summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-02-04 14:11:59 -0700
committerSteve Melenchuk <smelenchuk@gmail.com>2014-02-04 14:21:53 -0700
commit9bc3f90c7b04ef2dcce27fb88427e669ef168858 (patch)
tree31087a9d9d05f703eedcf1c1b2acf356b3c86621 /crawl-ref/source/mapdef.cc
parent99f7917a84f56ab630e2db4f5a4c8057d8e99064 (diff)
downloadcrawl-ref-9bc3f90c7b04ef2dcce27fb88427e669ef168858.tar.gz
crawl-ref-9bc3f90c7b04ef2dcce27fb88427e669ef168858.zip
Allow specifying Serpent of Hell subtype in spec again.
Instead of using soh_flavour:, just specify the branch immediately after "serpent of hell" either in full or abbreviation, e.g. "serpent of hell tartarus" or "serpent of hell coc". Mostly for use with the monster program, but vault makers needing a specific Serpent (sprint, anyone?) can do so now.
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index d1f62757f1..dfbeb59af6 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -4368,6 +4368,27 @@ mons_spec mons_list::demonspawn_monspec(string name) const
return spec;
}
+mons_spec mons_list::soh_monspec(string name) const
+{
+ // "serpent of hell " is 16 characters
+ name = name.substr(16);
+ string abbrev =
+ uppercase_first(lowercase(name)).substr(0, 3);
+ switch (str_to_branch(abbrev))
+ {
+ case BRANCH_GEHENNA:
+ return MONS_SERPENT_OF_HELL;
+ case BRANCH_COCYTUS:
+ return MONS_SERPENT_OF_HELL_COCYTUS;
+ case BRANCH_DIS:
+ return MONS_SERPENT_OF_HELL_DIS;
+ case BRANCH_TARTARUS:
+ return MONS_SERPENT_OF_HELL_TARTARUS;
+ default:
+ return MONS_PROGRAM_BUG;
+ }
+}
+
mons_spec mons_list::mons_by_name(string name) const
{
name = replace_all_of(name, "_", " ");
@@ -4464,6 +4485,10 @@ mons_spec mons_list::mons_by_name(string name) const
return demonspawn_monspec(name);
}
+ // The space is important - it indicates a flavour is being specified.
+ if (name.find("serpent of hell ") != string::npos)
+ return soh_monspec(name);
+
return get_monster_by_name(name);
}