v0.8.2: fixed crashes caused by new targeted trap logic

This commit is contained in:
Evan Debenham 2020-07-31 23:52:57 -04:00
parent 462b1027cc
commit 07d58369f8
4 changed files with 8 additions and 8 deletions
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps

View File

@ -53,8 +53,8 @@ public class DisintegrationTrap extends Trap {
if (target == null){
float closestDist = Float.MAX_VALUE;
for (Char ch : Actor.chars()){
float curDist = Dungeon.level.trueDistance(pos, target.pos);
if (target.invisible > 0) curDist += 1000;
float curDist = Dungeon.level.trueDistance(pos, ch.pos);
if (ch.invisible > 0) curDist += 1000;
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos && curDist < closestDist){
target = ch;

View File

@ -52,8 +52,8 @@ public class GrimTrap extends Trap {
if (target == null){
float closestDist = Float.MAX_VALUE;
for (Char ch : Actor.chars()){
float curDist = Dungeon.level.trueDistance(pos, target.pos);
if (target.invisible > 0) curDist += 1000;
float curDist = Dungeon.level.trueDistance(pos, ch.pos);
if (ch.invisible > 0) curDist += 1000;
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos && curDist < closestDist){
target = ch;

View File

@ -64,8 +64,8 @@ public class PoisonDartTrap extends Trap {
if (target == null){
float closestDist = Float.MAX_VALUE;
for (Char ch : Actor.chars()){
float curDist = Dungeon.level.trueDistance(pos, target.pos);
if (target.invisible > 0) curDist += 1000;
float curDist = Dungeon.level.trueDistance(pos, ch.pos);
if (ch.invisible > 0) curDist += 1000;
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (canTarget(ch) && bolt.collisionPos == ch.pos && curDist < closestDist){
target = ch;

View File

@ -49,8 +49,8 @@ public class WornDartTrap extends Trap {
if (target == null){
float closestDist = Float.MAX_VALUE;
for (Char ch : Actor.chars()){
float curDist = Dungeon.level.trueDistance(pos, target.pos);
if (target.invisible > 0) curDist += 1000;
float curDist = Dungeon.level.trueDistance(pos, ch.pos);
if (ch.invisible > 0) curDist += 1000;
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos && curDist < closestDist){
target = ch;