summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-08 10:51:46 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-08 10:51:46 +0000
commitd3d2bb1fc5dfa688e83c24a35fcfcb5fc047dc1b (patch)
treeadd7931557027936af09009e58138431f6244c0f
parentec8f97b4eb0d8f26161440c69eeaebacf861b3b3 (diff)
downloadcrawl-ref-d3d2bb1fc5dfa688e83c24a35fcfcb5fc047dc1b.tar.gz
crawl-ref-d3d2bb1fc5dfa688e83c24a35fcfcb5fc047dc1b.zip
Merge r2804 (enslaved fleeing behaviour).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2805 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc3
-rw-r--r--crawl-ref/source/mon-util.cc7
-rw-r--r--crawl-ref/source/monstuff.cc12
3 files changed, 17 insertions, 5 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 157c288499..d842cdca0e 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2034,9 +2034,6 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
case BEAM_CHARM: /* 9 = charm */
if (monster->add_ench(ENCH_CHARM))
{
- // break fleeing and suchlike
- monster->behaviour = BEH_SEEK;
-
// put in an exception for fungi, plants and other things you won't
// notice becoming charmed.
if (simple_monster_message(monster, " is charmed."))
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 8c1ba895b1..237a2eaa5c 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3783,6 +3783,13 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool)
speed /= 2;
break;
+ case ENCH_CHARM:
+ behaviour = BEH_SEEK;
+ target_x = you.x_pos;
+ target_y = you.y_pos;
+ foe = MHITYOU;
+ break;
+
default:
break;
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 79bbab27f1..affd188b41 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1995,7 +1995,13 @@ static void handle_behaviour(monsters *mon)
// we can jump back to WANDER if the foe
// isn't present.
- if (proxFoe)
+ if (isFriendly)
+ {
+ // Special-cased below so that it will flee *towards* you
+ mon->target_x = you.x_pos;
+ mon->target_y = you.y_pos;
+ }
+ else if (proxFoe)
{
// try to flee _from_ the correct position
mon->target_x = foe_x;
@@ -2173,7 +2179,9 @@ static void handle_movement(monsters *monster)
mmov_x = (dx > 0) ? 1 : ((dx < 0) ? -1 : 0);
mmov_y = (dy > 0) ? 1 : ((dy < 0) ? -1 : 0);
- if (monster->behaviour == BEH_FLEE)
+ if (monster->behaviour == BEH_FLEE &&
+ (!mons_friendly(monster) ||
+ monster->target_x != you.x_pos || monster->target_y != you.y_pos))
{
mmov_x *= -1;
mmov_y *= -1;