diff options
author | gammafunk <gammafunk@gmail.com> | 2014-02-04 02:20:21 -0600 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-02-09 11:13:00 -0500 |
commit | 5c913e88656986f9c9ed37a028372817ae09257b (patch) | |
tree | e892924b0cdfbb91457b36d46aa5ce04aa1841d7 /crawl-ref/source/mon-movetarget.cc | |
parent | 6a3835bcdbc3dd5f3eb46bd5073a1c7c29947952 (diff) | |
download | crawl-ref-5c913e88656986f9c9ed37a028372817ae09257b.tar.gz crawl-ref-5c913e88656986f9c9ed37a028372817ae09257b.zip |
Fix seek/wandering behaviour of spectral weapons and battlespheres.
The monster versions of these spells were misbehaving differently
depending on whether they are friendly or hostile due to assumptions in
handle_behaviour(). Some changes that let these "avatars" behave
properly when both friendly and hostile, regardless of caster:
0. I added a mons_is_avatar() function that returns true if the given
monster type is a battlesphere, spectral weapon, or grand avatar.
The behaviour changes only affect spectral weapons and
battlespheres, and the function is currently only used for code
relative to those two, but they're all in the class of "magical
constructs attached to the caster".
1. Spectral weapons and battlespheres seek their owner upon creation.
2. Avatars now always know the location of their owner and will attempt
to seek to their owner if they fail to seek their current target.
3. Avatars not created by the player see their owner as the "foe" to
fall back to instead of the player. Using the owner for mon->foe
when the avatar cannot attack (in the case of spectral weapons) is
perhaps not the best system, but it's how non-avatar player-friendly
monsters are currently able to track the player, so we use the
analogous approach now.
4. Spectral weapons are all properly "leashed" to their owner and fall
back to seeking owner if they are out of their two-distance leash.
Battlespheres also seek back to their owner if said owner is
teleported away.
Diffstat (limited to 'crawl-ref/source/mon-movetarget.cc')
-rw-r--r-- | crawl-ref/source/mon-movetarget.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-movetarget.cc b/crawl-ref/source/mon-movetarget.cc index d09643bbe9..7cf865cb50 100644 --- a/crawl-ref/source/mon-movetarget.cc +++ b/crawl-ref/source/mon-movetarget.cc @@ -918,7 +918,7 @@ void check_wander_target(monster* mon, bool isPacified) // default wander behaviour if (mon->pos() == mon->target || mons_is_batty(mon) - || !isPacified && one_chance_in(20) && mon->type != MONS_BATTLESPHERE + || (!isPacified && !mons_is_avatar(mon->type) && one_chance_in(20)) || herd_monster(mon) && !_herd_ok(mon) || !_band_ok(mon)) { |