summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/xom.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-24 21:35:54 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-24 21:35:54 +0000
commit0e672fb6b2424528497812eb1422c6bbad5396dd (patch)
tree106e812f21e027e85359ee0658b1ba7b355f27f8 /crawl-ref/source/xom.cc
parent230e608dbc403a547ef54e98a0b90a7e6af06cb3 (diff)
downloadcrawl-ref-0e672fb6b2424528497812eb1422c6bbad5396dd.tar.gz
crawl-ref-0e672fb6b2424528497812eb1422c6bbad5396dd.zip
* A few starting choice restriction tweaks.
* Increase probability of Xom acts some more, in particularly tension ones. * Greatly lower the chance of Xom doing a bad act despite xom_is_nice() having been rolled. (Now that Xom's mood is no longer predefined, it's not really necessary anymore.) * When making Xom cast a spell, distinguish between spells that require tension and those that don't. * Monsters that are more than 3 waypoints away from their target grid don't count towards tension. (This applies to monsters attracted by noise to a nearby position, or monsters "tracking" you.) * If there are no monsters within line of sight (including invisible ones), tension will always be zero. (This avoids the mysterious berserk effects while a monster is lurking around the corner.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9543 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/xom.cc')
-rw-r--r--crawl-ref/source/xom.cc67
1 files changed, 43 insertions, 24 deletions
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 99d2434fc4..a382e7faf3 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -55,7 +55,16 @@ REVISION("$Rev$");
// Which spells? First I copied all spells from your_spells(), and then
// I filtered some out, especially conjurations. Then I sorted them in
// roughly ascending order of power.
-static const spell_type _xom_spells[] =
+static const spell_type _xom_nontension_spells[] =
+{
+ SPELL_BLINK, SPELL_MAGIC_MAPPING, SPELL_DETECT_ITEMS,
+ SPELL_DETECT_CREATURES, SPELL_RING_OF_FLAMES, SPELL_OLGREBS_TOXIC_RADIANCE,
+ SPELL_EXCRUCIATING_WOUNDS, SPELL_SUMMON_BUTTERFLIES,
+ SPELL_FLY, SPELL_SPIDER_FORM, SPELL_STATUE_FORM, SPELL_ICE_FORM,
+ SPELL_DRAGON_FORM, SPELL_ANIMATE_DEAD, SPELL_NECROMUTATION
+};
+
+static const spell_type _xom_tension_spells[] =
{
SPELL_BLINK, SPELL_CONFUSING_TOUCH, SPELL_MAGIC_MAPPING,
SPELL_DETECT_ITEMS, SPELL_DETECT_CREATURES, SPELL_CAUSE_FEAR,
@@ -219,7 +228,7 @@ void xom_tick()
if (you.gift_timeout == 1)
simple_god_message(" is getting BORED.");
- if (one_chance_in(10) && (coinflip() || get_tension(GOD_XOM)))
+ if (one_chance_in(5) && (one_chance_in(3) || get_tension(GOD_XOM)))
xom_acts(abs(you.piety - MAX_PIETY/2));
}
@@ -237,16 +246,25 @@ void xom_is_stimulated(int maxinterestingness, const std::string& message,
_xom_is_stimulated(maxinterestingness, message_array, force_message);
}
-static void _xom_makes_you_cast_random_spell(int sever)
+static void _xom_makes_you_cast_random_spell(int sever, int tension)
{
int spellenum = sever;
god_acting gdact(GOD_XOM);
- const int nxomspells = ARRAYSZ(_xom_spells);
- spellenum = std::min(nxomspells, spellenum);
-
- const spell_type spell = _xom_spells[random2(spellenum)];
+ spell_type spell;
+ if (tension > 0)
+ {
+ const int nxomspells = ARRAYSZ(_xom_tension_spells);
+ spellenum = std::min(nxomspells, spellenum);
+ spell = _xom_tension_spells[random2(spellenum)];
+ }
+ else
+ {
+ const int nxomspells = ARRAYSZ(_xom_nontension_spells);
+ spellenum = std::min(nxomspells, spellenum);
+ spell = _xom_nontension_spells[random2(spellenum)];
+ }
god_speaks(GOD_XOM, _get_xom_speech("spell effect").c_str());
@@ -1136,8 +1154,11 @@ static bool _xom_is_good(int sever, int tension)
done = _xom_do_potion();
else if (x_chance_in_y(3, sever))
{
- _xom_makes_you_cast_random_spell(sever);
- done = true;
+ if (tension || coinflip())
+ {
+ _xom_makes_you_cast_random_spell(sever, tension);
+ done = true;
+ }
}
else if (x_chance_in_y(4, sever))
done = _xom_confuse_monsters(sever);
@@ -1750,18 +1771,15 @@ static bool _xom_summon_hostiles(int sever)
// Nasty, but fun.
if (one_chance_in(4))
- {
- god_speaks(GOD_XOM, speech.c_str());
- cast_tukimas_dance(100, GOD_XOM, true);
- // FIXME: We should probably only do this if the spell
- // succeeded.
- rc = true;
- }
+ rc = cast_tukimas_dance(100, GOD_XOM, true);
else
{
- // XXX: Can we clean up this ugliness, please?
- const int numdemons =
- std::min(random2(random2(random2(sever+1)+1)+1)+1, 14);
+ // The number of demons is dependant on severity, though heavily
+ // randomized.
+ int numdemons = sever;
+ for (int i = 0; i < 3; i++)
+ numdemons = random2(numdemons+1);
+ numdemons = std::min(numdemons+1,14);
for (int i = 0; i < numdemons; ++i)
{
@@ -1774,10 +1792,11 @@ static bool _xom_summon_hostiles(int sever)
rc = true;
}
}
-
- if (rc)
- god_speaks(GOD_XOM, speech.c_str());
}
+
+ if (rc)
+ god_speaks(GOD_XOM, speech.c_str());
+
return (rc);
}
@@ -2052,7 +2071,7 @@ void xom_acts(bool niceness, int sever)
const FixedVector<unsigned char, NUM_MUTATIONS> orig_mutation
= you.mutation;
- if (niceness && !one_chance_in(5))
+ if (niceness && !one_chance_in(20))
{
// Good stuff.
while (!_xom_is_good(sever, tension))
@@ -2078,7 +2097,7 @@ void xom_acts(bool niceness, int sever)
}
}
- if (you.religion == GOD_XOM && one_chance_in(5))
+ if (you.religion == GOD_XOM && one_chance_in(8))
{
const std::string old_xom_favour = describe_xom_favour();
you.piety = random2(MAX_PIETY+1);