diff options
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 2480ba424c..3685534fe2 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -51,9 +51,11 @@ #include "spells4.h" #include "spl-book.h" #include "spl-util.h" +#include "state.h" #include "stuff.h" #include "transfor.h" #include "view.h" +#include "xom.h" #ifdef DOS #include <conio.h> @@ -200,6 +202,7 @@ int list_spells() spell_menu.set_highlighter(NULL); spell_menu.set_more(formatted_string("Press '!' to toggle spell view.")); spell_menu.add_toggle_key('!'); + spell_menu.set_tag("spell"); for ( int i = 0; i < 52; ++i ) { @@ -584,6 +587,7 @@ bool cast_a_spell() if (!you.spell_no) { mpr("You don't know any spells."); + crawl_state.zero_turns_taken(); return (false); } @@ -596,6 +600,7 @@ bool cast_a_spell() if (silenced(you.x_pos, you.y_pos)) { mpr("You cannot cast spells when silenced!"); + crawl_state.zero_turns_taken(); more(); return (false); } @@ -628,11 +633,15 @@ bool cast_a_spell() } if (keyin == ESCAPE) + { + canned_msg( MSG_OK ); return (false); + } if (!isalpha(keyin)) { mpr("You don't know that spell."); + crawl_state.zero_turns_taken(); return (false); } @@ -641,6 +650,7 @@ bool cast_a_spell() if (spell == SPELL_NO_SPELL) { mpr("You don't know that spell."); + crawl_state.zero_turns_taken(); return (false); } @@ -665,7 +675,10 @@ bool cast_a_spell() { const spret_type cast_result = your_spells( spell ); if (cast_result == SPRET_ABORT) + { + crawl_state.zero_turns_taken(); return (false); + } exercise_spell( spell, true, cast_result == SPRET_SUCCESS ); did_god_conduct( DID_SPELL_CASTING, 1 + random2(5) ); @@ -780,15 +793,19 @@ void spellcasting_side_effects(spell_type spell, bool idonly = false) if (!spell_is_utility_spell(spell)) did_god_conduct( DID_SPELL_NONUTILITY, 10 + spell_difficulty(spell) ); - if (spell_is_unholy( spell )) - did_god_conduct( DID_UNHOLY, 10 + spell_difficulty(spell) ); + // Self-banishment gets a special exemption - you're there to spread light + if (spell_is_unholy(spell) && + (spell != SPELL_BANISHMENT || !you.banished)) + { + did_god_conduct( DID_UNHOLY, 10 + spell_difficulty(spell) ); + } // Linley says: Condensation Shield needs some disadvantages to keep // it from being a no-brainer... this isn't much, but its a start -- bwr if (spell_typematch(spell, SPTYP_FIRE)) expose_player_to_element(BEAM_FIRE, 0); - if (spell_typematch( spell, SPTYP_NECROMANCY )) + if (spell_typematch(spell, SPTYP_NECROMANCY)) { did_god_conduct( DID_NECROMANCY, 10 + spell_difficulty(spell) ); @@ -862,7 +879,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) testbits( flags, SPFLAG_DIR ) ? DIR_DIR : DIR_NONE); const char *prompt = get_spell_target_prompt(spell); - if (spell == SPELL_PORTALED_PROJECTILE) + if (spell == SPELL_PORTAL_PROJECTILE) { const int idx = get_fire_item_index(); if ( idx == ENDOFPACK ) @@ -876,7 +893,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) else if (dir == DIR_DIR) mpr(prompt? prompt : "Which direction? ", MSGCH_PROMPT); - bool needs_path = + const bool needs_path = !(testbits(flags, SPFLAG_GRID) || testbits(flags, SPFLAG_TARGET)); if ( !spell_direction( spd, beam, dir, targ, needs_path, prompt ) ) @@ -1016,6 +1033,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_DELAYED_FIREBALL: + crawl_state.cant_cmd_repeat("You can't repeat delayed fireball."); // This spell has two main advantages over Fireball: // // (1) The release is instantaneous, so monsters will not @@ -1188,6 +1206,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_SELECTIVE_AMNESIA: + crawl_state.cant_cmd_repeat("You can't repeat selective amnesia."); + if (!cast_selective_amnesia(false)) return (SPRET_ABORT); break; // Sif Muna power calls with true @@ -1433,6 +1453,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_TUKIMAS_DANCE: + crawl_state.cant_cmd_repeat("You can't repeat dancing weapon."); dancing_weapon(powc, false); break; @@ -1572,6 +1593,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_ALTER_SELF: + crawl_state.cant_cmd_repeat("You can't repeat alter self."); if (!enough_hp( you.hp_max / 2, true )) { mpr( "Your body is in too poor a condition " @@ -1597,6 +1619,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_PORTAL: + crawl_state.cant_cmd_repeat("You can't repeat create portal."); if (portal() == -1) return (SPRET_ABORT); break; @@ -1846,6 +1869,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_SWAP: + crawl_state.cant_cmd_repeat("You can't swap."); cast_swap(powc); break; @@ -1854,8 +1878,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) return (SPRET_ABORT); break; - case SPELL_PORTALED_PROJECTILE: - if ( !cast_portaled_projectile(powc, beam) ) + case SPELL_PORTAL_PROJECTILE: + if ( !cast_portal_projectile(powc, beam) ) return SPRET_ABORT; break; @@ -2542,7 +2566,8 @@ static void miscast_divination(int severity, const char* cause) case 0: if (you.is_undead) mpr("You suddenly recall your previous life!"); - else if (lose_stat(STAT_INTELLIGENCE, 1 + random2(3))) + else if (lose_stat(STAT_INTELLIGENCE, 1 + random2(3), + false, cause)) mpr("You have damaged your brain!"); else mpr("You have a terrible headache."); @@ -2570,7 +2595,8 @@ static void miscast_divination(int severity, const char* cause) case 2: if (you.is_undead) mpr("You suddenly recall your previous life."); - else if (lose_stat(STAT_INTELLIGENCE, 3 + random2(3))) + else if (lose_stat(STAT_INTELLIGENCE, 3 + random2(3), + false, cause)) mpr("You have damaged your brain!"); else mpr("You have a terrible headache."); @@ -2725,7 +2751,7 @@ static void miscast_necromancy(int severity, const char* cause) } // otherwise it just flows through... case 2: - lose_stat(STAT_RANDOM, 1 + random2avg(7, 2)); + lose_stat(STAT_RANDOM, 1 + random2avg(7, 2), false, cause); break; case 3: @@ -3420,7 +3446,7 @@ static void miscast_poison(int severity, const char* cause) if (player_res_poison()) canned_msg(MSG_NOTHING_HAPPENS); else - lose_stat(STAT_RANDOM, 1); + lose_stat(STAT_RANDOM, 1, false, cause); break; } break; @@ -3447,7 +3473,7 @@ static void miscast_poison(int severity, const char* cause) if (player_res_poison()) canned_msg(MSG_NOTHING_HAPPENS); else - lose_stat(STAT_RANDOM, 1 + random2avg(5, 2)); + lose_stat(STAT_RANDOM, 1 + random2avg(5, 2), false, cause); break; } break; @@ -3474,6 +3500,9 @@ void miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, return; } + if (cause == NULL || strlen(cause) == 0) + cause = "spell miscasting"; + sever /= 100; #if DEBUG_DIAGNOSTICS |