diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/main.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/xom.cc | 40 | ||||
-rw-r--r-- | crawl-ref/source/xom.h | 36 |
3 files changed, 63 insertions, 29 deletions
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index 86b5813784..95fa1189b8 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -592,12 +592,18 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) break; case 'X': - if (you.religion == GOD_XOM) - xom_acts(abs(you.piety - HALF_MAX_PIETY)); - else - xom_acts(coinflip(), random_range(0, HALF_MAX_PIETY)); + { + int result = 0; + do + { + if (you.religion == GOD_XOM) + result = xom_acts(abs(you.piety - HALF_MAX_PIETY)); + else + result = xom_acts(coinflip(), random_range(0, HALF_MAX_PIETY)); + } + while (result == 0); break; - + } case 'p': dungeon_terrain_changed(you.pos(), DNGN_ENTER_PANDEMONIUM, false); break; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 5b0ee4b460..a37362e01d 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -3669,9 +3669,21 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) #endif const bool was_bored = _xom_is_bored(); + const bool good_act = niceness && !one_chance_in(20); int result = XOM_DID_NOTHING; - if (niceness && !one_chance_in(20)) + if (good_act) { + // Make good acts at zero tension less likely, especially if Xom + // is in a bad mood. + if (tension == 0 && !x_chance_in_y(you.piety, MAX_PIETY)) + { +#ifdef NOTE_DEBUG_XOM + take_note(Note(NOTE_MESSAGE, 0, 0, "suppress good act because of " + "zero tension"), true); +#endif + return (XOM_GOOD_NOTHING); + } + // Good stuff. while (result == XOM_DID_NOTHING) result = _xom_is_good(sever, tension, debug); @@ -3691,6 +3703,19 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) } #endif + // Make bad acts at non-zero tension less likely, especially if Xom + // is in a good mood. + if (!_xom_feels_nasty() && tension > random2(10) + && x_chance_in_y(you.piety, MAX_PIETY)) + { +#ifdef NOTE_DEBUG_XOM + snprintf(info, INFO_SIZE, "suppress bad act because of %d tension", + tension); + take_note(Note(NOTE_MESSAGE, 0, 0, info), true); +#endif + return (XOM_BAD_NOTHING); + } + // Bad mojo. while (result == XOM_DID_NOTHING) result = _xom_is_bad(sever, tension, debug); @@ -4018,15 +4043,15 @@ static const char* _xom_effect_to_name(int effect) // See xom.h static const char* _xom_effect_names[] = { - "nothing", + "bugginess", // good acts - "potion", "spell (tension)", "spell (no tension)", "mapping", - "confuse monsters", "single ally", "animate monster weapon", + "nothing", "potion", "spell (tension)", "spell (no tension)", + "mapping", "confuse monsters", "single ally", "animate monster weapon", "annoyance gift", "random item gift", "acquirement", "summon allies", "polymorph", "swap monsters", "teleportation", "vitrification", "mutation", "permanent ally", "lightning", "change scenery", // bad acts - "miscast (pseudo)", "miscast (minor)", "miscast (major)", + "nothing", "miscast (pseudo)", "miscast (minor)", "miscast (major)", "miscast (nasty)", "stat loss", "teleportation", "swap weapons", "chaos upgrade", "mutation", "polymorph", "repel stairs", "confusion", "draining", "torment", "animate weapon", "summon demons", @@ -4121,8 +4146,9 @@ void debug_xom_effects() // Repeat N times. for (int i = 0; i < N; ++i) { - bool niceness = xom_is_nice(tension); - int result = xom_acts(niceness, sever, tension, true); + const bool niceness = xom_is_nice(tension); + const int result = xom_acts(niceness, sever, tension, true); + mood_effects.push_back(result); all_effects[0].push_back(result); diff --git a/crawl-ref/source/xom.h b/crawl-ref/source/xom.h index 50f670e15a..df8f6fa285 100644 --- a/crawl-ref/source/xom.h +++ b/crawl-ref/source/xom.h @@ -23,47 +23,49 @@ enum xom_event_type XOM_DID_NOTHING = 0, // good acts + XOM_GOOD_NOTHING, // good act suppressed XOM_GOOD_POTION, XOM_GOOD_SPELL_TENSION, XOM_GOOD_SPELL_CALM, - XOM_GOOD_MAPPING, - XOM_GOOD_CONFUSION, // 5 + XOM_GOOD_MAPPING, // 5 + XOM_GOOD_CONFUSION, XOM_GOOD_SINGLE_ALLY, XOM_GOOD_ANIMATE_MON_WPN, XOM_GOOD_ANNOYANCE_GIFT, - XOM_GOOD_RANDOM_ITEM, - XOM_GOOD_ACQUIREMENT, // 10 + XOM_GOOD_RANDOM_ITEM, // 10 + XOM_GOOD_ACQUIREMENT, XOM_GOOD_ALLIES, XOM_GOOD_POLYMORPH, XOM_GOOD_SWAP_MONSTERS, - XOM_GOOD_TELEPORT, - XOM_GOOD_VITRIFY, // 15 + XOM_GOOD_TELEPORT, // 15 + XOM_GOOD_VITRIFY, XOM_GOOD_MUTATION, XOM_GOOD_MAJOR_ALLY, XOM_GOOD_LIGHTNING, XOM_GOOD_SCENERY, - XOM_LAST_GOOD_ACT = XOM_GOOD_SCENERY, // 19 + XOM_LAST_GOOD_ACT = XOM_GOOD_SCENERY, // 20 // bad acts - XOM_BAD_MISCAST_PSEUDO, // 20 + XOM_BAD_NOTHING, // bad act suppressed + XOM_BAD_MISCAST_PSEUDO, XOM_BAD_MISCAST_MINOR, XOM_BAD_MISCAST_MAJOR, - XOM_BAD_MISCAST_NASTY, + XOM_BAD_MISCAST_NASTY, // 25 XOM_BAD_STATLOSS, - XOM_BAD_TELEPORT, // 25 + XOM_BAD_TELEPORT, XOM_BAD_SWAP_WEAPONS, XOM_BAD_CHAOS_UPGRADE, - XOM_BAD_MUTATION, + XOM_BAD_MUTATION, // 30 XOM_BAD_POLYMORPH, - XOM_BAD_STAIRS, // 30 + XOM_BAD_STAIRS, XOM_BAD_CONFUSION, XOM_BAD_DRAINING, - XOM_BAD_TORMENT, + XOM_BAD_TORMENT, // 35 XOM_BAD_ANIMATE_WPN, - XOM_BAD_SUMMON_DEMONS, // 35 + XOM_BAD_SUMMON_DEMONS, XOM_BAD_PSEUDO_BANISHMENT, XOM_BAD_BANISHMENT, - XOM_LAST_BAD_ACT = XOM_BAD_BANISHMENT, // 37 + XOM_LAST_BAD_ACT = XOM_BAD_BANISHMENT, // 39 XOM_PLAYER_DEAD = 100, // player already dead (shouldn't happen) NUM_XOM_EVENTS @@ -79,9 +81,9 @@ bool xom_is_nice(int tension = -1); int xom_acts(bool niceness, int sever, int tension = -1, bool debug = false); const char *describe_xom_favour(bool upper = false); -inline void xom_acts(int sever, int tension = -1) +inline int xom_acts(int sever, int tension = -1) { - xom_acts(xom_is_nice(tension), sever, tension); + return xom_acts(xom_is_nice(tension), sever, tension); } void xom_check_lost_item(const item_def& item); |