diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-26 15:17:48 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-26 15:17:48 +0000 |
commit | 8a6b1c9c6b539f8b27f16e27898bc7af485a1f0f (patch) | |
tree | 4df2db2c295f4641c9ab897896c9b5cbac263b72 | |
parent | e72a2008d34eb9e404a512a769bc703a7fc23a14 (diff) | |
download | crawl-ref-8a6b1c9c6b539f8b27f16e27898bc7af485a1f0f.tar.gz crawl-ref-8a6b1c9c6b539f8b27f16e27898bc7af485a1f0f.zip |
Trunk->0.3 merge (2546): Drawing from Destruction with no monsters nearby does not gain piety.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2596 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/decks.cc | 36 | ||||
-rw-r--r-- | crawl-ref/source/decks.h | 2 |
2 files changed, 27 insertions, 11 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 9510b3c9ac..8e34582998 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -440,11 +440,13 @@ void evoke_deck( item_def& deck ) int brownie_points = 0; mpr("You draw a card..."); bool allow_id = in_inventory(deck) && !item_ident(deck, ISFLAG_KNOW_TYPE); - + bool fake_draw = false; + // If the deck wasn't marked, draw a fair card. if ( deck.plus2 == 0 ) { - card_effect( choose_one_card(deck, true), deck_rarity(deck) ); + fake_draw = + !card_effect( choose_one_card(deck, true), deck_rarity(deck) ); if ( deck.sub_type != MISC_DECK_OF_PUNISHMENT ) { @@ -460,8 +462,8 @@ void evoke_deck( item_def& deck ) allow_id = false; // draw the marked card - card_effect(static_cast<card_type>(deck.plus2 - 1), - deck_rarity(deck)); + fake_draw = !card_effect(static_cast<card_type>(deck.plus2 - 1), + deck_rarity(deck)); // If there are more marked cards, shift them up if ( deck.special ) @@ -495,7 +497,8 @@ void evoke_deck( item_def& deck ) you.wield_change = true; } - did_god_conduct(DID_CARDS, brownie_points); + if (!fake_draw) + did_god_conduct(DID_CARDS, brownie_points); } int get_power_level(int power, deck_rarity_type rarity) @@ -737,8 +740,13 @@ static void minefield_card(int power, deck_rarity_type rarity) } } -static void damaging_card(card_type card, int power, deck_rarity_type rarity) +// Return true if it was a "genuine" draw, i.e., there was a monster +// to target. This is still exploitable by finding popcorn monsters. +static bool damaging_card(card_type card, int power, deck_rarity_type rarity) { + extern bool there_are_monsters_nearby(); + bool rc = there_are_monsters_nearby(); + const int power_level = get_power_level(power, rarity); dist target; @@ -783,6 +791,10 @@ static void damaging_card(card_type card, int power, deck_rarity_type rarity) if ( spell_direction( target, beam ) ) zapping(ztype, random2(power/4), beam); + else + rc = false; + + return rc; } static void elixir_card(int power, deck_rarity_type rarity) @@ -1282,8 +1294,9 @@ static int card_power(deck_rarity_type rarity) return result; } -void card_effect(card_type which_card, deck_rarity_type rarity) +bool card_effect(card_type which_card, deck_rarity_type rarity) { + bool rc = true; const int power = card_power(rarity); #ifdef DEBUG_DIAGNOSTICS msg::streams(MSGCH_DIAGNOSTICS) << "Card power: " << power @@ -1336,12 +1349,12 @@ void card_effect(card_type which_card, deck_rarity_type rarity) if ( coinflip() ) your_spells(SPELL_OLGREBS_TOXIC_RADIANCE,random2(power/4), false); else - damaging_card(which_card, power, rarity); + rc = damaging_card(which_card, power, rarity); break; case CARD_VITRIOL: case CARD_FLAME: case CARD_FROST: case CARD_HAMMER: case CARD_PAIN: - damaging_card(which_card, power, rarity); + rc = damaging_card(which_card, power, rarity); break; case CARD_BARGAIN: @@ -1379,7 +1392,10 @@ void card_effect(card_type which_card, deck_rarity_type rarity) break; } - return; + if (you.religion == GOD_NEMELEX_XOBEH && !rc) + simple_god_message(" seems disappointed in you."); + + return rc; } bool is_deck(const item_def &item) diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h index 6ef6725928..929ba71551 100644 --- a/crawl-ref/source/decks.h +++ b/crawl-ref/source/decks.h @@ -40,7 +40,7 @@ bool deck_triple_draw(); bool deck_peek(); bool deck_stack(); bool choose_deck_and_draw(); -void card_effect(card_type which_card, deck_rarity_type rarity); +bool card_effect(card_type which_card, deck_rarity_type rarity); void draw_from_deck_of_punishment(); bool is_deck(const item_def &item); |