summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-place.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-12 12:42:59 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-12 12:43:22 -0800
commita511725f34635f3e3a55cfc2b4f23723cec61ed5 (patch)
tree62280d716f7a10b501afbf8791ae1626fd2359aa /crawl-ref/source/mon-place.cc
parent1498653cf16e631f825793aed0c76af91efc6287 (diff)
downloadcrawl-ref-a511725f34635f3e3a55cfc2b4f23723cec61ed5.tar.gz
crawl-ref-a511725f34635f3e3a55cfc2b4f23723cec61ed5.zip
Monsters track who summoned them
Diffstat (limited to 'crawl-ref/source/mon-place.cc')
-rw-r--r--crawl-ref/source/mon-place.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index 12c9aac3e6..c326c359d8 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -1270,6 +1270,42 @@ static int _place_monster_aux(const mgen_data &mg,
}
mon->foe = mg.foe;
+ if (!mg.non_actor_summoner.empty())
+ {
+ CrawlStoreValue& blame = mon->props["blame"];
+
+ blame.new_vector(SV_STR, SFLAG_CONST_TYPE);
+ blame.get_vector().push_back(mg.non_actor_summoner);
+ }
+ else if (mg.summoner != NULL)
+ {
+ CrawlStoreValue& blame = mon->props["blame"];
+
+ blame.new_vector(SV_STR, SFLAG_CONST_TYPE);
+
+ if (mg.summoner->atype() == ACT_PLAYER)
+ {
+ blame.get_vector().push_back("themselves");
+ }
+ else
+ {
+ monsters* sum = &menv[mg.summoner->mindex()];
+
+ blame.get_vector().push_back(sum->full_name(DESC_NOCAP_A, true));
+
+ if (sum->props.exists("blame"))
+ {
+ CrawlVector& oldblame = sum->props["blame"].get_vector();
+
+ for (CrawlVector::iterator i = oldblame.begin();
+ i != oldblame.end(); ++i)
+ {
+ blame.get_vector().push_back(*i);
+ }
+ }
+ }
+ }
+
// Initialise (very) ugly things and pandemonium demons.
if (mon->type == MONS_UGLY_THING
|| mon->type == MONS_VERY_UGLY_THING)
@@ -2408,6 +2444,11 @@ int mons_place(mgen_data mg)
break;
}
+ if (mg.behaviour == BEH_COPY)
+ mg.behaviour = mg.summoner == &you
+ ? BEH_FRIENDLY
+ : SAME_ATTITUDE((&menv[mg.summoner->mindex()]));
+
int mid = place_monster(mg);
if (mid == -1)
return (-1);