v0.8.2: fixed crashes caused by new targeted trap logic
This commit is contained in:
parent
462b1027cc
commit
07d58369f8
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user