summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-08 05:55:47 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-08 05:55:47 +0000
commite7240df9978d7ba42ed7dcfdf9ab385b2ce74d36 (patch)
tree31ecdc6a9945ba6bfb8e1b35cb484808df1f4f57 /crawl-ref/source/decks.h
parent16a8b1fe4a5acec73e490b9f7d3e53f567673763 (diff)
downloadcrawl-ref-e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36.tar.gz
crawl-ref-e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36.zip
Added class CrawlHashTable, a savable/loadable string-keyed
associative array with heterogeneous values, capable of holding booleans, bytes, shorts, longs, floats, string, coordinates (coord_def), items (item_def) and nested hash tables. A table can be made to be homogeneous by giving it a value type, which causes dynamic type checking to be performed. The same type checking can be performed for individual member values of a heterogeneous table by setting a flag on that value. A flag can also be set on an individual member value to prevent its value from being changed. CrawlHashTable is currently only used for the props field of the item_def struct (though it could easily be added elsewhere), and is only being used by decks. The deck structure has been changed so that deck.plus is the original number of cards in the deck, deck.plus2 is either the number of cards used or the number of cards left, and deck.special hold the deck's rarity. The cards themselves are selected at deck creation time and stored in the nested hash table deck.props["cards"]. The Nemelex "Peek Deck" ability has been changed to identify the deck, draw three cards from it, show them to the user, and shuffle them back into the deck (with special cases for decks containing only one or two cards). A fourth Nemelex ability, "Mark Deck", has been added, which picks four cards from the deck, marks them, and then shuffles them back into the deck, creating a deck with a mixture of marked and unmarked cards. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2370 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/decks.h')
-rw-r--r--crawl-ref/source/decks.h88
1 files changed, 87 insertions, 1 deletions
diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h
index 47c6d646ac..df5b3942e5 100644
--- a/crawl-ref/source/decks.h
+++ b/crawl-ref/source/decks.h
@@ -17,6 +17,19 @@
#include "externs.h"
+// DECK STRUCTURE: deck.plus is the number of cards the deck *started*
+// with, deck.plus2 is the number of cards drawn, deck.special is the
+// deck rarity, deck.props["cards"] holds the list of cards (with the
+// highest index card being the top card, and index 0 being the bottom
+// card), deck.props.["card_flags"] holds the flags for each card,
+// deck.props["num_marked"] is the number of marked cards left in the
+// deck, and deck.props["non_brownie_draws"] is the number of
+// non-marked draws you have to make from that deck before earning
+// brownie points from it again.
+//
+// The card type and per-card flags are each stored as unsigned bytes,
+// for a maximum of 256 differetn kinds of cards and 8 bits of flags.
+
enum deck_rarity_type
{
DECK_RARITY_COMMON,
@@ -34,17 +47,90 @@ enum deck_type
DECK_OF_WONDERS
};
+enum card_flags_type
+{
+ CFLAG_ODDITY = (1 << 0),
+ CFLAG_SEEN = (1 << 1),
+ CFLAG_MARKED = (1 << 2)
+};
+
+enum card_type
+{
+ CARD_BLANK1 = 0, // non-retried
+ CARD_BLANK2, // retried and failed
+ CARD_PORTAL, // "the mover"
+ CARD_WARP, // "the jumper"
+ CARD_SWAP, // "swap"
+ CARD_VELOCITY, // "the runner"
+
+ CARD_TOMB, // "the wall"
+ CARD_BANSHEE, // "the scream"
+ CARD_DAMNATION, // banishment
+ CARD_SOLITUDE, // dispersal
+ CARD_WARPWRIGHT, // create teleport trap
+
+ CARD_VITRIOL, // acid damage
+ CARD_FLAME, // fire damage
+ CARD_FROST, // cold damage
+ CARD_VENOM, // poison damage
+ CARD_HAMMER, // pure damage
+
+ CARD_ELIXIR, // healing
+ CARD_BATTLELUST, // melee boosts
+ CARD_METAMORPHOSIS, // transformation
+ CARD_HELM, // defense
+ CARD_BLADE, // weapon boosts
+ CARD_SHADOW, // assassin skills
+
+ CARD_SUMMON_ANIMAL,
+ CARD_SUMMON_DEMON,
+ CARD_SUMMON_WEAPON,
+ CARD_SUMMON_ANY,
+
+ CARD_POTION,
+ CARD_FOCUS,
+ CARD_SHUFFLE,
+
+ CARD_EXPERIENCE,
+ CARD_WILD_MAGIC,
+ CARD_HELIX, // remove one *bad* mutation
+
+ CARD_MAP, // magic mapping
+ CARD_DOWSING, // detect SD/traps/items/monsters
+ CARD_SPADE, // dig
+ CARD_TROWEL, // create feature/vault
+ CARD_MINEFIELD, // plant traps
+
+ CARD_GENIE, // acquirement OR rotting/deterioration
+ CARD_BARGAIN, // shopping discount
+ CARD_WRATH, // Godly wrath
+ CARD_WRAITH, // drain XP
+ CARD_XOM,
+ CARD_FEAST,
+ CARD_FAMINE,
+ CARD_CURSE, // Curse your items
+
+ NUM_CARDS
+};
+
const char* card_name(card_type card);
void evoke_deck(item_def& deck);
bool deck_triple_draw();
bool deck_peek();
+bool deck_mark();
bool deck_stack();
bool choose_deck_and_draw();
-void card_effect(card_type which_card, deck_rarity_type rarity);
+void card_effect(card_type which_card, deck_rarity_type rarity,
+ unsigned char card_flags = 0, bool tell_card = true);
void draw_from_deck_of_punishment();
+bool top_card_is_known(const item_def &item);
+card_type top_card(const item_def &item);
+
bool is_deck(const item_def &item);
+bool bad_deck(const item_def &item);
deck_rarity_type deck_rarity(const item_def &item);
unsigned char deck_rarity_to_color(deck_rarity_type rarity);
+void init_deck(item_def &item);
#endif