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,24 +95,26 @@ 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;
PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist ); ArrayList<Char> hitThisArc = new ArrayList<>();
for (int i = 0; i < PathFinder.distance.length; i++) { PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist );
if (PathFinder.distance[i] < Integer.MAX_VALUE){ for (int i = 0; i < PathFinder.distance.length; i++) {
Char n = Actor.findChar( i ); if (PathFinder.distance[i] < Integer.MAX_VALUE){
if (n == Dungeon.hero && PathFinder.distance[i] > 1) Char n = Actor.findChar( i );
//the hero is only zapped if they are adjacent if (n == Dungeon.hero && PathFinder.distance[i] > 1)
continue; //the hero is only zapped if they are adjacent
else if (n != null && !affected.contains( n )) { continue;
arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center())); else if (n != null && !affected.contains( n )) {
arc(n); hitThisArc.add(n);
}
} }
}
}
affected.addAll(hitThisArc);
for (Char hit : hitThisArc){
arcs.add(new Lightning.Arc(ch.sprite.center(), hit.sprite.center()));
arc(hit);
} }
} }