summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-24 01:01:31 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-24 01:01:31 +0000
commitcd0672dfe7259e91c502f61433e0382182de1650 (patch)
tree12fd7601d6adf0877a3e35d0f74375a38eb7cabf /crawl-ref/source
parent9578f871072202a78ceab3e66813fd33bb259c22 (diff)
downloadcrawl-ref-cd0672dfe7259e91c502f61433e0382182de1650.tar.gz
crawl-ref-cd0672dfe7259e91c502f61433e0382182de1650.zip
"The Wrath" card: never choose Nemelex (to prevent Nemelex from recursively
forcing the player to draw from his Deck of Punishment), and keep trying different gods until one is found who is willing to punish the player (the good gods will only punish you if you're worshipping an evil god, plus Zin will punish the worshippers of chaotic gods). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7929 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/decks.cc19
-rw-r--r--crawl-ref/source/religion.cc16
-rw-r--r--crawl-ref/source/religion.h2
3 files changed, 31 insertions, 6 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 025f7a283d..404af55c76 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2580,7 +2580,24 @@ static void _genie_card(int power, deck_rarity_type rarity)
// Special case for *your* god, maybe?
static void _godly_wrath()
{
- divine_retribution(static_cast<god_type>(random2(NUM_GODS - 1) + 1));
+ int tries = 100;
+ while (tries-- > 0)
+ {
+ god_type god = static_cast<god_type>(random2(NUM_GODS - 1) + 1);
+
+ // Don't recursively make player draw from the Deck of Punishment.
+ if (god == GOD_NEMELEX_XOBEH)
+ continue;
+
+ // Stop once we find a god willing to punish the player.
+ if (divine_retribution(god))
+ break;
+ }
+
+ if (tries <= 0)
+ {
+ mpr("You somehow manage to escape divine attention...");
+ }
}
static void _curse_card(int power, deck_rarity_type rarity)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 7b742427c0..3353ddc510 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -4727,7 +4727,7 @@ static bool _nemelex_retribution()
return (true);
}
-void divine_retribution( god_type god )
+bool divine_retribution( god_type god )
{
ASSERT(god != GOD_NO_GOD);
@@ -4737,12 +4737,13 @@ void divine_retribution( god_type god )
if ((god == you.religion && is_good_god(god))
|| (god != you.religion && !god_hates_your_god(god)))
{
- return;
+ return (false);
}
god_acting gdact(god, true);
- bool do_more = true;
+ bool do_more = true;
+ bool did_retrib = true;
switch (god)
{
// One in ten chance that Xom might do something good...
@@ -4762,7 +4763,12 @@ void divine_retribution( god_type god )
case GOD_ELYVILON: do_more = _elyvilon_retribution(); break;
default:
- do_more = false;
+#if DEBUG_DIAGNOSTICS || DEBUG_RELIGION
+ mprf(MSGCH_DIAGNOSTICS, "No retribution defined for %s.",
+ god_name(god).c_str());
+#endif
+ do_more = false;
+ did_retrib = false;
break;
}
@@ -4789,6 +4795,8 @@ void divine_retribution( god_type god )
// Just the thought of retribution mollifies the god by at least a
// point...the punishment might have reduced penance further.
dec_penance(god, 1 + random2(3));
+
+ return (did_retrib);
}
static bool _holy_beings_on_level_attitude_change()
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index a2019b7201..16f56447f6 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -94,7 +94,7 @@ bool god_hates_killing(god_type god, const monsters* mon);
bool god_likes_butchery(god_type god);
bool god_hates_butchery(god_type god);
harm_protection_type god_protects_from_harm(god_type god, bool actual = true);
-void divine_retribution(god_type god);
+bool divine_retribution(god_type god);
bool zin_sustenance(bool actual = true);
bool yred_injury_mirror(bool actual = true);