diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index 0379a52e2..fd8ae8a5f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -52,7 +52,7 @@ public class WandOfLightning extends DamageWand { private ArrayList<Char> affected = new ArrayList<>(); - ArrayList<Lightning.Arc> arcs = new ArrayList<>(); + private ArrayList<Lightning.Arc> arcs = new ArrayList<>(); public int min(int lvl){ return 5+lvl; @@ -70,9 +70,6 @@ public class WandOfLightning extends DamageWand { //if the main target is in water, all affected take full damage if (Dungeon.level.water[bolt.collisionPos]) multipler = 1f; - int min = 5 + level(); - int max = 10 + 5*level(); - for (Char ch : affected){ processSoulMark(ch, chargesPerCast()); ch.damage(Math.round(damageRoll() * multipler), this); @@ -98,24 +95,26 @@ public class WandOfLightning extends DamageWand { affected.add( ch ); - int dist; - if (Dungeon.level.water[ch.pos] && !ch.flying) - dist = 2; - else - dist = 1; + int dist = (Dungeon.level.water[ch.pos] && !ch.flying) ? 2 : 1; - PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist ); - for (int i = 0; i < PathFinder.distance.length; i++) { - if (PathFinder.distance[i] < Integer.MAX_VALUE){ - Char n = Actor.findChar( i ); - if (n == Dungeon.hero && PathFinder.distance[i] > 1) - //the hero is only zapped if they are adjacent - continue; - else if (n != null && !affected.contains( n )) { - arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center())); - arc(n); - } + ArrayList<Char> hitThisArc = new ArrayList<>(); + PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE){ + Char n = Actor.findChar( i ); + if (n == Dungeon.hero && PathFinder.distance[i] > 1) + //the hero is only zapped if they are adjacent + continue; + else if (n != null && !affected.contains( n )) { + hitThisArc.add(n); } + } + } + + affected.addAll(hitThisArc); + for (Char hit : hitThisArc){ + arcs.add(new Lightning.Arc(ch.sprite.center(), hit.sprite.center())); + arc(hit); } }