summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godwrath.cc
diff options
context:
space:
mode:
authorBrendan Hickey <brendan@bhickey.net>2013-07-28 00:31:07 -0700
committerBrendan Hickey <brendan@bhickey.net>2013-07-28 00:37:53 -0700
commitcc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872 (patch)
tree2534d2f5cac007ec674bc966576f0d47542d17b0 /crawl-ref/source/godwrath.cc
parent772cbec2479d6b59ccb91cad149c7edf8968cf6f (diff)
downloadcrawl-ref-cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872.tar.gz
crawl-ref-cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872.zip
Refactor 'you.religion' checks.
Pull 'you.religion [!=]= FOO' checks into a function: you_worship(FOO). This change is part of a large plan to clean up religion.
Diffstat (limited to 'crawl-ref/source/godwrath.cc')
-rw-r--r--crawl-ref/source/godwrath.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index 297036d522..949d077ecd 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -498,7 +498,7 @@ static bool _yredelemnul_retribution()
if (random2(you.experience_level) > 4)
{
- if (you.religion == god && coinflip() && yred_slaves_abandon_you())
+ if (you_worship(god) && coinflip() && yred_slaves_abandon_you())
;
else
{
@@ -697,7 +697,7 @@ static bool _beogh_retribution()
}
case 3: // 25%, relatively harmless
case 4: // in effect, only for penance
- if (you.religion == god && beogh_followers_abandon_you())
+ if (you_worship(god) && beogh_followers_abandon_you())
break;
// else fall through
default: // send orcs after you (3/8 to 5/8)
@@ -1013,7 +1013,7 @@ static bool _fedhas_retribution()
// We have 3 forms of retribution, but players under penance will be
// spared the 'you are now surrounded by oklob plants, please die' one.
- const int retribution_options = you.religion == GOD_FEDHAS ? 2 : 3;
+ const int retribution_options = you_worship(GOD_FEDHAS) ? 2 : 3;
switch (random2(retribution_options))
{
@@ -1280,13 +1280,13 @@ static bool _beogh_idol_revenge()
// Beogh watches his charges closely, but for others doesn't always
// notice.
- if (you.religion == GOD_BEOGH
+ if (you_worship(GOD_BEOGH)
|| (player_genus(GENPC_ORCISH) && coinflip())
|| one_chance_in(3))
{
const char *revenge;
- if (you.religion == GOD_BEOGH)
+ if (you_worship(GOD_BEOGH))
revenge = _get_beogh_speech("idol follower").c_str();
else if (player_genus(GENPC_ORCISH))
revenge = _get_beogh_speech("idol orc").c_str();
@@ -1305,7 +1305,7 @@ static void _tso_blasts_cleansing_flame(const char *message)
{
// TSO won't protect you from his own cleansing flame, and Xom is too
// capricious to protect you from it.
- if (you.religion != GOD_SHINING_ONE && you.religion != GOD_XOM
+ if (!you_worship(GOD_SHINING_ONE) && !you_worship(GOD_XOM)
&& !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY * 2))
{
god_speaks(you.religion,
@@ -1400,7 +1400,7 @@ static void _god_smites_you(god_type god, const char *message,
// Your god won't protect you from his own smiting, and Xom is too
// capricious to protect you from any god's smiting.
- if (you.religion != god && you.religion != GOD_XOM
+ if (!you_worship(god) && !you_worship(GOD_XOM)
&& !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY * 2))
{
god_speaks(you.religion,