v0.8.2: targeting traps now prefer visible targets over invisible ones
This commit is contained in:
parent
55f3fba7e1
commit
d62cb4aa95
|
@ -51,10 +51,12 @@ public class DisintegrationTrap extends Trap {
|
|||
|
||||
//find the closest char that can be aimed at
|
||||
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;
|
||||
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
|
||||
if (bolt.collisionPos == ch.pos &&
|
||||
(target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))){
|
||||
if (bolt.collisionPos == ch.pos && curDist < closestDist){
|
||||
target = ch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,12 @@ public class GrimTrap extends Trap {
|
|||
|
||||
//find the closest char that can be aimed at
|
||||
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;
|
||||
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
|
||||
if (bolt.collisionPos == ch.pos &&
|
||||
(target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))){
|
||||
if (bolt.collisionPos == ch.pos && curDist < closestDist){
|
||||
target = ch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,10 +62,12 @@ public class PoisonDartTrap extends Trap {
|
|||
|
||||
//find the closest char that can be aimed at
|
||||
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;
|
||||
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
|
||||
if (canTarget(ch) && bolt.collisionPos == ch.pos &&
|
||||
(target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))){
|
||||
if (canTarget(ch) && bolt.collisionPos == ch.pos && curDist < closestDist){
|
||||
target = ch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,13 +45,14 @@ public class WornDartTrap extends Trap {
|
|||
@Override
|
||||
public void activate() {
|
||||
Char target = Actor.findChar(pos);
|
||||
|
||||
//find the closest char that can be aimed at
|
||||
|
||||
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;
|
||||
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
|
||||
if (bolt.collisionPos == ch.pos &&
|
||||
(target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))){
|
||||
if (bolt.collisionPos == ch.pos && curDist < closestDist){
|
||||
target = ch;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user