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/docs/options_guide.txt | 7 +- crawl-ref/settings/init.txt | 7 +- crawl-ref/source/delay.cc | 2 + crawl-ref/source/describe.cc | 78 ++++++++------ crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 6 +- crawl-ref/source/misc.cc | 12 ++- crawl-ref/source/mon-data.h | 2 +- crawl-ref/source/mon-util.cc | 7 +- crawl-ref/source/mon-util.h | 3 +- crawl-ref/source/monstuff.cc | 2 + crawl-ref/source/notes.cc | 14 +++ crawl-ref/source/notes.h | 1 + crawl-ref/source/xom.cc | 222 ++++++++++++++++++++------------------- 14 files changed, 209 insertions(+), 155 deletions(-) diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt index 43aeb37c8d..29fe06c45d 100644 --- a/crawl-ref/docs/options_guide.txt +++ b/crawl-ref/docs/options_guide.txt @@ -104,7 +104,7 @@ The contents of this text are: user_note_prefix, note_items, note_monsters, ood_interesting, note_hp_percent, note_skill_levels, note_all_skill_levels, note_skill_max, note_all_spells, - note_messages + note_xom_effects, note_messages 6- Miscellaneous. 6-a All OS. mouse_input, wiz_mode, char_set, classic_item_colours, @@ -1785,7 +1785,7 @@ note_all_skill_levels = false This is a shortcut for note_skill_levels = 1,2,..,27. If you set this to true, all skill levels are considered noteworthy. -note_skill_max = false +note_skill_max = true Setting this option will cause a note whenever a new maximum in skill levels is reached. If note_skill_max is true and note_skill_levels is nonempty, notes will be taken whenever @@ -1794,6 +1794,9 @@ note_skill_max = false note_all_spells = true Will add a note for each spell memorised. +note_xom_effects = true + This will add a note whenever Xom does something. + note_messages = Messages which match an item in this comma-separated list are considered interesting. You can have multiple note_messages diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt index ddf4d4daf4..327c139efb 100644 --- a/crawl-ref/settings/init.txt +++ b/crawl-ref/settings/init.txt @@ -363,9 +363,10 @@ include = tiles_options.txt ood_interesting = 8 note_hp_percent = 5 note_skill_levels = 1,5,10,15,27 -note_all_skill_levels = true -note_skill_max = true -note_all_spells = true +#note_all_skill_levels = true +#note_skill_max = false +#note_all_spells = false +#note_xom_effects = false note_items = rod of, acquirement, preservation, running, of Zot note_messages = You pass through the gate note_messages = cast .* Abyss diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 67ccf979aa..3c5083ba5b 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1577,6 +1577,8 @@ void armour_wear_effects(const int item_slot) god_type god; if (origin_is_god_gift(arm, &god) && god == GOD_XOM) amusement *= 2; + + xom_is_stimulated(amusement); } } 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)) { diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index e94cc0c68c..ed71617376 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1987,6 +1987,7 @@ public: bool note_all_spells; // take note when learning any spell std::string user_note_prefix; // Prefix for user notes int note_hp_percent; // percentage hp for notetaking + bool note_xom_effects; // take note of all Xom effects int ood_interesting; // how many levels OOD is noteworthy? int rare_interesting; // what monster rarity is noteworthy? confirm_level_type easy_confirm; // make yesno() confirming easier diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 592a237440..8f09c0597e 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -745,8 +745,9 @@ void game_options::reset_options() user_note_prefix = ""; note_all_skill_levels = false; - note_skill_max = false; - note_all_spells = false; + note_skill_max = true; + note_all_spells = true; + note_xom_effects = true; note_hp_percent = 5; ood_interesting = 8; rare_interesting = 9; @@ -2463,6 +2464,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) else BOOL_OPTION(note_all_skill_levels); else BOOL_OPTION(note_skill_max); else BOOL_OPTION(note_all_spells); + else BOOL_OPTION(note_xom_effects); else BOOL_OPTION(delay_message_clear); else if (key == "flush") { diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 72edbf9402..a40e3c5457 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -82,8 +82,10 @@ REVISION("$Rev$"); #include "view.h" #include "xom.h" -static void _create_monster_hide(int mons_class) +static void _create_monster_hide(const item_def corpse) { + int mons_class = corpse.plus; + int o = get_item_slot(); if (o == NON_ITEM) return; @@ -118,6 +120,10 @@ static void _create_monster_hide(int mons_class) break; } + int mtype = corpse.orig_monnum - 1; + if (!invalid_monster_class(mtype) && mons_is_unique(mtype)) + item.inscription = mons_type_name(mtype, DESC_PLAIN); + move_item_to_grid(&o, you.pos()); } @@ -163,7 +169,7 @@ void turn_corpse_into_chunks(item_def &item) // Happens after the corpse has been butchered. if (monster_descriptor(item.plus, MDSC_LEAVES_HIDE) && !one_chance_in(3)) - _create_monster_hide(item.plus); + _create_monster_hide(item); } void turn_corpse_into_skeleton_and_chunks(item_def &item) @@ -896,7 +902,7 @@ void turn_corpse_into_blood_potions(item_def &item) // Happens after the blood has been bottled. if (monster_descriptor(mons_class, MDSC_LEAVES_HIDE) && !one_chance_in(3)) - _create_monster_hide(mons_class); + _create_monster_hide(item); } void turn_corpse_into_skeleton_and_blood_potions(item_def &item) diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index 6d71a3fe18..d9a0e2d6e5 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -3798,7 +3798,7 @@ static monsterentry mondata[] = { }, // major demons ('&') -// random demon in pan - only one per level. stats are stored in ghost struct +// random demon in pan - only one per level. Stats are stored in ghost struct. { MONS_PANDEMONIUM_DEMON, '&', BLACK, "pandemonium lord", M_FIGHTER | M_SPELLCASTER | M_SPEAKS | M_EVIL, diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 23299ce6ff..5bb8f85e37 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1494,7 +1494,7 @@ flight_type mons_class_flies(int mc) return (FL_NONE); } -flight_type mons_flies(const monsters *mon) +flight_type mons_flies(const monsters *mon, bool randarts) { if (mons_enslaved_twisted_soul(mon)) return (FL_LEVITATE); @@ -1512,8 +1512,11 @@ flight_type mons_flies(const monsters *mon) if (ret == FL_NONE && mons_is_zombified(mon)) ret = mons_class_flies(mon->type); - if (ret == FL_NONE && _scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) + if (randarts && ret == FL_NONE + && _scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) + { ret = FL_LEVITATE; + } return (ret); } diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 9bd0ce27d3..aa33a1e56b 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -452,6 +452,7 @@ habitat_type grid2habitat(dungeon_feature_type grid); dungeon_feature_type habitat2grid(habitat_type ht); monsterentry *get_monster_data(int p_monsterid); +const mon_resist_def &get_mons_class_resists(int mc); mon_resist_def get_mons_resists(const monsters *mon); // last updated 10jun2000 {dlb} @@ -473,7 +474,7 @@ bool give_monster_proper_name(monsters *mon, bool orcs_only = true); * called from: beam - direct - fight - monstuff - mstuff2 - spells4 - view * *********************************************************************** */ flight_type mons_class_flies(int mc); -flight_type mons_flies(const monsters *mon); +flight_type mons_flies(const monsters *mon, bool randarts = true); bool mons_class_amphibious(int mc); bool mons_amphibious(const monsters *mon); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index edee201177..1a96b717da 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -374,8 +374,10 @@ int fill_out_corpse(const monsters* monster, item_def& corpse, if (!monster->mname.empty()) corpse.props[CORPSE_NAME_KEY] = monster->mname; else if (mons_is_unique(monster->type)) + { corpse.props[CORPSE_NAME_KEY] = mons_type_name(monster->type, DESC_PLAIN); + } return (corpse_class); } diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc index b7e1cc3c38..c30efe3706 100644 --- a/crawl-ref/source/notes.cc +++ b/crawl-ref/source/notes.cc @@ -140,6 +140,10 @@ static bool _is_noteworthy( const Note& note ) return (false); } + // Xom effects are only noteworthy if the option is true. + if (note.type == NOTE_XOM_EFFECT) + return (Options.note_xom_effects); + // God powers might be noteworthy if it's an actual power. if (note.type == NOTE_GOD_POWER && _real_god_power(note.first, note.second) == -1) @@ -374,6 +378,16 @@ std::string Note::describe( bool when, bool where, bool what ) const case NOTE_SEEN_FEAT: result << "Found " << name; break; + case NOTE_XOM_EFFECT: + result << "XOM: " << name; +#if defined(DEBUG_XOM) || defined(NOTE_DEBUG_XOM) + // If debugging, also take note of piety and tension. + result << " (piety: " << first; + if (second >= 0) + result << ", tension: " << second; + result << ")"; +#endif + break; default: result << "Buggy note description: unknown note type"; break; diff --git a/crawl-ref/source/notes.h b/crawl-ref/source/notes.h index 3232bd5b08..1796228e85 100644 --- a/crawl-ref/source/notes.h +++ b/crawl-ref/source/notes.h @@ -47,6 +47,7 @@ enum NOTE_TYPES NOTE_BUY_ITEM, /* needs: item name (string), price (int) */ NOTE_DONATE_MONEY, /* needs: amount of gold */ NOTE_SEEN_FEAT, /* needs: feature seen (string) */ + NOTE_XOM_EFFECT, /* needs: description (name string) */ NOTE_NUM_TYPES }; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 1c5af19b4a..1c0012ac01 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -26,6 +26,7 @@ REVISION("$Rev$"); #include "monplace.h" #include "monstuff.h" #include "mutation.h" +#include "notes.h" #include "ouch.h" #include "player.h" #include "randart.h" @@ -50,11 +51,6 @@ REVISION("$Rev$"); # define NOTE_DEBUG_XOM 1 #endif -#define NOTE_DEBUG_XOM -#ifdef NOTE_DEBUG_XOM -#include "notes.h" -#endif - #ifdef DEBUG_RELIGION # define DEBUG_DIAGNOSTICS 1 # define DEBUG_GIFTS 1 @@ -514,12 +510,11 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension) spell, spellenum); #endif -#ifdef NOTE_DEBUG_XOM static char spell_buf[100]; - snprintf(spell_buf, sizeof(spell_buf), "XOM: cast spell '%s' (tension %d)", - spell_title(spell), tension); - take_note(Note(NOTE_MESSAGE, 0, 0, spell_buf), true); -#endif + snprintf(spell_buf, sizeof(spell_buf), "cast spell '%s'", + spell_title(spell)); + take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, spell_buf), true); + your_spells(spell, sever, false); return (true); } @@ -582,17 +577,15 @@ static void _xom_make_item(object_class_type base, int subtype, int power) _try_brand_switch(thing_created); + static char gift_buf[100]; + snprintf(gift_buf, sizeof(gift_buf), "god gift: %s", + mitm[thing_created].name(DESC_PLAIN).c_str()); + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, gift_buf), true); + move_item_to_grid(&thing_created, you.pos()); mitm[thing_created].inscription = "god gift"; canned_msg(MSG_SOMETHING_APPEARS); -#ifdef NOTE_DEBUG_XOM - static char gift_buf[100]; - snprintf(gift_buf, sizeof(gift_buf), "XOM: god gift: %s", - mitm[thing_created].name(DESC_PLAIN).c_str()); - take_note(Note(NOTE_MESSAGE, 0, 0, gift_buf), true); -#endif - stop_running(); } @@ -611,12 +604,10 @@ static void _xom_acquirement(object_class_type force_class) _try_brand_switch(item_index); -#ifdef NOTE_DEBUG_XOM static char gift_buf[100]; - snprintf(gift_buf, sizeof(gift_buf), "XOM: god gift: %s", + snprintf(gift_buf, sizeof(gift_buf), "god gift: %s", mitm[item_index].name(DESC_PLAIN).c_str()); - take_note(Note(NOTE_MESSAGE, 0, 0, gift_buf), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, gift_buf), true); stop_running(); } @@ -1063,8 +1054,8 @@ static bool _xom_do_potion() if (pot == POT_BERSERK_RAGE) you.berserk_penalty = NO_BERSERK_PENALTY; -#ifdef NOTE_DEBUG_XOM - std::string potion_msg = "XOM: potion effect "; + // Take a note. + std::string potion_msg = "potion effect "; switch (pot) { case POT_HEALING: potion_msg += "(healing)"; break; @@ -1076,8 +1067,9 @@ static bool _xom_do_potion() case POT_EXPERIENCE: potion_msg += "(experience)"; break; default: potion_msg += "(other)"; break; } - take_note(Note(NOTE_MESSAGE, 0, 0, potion_msg.c_str()), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, + potion_msg.c_str()), true); + potion_effect(pot, 150); rc = true; @@ -1112,10 +1104,12 @@ static bool _xom_confuse_monsters(int sever) rc = true; } } -#ifdef NOTE_DEBUG_XOM + if (rc == true) - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: confuse monster(s)"), true); -#endif + { + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "confuse monster(s)"), + true); + } return (rc); } @@ -1218,16 +1212,15 @@ static bool _xom_send_allies(int sever) player_angers_monster(mon); } -#ifdef NOTE_DEBUG_XOM + // Take a note. static char summ_buf[80]; - snprintf(summ_buf, sizeof(summ_buf), "XOM: summons %d %s%s%s", + snprintf(summ_buf, sizeof(summ_buf), "summons %d %s%s%s", num_actually_summoned, hostiletype == 0 ? "friendly " : hostiletype == 3 ? "hostile " : "", only_demonic ? "demon" : "monster", num_actually_summoned > 1 ? "s" : ""); - take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); rc = true; } @@ -1266,13 +1259,12 @@ static bool _xom_send_one_ally(int sever) player_angers_monster(&menv[summons]); -#ifdef NOTE_DEBUG_XOM + // Take a note. static char summ_buf[80]; - snprintf(summ_buf, sizeof(summ_buf), "XOM: summons %s %s", + snprintf(summ_buf, sizeof(summ_buf), "summons %s %s", beha == BEH_FRIENDLY ? "friendly" : "hostile", menv[summons].name(DESC_PLAIN).c_str()); - take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); rc = true; } @@ -1293,9 +1285,9 @@ static bool _xom_polymorph_nearby_monster(bool helpful) : "bad monster polymorph"); god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str()); -#ifdef NOTE_DEBUG_XOM + bool see_old = you.can_see(mon); std::string old_name = mon->full_name(DESC_PLAIN); -#endif + if (one_chance_in(8) && !mons_is_shapeshifter(mon)) { mon->add_ench(one_chance_in(3) ? ENCH_GLOWING_SHAPESHIFTER @@ -1306,13 +1298,30 @@ static bool _xom_polymorph_nearby_monster(bool helpful) monster_polymorph(mon, RANDOM_MONSTER, powerup ? PPT_MORE : PPT_LESS); + bool see_new = you.can_see(mon); + + if (see_old || see_new) + { + std::string new_name = mon->full_name(DESC_PLAIN); + if (!see_old) + old_name = "something unseen"; + else if (!see_new) + new_name = "something unseen"; + + // Take a note. + static char poly_buf[120]; + snprintf(poly_buf, sizeof(poly_buf), "polymorph %s -> %s", + old_name.c_str(), new_name.c_str()); + + std::string poly = poly_buf; #ifdef NOTE_DEBUG_XOM - static char poly_buf[120]; - snprintf(poly_buf, sizeof(poly_buf), "XOM: polymorph %s -> %s (%s)", - old_name.c_str(), mon->full_name(DESC_PLAIN).c_str(), - powerup ? "upgrade" : "downgrade"); - take_note(Note(NOTE_MESSAGE, 0, 0, poly_buf), true); + poly += " ("; + poly += (powerup ? "upgrade" : "downgrade"); + poly += ")"; #endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, poly.c_str()), + true); + } rc = true; } } @@ -1436,9 +1445,7 @@ static bool _xom_rearrange_pieces(int sever) } } } -#ifdef NOTE_DEBUG_XOM - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: swap monsters"), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "swap monsters"), true); return (true); } @@ -1454,12 +1461,15 @@ static bool _xom_give_mutations(bool good) god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str()); const int num_tries = random2(4) + 1; -#ifdef NOTE_DEBUG_XOM + static char mut_buf[80]; - snprintf(mut_buf, sizeof(mut_buf), "XOM: give %s mutation%s", - good ? "good" : "random", num_tries > 1 ? "s" : ""); - take_note(Note(NOTE_MESSAGE, 0, 0, mut_buf), true); + snprintf(mut_buf, sizeof(mut_buf), "give %smutations", +#ifdef NOTE_DEBUG_XOM + good ? "good " : "random "); +#else + ""); #endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, mut_buf), true); mpr("Your body is suffused with distortional energy."); @@ -1517,13 +1527,12 @@ static bool _xom_send_major_ally(int sever) player_angers_monster(&menv[summons]); -#ifdef NOTE_DEBUG_XOM + // Take a note. static char summ_buf[80]; - snprintf(summ_buf, sizeof(summ_buf), "XOM: sends permanent %s %s", + snprintf(summ_buf, sizeof(summ_buf), "sends permanent %s %s", beha == BEH_FRIENDLY ? "friendly" : "hostile", menv[summons].name(DESC_PLAIN).c_str()); - take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); rc = true; } @@ -1592,12 +1601,12 @@ static bool _xom_throw_divine_lightning() you.hp = 1; you.reset_escaped_death(); } -#ifdef NOTE_DEBUG_XOM + + // Take a note. static char lightning_buf[80]; snprintf(lightning_buf, sizeof(lightning_buf), - "XOM: divine lightning%s", protection ? " (protected)" : ""); - take_note(Note(NOTE_MESSAGE, 0, 0, lightning_buf), true); -#endif + "divine lightning%s", protection ? " (protected)" : ""); + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, lightning_buf), true); return (true); } @@ -1673,13 +1682,15 @@ static bool _xom_is_good(int sever, int tension) while (x_chance_in_y(3, 4) || player_in_a_dangerous_place()); maybe_update_stashes(); -#ifdef NOTE_DEBUG_XOM + // Take a note. static char tele_buf[80]; snprintf(tele_buf, sizeof(tele_buf), - "XOM: %d-stop teleportation journey%s", - count, (player_in_a_dangerous_place() ? " (dangerous)" : "")); - take_note(Note(NOTE_MESSAGE, 0, 0, tele_buf), true); + "XOM: %d-stop teleportation journey%s", count, +#ifdef NOTE_DEBUG_XOM + player_in_a_dangerous_place() ? " (dangerous)" : // see below #endif + ""); + take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, tele_buf), true); done = true; } else if (random2(tension) < 5 && x_chance_in_y(12, sever)) @@ -1688,9 +1699,8 @@ static bool _xom_is_good(int sever, int tension) if (vitrify_area(random2avg(sever/4,2) + 1)) { god_speaks(GOD_XOM, _get_xom_speech("vitrification").c_str()); -#ifdef NOTE_DEBUG_XOM - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: vitrification"), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, + "vitrification"), true); done = true; } } @@ -2112,12 +2122,15 @@ static void _xom_miscast(const int max_level, const bool nasty) const int level = random2(max_level + 1); + // Take a note. + std::string desc = "miscast effect"; #ifdef NOTE_DEBUG_XOM - static char miscast_buf[80]; - snprintf(miscast_buf, sizeof(miscast_buf), "XOM: level %d miscast effect %s", - level, nasty ? "(nasty)" : ""); - take_note(Note(NOTE_MESSAGE, 0, 0, miscast_buf), true); + static char level_buf[20]; + snprintf(level_buf, sizeof(level_buf), " level %d%s", + level, (nasty ? " (nasty)" : "")); + desc += level_buf; #endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, desc.c_str()), true); if (level == 0 && one_chance_in(20)) { @@ -2173,17 +2186,18 @@ static bool _xom_lose_stats() const int loss = 1 + random2(max); lose_stat(stat, loss, true, "the vengeance of Xom" ); -#ifdef NOTE_DEBUG_XOM + // Take a note. static char stat_buf[80]; - snprintf(stat_buf, sizeof(stat_buf), "XOM: stat loss: -%d %s (%d/%d)", + snprintf(stat_buf, sizeof(stat_buf), "stat loss: -%d %s (%d/%d)", loss, (stat == STAT_STRENGTH ? "Str" : stat == STAT_DEXTERITY ? "Dex" : "Int"), (stat == STAT_STRENGTH ? you.strength : stat == STAT_DEXTERITY ? you.dex : you.intel), (stat == STAT_STRENGTH ? you.max_strength : stat == STAT_DEXTERITY ? you.max_dex : you.max_intel)); - take_note(Note(NOTE_MESSAGE, 0, 0, stat_buf), true); -#endif + + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, stat_buf), true); + return (true); } @@ -2213,10 +2227,9 @@ static bool _xom_chaos_upgrade_nearby_monster() // Wake the monster up. behaviour_event(mon, ME_ALERT, MHITYOU); -#ifdef NOTE_DEBUG_XOM + if (rc) - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: chaos upgrade monster"), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "chaos upgrade"), true); return (rc); } @@ -2258,12 +2271,12 @@ static bool _xom_player_confusion_effect(int sever) mons_too = true; } } -#ifdef NOTE_DEBUG_XOM - std::string conf_msg = "XOM: confusion"; + + // Take a note. + std::string conf_msg = "confusion"; if (mons_too) conf_msg += " (+ monsters)"; - take_note(Note(NOTE_MESSAGE, 0, 0, conf_msg.c_str()), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, conf_msg.c_str()), true); } return (rc); @@ -2481,10 +2494,8 @@ static bool _repel_stairs() else canned_msg(MSG_NOTHING_HAPPENS); } - -#ifdef NOTE_DEBUG_XOM - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: repel stairs"), true); -#endif + else + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "repel stairs"), true); return (true); } @@ -2508,9 +2519,7 @@ static bool _xom_draining_torment_effect(int sever) if (random2(sever) > 3 && (nasty || you.experience > 0)) drain_exp(); -#ifdef NOTE_DEBUG_XOM - take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: draining"), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "draining"), true); rc = true; } } @@ -2521,12 +2530,13 @@ static bool _xom_draining_torment_effect(int sever) { god_speaks(GOD_XOM, speech.c_str()); torment_player(0, TORMENT_XOM); -#ifdef NOTE_DEBUG_XOM + + // Take a note. static char torment_buf[80]; snprintf(torment_buf, sizeof(torment_buf), - "XOM: torment (%d/%d hp)", you.hp, you.hp_max); - take_note(Note(NOTE_MESSAGE, 0, 0, torment_buf), true); -#endif + "torment (%d/%d hp)", you.hp, you.hp_max); + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, torment_buf), true); + rc = true; } } @@ -2545,15 +2555,13 @@ static bool _xom_summon_hostiles(int sever) const std::string wep_name = weapon.name(DESC_PLAIN); rc = cast_tukimas_dance(100, GOD_XOM, true); -#ifdef NOTE_DEBUG_XOM if (rc) { static char wpn_buf[80]; snprintf(wpn_buf, sizeof(wpn_buf), - "XOM: animates weapon (%s)", wep_name.c_str()); - take_note(Note(NOTE_MESSAGE, 0, 0, wpn_buf), true); + "animates weapon (%s)", wep_name.c_str()); + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, wpn_buf), true); } -#endif } else { @@ -2579,13 +2587,12 @@ static bool _xom_summon_hostiles(int sever) if (num_summoned > 0) { -#ifdef NOTE_DEBUG_XOM static char summ_buf[80]; snprintf(summ_buf, sizeof(summ_buf), - "XOM: summons %d hostile demon%s", + "summons %d hostile demon%s", num_summoned, num_summoned > 1 ? "s" : ""); - take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true); -#endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); + rc = true; } } @@ -2662,13 +2669,17 @@ static bool _xom_is_bad(int sever, int tension) badness = player_in_a_dangerous_place() ? 3 : 1; maybe_update_stashes(); -#ifdef NOTE_DEBUG_XOM + // Take a note. static char tele_buf[80]; snprintf(tele_buf, sizeof(tele_buf), - "XOM: %d-stop teleportation journey%s", - count, (badness == 3 ? " (dangerous)" : "")); - take_note(Note(NOTE_MESSAGE, 0, 0, tele_buf), true); + "%d-stop teleportation journey%s", count, +#ifdef NOTE_DEBUG_XOM + badness == 3 ? " (dangerous)" : ""); +#else + ""); #endif + take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, tele_buf), + true); done = true; } else if (x_chance_in_y(8, sever)) @@ -2716,6 +2727,7 @@ static bool _xom_is_bad(int sever, int tension) else if (one_chance_in(sever) && you.level_type != LEVEL_ABYSS) { god_speaks(GOD_XOM, _get_xom_speech("banishment").c_str()); + // handles note taking banished(DNGN_ENTER_ABYSS, "Xom"); badness = 5; done = true; @@ -2947,8 +2959,7 @@ void xom_acts(bool niceness, int sever, int tension) } else { -#ifdef NOTE_DEBUG_XOM - if (was_bored) + if (was_bored && Options.note_xom_effects) take_note(Note(NOTE_MESSAGE, 0, 0, "XOM is BORED!"), true); #ifdef DEBUG_XOM else if (niceness) @@ -2956,7 +2967,6 @@ void xom_acts(bool niceness, int sever, int tension) take_note(Note(NOTE_MESSAGE, 0, 0, "good act randomly turned bad"), true); } -#endif #endif // Bad mojo. -- cgit v1.2.3-54-g00ecf