summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monspeak.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 10:13:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 10:13:49 +0000
commitc5f945ee7a4616a77a568245ebb0fcd7c8b859b1 (patch)
tree6990a8687f28fe01b4232712c634a93f81c52b35 /crawl-ref/source/monspeak.cc
parent299e58e1cac6a28bde782516f08532f6fe08aec9 (diff)
downloadcrawl-ref-c5f945ee7a4616a77a568245ebb0fcd7c8b859b1.tar.gz
crawl-ref-c5f945ee7a4616a77a568245ebb0fcd7c8b859b1.zip
FR #2083661: when polymorphed, unique (and named) monsters now retain their
name (but not spells, yet), and use their old speech text if it makes sense for them to be able to do so. Polymorphed monsters now retain some of their old flags, like MF_CREATED_FRIENDLY and MF_GOT_HALF_XP. If the Royal Jelly is polymorphed into something else then the Slime:6 vaults will unlock when that monster is killed. If the Royal Jelly is banished the player will be given a hint that it's gone and that the vaults will remain locked. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7970 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monspeak.cc')
-rw-r--r--crawl-ref/source/monspeak.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc
index 059ad562cc..2619563f2b 100644
--- a/crawl-ref/source/monspeak.cc
+++ b/crawl-ref/source/monspeak.cc
@@ -200,6 +200,27 @@ static std::string _player_ghost_speak_str(const monsters *monster,
return msg;
}
+// If the monster was originally a unique which has been polymorphed into
+// a non-unique, is its current monter type capable of using it's old
+// speech?
+static bool _polyd_can_speak(const monsters* monster)
+{
+ // Wizard and priest monsters can always speak.
+ if (mons_class_flag(monster->type, M_ACTUAL_SPELLS | M_PRIEST))
+ return (true);
+
+ // Silent or non-sentient monsters can't use the original speech.
+ if (mons_intel(monster) < I_NORMAL
+ || mons_shouts(monster->type) == S_SILENT)
+ {
+ return (false);
+ }
+
+ // Does it have the proper vocal equipment?
+ const mon_body_shape shape = get_mon_shape(monster);
+ return (shape >= MON_SHAPE_HUMANOID && shape <= MON_SHAPE_NAGA);
+}
+
// Returns true if something is said.
bool mons_speaks(const monsters *monster)
{
@@ -316,7 +337,15 @@ bool mons_speaks(const monsters *monster)
msg = _get_speak_string(prefixes, "pandemonium lord", monster);
}
else
- msg = _get_speak_string(prefixes, monster->name(DESC_PLAIN), monster);
+ {
+ if (!monster->mname.empty() && _polyd_can_speak(monster))
+ msg = _get_speak_string(prefixes, monster->name(DESC_PLAIN),
+ monster);
+
+ if (msg.empty())
+ msg = _get_speak_string(prefixes, monster->base_name(DESC_PLAIN),
+ monster);
+ }
// The exact name brought no results, try monster genus.
if ((msg.empty() || msg == "__NEXT")