From 3bea6e2e7aadb7df468b8a00c3a8fb42dde3dfb5 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Mon, 23 Nov 2009 14:15:41 +0100 Subject: Move _polyd_can_speak() to monsters::can_speak() so others can use it. --- crawl-ref/source/monster.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crawl-ref/source/monster.cc') 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) -- cgit v1.2.3-54-g00ecf