From 408846301644a38019dd047545d0d5cda74a6ef1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 28 Aug 2024 11:35:37 -0400 Subject: [PATCH] v2.5.0: piranhas are now killed by levitation --- .../actors/mobs/PhantomPiranha.java | 4 ++++ .../shatteredpixeldungeon/actors/mobs/Piranha.java | 7 ++++++- .../shatteredpixeldungeon/items/wands/CursedWand.java | 9 ++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/PhantomPiranha.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/PhantomPiranha.java index 289c492fb..16d933e94 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/PhantomPiranha.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/PhantomPiranha.java @@ -92,6 +92,10 @@ public class PhantomPiranha extends Piranha { private boolean teleportAway(){ + if (flying){ + return false; + } + ArrayList inFOVCandidates = new ArrayList<>(); ArrayList outFOVCandidates = new ArrayList<>(); for (int i = 0; i < Dungeon.level.length(); i++){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index 1bc33cc8b..4fd72ec52 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -29,7 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat; import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.RatSkull; import com.shatteredpixel.shatteredpixeldungeon.sprites.PiranhaSprite; @@ -66,7 +68,10 @@ public class Piranha extends Mob { @Override protected boolean act() { - if (!Dungeon.level.water[pos]) { + if (!Dungeon.level.water[pos] || flying) { + if (sprite != null && buff(Levitation.class) != null){ + sprite.emitter().burst(Speck.factory( Speck.JET ), 10); + } dieOnLand(); return true; } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 34c3bd7f2..75ee73160 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -54,6 +54,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GoldenMimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; @@ -623,11 +624,9 @@ public class CursedWand { @Override public boolean effect(Item origin, Char user, Ballistica bolt, boolean positiveOnly) { - if (!positiveOnly) { - Char ch = Actor.findChar(bolt.collisionPos); - if (ch != null){ - Buff.affect(ch, Levitation.class, Levitation.DURATION); - } + Char ch = Actor.findChar(bolt.collisionPos); + if ((!positiveOnly || (ch instanceof Piranha)) && ch != null && !ch.flying) { + Buff.affect(ch, Levitation.class, Levitation.DURATION); } else { Buff.affect(user, Levitation.class, Levitation.DURATION); }