From ec7432d4ec543b634caeec017eb5a4b66fe06240 Mon Sep 17 00:00:00 2001 From: haranp Date: Wed, 9 May 2007 08:34:05 +0000 Subject: Nemelex now grants a 'triple draw' ability: choose 1 out of 3 (or out of however many are left.) Cost is 2MP + food + piety. This of course makes Nemelex completely, totally and absolutely broken; it's only the beginning of the Nemelex revamp. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1432 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 13 +++- crawl-ref/source/decks.cc | 166 +++++++++++++++++++++++++++++++++++++++++-- crawl-ref/source/decks.h | 3 +- crawl-ref/source/enum.h | 1 + crawl-ref/source/religion.cc | 4 +- 5 files changed, 175 insertions(+), 12 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index f2fac8af35..630b313185 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -37,6 +37,7 @@ #include "externs.h" #include "beam.h" +#include "decks.h" #include "effects.h" #include "food.h" #include "it_use2.h" @@ -126,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_NON_ABILITY, ABIL_NON_ABILITY, + { ABIL_NON_ABILITY, ABIL_NEMELEX_TRIPLE_DRAW, ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY }, // Elyvilon { ABIL_ELYVILON_LESSER_HEALING, ABIL_ELYVILON_PURIFICATION, @@ -268,6 +269,9 @@ static const ability_def Ability_List[] = { ABIL_LUGONU_SUMMON_DEMONS, "Summon Abyssal Servants", 7, 0, 100, 5, ABFLAG_NONE }, { ABIL_LUGONU_ABYSS_ENTER, "Enter the Abyss", 9, 0, 200, 40, ABFLAG_NONE }, + // Nemelex + { ABIL_NEMELEX_TRIPLE_DRAW, "Triple Draw", 2, 0, 100, 2, ABFLAG_NONE }, + // These six are unused "evil" god abilities: { ABIL_CHARM_SNAKE, "Charm Snake", 6, 0, 200, 5, ABFLAG_NONE }, { ABIL_TRAN_SERPENT_OF_HELL, "Turn into Demonic Serpent", 16, 0, 600, 8, ABFLAG_NONE }, @@ -1548,6 +1552,11 @@ static bool do_ability(const ability_def& abil) activate_notes(true); break; + case ABIL_NEMELEX_TRIPLE_DRAW: + if ( !deck_triple_draw() ) + return false; + break; + //jmf: intended as invocations from evil god(s): case ABIL_CHARM_SNAKE: cast_snake_charm( you.experience_level * 2 @@ -1714,7 +1723,7 @@ static std::string describe_talent(const talent& tal) std::ostringstream desc; desc << std::left - << std::setw(30) << ability_name(tal.which) + << std::setw(32) << ability_name(tal.which) << std::setw(24) << make_cost_description(tal.which) << std::setw(10) << failure_rate_to_string(tal.fail); return desc.str(); diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 6cf199ff9a..dd485457a3 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -13,6 +13,7 @@ #include "decks.h" #include +#include #include "externs.h" @@ -203,7 +204,6 @@ static card_type deck_of_punishment[] = CARD_PANDEMONIUM }; -// array sizes -- see notes below {dlb} #define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) #define DECK_WONDERS_SIZE ARRAYSIZE(deck_of_wonders) #define DECK_SUMMONING_SIZE ARRAYSIZE(deck_of_summoning) @@ -211,15 +211,75 @@ static card_type deck_of_punishment[] = #define DECK_POWER_SIZE ARRAYSIZE(deck_of_power) #define DECK_PUNISHMENT_SIZE ARRAYSIZE(deck_of_punishment) -static void cards(card_type which_card); +static const char* card_name(card_type card) +{ + switch (card) + { + case CARD_BLANK: return "a blank card"; + case CARD_BUTTERFLY: return "Butterfly"; + case CARD_WRAITH: return "the Wraith"; + case CARD_EXPERIENCE: return "Experience"; + case CARD_WEALTH: return "Wealth"; + case CARD_INTELLIGENCE: return "the Brain"; + case CARD_STRENGTH: return "Strength"; + case CARD_QUICKSILVER: return "Quicksilver"; + case CARD_STUPIDITY: return "Stupidity"; + case CARD_WEAKNESS: return "Weakness"; + case CARD_SLOTH: return "the Slug"; + case CARD_SHUFFLE: return "Shuffle"; + case CARD_FREAK: return "the Freak"; + case CARD_DEATH: return "Death"; + case CARD_NORMALITY: return "Normality"; + case CARD_SHADOW: return "the Shadow"; + case CARD_GATE: return "the Gate"; + case CARD_STATUE: return "the Crystal Statue"; + case CARD_ACQUISITION: return "Acquisition"; + case CARD_HASTEN: return "Haste"; + case CARD_DEMON_LESSER: return "a little demon"; + case CARD_DEMON_COMMON: return "a demon"; + case CARD_DEMON_GREATER: return "a huge demon"; + case CARD_DEMON_SWARM: return "a swarm of little demons"; + case CARD_YAK: return "a huge, shaggy yak"; + case CARD_FIEND: return "a huge, scaly devil"; + case CARD_DRAGON: return "a huge, scaly dragon"; + case CARD_GOLEM: return "a statue"; + case CARD_THING_FUGLY: return "a very ugly thing"; + case CARD_LICH: return "a very irritated-looking skeletal thing"; + case CARD_HORROR_UNSEEN: + return player_see_invis() ? "a hideous abomination" : "a blank card"; + case CARD_BLINK: return "Blink"; + case CARD_TELEPORT: return "the Portal of Delayed Transposition"; + case CARD_TELEPORT_NOW: return "the Portal of Instantaneous Transposition"; + case CARD_RAGE: return "Rage"; + case CARD_LEVITY: return "Levity"; + case CARD_VENOM: return "Venom"; + case CARD_XOM: return "the card of Xom"; + case CARD_SLOW: return "Slowness"; + case CARD_DECAY: return "Decay"; + case CARD_HEALING: return "the Elixir of Health"; + case CARD_HEAL_WOUNDS: return "the Symbol of Immediate Regeneration"; + case CARD_TORMENT: return "the Symbol of Torment"; + case CARD_FOUNTAIN: return "the Fountain"; + case CARD_ALTAR: return "the Altar"; + case CARD_FAMINE: return "Famine"; + case CARD_FEAST: return "the Feast"; + case CARD_WILD_MAGIC: return "Wild Magic"; + case CARD_VIOLENCE: return "Violence"; + case CARD_PROTECTION: return "Protection"; + case CARD_KNOWLEDGE: return "Knowledge"; + case CARD_MAZE: return "the Maze"; + case CARD_PANDEMONIUM: return "Pandemonium"; + case CARD_IMPRISONMENT: return "the Prison"; + case CARD_RULES_FOR_BRIDGE: return "the rules for contract bridge"; + case NUM_CARDS: case CARD_RANDOM: return "a buggy card"; + } + return "a very buggy card"; +} -void deck_of_cards(deck_type which_deck) +static card_type choose_one_card(deck_type which_deck, bool message) { card_type *deck = deck_of_wonders; int max_card = 0; - int brownie_points = 0; // for passing to did_god_conduct() {dlb} - - mpr("You draw a card..."); switch (which_deck) { @@ -249,7 +309,8 @@ void deck_of_cards(deck_type which_deck) if (one_chance_in(250)) { - mpr("This card doesn't seem to belong here."); + if ( message ) + mpr("This card doesn't seem to belong here."); chosen = static_cast(random2(NUM_CARDS)); } @@ -257,6 +318,97 @@ void deck_of_cards(deck_type which_deck) if (which_deck != DECK_OF_PUNISHMENT && chosen == CARD_BLANK && you.skills[SK_EVOCATIONS] > random2(30)) chosen = deck[random2(max_card)]; + return chosen; +} +static void cards(card_type which_card); + +// returns the deck type, of DECK_OF_PUNISHMENT if none +deck_type subtype_to_decktype(int subtype) +{ + switch ( subtype ) + { + case MISC_DECK_OF_WONDERS: + return DECK_OF_WONDERS; + case MISC_DECK_OF_POWER: + return DECK_OF_POWER; + case MISC_DECK_OF_SUMMONINGS: + return DECK_OF_SUMMONING; + case MISC_DECK_OF_TRICKS: + return DECK_OF_TRICKS; + default: // sentinel + return DECK_OF_PUNISHMENT; + } +} + +bool deck_triple_draw() +{ + if (you.equip[EQ_WEAPON] == -1) + { + mpr("You aren't wielding a deck!"); + return false; + } + item_def& item(you.inv[you.equip[EQ_WEAPON]]); + + if ( item.base_type != OBJ_MISCELLANY || + subtype_to_decktype(item.sub_type) == DECK_OF_PUNISHMENT ) + { + mpr("You aren't wielding a deck!"); + return false; + } + + const deck_type dtype = subtype_to_decktype(item.sub_type); + + if (item.plus == 1) + { + // only one card to draw, so just draw it + deck_of_cards(dtype); + return true; + } + + const int num_to_draw = (item.plus < 3 ? item.plus : 3); + std::vector draws; + for ( int i = 0; i < num_to_draw; ++i ) + draws.push_back(choose_one_card(dtype, false)); + + mpr("You draw... (choose one card)"); + for ( int i = 0; i < num_to_draw; ++i ) + msg::streams(MSGCH_PROMPT) << (static_cast(i + 'a')) << " - " + << card_name(draws[i]) << std::endl; + int selected = -1; + while ( 1 ) + { + int keyin = get_ch(); + if ( isalpha(keyin) ) + keyin = tolower(keyin); + if (keyin >= 'a' && keyin < 'a' + num_to_draw) + { + selected = keyin - 'a'; + break; + } + else + canned_msg(MSG_HUH); + } + cards(draws[selected]); + + // remove the cards from the deck + item.plus -= num_to_draw; + if (item.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 ); + } + + return true; +} + +void deck_of_cards(deck_type which_deck) +{ + int brownie_points = 0; // for passing to did_god_conduct() {dlb} + + mpr("You draw a card..."); + + const card_type chosen = choose_one_card(which_deck, true); cards(chosen); diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h index 6124aa14db..4e9ab88c34 100644 --- a/crawl-ref/source/decks.h +++ b/crawl-ref/source/decks.h @@ -20,6 +20,7 @@ * called from: it_use_3 - religion * *********************************************************************** */ void deck_of_cards(deck_type which_deck); - +deck_type subtype_to_decktype(int subtype); +bool deck_triple_draw(); #endif diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index ac34b6363f..49f3227a2f 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -113,6 +113,7 @@ enum ability_type ABIL_LUGONU_BEND_SPACE, ABIL_LUGONU_SUMMON_DEMONS, ABIL_LUGONU_ABYSS_ENTER, + ABIL_NEMELEX_TRIPLE_DRAW, ABIL_CHARM_SNAKE, ABIL_TRAN_SERPENT_OF_HELL, diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 85152b1991..3a721f3cc1 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -154,7 +154,7 @@ const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] = "haste yourself", "" }, // Nemelex - { "", "", "", "", "" }, + { "", "draw cards with careful consideration", "", "", "" }, // Elyvilon { "call upon Elyvilon for minor healing", "call upon Elyvilon for purification", @@ -230,7 +230,7 @@ const char* god_lose_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] = "haste yourself", "" }, // Nemelex - { "", "", "", "", "" }, + { "", "draw cards with careful consideration", "", "", "" }, // Elyvilon { "call upon Elyvilon for minor healing", "call upon Elyvilon for purification", -- cgit v1.2.3-54-g00ecf