v0.9.3c: fully fixed warp becaon onto characters
This commit is contained in:
parent
e180c2916c
commit
f71af34f0b
|
@ -112,6 +112,9 @@ public class WarpBeacon extends ArmorAbility {
|
||||||
if (tracker.depth == Dungeon.depth){
|
if (tracker.depth == Dungeon.depth){
|
||||||
Char existing = Actor.findChar(tracker.pos);
|
Char existing = Actor.findChar(tracker.pos);
|
||||||
|
|
||||||
|
Invisibility.dispel();
|
||||||
|
ScrollOfTeleportation.appear(hero, tracker.pos);
|
||||||
|
|
||||||
if (existing != null && existing != hero){
|
if (existing != null && existing != hero){
|
||||||
if (hero.hasTalent(Talent.TELEFRAG)){
|
if (hero.hasTalent(Talent.TELEFRAG)){
|
||||||
int heroHP = hero.HP + hero.shielding();
|
int heroHP = hero.HP + hero.shielding();
|
||||||
|
@ -128,29 +131,28 @@ public class WarpBeacon extends ArmorAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existing.isAlive()){
|
if (existing.isAlive()){
|
||||||
|
Char toPush = Char.hasProp(existing, Char.Property.IMMOVABLE) ? hero : existing;
|
||||||
|
|
||||||
ArrayList<Integer> candidates = new ArrayList<>();
|
ArrayList<Integer> candidates = new ArrayList<>();
|
||||||
for (int n : PathFinder.NEIGHBOURS8) {
|
for (int n : PathFinder.NEIGHBOURS8) {
|
||||||
int cell = target + n;
|
int cell = tracker.pos + n;
|
||||||
if (!Dungeon.level.solid[cell] && Actor.findChar( cell ) == null
|
if (!Dungeon.level.solid[cell] && Actor.findChar( cell ) == null
|
||||||
&& (!Char.hasProp(existing, Char.Property.LARGE) || Dungeon.level.openSpace[cell])) {
|
&& (!Char.hasProp(toPush, Char.Property.LARGE) || Dungeon.level.openSpace[cell])) {
|
||||||
candidates.add( cell );
|
candidates.add( cell );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Random.shuffle(candidates);
|
Random.shuffle(candidates);
|
||||||
Char toPush = Char.hasProp(existing, Char.Property.IMMOVABLE) ? hero : existing;
|
|
||||||
|
|
||||||
if (!candidates.isEmpty()){
|
if (!candidates.isEmpty()){
|
||||||
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
||||||
|
|
||||||
existing.pos = candidates.get(0);
|
toPush.pos = candidates.get(0);
|
||||||
Dungeon.level.occupyCell(existing);
|
Dungeon.level.occupyCell(toPush);
|
||||||
hero.next();
|
hero.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Invisibility.dispel();
|
|
||||||
ScrollOfTeleportation.appear(hero, tracker.pos);
|
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user