v0.7.5e: fixed wand of lightning not targeting as many things as it should

This commit is contained in:
Evan Debenham 2019-10-24 12:47:09 -04:00
parent 8bc82fd9ca
commit dd34a07759

View File

@ -52,7 +52,7 @@ public class WandOfLightning extends DamageWand {
private ArrayList<Char> affected = new ArrayList<>(); private ArrayList<Char> affected = new ArrayList<>();
ArrayList<Lightning.Arc> arcs = new ArrayList<>(); private ArrayList<Lightning.Arc> arcs = new ArrayList<>();
public int min(int lvl){ public int min(int lvl){
return 5+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 the main target is in water, all affected take full damage
if (Dungeon.level.water[bolt.collisionPos]) multipler = 1f; if (Dungeon.level.water[bolt.collisionPos]) multipler = 1f;
int min = 5 + level();
int max = 10 + 5*level();
for (Char ch : affected){ for (Char ch : affected){
processSoulMark(ch, chargesPerCast()); processSoulMark(ch, chargesPerCast());
ch.damage(Math.round(damageRoll() * multipler), this); ch.damage(Math.round(damageRoll() * multipler), this);
@ -98,12 +95,9 @@ public class WandOfLightning extends DamageWand {
affected.add( ch ); affected.add( ch );
int dist; int dist = (Dungeon.level.water[ch.pos] && !ch.flying) ? 2 : 1;
if (Dungeon.level.water[ch.pos] && !ch.flying)
dist = 2;
else
dist = 1;
ArrayList<Char> hitThisArc = new ArrayList<>();
PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist ); PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist );
for (int i = 0; i < PathFinder.distance.length; i++) { for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE){ if (PathFinder.distance[i] < Integer.MAX_VALUE){
@ -112,11 +106,16 @@ public class WandOfLightning extends DamageWand {
//the hero is only zapped if they are adjacent //the hero is only zapped if they are adjacent
continue; continue;
else if (n != null && !affected.contains( n )) { else if (n != null && !affected.contains( n )) {
arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center())); hitThisArc.add(n);
arc(n);
} }
} }
} }
affected.addAll(hitThisArc);
for (Char hit : hitThisArc){
arcs.add(new Lightning.Arc(ch.sprite.center(), hit.sprite.center()));
arc(hit);
}
} }
@Override @Override