summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 23:12:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 23:12:03 +0000
commitfef9f681531bf38dc5a969ba9d502418239f89c4 (patch)
tree254823fdbf77bb313f407aed250963cfa3fb275e /crawl-ref/source/religion.cc
parent640681c01424da536a923083e0f39d346e219f44 (diff)
downloadcrawl-ref-fef9f681531bf38dc5a969ba9d502418239f89c4.tar.gz
crawl-ref-fef9f681531bf38dc5a969ba9d502418239f89c4.zip
Move the tutorial descriptions of gods' likes and dislikes into
functions of their own, and reuse them in the god descriptions ('^' screen, when praying at altars, and when searching the database). What's still missing is some sort of "What this god offers you". The current handling makes gods like Lugonu, who have no restrictions and demand very little, appear like no-brainers, when of course the whole thing is much more complicated. I'll also be adding some extended information for the ^ screen (thus for your own god only). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5870 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc240
1 files changed, 240 insertions, 0 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index b017addf04..6aaa64e942 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -464,6 +464,233 @@ bool god_gives_permanent_followers(god_type god)
|| god == GOD_BEOGH);
}
+
+std::string print_god_likes(god_type which_god, bool verbose)
+{
+ // Return early for the special cases.
+ if (which_god == GOD_NO_GOD || which_god == GOD_XOM)
+ return "";
+
+ std::string text = god_name(which_god);
+ std::vector<std::string> likes;
+
+ // Unique/unusual piety gain methods first.
+ switch (which_god)
+ {
+ case GOD_SIF_MUNA:
+ likes.push_back("train your various spell casting skills");
+ break;
+
+ case GOD_TROG:
+ snprintf(info, INFO_SIZE, "destroy spellbooks (especially ones you've"
+ "never read)%s",
+ verbose ? "via the <w>a</w> command" : "");
+
+ likes.push_back(info);
+ break;
+
+ case GOD_NEMELEX_XOBEH:
+ likes.push_back("draw unmarked cards and use up decks");
+ break;
+
+ case GOD_ELYVILON:
+ snprintf(info, INFO_SIZE, "destroy weapons (especially evil ones)%s",
+ verbose ? "via the <w>a</w> command" : "");
+
+ likes.push_back(info);
+ break;
+
+ default:
+ break;
+ }
+
+ switch (which_god)
+ {
+ case GOD_SHINING_ONE: case GOD_KIKUBAAQUDGHA: case GOD_OKAWARU:
+ case GOD_MAKHLEB: case GOD_SIF_MUNA: case GOD_TROG:
+ snprintf(info, INFO_SIZE, "sacrifice items%s",
+ verbose ? " (by dropping them on an altar and praying)" : "");
+
+ likes.push_back(info);
+ break;
+
+ case GOD_NEMELEX_XOBEH:
+ snprintf(info, INFO_SIZE, "sacrifice items%s",
+ verbose ? " (by standing over them and praying)" : "");
+
+ likes.push_back(info);
+ break;
+
+ case GOD_ZIN:
+ snprintf(info, INFO_SIZE, "sacrifice gold%s",
+ verbose ? " (by praying at an altar)" : "");
+
+ likes.push_back(info);
+ break;
+
+ default:
+ break;
+ }
+
+ if (god_likes_butchery(which_god))
+ likes.push_back("butcher corpses while praying");
+
+ switch (which_god)
+ {
+ case GOD_KIKUBAAQUDGHA: case GOD_YREDELEMNUL: case GOD_OKAWARU:
+ case GOD_VEHUMET: case GOD_MAKHLEB: case GOD_TROG:
+ case GOD_BEOGH: case GOD_LUGONU:
+ likes.push_back("kill living beings");
+ break;
+
+ default:
+ break;
+ }
+
+ switch (which_god)
+ {
+ case GOD_SHINING_ONE: case GOD_OKAWARU: case GOD_VEHUMET:
+ case GOD_MAKHLEB: case GOD_LUGONU:
+ likes.push_back("kill the undead");
+ break;
+
+ default:
+ break;
+ }
+
+ switch (which_god)
+ {
+ case GOD_SHINING_ONE: case GOD_OKAWARU: case GOD_MAKHLEB:
+ likes.push_back("kill demons");
+ break;
+
+ default:
+ break;
+ }
+
+ // Unusual kills.
+ switch (which_god)
+ {
+ case GOD_ZIN:
+ likes.push_back("kill monsters which cause mutation or rotting");
+ break;
+
+ case GOD_SHINING_ONE:
+ likes.push_back("kill living evil beings");
+ break;
+
+ case GOD_BEOGH:
+ likes.push_back("kill the priests of other religions");
+ break;
+
+ case GOD_TROG:
+ likes.push_back("kill wizards and other users of magic");
+ break;
+
+ default:
+ break;
+ }
+
+ if (likes.size() == 0)
+ {
+ text += " %s doesn't like anything? This a bug; please report it.";
+ }
+ else
+ {
+ text += " likes it when you ";
+ text += comma_separated_line(likes.begin(), likes.end(),
+ " and ", ", ");
+ text += ".";
+ }
+
+ return (text);
+}
+
+// verbose currently unused
+std::string print_god_dislikes(god_type which_god, bool /*verbose*/)
+{
+ // Return early for the special cases.
+ if (which_god == GOD_NO_GOD || which_god == GOD_XOM)
+ return "";
+
+ std::vector<std::string> dislikes;
+
+ if (god_hates_butchery(which_god))
+ dislikes.push_back("butcher corpses while praying");
+
+ if (is_good_god(which_god))
+ {
+ dislikes.push_back("drink blood");
+ dislikes.push_back("perform cannibalism");
+ dislikes.push_back("use necromancy");
+ dislikes.push_back("use unholy magic or items");
+ dislikes.push_back("attack holy beings");
+ dislikes.push_back("attack neutral beings");
+ }
+
+ switch (which_god)
+ {
+ case GOD_ZIN: case GOD_SHINING_ONE: case GOD_ELYVILON:
+ case GOD_OKAWARU:
+ dislikes.push_back("attack allies");
+ break;
+
+ case GOD_BEOGH:
+ dislikes.push_back("attack allied orcs");
+ break;
+
+ default:
+ break;
+ }
+
+ switch (which_god)
+ {
+ case GOD_ELYVILON: case GOD_ZIN: case GOD_OKAWARU:
+ dislikes.push_back("allow an ally to die");
+ break;
+
+ default:
+ break;
+ }
+
+ switch (which_god)
+ {
+ case GOD_ZIN:
+ dislikes.push_back("cause yourself to mutate in a way that could "
+ "have been avoided");
+ dislikes.push_back("eat the flesh of sentient beings");
+ break;
+
+ case GOD_SHINING_ONE:
+ dislikes.push_back("poison a monster");
+ dislikes.push_back("attack in an unchivalric manner");
+ break;
+
+ case GOD_ELYVILON:
+ dislikes.push_back("kill a living thing while praying");
+ break;
+
+ case GOD_TROG:
+ dislikes.push_back("memorize spells");
+ dislikes.push_back("cast spells");
+ break;
+
+ default:
+ break;
+ }
+
+ if (dislikes.empty())
+ return "";
+
+ std::string text = god_name(which_god);
+ text += " dislikes it when you ";
+ text += comma_separated_line(dislikes.begin(), dislikes.end(),
+ " or ", ", ");
+ text += ".";
+
+ return (text);
+}
+
void dec_penance(god_type god, int val)
{
if (you.penance[god] > 0)
@@ -1889,6 +2116,19 @@ std::string god_name( god_type which_god, bool long_name )
return "";
}
+god_type string_to_god(const char *name)
+{
+ god_type god;
+ for (int i = 0; i < NUM_GODS; i++)
+ {
+ god = (god_type) i;
+ if (name == god_name(god, false))
+ return (god);
+ }
+
+ return (GOD_NO_GOD);
+}
+
void god_speaks( god_type god, const char *mesg )
{
mpr( mesg, MSGCH_GOD, god );