diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-08 05:55:47 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-08 05:55:47 +0000 |
commit | e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36 (patch) | |
tree | 31ecdc6a9945ba6bfb8e1b35cb484808df1f4f57 /crawl-ref/source/abl-show.cc | |
parent | 16a8b1fe4a5acec73e490b9f7d3e53f567673763 (diff) | |
download | crawl-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/abl-show.cc')
-rw-r--r-- | crawl-ref/source/abl-show.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 2bee608be0..be68ecf8fd 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -146,7 +146,7 @@ ability_type god_abilities[MAX_NUM_GODS][MAX_GOD_ABILITIES] = ABIL_TROG_BROTHERS_IN_ARMS, ABIL_NON_ABILITY }, // Nemelex { ABIL_NEMELEX_PEEK_DECK, ABIL_NEMELEX_DRAW_CARD, - ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY, + ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NEMELEX_MARK_DECK, ABIL_NEMELEX_STACK_DECK }, // Elyvilon { ABIL_ELYVILON_LESSER_HEALING, ABIL_ELYVILON_PURIFICATION, @@ -299,6 +299,7 @@ static const ability_def Ability_List[] = { ABIL_NEMELEX_PEEK_DECK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT }, { ABIL_NEMELEX_DRAW_CARD, "Draw Card", 2, 0, 0, 0, ABFLAG_NONE }, { ABIL_NEMELEX_TRIPLE_DRAW, "Triple Draw", 2, 0, 100, 2, ABFLAG_NONE }, + { ABIL_NEMELEX_MARK_DECK, "Mark Deck", 4, 0, 125, 5, ABFLAG_NONE }, { ABIL_NEMELEX_STACK_DECK, "Stack Deck", 5, 0, 150, 6, ABFLAG_NONE }, // Beogh @@ -728,9 +729,10 @@ static talent get_talent(ability_type ability, bool check_confused) failure = 80 - (you.piety / 25) - (4 * you.skills[SK_EVOCATIONS]); break; - case ABIL_NEMELEX_PEEK_DECK: + case ABIL_NEMELEX_MARK_DECK: invoc = true; - failure = 40 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]); + failure = 70 - (you.piety * 2 / 45) + - (9 * you.skills[SK_EVOCATIONS] / 2); break; case ABIL_NEMELEX_TRIPLE_DRAW: @@ -738,6 +740,11 @@ static talent get_talent(ability_type ability, bool check_confused) failure = 60 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]); break; + case ABIL_NEMELEX_PEEK_DECK: + invoc = true; + failure = 40 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]); + break; + case ABIL_NEMELEX_DRAW_CARD: invoc = true; perfect = true; // Tactically important to allow perfection @@ -1679,6 +1686,12 @@ static bool do_ability(const ability_def& abil) exercise(SK_EVOCATIONS, 2 + random2(2)); break; + case ABIL_NEMELEX_MARK_DECK: + if ( !deck_mark() ) + return false; + exercise(SK_EVOCATIONS, 4 + random2(4)); + break; + case ABIL_NEMELEX_STACK_DECK: if ( !deck_stack() ) return false; |