From 1f9e38751c81744f2e8d4ffb1aea7f3870ba9d5b Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 25 Sep 2008 17:13:23 +0000 Subject: Ranges redone. bolt no longer has a rangeMax, just a range. Almost all ranges are now capped by LOS. There are still some things missing, most noticeably randomizing ranges for the range-1-to-2 spells (e.g. Flame Tongue.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6984 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 6 +- crawl-ref/source/beam.cc | 209 ++--------------------------------------- crawl-ref/source/beam.h | 3 +- crawl-ref/source/decks.cc | 4 +- crawl-ref/source/directn.cc | 14 ++- crawl-ref/source/item_use.cc | 39 ++++---- crawl-ref/source/monstuff.cc | 14 +-- crawl-ref/source/mstuff2.cc | 109 +++------------------- crawl-ref/source/spells1.cc | 3 +- crawl-ref/source/spells4.cc | 28 ++---- crawl-ref/source/spl-cast.cc | 43 ++++++--- crawl-ref/source/spl-data.h | 217 ++++++++++++++++++++++++++++++++++++++++++- crawl-ref/source/spl-util.cc | 21 ++++- crawl-ref/source/spl-util.h | 7 ++ 14 files changed, 341 insertions(+), 376 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 700c8bc781..ae9e4b55d5 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1078,14 +1078,14 @@ static bool _do_ability(const ability_def& abil) } case ABIL_DELAYED_FIREBALL: - if ( !spell_direction(spd, beam, DIR_NONE, TARG_ENEMY) ) + if (!spell_direction(spd, beam, DIR_NONE, TARG_ENEMY)) return (false); // Note: power level of ball calculated at release -- bwr - fireball( calc_spell_power( SPELL_DELAYED_FIREBALL, true ), beam ); + fireball(calc_spell_power( SPELL_DELAYED_FIREBALL, true ), beam); // only one allowed since this is instantaneous -- bwr - you.attribute[ ATTR_DELAYED_FIREBALL ] = 0; + you.attribute[ATTR_DELAYED_FIREBALL] = 0; break; case ABIL_SPIT_POISON: // Naga + spit poison mutation diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 136ccfd092..04ae6eb964 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -205,8 +205,8 @@ static void _ench_animation( int flavour, const monsters *mon, bool force ) static void _beam_set_default_values(bolt &beam, int power) { - beam.range = 8 + random2(5); // default for "0" beams (I think) - beam.rangeMax = 0; + if (beam.range <= 0) + beam.range = LOS_RADIUS; beam.hit = 0; // default for "0" beams (I think) beam.damage = dice_def( 1, 0 ); // default for "0" beams (I think) beam.type = 0; // default for "0" beams @@ -275,48 +275,36 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) switch (z_type) { case ZAP_SMALL_SANDBLAST: - pbolt.rangeMax = 2; - pbolt.flavour = BEAM_FRAG; // extra AC resist + pbolt.flavour = BEAM_FRAG; break; case ZAP_SANDBLAST: - if (power > 50) - power = 50; - -// pbolt.range = 2 + random2(power) / 20; - pbolt.rangeMax = 2 + (power-1) / 20; // max 4 - pbolt.flavour = BEAM_FRAG; // extra AC resist + pbolt.flavour = BEAM_FRAG; break; case ZAP_FLAME_TONGUE: if (power > 25) power = 25; -// pbolt.range = 1 + random2(2) + random2(power) / 10; - pbolt.rangeMax = 2 + (power-1) / 10; // max 4 pbolt.flavour = BEAM_FIRE; break; case ZAP_CLEANSING_FLAME: pbolt.name = "golden flame"; - pbolt.rangeMax = 7; pbolt.flavour = BEAM_HOLY; pbolt.is_explosion = true; break; case ZAP_MAGMA: - pbolt.rangeMax = 8; pbolt.flavour = BEAM_LAVA; pbolt.is_beam = true; break; case ZAP_IRON_BOLT: - pbolt.rangeMax = 9; pbolt.flavour = BEAM_MMISSILE; // unresistable break; case ZAP_CRYSTAL_SPEAR: - pbolt.rangeMax = 9; pbolt.flavour = BEAM_MMISSILE; // unresistable break; @@ -324,11 +312,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 3 + random2( 1 + power / 2 ); - pbolt.rangeMax = 3 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_POISON; break; @@ -336,11 +319,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 3 + random2( 1 + power / 2 ); - pbolt.rangeMax = 3 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_FIRE; pbolt.is_beam = true; break; @@ -349,11 +327,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 3 + random2( 1 + power / 2 ); - pbolt.rangeMax = 3 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_COLD; pbolt.is_beam = true; break; @@ -362,11 +335,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 3 + random2( 1 + power / 2 ); - pbolt.rangeMax = 3 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_ACID; pbolt.is_beam = true; break; @@ -375,11 +343,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 3 + random2( 1 + power / 2 ); - pbolt.rangeMax = 3 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_POISON; pbolt.is_beam = true; break; @@ -388,17 +351,11 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) if (power > 50) power = 50; -// pbolt.range = 6 + random2( 1 + power / 2 ); - pbolt.rangeMax = 6 + power / 2; - if (pbolt.rangeMax > 9) - pbolt.rangeMax = 9; - pbolt.flavour = BEAM_MMISSILE; // unresistable pbolt.is_beam = true; break; case ZAP_BREATHE_STEAM: - pbolt.rangeMax = 9; pbolt.flavour = BEAM_STEAM; pbolt.is_beam = true; break; @@ -407,34 +364,28 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) case ZAP_MAGIC_DARTS: case ZAP_STONE_ARROW: case ZAP_MYSTIC_BLAST: - pbolt.rangeMax = 12; pbolt.flavour = BEAM_MMISSILE; // unresistable break; case ZAP_STING: case ZAP_POISON_ARROW: - pbolt.rangeMax = 12; pbolt.flavour = BEAM_POISON; break; case ZAP_FLAME: case ZAP_STICKY_FLAME: - pbolt.rangeMax = 12; pbolt.flavour = BEAM_FIRE; break; case ZAP_FROST: - pbolt.rangeMax = 12; pbolt.flavour = BEAM_COLD; break; case ZAP_ICE_BOLT: - pbolt.rangeMax = 12; pbolt.flavour = BEAM_ICE; // half resistable break; case ZAP_ELECTRICITY: - pbolt.rangeMax = 13; pbolt.flavour = BEAM_ELECTRICITY; // beams & reflects pbolt.is_beam = true; break; @@ -442,60 +393,50 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) case ZAP_DISRUPTION: case ZAP_DISINTEGRATION: pbolt.name = "0"; - pbolt.rangeMax = 14; pbolt.flavour = BEAM_DISINTEGRATION; break; case ZAP_PAIN: pbolt.name = "0"; - pbolt.rangeMax = 14; pbolt.flavour = BEAM_PAIN; break; case ZAP_DISPEL_UNDEAD: pbolt.name = "0"; - pbolt.rangeMax = 14; pbolt.flavour = BEAM_DISPEL_UNDEAD; break; case ZAP_FIRE: - pbolt.rangeMax = 16; pbolt.flavour = BEAM_FIRE; pbolt.is_beam = true; break; case ZAP_BONE_SHARDS: - pbolt.rangeMax = 16; pbolt.flavour = BEAM_MAGIC; // unresisted pbolt.is_beam = true; break; case ZAP_COLD: - pbolt.rangeMax = 16; pbolt.flavour = BEAM_COLD; pbolt.is_beam = true; break; case ZAP_NEGATIVE_ENERGY: - pbolt.rangeMax = 16; pbolt.flavour = BEAM_NEG; // drains levels pbolt.is_beam = true; break; case ZAP_BEAM_OF_ENERGY: // bolt of innacuracy - pbolt.range = 16; pbolt.flavour = BEAM_ENERGY; // unresisted pbolt.is_beam = true; break; case ZAP_VENOM_BOLT: - pbolt.rangeMax = 17; pbolt.flavour = BEAM_POISON; pbolt.is_beam = true; break; case ZAP_LIGHTNING: - pbolt.rangeMax = 17; pbolt.flavour = BEAM_ELECTRICITY; // beams & reflects pbolt.is_beam = true; break; @@ -503,110 +444,91 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) // enchantments case ZAP_ENSLAVEMENT: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_CHARM; break; case ZAP_BANISHMENT: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_BANISH; break; case ZAP_DEGENERATION: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_DEGENERATE; break; case ZAP_ENSLAVE_UNDEAD: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_ENSLAVE_UNDEAD; break; case ZAP_CONTROL_DEMON: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_ENSLAVE_DEMON; break; case ZAP_SLEEP: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_SLEEP; break; case ZAP_BACKLIGHT: pbolt.name = "0"; - pbolt.rangeMax = 11; pbolt.flavour = BEAM_BACKLIGHT; break; case ZAP_SLOWING: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_SLOW; break; case ZAP_HASTING: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_HASTE; break; case ZAP_PARALYSIS: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_PARALYSIS; break; case ZAP_PETRIFY: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_PETRIFY; break; case ZAP_CONFUSION: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_CONFUSION; break; case ZAP_INVISIBILITY: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_INVISIBILITY; break; case ZAP_HEALING: pbolt.name = "0"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_HEALING; break; case ZAP_TELEPORTATION: pbolt.name = "0"; - pbolt.rangeMax = 13; pbolt.flavour = BEAM_TELEPORT; break; case ZAP_POLYMORPH_OTHER: pbolt.name = "0"; - pbolt.rangeMax = 13; pbolt.flavour = BEAM_POLYMORPH; break; case ZAP_AGONY: pbolt.name = "0agony"; - pbolt.rangeMax = 14; pbolt.flavour = BEAM_PAIN; break; case ZAP_DIGGING: pbolt.name = "0"; -// pbolt.range = 3 + random2( power / 5 ) + random2(5); - pbolt.rangeMax = 6 + power / 5; pbolt.flavour = BEAM_DIGGING; pbolt.is_beam = true; break; @@ -614,14 +536,12 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) // explosions case ZAP_FIREBALL: pbolt.name = "fireball"; - pbolt.rangeMax = 12; pbolt.flavour = BEAM_FIRE; // fire pbolt.is_explosion = true; break; case ZAP_ICE_STORM: pbolt.name = "great blast of cold"; - pbolt.rangeMax = 13; pbolt.ench_power = power; // used for radius pbolt.flavour = BEAM_ICE; // half resisted pbolt.is_explosion = true; @@ -629,27 +549,23 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt ) case ZAP_ORB_OF_FRAGMENTATION: // cap 150 pbolt.name = "metal orb"; - pbolt.rangeMax = 16; pbolt.flavour = BEAM_FRAG; // extra AC resist pbolt.is_explosion = true; break; case ZAP_HELLFIRE: - pbolt.rangeMax = 16; pbolt.flavour = BEAM_HELLFIRE; pbolt.is_explosion = true; break; case ZAP_ORB_OF_ELECTRICITY: // cap 150 pbolt.name = "orb of electricity"; - pbolt.rangeMax = 20; pbolt.flavour = BEAM_ELECTRICITY; pbolt.is_explosion = true; break; case ZAP_DEBUGGING_RAY: default: // buggy beam - pbolt.rangeMax = 16; pbolt.flavour = BEAM_MMISSILE; // unresistable break; } @@ -669,10 +585,6 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range) pbolt.name = "unimportant"; _get_max_range(ztype, power, pbolt); - // Override range if necessary. - if (range > 0) - pbolt.rangeMax = range; - pbolt.is_tracer = true; pbolt.source = you.pos(); pbolt.can_see_invis = player_see_invis(); @@ -997,7 +909,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_STRIKING: // cap 25 pbolt.name = "force bolt"; pbolt.colour = BLACK; - pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 1, 5 ); // dam: 5 pbolt.hit = 8 + power / 10; // 25: 10 pbolt.type = dchar_glyph(DCHAR_SPACE); @@ -1008,7 +919,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_MAGIC_DARTS: // cap 25 pbolt.name = "magic dart"; pbolt.colour = LIGHTMAGENTA; - pbolt.range = random2(5) + 8; pbolt.damage = dice_def( 1, 3 + power / 5 ); // 25: 1d8 pbolt.hit = AUTOMATIC_HIT; // hits always pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1019,7 +929,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_STING: // cap 25 pbolt.name = "sting"; pbolt.colour = GREEN; - pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 1, 3 + power / 5 ); // 25: 1d8 pbolt.hit = 8 + power / 5; // 25: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1030,7 +939,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_ELECTRICITY: // cap 20 pbolt.name = "zap"; pbolt.colour = LIGHTCYAN; - pbolt.range = 6 + random2(8); // extended in beam pbolt.damage = dice_def( 1, 3 + random2(power) / 2 );// 25: 1d11 pbolt.hit = 8 + power / 7; // 25: 11 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1042,7 +950,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_DISRUPTION: // cap 25 pbolt.name = "0"; pbolt.flavour = BEAM_DISINTEGRATION; - pbolt.range = 7 + random2(8); pbolt.damage = dice_def( 1, 4 + power / 5 ); // 25: 1d9 pbolt.ench_power *= 3; break; @@ -1050,7 +957,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_PAIN: // cap 25 pbolt.name = "0"; pbolt.flavour = BEAM_PAIN; - pbolt.range = 7 + random2(8); pbolt.damage = dice_def( 1, 4 + power / 5 ); // 25: 1d9 pbolt.ench_power *= 7; pbolt.ench_power /= 2; @@ -1059,11 +965,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_FLAME_TONGUE: // cap 25 pbolt.name = "flame"; pbolt.colour = RED; - - pbolt.range = 1 + random2(2) + random2(power) / 10; - if (pbolt.range > 4) - pbolt.range = 4; - pbolt.damage = dice_def( 1, 8 + power / 4 ); // 25: 1d14 pbolt.hit = 7 + power / 6; // 25: 11 pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); @@ -1080,7 +981,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) (temp_rand == 2) ? "grit" : "sand"; pbolt.colour = BROWN; - pbolt.range = (random2(power) > random2(30)) ? 2 : 1; pbolt.damage = dice_def( 1, 8 + power / 4 ); // 25: 1d14 pbolt.hit = 8 + power / 5; // 25: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); @@ -1090,13 +990,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_SANDBLAST: // cap 50 pbolt.name = coinflip() ? "blast of rock" : "rocky blast"; - pbolt.colour = BROWN; - - pbolt.range = 2 + random2(power) / 20; - if (pbolt.range > 4) - pbolt.range = 4; - pbolt.damage = dice_def( 2, 4 + power / 3 ); // 25: 2d12 pbolt.hit = 13 + power / 10; // 25: 15 pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); @@ -1107,7 +1001,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_BONE_SHARDS: pbolt.name = "spray of bone shards"; pbolt.colour = LIGHTGREY; - pbolt.range = 7 + random2(10); // Incoming power is highly dependant on mass (see spells3.cc). // Basic function is power * 15 + mass... with the largest @@ -1124,7 +1017,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_FLAME: // cap 50 pbolt.name = "puff of flame"; pbolt.colour = RED; - pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 2, 4 + power / 10 );// 25: 2d6 50: 2d9 pbolt.hit = 8 + power / 10; // 25: 10 50: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1135,7 +1027,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_FROST: // cap 50 pbolt.name = "puff of frost"; pbolt.colour = WHITE; - pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 2, 4 + power / 10 );// 25: 2d6 50: 2d9 pbolt.hit = 8 + power / 10; // 25: 10 50: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1146,7 +1037,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_STONE_ARROW: // cap 100 pbolt.name = "stone arrow"; pbolt.colour = LIGHTGREY; - pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 2, 5 + power / 7 );// 25: 2d8 50: 2d12 pbolt.hit = 8 + power / 10; // 25: 10 50: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -1157,7 +1047,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_STICKY_FLAME: // cap 100 pbolt.name = "sticky flame"; // extra damage pbolt.colour = RED; - pbolt.range = 8 + random2(5); // 50: 2d7 100: 2d11 pbolt.damage = dice_def( 2, 3 + power / 12 ); // 50: 16 100: 21 @@ -1170,7 +1059,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_MYSTIC_BLAST: // cap 100 pbolt.name = "orb of energy"; pbolt.colour = LIGHTMAGENTA; - pbolt.range = 8 + random2(5); pbolt.damage = calc_dice( 2, 15 + (power * 2) / 5 ); pbolt.hit = 10 + power / 7; // 50: 17 100: 24 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1181,7 +1069,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_ICE_BOLT: // cap 100 pbolt.name = "bolt of ice"; pbolt.colour = WHITE; - pbolt.range = 8 + random2(5); pbolt.damage = calc_dice( 3, 10 + power / 2 ); pbolt.hit = 9 + power / 12; // 50: 13 100: 17 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1191,7 +1078,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_DISPEL_UNDEAD: // cap 100 pbolt.name = "0"; pbolt.flavour = BEAM_DISPEL_UNDEAD; - pbolt.range = 7 + random2(8); pbolt.damage = calc_dice( 3, 20 + (power * 3) / 4 ); pbolt.ench_power *= 3; pbolt.ench_power /= 2; @@ -1200,7 +1086,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_MAGMA: // cap 150 pbolt.name = "bolt of magma"; pbolt.colour = RED; - pbolt.range = 5 + random2(4); pbolt.damage = calc_dice( 4, 10 + (power * 3) / 5 ); pbolt.hit = 8 + power / 25; // 50: 10 100: 14 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1212,7 +1097,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_FIRE: // cap 150 pbolt.name = "bolt of fire"; pbolt.colour = RED; - pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 6, 18 + power * 2 / 3 ); pbolt.hit = 10 + power / 25; // 50: 12 100: 14 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1224,7 +1108,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_COLD: // cap 150 pbolt.name = "bolt of cold"; pbolt.colour = WHITE; - pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 6, 18 + power * 2 / 3 ); pbolt.hit = 10 + power / 25; // 50: 12 100: 14 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1236,7 +1119,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_VENOM_BOLT: // cap 150 pbolt.name = "bolt of poison"; pbolt.colour = LIGHTGREEN; - pbolt.range = 8 + random2(10); pbolt.damage = calc_dice( 4, 15 + power / 2 ); pbolt.hit = 8 + power / 20; // 50: 10 100: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1249,7 +1131,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // These always auto-identify, so no generic name. pbolt.name = "bolt of negative energy"; pbolt.colour = DARKGREY; - pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 4, 15 + (power * 3) / 5 ); pbolt.hit = 8 + power / 20; // 50: 10 100: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1261,7 +1142,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_IRON_BOLT: // cap 150 pbolt.name = "iron bolt"; pbolt.colour = LIGHTCYAN; - pbolt.range = 5 + random2(5); pbolt.damage = calc_dice( 9, 15 + (power * 3) / 4 ); pbolt.hit = 7 + power / 15; // 50: 10 100: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -1272,7 +1152,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_POISON_ARROW: // cap 150 pbolt.name = "poison arrow"; pbolt.colour = LIGHTGREEN; - pbolt.range = 8 + random2(5); pbolt.damage = calc_dice( 4, 15 + power ); pbolt.hit = 5 + power / 10; // 50: 10 100: 15 pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -1284,7 +1163,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_DISINTEGRATION: // cap 150 pbolt.name = "0"; pbolt.flavour = BEAM_DISINTEGRATION; - pbolt.range = 7 + random2(8); pbolt.damage = calc_dice( 3, 15 + (power * 3) / 4 ); pbolt.ench_power *= 5; pbolt.ench_power /= 2; @@ -1295,7 +1173,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // also for breath (at pow = lev * 2; max dam: 33) pbolt.name = "bolt of lightning"; pbolt.colour = LIGHTCYAN; - pbolt.range = 8 + random2(10); // extended in beam pbolt.damage = calc_dice( 1, 10 + (power * 3) / 5 ); pbolt.hit = 7 + random2(power) / 20; // 50: 7-9 100: 7-12 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1307,7 +1184,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_FIREBALL: // cap 150 pbolt.name = "fireball"; pbolt.colour = RED; - pbolt.range = 8 + random2(5); pbolt.damage = calc_dice( 3, 10 + power / 2 ); pbolt.hit = 40; // hit: 40 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1318,7 +1194,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_ORB_OF_ELECTRICITY: // cap 150 pbolt.name = "orb of electricity"; pbolt.colour = LIGHTBLUE; - pbolt.range = 9 + random2(12); pbolt.damage = calc_dice( 1, 15 + (power * 4) / 5 ); pbolt.damage.num = 0; // only does explosion damage pbolt.hit = 40; // hit: 40 @@ -1330,7 +1205,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_ORB_OF_FRAGMENTATION: // cap 150 pbolt.name = "metal orb"; pbolt.colour = CYAN; - pbolt.range = 9 + random2(7); pbolt.damage = calc_dice( 3, 30 + (power * 3) / 4 ); pbolt.hit = 20; // hit: 20 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1341,7 +1215,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_CLEANSING_FLAME: pbolt.name = "golden flame"; pbolt.colour = YELLOW; - pbolt.range = 7; pbolt.damage = calc_dice( 3, 20 + (power * 2) / 3 ); pbolt.hit = 150; pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1353,7 +1226,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_CRYSTAL_SPEAR: // cap 200 pbolt.name = "crystal spear"; pbolt.colour = WHITE; - pbolt.range = 6 + random2(4); pbolt.damage = calc_dice( 10, 23 + power ); pbolt.hit = 10 + power / 15; // 50: 13 100: 16 pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -1364,7 +1236,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_HELLFIRE: // cap 200 pbolt.name = "hellfire"; pbolt.colour = RED; - pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 3, 10 + (power * 3) / 4 ); pbolt.hit = 20 + power / 10; // 50: 25 100: 30 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1376,7 +1247,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_ICE_STORM: // cap 200 pbolt.name = "great blast of cold"; pbolt.colour = BLUE; - pbolt.range = 9 + random2(5); pbolt.damage = calc_dice( 7, 22 + power ); pbolt.hit = 20 + power / 10; // 50: 25 100: 30 pbolt.ench_power = power; // used for radius @@ -1388,7 +1258,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_BEAM_OF_ENERGY: // bolt of innacuracy pbolt.name = "narrow beam of energy"; pbolt.colour = YELLOW; - pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 12, 40 + (power * 3) / 2 ); pbolt.hit = 1; pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1401,11 +1270,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max pow = lev + mut * 5 = 42 pbolt.name = "splash of poison"; pbolt.colour = GREEN; - - pbolt.range = 3 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 1, 4 + power / 2 ); // max dam: 25 pbolt.hit = 5 + random2( 1 + power / 3 ); // max hit: 19 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1417,11 +1281,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max pow = lev + mut * 4 + 12 = 51 (capped to 50) pbolt.name = "fiery breath"; pbolt.colour = RED; - - pbolt.range = 3 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 4 + power / 3 ); // max dam: 60 pbolt.hit = 8 + random2( 1 + power / 3 ); // max hit: 25 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1434,11 +1293,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max power = lev = 27 pbolt.name = "freezing breath"; pbolt.colour = WHITE; - - pbolt.range = 3 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 4 + power / 3 ); // max dam: 39 pbolt.hit = 8 + random2( 1 + power / 3 ); pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1451,11 +1305,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max power = lev for ability, 50 for minor destruction (max dam: 57) pbolt.name = "acid"; pbolt.colour = YELLOW; - - pbolt.range = 3 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 3 + power / 3 ); // max dam: 36 pbolt.hit = 5 + random2( 1 + power / 3 ); pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1468,11 +1317,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max power = lev = 27 pbolt.name = "poison gas"; pbolt.colour = GREEN; - - pbolt.range = 3 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 2 + power / 6 ); // max dam: 18 pbolt.hit = 6 + random2( 1 + power / 3 ); pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1493,10 +1337,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) if (random2(power) >= 17) pbolt.colour = LIGHTMAGENTA; - pbolt.range = 6 + random2( 1 + power / 2 ); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 3 + power / 3 ); // max dam: 36 pbolt.hit = 5 + random2( 1 + power / 3 ); pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1509,11 +1349,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // max power = lev = 27 pbolt.name = "ball of steam"; pbolt.colour = LIGHTGREY; - - pbolt.range = 6 + random2(5); - if (pbolt.range > 9) - pbolt.range = 9; - pbolt.damage = dice_def( 3, 4 + power / 5 ); // max dam: 27 pbolt.hit = 10 + random2( 1 + power / 5 ); pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1569,56 +1404,48 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "0"; pbolt.flavour = BEAM_DIGGING; // not ordinary "0" beam range {dlb} - pbolt.range = 3 + random2( power / 5 ) + random2(5); pbolt.is_beam = true; break; case ZAP_TELEPORTATION: pbolt.name = "0"; pbolt.flavour = BEAM_TELEPORT; - pbolt.range = 9 + random2(5); // pbolt.is_beam = true; break; case ZAP_POLYMORPH_OTHER: pbolt.name = "0"; pbolt.flavour = BEAM_POLYMORPH; - pbolt.range = 9 + random2(5); // pbolt.is_beam = true; break; case ZAP_ENSLAVEMENT: pbolt.name = "0"; pbolt.flavour = BEAM_CHARM; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; case ZAP_BANISHMENT: pbolt.name = "0"; pbolt.flavour = BEAM_BANISH; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; case ZAP_DEGENERATION: pbolt.name = "0"; pbolt.flavour = BEAM_DEGENERATE; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; case ZAP_ENSLAVE_UNDEAD: pbolt.name = "0"; pbolt.flavour = BEAM_ENSLAVE_UNDEAD; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; case ZAP_AGONY: pbolt.name = "0agony"; pbolt.flavour = BEAM_PAIN; - pbolt.range = 7 + random2(8); pbolt.ench_power *= 5; // pbolt.is_beam = true; break; @@ -1626,7 +1453,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_CONTROL_DEMON: pbolt.name = "0"; pbolt.flavour = BEAM_ENSLAVE_DEMON; - pbolt.range = 7 + random2(5); pbolt.ench_power *= 3; pbolt.ench_power /= 2; // pbolt.is_beam = true; @@ -1635,7 +1461,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_SLEEP: //jmf: added pbolt.name = "0"; pbolt.flavour = BEAM_SLEEP; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; @@ -1643,14 +1468,12 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "0"; pbolt.flavour = BEAM_BACKLIGHT; pbolt.colour = BLUE; - pbolt.range = 7 + random2(5); // pbolt.is_beam = true; break; case ZAP_DEBUGGING_RAY: pbolt.name = "debugging ray"; pbolt.colour = random_colour(); - pbolt.range = 7 + random2(10); pbolt.damage = dice_def( 1500, 1 ); // dam: 1500 pbolt.hit = 1500; // hit: 1500 pbolt.type = dchar_glyph(DCHAR_FIRED_DEBUG); @@ -1661,7 +1484,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) default: pbolt.name = "buggy beam"; pbolt.colour = random_colour(); - pbolt.range = 7 + random2(10); pbolt.damage = dice_def( 1, 0 ); pbolt.hit = 60; pbolt.type = dchar_glyph(DCHAR_FIRED_DEBUG); @@ -1677,15 +1499,6 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) } } -/* NEW (GDL): - * Now handles all beamed/thrown items and spells, tracers, and their effects. - * item is used for items actually thrown/launched - * - * If item is NULL, there is no physical object being thrown that could - * land on the ground. - */ - - // Affect monster in wall unless it can shield itself using the wall. // The wall will always shield the monster if the beam bounces off the // wall, and a monster can't use a metal wall to shield itself from @@ -1740,7 +1553,6 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item) { bool beamTerminate; // Has beam been 'stopped' by something? coord_def &testpos(pbolt.pos); - int rangeRemaining; bool did_bounce = false; cursor_control coff(false); @@ -1800,14 +1612,7 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item) beamTerminate = false; // Setup range. - rangeRemaining = pbolt.range; - if (pbolt.rangeMax > pbolt.range) - { - if (pbolt.is_tracer) - rangeRemaining = pbolt.rangeMax; - else - rangeRemaining += random2((pbolt.rangeMax - pbolt.range) + 1); - } + int rangeRemaining = pbolt.range; // Before we start drawing the beam, turn buffering off. #ifdef WIN32CONSOLE @@ -5177,7 +4982,7 @@ static int _range_used_on_hit(bolt &beam) // If it isn't lightning, reduce range by a lot. if (beam.flavour != BEAM_ELECTRICITY) - return (random2(4) + 2); + return (2); return (0); } @@ -5707,7 +5512,7 @@ static bool _nice_beam(monsters *mon, bolt &beam) // // TODO: Eventually it'd be nice to have a proper factory for these things // (extended from setup_mons_cast() and zapping() which act as limited ones). -bolt::bolt() : range(0), rangeMax(0), type('*'), +bolt::bolt() : range(0), type('*'), colour(BLACK), flavour(BEAM_MAGIC), source(), target(), pos(), damage(0,0), ench_power(0), hit(0), diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index f6d54a470f..1806c7ac9f 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -99,8 +99,7 @@ struct dist; struct bolt { // INPUT parameters set by caller - int range; // minimum range - int rangeMax; // maximum range + int range; unsigned type; // missile gfx int colour; beam_type flavour; diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 19cec487e0..92edae8b0a 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1675,8 +1675,8 @@ static bool _damaging_card(card_type card, int power, deck_rarity_type rarity) snprintf(info, INFO_SIZE, "You have drawn %s. Aim where? ", card_name(card)); - if (spell_direction(target, beam, DIR_NONE, TARG_ENEMY, true, true, false, - info) + if (spell_direction(target, beam, DIR_NONE, TARG_ENEMY, + LOS_RADIUS, true, true, false, info) && player_tracer(ZAP_DEBUGGING_RAY, power/4, beam)) { zapping(ztype, random2(power/4), beam); diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 78b68aafa6..b319988c00 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -1363,6 +1363,11 @@ void direction(dist& moves, targeting_type restricts, mpr("Sorry, you can't target what you can't see.", MSGCH_EXAMINE_FILTER); } + else if (range >= 0 + && grid_distance(moves.target, you.pos()) > range) + { + mpr("That is beyond the maximum range.", MSGCH_EXAMINE_FILTER); + } // Ask for confirmation if we're quitting for some odd reason. else if (moves.isValid || moves.isCancel || yesno("Are you sure you want to fizzle?", false, 'n')) @@ -1424,6 +1429,7 @@ void direction(dist& moves, targeting_type restricts, { // Draw the new ray with magenta '*'s, not including // your square or the target square. + // Out-of-range cells get grey '*'s instead. ray_def raycopy = ray; // temporary copy to work with while (raycopy.pos() != moves.target) { @@ -1433,8 +1439,12 @@ void direction(dist& moves, targeting_type restricts, if (!in_los(raycopy.pos())) break; - draw_ray_glyph(raycopy.pos(), MAGENTA, '*', - MAGENTA | COLFLAG_REVERSE); + const bool in_range = (range < 0) + || grid_distance(raycopy.pos(), you.pos()) <= range; + const int bcol = in_range ? MAGENTA : DARKGREY; + + draw_ray_glyph(raycopy.pos(), bcol, '*', + bcol | COLFLAG_REVERSE); } raycopy.advance_through(moves.target); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 31c539c448..bf63dff657 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1865,46 +1865,39 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, pbolt.aux_source.clear(); // pbolt.range is set below + int max_range = 0; + int range = 0; + if (projected) { if (wepType == MI_LARGE_ROCK) { - pbolt.range = 1 + random2( you.strength / 5 ); - pbolt.rangeMax = you.strength / 5; + range = 1 + random2( you.strength / 5 ); + max_range = you.strength / 5; if (you.can_throw_rocks()) { - pbolt.range += random_range(4, 7); - pbolt.rangeMax += 7; - } - if (pbolt.rangeMax > 12) - { - pbolt.rangeMax = 12; - if (pbolt.range > 12) - pbolt.range = 12; + range += random_range(4, 7); + max_range += 7; } } else if (wepType == MI_THROWING_NET) { - pbolt.rangeMax = pbolt.range = 2 + player_size(PSIZE_BODY); + max_range = range = 2 + player_size(PSIZE_BODY); } else { - pbolt.rangeMax = pbolt.range = 12; + max_range = range = LOS_RADIUS; } } else { // Range based on mass & strength, between 1 and 9. - pbolt.range = you.strength - item_mass(item) / 10 + 3; - if (pbolt.range < 1) - pbolt.range = 1; - - if (pbolt.range > 9) - pbolt.range = 9; - - pbolt.rangeMax = pbolt.range; + max_range = range = std::max(you.strength - item_mass(item)/10 + 3, 1); } + range = std::min(range, LOS_RADIUS); + max_range = std::min(max_range, LOS_RADIUS); + pbolt.is_beam = false; pbolt.beam_source = 0; pbolt.can_see_invis = player_see_invis(); @@ -1912,6 +1905,9 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, pbolt.attitude = ATT_FRIENDLY; pbolt.is_tracer = true; + // For the tracer, use max_range. For the actual shot, use range. + pbolt.range = max_range; + // Don't do the tracing when using Portaled Projectile, or when confused. if (!teleport && !you.duration[DUR_CONF]) { @@ -1934,6 +1930,9 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, } } + // Use real range for firing. + pbolt.range = range; + // Now start real firing! origin_set_unknown(item); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 8a281b7dcf..84e1c9f75a 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3906,8 +3906,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) // Setup tracer. beem.name = "glob of lava"; beem.aux_source = "glob of lava"; - beem.range = 4; - beem.rangeMax = 13; + beem.range = 6; beem.damage = dice_def( 3, 10 ); beem.hit = 20; beem.colour = RED; @@ -3942,8 +3941,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) // Setup tracer. beem.name = "bolt of electricity"; beem.aux_source = "bolt of electricity"; - beem.range = 4; - beem.rangeMax = 13; + beem.range = 8; beem.damage = dice_def( 3, 6 ); beem.hit = 50; beem.colour = LIGHTCYAN; @@ -4096,8 +4094,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) // Set up the beam. beem.name = "volley of spikes"; beem.aux_source = "volley of spikes"; - beem.range = 9; - beem.rangeMax = 9; + beem.range = 6; beem.hit = 14; beem.damage = dice_def( 2, 10 ); beem.beam_source = monster_index(monster); @@ -4511,7 +4508,6 @@ static bool _handle_wand(monsters *monster, bolt &beem) beem.source = monster->pos(); beem.colour = theBeam.colour; beem.range = theBeam.range; - beem.rangeMax = theBeam.rangeMax; beem.damage = theBeam.damage; beem.ench_power = theBeam.ench_power; beem.hit = theBeam.hit; @@ -7232,8 +7228,8 @@ static void _setup_plant_spit(monsters *monster, bolt &pbolt) { pbolt.name = "acid"; pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); - pbolt.range = 9; - pbolt.rangeMax = 9; + // immobile plants get long-range spit... + pbolt.range = LOS_RADIUS; pbolt.colour = YELLOW; pbolt.flavour = BEAM_ACID; pbolt.beam_source = monster_index(monster); diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index bba8acf260..f2d7f833be 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -941,7 +941,6 @@ void setup_mons_cast(monsters *monster, bolt &pbolt, pbolt.colour = theBeam.colour; pbolt.range = theBeam.range; - pbolt.rangeMax = theBeam.rangeMax; pbolt.hit = theBeam.hit; pbolt.damage = theBeam.damage; @@ -1089,6 +1088,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) pbolt.aux_source = "blast of fiery breath"; pbolt.flavour = BEAM_FIRE; pbolt.colour = RED; + pbolt.range = 6; break; case MONS_ICE_DRAGON: @@ -1096,6 +1096,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) pbolt.aux_source = "blast of icy breath"; pbolt.flavour = BEAM_COLD; pbolt.colour = WHITE; + pbolt.range = 7; break; case MONS_RED_DRACONIAN: @@ -1103,6 +1104,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) pbolt.aux_source = "blast of searing breath"; pbolt.flavour = BEAM_FIRE; pbolt.colour = RED; + pbolt.range = 6; scaling = 65; break; @@ -1111,6 +1113,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) pbolt.aux_source = "blast of chilling breath"; pbolt.flavour = BEAM_COLD; pbolt.colour = WHITE; + pbolt.range = 7; scaling = 65; break; @@ -1119,6 +1122,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) pbolt.aux_source = "blast of draining breath"; pbolt.flavour = BEAM_NEG; pbolt.colour = DARKGREY; + pbolt.range = LOS_RADIUS; scaling = 65; break; @@ -1131,8 +1135,6 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) mprf( MSGCH_DIAGNOSTICS, "bolt name: '%s'", pbolt.name.c_str() ); #endif - pbolt.range = 4; - pbolt.rangeMax = 13; pbolt.damage = dice_def( 3, (monster->hit_dice * 2) ); pbolt.damage.size = scaling * pbolt.damage.size / 100; pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1166,8 +1168,8 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt) void setup_generic_throw(struct monsters *monster, struct bolt &pbolt) { - pbolt.range = 9; - pbolt.rangeMax = 9; + // FIXME we should use a sensible range here + pbolt.range = LOS_RADIUS; pbolt.beam_source = monster_index(monster); pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -1213,7 +1215,8 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used) if (mons_friendly(monster)) item.flags |= ISFLAG_DROPPED_BY_ALLY; - pbolt.range = 9; + // FIXME we should actually determine a sensible range here + pbolt.range = LOS_RADIUS; pbolt.beam_source = monster_index(monster); pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE); pbolt.colour = item.colour; @@ -1665,7 +1668,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) // Initialize to some bogus values so we can catch problems. beam.name = "****"; beam.colour = 1000; - beam.range = beam.rangeMax = 8; beam.hit = -1; beam.damage = dice_def( 1, 0 ); beam.ench_power = -1; @@ -1675,13 +1677,13 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.is_beam = false; beam.is_explosion = false; + beam.range = spell_range(spell_cast, power, true); + switch (spell_cast) { case SPELL_MAGIC_DART: beam.colour = LIGHTMAGENTA; // inv_colour [throw_2]; beam.name = "magic dart"; // inv_name [throw_2]); - beam.range = 6; - beam.rangeMax = 10; beam.damage = dice_def( 3, 4 + (power / 100) ); beam.hit = AUTOMATIC_HIT; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1693,8 +1695,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_THROW_FLAME: beam.colour = RED; beam.name = "puff of flame"; - beam.range = 6; - beam.rangeMax = 10; // should this be the same as magic missile? // No... magic missile is special in that it has a really @@ -1711,8 +1711,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_THROW_FROST: beam.colour = WHITE; beam.name = "puff of frost"; - beam.range = 6; - beam.rangeMax = 10; // should this be the same as magic missile? // see SPELL_FLAME -- bwr @@ -1729,16 +1727,12 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.name = "0"; beam.flavour = BEAM_DISPEL_UNDEAD; beam.thrower = KILL_MON_MISSILE; - beam.range = 7 + random2(8); - beam.rangeMax = 9; beam.damage = dice_def( 3, std::min(6 + power / 10, 40) ); beam.is_beam = true; break; case SPELL_PARALYSE: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_PARALYSIS; beam.thrower = KILL_MON_MISSILE; @@ -1747,8 +1741,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_SLOW: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_SLOW; beam.thrower = KILL_MON_MISSILE; @@ -1757,8 +1749,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_HASTE: // (self) beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_HASTE; beam.thrower = KILL_MON_MISSILE; @@ -1767,8 +1757,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BACKLIGHT: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_BACKLIGHT; beam.thrower = KILL_MON_MISSILE; @@ -1777,8 +1765,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_CONFUSE: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_CONFUSION; beam.thrower = KILL_MON_MISSILE; @@ -1787,8 +1773,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_SLEEP: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_SLEEP; beam.thrower = KILL_MON_MISSILE; @@ -1797,8 +1781,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_POLYMORPH_OTHER: beam.name = "0"; - beam.range = 6; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_POLYMORPH; beam.thrower = KILL_MON_MISSILE; @@ -1807,8 +1789,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_VENOM_BOLT: beam.name = "bolt of poison"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 6 + power / 13 ); beam.colour = LIGHTGREEN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1826,13 +1806,10 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.thrower = KILL_MON; beam.flavour = BEAM_POISON_ARROW; beam.hit = 20 + power / 25; - beam.range = beam.rangeMax = 8; break; case SPELL_BOLT_OF_MAGMA: beam.name = "bolt of magma"; - beam.range = 5; - beam.rangeMax = 13; beam.damage = dice_def( 3, 8 + power / 11 ); beam.colour = RED; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1844,8 +1821,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BOLT_OF_FIRE: beam.name = "bolt of fire"; - beam.range = 5; - beam.rangeMax = 13; beam.damage = dice_def( 3, 8 + power / 11 ); beam.colour = RED; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1857,8 +1832,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_ICE_BOLT: beam.name = "bolt of ice"; - beam.range = 5; - beam.rangeMax = 13; beam.damage = dice_def( 3, 8 + power / 11 ); beam.colour = WHITE; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1870,8 +1843,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BOLT_OF_COLD: beam.name = "bolt of cold"; - beam.range = 5; - beam.rangeMax = 13; beam.damage = dice_def( 3, 8 + power / 11 ); beam.colour = WHITE; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1883,8 +1854,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_FREEZING_CLOUD: beam.name = "freezing blast"; - beam.range = 5; - beam.rangeMax = 12; beam.damage = dice_def( 2, 9 + power / 11 ); beam.colour = WHITE; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1897,8 +1866,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_SHOCK: beam.name = "zap"; - beam.range = 8; - beam.rangeMax = 16; beam.damage = dice_def( 1, 8 + (power / 20) ); beam.colour = LIGHTCYAN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1910,8 +1877,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_LIGHTNING_BOLT: beam.name = "bolt of lightning"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 10 + power / 17 ); beam.colour = LIGHTCYAN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1923,8 +1888,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_INVISIBILITY: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_INVISIBILITY; beam.thrower = KILL_MON; @@ -1934,8 +1897,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_FIREBALL: beam.colour = RED; beam.name = "fireball"; - beam.range = 6; - beam.rangeMax = 10; beam.damage = dice_def( 3, 7 + power / 10 ); beam.hit = 40; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -1953,7 +1914,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_ICE_STORM: beam.name = "great blast of cold"; beam.colour = BLUE; - beam.range = 9 + random2(5); beam.damage = calc_dice( 10, 18 + power / 2 ); beam.hit = 20 + power / 10; // 50: 25 100: 30 beam.ench_power = power; // used for radius @@ -1982,8 +1942,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_LESSER_HEALING: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_HEALING; beam.thrower = KILL_MON; @@ -1993,8 +1951,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_TELEPORT_SELF: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_TELEPORT; // 6 is used by digging beam.thrower = KILL_MON; @@ -2003,8 +1959,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_TELEPORT_OTHER: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_TELEPORT; // 6 is used by digging beam.thrower = KILL_MON; @@ -2017,8 +1971,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_LEHUDIBS_CRYSTAL_SPEAR: // was splinters beam.name = "crystal spear"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 16 + power / 10 ); beam.colour = WHITE; beam.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -2030,8 +1982,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_DIG: beam.name = "0"; - beam.range = 3; - beam.rangeMax = 7 + random2(power) / 10; beam.type = 0; beam.flavour = BEAM_DIGGING; beam.thrower = KILL_MON; @@ -2040,8 +1990,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BOLT_OF_DRAINING: // negative energy beam.name = "bolt of negative energy"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 6 + power / 13 ); beam.colour = DARKGREY; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2054,8 +2002,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_ISKENDERUNS_MYSTIC_BLAST: // mystic blast beam.colour = LIGHTMAGENTA; beam.name = "orb of energy"; - beam.range = 6; - beam.rangeMax = 10; beam.damage = dice_def( 3, 7 + (power / 14) ); beam.hit = 20 + (power / 20); beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2067,8 +2013,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_STEAM_BALL: beam.colour = LIGHTGREY; beam.name = "ball of steam"; - beam.range = 6; - beam.rangeMax = 10; beam.damage = dice_def( 3, 7 + (power / 15) ); beam.hit = 20 + power / 20; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2079,8 +2023,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_PAIN: beam.name = "0"; - beam.range = 7; - beam.rangeMax = 14; beam.type = 0; beam.flavour = BEAM_PAIN; // pain beam.thrower = KILL_MON; @@ -2092,8 +2034,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_STICKY_FLAME: beam.colour = RED; beam.name = "sticky flame"; - beam.range = 6; - beam.rangeMax = 10; beam.damage = dice_def( 3, 3 + power / 50 ); beam.hit = 18 + power / 15; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2104,8 +2044,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_POISONOUS_CLOUD: // demon beam.name = "blast of poison"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 3 + power / 25 ); beam.colour = LIGHTGREEN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2119,8 +2057,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_ENERGY_BOLT: // eye of devastation beam.colour = YELLOW; beam.name = "bolt of energy"; - beam.range = 9; - beam.rangeMax = 23; beam.damage = dice_def( 3, 20 ); beam.hit = 15 + power / 30; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2132,8 +2068,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_STING: // sting beam.colour = GREEN; beam.name = "sting"; - beam.range = 8; - beam.rangeMax = 12; beam.damage = dice_def( 1, 6 + power / 25 ); beam.hit = 60; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2145,8 +2079,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BOLT_OF_IRON: beam.colour = LIGHTCYAN; beam.name = "iron bolt"; - beam.range = 4; - beam.rangeMax = 8; beam.damage = dice_def( 3, 8 + (power / 9) ); beam.hit = 20 + (power / 25); beam.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -2158,8 +2090,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_STONE_ARROW: beam.colour = LIGHTGREY; beam.name = "stone arrow"; - beam.range = 8; - beam.rangeMax = 12; beam.damage = dice_def( 3, 5 + (power / 10) ); beam.hit = 14 + power / 35; beam.type = dchar_glyph(DCHAR_FIRED_MISSILE); @@ -2171,8 +2101,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_POISON_SPLASH: beam.colour = GREEN; beam.name = "splash of poison"; - beam.range = 5; - beam.rangeMax = 10; beam.damage = dice_def( 1, 4 + power / 10 ); beam.hit = 16 + power / 20; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2183,8 +2111,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_DISINTEGRATE: beam.name = "0"; - beam.range = 7; - beam.rangeMax = 14; beam.type = 0; beam.flavour = BEAM_DISINTEGRATION; beam.thrower = KILL_MON; @@ -2196,8 +2122,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_MEPHITIC_CLOUD: // swamp drake beam.name = "foul vapour"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 2 + power / 25 ); beam.colour = GREEN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2210,7 +2134,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_MIASMA: // death drake beam.name = "foul vapour"; - beam.range = beam.rangeMax = 8; beam.damage = dice_def( 3, 5 + power / 24 ); beam.colour = DARKGREY; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2224,8 +2147,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_QUICKSILVER_BOLT: // Quicksilver dragon beam.colour = random_colour(); beam.name = "bolt of energy"; - beam.range = 9; - beam.rangeMax = 23; beam.damage = dice_def( 3, 25 ); beam.hit = 16 + power / 25; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2238,8 +2159,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.name = "hellfire"; beam.aux_source = "blast of hellfire"; beam.colour = RED; - beam.range = 4; - beam.rangeMax = 13; beam.damage = dice_def( 3, 25 ); beam.hit = 24; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2251,8 +2170,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_METAL_SPLINTERS: beam.name = "spray of metal splinters"; - beam.range = 7; - beam.rangeMax = 16; beam.damage = dice_def( 3, 20 + power / 20 ); beam.colour = CYAN; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -2264,8 +2181,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) case SPELL_BANISHMENT: beam.name = "0"; - beam.range = 5; - beam.rangeMax = 9; beam.type = 0; beam.flavour = BEAM_BANISH; beam.thrower = KILL_MON_MISSILE; @@ -2279,8 +2194,6 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.thrower = KILL_MON; beam.is_beam = true; beam.is_enchant = true; - beam.range = 8; - beam.rangeMax = 8; break; default: diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index fcbe4e7e99..0ebd200152 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -274,7 +274,6 @@ void cast_chain_lightning(int pow) beam.beam_source = MHITYOU; beam.thrower = KILL_YOU_MISSILE; beam.range = 8; - beam.rangeMax = 8; beam.hit = AUTOMATIC_HIT; beam.type = dchar_glyph(DCHAR_FIRED_ZAP); beam.flavour = BEAM_ELECTRICITY; @@ -550,7 +549,6 @@ bool stinking_cloud( int pow, bolt &beem ) beem.name = "ball of vapour"; beem.colour = GREEN; beem.range = 6; - beem.rangeMax = 6; beem.damage = dice_def( 1, 0 ); beem.hit = 20; beem.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -691,6 +689,7 @@ static int _healing_spell(int healed, const coord_def where = coord_def(0,0)) spd.isValid = spell_direction(spd, beam, DIR_TARGET, you.religion == GOD_ELYVILON ? TARG_ANY : TARG_FRIEND, + LOS_RADIUS, true, true, true, "Heal whom?"); } else diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index d2a9210cc8..002554c889 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1266,21 +1266,13 @@ bool backlight_monsters(coord_def where, int pow, int garbage) return (true); } -bool cast_evaporate(int pow, bolt& beem, int potion) +bool cast_evaporate(int pow, bolt& beem, int pot_idx) { - if (potion == -1) - return (false); - else if (you.inv[potion].base_type != OBJ_POTIONS) - { - mpr( "This spell works only on potions!" ); - canned_msg(MSG_SPELL_FIZZLES); - return (false); - } + ASSERT(you.inv[pot_idx].base_type == OBJ_POTIONS); + item_def& potion = you.inv[pot_idx]; beem.name = "potion"; - beem.colour = you.inv[potion].colour; - beem.range = 9; - beem.rangeMax = 9; + beem.colour = potion.colour; beem.type = dchar_glyph(DCHAR_FIRED_FLASK); beem.beam_source = MHITYOU; beem.thrower = KILL_YOU_MISSILE; @@ -1294,7 +1286,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) beem.flavour = BEAM_POTION_STINKING_CLOUD; beam_type tracer_flavour = BEAM_MMISSILE; - switch (you.inv[potion].sub_type) + switch (potion.sub_type) { case POT_STRONG_POISON: beem.flavour = BEAM_POTION_POISON; @@ -1341,7 +1333,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) case POT_BERSERK_RAGE: beem.effect_known = false; beem.flavour = (coinflip() ? BEAM_POTION_FIRE : BEAM_POTION_STEAM); - if (you.inv[potion].sub_type == POT_BERSERK_RAGE) + if (potion.sub_type == POT_BERSERK_RAGE) tracer_flavour = BEAM_FIRE; else tracer_flavour = BEAM_RANDOM; @@ -1412,13 +1404,13 @@ bool cast_evaporate(int pow, bolt& beem, int potion) fire_beam(beem); // Use up a potion. - if (is_blood_potion(you.inv[potion])) - remove_oldest_blood_potion(you.inv[potion]); + if (is_blood_potion(potion)) + remove_oldest_blood_potion(potion); - dec_inv_item_quantity( potion, 1 ); + dec_inv_item_quantity( pot_idx, 1 ); return (true); -} // end cast_evaporate() +} // The intent of this spell isn't to produce helpful potions // for drinking, but rather to provide ammo for the Evaporate diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 8dde8f6add..c72b4cffe2 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -944,6 +944,27 @@ beam_type _spell_to_beam_type(spell_type spell) return BEAM_NONE; } +int _setup_evaporate_cast() +{ + int rc = prompt_invent_item("Throw which potion?", MT_INVLIST, OBJ_POTIONS); + + if (prompt_failed(rc)) + { + rc = -1; + } + else if (you.inv[rc].base_type != OBJ_POTIONS) + { + mpr("This spell works only on potions!"); + rc = -1; + } + else + { + mprf(MSGCH_PROMPT, "Where do you want to aim %s?", + you.inv[rc].name(DESC_NOCAP_YOUR).c_str()); + } + return rc; +} + // Returns SPRET_SUCCESS if spell is successfully cast for purposes of // exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled // the casting. @@ -986,19 +1007,9 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) const char *prompt = get_spell_target_prompt(spell); if (spell == SPELL_EVAPORATE) { - potion = prompt_invent_item("Throw which potion?", - MT_INVLIST, OBJ_POTIONS); - - if (prompt_failed(potion)) - return (SPRET_ABORT); - - if (you.inv[potion].base_type != OBJ_POTIONS) - { - mpr("This spell works only on potions!"); + potion = _setup_evaporate_cast(); + if (potion == -1) return (SPRET_ABORT); - } - mprf(MSGCH_PROMPT, "Where do you want to aim %s?", - you.inv[potion].name(DESC_NOCAP_YOUR).c_str()); } else if (dir == DIR_DIR) mpr(prompt ? prompt : "Which direction?", MSGCH_PROMPT); @@ -1008,13 +1019,17 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) const bool dont_cancel_me = testbits(flags, SPFLAG_AREA); - if (!spell_direction(spd, beam, dir, targ, needs_path, true, - dont_cancel_me, prompt, + const int range = spell_range(spell, powc, false); + + if (!spell_direction(spd, beam, dir, targ, range, + needs_path, true, dont_cancel_me, prompt, testbits(flags, SPFLAG_NOT_SELF))) { return (SPRET_ABORT); } + beam.range = spell_range(spell, powc, true); + if (testbits(flags, SPFLAG_NOT_SELF) && spd.isMe) { if (spell == SPELL_TELEPORT_OTHER || spell == SPELL_HEAL_OTHER diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h index 3c5de95923..e5d629e789 100644 --- a/crawl-ref/source/spl-data.h +++ b/crawl-ref/source/spl-data.h @@ -135,6 +135,7 @@ SPFLAG_NONE, 6, 0, + -1, -1, NULL, false, true @@ -146,6 +147,7 @@ SPFLAG_ESCAPE, 5, 0, + -1, -1, NULL, false, true @@ -157,6 +159,7 @@ SPFLAG_AREA, 5, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -168,6 +171,7 @@ SPFLAG_NONE, 1, 0, + LOS_RADIUS, LOS_RADIUS, NULL, false, true @@ -179,6 +183,7 @@ SPFLAG_NONE, 5, 0, + -1, -1, NULL, false, true @@ -190,6 +195,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -201,6 +207,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 6, 6, NULL, true, false @@ -212,6 +219,7 @@ SPFLAG_NONE, 4, 0, + -1, -1, NULL, false, false @@ -223,6 +231,7 @@ SPFLAG_NONE, 1, 1000, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -234,6 +243,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 1, 25, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -245,6 +255,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 3, 100, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -256,6 +267,7 @@ SPFLAG_NONE, 7, 0, + -1, -1, NULL, false, true @@ -267,6 +279,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + 5, 5, NULL, true, false @@ -278,6 +291,7 @@ SPFLAG_NONE, 3, 100, + 4, 4, NULL, false, false @@ -289,6 +303,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF | SPFLAG_NEUTRAL, 4, 200, + -1, -1, NULL, false, true @@ -300,6 +315,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 6, 6, NULL, true, false @@ -311,6 +327,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 7, 7, NULL, true, false @@ -322,6 +339,7 @@ SPFLAG_DIR_OR_TARGET, 5, 200, + 5, 12, NULL, true, false @@ -333,6 +351,7 @@ SPFLAG_DIR_OR_TARGET, 5, 200, + 5, 5, NULL, true, false @@ -344,6 +363,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 5, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -355,6 +375,7 @@ SPFLAG_DIR_OR_TARGET, 3, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -368,6 +389,7 @@ // and Swiftness is level 2 (and gives a similar effect). It's also // not that much better than Invisibility. -- bwr 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, true @@ -379,6 +401,7 @@ SPFLAG_DIR_OR_TARGET, 4, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -390,6 +413,7 @@ SPFLAG_DIR_OR_TARGET, 4, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -401,6 +425,7 @@ SPFLAG_DIR_OR_TARGET, 3, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -412,6 +437,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_HELPFUL, 6, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, true @@ -423,6 +449,7 @@ SPFLAG_DIR_OR_TARGET, 2, 50, + 7, 7, NULL, true, false @@ -434,6 +461,7 @@ SPFLAG_DIR_OR_TARGET, 2, 50, + 8, 8, NULL, true, false @@ -445,6 +473,7 @@ SPFLAG_ESCAPE, 7, 0, + -1, -1, NULL, false, true @@ -456,6 +485,7 @@ SPFLAG_GRID | SPFLAG_AREA, 7, 200, + 6, 6, "Where do you want to put it?", true, false @@ -467,6 +497,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_AREA, 3, 200, + 8, 8, NULL, true, false @@ -478,6 +509,7 @@ SPFLAG_AREA, 8, 200, + -1, -1, NULL, false, false @@ -489,6 +521,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 2, 0, + -1, -1, NULL, false, true @@ -500,6 +533,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 2, 0, + -1, -1, NULL, false, true @@ -511,6 +545,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 2, 0, + -1, -1, NULL, false, true @@ -522,6 +557,7 @@ SPFLAG_DIR_OR_TARGET, 5, 200, + 6, 6, NULL, true, false @@ -533,6 +569,7 @@ SPFLAG_AREA, 4, 0, + -1, -1, NULL, true, false @@ -544,6 +581,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF | SPFLAG_ESCAPE, 4, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -555,6 +593,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 2, 0, + LOS_RADIUS, LOS_RADIUS, NULL, false, true @@ -566,6 +605,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 6, 0, + LOS_RADIUS, LOS_RADIUS, NULL, false, true @@ -577,6 +617,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 3, 200, + -1, -1, NULL, false, true @@ -588,6 +629,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 5, 0, + -1, -1, NULL, false, true @@ -599,6 +641,7 @@ SPFLAG_NONE, 8, 200, + -1, -1, NULL, false, false @@ -610,6 +653,7 @@ SPFLAG_NONE, 4, 0, + -1, -1, NULL, false, true @@ -621,6 +665,7 @@ SPFLAG_AREA, 6, 200, + -1, -1, NULL, false, false @@ -632,6 +677,7 @@ SPFLAG_TARGET | SPFLAG_NOT_SELF, 4, 200, + LOS_RADIUS, LOS_RADIUS, "Smite whom?", false, false @@ -643,6 +689,7 @@ SPFLAG_AREA, 3, 0, + -1, -1, NULL, false, false @@ -654,6 +701,7 @@ SPFLAG_AREA, 7, 0, + -1, -1, NULL, false, false @@ -665,6 +713,7 @@ SPFLAG_NONE, 3, 0, + -1, -1, NULL, false, true @@ -676,6 +725,7 @@ SPFLAG_NONE, 1, 80, + -1, -1, NULL, false, false @@ -687,6 +737,7 @@ SPFLAG_AREA | SPFLAG_NEUTRAL, 3, 200, + -1, -1, NULL, false, false @@ -698,6 +749,7 @@ SPFLAG_NONE, 4, 200, + -1, -1, NULL, false, false @@ -709,6 +761,7 @@ SPFLAG_NONE, 2, 150, + -1, -1, NULL, false, true @@ -720,6 +773,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 6, 6, NULL, true, false @@ -731,6 +785,7 @@ SPFLAG_DIR_OR_TARGET, 8, 200, + 4, 4, NULL, true, false @@ -742,6 +797,7 @@ SPFLAG_DIR_OR_TARGET, 3, 1000, + 7, 7, NULL, true, false @@ -753,6 +809,7 @@ SPFLAG_GRID | SPFLAG_AREA, 6, 200, + 6, 6, "Where do you want to put it?", true, false @@ -764,6 +821,7 @@ SPFLAG_GRID | SPFLAG_AREA, 9, 200, + 6, 6, "Where?", true, false @@ -775,6 +833,7 @@ SPFLAG_MAPPING, 2, 50, + -1, -1, NULL, false, true @@ -786,6 +845,7 @@ SPFLAG_ESCAPE, 2, 0, + -1, -1, NULL, false, true @@ -799,6 +859,7 @@ SPFLAG_DIR_OR_TARGET, 4, 100, + 5, 5, NULL, true, false @@ -810,6 +871,7 @@ SPFLAG_NONE, 6, 200, + -1, -1, NULL, false, false @@ -821,6 +883,7 @@ SPFLAG_UNHOLY, 8, 200, + -1, -1, NULL, false, false @@ -831,7 +894,8 @@ SPTYP_ENCHANTMENT, SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 4, - 200, + 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -843,6 +907,7 @@ SPFLAG_MAPPING, 4, 45, + -1, -1, NULL, false, true @@ -854,6 +919,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_HELPFUL | SPFLAG_NOT_SELF, 3, 100, + LOS_RADIUS, LOS_RADIUS, NULL, true, true @@ -865,6 +931,7 @@ SPFLAG_AREA | SPFLAG_NEUTRAL, 4, 0, + -1, -1, NULL, false, true @@ -876,6 +943,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + 6, 6, NULL, true, false @@ -887,6 +955,7 @@ SPFLAG_NONE, 5, 200, + -1, -1, NULL, false, true @@ -898,6 +967,7 @@ SPFLAG_NONE, 6, 200, + -1, -1, NULL, true }, @@ -908,6 +978,7 @@ SPFLAG_NONE, 1, 0, + -1, -1, NULL, false, true @@ -919,6 +990,7 @@ SPFLAG_DIR | SPFLAG_NOT_SELF, 3, 200, + 1, 1, NULL, false, false @@ -930,6 +1002,7 @@ SPFLAG_NONE, 7, 200, + -1, -1, NULL, false, false @@ -941,6 +1014,7 @@ SPFLAG_MAPPING, 2, 50, + -1, -1, NULL, false, true @@ -952,6 +1026,7 @@ SPFLAG_NONE, 5, 200, + -1, -1, NULL, false, true @@ -963,6 +1038,7 @@ SPFLAG_DIR | SPFLAG_NOT_SELF, 1, 25, + 1, 1, NULL, false, false @@ -974,6 +1050,7 @@ SPFLAG_DIR | SPFLAG_NOT_SELF, 1, 25, + 1, 1, NULL, false, false @@ -985,6 +1062,7 @@ SPFLAG_NONE, 4, 200, + -1, -1, NULL, false, false @@ -996,6 +1074,7 @@ SPFLAG_AREA, 5, 200, + -1, -1, NULL, true, false @@ -1007,6 +1086,7 @@ SPFLAG_DIR_OR_TARGET, 4, 100, + 5, 5, NULL, true, false @@ -1018,6 +1098,7 @@ SPFLAG_NONE, 5, 200, + -1, -1, NULL, false, false @@ -1029,6 +1110,7 @@ SPFLAG_NONE, 3, 200, + -1, -1, NULL, false, false @@ -1040,6 +1122,7 @@ SPFLAG_UNHOLY, 3, 200, + -1, -1, NULL, false, false @@ -1051,6 +1134,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, false @@ -1062,6 +1146,7 @@ SPFLAG_NONE, 3, 0, + -1, -1, NULL, false, false @@ -1073,6 +1158,7 @@ SPFLAG_DIR_OR_TARGET, 4, 100, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -1084,6 +1170,7 @@ SPFLAG_NONE, 7, 200, + -1, -1, NULL, false, false @@ -1095,6 +1182,7 @@ SPFLAG_NONE, 4, 200, + -1, -1, NULL, false, false @@ -1106,6 +1194,7 @@ SPFLAG_DIR_OR_TARGET, 6, // why is this the only holy spell with a secondary? {dlb} 200, + 8, 8, NULL, true, false @@ -1118,6 +1207,7 @@ SPFLAG_DIR_OR_TARGET, 8, 200, + 6, 6, NULL, true, false @@ -1129,6 +1219,7 @@ SPFLAG_NONE, 7, 200, + -1, -1, NULL, false, false @@ -1140,6 +1231,7 @@ SPFLAG_NONE, 8, 200, + -1, -1, NULL, false, false @@ -1151,6 +1243,7 @@ SPFLAG_AREA | SPFLAG_NEUTRAL, 4, 200, + -1, -1, NULL, false, false @@ -1162,6 +1255,7 @@ SPFLAG_NONE, 1, 50, + -1, -1, NULL, false, true @@ -1173,6 +1267,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 7, 7, NULL, true, false @@ -1184,6 +1279,7 @@ SPFLAG_NONE, 5, 200, + -1, -1, NULL, false, true @@ -1195,6 +1291,7 @@ SPFLAG_NONE, 3, 200, + -1, -1, NULL, false, true @@ -1206,6 +1303,7 @@ SPFLAG_DIR_OR_TARGET, 3, 200, + 6, 6, NULL, true, false @@ -1217,6 +1315,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_UNHOLY, 4, 200, + -1, -1, NULL, true, false @@ -1228,6 +1327,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 5, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -1239,6 +1339,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + 7, 7, NULL, true, false @@ -1250,6 +1351,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1261,6 +1363,7 @@ SPFLAG_NONE, 3, 200, + -1, -1, NULL, false, false @@ -1272,6 +1375,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_UNHOLY, 9, 200, + 7, 7, NULL, true, false @@ -1283,6 +1387,7 @@ SPFLAG_UNHOLY, 5, 200, + -1, -1, NULL, false, false @@ -1294,6 +1399,7 @@ SPFLAG_UNHOLY, 6, 200, + -1, -1, NULL, false, false @@ -1305,6 +1411,7 @@ SPFLAG_UNHOLY, 7, 200, + -1, -1, NULL, false, false @@ -1316,6 +1423,7 @@ SPFLAG_AREA | SPFLAG_NEUTRAL, 2, 0, + -1, -1, NULL, false, false @@ -1327,6 +1435,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1338,6 +1447,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1349,6 +1459,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1360,6 +1471,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1371,6 +1483,7 @@ SPFLAG_DIR | SPFLAG_NOT_SELF, 1, 25, + 1, 1, NULL, false, false @@ -1382,6 +1495,7 @@ SPFLAG_DIR_OR_TARGET, 6, 200, + 5, 5, NULL, true, false @@ -1393,6 +1507,7 @@ SPFLAG_DIR_OR_TARGET, 3, 50, + 5, 5, NULL, true, false @@ -1404,6 +1519,7 @@ SPFLAG_NONE, 7, 0, + -1, -1, NULL, false, false @@ -1416,6 +1532,7 @@ SPFLAG_NONE, 6, 200, + -1, -1, NULL, false, true @@ -1427,6 +1544,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + 8, 8, NULL, true, false @@ -1438,6 +1556,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, true @@ -1449,6 +1568,7 @@ SPFLAG_NONE, 4, 200, + -1, -1, NULL, false, true @@ -1460,6 +1580,7 @@ SPFLAG_NONE, 4, 200, + -1, -1, NULL, false, true @@ -1471,6 +1592,7 @@ SPFLAG_DIR_OR_TARGET, 7, 200, + 7, 12, NULL, true, false @@ -1482,6 +1604,7 @@ SPFLAG_MAPPING, 2, 60, // not 50, note the fuzz + -1, -1, NULL, false, false @@ -1493,6 +1616,7 @@ SPFLAG_RECOVERY | SPFLAG_HELPFUL, 2, 200, + -1, -1, NULL, false, true @@ -1504,6 +1628,7 @@ SPFLAG_HELPFUL, 4, 200, + -1, -1, NULL, false, true @@ -1515,6 +1640,7 @@ SPFLAG_HELPFUL, 4, 0, + -1, -1, NULL, false, true @@ -1526,6 +1652,7 @@ SPFLAG_HELPFUL, 2, 0, + -1, -1, NULL, false, true @@ -1537,6 +1664,7 @@ SPFLAG_HELPFUL, 4, 200, + -1, -1, NULL, false, true @@ -1548,6 +1676,7 @@ SPFLAG_NONE, 2, 0, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -1559,6 +1688,7 @@ SPFLAG_NONE, 7, 0, + -1, -1, NULL, false, false @@ -1570,6 +1700,7 @@ SPFLAG_DIR_OR_TARGET, 7, 100, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -1581,6 +1712,7 @@ SPFLAG_NONE, 3, 0, + -1, -1, NULL, false, true @@ -1592,6 +1724,7 @@ SPFLAG_ESCAPE, 7, 0, + -1, -1, NULL, false, true @@ -1603,6 +1736,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 5, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -1614,6 +1748,7 @@ SPFLAG_HELPFUL, 3, 200, + -1, -1, NULL, false, true @@ -1625,6 +1760,7 @@ SPFLAG_DIR_OR_TARGET, 1, 25, + 7, 7, NULL, false, false @@ -1636,6 +1772,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 6, 200, + 6, 6, NULL, true, false @@ -1647,6 +1784,7 @@ SPFLAG_HELPFUL, 5, // only removes weapon, so I raised this from 4 -- bwr 200, + -1, -1, NULL, false, true @@ -1658,6 +1796,7 @@ SPFLAG_HELPFUL, 6, 200, + -1, -1, NULL, false, true @@ -1669,6 +1808,7 @@ SPFLAG_HELPFUL, 4, // doesn't allow for equipment, so I lowered this from 5 -- bwr 200, + -1, -1, NULL, false, true @@ -1680,6 +1820,7 @@ SPFLAG_HELPFUL, 8, 200, + -1, -1, NULL, false, true @@ -1691,6 +1832,7 @@ SPFLAG_HELPFUL, 8, 200, + -1, -1, NULL, false, true @@ -1702,6 +1844,7 @@ SPFLAG_HELPFUL, 9, 200, + -1, -1, NULL, false, true @@ -1713,6 +1856,7 @@ SPFLAG_AREA, 6, 0, + -1, -1, NULL, false, false @@ -1724,6 +1868,7 @@ SPFLAG_HELPFUL, 6, 200, + -1, -1, NULL, false, true @@ -1735,8 +1880,10 @@ SPFLAG_DIR_OR_TARGET, 7, 200, + 5, 5, NULL, - true + true, + false }, { @@ -1745,8 +1892,10 @@ SPFLAG_DIR_OR_TARGET, 4, 100, + 6, 6, NULL, - true + true, + false }, { @@ -1755,6 +1904,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_AREA, 9, 200, + 6, 6, NULL, true, false @@ -1766,6 +1916,7 @@ SPFLAG_DIR | SPFLAG_NOT_SELF, 1, 25, + 1, 1, NULL, false, false @@ -1777,6 +1928,7 @@ SPFLAG_TARGET | SPFLAG_NOT_SELF, 4, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -1788,6 +1940,7 @@ SPFLAG_UNHOLY, 5, 0, + -1, -1, NULL, false, false @@ -1799,6 +1952,7 @@ SPFLAG_NONE, 1, 200, + -1, -1, NULL, false, false @@ -1810,6 +1964,7 @@ SPFLAG_HELPFUL, 2, 200, + -1, -1, NULL, false, true @@ -1821,6 +1976,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 1, 25, + 1, 2, NULL, false, false @@ -1832,6 +1988,7 @@ SPFLAG_ESCAPE, 3, 200, + -1, -1, NULL, false, true @@ -1843,6 +2000,7 @@ SPFLAG_AREA, 6, 200, + -1, -1, NULL, false, false @@ -1854,6 +2012,7 @@ SPFLAG_NONE, 2, 200, + -1, -1, NULL, false, false @@ -1865,6 +2024,7 @@ SPFLAG_NONE, 3, 200, + -1, -1, NULL, false, false @@ -1876,6 +2036,7 @@ SPFLAG_NONE, 9, 200, + -1, -1, NULL, false, false @@ -1887,6 +2048,7 @@ SPFLAG_AREA, 5, 200, + -1, -1, NULL, false, false @@ -1898,6 +2060,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 2, 56, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -1909,6 +2072,7 @@ SPFLAG_AREA, 7, 200, + -1, -1, NULL, false, false @@ -1920,6 +2084,7 @@ SPFLAG_NONE, 1, 0, + -1, -1, NULL, false, true @@ -1931,6 +2096,7 @@ SPFLAG_NONE, 1, 200, + -1, -1, NULL, false, true @@ -1942,6 +2108,7 @@ SPFLAG_HELPFUL, 4, 200, + -1, -1, NULL, false, true @@ -1953,6 +2120,7 @@ SPFLAG_HELPFUL, 5, 200, + -1, -1, NULL, false, true @@ -1964,6 +2132,7 @@ SPFLAG_NONE, 1, 200, + -1, -1, NULL, false, false @@ -1975,6 +2144,7 @@ SPFLAG_HELPFUL, 7, // this is high for a reason - Warp brands are very powerful. 0, + -1, -1, NULL, false, true @@ -1986,6 +2156,7 @@ SPFLAG_AREA, 5, 200, + -1, -1, NULL, false, false @@ -1997,6 +2168,7 @@ SPFLAG_AREA, 9, 200, + -1, -1, NULL, false, false @@ -2008,6 +2180,7 @@ SPFLAG_AREA | SPFLAG_ESCAPE, 7, 200, + -1, -1, NULL, false, false @@ -2019,6 +2192,7 @@ SPFLAG_AREA, 4, 200, + -1, -1, NULL, false, false @@ -2030,6 +2204,7 @@ SPFLAG_DIR, 1, 100, + 1, 1, NULL, false, false @@ -2041,6 +2216,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 1, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -2052,6 +2228,7 @@ SPFLAG_NONE, 4, 0, + -1, -1, NULL, false, false @@ -2063,6 +2240,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_AREA, 2, // XXX: level 2 or 3, what should it be now? -- bwr 200, + 6, 6, NULL, true, false @@ -2074,6 +2252,7 @@ SPFLAG_NONE, 4, 0, + -1, -1, NULL, false, false @@ -2085,6 +2264,7 @@ SPFLAG_GRID, 5, 200, + LOS_RADIUS, LOS_RADIUS, "Fragment what (e.g. a wall or monster)?", false, false @@ -2096,6 +2276,7 @@ SPFLAG_HELPFUL, 9, 200, + -1, -1, NULL, false, true @@ -2107,6 +2288,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF, 1, 50, + 1, 2, NULL, true, false @@ -2118,6 +2300,7 @@ SPFLAG_AREA, 5, 200, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -2129,6 +2312,7 @@ SPFLAG_HELPFUL, 2, 200, + -1, -1, NULL, false, true @@ -2140,6 +2324,7 @@ SPFLAG_HELPFUL, 4, 200, + -1, -1, NULL, false, true @@ -2151,6 +2336,7 @@ SPFLAG_ESCAPE, 3, 100, + -1, -1, NULL, false, true @@ -2162,6 +2348,7 @@ SPFLAG_HELPFUL, 2, 200, + -1, -1, NULL, false, true @@ -2173,6 +2360,7 @@ SPFLAG_NONE, 6, 200, + -1, -1, NULL, false, false @@ -2184,6 +2372,7 @@ SPFLAG_NONE, 7, 200, + -1, -1, NULL, false, false @@ -2195,6 +2384,7 @@ SPFLAG_AREA, 8, 200, + -1, -1, NULL, false, false @@ -2206,6 +2396,7 @@ SPFLAG_HELPFUL, 5, // fairly high level - potentially one of the best brands 200, + -1, -1, NULL, false, false @@ -2217,6 +2408,7 @@ SPFLAG_TARGET, 2, 50, + 4, 8, NULL, false, false @@ -2228,6 +2420,7 @@ SPFLAG_NONE, 5, 200, + -1, -1, NULL, false, false @@ -2239,6 +2432,7 @@ SPFLAG_DIR_OR_TARGET | SPFLAG_UNHOLY, 9, 200, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -2250,6 +2444,7 @@ SPFLAG_UNHOLY, 3, 0, + -1, -1, NULL, false, false @@ -2261,6 +2456,7 @@ SPFLAG_UNHOLY | SPFLAG_TARGET, 3, 0, + LOS_RADIUS, LOS_RADIUS, NULL, false, false @@ -2272,6 +2468,7 @@ SPFLAG_UNHOLY, 3, 0, + -1, -1, NULL, false, false @@ -2283,6 +2480,7 @@ SPFLAG_DIR_OR_TARGET, 4, 0, + 7, 7, NULL, true, false @@ -2294,6 +2492,7 @@ SPFLAG_UNHOLY, 4, 0, + -1, -1, NULL, false, false @@ -2305,6 +2504,7 @@ SPFLAG_UNHOLY, 4, 0, + -1, -1, NULL, false, false @@ -2316,6 +2516,7 @@ SPFLAG_DIR_OR_TARGET, 4, 0, + 8, 8, NULL, true, false @@ -2327,6 +2528,7 @@ SPFLAG_DIR_OR_TARGET, 2, 0, + 7, 7, NULL, true, false @@ -2338,6 +2540,7 @@ SPFLAG_NONE, 7, 0, + -1, -1, NULL, false, false, @@ -2349,6 +2552,7 @@ SPFLAG_NONE, 1, 0, + -1, -1, NULL, false, false @@ -2360,6 +2564,7 @@ SPFLAG_DIR_OR_TARGET, 5, 0, + 8, 8, NULL, true, false @@ -2371,6 +2576,7 @@ SPFLAG_DIR_OR_TARGET, 5, 0, + 5, 5, NULL, true, false @@ -2382,6 +2588,7 @@ SPFLAG_DIR_OR_TARGET, 6, 0, + 6, 6, NULL, true, false @@ -2393,6 +2600,7 @@ SPFLAG_NONE, 6, 0, + -1, -1, NULL, false, false @@ -2404,6 +2612,7 @@ SPFLAG_ESCAPE | SPFLAG_DIR_OR_TARGET, 2, 0, + LOS_RADIUS, LOS_RADIUS, NULL, true, false @@ -2415,6 +2624,7 @@ SPFLAG_NONE, 4, 0, + -1, -1, NULL, false, false @@ -2426,6 +2636,7 @@ 0, 0, 0, + -1, -1, NULL, false, false diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 67ec2c373d..3cfed59490 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -672,6 +672,7 @@ void apply_area_cloud( cloud_func func, const coord_def& where, // Return false if the user canceled, true otherwise. bool spell_direction( dist &spelld, bolt &pbolt, targeting_type restrict, targ_mode_type mode, + int range, bool needs_path, bool may_target_monster, bool may_target_self, const char *prompt, bool cancel_at_self ) @@ -679,7 +680,7 @@ bool spell_direction( dist &spelld, bolt &pbolt, if (restrict != DIR_DIR) message_current_target(); - direction( spelld, restrict, mode, -1, false, needs_path, + direction( spelld, restrict, mode, range, false, needs_path, may_target_monster, may_target_self, prompt, NULL, cancel_at_self ); @@ -871,3 +872,21 @@ int spell_power_cap(spell_type spell) { return (_seekspell(spell)->power_cap); } + +int spell_range(spell_type spell, int pow, bool real_cast) +{ + const int minrange = _seekspell(spell)->min_range; + const int maxrange = _seekspell(spell)->max_range; + ASSERT(maxrange >= minrange); + + if (minrange == maxrange) + return minrange; + + const int powercap = spell_power_cap(spell); + + if (powercap <= pow) + return maxrange; + + // Round appropriately. + return ((pow*(maxrange - minrange) + powercap/2) / powercap + minrange); +} diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 16c1bac4d0..76f3dba729 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -50,6 +50,11 @@ struct spell_desc unsigned int flags; // bitfield unsigned int level; int power_cap; + + // At power 0, you get min_range. At power power_cap, you get max_range. + int min_range; + int max_range; + const char *target_prompt; @@ -78,6 +83,7 @@ int spell_hunger(spell_type which_spell); int spell_mana(spell_type which_spell); int spell_difficulty(spell_type which_spell); int spell_power_cap(spell_type spell); +int spell_range(spell_type spell, int pow, bool real_cast); const char *get_spell_target_prompt( spell_type which_spell ); @@ -122,6 +128,7 @@ int apply_area_within_radius(cell_func cf, 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, 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