diff options
-rw-r--r-- | crawl-ref/source/food.cc | 64 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 2 |
4 files changed, 37 insertions, 37 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index b392fce971..736b5de852 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -1509,16 +1509,8 @@ int prompt_eat_chunks() return (0); // If we *know* player doesn't have the gourmand effect, don't prompt. - if (!player_mutation_level(MUT_GOURMAND) - && player_mutation_level(MUT_CARNIVOROUS) < 3) - { - if (!player_wearing_slot(EQ_AMULET)) - return (0); - - const item_def& amu(you.inv[you.equip[EQ_AMULET]]); - if (item_type_known(amu) && amu.sub_type != AMU_THE_GOURMAND) - return (0); - } + if (!player_likes_chunks(true)) + return (0); bool found_valid = false; std::vector<item_def *> chunks; @@ -1574,7 +1566,7 @@ int prompt_eat_chunks() const bool easy_eat = Options.easy_eat_chunks && !you.is_undead; const bool easy_contam = easy_eat - && (Options.easy_eat_gourmand && wearing_amulet(AMU_THE_GOURMAND) + && (Options.easy_eat_gourmand && you.duration[DUR_GOURMAND] > 0 || Options.easy_eat_contaminated); if (found_valid) @@ -1719,9 +1711,7 @@ static int _chunk_nutrition(bool likes_chunks) : apply_herbivore_nutrition_effects(nutrition)); } - const int gourmand = - wearing_amulet(AMU_THE_GOURMAND) ? you.duration[DUR_GOURMAND] : 0; - + const int gourmand = you.duration[DUR_GOURMAND]; const int effective_nutrition = _apply_gourmand_nutrition_effects(nutrition, gourmand); @@ -2492,6 +2482,29 @@ bool is_forbidden_food(const item_def &food) return (false); } +static bool _check_amu_the_gourmand(bool reqid) +{ + if (wearing_amulet(AMU_THE_GOURMAND, !reqid)) + { + const int amulet = you.equip[EQ_AMULET]; + + ASSERT(amulet != -1); + + if (!item_type_known(you.inv[amulet])) + { + // For artefact amulets, this will tell you its name and + // subtype. Other properties may still be hidden. + set_ident_flags(you.inv[amulet], ISFLAG_KNOW_TYPE); + set_ident_type(OBJ_JEWELLERY, AMU_THE_GOURMAND, ID_KNOWN_TYPE); + mpr(you.inv[amulet].name(DESC_INVENTORY, false).c_str()); + } + + return (true); + } + + return (false); +} + bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid, bool check_hunger) { @@ -2575,24 +2588,8 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, if (ur_chunkslover) return (true); - // Else, we're not hungry enough. - if (wearing_amulet(AMU_THE_GOURMAND, !reqid)) - { - const int amulet = you.equip[EQ_AMULET]; - - ASSERT(amulet != -1); - - if (!item_type_known(you.inv[amulet])) - { - // For artefact amulets, this will tell you its name - // and subtype. Other properties may still be hidden. - set_ident_flags(you.inv[amulet], ISFLAG_KNOW_TYPE); - set_ident_type(OBJ_JEWELLERY, AMU_THE_GOURMAND, - ID_KNOWN_TYPE); - mpr(you.inv[amulet].name(DESC_INVENTORY, false).c_str()); - } + if (_check_amu_the_gourmand(reqid)) return (true); - } if (!suppress_msg) mpr("You aren't quite hungry enough to eat that!"); @@ -2603,6 +2600,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, // rations for non-herbivores) are okay. return (true); } + case OBJ_CORPSES: if (you.species == SP_VAMPIRE) { @@ -2654,6 +2652,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, return (false); } default: + _check_amu_the_gourmand(reqid); return (true); } @@ -2752,8 +2751,7 @@ static corpse_effect_type _determine_chunk_effect(corpse_effect_type chunktype, // contaminated meat as though it were "clean" meat - level 3 // saprovores get rotting meat effect from clean chunks, since they // love rotting meat. - if (wearing_amulet(AMU_THE_GOURMAND) - && x_chance_in_y(you.duration[DUR_GOURMAND], GOURMAND_MAX)) + if (x_chance_in_y(you.duration[DUR_GOURMAND], GOURMAND_MAX)) { if (player_mutation_level(MUT_SAPROVOROUS) == 3) { diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 434b5dc504..7022b53ef7 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -2030,7 +2030,8 @@ static std::vector<formatted_string> _get_overview_resistances( int saplevel = player_mutation_level(MUT_SAPROVOROUS); const char* pregourmand; const char* postgourmand; - if ( wearing_amulet(AMU_THE_GOURMAND, calc_unid) ) + + if (player_mutation_level(MUT_GOURMAND) || you.duration[DUR_GOURMAND] > 0) { pregourmand = "Gourmand : "; postgourmand = itosym1(1); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 2bf3a2170f..15abd4d22b 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1292,10 +1292,11 @@ bool player_can_smell() return (you.species != SP_MUMMY); } -bool player_likes_chunks() +bool player_likes_chunks(bool permanently) { return (player_mutation_level(MUT_GOURMAND) - || player_mutation_level(MUT_CARNIVOROUS) > 0); + || player_mutation_level(MUT_CARNIVOROUS) > 0 + || (!permanently && you.duration[DUR_GOURMAND] > 0)); } // If temp is set to false, temporary sources or resistance won't be counted. diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 2ec0821269..bdc557bc09 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -174,7 +174,7 @@ bool player_item_conserve(bool calc_unid = true); int player_mental_clarity(bool calc_unid = true, bool items = true); bool player_can_smell(); -bool player_likes_chunks(); +bool player_likes_chunks(bool permanently = false); bool player_can_swim(); bool player_likes_water(bool permanently = false); |