v0.9.3a: fixed self-telefragging and warp beacon moving immovable chars

This commit is contained in:
Evan Debenham 2021-06-11 22:33:19 -04:00
parent a8ef8a982a
commit eb5212b42c

View File

@ -112,7 +112,7 @@ public class WarpBeacon extends ArmorAbility {
if (tracker.depth == Dungeon.depth){
Char existing = Actor.findChar(tracker.pos);
if (existing != null){
if (existing != null && existing != hero){
if (hero.hasTalent(Talent.TELEFRAG)){
int heroHP = hero.HP + hero.shielding();
int heroDmg = Math.round(1.666f + 3.333f*hero.pointsInTalent(Talent.TELEFRAG));
@ -137,8 +137,10 @@ public class WarpBeacon extends ArmorAbility {
}
}
Random.shuffle(candidates);
Char toPush = Char.hasProp(existing, Char.Property.IMMOVABLE) ? hero : existing;
if (!candidates.isEmpty()){
Actor.addDelayed( new Pushing( existing, existing.pos, candidates.get(0) ), -1 );
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
existing.pos = candidates.get(0);
Dungeon.level.occupyCell(existing);