summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-chimera.cc
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-06-18 01:03:53 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-06-21 18:26:20 +0100
commit61733ca5542371ee3aab8f550039d379f8308a25 (patch)
treeb93d9aad579d08356d276a34812a61d737321750 /crawl-ref/source/mon-chimera.cc
parent2eb7d383bc1e72389c44a96616fa66d788b05c87 (diff)
downloadcrawl-ref-61733ca5542371ee3aab8f550039d379f8308a25.tar.gz
crawl-ref-61733ca5542371ee3aab8f550039d379f8308a25.zip
Support spell lists of 2nd and 3rd chimera parts
Diffstat (limited to 'crawl-ref/source/mon-chimera.cc')
-rw-r--r--crawl-ref/source/mon-chimera.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-chimera.cc b/crawl-ref/source/mon-chimera.cc
index 0f31e99d28..9342bbd9df 100644
--- a/crawl-ref/source/mon-chimera.cc
+++ b/crawl-ref/source/mon-chimera.cc
@@ -55,6 +55,27 @@ static void apply_chimera_part(monster* mon, monster_type part, int partnum)
mon->props["chimera_batty"].get_int() = partnum;
else if (mons_flies(&dummy))
mon->props["chimera_wings"].get_int() = partnum;
+
+ // Apply spells but only for 2nd and 3rd parts since 1st part is
+ // already supported by the original define_monster call
+ if (partnum > 1)
+ {
+ // Check monster's spells
+ for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i)
+ {
+ if (dummy.spells[i] != SPELL_NO_SPELL)
+ continue;
+ // Find a free spell slot on the chimera
+ for (int j = 0; j < NUM_MONSTER_SPELL_SLOTS; ++j)
+ {
+ if (mon->spells[j] == SPELL_NO_SPELL)
+ {
+ mon->spells[j] = dummy.spells[i];
+ break;
+ }
+ }
+ }
+ }
}
monster_type get_chimera_part(const monster* mon, int partnum)