summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
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 );