summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godcompanions.cc
diff options
context:
space:
mode:
authorDracoOmega <draco_omega@live.com>2013-02-27 13:38:42 -0330
committerDracoOmega <draco_omega@live.com>2013-03-03 18:36:51 -0330
commit72f3d047aa9c895fba5a28db6dcd34d986baf12c (patch)
tree3978293d78a7579429abd9b579f61013d9ce07fa /crawl-ref/source/godcompanions.cc
parentbf0e94542fb4c2ba0df094e86d8b992edf4b5515 (diff)
downloadcrawl-ref-72f3d047aa9c895fba5a28db6dcd34d986baf12c.tar.gz
crawl-ref-72f3d047aa9c895fba5a28db6dcd34d986baf12c.zip
Change recall to be incremental instead of instant
Instead of gathering all corresponding allies and dumping them instantly on top of you, recall now recalls a single ally every 3-6 aut and continues until all appropriate allies have either been recalled, or recall was attempted on them and failed (possibly because there was no room). This should allow recall to still be a useful logistical tool for transporting your army around while weaking its ability to instantly snipe specific targets.
Diffstat (limited to 'crawl-ref/source/godcompanions.cc')
-rw-r--r--crawl-ref/source/godcompanions.cc76
1 files changed, 72 insertions, 4 deletions
diff --git a/crawl-ref/source/godcompanions.cc b/crawl-ref/source/godcompanions.cc
index a26c0cb5a0..acd7fa3b9d 100644
--- a/crawl-ref/source/godcompanions.cc
+++ b/crawl-ref/source/godcompanions.cc
@@ -94,7 +94,7 @@ bool recall_offlevel_companions()
// Recall can't pull monsters out of the Abyss
if (comp->level.branch == BRANCH_ABYSS)
continue;
-
+
if (comp->mons.place(true))
{
monster* mons = monster_by_mid(mid);
@@ -137,11 +137,79 @@ bool recall_offlevel_companions()
return recalled;
}
-bool companion_is_elsewhere(const monster* mons)
+void populate_offlevel_recall_list()
+{
+ for(map<mid_t, companion>::iterator i = companion_list.begin();
+ i != companion_list.end(); ++i )
+ {
+ int mid = i->first;
+ companion* comp = &i->second;
+ if (comp->level != level_id::current())
+ {
+ // Recall can't pull monsters out of the Abyss
+ if (comp->level.branch == BRANCH_ABYSS)
+ continue;
+
+ you.recall_list.push_back(mid);
+ }
+ }
+}
+
+bool recall_offlevel_ally(mid_t mid)
+{
+ if (!companion_is_elsewhere(mid))
+ return false;
+
+ companion* comp = &companion_list[mid];
+ if (comp->level != level_id::current())
+ {
+ if (comp->mons.place(true))
+ {
+ monster* mons = monster_by_mid(mid);
+
+ // The monster is now on this level
+ remove_monster_from_transit(comp->level, mid);
+ comp->level = level_id::current();
+ simple_monster_message(mons, " is recalled.");
+
+ // Catch up time for off-level monsters
+ // (We move the player away so that we don't get expiry
+ // messages for things that supposed wore off ages ago)
+ const coord_def old_pos = you.pos();
+ you.moveto(coord_def(0, 0));
+
+ int turns = you.elapsed_time - comp->timestamp;
+ if (mons_can_regenerate(mons))
+ {
+ if (monster_descriptor(mons->type, MDSC_REGENERATES))
+ mons->heal(turns);
+ else
+ {
+ const int regen_rate = max(mons_natural_regen_rate(mons) * 2, 5);
+ mons->heal(div_rand_round(turns * regen_rate, 50));
+ }
+ }
+ if (turns >= 10 && mons->alive())
+ {
+ // Remove confusion manually (so that the monster
+ // doesn't blink after being recalled)
+ mons->del_ench(ENCH_CONFUSION, true);
+ mons->timeout_enchantments(turns / 10);
+ }
+ you.moveto(old_pos);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool companion_is_elsewhere(mid_t mid)
{
- if (companion_list.find(mons->mid) != companion_list.end())
+ if (companion_list.find(mid) != companion_list.end())
{
- return (companion_list[mons->mid].level != level_id::current());
+ return (companion_list[mid].level != level_id::current());
}
return false;
} \ No newline at end of file