diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 22:20:48 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 22:22:47 +1000 |
commit | 61355ed8d15da8e07e762c38f84698b4d77b605a (patch) | |
tree | fd18975919f81bc2b781d3bed67ac5624c45f762 /crawl-ref | |
parent | 58e8489c81d0e62a5b688ecba115c290d0835ca3 (diff) | |
download | crawl-ref-61355ed8d15da8e07e762c38f84698b4d77b605a.tar.gz crawl-ref-61355ed8d15da8e07e762c38f84698b4d77b605a.zip |
Check monster props for a speech key as well as prefixes (kilobyte).
This now means that speech_key will override the lookup: instead of
looking up the monster's name, it will first look up the speech_key's
value.
speech_prefix retains the original implementation of speech_key (adding
a single prefix to a list of possibles).
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/mon-speak.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/mon-stuff.cc | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc index be75705372..a5424f117b 100644 --- a/crawl-ref/source/mon-speak.cc +++ b/crawl-ref/source/mon-speak.cc @@ -461,8 +461,8 @@ bool mons_speaks(monsters *monster) prefixes.push_back("confused"); // Allows monster speech to be altered slightly on-the-fly. - if (monster->props.exists("speech_key")) - prefixes.push_back(monster->props["speech_key"].get_string()); + if (monster->props.exists("speech_prefix")) + prefixes.push_back(monster->props["speech_prefix"].get_string()); const actor* foe = (!crawl_state.arena && monster->wont_attack() && invalid_monster_index(monster->foe)) ? @@ -558,10 +558,19 @@ bool mons_speaks(monsters *monster) } else { + + if (monster->props.exists("speech_key")) + { + msg = _get_speak_string(prefixes, + monster->props["speech_key"].get_string(), + monster, no_player, no_foe, no_foe_name, + no_god, unseen); + } + // If the monster was originally a unique which has been polymorphed // into a non-unique, is its current monter type capable of using its // old speech? - if (!monster->mname.empty() && monster->can_speak()) + if (!monster->mname.empty() && monster->can_speak() && msg.empty()) { msg = _get_speak_string(prefixes, monster->name(DESC_PLAIN), monster, no_player, no_foe, no_foe_name, diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index e0a6cdb023..7c46d42e29 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -1117,7 +1117,7 @@ static void _elven_twin_died(monsters* twin) // Okay, let them climb stairs now. monster->props["can_climb"] = "yes"; - monster->props["speech_key"] = "twin_died"; + monster->props["speech_prefix"] = "twin_died"; // If you've stabbed one of them, the other one is likely asleep still. if (monster->asleep()) |