From cf8e53f9aadf0dc9caa07afc2c9f5e45fe6c34c9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 30 Oct 2023 14:08:04 -0400 Subject: [PATCH] v2.3.0: fixed potion shatters not cleansing fire/ooze outside of FOV --- .../items/potions/Potion.java | 21 +++++++++++-------- .../items/potions/PotionOfFrost.java | 6 +++--- .../items/potions/PotionOfLevitation.java | 2 +- .../items/potions/PotionOfLiquidFlame.java | 2 +- .../items/potions/PotionOfParalyticGas.java | 2 +- .../items/potions/PotionOfPurity.java | 6 +++--- .../items/potions/PotionOfToxicGas.java | 2 +- .../items/potions/brews/BlizzardBrew.java | 2 +- .../items/potions/brews/CausticBrew.java | 4 ++-- .../items/potions/brews/InfernalBrew.java | 4 ++-- .../items/potions/brews/ShockingBrew.java | 2 +- .../elixirs/ElixirOfHoneyedHealing.java | 2 +- .../potions/exotic/PotionOfCleansing.java | 2 +- .../potions/exotic/PotionOfCorrosiveGas.java | 6 +++--- .../potions/exotic/PotionOfShroudingFog.java | 6 +++--- .../potions/exotic/PotionOfSnapFreeze.java | 6 +++--- .../potions/exotic/PotionOfStormClouds.java | 6 +++--- 17 files changed, 42 insertions(+), 39 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 63ad332b4..63fb0da8a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -315,10 +315,10 @@ public class Potion extends Item { } public void shatter( int cell ) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { GLog.i( Messages.get(Potion.class, "shatter") ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); - splash( cell ); } } @@ -391,20 +391,23 @@ public class Potion extends Item { } protected void splash( int cell ) { - Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); - if (fire != null) - fire.clear( cell ); - - final int color = splashColor(); + if (fire != null) { + fire.clear(cell); + } Char ch = Actor.findChar(cell); if (ch != null && ch.alignment == Char.Alignment.ALLY) { Buff.detach(ch, Burning.class); Buff.detach(ch, Ooze.class); - Splash.at( ch.sprite.center(), color, 5 ); - } else { - Splash.at( cell, color, 5 ); + } + + if (Dungeon.level.heroFOV[cell]) { + if (ch != null) { + Splash.at(ch.sprite.center(), splashColor(), 5); + } else { + Splash.at(cell, splashColor(), 5); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java index cd0d80629..8c38452f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java @@ -38,11 +38,11 @@ public class PotionOfFrost extends Potion { @Override public void shatter( int cell ) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - - splash( cell ); + Sample.INSTANCE.play( Assets.Sounds.SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java index c8169169a..3fb958b27 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java @@ -43,10 +43,10 @@ public class PotionOfLevitation extends Potion { @Override public void shatter( int cell ) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java index 39cc4d3f2..d584e070f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -39,10 +39,10 @@ public class PotionOfLiquidFlame extends Potion { @Override public void shatter( int cell ) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.BURNING ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java index b97f953eb..0cfe0b9cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java @@ -38,10 +38,10 @@ public class PotionOfParalyticGas extends Potion { @Override public void shatter( int cell ) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index 381ad5644..b09dbd03e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -77,10 +77,10 @@ public class PotionOfPurity extends Potion { } } - - + + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { - splash(cell); Sample.INSTANCE.play(Assets.Sounds.SHATTER); identify(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java index f6ebfaf44..525176399 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java @@ -38,10 +38,10 @@ public class PotionOfToxicGas extends Potion { @Override public void shatter( int cell ) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/BlizzardBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/BlizzardBrew.java index a4a3733e2..6dca1804a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/BlizzardBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/BlizzardBrew.java @@ -40,8 +40,8 @@ public class BlizzardBrew extends Brew { @Override public void shatter(int cell) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java index cb387d14b..a2b91fbf9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java @@ -43,9 +43,9 @@ public class CausticBrew extends Brew { @Override public void shatter(int cell) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/InfernalBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/InfernalBrew.java index 5603b08e4..90be30746 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/InfernalBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/InfernalBrew.java @@ -40,9 +40,9 @@ public class InfernalBrew extends Brew { @Override public void shatter(int cell) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/ShockingBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/ShockingBrew.java index 116bdabec..0fa6d2192 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/ShockingBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/ShockingBrew.java @@ -41,8 +41,8 @@ public class ShockingBrew extends Brew { @Override public void shatter(int cell) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { - splash( cell ); Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play(Assets.Sounds.LIGHTNING); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java index 49f5d1a6d..8d22960bc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java @@ -51,9 +51,9 @@ public class ElixirOfHoneyedHealing extends Elixir { @Override public void shatter(int cell) { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { Sample.INSTANCE.play( Assets.Sounds.SHATTER ); - splash( cell ); } Char ch = Actor.findChar(cell); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java index 37dc3012e..baf127ce1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java @@ -56,9 +56,9 @@ public class PotionOfCleansing extends ExoticPotion { if (Actor.findChar(cell) == null){ super.shatter(cell); } else { + splash( cell ); if (Dungeon.level.heroFOV[cell]) { Sample.INSTANCE.play(Assets.Sounds.SHATTER); - splash(cell); identify(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java index 911711464..bad5071f2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java @@ -38,11 +38,11 @@ public class PotionOfCorrosiveGas extends ExoticPotion { @Override public void shatter( int cell ) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - - splash( cell ); + Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java index db97ac928..7b7c7f7f4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java @@ -38,11 +38,11 @@ public class PotionOfShroudingFog extends ExoticPotion { @Override public void shatter( int cell ) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - - splash( cell ); + Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfSnapFreeze.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfSnapFreeze.java index dc8a2c1b1..5de182990 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfSnapFreeze.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfSnapFreeze.java @@ -40,11 +40,11 @@ public class PotionOfSnapFreeze extends ExoticPotion { @Override public void shatter(int cell) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - - splash( cell ); + Sample.INSTANCE.play( Assets.Sounds.SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java index be1b3bd84..e4e3add61 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java @@ -38,11 +38,11 @@ public class PotionOfStormClouds extends ExoticPotion { @Override public void shatter(int cell) { - + + splash( cell ); if (Dungeon.level.heroFOV[cell]) { identify(); - - splash( cell ); + Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); }