summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-other.cc
diff options
context:
space:
mode:
authorSamuel Bronson <naesten@gmail.com>2013-04-14 19:31:47 -0400
committerSamuel Bronson <naesten@gmail.com>2013-04-14 19:31:47 -0400
commitd3c17637435c58112f3a46700cdd410b4a7e3359 (patch)
tree0fd55b0cc626b335e4524369ade4bd192e5f1926 /crawl-ref/source/spl-other.cc
parent85ceb4fef687e2758d02f5dedecba64b9e72d6c0 (diff)
downloadcrawl-ref-d3c17637435c58112f3a46700cdd410b4a7e3359.tar.gz
crawl-ref-d3c17637435c58112f3a46700cdd410b4a7e3359.zip
Make Yred/Beogh's recall abilities prevent recalled dudes from running off
That is, make them follow you unless they were already attacking a monster you can see.
Diffstat (limited to 'crawl-ref/source/spl-other.cc')
-rw-r--r--crawl-ref/source/spl-other.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc
index 84130f4435..1fb5408d6d 100644
--- a/crawl-ref/source/spl-other.cc
+++ b/crawl-ref/source/spl-other.cc
@@ -244,6 +244,25 @@ void start_recall(int type)
mpr("Nothing appears to have answered your call.");
}
+// Remind a recalled ally (or one skipped due to proximity) not to run
+// away or wander off.
+void recall_orders(monster *mons)
+{
+ // FIXME: is this okay for berserk monsters? We still want them to
+ // stick around...
+
+ // Don't patrol
+ mons->patrol_point = coord_def(0, 0);
+
+ // Don't wander
+ mons->behaviour = BEH_SEEK;
+
+ // Don't persue distant enemies
+ const actor *foe = mons->get_foe();
+ if (foe && !you.can_see(foe))
+ mons->foe = MHITYOU;
+}
+
// Attempt to recall a single monster by mid, which might be either on or off
// our current level. Returns whether this monster was successfully recalled.
static bool _try_recall(mid_t mid)
@@ -258,6 +277,7 @@ static bool _try_recall(mid_t mid)
if (mons->pos().distance_from(you.pos()) < 3
&& mons->see_cell_no_trans(you.pos()))
{
+ recall_orders(mons);
return false;
}
else
@@ -266,6 +286,7 @@ static bool _try_recall(mid_t mid)
if (find_habitable_spot_near(you.pos(), mons_base_type(mons), 3, false, empty)
&& mons->move_to_pos(empty))
{
+ recall_orders(mons);
simple_monster_message(mons, " is recalled.");
return true;
}