v2.3.0: fixed potion shatters not cleansing fire/ooze outside of FOV

This commit is contained in:
Evan Debenham
2023-10-30 14:08:04 -04:00
parent 008a65140a
commit cf8e53f9aa
17 changed files with 42 additions and 39 deletions
@@ -315,10 +315,10 @@ public class Potion extends Item {
} }
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
GLog.i( Messages.get(Potion.class, "shatter") ); GLog.i( Messages.get(Potion.class, "shatter") );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
splash( cell );
} }
} }
@@ -391,20 +391,23 @@ public class Potion extends Item {
} }
protected void splash( int cell ) { protected void splash( int cell ) {
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
if (fire != null) if (fire != null) {
fire.clear(cell); fire.clear(cell);
}
final int color = splashColor();
Char ch = Actor.findChar(cell); Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment == Char.Alignment.ALLY) { if (ch != null && ch.alignment == Char.Alignment.ALLY) {
Buff.detach(ch, Burning.class); Buff.detach(ch, Burning.class);
Buff.detach(ch, Ooze.class); Buff.detach(ch, Ooze.class);
Splash.at( ch.sprite.center(), color, 5 ); }
if (Dungeon.level.heroFOV[cell]) {
if (ch != null) {
Splash.at(ch.sprite.center(), splashColor(), 5);
} else { } else {
Splash.at( cell, color, 5 ); Splash.at(cell, splashColor(), 5);
}
} }
} }
@@ -39,10 +39,10 @@ public class PotionOfFrost extends Potion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
} }
@@ -43,10 +43,10 @@ public class PotionOfLevitation extends Potion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -39,10 +39,10 @@ public class PotionOfLiquidFlame extends Potion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.BURNING ); Sample.INSTANCE.play( Assets.Sounds.BURNING );
} }
@@ -38,10 +38,10 @@ public class PotionOfParalyticGas extends Potion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -79,8 +79,8 @@ public class PotionOfPurity extends Potion {
} }
if (Dungeon.level.heroFOV[cell]) {
splash( cell ); splash( cell );
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play(Assets.Sounds.SHATTER); Sample.INSTANCE.play(Assets.Sounds.SHATTER);
identify(); identify();
@@ -38,10 +38,10 @@ public class PotionOfToxicGas extends Potion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -40,8 +40,8 @@ public class BlizzardBrew extends Brew {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
if (Dungeon.level.heroFOV[cell]) {
splash( cell ); splash( cell );
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -44,8 +44,8 @@ public class CausticBrew extends Brew {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
if (Dungeon.level.heroFOV[cell]) {
splash( cell ); splash( cell );
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
} }
@@ -41,8 +41,8 @@ public class InfernalBrew extends Brew {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
if (Dungeon.level.heroFOV[cell]) {
splash( cell ); splash( cell );
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -41,8 +41,8 @@ public class ShockingBrew extends Brew {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
if (Dungeon.level.heroFOV[cell]) {
splash( cell ); splash( cell );
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play(Assets.Sounds.LIGHTNING); Sample.INSTANCE.play(Assets.Sounds.LIGHTNING);
} }
@@ -51,9 +51,9 @@ public class ElixirOfHoneyedHealing extends Elixir {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
splash( cell );
} }
Char ch = Actor.findChar(cell); Char ch = Actor.findChar(cell);
@@ -56,9 +56,9 @@ public class PotionOfCleansing extends ExoticPotion {
if (Actor.findChar(cell) == null){ if (Actor.findChar(cell) == null){
super.shatter(cell); super.shatter(cell);
} else { } else {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play(Assets.Sounds.SHATTER); Sample.INSTANCE.play(Assets.Sounds.SHATTER);
splash(cell);
identify(); identify();
} }
@@ -39,10 +39,10 @@ public class PotionOfCorrosiveGas extends ExoticPotion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -39,10 +39,10 @@ public class PotionOfShroudingFog extends ExoticPotion {
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }
@@ -41,10 +41,10 @@ public class PotionOfSnapFreeze extends ExoticPotion {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
} }
@@ -39,10 +39,10 @@ public class PotionOfStormClouds extends ExoticPotion {
@Override @Override
public void shatter(int cell) { public void shatter(int cell) {
splash( cell );
if (Dungeon.level.heroFOV[cell]) { if (Dungeon.level.heroFOV[cell]) {
identify(); identify();
splash( cell );
Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.SHATTER );
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
} }