v2.3.0: fixed char swapping and ally warp working on immobile allies

This commit is contained in:
Evan Debenham
2024-01-04 13:29:30 -05:00
parent 878e24975d
commit cfedb7aaf2

View File

@@ -208,6 +208,7 @@ public abstract class Char extends Actor {
return true;
} else if (c instanceof Hero
&& alignment == Alignment.ALLY
&& !hasProp(this, Property.IMMOVABLE)
&& Dungeon.level.distance(pos, c.pos) <= 2*Dungeon.hero.pointsInTalent(Talent.ALLY_WARP)){
return true;
} else {
@@ -235,6 +236,11 @@ public abstract class Char extends Actor {
int oldPos = pos;
int newPos = c.pos;
//can't swap or ally warp if either char is immovable
if (hasProp(this, Property.IMMOVABLE) || hasProp(c, Property.IMMOVABLE)){
return true;
}
//warp instantly with allies in this case
if (c == Dungeon.hero && Dungeon.hero.hasTalent(Talent.ALLY_WARP)){
PathFinder.buildDistanceMap(c.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));