v3.0.1: fixed shocking enchant missing valid targets in some cases
This commit is contained in:
@@ -83,21 +83,28 @@ public class Shocking extends Weapon.Enchantment {
|
||||
private ArrayList<Lightning.Arc> arcs = new ArrayList<>();
|
||||
|
||||
public static void arc( Char attacker, Char defender, int dist, ArrayList<Char> affected, ArrayList<Lightning.Arc> arcs ) {
|
||||
|
||||
|
||||
affected.add(defender);
|
||||
|
||||
|
||||
defender.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
|
||||
defender.sprite.flash();
|
||||
|
||||
|
||||
ArrayList<Char> hitThisArc = new ArrayList<>();
|
||||
PathFinder.buildDistanceMap( defender.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 != null && n != attacker && !affected.contains(n)) {
|
||||
arcs.add(new Lightning.Arc(defender.sprite.center(), n.sprite.center()));
|
||||
arc(attacker, n, (Dungeon.level.water[n.pos] && !n.flying) ? 2 : 1, affected, arcs);
|
||||
hitThisArc.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
affected.addAll(hitThisArc);
|
||||
for (Char hit : hitThisArc){
|
||||
arcs.add(new Lightning.Arc(defender.sprite.center(), hit.sprite.center()));
|
||||
arc(attacker, hit, (Dungeon.level.water[hit.pos] && !hit.flying) ? 2 : 1, affected, arcs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user