From 5be9c59587164c09a41da05a8de9e0d3588412ab Mon Sep 17 00:00:00 2001 From: haranp Date: Wed, 4 Feb 2009 11:48:03 +0000 Subject: Take range information from the beam if applicable in spell_direction(). Implements [2553289]. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8889 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 16 ++++++++-------- crawl-ref/source/spl-util.cc | 3 +++ crawl-ref/source/spl-util.h | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 0d290f460e..0264ed4001 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1204,7 +1204,7 @@ static bool _do_ability(const ability_def& abil) else { beam.range = _calc_breath_ability_range(abil.ability); - if (!spell_direction(abild, beam, DIR_NONE, TARG_ENEMY, beam.range)) + if (!spell_direction(abild, beam)) return (false); } @@ -1408,7 +1408,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_THROW_FROST: // Taking ranges from the equivalent spells. beam.range = (abil.ability == ABIL_THROW_FLAME ? 7 : 8); - if (!spell_direction(abild, beam, DIR_NONE, TARG_ENEMY, beam.range)) + if (!spell_direction(abild, beam)) return (false); if (!zapping((abil.ability == ABIL_THROW_FLAME ? ZAP_FLAME : ZAP_FROST), @@ -1421,7 +1421,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_BOLT_OF_DRAINING: // Taking range from Bolt of Draining. beam.range = 6; - if (!spell_direction(abild, beam, DIR_NONE, TARG_ENEMY, beam.range)) + if (!spell_direction(abild, beam)) return (false); if (!zapping(ZAP_NEGATIVE_ENERGY, you.experience_level * 6, beam, true)) @@ -1521,7 +1521,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_KIKU_ENSLAVE_UNDEAD: { god_acting gdact; - beam.range = 8; + beam.range = LOS_RADIUS; if (!spell_direction(spd, beam)) return (false); @@ -1578,7 +1578,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_YRED_ENSLAVE_SOUL: { god_acting gdact; - beam.range = 8; + beam.range = LOS_RADIUS; if (!spell_direction(spd, beam)) return (false); @@ -1610,7 +1610,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_MAKHLEB_MINOR_DESTRUCTION: - if (!spell_direction(spd, beam, DIR_NONE, TARG_ENEMY, 8)) + if (!spell_direction(spd, beam)) return (false); power = you.skills[SK_INVOCATIONS] @@ -1763,7 +1763,8 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_LUGONU_BANISH: - if (!spell_direction(spd, beam, DIR_NONE, TARG_ENEMY)) + beam.range = LOS_RADIUS; + if (!spell_direction(spd, beam)) return (false); if (beam.target == you.pos()) @@ -1771,7 +1772,6 @@ static bool _do_ability(const ability_def& abil) mpr("You cannot banish yourself!"); return (false); } - beam.range = 8; if (!zapping(ZAP_BANISHMENT, 16 + you.skills[SK_INVOCATIONS] * 8, beam, true)) { diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index b030fe8fca..9886c334fa 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -742,6 +742,9 @@ bool spell_direction( dist &spelld, bolt &pbolt, if (restrict != DIR_DIR) message_current_target(); + if (range < 1) + range = (pbolt.range < 1) ? LOS_RADIUS : pbolt.range; + direction( spelld, restrict, mode, range, false, needs_path, may_target_monster, may_target_self, prompt, NULL, cancel_at_self ); diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 0342fcc076..dd0e78319f 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -111,7 +111,8 @@ void apply_area_cloud(cloud_func func, const coord_def& where, bool spell_direction( dist &spelld, bolt &pbolt, targeting_type restrict = DIR_NONE, targ_mode_type mode = TARG_ENEMY, - int range = LOS_RADIUS, + // pbolt.range if applicable, otherwise LOS_RADIUS + int range = 0, bool needs_path = true, bool may_target_monster = true, bool may_target_self = false, const char *prompt = NULL, bool cancel_at_self = false ); -- cgit v1.2.3-54-g00ecf