diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-17 18:30:45 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-17 18:30:45 +0000 |
commit | 94410e34844eacecadec9c0f3b8e96b2833d16e6 (patch) | |
tree | 801d9dfbafb11f404ac732d304923b74a9ed1141 /crawl-ref/source/mon-util.cc | |
parent | 73466105efd4afd0b5317668be0109395e931659 (diff) | |
download | crawl-ref-94410e34844eacecadec9c0f3b8e96b2833d16e6.tar.gz crawl-ref-94410e34844eacecadec9c0f3b8e96b2833d16e6.zip |
Add an unfinished attempt at making pacified monsters leave the level.
BEH_LEAVE replaces BEH_INVESTIGATE, which wasn't being used.
Notes:
Since leaving the level is similar to fleeing in some ways, monsters
leaving the level share some behaviors with fleeing monsters: they are
less likely to shoot; they are more likely to use scrolls of blinking or
teleportation; and leaving eyeballs won't paralyze you or drain your MP.
Leaving the level is also similar to lurking in some ways, so it won't
be interrupted by noticing something, just as with lurking.
Getting far enough away from a monster will make it leave the level
(i.e., die with KILL_DISMISSED and MF_HARD_RESET, so it takes its stuff
with it), as will getting it into a grid it can submerge in, at which
time it will submerge and leave the level. Neither of these apply to
monsters that can't move, of course, except for mimics, since they can
teleport.
Incomplete things (sorry for the mess):
I still haven't figured out how to make a monster target a dungeon
feature (in this case, the nearest level exit, the nearest teleportation
or shaft trap, or the nearest submersible grid), so, currently, a
pacified monster will just go to where its last target was and stand
there until/unless one of the aforementioned level exit scenarios
occurs.
Pacified monsters can still cast summoning spells. Whatever they summon
is neutral, just as they are, but such summons can still get in the way.
(Try pacifying an orc high priest, for example.) Maybe summoning should
be disabled or have its chance lowered for neutral monsters in general,
unless something's in their way?
Speaking of targeting, the leaving-by-submerging scenario should occur
only if there's no other way to reach the target: all ways off the level
are blocked, the monster's habitat is water and it's not amphibious, the
monster's habitat is lava, or (possibly) the monster's habitat is rock.
There should be a message if the monster leaves the level, but what
about the ones that do so out of the player's LOS?
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5924 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index bc4877f425..ae7ac4af5c 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -425,6 +425,13 @@ bool mons_is_stationary(const monsters *mon) return mons_class_is_stationary(mon->type); } +// Mimics can teleport, so they're not truly stationary. +// XXX: There should be a more generic way to check for this! +bool mons_is_truly_stationary(const monsters *mon) +{ + return (mons_is_stationary(mon) && !mons_is_mimic(mon->type)); +} + bool mons_is_insubstantial(int mc) { return mons_class_flag(mc, M_INSUBSTANTIAL); @@ -2105,6 +2112,11 @@ bool mons_good_neutral(const monsters *m) return (m->attitude == ATT_GOOD_NEUTRAL); } +bool mons_is_pacified(const monsters *m) +{ + return (m->attitude == ATT_NEUTRAL && testbits(m->flags, MF_GOT_HALF_XP)); +} + bool mons_wont_attack(const monsters *m) { return (mons_friendly(m) || mons_good_neutral(m)); @@ -2200,6 +2212,11 @@ bool mons_is_cornered(const monsters *m) return (m->behaviour == BEH_CORNERED); } +bool mons_is_leaving(const monsters *m) +{ + return (m->behaviour == BEH_LEAVE); +} + bool mons_is_lurking(const monsters *m) { return (m->behaviour == BEH_LURK); @@ -2252,6 +2269,9 @@ void mons_pacify(monsters *mon) gain_exp(exper_value(mon) / 2 + 1, &exp_gain, &avail_gain); mon->flags |= MF_GOT_HALF_XP; } + + // Make the monster leave the level. + behaviour_event(mon, ME_EVAL); } bool mons_should_fire(struct bolt &beam) |