summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-29 16:37:55 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-29 16:37:55 +0000
commit516bb94c3c609ef0eaa4adebeb68b64b568f2219 (patch)
treeb6c52753fef70ff0f8e1ba6cb981429222367425 /crawl-ref/source/mapdef.cc
parent2931994db5281c12610cf08647175863622f5f78 (diff)
downloadcrawl-ref-516bb94c3c609ef0eaa4adebeb68b64b568f2219.tar.gz
crawl-ref-516bb94c3c609ef0eaa4adebeb68b64b568f2219.zip
Better handling for mimics in .des files, fixed guardian naga minivault.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1396 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 1535b2ffa0..4ef6f3217a 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -881,6 +881,9 @@ mons_spec mons_list::pick_monster(mons_spec_slot &slot)
slot.fix_slot = false;
}
+ if (pick.mid == MONS_WEAPON_MIMIC && !pick.fix_mons)
+ pick.mid = random_range(MONS_GOLD_MIMIC, MONS_POTION_MIMIC);
+
return (pick);
}
@@ -897,6 +900,31 @@ void mons_list::clear()
mons.clear();
}
+bool mons_list::check_mimic(const std::string &s, int *mid, bool *fix) const
+{
+ if (s == "mimic")
+ {
+ *mid = MONS_WEAPON_MIMIC;
+ *fix = false;
+ return (true);
+ }
+ else if (s == "gold mimic")
+ *mid = MONS_GOLD_MIMIC;
+ else if (s == "weapon mimic")
+ *mid = MONS_WEAPON_MIMIC;
+ else if (s == "armour mimic")
+ *mid = MONS_ARMOUR_MIMIC;
+ else if (s == "scroll mimic")
+ *mid = MONS_SCROLL_MIMIC;
+ else if (s == "potion mimic")
+ *mid = MONS_POTION_MIMIC;
+ else
+ return (false);
+
+ *fix = true;
+ return (true);
+}
+
mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
{
mons_spec_slot slot;
@@ -913,7 +941,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
if (weight == TAG_UNFOUND || weight <= 0)
weight = 10;
- const bool fixmons = strip_tag(s, "fix_mons");
+ bool fixmons = strip_tag(s, "fix_mons");
const bool generate_awake = strip_tag(s, "generate_awake");
trim_string(s);
@@ -924,6 +952,8 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
mlevel = -8;
else if (s == "9")
mlevel = -9;
+ else if (check_mimic(s, &mid, &fixmons))
+ ;
else if (s != "0")
{
mid = mons_by_name(s);