diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-05 11:18:56 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-05 11:18:56 +1000 |
commit | 98b441d511bd1538c6803f8fab3a7777c51dc90b (patch) | |
tree | ce9fe9f204d2a17383f8708641297fe26c0778c3 /crawl-ref/source/mapdef.cc | |
parent | 70b4882ab1e74848851da2cc5f9f7872ca1c8bc8 (diff) | |
download | crawl-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/source/mapdef.cc')
-rw-r--r-- | crawl-ref/source/mapdef.cc | 42 |
1 files changed, 42 insertions, 0 deletions
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()) { |