diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/decks.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 2 |
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); |