From e558b0503312ea313b9a0303b74cce435500f119 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 18 Jan 2009 01:29:33 +0000 Subject: Tweaks to make it less likely that command repitition will be cancled when it's being used to wizard test Xom acts. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8525 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 5 +++-- crawl-ref/source/ouch.cc | 6 +++++- crawl-ref/source/player.cc | 12 +++++------- crawl-ref/source/spl-cast.cc | 18 +++++++++++++----- 4 files changed, 26 insertions(+), 15 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index ba1fe4b933..9ce37018c5 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1568,8 +1568,9 @@ static void _input() if (you.cannot_act()) { - crawl_state.cancel_cmd_repeat("Cannot move, cancelling command " - "repetition."); + if (crawl_state.repeat_cmd != CMD_WIZARD) + crawl_state.cancel_cmd_repeat("Cannot move, cancelling command " + "repetition."); world_reacts(); return; diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 53c0021c81..881216ee1a 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -899,8 +899,12 @@ void ouch(int dam, int death_source, kill_method_type death_type, } // Also don't kill wizards testing Xom acts. - if (crawl_state.prev_cmd == CMD_WIZARD && you.religion != GOD_XOM) + if ((crawl_state.repeat_cmd == CMD_WIZARD + || crawl_state.prev_cmd == CMD_WIZARD) + && you.religion != GOD_XOM) + { return; + } // Okay, you *didn't* escape death. you.reset_escaped_death(); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 4cdf592454..e13ba99ba5 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2994,6 +2994,9 @@ void gain_exp( unsigned int exp_gained, unsigned int* actual_gain, void level_change(bool skip_attribute_increase) { + const bool wiz_cmd = crawl_state.prev_cmd == CMD_WIZARD + || crawl_state.repeat_cmd == CMD_WIZARD; + // necessary for the time being, as level_change() is called // directly sometimes {dlb} you.redraw_experience = true; @@ -3003,14 +3006,9 @@ void level_change(bool skip_attribute_increase) { bool skip_more = false; - if (!skip_attribute_increase) + if (!skip_attribute_increase && !wiz_cmd) { - if (crawl_state.is_replaying_keys() - || crawl_state.is_repeating_cmd()) - { - crawl_state.cancel_cmd_repeat(); - crawl_state.cancel_cmd_again(); - } + crawl_state.cancel_cmd_all(); if (is_processing_macro()) flush_input_buffer(FLUSH_ABORT_MACRO); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 13ceb292d1..528cdf3507 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1097,6 +1097,9 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) (crawl_state.is_god_acting()) ? crawl_state.which_god_acting() : GOD_NO_GOD; + const bool normal_cast = crawl_state.prev_cmd == CMD_CAST_SPELL + && god == GOD_NO_GOD; + // Make some noise if it's actually the player casting. if (god == GOD_NO_GOD) noisy( spell_noise(spell), you.pos() ); @@ -1403,7 +1406,8 @@ 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."); + if (normal_cast) + 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 @@ -1559,7 +1563,8 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) case SPELL_TUKIMAS_DANCE: // Temporarily turn a wielded weapon into a dancing weapon. - crawl_state.cant_cmd_repeat("You can't repeat Tukima's Dance."); + if (normal_cast) + crawl_state.cant_cmd_repeat("You can't repeat Tukima's Dance."); cast_tukimas_dance(powc, god); break; @@ -1877,7 +1882,8 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) // Trying is already enough, even if it fails. did_god_conduct(DID_DELIBERATE_MUTATING, 10); - crawl_state.cant_cmd_repeat("You can't repeat Alter Self."); + if (normal_cast) + 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 " @@ -2091,7 +2097,8 @@ 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."); + if (normal_cast) + crawl_state.cant_cmd_repeat("You can't swap."); cast_swap(powc); break; @@ -2100,7 +2107,8 @@ 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 (normal_cast) + crawl_state.cant_cmd_repeat("You can't repeat create portal."); if (portal() == -1) return (SPRET_ABORT); break; -- cgit v1.2.3-54-g00ecf