v1.4.0: fixed various char positioning errors with warp effects
This commit is contained in:
@@ -429,7 +429,7 @@ public class Dungeon {
|
|||||||
level.addRespawner();
|
level.addRespawner();
|
||||||
|
|
||||||
for(Mob m : level.mobs){
|
for(Mob m : level.mobs){
|
||||||
if (m.pos == hero.pos){
|
if (m.pos == hero.pos && !Char.hasProp(m, Char.Property.IMMOVABLE)){
|
||||||
//displace mob
|
//displace mob
|
||||||
for(int i : PathFinder.NEIGHBOURS8){
|
for(int i : PathFinder.NEIGHBOURS8){
|
||||||
if (Actor.findChar(m.pos+i) == null && level.passable[m.pos + i]){
|
if (Actor.findChar(m.pos+i) == null && level.passable[m.pos + i]){
|
||||||
|
|||||||
@@ -119,8 +119,6 @@ public class WarpBeacon extends ArmorAbility {
|
|||||||
if (tracker.depth == Dungeon.depth && tracker.branch == Dungeon.branch){
|
if (tracker.depth == Dungeon.depth && tracker.branch == Dungeon.branch){
|
||||||
Char existing = Actor.findChar(tracker.pos);
|
Char existing = Actor.findChar(tracker.pos);
|
||||||
|
|
||||||
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();
|
||||||
@@ -150,13 +148,20 @@ public class WarpBeacon extends ArmorAbility {
|
|||||||
Random.shuffle(candidates);
|
Random.shuffle(candidates);
|
||||||
|
|
||||||
if (!candidates.isEmpty()){
|
if (!candidates.isEmpty()){
|
||||||
|
ScrollOfTeleportation.appear(hero, tracker.pos);
|
||||||
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
||||||
|
|
||||||
toPush.pos = candidates.get(0);
|
toPush.pos = candidates.get(0);
|
||||||
Dungeon.level.occupyCell(toPush);
|
Dungeon.level.occupyCell(toPush);
|
||||||
hero.next();
|
hero.next();
|
||||||
|
} else {
|
||||||
|
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ScrollOfTeleportation.appear(hero, tracker.pos);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ScrollOfTeleportation.appear(hero, tracker.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Invisibility.dispel();
|
Invisibility.dispel();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage;
|
||||||
@@ -43,6 +44,9 @@ import com.watabou.noosa.Game;
|
|||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class BeaconOfReturning extends Spell {
|
public class BeaconOfReturning extends Spell {
|
||||||
|
|
||||||
@@ -112,28 +116,35 @@ public class BeaconOfReturning extends Spell {
|
|||||||
|
|
||||||
if (returnDepth == Dungeon.depth && returnBranch == Dungeon.branch) {
|
if (returnDepth == Dungeon.depth && returnBranch == Dungeon.branch) {
|
||||||
|
|
||||||
Char moving = Actor.findChar(returnPos);
|
Char existing = Actor.findChar(returnPos);
|
||||||
if (moving != null){
|
if (existing != null && existing != hero){
|
||||||
moving.pos = returnPos+1;
|
Char toPush = !Char.hasProp(existing, Char.Property.IMMOVABLE) ? hero : existing;
|
||||||
}
|
|
||||||
|
|
||||||
if (ScrollOfTeleportation.teleportToLocation(hero, returnPos)){
|
ArrayList<Integer> candidates = new ArrayList<>();
|
||||||
if (moving != null){
|
for (int n : PathFinder.NEIGHBOURS8) {
|
||||||
moving.pos = returnPos;
|
int cell = returnPos + n;
|
||||||
for(int i : PathFinder.NEIGHBOURS8){
|
if (!Dungeon.level.solid[cell] && Actor.findChar( cell ) == null
|
||||||
if (Actor.findChar(moving.pos+i) == null
|
&& (!Char.hasProp(toPush, Char.Property.LARGE) || Dungeon.level.openSpace[cell])) {
|
||||||
&& Dungeon.level.passable[moving.pos + i]
|
candidates.add( cell );
|
||||||
&& (!Char.hasProp(moving, Char.Property.LARGE) || Dungeon.level.openSpace[moving.pos + i])){
|
|
||||||
moving.pos += i;
|
|
||||||
moving.sprite.point(moving.sprite.worldToCamera(moving.pos));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
Random.shuffle(candidates);
|
||||||
if (moving != null) {
|
|
||||||
moving.pos = returnPos;
|
if (!candidates.isEmpty()){
|
||||||
|
if (toPush == hero){
|
||||||
|
returnPos = candidates.get(0);
|
||||||
|
} else {
|
||||||
|
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
||||||
|
toPush.pos = candidates.get(0);
|
||||||
|
Dungeon.level.occupyCell(toPush);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ScrollOfTeleportation.teleportToLocation(hero, returnPos)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user