diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-08 10:42:41 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-08 10:42:41 +0000 |
commit | 19af7cb5ed24a2f1b456dbe8030418ca77f0f6e2 (patch) | |
tree | 45e5e0e1906c2747c401ef15b6b8252baa7aa265 | |
parent | 76bba18901cc2e3278bd683d93351d44e750f98e (diff) | |
download | crawl-ref-19af7cb5ed24a2f1b456dbe8030418ca77f0f6e2.tar.gz crawl-ref-19af7cb5ed24a2f1b456dbe8030418ca77f0f6e2.zip |
Enslaved fleeing monsters now flee towards you, not away from you.
Hopefully fixes 1828086.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2804 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/beam.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 12 |
3 files changed, 17 insertions, 5 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index b10f73c0fd..6e154a706e 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2039,9 +2039,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 06d4b5586a..3474059a72 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4011,6 +4011,13 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet) mprf("%s merges itself into the air.", name(DESC_CAP_A, true).c_str() ); 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 5376801ed2..1a0e900b25 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2095,7 +2095,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; @@ -2239,7 +2245,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 && + (!isFriendly || monster->target_x != you.x_pos || + monster->target_y != you.y_pos)) { mmov_x *= -1; mmov_y *= -1; |