From: <gi...@cr...> - 2013-04-14 23:35:14
|
via d3c17637435c58112f3a46700cdd410b4a7e3359 (commit) from 85ceb4fef687e2758d02f5dedecba64b9e72d6c0 (commit) ----------------------------------------------------------------------- commit d3c17637435c58112f3a46700cdd410b4a7e3359 Author: Samuel Bronson <na...@gm...> Date: Sun Apr 14 19:31:47 2013 -0400 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. ----------------------------------------------------------------------- Summary of changes: crawl-ref/source/godcompanions.cc | 4 ++++ crawl-ref/source/spl-other.cc | 21 +++++++++++++++++++++ crawl-ref/source/spl-other.h | 1 + 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/crawl-ref/source/godcompanions.cc b/crawl-ref/source/godcompanions.cc index 7a1016d..ab44ff9 100644 --- a/crawl-ref/source/godcompanions.cc +++ b/crawl-ref/source/godcompanions.cc @@ -16,6 +16,7 @@ #include "mon-util.h" #include "religion.h" #include "stuff.h" +#include "spl-other.h" #include "branch.h" map<mid_t, companion> companion_list; @@ -163,6 +164,9 @@ bool recall_offlevel_ally(mid_t mid) mons->timeout_enchantments(turns / 10); } you.moveto(old_pos); + // Do this after returning the player to the proper position + // because it uses player position + recall_orders(mons); return true; } diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc index 84130f4..1fb5408 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; } diff --git a/crawl-ref/source/spl-other.h b/crawl-ref/source/spl-other.h index 56e9a8c..83fa3f1 100644 --- a/crawl-ref/source/spl-other.h +++ b/crawl-ref/source/spl-other.h @@ -9,6 +9,7 @@ spret_type cast_sublimation_of_blood(int pow, bool fail); spret_type cast_death_channel(int pow, god_type god, bool fail); spret_type cast_recall(bool fail); void start_recall(int type); +void recall_orders(monster *mons); void do_recall(int time); void end_recall(); -- Dungeon Crawl Stone Soup |