From 6154ce26f08678558f0e59dc19506bd5af6eeb9c Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 19 Apr 2009 11:48:04 +0000 Subject: * Properly print (non-spoily) resists descriptions for ghosts/pandemonium lords, using mons_class_resists (currently only poison) instead of mons_resists(). * Add option note_xom_effects (defaults to true) that causes note-taking for all Xom effects, hopefully spoiler free. * Autoinscribe hides from unique monsters' corpses with the monster name, as suggested on rgrm. Currently only applies to Snorg and Tiamat. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9652 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 78 ++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 35 deletions(-) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index b04ca94afe..cc750337a6 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2602,7 +2602,14 @@ static const char* _get_resist_name(mon_resist_flags res_type) // attributes. static std::string _monster_stat_description(const monsters& mon) { - const mon_resist_def resist = get_mons_resists(&mon); + std::ostringstream result; + + // Don't leak or duplicate resistance information for ghosts/demons. + const mon_resist_def resist = + (mon.type == MONS_PANDEMONIUM_DEMON + || mon.type == MONS_PLAYER_GHOST ? get_mons_class_resists(mon.type) + : get_mons_resists(&mon)); + const mon_resist_flags resists[] = { MR_RES_ELEC, MR_RES_POISON, MR_RES_FIRE, MR_RES_STEAM, MR_RES_COLD, MR_RES_ACID @@ -2642,9 +2649,6 @@ static std::string _monster_stat_description(const monsters& mon) } } - const char* pronoun = mons_pronoun(static_cast(mon.type), - PRONOUN_CAP, true); - std::vector resist_descriptions; if (!extreme_resists.empty()) { @@ -2666,7 +2670,8 @@ static std::string _monster_stat_description(const monsters& mon) resist_descriptions.push_back(tmp); } - std::ostringstream result; + const char* pronoun = mons_pronoun(static_cast(mon.type), + PRONOUN_CAP, true); if (!resist_descriptions.empty()) { @@ -2690,31 +2695,37 @@ static std::string _monster_stat_description(const monsters& mon) result << pronoun << " is immune to magical enchantments.$"; // Seeing/sensing invisible. - if (mons_class_flag(mon.type, M_SEE_INVIS)) - result << pronoun << " can see invisible.$"; - else if (mons_class_flag(mon.type, M_SENSE_INVIS)) - result << pronoun << " can sense the presence of invisible creatures.$"; - - // Unusual monster speed. - const int speed = mons_base_speed(&mon); - if (speed != 10) - { - result << pronoun << " is "; - if (speed < 7) - result << "very slow"; - else if (speed < 10) - result << "slow"; - else if (speed > 20) - result << "extremely fast"; - else if (speed > 15) - result << "very fast"; - else if (speed > 10) - result << "fast"; - result << ".$"; + if (mon.type != MONS_PANDEMONIUM_DEMON && mon.type != MONS_PLAYER_GHOST) + { + if (mons_class_flag(mon.type, M_SEE_INVIS)) + result << pronoun << " can see invisible.$"; + else if (mons_class_flag(mon.type, M_SENSE_INVIS)) + result << pronoun << " can sense the presence of invisible creatures.$"; + + // Unusual monster speed. + const int speed = mons_base_speed(&mon); + if (speed != 10) + { + result << pronoun << " is "; + if (speed < 7) + result << "very slow"; + else if (speed < 10) + result << "slow"; + else if (speed > 20) + result << "extremely fast"; + else if (speed > 15) + result << "very fast"; + else if (speed > 10) + result << "fast"; + result << ".$"; + } } // Can the monster levitate/fly? - const flight_type fly = mons_flies(&mon); + // This doesn't give anything away since all ghosts can fly, and + // for demons it's already mentioned in their flavour description. + const flight_type fly = mons_flies(&mon, false); + if (fly != FL_NONE) { result << pronoun << " can " @@ -2848,7 +2859,7 @@ void get_monster_db_desc(const monsters& mons, describe_info &inf, break; case MONS_PANDEMONIUM_DEMON: - inf.body << _describe_demon(mons); + inf.body << _describe_demon(mons) << "$"; break; case MONS_URUG: @@ -2866,13 +2877,10 @@ void get_monster_db_desc(const monsters& mons, describe_info &inf, break; } - // Don't leak or duplicate resistance information for demons. - if (mons.type != MONS_PANDEMONIUM_DEMON) - { - std::string result = _monster_stat_description(mons); - if (!result.empty()) - inf.body << "$" << result; - } + // Get information on resistances, speed, etc. + std::string result = _monster_stat_description(mons); + if (!result.empty()) + inf.body << "$" << result; if (!mons_can_use_stairs(&mons)) { -- cgit v1.2.3-54-g00ecf