diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 16:48:25 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 16:48:25 +0000 |
commit | 85703632b12462f84e828ea3952c5c675f2907d5 (patch) | |
tree | 0f2b6ce1329aacd64a662233a2361312cbf2e1a7 /crawl-ref/source/mon-util.cc | |
parent | a729d6cf3924926ca7139a24e381f35ae4ec10d7 (diff) | |
download | crawl-ref-85703632b12462f84e828ea3952c5c675f2907d5.tar.gz crawl-ref-85703632b12462f84e828ea3952c5c675f2907d5.zip |
Add logic to allow the use of a character's religion in
the speech files. For atheistic characters, "you" is
used instead, so that the result looks like this:
I like/hate Xom. ---- I like/hate you.
Xom is mighty/stupid. ---- You are mighty/stupid.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3486 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index fa3b93b271..6a85bd55cb 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -48,6 +48,7 @@ #include "mtransit.h" #include "player.h" #include "randart.h" +#include "religion.h" #include "spl-util.h" #include "stuff.h" #include "terrain.h" @@ -5383,6 +5384,22 @@ void mon_enchant::set_duration(const monsters *mons, const mon_enchant *added) maxduration = duration; } +// replaces @player_god@ and @god_is@ with player's god name +// special handling for atheists: use "you"/"You" instead +static std::string replace_god_name(bool need_verb = false, bool capital = false) +{ + std::string result = + (you.religion == GOD_NO_GOD ? (capital? "You" : "you") + : god_name(you.religion, false)); + if (need_verb) + { + result += + (you.religion == GOD_NO_GOD? " are" : " is"); + } + + return (result); +} + static std::string get_species_insult(const std::string type) { std::string lookup = "insult "; @@ -5493,6 +5510,14 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@possessive@", monster->pronoun(PRONOUN_NOCAP_POSSESSIVE)); + // replace with "you are" for atheists + msg = replace_all(msg, "@god_is@", replace_god_name(true, false)); + msg = replace_all(msg, "@God_is@", replace_god_name(true, true)); + + // no verb needed + msg = replace_all(msg, "@player_god@", replace_god_name(false, false)); + msg = replace_all(msg, "@Player_god@", replace_god_name(false, true)); + // replace with species specific insults msg = replace_all(msg, "@species_insult_adj1@", get_species_insult("adj1")); msg = replace_all(msg, "@species_insult_adj2@", get_species_insult("adj2")); |