summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
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/decks.cc
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/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc19
1 files changed, 18 insertions, 1 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)