diff options
author | Cedor <cedordark@yahoo.fr> | 2013-11-24 00:35:00 +0100 |
---|---|---|
committer | Chris Campbell <chriscampbell89@gmail.com> | 2014-01-03 19:17:34 +0000 |
commit | 67e62b1a32c13c9cd625f80120da6cd9ffb0248a (patch) | |
tree | 086471d3dd7f06430708efe6af1384d3c1f72a8d /crawl-ref/source/mon-info.cc | |
parent | ff7ed8f24b57b6b6eb22737545387ca67b600080 (diff) | |
download | crawl-ref-67e62b1a32c13c9cd625f80120da6cd9ffb0248a.tar.gz crawl-ref-67e62b1a32c13c9cd625f80120da6cd9ffb0248a.zip |
Added spell list to monster description for player ghosts and vault monsters
Diffstat (limited to 'crawl-ref/source/mon-info.cc')
-rw-r--r-- | crawl-ref/source/mon-info.cc | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc index 56de48c5cc..874131f9c6 100644 --- a/crawl-ref/source/mon-info.cc +++ b/crawl-ref/source/mon-info.cc @@ -219,7 +219,8 @@ static bool _is_public_key(string key) || key == "chimera_part_3" || key == "chimera_batty" || key == "chimera_wings" - || key == "chimera_legs") + || key == "chimera_legs" + || key == "custom_spells") { return true; } @@ -677,6 +678,21 @@ monster_info::monster_info(const monster* m, int milev) u.ghost.damage = quantise(ghost.damage, 5); } + // book loading for player ghost and vault monsters + spells.init(SPELL_NO_SPELL); + if (m->props.exists("custom_spells") || mons_is_pghost(type)) + { + for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) + spells[i] = m->spells[i]; + // XXX handle here special cases for sources of magic (magic, divine, other) + if (m->is_priest()) + this->props["priest"] = true; + else if (m->is_actual_spellcaster()) + this->props["caster"] = true; + else + this->props[""] = true; + } + for (unsigned i = 0; i <= MSLOT_LAST_VISIBLE_SLOT; ++i) { bool ok; @@ -1728,6 +1744,20 @@ bool monster_info::ground_level() const return !airborne() && !is(MB_CLINGING); } +vector<mon_spellbook_type> monster_info::get_spellbooks() const +{ + vector<mon_spellbook_type> books; + + // special case for vault monsters: if they have a custom book, + // treat it as MST_GHOST + if (this->props.exists("custom_spells")) + books.push_back(MST_GHOST); + else + books = mons_spellbook_list(this->type); + + return books; +} + void get_monster_info(vector<monster_info>& mons) { vector<monster* > visible; |