diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-05 14:53:04 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-05 14:53:04 +0000 |
commit | 87c95a753d11b0b540f7c6a3d3e7f8a8b67ae3c1 (patch) | |
tree | f6c89860622bf0c2fb6e569e0addcd7636c61c57 /crawl-ref | |
parent | 086e548103eed62bf4d1bb806e2bec88562fbfe6 (diff) | |
download | crawl-ref-87c95a753d11b0b540f7c6a3d3e7f8a8b67ae3c1.tar.gz crawl-ref-87c95a753d11b0b540f7c6a3d3e7f8a8b67ae3c1.zip |
[2010192] Fixing issue where cancelling a ranged attack (e.g. "Really fire on...?") wouldn't really cancel the attack. Also, s/beam_stopped/beam_cancelled/ for clarity.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6409 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/beam.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/beam.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index e8e09d2707..b7ad0d4ce4 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -701,15 +701,18 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range) pbolt.fr_helped = pbolt.fr_hurt = 0; pbolt.foe_helped = pbolt.foe_hurt = 0; pbolt.foe_ratio = 100; - pbolt.beam_stopped = false; + pbolt.beam_cancelled= false; pbolt.dont_stop_foe = pbolt.dont_stop_fr = false; fire_beam(pbolt); // Should only happen if the player answered 'n' to one of those // "Fire through friendly?" prompts. - if (pbolt.beam_stopped) + if (pbolt.beam_cancelled) { +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "%s", "Beam stopped."); +#endif canned_msg(MSG_OK); you.turn_is_over = false; return (false); @@ -1934,6 +1937,9 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item) } } + if (pbolt.beam_cancelled) + return; + // Always decrease range by 1. rangeRemaining--; @@ -4352,7 +4358,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item) if (stop_attack_prompt(mon, true, target)) { - beam.beam_stopped = true; + beam.beam_cancelled = true; return (BEAM_STOP); } if (beam.fr_count == 1 && !beam.dont_stop_fr) @@ -4514,7 +4520,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item) if (stop_attack_prompt(mon, true, target)) { - beam.beam_stopped = true; + beam.beam_cancelled = true; return (BEAM_STOP); } if (beam.fr_count == 1 && !beam.dont_stop_fr) @@ -5632,7 +5638,7 @@ bolt::bolt() : range(0), rangeMax(0), type('*'), msg_generated(false), in_explosion_phase(false), smart_monster(false), can_see_invis(false), attitude(ATT_HOSTILE), foe_ratio(0), chose_ray(false), - beam_stopped(false), dont_stop_foe(false), dont_stop_fr(false) + beam_cancelled(false), dont_stop_foe(false), dont_stop_fr(false) { } diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index d6f3e6e164..e81f4e6854 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -148,7 +148,7 @@ struct bolt mon_attitude_type attitude; // attitude of whoever fired tracer int foe_ratio; // 100* foe ratio (see mons_should_fire()) bool chose_ray; // do we want a specific ray? - bool beam_stopped; // stop_attack_prompt() returned true + bool beam_cancelled; // stop_attack_prompt() returned true bool dont_stop_foe; // stop_attack_prompt() returned false for foe bool dont_stop_fr; // stop_attack_prompt() returned false for // friend diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 06c688deb7..49855a0b41 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1912,7 +1912,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // Should only happen if the player answered 'n' to one of those // "Fire through friendly?" prompts. - if (pbolt.fr_count > 0) + if (pbolt.fr_count > 0 || pbolt.beam_cancelled) { canned_msg(MSG_OK); you.turn_is_over = false; |