From bc14ea0aa0881b756531c6630e3cf558fbb5caf9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 4 Aug 2018 15:21:23 -0400 Subject: [PATCH] v0.7.0: bugfixes: - various cases where hero can appear ontop of enemies - incorrect wand quickslot functionality with magic immune --- .../shatteredpixeldungeon/Dungeon.java | 12 ++++++++++++ .../items/artifacts/LloydsBeacon.java | 12 ++++++++++++ .../shatteredpixeldungeon/items/wands/Wand.java | 14 ++++++-------- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 4cf422e9d..bddcd9a48 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -378,6 +378,18 @@ public class Dungeon { hero.pos = pos; + for(Mob m : level.mobs){ + if (m.pos == hero.pos){ + //displace mob + for(int i : PathFinder.NEIGHBOURS8){ + if (Actor.findChar(m.pos+i) == null && level.passable[m.pos + i]){ + m.pos += i; + break; + } + } + } + } + Light light = hero.buff( Light.class ); hero.viewDistance = light == null ? level.viewDistance : Math.max( Light.DISTANCE, level.viewDistance ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 455be3076..427c7b5b1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -159,6 +159,18 @@ public class LloydsBeacon extends Artifact { if (returnDepth == Dungeon.depth) { ScrollOfTeleportation.appear( hero, returnPos ); + for(Mob m : Dungeon.level.mobs){ + if (m.pos == hero.pos){ + //displace mob + for(int i : PathFinder.NEIGHBOURS8){ + if (Actor.findChar(m.pos+i) == null && Dungeon.level.passable[m.pos + i]){ + m.pos += i; + m.sprite.point(m.sprite.worldToCamera(m.pos)); + break; + } + } + } + } Dungeon.level.press( returnPos, hero ); Dungeon.observe(); GameScene.updateFog(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index aa0219611..eb9a0dece 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -97,14 +97,9 @@ public abstract class Wand extends Item { if (action.equals( AC_ZAP )) { - if (hero.buff(MagicImmune.class) != null){ - GLog.w( Messages.get(this, "no_magic") ); - } else { - - curUser = hero; - curItem = this; - GameScene.selectCell(zapper); - } + curUser = hero; + curItem = this; + GameScene.selectCell( zapper ); } } @@ -374,6 +369,9 @@ public abstract class Wand extends Item { if (target == curUser.pos || cell == curUser.pos) { GLog.i( Messages.get(Wand.class, "self_target") ); return; + } else if (curUser.buff(MagicImmune.class) != null){ + GLog.w( Messages.get(Wand.class, "no_magic") ); + return; } curUser.sprite.zap(cell);