summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-21 18:26:58 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-21 18:26:58 +0000
commitddba1bc505be4ae692233285e785642d6aa4f0b1 (patch)
treeb95dd27669892198de16a5d3afb8e17fd57739ac
parent9c3ecfbada5e9797f91e418a550ecf6fb02a66e3 (diff)
downloadcrawl-ref-ddba1bc505be4ae692233285e785642d6aa4f0b1.tar.gz
crawl-ref-ddba1bc505be4ae692233285e785642d6aa4f0b1.zip
Added a Draw Card invocation for Nemelex, which lets you draw a card
from a deck in inventory. Using Peek Deck now loses 1d2 cards from the peeked deck. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1901 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/abl-show.cc28
-rw-r--r--crawl-ref/source/decks.cc49
-rw-r--r--crawl-ref/source/decks.h1
-rw-r--r--crawl-ref/source/enum.h4
-rw-r--r--crawl-ref/source/religion.cc4
5 files changed, 73 insertions, 13 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 2d962bc3a3..fa9eb29504 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -128,8 +128,9 @@ ability_type god_abilities[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
{ ABIL_TROG_BERSERK, ABIL_TROG_MIGHT, ABIL_NON_ABILITY,
ABIL_TROG_HASTE_SELF, ABIL_NON_ABILITY },
// Nemelex
- { ABIL_NEMELEX_PEEK, ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY,
- ABIL_NON_ABILITY, ABIL_NEMELEX_STACK_DECK },
+ { ABIL_NEMELEX_PEEK_DECK, ABIL_NEMELEX_DRAW_CARD,
+ ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY,
+ ABIL_NEMELEX_STACK_DECK },
// Elyvilon
{ ABIL_ELYVILON_LESSER_HEALING, ABIL_ELYVILON_PURIFICATION,
ABIL_ELYVILON_HEALING, ABIL_ELYVILON_RESTORATION,
@@ -276,8 +277,9 @@ static const ability_def Ability_List[] =
{ ABIL_LUGONU_ABYSS_ENTER, "Enter the Abyss", 9, 0, 200, 40, ABFLAG_NONE },
// Nemelex
+ { ABIL_NEMELEX_PEEK_DECK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT },
+ { ABIL_NEMELEX_DRAW_CARD, "Draw Card", 1, 0, 0, 1, ABFLAG_NONE },
{ ABIL_NEMELEX_TRIPLE_DRAW, "Triple Draw", 2, 0, 100, 2, ABFLAG_NONE },
- { ABIL_NEMELEX_PEEK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT },
{ ABIL_NEMELEX_STACK_DECK, "Stack Deck", 5, 0, 150, 6, ABFLAG_NONE },
// Beogh
@@ -699,7 +701,7 @@ 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:
+ case ABIL_NEMELEX_PEEK_DECK:
invoc = true;
failure = 40 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]);
break;
@@ -709,6 +711,12 @@ static talent get_talent(ability_type ability, bool check_confused)
failure = 60 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]);
break;
+ case ABIL_NEMELEX_DRAW_CARD:
+ invoc = true;
+ perfect = true; // Tactically important to allow perfection
+ failure = 50 - (you.piety / 20) - (5 * you.skills[SK_EVOCATIONS]);
+ break;
+
//jmf: following for to-be-created gods
case ABIL_CHARM_SNAKE:
invoc = true;
@@ -742,8 +750,8 @@ static talent get_talent(ability_type ability, bool check_confused)
break;
}
- // Perfect abilities are things like "renounce religion", which
- // shouldn't have a failure rate ever. -- bwr
+ // Perfect abilities are things which can go down to a 0%
+ // failure rate (e.g., Renounce Religion.)
if (failure <= 0 && !perfect)
failure = 1;
@@ -1586,13 +1594,19 @@ static bool do_ability(const ability_def& abil)
activate_notes(true);
break;
+ case ABIL_NEMELEX_DRAW_CARD:
+ if ( !choose_deck_and_draw() )
+ return false;
+ exercise(SK_EVOCATIONS, 1 + random2(2));
+ break;
+
case ABIL_NEMELEX_TRIPLE_DRAW:
if ( !deck_triple_draw() )
return false;
exercise(SK_EVOCATIONS, 3 + random2(3));
break;
- case ABIL_NEMELEX_PEEK:
+ case ABIL_NEMELEX_PEEK_DECK:
if ( !deck_peek() )
return false;
exercise(SK_EVOCATIONS, 2 + random2(2));
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 6e639692b8..f64067dc39 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -228,6 +228,31 @@ static bool wielding_deck()
return is_deck(you.inv[you.equip[EQ_WEAPON]]);
}
+// Select a deck from inventory and draw a card from it.
+bool choose_deck_and_draw()
+{
+ int slot = prompt_invent_item( "Draw from which deck?",
+ MT_INVLIST, OBJ_MISCELLANY,
+ true, true, true, 0, NULL,
+ OPER_EVOKE );
+ if ( slot == PROMPT_ABORT )
+ {
+ canned_msg(MSG_OK);
+ return false;
+ }
+
+ item_def& deck(you.inv[slot]);
+ if ( !is_deck(deck) )
+ {
+ mpr("That isn't a deck!");
+ return false;
+ }
+ evoke_deck(deck);
+ return true;
+}
+
+// Peek at a deck (show what the next card will be.)
+// Return false if the operation was failed/aborted along the way.
bool deck_peek()
{
if ( !wielding_deck() )
@@ -241,15 +266,29 @@ bool deck_peek()
mpr("You already know what the next card will be.");
return false;
}
-
+
const card_type chosen = choose_one_card(item, false);
msg::stream << "You see " << card_name(chosen) << '.' << std::endl;
item.plus2 = chosen + 1;
you.wield_change = true;
+
+ // You lose 1d2 cards when peeking.
+ if ( item.plus > 1 )
+ {
+ mpr("Some cards drop out of the deck.");
+ if ( item.plus > 2 && coinflip() )
+ item.plus -= 2;
+ else
+ item.plus -= 1;
+ }
+
return true;
}
+// Stack a deck: look at the next five cards, put them back in any
+// order, discard the rest of the deck.
+// Return false if the operation was failed/aborted along the way.
bool deck_stack()
{
if ( !wielding_deck() )
@@ -285,7 +324,7 @@ bool deck_stack()
}
int selected = -1;
- while ( 1 )
+ while ( true )
{
const int keyin = tolower(get_ch());
if (keyin >= 'a' && keyin < 'a' + static_cast<int>(draws.size()))
@@ -309,6 +348,7 @@ bool deck_stack()
return true;
}
+// Draw the next three cards, discard two and pick one.
bool deck_triple_draw()
{
if ( !wielding_deck() )
@@ -372,6 +412,7 @@ bool deck_triple_draw()
return true;
}
+// This is Nemelex retribution.
void draw_from_deck_of_punishment()
{
item_def deck;
@@ -393,6 +434,8 @@ 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);
+
+ // If the deck wasn't marked, draw a fair card.
if ( deck.plus2 == 0 )
{
card_effect( choose_one_card(deck, true), deck_rarity(deck) );
@@ -432,7 +475,7 @@ void evoke_deck( item_def& deck )
if ( deck.plus == 0 )
{
mpr("The deck of cards disappears in a puff of smoke.");
- unwield_item(you.equip[EQ_WEAPON]);
+ unwield_item(you.equip[EQ_WEAPON]);
dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
// Finishing the deck will earn a point, even if it
// was marked or stacked.
diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h
index 4e980b15ad..1ab652904f 100644
--- a/crawl-ref/source/decks.h
+++ b/crawl-ref/source/decks.h
@@ -22,6 +22,7 @@ void evoke_deck(item_def& deck);
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);
void draw_from_deck_of_punishment();
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 61c7ba0de2..b22d747567 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -113,8 +113,9 @@ enum ability_type
ABIL_LUGONU_BEND_SPACE,
ABIL_LUGONU_SUMMON_DEMONS,
ABIL_LUGONU_ABYSS_ENTER,
+ ABIL_NEMELEX_PEEK_DECK,
+ ABIL_NEMELEX_DRAW_CARD,
ABIL_NEMELEX_TRIPLE_DRAW,
- ABIL_NEMELEX_PEEK,
ABIL_NEMELEX_STACK_DECK,
ABIL_BEOGH_SMITING,
ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS,
@@ -2795,6 +2796,7 @@ enum operation_types
OPER_EXAMINE = 'v',
OPER_FIRE = 'f',
OPER_PRAY = 'p',
+ OPER_EVOKE = 'E',
OPER_ANY = 0
};
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 8ee2179dc0..5dfcf5f19f 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -165,9 +165,9 @@ const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
"" },
// Nemelex
{ "peek at the first card of a deck",
+ "draw cards from decks in your inventory",
"draw cards with careful consideration",
"",
- "",
"stack decks" },
// Elyvilon
{ "call upon Elyvilon for minor healing",
@@ -251,9 +251,9 @@ const char* god_lose_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
"" },
// Nemelex
{ "peek at the first card of a deck",
+ "draw cards from decks in your inventory",
"draw cards with careful consideration",
"",
- "",
"stack decks" },
// Elyvilon
{ "call upon Elyvilon for minor healing",