From 5da77fd18ee63339cbb9fba9b23a04188b08c6e5 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 11 Jul 2008 12:31:08 +0000 Subject: Fix 2015315 by not even bothering to prompt for spells with the SPFLAG_NOT_SELF flag. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6492 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 21 ++++++++++++++------- crawl-ref/source/directn.cc | 14 +++++++++----- crawl-ref/source/directn.h | 2 +- crawl-ref/source/spl-cast.cc | 5 ++++- crawl-ref/source/spl-util.cc | 4 ++-- crawl-ref/source/spl-util.h | 2 +- 6 files changed, 31 insertions(+), 17 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 4726f60cc7..74fdd24a67 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -711,7 +711,7 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range) if (pbolt.beam_cancelled) { #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "%s", "Beam stopped."); + mprf(MSGCH_DIAGNOSTICS, "%s", "Beam cancelled."); #endif canned_msg(MSG_OK); you.turn_is_over = false; @@ -3630,13 +3630,20 @@ static int _affect_player( bolt &beam, item_def *item ) if (YOU_KILL(beam.thrower)) { // Don't ask if we're aiming at ourselves. - if (!beam.aimed_at_feet && !beam.dont_stop_player - && !yesno("That beam is likely to hit yourself. Continue " - "anyway?", false, 'n')) + if (!beam.aimed_at_feet && !beam.dont_stop_player) { - beam.fr_count += 1; - beam.fr_power += you.experience_level; - beam.dont_stop_player = true; + if (yesno("That beam is likely to hit yourself. Continue " + "anyway?", false, 'n')) + { + beam.fr_count += 1; + beam.fr_power += you.experience_level; + beam.dont_stop_player = true; + } + else + { + beam.beam_cancelled = true; + return (BEAM_STOP); + } } } else if (beam.can_see_invis || !you.invisible() diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 54150223eb..ba9bf9fe5c 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -472,7 +472,7 @@ static void _fill_monster_list(bool full_info) void direction(dist& moves, targeting_type restricts, targ_mode_type mode, int range, bool just_looking, bool needs_path, bool may_target_monster, const char *prompt, - targeting_behaviour *beh) + targeting_behaviour *beh, bool cancel_at_self) { static targeting_behaviour stock_behaviour; if (!beh) @@ -1049,12 +1049,16 @@ void direction(dist& moves, targeting_type restricts, if (moves.isTarget && moves.tx == you.x_pos && moves.ty == you.y_pos && mode == TARG_ENEMY - && (Options.allow_self_target == CONFIRM_CANCEL - || (Options.allow_self_target == CONFIRM_PROMPT - && !yesno("Really target yourself?", false, 'n')))) + && (cancel_at_self + || Options.allow_self_target == CONFIRM_CANCEL + || Options.allow_self_target == CONFIRM_PROMPT + && !yesno("Really target yourself?", false, 'n'))) { - if (Options.allow_self_target == CONFIRM_CANCEL ) + if (cancel_at_self) + mpr("Sorry, you can't target yourself."); + else if (Options.allow_self_target == CONFIRM_CANCEL) mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER); + show_prompt = true; } else if (moves.isTarget && !see_grid(moves.tx, moves.ty)) diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h index d071ab28ec..557962186f 100644 --- a/crawl-ref/source/directn.h +++ b/crawl-ref/source/directn.h @@ -151,7 +151,7 @@ void direction( dist &moves, targeting_type restricts = DIR_NONE, targ_mode_type mode = TARG_ANY, int range = -1, bool just_looking = false, bool needs_path = true, bool may_target_monster = true, const char *prompt = NULL, - targeting_behaviour *mod = NULL ); + targeting_behaviour *mod = NULL, bool cancel_at_self = false ); bool in_los_bounds(int x, int y); bool in_viewport_bounds(int x, int y); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 51a3c0ff70..13d9922563 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1034,8 +1034,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) const bool needs_path = (!testbits(flags, SPFLAG_GRID) && !testbits(flags, SPFLAG_TARGET)); - if (!spell_direction(spd, beam, dir, targ, needs_path, true, prompt)) + if (!spell_direction(spd, beam, dir, targ, needs_path, true, prompt, + testbits(flags, SPFLAG_NOT_SELF))) + { return (SPRET_ABORT); + } if (testbits(flags, SPFLAG_NOT_SELF) && spd.isMe) { diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 6edc0d33a8..e64c2f089f 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -782,13 +782,13 @@ void apply_area_cloud( int (*func) (int, int, int, int, cloud_type, bool spell_direction( dist &spelld, bolt &pbolt, targeting_type restrict, targ_mode_type mode, bool needs_path, bool may_target_monster, - const char *prompt ) + const char *prompt, bool cancel_at_self ) { if (restrict != DIR_DIR) message_current_target(); direction( spelld, restrict, mode, -1, false, needs_path, - may_target_monster, prompt ); + may_target_monster, prompt, NULL, cancel_at_self ); if (!spelld.isValid) { diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index f245210455..b2dd736b7c 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -132,7 +132,7 @@ bool spell_direction( dist &spelld, bolt &pbolt, targeting_type restrict = DIR_NONE, targ_mode_type mode = TARG_ENEMY, bool needs_path = true, bool may_target_monster = true, - const char *prompt = NULL ); + const char *prompt = NULL, bool cancel_at_self = false ); void apply_area_cloud(int (*func) (int, int, int, int, cloud_type, kill_category), -- cgit v1.2.3-54-g00ecf