diff options
author | DracoOmega <draco_omega@live.com> | 2014-01-17 22:13:02 -0330 |
---|---|---|
committer | DracoOmega <draco_omega@live.com> | 2014-01-18 00:17:08 -0330 |
commit | e25714242b04ac28f0ecb15ed916a2f42eb410b8 (patch) | |
tree | 0a554372e24b56b26873dcd40ca0b57446123822 /crawl-ref/source/wiz-mon.cc | |
parent | 2cbd564df629498722f101057aaa1a63ae49661c (diff) | |
download | crawl-ref-e25714242b04ac28f0ecb15ed916a2f42eb410b8.tar.gz crawl-ref-e25714242b04ac28f0ecb15ed916a2f42eb410b8.zip |
Repurpose BEH_CORNERED to adjust monster fleeing behavior, plus code cleanup
After detailed scrutiny, it was unclear that BEH_CORNERED was actually
serving any real purpose. When a monster was told to stop fleeing (maybe it
hit a wall), it would briefly enter BEH_CORNERED, but then immediately exit
it again unless at low health. But even in BEH_CORNERED, there seemed to
be few meaningful logic differences from a stripped down BEH_SEEK against
a visible foe. (There were also some other checks that seemed to serve no
function.)
Now BEH_CORNERED has a distinct purpose from other behaviors. When a monster
is fleeing and its path is obstructed by a monster or terrain obstacle, instead
of immediately stopping fleeing (and incidentally becoming invisibly immune to
fear for some time!), it will pause one turn in place in the hope that a path
will open up next turn. This actually happens frequently when multiple monsters
are fleeing in a confined space (say you read a scroll of fear in a corridor);
instead of many of them breaking fear immediately, they will wait just a moment
to give outer monsters a chance to move and thus give space to move themselves.
In practice, this means that fear tends to operate in a more intuitive manner
when playing, instead of sometimes appearing to have no practical effect.
It should be noted that breaking fear due to being stuck did not actually remove
ENCH_FEAR from a monster, even if it acted in all ways as though this enchantment
was not present. However, since cause fear would not apply ENCH_FEAR to a monster
that already had it, if any monster broke fear prematurely, it would remain
invisibly immune to further fear until the effect on them wore off. (It would even
give a message later on about the monster 'recovering its courage', which seems a
little odd if it's just been chasing you for several turns already). Now fear is
properly removed if the monster actually stops fleeing.
This commit also adds a few comments to try and explicate the difference
between 'fleeing' and 'retreating', where the former implies a disorderly
run away from a target (such as when afflicted by fear) while the latter
subsumes any case where the monster wants to move AWAY from its target pos
instead of towards it (which includes backing away from a player with a
reaching weapon that it cannot retaliate against)
Note that BEH_CORNERED is subsumed beneath mons_is_fleeing() since the monster
still WANTS to flee, even if it currently cannot move, and this is often relevant
when fleeing status is checked.
Diffstat (limited to 'crawl-ref/source/wiz-mon.cc')
-rw-r--r-- | crawl-ref/source/wiz-mon.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/wiz-mon.cc b/crawl-ref/source/wiz-mon.cc index 6476835b0c..fd9c716d83 100644 --- a/crawl-ref/source/wiz-mon.cc +++ b/crawl-ref/source/wiz-mon.cc @@ -627,7 +627,7 @@ void debug_stethoscope(int mon) : mons_is_wandering(&mons) ? "wander" : mons_is_seeking(&mons) ? "seek" : mons_is_fleeing(&mons) ? "flee" - : mons_is_retreating(&mons) ? "retreat" + : mons.behaviour == BEH_RETREAT ? "retreat" : mons_is_cornered(&mons) ? "cornered" : mons_is_lurking(&mons) ? "lurk" : mons.behaviour == BEH_WITHDRAW ? "withdraw" |