summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abl-show.cc8
-rw-r--r--crawl-ref/source/decks.cc169
-rw-r--r--crawl-ref/source/decks.h10
-rw-r--r--crawl-ref/source/enum.h62
-rw-r--r--crawl-ref/source/invent.cc8
-rw-r--r--crawl-ref/source/it_use3.cc14
-rw-r--r--crawl-ref/source/itemname.cc9
-rw-r--r--crawl-ref/source/religion.cc12
-rw-r--r--crawl-ref/source/tutorial.cc15
9 files changed, 175 insertions, 132 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 630b313185..3a897a841e 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -127,7 +127,7 @@ 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_NON_ABILITY, ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY,
+ { ABIL_NEMELEX_PEEK, ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY,
ABIL_NON_ABILITY, ABIL_NON_ABILITY },
// Elyvilon
{ ABIL_ELYVILON_LESSER_HEALING, ABIL_ELYVILON_PURIFICATION,
@@ -271,6 +271,7 @@ static const ability_def Ability_List[] =
// Nemelex
{ ABIL_NEMELEX_TRIPLE_DRAW, "Triple Draw", 2, 0, 100, 2, ABFLAG_NONE },
+ { ABIL_NEMELEX_PEEK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT },
// These six are unused "evil" god abilities:
{ ABIL_CHARM_SNAKE, "Charm Snake", 6, 0, 200, 5, ABFLAG_NONE },
@@ -1557,6 +1558,11 @@ static bool do_ability(const ability_def& abil)
return false;
break;
+ case ABIL_NEMELEX_PEEK:
+ if ( !deck_peek() )
+ return false;
+ break;
+
//jmf: intended as invocations from evil god(s):
case ABIL_CHARM_SNAKE:
cast_snake_charm( you.experience_level * 2
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index dd485457a3..496a50f176 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -32,67 +32,6 @@
#include "spl-cast.h"
#include "stuff.h"
-enum card_type
-{
- CARD_BLANK = 0, // 0
- CARD_BUTTERFLY,
- CARD_WRAITH,
- CARD_EXPERIENCE,
- CARD_WEALTH,
- CARD_INTELLIGENCE, // 5
- CARD_STRENGTH,
- CARD_QUICKSILVER,
- CARD_STUPIDITY,
- CARD_WEAKNESS,
- CARD_SLOTH, // 10
- CARD_SHUFFLE,
- CARD_FREAK,
- CARD_DEATH,
- CARD_NORMALITY,
- CARD_SHADOW, // 15
- CARD_GATE,
- CARD_STATUE,
- CARD_ACQUISITION,
- CARD_HASTEN,
- CARD_DEMON_LESSER, // 20
- CARD_DEMON_COMMON,
- CARD_DEMON_GREATER,
- CARD_DEMON_SWARM,
- CARD_YAK,
- CARD_FIEND, // 25
- CARD_DRAGON,
- CARD_GOLEM,
- CARD_THING_FUGLY,
- CARD_LICH,
- CARD_HORROR_UNSEEN, // 30
- CARD_BLINK,
- CARD_TELEPORT,
- CARD_TELEPORT_NOW,
- CARD_RAGE,
- CARD_LEVITY, // 35
- CARD_VENOM,
- CARD_XOM,
- CARD_SLOW,
- CARD_DECAY,
- CARD_HEALING, // 40
- CARD_HEAL_WOUNDS,
- CARD_TORMENT,
- CARD_FOUNTAIN,
- CARD_ALTAR,
- CARD_FAMINE, // 45
- CARD_FEAST,
- CARD_WILD_MAGIC,
- CARD_VIOLENCE,
- CARD_PROTECTION,
- CARD_KNOWLEDGE, // 50
- CARD_MAZE,
- CARD_PANDEMONIUM,
- CARD_IMPRISONMENT,
- CARD_RULES_FOR_BRIDGE, // 54
- NUM_CARDS, // must remain last regular member {dlb}
- CARD_RANDOM = 255 // must remain final member {dlb}
-};
-
static card_type deck_of_wonders[] =
{
CARD_BLANK,
@@ -211,7 +150,7 @@ static card_type deck_of_punishment[] =
#define DECK_POWER_SIZE ARRAYSIZE(deck_of_power)
#define DECK_PUNISHMENT_SIZE ARRAYSIZE(deck_of_punishment)
-static const char* card_name(card_type card)
+const char* card_name(card_type card)
{
switch (card)
{
@@ -340,22 +279,51 @@ deck_type subtype_to_decktype(int subtype)
}
}
-bool deck_triple_draw()
+static bool wielding_deck()
+{
+ if ( you.equip[EQ_WEAPON] == -1 )
+ return false;
+ const item_def& item = you.inv[you.equip[EQ_WEAPON]];
+ return ( item.base_type == OBJ_MISCELLANY &&
+ subtype_to_decktype(item.sub_type) != DECK_OF_PUNISHMENT );
+}
+
+bool deck_peek()
{
- if (you.equip[EQ_WEAPON] == -1)
+ if ( !wielding_deck() )
{
mpr("You aren't wielding a deck!");
return false;
}
item_def& item(you.inv[you.equip[EQ_WEAPON]]);
+ if ( item.special != 0 )
+ {
+ mpr("You already know what the next card will be.");
+ return false;
+ }
+ const deck_type dtype = subtype_to_decktype(item.sub_type);
+ const card_type chosen = choose_one_card(dtype, false);
+ msg::stream << "You see " << card_name(chosen) << '.' << std::endl;
+ item.special = chosen + 1;
+ you.wield_change = true;
+ return true;
+}
- if ( item.base_type != OBJ_MISCELLANY ||
- subtype_to_decktype(item.sub_type) == DECK_OF_PUNISHMENT )
+bool deck_triple_draw()
+{
+ if ( !wielding_deck() )
{
mpr("You aren't wielding a deck!");
return false;
}
+ item_def& item(you.inv[you.equip[EQ_WEAPON]]);
+ if ( item.special != 0 )
+ {
+ mpr("You can't triple draw from a marked deck.");
+ return false;
+ }
+
const deck_type dtype = subtype_to_decktype(item.sub_type);
if (item.plus == 1)
@@ -398,52 +366,53 @@ bool deck_triple_draw()
unwield_item(you.equip[EQ_WEAPON]);
dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
}
-
+ you.wield_change = true;
return true;
}
-void deck_of_cards(deck_type which_deck)
+void evoke_deck( item_def& deck )
{
- int brownie_points = 0; // for passing to did_god_conduct() {dlb}
-
+ const deck_type which_deck = subtype_to_decktype(deck.sub_type);
mpr("You draw a card...");
-
- const card_type chosen = choose_one_card(which_deck, true);
-
- cards(chosen);
-
- // Decks of punishment aren't objects in the game,
- // its just Nemelex's form of punishment -- bwr
- if (which_deck != DECK_OF_PUNISHMENT)
+ if ( deck.special == 0 )
{
- you.inv[you.equip[EQ_WEAPON]].plus--;
-
- if (you.inv[you.equip[EQ_WEAPON]].plus == 0)
- {
- mpr("The deck of cards disappears in a puff of smoke.");
-
- unwield_item(you.equip[EQ_WEAPON]);
-
- dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
+ deck_of_cards(which_deck);
+ }
+ else
+ {
+ cards(static_cast<card_type>(deck.special - 1));
+ deck.special = 0;
+ you.wield_change = true;
+ }
+ deck.plus--;
- // these bonuses happen only when the deck expires {dlb}:
- brownie_points = (coinflip()? 2 : 1);
+ int brownie_points = 0;
+ if ( deck.plus == 0 )
+ {
+ mpr("The deck of cards disappears in a puff of smoke.");
+ unwield_item(you.equip[EQ_WEAPON]);
+ dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
- if (which_deck == DECK_OF_WONDERS)
- brownie_points += 2;
- else if (which_deck == DECK_OF_POWER)
- brownie_points++;
- }
+ // these bonuses happen only when the deck expires {dlb}:
+ brownie_points = (coinflip() ? 2 : 1);
- // this bonus happens with every use {dlb}:
- if (which_deck == DECK_OF_WONDERS || one_chance_in(3))
+ if (which_deck == DECK_OF_WONDERS)
+ brownie_points += 2;
+ else if (which_deck == DECK_OF_POWER)
brownie_points++;
-
- did_god_conduct(DID_CARDS, brownie_points);
}
- return;
-} // end deck_of_cards()
+ // this bonus happens with every use {dlb}:
+ if (which_deck == DECK_OF_WONDERS || one_chance_in(3))
+ brownie_points++;
+
+ did_god_conduct(DID_CARDS, brownie_points);
+}
+
+void deck_of_cards(deck_type which_deck)
+{
+ cards(choose_one_card(which_deck, true));
+}
static void cards(card_type which_card)
{
diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h
index 4e9ab88c34..b0064b464a 100644
--- a/crawl-ref/source/decks.h
+++ b/crawl-ref/source/decks.h
@@ -15,12 +15,14 @@
#include "enum.h"
-// last updated 12may2000 {dlb}
-/* ***********************************************************************
- * called from: it_use_3 - religion
- * *********************************************************************** */
+#include "externs.h"
+
+const char* card_name(card_type card);
+void evoke_deck(item_def& deck);
void deck_of_cards(deck_type which_deck);
deck_type subtype_to_decktype(int subtype);
bool deck_triple_draw();
+bool deck_peek();
+const char* card_name(card_type card);
#endif
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 49f3227a2f..a6c3fe3ac5 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -114,6 +114,7 @@ enum ability_type
ABIL_LUGONU_SUMMON_DEMONS,
ABIL_LUGONU_ABYSS_ENTER,
ABIL_NEMELEX_TRIPLE_DRAW,
+ ABIL_NEMELEX_PEEK,
ABIL_CHARM_SNAKE,
ABIL_TRAN_SERPENT_OF_HELL,
@@ -507,6 +508,67 @@ enum canned_message_type // canned_msg() - unsigned char
MSG_EMPTY_HANDED
};
+enum card_type
+{
+ CARD_BLANK = 0, // 0
+ CARD_BUTTERFLY,
+ CARD_WRAITH,
+ CARD_EXPERIENCE,
+ CARD_WEALTH,
+ CARD_INTELLIGENCE, // 5
+ CARD_STRENGTH,
+ CARD_QUICKSILVER,
+ CARD_STUPIDITY,
+ CARD_WEAKNESS,
+ CARD_SLOTH, // 10
+ CARD_SHUFFLE,
+ CARD_FREAK,
+ CARD_DEATH,
+ CARD_NORMALITY,
+ CARD_SHADOW, // 15
+ CARD_GATE,
+ CARD_STATUE,
+ CARD_ACQUISITION,
+ CARD_HASTEN,
+ CARD_DEMON_LESSER, // 20
+ CARD_DEMON_COMMON,
+ CARD_DEMON_GREATER,
+ CARD_DEMON_SWARM,
+ CARD_YAK,
+ CARD_FIEND, // 25
+ CARD_DRAGON,
+ CARD_GOLEM,
+ CARD_THING_FUGLY,
+ CARD_LICH,
+ CARD_HORROR_UNSEEN, // 30
+ CARD_BLINK,
+ CARD_TELEPORT,
+ CARD_TELEPORT_NOW,
+ CARD_RAGE,
+ CARD_LEVITY, // 35
+ CARD_VENOM,
+ CARD_XOM,
+ CARD_SLOW,
+ CARD_DECAY,
+ CARD_HEALING, // 40
+ CARD_HEAL_WOUNDS,
+ CARD_TORMENT,
+ CARD_FOUNTAIN,
+ CARD_ALTAR,
+ CARD_FAMINE, // 45
+ CARD_FEAST,
+ CARD_WILD_MAGIC,
+ CARD_VIOLENCE,
+ CARD_PROTECTION,
+ CARD_KNOWLEDGE, // 50
+ CARD_MAZE,
+ CARD_PANDEMONIUM,
+ CARD_IMPRISONMENT,
+ CARD_RULES_FOR_BRIDGE, // 54
+ NUM_CARDS, // must remain last regular member {dlb}
+ CARD_RANDOM = 255 // must remain final member {dlb}
+};
+
enum char_set_type
{
CSET_ASCII, // flat 7-bit ASCII
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index a570e9e625..17f6ad4581 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -756,12 +756,12 @@ static bool has_warning_inscription(const item_def& item,
bool check_warning_inscriptions( const item_def& item,
operation_types oper )
{
- char prompt[ITEMNAME_SIZE + 100];
if ( has_warning_inscription(item, oper) )
{
- snprintf(prompt, sizeof prompt, "Really choose %s?",
- item.name(DESC_INVENTORY).c_str());
- return yesno(prompt, false, 'n');
+ std::string prompt = "Really choose ";
+ prompt += item.name(DESC_INVENTORY);
+ prompt += '?';
+ return yesno(prompt.c_str(), false, 'n');
}
else
return true;
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index c0f47d3103..c8d8b2d64f 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -612,22 +612,10 @@ bool evoke_wielded( void )
break;
case MISC_DECK_OF_WONDERS:
- deck_of_cards(DECK_OF_WONDERS);
- pract = 1;
- break;
-
case MISC_DECK_OF_SUMMONINGS:
- deck_of_cards(DECK_OF_SUMMONING);
- pract = 1;
- break;
-
case MISC_DECK_OF_TRICKS:
- deck_of_cards(DECK_OF_TRICKS);
- pract = 1;
- break;
-
case MISC_DECK_OF_POWER:
- deck_of_cards(DECK_OF_POWER);
+ evoke_deck(wpn);
pract = 1;
break;
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 7a547d3847..1605a8fd04 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -27,6 +27,7 @@
#include "externs.h"
+#include "decks.h"
#include "invent.h"
#include "itemprop.h"
#include "macro.h"
@@ -1331,6 +1332,14 @@ std::string item_def::name_aux( bool terse, bool ident ) const
else
{
buff << misc_type_name(item_typ, know_type);
+ if ( subtype_to_decktype(item_typ) != DECK_OF_PUNISHMENT &&
+ this->special != 0 )
+ {
+ // an inscribed deck!
+ buff << " {"
+ << card_name(static_cast<card_type>(this->special - 1))
+ << "}";
+ }
}
break;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 3a721f3cc1..65c5a1edae 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -154,7 +154,11 @@ const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
"haste yourself",
"" },
// Nemelex
- { "", "draw cards with careful consideration", "", "", "" },
+ { "peek at the first card of a deck",
+ "draw cards with careful consideration",
+ "",
+ "",
+ "" },
// Elyvilon
{ "call upon Elyvilon for minor healing",
"call upon Elyvilon for purification",
@@ -230,7 +234,11 @@ const char* god_lose_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
"haste yourself",
"" },
// Nemelex
- { "", "draw cards with careful consideration", "", "", "" },
+ { "peek at the first card of a deck",
+ "draw cards with careful consideration",
+ "",
+ "",
+ "" },
// Elyvilon
{ "call upon Elyvilon for minor healing",
"call upon Elyvilon for purification",
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index b338cbf380..4c6310ae92 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -463,12 +463,12 @@ static formatted_string tutorial_message_intro()
static void tutorial_movement_info()
{
- std::string text;
- text = "To move your character, use the numpad; try Numlock both on and off. "
- "If your system has no number pad, or if you are familiar with the vi "
- "keys, movement is also possible with <w>hjklyubn<magenta>. A basic "
- "command list can be found under <w>?<magenta>, and the most important "
- "commands will be explained to you as it becomes necessary. ";
+ std::string text =
+ "To move your character, use the numpad; try Numlock both on and off. "
+ "If your system has no number pad, or if you are familiar with the vi "
+ "keys, movement is also possible with <w>hjklyubn<magenta>. A basic "
+ "command list can be found under <w>?<magenta>, and the most "
+ "important commands will be explained to you as it becomes necessary.";
mesclr();
print_formatted_paragraph(text, get_tutorial_cols(), MSGCH_TUTORIAL);
}
@@ -615,8 +615,7 @@ void tutorial_death_screen()
mpr( "See you next game!", MSGCH_TUTORIAL);
- for ( long i = 0; i < TUT_EVENTS_NUM; ++i )
- Options.tutorial_events[i] = 0;
+ Options.tutorial_events.init(false);
}
// if a character survives until Xp 5, the tutorial is declared finished