From f0a1ae8d45ea911b73f755cd6dfdb2bde2f13e7f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 6 Dec 2021 15:21:40 -0500 Subject: [PATCH] v1.1.0: fixed some teleport effects still not working on boss levels --- .../items/artifacts/UnstableSpellbook.java | 2 -- .../items/scrolls/ScrollOfTeleportation.java | 3 --- .../items/spells/PhaseShift.java | 24 ++----------------- .../items/weapon/curses/Displacing.java | 24 +++++-------------- 4 files changed, 8 insertions(+), 45 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 0e7803f40..ec88a676c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -125,8 +125,6 @@ public class UnstableSpellbook extends Artifact { ||((scroll instanceof ScrollOfIdentify || scroll instanceof ScrollOfRemoveCurse || scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0) - //don't roll teleportation scrolls on boss floors - || (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel()) //cannot roll transmutation || (scroll instanceof ScrollOfTransmutation)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java index acc3d6dfd..dd336743b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java @@ -61,9 +61,6 @@ public class ScrollOfTeleportation extends Scroll { } identify(); - if (!Dungeon.bossLevel()) { - readAnimation(); - } } public static boolean teleportToLocation(Char ch, int pos){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java index d2a9a7a88..dbdbbb8f4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java @@ -46,31 +46,11 @@ public class PhaseShift extends TargetedSpell { //TODO probably want this to not work on the hero for balance reasons? ScrollOfTeleportation.teleportChar(curUser); } else if (ch != null) { - int count = 20; - int pos; - do { - pos = Dungeon.level.randomRespawnCell( hero ); - if (count-- <= 0) { - break; - } - } while (pos == -1 || Dungeon.level.secret[pos]); - - if (pos == -1 || Dungeon.bossLevel()) { - - GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") ); - - } else if (ch.properties().contains(Char.Property.IMMOVABLE)) { - - GLog.w( Messages.get(this, "tele_fail") ); - - } else { - - ch.pos = pos; + if (ScrollOfTeleportation.teleportChar(ch)){ + if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){ ((Mob) ch).state = ((Mob) ch).WANDERING; } - ch.sprite.place(ch.pos); - ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java index 173234ae0..e7204a609 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java @@ -26,6 +26,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.watabou.utils.Random; @@ -39,30 +41,16 @@ public class Displacing extends Weapon.Enchantment { float procChance = 1/12f * procChanceMultiplier(attacker); if (Random.Float() < procChance && !defender.properties().contains(Char.Property.IMMOVABLE)){ - int count = 20; - int newPos; - do { - newPos = Dungeon.level.randomRespawnCell( defender ); - if (count-- <= 0) { - break; - } - } while (newPos == -1 || Dungeon.level.secret[newPos]); - if (newPos != -1 && !Dungeon.bossLevel()) { - - if (Dungeon.level.heroFOV[defender.pos]) { - CellEmitter.get( defender.pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); + int oldpos = defender.pos; + if (ScrollOfTeleportation.teleportChar(defender)){ + if (Dungeon.level.heroFOV[oldpos]) { + CellEmitter.get( oldpos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); } - defender.pos = newPos; if (defender instanceof Mob && ((Mob) defender).state == ((Mob) defender).HUNTING){ ((Mob) defender).state = ((Mob) defender).WANDERING; } - defender.sprite.place( defender.pos ); - defender.sprite.visible = Dungeon.level.heroFOV[defender.pos]; - - return 0; - } }