summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/scripts
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-02-07 19:44:05 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-02-07 19:44:05 +0530
commit22cbbebdf0b402843474de9c091fe944c0d79557 (patch)
tree358b82e40478bc662127a97765dd64b314578c37 /crawl-ref/source/scripts
parent609e8d3028a8f44eb8cadf756675ed0d24ab7e2c (diff)
downloadcrawl-ref-22cbbebdf0b402843474de9c091fe944c0d79557.tar.gz
crawl-ref-22cbbebdf0b402843474de9c091fe944c0d79557.zip
Make place-population report shapeshifters correctly, and merge hydras and ugly things when counting.
Diffstat (limited to 'crawl-ref/source/scripts')
-rw-r--r--crawl-ref/source/scripts/place-population.lua22
1 files changed, 21 insertions, 1 deletions
diff --git a/crawl-ref/source/scripts/place-population.lua b/crawl-ref/source/scripts/place-population.lua
index e1d4fc04dc..cd9c50a4e7 100644
--- a/crawl-ref/source/scripts/place-population.lua
+++ b/crawl-ref/source/scripts/place-population.lua
@@ -9,6 +9,26 @@ local start_level = nil
local end_level = nil
local ignore_uniques = true
+local function canonical_name(mons)
+ local shapeshifter = mons.shapeshifter
+ if shapeshifter then
+ return shapeshifter
+ end
+
+ local mname = mons.name
+
+ if string.find(mname, 'ugly thing$') then
+ return "ugly thing"
+ end
+
+ local _, _, hydra_suffix = string.find(mname, '.*-headed (.*)')
+ if hydra_suffix then
+ mname = hydra_suffix
+ end
+
+ return mname
+end
+
local function count_monsters_at(place, set)
debug.goto_place(place)
test.regenerate_level(nil, use_random_maps)
@@ -16,7 +36,7 @@ local function count_monsters_at(place, set)
local monsters_here = set or { }
for mons in test.level_monster_iterator() do
if not ignore_uniques or not mons.unique then
- local mname = mons.name
+ local mname = canonical_name(mons)
if not excluded_things[mname] then
local mstat = monsters_here[mname] or { count = 0, exp = 0 }
mstat.count = mstat.count + 1