summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/delay.cc56
-rw-r--r--crawl-ref/source/delay.h1
-rw-r--r--crawl-ref/source/fight.cc87
-rw-r--r--crawl-ref/source/mon-util.cc4
-rw-r--r--crawl-ref/source/monstuff.cc13
-rw-r--r--crawl-ref/source/mutation.cc6
-rw-r--r--crawl-ref/source/notes.cc3
-rw-r--r--crawl-ref/source/transfor.cc16
-rw-r--r--crawl-ref/source/transfor.h3
-rw-r--r--crawl-ref/source/xom.cc238
10 files changed, 362 insertions, 65 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index f0ec367717..5a47ce5e96 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1902,6 +1902,33 @@ inline static bool _monster_warning(activity_interrupt_type ai,
return (false);
}
+// Turns autopickup off if we ran into an invisible monster or saw a monster
+// turn invisible.
+// Turns autopickup on if we saw an invisible monster become visible or
+// killed an invisible monster.
+void autotoggle_autopickup(bool off)
+{
+ if (off)
+ {
+ if (Options.autopickup_on)
+ {
+ Options.autopickup_on = false;
+ mprf(MSGCH_WARN,
+ "Deactivating autopickup; reactivate with <w>Ctrl+A</w>.");
+ }
+ if (Options.tutorial_left)
+ {
+ learned_something_new(TUT_INVISIBLE_DANGER);
+ Options.tut_seen_invisible = you.num_turns;
+ }
+ }
+ else if (!Options.autopickup_on)
+ {
+ Options.autopickup_on = true;
+ mprf(MSGCH_WARN, "Reactivating autopickup.");
+ }
+}
+
static bool _paranoid_option_disable( activity_interrupt_type ai,
const activity_interrupt_data &at )
{
@@ -1909,34 +1936,7 @@ static bool _paranoid_option_disable( activity_interrupt_type ai,
{
const monsters* mon = static_cast<const monsters*>(at.data);
if (mon && !player_monster_visible(mon) && !mons_is_submerged(mon))
- {
- // Now that autoprayer has been removed the vectors aren't
- // really needed anymore, but let's keep them "just in case".
- std::vector<std::string> deactivatees;
- std::vector<std::string> restart;
-
- if (Options.autopickup_on)
- {
- deactivatees.push_back("autopickup");
- Options.autopickup_on = false;
- restart.push_back("Ctrl+A");
- }
-
- if (!deactivatees.empty())
- {
- mprf(MSGCH_WARN, "Deactivating %s; reactivate with %s.",
- comma_separated_line(deactivatees.begin(),
- deactivatees.end()).c_str(),
- comma_separated_line(restart.begin(),
- restart.end()).c_str());
- }
-
- if (Options.tutorial_left)
- {
- learned_something_new(TUT_INVISIBLE_DANGER);
- Options.tut_seen_invisible = you.num_turns;
- }
- }
+ autotoggle_autopickup(true);
return (true);
}
return (false);
diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h
index cafde33717..edc2868df0 100644
--- a/crawl-ref/source/delay.h
+++ b/crawl-ref/source/delay.h
@@ -91,6 +91,7 @@ activity_interrupt_type get_activity_interrupt(const std::string &);
const char *delay_name(int delay);
delay_type get_delay(const std::string &);
+void autotoggle_autopickup(bool off);
bool interrupt_activity( activity_interrupt_type ai,
const activity_interrupt_data &a
= activity_interrupt_data() );
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index f81078d91f..d92bc31dfe 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -62,6 +62,10 @@ REVISION("$Rev$");
#include "view.h"
#include "xom.h"
+#ifdef DEBUG_CHAOS
+#include "notes.h"
+#endif
+
const int HIT_WEAK = 7;
const int HIT_MED = 18;
const int HIT_STRONG = 36;
@@ -1986,7 +1990,7 @@ void melee_attack::_monster_die(monsters* monster, killer_type killer,
def_copy = new monsters(*monster);
// The monster is about to die, so restore its original attitude
- // for the cleanup effects (god reactions.) This could be a
+ // for the cleanup effects (god reactions). This could be a
// problem if the "killing" is actually an Abyss banishment - we
// don't want to create permafriendlies this way - so don't do it
// then.
@@ -2339,6 +2343,28 @@ void melee_attack::chaos_affects_defender()
beam.flavour = BEAM_NONE;
int choice = choose_random_weighted(probs, probs + NUM_CHAOS_TYPES);
+#ifdef DEBUG_CHAOS
+ std::string chaos_effect = "CHAOS effect: ";
+ switch (choice)
+ {
+ case CHAOS_CLONE: chaos_effect += "clone"; break;
+ case CHAOS_POLY: chaos_effect += "polymorph"; break;
+ case CHAOS_POLY_UP: chaos_effect += "polymorph PPT_MORE"; break;
+ case CHAOS_MAKE_SHIFTER: chaos_effect += "shifter"; break;
+ case CHAOS_MISCAST: chaos_effect += "miscast"; break;
+ case CHAOS_RAGE: chaos_effect += "berserk"; break;
+ case CHAOS_HEAL: chaos_effect += "healing"; break;
+ case CHAOS_HASTE: chaos_effect += "hasting"; break;
+ case CHAOS_INVIS: chaos_effect += "invisible"; break;
+ case CHAOS_SLOW: chaos_effect += "slowing"; break;
+ case CHAOS_PARALYSIS: chaos_effect += "paralysis"; break;
+ case CHAOS_PETRIFY: chaos_effect += "petrify"; break;
+ default: chaos_effect += "(other)"; break;
+ }
+
+ take_note(Note(NOTE_MESSAGE, 0, 0, chaos_effect.c_str()), true);
+#endif
+
switch (static_cast<chaos_type>(choice))
{
case CHAOS_CLONE:
@@ -2542,7 +2568,13 @@ void melee_attack::chaos_affects_attacker()
// Move stairs out from under the attacker.
if (one_chance_in(100) && _move_stairs(attacker, defender))
+ {
+#ifdef DEBUG_CHAOS
+ take_note(Note(NOTE_MESSAGE, 0, 0,
+ "CHAOS affects attacker: move stairs"), true);
+#endif
DID_AFFECT();
+ }
// Dump attacker or items under attacker to another level.
if (is_valid_shaft_level()
@@ -2551,6 +2583,10 @@ void melee_attack::chaos_affects_attacker()
&& one_chance_in(1000))
{
(void) attacker->do_shaft();
+#ifdef DEBUG_CHAOS
+ take_note(Note(NOTE_MESSAGE, 0, 0,
+ "CHAOS affects attacker: shaft effect"), true);
+#endif
DID_AFFECT();
}
@@ -2560,6 +2596,10 @@ void melee_attack::chaos_affects_attacker()
mprf("Smoke pours forth from %s!", wep_name(DESC_NOCAP_YOUR).c_str());
big_cloud(random_smoke_type(), KC_OTHER, attacker->pos(), 20,
4 + random2(8));
+#ifdef DEBUG_CHAOS
+ take_note(Note(NOTE_MESSAGE, 0, 0,
+ "CHAOS affects attacker: smoke"), true);
+#endif
DID_AFFECT();
}
@@ -2589,6 +2629,10 @@ void melee_attack::chaos_affects_attacker()
{
mpr(msg.c_str(), MSGCH_SOUND);
noisy(15, attacker->pos());
+#ifdef DEBUG_CHAOS
+ take_note(Note(NOTE_MESSAGE, 0, 0,
+ "CHAOS affects attacker: noise"), true);
+#endif
DID_AFFECT();
}
}
@@ -2711,10 +2755,16 @@ static bool _make_zombie(monsters* mon, int corpse_class, int corpse_index,
if (you.can_see(zombie))
simple_monster_message(mon, " instantly turns into a zombie!");
else if (last_item != NON_ITEM)
+ {
simple_monster_message(mon, "'s equipment vanishes!");
+ autotoggle_autopickup(true);
+ }
}
else
+ {
simple_monster_message(zombie, " appears from thin air!");
+ autotoggle_autopickup(false);
+ }
return (true);
}
@@ -2744,9 +2794,14 @@ void melee_attack::chaos_killed_defender(monsters* mon)
_find_remains(mon, corpse_class, corpse_index, fake_corpse, last_item,
items);
- if (one_chance_in(100) &&
- _make_zombie(mon, corpse_class, corpse_index, fake_corpse, last_item))
+ if (one_chance_in(100)
+ && _make_zombie(mon, corpse_class, corpse_index, fake_corpse,
+ last_item))
{
+#ifdef DEBUG_CHAOS
+ take_note(Note(NOTE_MESSAGE, 0, 0,
+ "CHAOS killed defender: zombified monster"), true);
+#endif
DID_AFFECT();
}
}
@@ -2888,6 +2943,32 @@ int melee_attack::random_chaos_brand()
if (susceptible)
break;
}
+#ifdef DEBUG_CHAOS
+ std::string brand_name = "CHAOS brand: ";
+ switch (brand)
+ {
+ case SPWPN_NORMAL: brand_name += "(plain)"; break;
+ case SPWPN_FLAMING: brand_name += "flaming"; break;
+ case SPWPN_FREEZING: brand_name += "freezing"; break;
+ case SPWPN_HOLY_WRATH: brand_name += "holy wrath"; break;
+ case SPWPN_ELECTROCUTION: brand_name += "electrocution"; break;
+ case SPWPN_VENOM: brand_name += "venom"; break;
+ case SPWPN_DRAINING: brand_name += "draining"; break;
+ case SPWPN_DISTORTION: brand_name += "distortion"; break;
+ case SPWPN_VAMPIRICISM: brand_name += "vampiricism"; break;
+ case SPWPN_VORPAL: brand_name += "vorpal"; break;
+ // ranged weapon brands
+ case SPWPN_FLAME: brand_name += "(flame)"; break;
+ case SPWPN_FROST: brand_name += "(frost)"; break;
+
+ // both ranged and non-ranged
+ case SPWPN_CHAOS: brand_name += "chaos"; break;
+ case SPWPN_CONFUSE: brand_name += "confusion"; break;
+ default: brand_name += "(other)"; break;
+ }
+
+ take_note(Note(NOTE_MESSAGE, 0, 0, brand_name.c_str()), true);
+#endif
return (brand);
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index e900a36cda..1f4763e561 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5416,7 +5416,7 @@ std::string monsters::hand_name(bool plural, bool *can_plural) const
case MON_SHAPE_BLOB:
case MON_SHAPE_SNAKE:
case MON_SHAPE_FISH:
- return foot_name(plural);
+ return foot_name(plural, can_plural);
case MON_SHAPE_BAT:
str = "wing";
@@ -6750,6 +6750,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
{
mprf("%s appears from thin air!",
name(DESC_CAP_A, true).c_str());
+ autotoggle_autopickup(false);
}
seen_monster(this);
@@ -6881,7 +6882,6 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
mpr("Something invisible bursts forth from the water.");
interrupt_activity(AI_FORCE_INTERRUPT);
}
-
break;
default:
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 5ebb2b2ee9..c5948c9bef 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1123,9 +1123,11 @@ int monster_die(monsters *monster, killer_type killer,
// Take note!
if (!mons_reset && !crawl_state.arena && MONST_INTERESTING(monster))
+ {
take_note(Note(NOTE_KILL_MONSTER,
monster->type, mons_friendly(monster),
monster->name(DESC_NOCAP_A, true).c_str()));
+ }
// From time to time Trog gives you a little bonus
if (killer == KILL_YOU && you.duration[DUR_BERSERKER])
@@ -1737,6 +1739,10 @@ int monster_die(monsters *monster, killer_type killer,
"as it dies; that was a shifter!");
}
+ // If we kill an invisible monster reactivate autopickup.
+ if (mons_near(monster) && !player_monster_visible(monster))
+ autotoggle_autopickup(false);
+
crawl_state.dec_mon_acting(monster);
monster_cleanup(monster);
@@ -1970,7 +1976,9 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
return simple_monster_message(monster, " looks momentarily different.");
// Messaging.
- bool can_see = you.can_see(monster);
+ bool can_see = you.can_see(monster);
+ bool can_see_new = !mons_class_flag(targetc, M_INVIS) || player_see_invis();
+
// If old monster is visible to the player, and is interesting,
// then note why the interesting monster went away.
@@ -1991,7 +1999,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
else
str_polymon = " evaporates and reforms as ";
- if (!can_see)
+ if (!can_see_new)
str_polymon += "something you cannot see!";
else
{
@@ -2088,6 +2096,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
if (!player_messaged && you.can_see(monster))
{
mprf("%s appears out of thin air!", monster->name(DESC_CAP_A).c_str());
+ autotoggle_autopickup(false);
player_messaged = true;
}
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index b7c7650cca..148c927cca 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -2241,7 +2241,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
// Hooves and talons force boots off.
if (you_tran_can_wear(EQ_BOOTS))
- remove_one_equip(EQ_BOOTS, false);
+ remove_one_equip(EQ_BOOTS, false, true);
break;
case MUT_CLAWS:
@@ -2252,7 +2252,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
// mutation yet, so we have to check for level 2 or higher claws
// here.
if (you.mutation[mutat] >= 2 && you_tran_can_wear(EQ_GLOVES))
- remove_one_equip(EQ_GLOVES, false);
+ remove_one_equip(EQ_GLOVES, false, true);
break;
case MUT_HORNS:
@@ -2265,7 +2265,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
&& is_hard_helmet(you.inv[you.equip[EQ_HELMET]])
&& you_tran_can_wear(EQ_HELMET))
{
- remove_one_equip(EQ_HELMET, false);
+ remove_one_equip(EQ_HELMET, false, true);
}
break;
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 06b57c5a5a..d1feb6bf07 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -381,9 +381,10 @@ std::string Note::describe( bool when, bool where, bool what ) const
}
if (type == NOTE_SEEN_MONSTER || type == NOTE_KILL_MONSTER)
+ {
if (what && first == MONS_PANDEMONIUM_DEMON)
result << " the pandemonium lord";
-
+ }
return result.str();
}
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index 35aa8c5f1d..3eb69e744c 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -30,6 +30,7 @@ REVISION("$Rev$");
#include "state.h"
#include "stuff.h"
#include "traps.h"
+#include "xom.h"
static void _extra_hp(int amount_extra);
@@ -153,7 +154,7 @@ static void _unwear_equipment_slot(equipment_type eqslot)
}
static void _remove_equipment(const std::set<equipment_type>& removed,
- bool meld = true)
+ bool meld = true, bool mutation = false)
{
// Meld items into you in (reverse) order. (std::set is a sorted container)
std::set<equipment_type>::const_iterator iter;
@@ -172,7 +173,16 @@ static void _remove_equipment(const std::set<equipment_type>& removed,
_unwear_equipment_slot(e);
if (unequip)
+ {
you.equip[e] = -1;
+
+ if (mutation)
+ {
+ // A mutation made us not only lose an equipment slot
+ // but actually removed a worn item: Funny!
+ xom_is_stimulated(is_artefact(*equip) ? 255 : 128);
+ }
+ }
}
}
@@ -261,11 +271,11 @@ void unmeld_one_equip(equipment_type eq)
_unmeld_equipment(e);
}
-void remove_one_equip(equipment_type eq, bool meld)
+void remove_one_equip(equipment_type eq, bool meld, bool mutation)
{
std::set<equipment_type> r;
r.insert(eq);
- _remove_equipment(r, meld);
+ _remove_equipment(r, meld, mutation);
}
static bool _tran_may_meld_cursed(int transformation)
diff --git a/crawl-ref/source/transfor.h b/crawl-ref/source/transfor.h
index 3d2abedb3d..33df1c6b37 100644
--- a/crawl-ref/source/transfor.h
+++ b/crawl-ref/source/transfor.h
@@ -42,7 +42,8 @@ size_type transform_size(int psize = PSIZE_BODY);
bool transform(int pow, transformation_type which_trans, bool force = false,
bool just_check = false);
-void remove_one_equip(equipment_type eq, bool meld = true);
+void remove_one_equip(equipment_type eq, bool meld = true,
+ bool mutation = false);
void unmeld_one_equip(equipment_type eq);
bool transform_changed_physiology( bool phys_scales = false );
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 3a05f1e2e3..d563b30846 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -44,14 +44,18 @@ REVISION("$Rev$");
#include "view.h"
#include "xom.h"
-#if DEBUG_RELIGION
-# define DEBUG_DIAGNOSTICS 1
-# define DEBUG_GIFTS 1
+#ifdef DEBUG_XOM
+# define DEBUG_RELIGION 1
+# define NOTE_DEBUG_XOM 1
#endif
-#if DEBUG_XOM
+#define NOTE_DEBUG_XOM
+#ifdef NOTE_DEBUG_XOM
+#include "notes.h"
+#endif
+
+#ifdef DEBUG_RELIGION
# define DEBUG_DIAGNOSTICS 1
-# define DEBUG_RELIGION 1
# define DEBUG_GIFTS 1
#endif
@@ -473,6 +477,12 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
spell, spellenum);
#endif
+#ifdef NOTE_DEBUG_XOM
+ static char spell_buf[80];
+ 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
your_spells(spell, sever, false);
return (true);
}
@@ -538,6 +548,14 @@ static void _xom_make_item(object_class_type base, int subtype, int power)
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[80];
+ 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();
}
@@ -702,7 +720,6 @@ static bool _xom_give_item(int power)
}
more();
-
return (true);
}
@@ -874,8 +891,8 @@ static void _do_chaos_upgrade(item_def &item, const monsters* mon)
mpr(msg.c_str());
}
- const int brand = (item.base_type == OBJ_WEAPONS) ? (int) SPWPN_CHAOS :
- (int) SPMSL_CHAOS;
+ const int brand = (item.base_type == OBJ_WEAPONS) ? (int) SPWPN_CHAOS
+ : (int) SPMSL_CHAOS;
if (is_random_artefact(item))
{
@@ -950,11 +967,44 @@ static bool _player_is_dead()
static bool _xom_do_potion()
{
bool rc = false;
- potion_type pot =
- static_cast<potion_type>(
- random_choose(POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED,
- POT_MIGHT, POT_INVISIBILITY, POT_BERSERK_RAGE,
- POT_EXPERIENCE, -1));
+ potion_type pot = POT_HEALING;
+ while (true)
+ {
+ pot = static_cast<potion_type>(
+ random_choose(POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED,
+ POT_MIGHT, POT_INVISIBILITY, POT_BERSERK_RAGE,
+ POT_EXPERIENCE, -1));
+
+ bool has_effect = true;
+ // Don't pick something that won't have an effect.
+ // Extending an existing effect is okay, though.
+ switch (pot)
+ {
+ case POT_HEALING:
+ if (you.rotting || you.disease || you.duration[DUR_CONF]
+ || you.duration[DUR_POISONING])
+ {
+ break;
+ }
+ // else fall through
+ case POT_HEAL_WOUNDS:
+ if (you.hp == you.hp_max && player_rotted() == 0)
+ has_effect = false;
+ break;
+ case POT_BERSERK_RAGE:
+ if (!you.can_go_berserk(false))
+ has_effect = false;
+ break;
+ case POT_EXPERIENCE:
+ if (you.experience_level == 27)
+ has_effect = false;
+ break;
+ default:
+ break;
+ }
+ if (has_effect)
+ break;
+ }
if (pot == POT_EXPERIENCE && !one_chance_in(6))
pot = POT_BERSERK_RAGE;
@@ -966,6 +1016,21 @@ 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 ";
+ switch (pot)
+ {
+ case POT_HEALING: potion_msg += "(healing)"; break;
+ case POT_HEAL_WOUNDS: potion_msg += "(heal wounds)"; break;
+ case POT_SPEED: potion_msg += "(speed)"; break;
+ case POT_MIGHT: potion_msg += "(might)"; break;
+ case POT_INVISIBILITY: potion_msg += "(invisibility)"; break;
+ case POT_BERSERK_RAGE: potion_msg += "(berserk)"; break;
+ 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
potion_effect(pot, 150);
rc = true;
@@ -1000,6 +1065,10 @@ 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
return (rc);
}
@@ -1053,7 +1122,7 @@ static bool _xom_send_allies(int sever)
if (num_actually_summoned)
{
- const bool only_holy = (numdifferent == num_actually_summoned);
+ const bool only_holy = (numdifferent == num_actually_summoned);
const bool only_demonic = (numdifferent == 0);
if (only_holy)
@@ -1102,6 +1171,16 @@ static bool _xom_send_allies(int sever)
player_angers_monster(mon);
}
+#ifdef NOTE_DEBUG_XOM
+ static char summ_buf[80];
+ snprintf(summ_buf, sizeof(summ_buf), "XOM: summons %d %s%s",
+ num_actually_summoned,
+ hostiletype == 0 ? "friendly " :
+ hostiletype == 3 ? "hostile " : "",
+ only_demonic ? "demons" : "monsters");
+ take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true);
+#endif
+
rc = true;
}
return (rc);
@@ -1126,9 +1205,7 @@ static bool _xom_send_one_ally(int sever)
const int summons =
create_monster(
- mgen_data(mon, beha,
- 6, MON_SUMM_AID,
- you.pos(), MHITYOU,
+ mgen_data(mon, beha, 6, MON_SUMM_AID, you.pos(), MHITYOU,
MG_FORCE_BEH, GOD_XOM));
if (summons != -1)
@@ -1140,6 +1217,14 @@ static bool _xom_send_one_ally(int sever)
player_angers_monster(&menv[summons]);
+#ifdef NOTE_DEBUG_XOM
+ static char summ_buf[80];
+ snprintf(summ_buf, sizeof(summ_buf), "XOM: 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
+
rc = true;
}
return (rc);
@@ -1158,6 +1243,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
+ std::string old_name = mon->name(DESC_PLAIN);
+#endif
if (one_chance_in(8) && !mons_is_shapeshifter(mon))
{
mon->add_ench(one_chance_in(3) ? ENCH_GLOWING_SHAPESHIFTER
@@ -1168,6 +1256,13 @@ static bool _xom_polymorph_nearby_monster(bool helpful)
monster_polymorph(mon, RANDOM_MONSTER,
powerup ? PPT_MORE : PPT_LESS);
+#ifdef NOTE_DEBUG_XOM
+ static char poly_buf[80];
+ snprintf(poly_buf, sizeof(poly_buf), "XOM: polymorph %s -> %s (%s)",
+ old_name.c_str(), mon->name(DESC_PLAIN, true).c_str(),
+ powerup ? "upgrade" : "downgrade");
+ take_note(Note(NOTE_MESSAGE, 0, 0, poly_buf), true);
+#endif
rc = true;
}
}
@@ -1290,6 +1385,9 @@ static bool _xom_rearrange_pieces(int sever)
}
}
}
+#ifdef NOTE_DEBUG_XOM
+ take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: swap monsters"), true);
+#endif
return (true);
}
@@ -1303,6 +1401,13 @@ static bool _xom_give_mutations(bool good)
const char* lookup = (good ? "good mutations" : "random mutations");
god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str());
+#ifdef NOTE_DEBUG_XOM
+ static char mut_buf[80];
+ snprintf(mut_buf, sizeof(mut_buf), "XOM: give %s mutations",
+ good || !_xom_feels_nasty() ? "good" : "random");
+ take_note(Note(NOTE_MESSAGE, 0, 0, mut_buf), true);
+#endif
+
mpr("Your body is suffused with distortional energy.");
set_hp(1 + random2(you.hp), false);
@@ -1357,6 +1462,15 @@ static bool _xom_send_major_ally(int sever)
}
player_angers_monster(&menv[summons]);
+
+#ifdef NOTE_DEBUG_XOM
+ static char summ_buf[80];
+ snprintf(summ_buf, sizeof(summ_buf), "XOM: 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
+
rc = true;
}
@@ -1402,8 +1516,10 @@ static bool _xom_throw_divine_lightning()
you.hp = 1;
you.reset_escaped_death();
}
-
- return true;
+#ifdef NOTE_DEBUG_XOM
+ take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: divine lightning"), true);
+#endif
+ return (true);
}
// The nicer stuff. Note: these things are not necessarily nice.
@@ -1465,8 +1581,10 @@ static bool _xom_is_good(int sever, int tension)
// to a few random areas, stopping randomly but most likely in
// an area that is not dangerous to you.
god_speaks(GOD_XOM, _get_xom_speech("teleportation journey").c_str());
+ int count = 0;
do
{
+ count++;
you_teleport_now(false);
more();
if (one_chance_in(10))
@@ -1474,6 +1592,14 @@ static bool _xom_is_good(int sever, int tension)
}
while (x_chance_in_y(3, 4) || player_in_a_dangerous_place());
done = true;
+
+#ifdef NOTE_DEBUG_XOM
+ 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);
+#endif
}
else if (random2(tension) < 5 && x_chance_in_y(12, sever))
{
@@ -1481,6 +1607,9 @@ 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
done = true;
}
}
@@ -1902,6 +2031,13 @@ static void _xom_miscast(const int max_level, const bool nasty)
const int level = random2(max_level + 1);
+#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);
+#endif
+
if (level == 0 && one_chance_in(20))
{
god_speaks(GOD_XOM, _get_xom_speech(speech_str).c_str());
@@ -1953,7 +2089,16 @@ static bool _xom_lose_stats()
}
god_speaks(GOD_XOM, _get_xom_speech("lose stats").c_str());
- lose_stat(stat, 1 + random2(max), true, "the vengeance of Xom" );
+ const int loss = 1 + random2(max);
+ lose_stat(stat, loss, true, "the vengeance of Xom" );
+
+#ifdef NOTE_DEBUG_XOM
+ static char stat_buf[80];
+ snprintf(stat_buf, sizeof(stat_buf), "XOM: stat loss (-%d %s)",
+ loss, (stat == STAT_STRENGTH ? " Str" :
+ stat == STAT_DEXTERITY ? " Dex" : "Int"));
+ take_note(Note(NOTE_MESSAGE, 0, 0, stat_buf), true);
+#endif
return (true);
}
@@ -1983,7 +2128,10 @@ 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
return (rc);
}
@@ -2000,6 +2148,7 @@ static bool _xom_player_confusion_effect(int sever)
// Sometimes Xom gets carried away and starts confusing
// other creatures too.
+ bool mons_too = false;
if (coinflip())
{
for (unsigned i = 0; i < MAX_MONSTERS; ++i)
@@ -2020,8 +2169,15 @@ static bool _xom_player_confusion_effect(int sever)
simple_monster_message(monster,
" looks rather confused.");
}
+ mons_too = true;
}
}
+#ifdef NOTE_DEBUG_XOM
+ std::string conf_msg = "XOM: confusion";
+ if (mons_too)
+ conf_msg += " (+ monsters)";
+ take_note(Note(NOTE_MESSAGE, 0, 0, conf_msg.c_str()), true);
+#endif
}
return (rc);
}
@@ -2046,6 +2202,9 @@ static bool _xom_draining_torment_effect(int sever)
drain_exp();
rc = true;
+#ifdef NOTE_DEBUG_XOM
+ take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: draining"), true);
+#endif
}
}
else
@@ -2055,6 +2214,12 @@ static bool _xom_draining_torment_effect(int sever)
{
god_speaks(GOD_XOM, speech.c_str());
torment_player(0, TORMENT_XOM);
+#ifdef NOTE_DEBUG_XOM
+ static char torment_buf[80];
+ snprintf(torment_buf, sizeof(torment_buf), "XOM: torment (%d/%d)",
+ you.hp, you.hp_max);
+ take_note(Note(NOTE_MESSAGE, 0, 0, torment_buf), true);
+#endif
rc = true;
}
}
@@ -2068,7 +2233,14 @@ static bool _xom_summon_hostiles(int sever)
// Nasty, but fun.
if (one_chance_in(4))
+ {
rc = cast_tukimas_dance(100, GOD_XOM, true);
+
+#ifdef NOTE_DEBUG_XOM
+ if (rc)
+ take_note(Note(NOTE_MESSAGE, 0, 0, "XOM: animates weapon"), true);
+#endif
+ }
else
{
// The number of demons is dependent on severity, though heavily
@@ -2078,6 +2250,7 @@ static bool _xom_summon_hostiles(int sever)
numdemons = random2(numdemons+1);
numdemons = std::min(numdemons+1,14);
+ int num_summoned = 0;
for (int i = 0; i < numdemons; ++i)
{
if (create_monster(
@@ -2086,9 +2259,20 @@ static bool _xom_summon_hostiles(int sever)
you.pos(), 4, 0, true, GOD_XOM,
MON_SUMM_WRATH)) != -1)
{
- rc = true;
+ num_summoned++;
}
}
+
+ if (num_summoned > 0)
+ {
+#ifdef NOTE_DEBUG_XOM
+ static char summ_buf[80];
+ snprintf(summ_buf, sizeof(summ_buf),
+ "XOM: summons %d hostile demons", num_summoned);
+ take_note(Note(NOTE_MESSAGE, 0, 0, summ_buf), true);
+#endif
+ rc = true;
+ }
}
if (rc)
@@ -2152,14 +2336,24 @@ static bool _xom_is_bad(int sever, int tension)
// an area is dangerous to you or randomly.
god_speaks(GOD_XOM,
_get_xom_speech("teleportation journey").c_str());
+ int count = 0;
do
{
+ count++;
you_teleport_now(false);
more();
}
while (x_chance_in_y(3, 4) && !player_in_a_dangerous_place());
badness = player_in_a_dangerous_place() ? 3 : 1;
done = true;
+
+#ifdef NOTE_DEBUG_XOM
+ 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);
+#endif
}
else if (x_chance_in_y(8, sever))
{