summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-05 11:18:56 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-05 11:18:56 +1000
commit98b441d511bd1538c6803f8fab3a7777c51dc90b (patch)
treece9fe9f204d2a17383f8708641297fe26c0778c3 /crawl-ref
parent70b4882ab1e74848851da2cc5f9f7872ca1c8bc8 (diff)
downloadcrawl-ref-98b441d511bd1538c6803f8fab3a7777c51dc90b.tar.gz
crawl-ref-98b441d511bd1538c6803f8fab3a7777c51dc90b.zip
New monster spec tags for marking monsters summoned.
dur:1-6, marks the abjuration duration of a monster. sum:<str>, any of "clone", "animate", "chaos", "miscast", "zot", "wrath" or "aid", or the relevant spell we're mimicking; nas:<str> equivalent to the non-actor summoner. Not setting the non-actor summoner will mean that kills by these pseudo- summons are unmarked as such.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/dungeon.cc5
-rw-r--r--crawl-ref/source/mapdef.cc42
-rw-r--r--crawl-ref/source/mapdef.h8
3 files changed, 53 insertions, 2 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index ef0616086c..7640048c11 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4933,6 +4933,11 @@ int dgn_place_monster(mons_spec &mspec,
mg.hd = mspec.hd;
mg.hp = mspec.hp;
+ // Marking monsters as summoned
+ mg.abjuration_duration = mspec.abjuration_duration;
+ mg.summon_type = mspec.summon_type;
+ mg.non_actor_summoner = mspec.non_actor_summoner;
+
// XXX: hack.
if (mg.colour == -1)
mg.colour = random_colour();
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index bf6c7c55f3..0882e6fc6d 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -3073,6 +3073,48 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
if (mspec.hp == TAG_UNFOUND)
mspec.hp = 0;
+ int dur = strip_number_tag(mon_str, "dur:");
+ if (dur == TAG_UNFOUND)
+ dur = 0;
+ else if (dur < 1 || dur > 6)
+ dur = 0;
+
+ mspec.abjuration_duration = dur;
+
+ int summon_type = 0;
+ std::string s_type = strip_tag_prefix(mon_str, "sum:");
+ if (!s_type.empty())
+ {
+ // In case of spells!
+ s_type = replace_all_of(s_type, "_", " ");
+ summon_type = static_cast<int>(str_to_summon_type(s_type));
+ if (summon_type == SPELL_NO_SPELL)
+ {
+ error = make_stringf("bad monster summon type: \"%s\"",
+ s_type.c_str());
+ return (slot);
+ }
+ if (mspec.abjuration_duration == 0)
+ {
+ error = "marked summon with no duration";
+ return (slot);
+ }
+ }
+
+ mspec.summon_type = summon_type;
+
+ std::string non_actor_summoner = strip_tag_prefix(mon_str, "nas:");
+ if (!non_actor_summoner.empty())
+ {
+ non_actor_summoner = replace_all_of(non_actor_summoner, "_", " ");
+ mspec.non_actor_summoner = non_actor_summoner;
+ if (mspec.abjuration_duration == 0)
+ {
+ error = "marked summon with no duration";
+ return (slot);
+ }
+ }
+
std::string colour = strip_tag_prefix(mon_str, "col:");
if (!colour.empty())
{
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index a04a092307..f85ae22103 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -542,9 +542,12 @@ class mons_spec
int colour;
int hd;
int hp;
+ int abjuration_duration;
+ int summon_type;
item_list items;
std::string monname;
+ std::string non_actor_summoner;
bool explicit_spells;
monster_spells spells;
@@ -558,8 +561,9 @@ class mons_spec
: mid(id), place(), monbase(base), attitude(ATT_HOSTILE), number(num),
quantity(1), genweight(gw), mlevel(ml), fix_mons(_fixmons),
generate_awake(awaken), patrolling(false), band(false),
- colour(BLACK), hd(0), hp(0), items(), monname(""),
- explicit_spells(false), spells(), extra_monster_flags(0L)
+ colour(BLACK), hd(0), hp(0), abjuration_duration(0), summon_type(0),
+ items(), monname(""), non_actor_summoner(""), explicit_spells(false),
+ spells(), extra_monster_flags(0L)
{
}
};