diff options
author | Adam Borowski <kilobyte@angband.pl> | 2009-11-23 14:15:41 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2009-11-23 15:04:33 +0100 |
commit | 3bea6e2e7aadb7df468b8a00c3a8fb42dde3dfb5 (patch) | |
tree | beb4d7dcd257ffb407f21e9a713bc74b2ec93c97 /crawl-ref/source/monster.cc | |
parent | 2d3e3d3d42a7d5efcceaad43b06abe2e026d3346 (diff) | |
download | crawl-ref-3bea6e2e7aadb7df468b8a00c3a8fb42dde3dfb5.tar.gz crawl-ref-3bea6e2e7aadb7df468b8a00c3a8fb42dde3dfb5.zip |
Move _polyd_can_speak() to monsters::can_speak() so others can use it.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r-- | crawl-ref/source/monster.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 15fd301813..c5c018c8f5 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -659,6 +659,24 @@ bool monsters::can_throw_large_rocks() const || ::mons_species(type) == MONS_OGRE); } +bool monsters::can_speak() +{ + // Priest and wizard monsters can always speak. + if (is_priest() || is_actual_spellcaster()) + return (true); + + // Silent or non-sentient monsters can't use the original speech. + if (mons_intel(this) < I_NORMAL + || mons_shouts(type) == S_SILENT) + { + return (false); + } + + // Does it have the proper vocal equipment? + const mon_body_shape shape = get_mon_shape(this); + return (shape >= MON_SHAPE_HUMANOID && shape <= MON_SHAPE_NAGA); +} + bool monsters::has_spell_of_type(unsigned disciplines) const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) |