summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-04 19:13:03 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-04 19:13:03 +0000
commit1a5d9f3661b57f592f9b108dc15d0c707e3603e3 (patch)
tree56f651b90990a47ed0b6e4f90d09069f136f5273 /crawl-ref/source/decks.cc
parent74061dc6c48cf08a48485d0a7ab4074188c75d0a (diff)
downloadcrawl-ref-1a5d9f3661b57f592f9b108dc15d0c707e3603e3.tar.gz
crawl-ref-1a5d9f3661b57f592f9b108dc15d0c707e3603e3.zip
Once you've seen two cards form a deck, you identify it.
Triple Draw now loses some cards from the deck. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4072 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 83f05493c4..e2f8e50bc1 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -67,6 +67,8 @@
// The card type and per-card flags are each stored as unsigned bytes,
// for a maximum of 256 different kinds of cards and 8 bits of flags.
+static void _deck_ident(item_def& deck);
+
struct card_with_weights
{
card_type card;
@@ -447,6 +449,10 @@ static void _remember_drawn_card(item_def& deck, card_type card)
CrawlHashTable &props = deck.props;
CrawlVector &drawn = props["drawn_cards"].get_vector();
drawn.push_back( static_cast<char>(card) );
+
+ // Once you've drawn two cards, you know the deck.
+ if ( drawn.size() >= 2 )
+ _deck_ident(deck);
}
const std::vector<card_type> get_drawn_cards(const item_def& deck)
@@ -1047,6 +1053,18 @@ bool deck_triple_draw()
if (_check_buggy_deck(deck))
return false;
+ // lose some cards, but keep at least two
+ if ( cards_in_deck(deck) > 2 )
+ {
+ const int num_lost = std::min(cards_in_deck(deck)-2, random2(2) + 1);
+ for ( int i = 0; i < num_lost; ++i )
+ _deck_lose_card(deck);
+ if ( num_lost == 1 )
+ mpr("A card falls out of the deck.");
+ else if ( num_lost > 1 )
+ mpr("Some cards fall out of the deck.");
+ }
+
const int num_cards = cards_in_deck(deck);
if (num_cards == 1)