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