v0.8.2: fixed crashes caused by new targeted trap logic
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user