diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/describe.cc | 46 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/spells2.h | 7 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 2 |
5 files changed, 50 insertions, 18 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index fbb6e7c39f..b725f8b10f 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2590,6 +2590,48 @@ static std::string _describe_draconian(const monsters *mon) return (description); } +// Return a string of the form "She is resistant to fire." +static std::string _resistance_description(const char* pronoun, + int level, const char* attackname) +{ + const char* modifiers[] = { + "susceptible", // -1 + "resistant", // +1 + "very resistant", // +2 + "extremely resistant" // +3 + }; + std::string result; + + if (level != 0) + { + const int offset = (level < 0) ? 0 : std::min(level, 3); + + result = pronoun; + result += " is "; + result += modifiers[offset]; + result += " to "; + result += attackname; + result += ".$"; + } + return result; +} + +static std::string _monster_resists_string(const monsters& mon) +{ + const mon_resist_def resist = get_mons_resists(&mon); + const char* pronoun = mons_pronoun(static_cast<monster_type>(mon.type), + PRONOUN_CAP, true); + std::string result; + // Not shown: hellfire, asphyxiation, sticky flames. + result += _resistance_description(pronoun, resist.elec, "electricity"); + result += _resistance_description(pronoun, resist.poison, "poison"); + result += _resistance_description(pronoun, resist.fire, "fire"); + result += _resistance_description(pronoun, resist.steam, "steam"); + result += _resistance_description(pronoun, resist.cold, "cold"); + result += _resistance_description(pronoun, resist.acid, "acid"); + return result; +} + //--------------------------------------------------------------- // // describe_monsters @@ -2729,6 +2771,10 @@ void describe_monsters(const monsters& mons) break; } + // Don't leak or duplicate resistance information for ghosts/demons. + if (mons.type != MONS_PANDEMONIUM_DEMON && mons.type != MONS_PLAYER_GHOST) + body << _monster_resists_string(mons); + if (!mons_can_use_stairs(&mons)) { body << "$" << mons_pronoun(static_cast<monster_type>(mons.type), diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 9d280a6cfc..34a6f79b87 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -451,6 +451,7 @@ habitat_type grid2habitat(dungeon_feature_type grid); dungeon_feature_type habitat2grid(habitat_type ht); monsterentry *get_monster_data(int p_monsterid); +mon_resist_def get_mons_resists(const monsters *mon); // last updated 10jun2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 48ff558ec8..55deaf7c8a 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -78,9 +78,6 @@ int detect_traps( int pow ) int detect_items( int pow ) { - if (pow > 50) - pow = 50; - int items_found = 0; const int map_radius = 8 + random2(8) + pow; @@ -191,9 +188,6 @@ int detect_creatures( int pow, bool telepathic ) if (!telepathic) _fuzz_detect_creatures(pow, &fuzz_radius, &fuzz_chance); - if (pow > 50) - pow = 50; - int creatures_found = 0; const int map_radius = 8 + random2(8) + pow; @@ -224,10 +218,8 @@ int detect_creatures( int pow, bool telepathic ) return (creatures_found); } -int corpse_rot(int pow) +void corpse_rot() { - UNUSED(pow); - for (radius_iterator ri(you.pos(), 6); ri; ++ri) { if (see_grid_no_trans(*ri) && !is_sanctuary(*ri) @@ -256,8 +248,6 @@ int corpse_rot(int pow) mpr("You smell decay."); // Should make zombies decay into skeletons? - - return (0); } bool brand_weapon(brand_type which_brand, int power) diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index f3f03486c4..1ef58c5818 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -27,12 +27,7 @@ bool brand_weapon(brand_type which_brand, int power); * *********************************************************************** */ bool burn_freeze(int pow, beam_type flavour, int targetmon); - -// last updated 24may2000 {dlb} -/* *********************************************************************** - * called from: spell - * *********************************************************************** */ -int corpse_rot(int pow); +void corpse_rot(); struct dist; diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index b7a7fb83d5..56bc4b7e4b 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -2108,7 +2108,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) break; case SPELL_CORPSE_ROT: - corpse_rot(0); + corpse_rot(); break; case SPELL_FULSOME_DISTILLATION: |