From 148fc96d9158da67c40171f3ddfabe209fcafbb0 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 22 Jun 2020 20:02:24 -0400 Subject: [PATCH] v0.8.1: Fixed the following minor bugs: - preparation incorrect killing enemies at health threshold, instead of below it - preparation incorrectly ignoring boss phases and death resistance effects - talisman of foresight vision marking effects incorrectly persisting between depths - packs filling past capacity in some cases - fireblast incorrectly setting adjacent cells on fire when not flammable - typos in the description of shields - game incorrectly closing when back button is pressed in new hero select - memory leaks on Android phones when the game is closed/opened - cursed wand gas zaps not using new SFX --- .../shatteredpixel/shatteredpixeldungeon/actors/Char.java | 8 +++++++- .../shatteredpixeldungeon/actors/buffs/Preparation.java | 4 ++-- .../items/artifacts/TalismanOfForesight.java | 5 +++++ .../shatteredpixeldungeon/items/bags/Bag.java | 2 +- .../shatteredpixeldungeon/items/wands/CursedWand.java | 1 + .../items/wands/WandOfFireblast.java | 5 ++++- .../items/weapon/melee/Greatshield.java | 4 ++-- .../items/weapon/melee/RoundShield.java | 4 ++-- .../shatteredpixeldungeon/levels/Level.java | 5 +++-- .../shatteredpixeldungeon/scenes/GameScene.java | 3 +++ .../shatteredpixeldungeon/scenes/HeroSelectScene.java | 5 +++++ 11 files changed, 35 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index e37cd0152..852bcf22e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -309,7 +309,13 @@ public abstract class Char extends Actor { buff(FrostImbue.class).proc(enemy); if (enemy.isAlive() && prep != null && prep.canKO(enemy)){ - enemy.die(this); + enemy.HP = 0; + if (!enemy.isAlive()) { + enemy.die(this); + } else { + //helps with triggering any on-damage effects that need to activate + enemy.damage(-1, this); + } enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Preparation.class, "assassinated")); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 716c95869..04ead3132 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -72,9 +72,9 @@ public class Preparation extends Buff implements ActionIndicator.Action { public boolean canKO(Char defender){ if (defender.properties().contains(Char.Property.MINIBOSS) || defender.properties().contains(Char.Property.BOSS)){ - return (defender.HP/(float)defender.HT) <= (KOThreshold/5f); + return (defender.HP/(float)defender.HT) < (KOThreshold/5f); } else { - return (defender.HP/(float)defender.HT) <= KOThreshold; + return (defender.HP/(float)defender.HT) < KOThreshold; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index 7e4fadb9c..bd7e26f8e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -340,6 +340,7 @@ public class TalismanOfForesight extends Artifact { public static class CharAwareness extends FlavourBuff { public int charID; + public int depth = Dungeon.depth; private static final String ID = "id"; @@ -367,8 +368,10 @@ public class TalismanOfForesight extends Artifact { public static class HeapAwareness extends FlavourBuff { public int pos; + public int depth = Dungeon.depth; private static final String POS = "pos"; + private static final String DEPTH = "depth"; @Override public void detach() { @@ -381,12 +384,14 @@ public class TalismanOfForesight extends Artifact { public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); pos = bundle.getInt(POS); + depth = bundle.getInt(DEPTH); } @Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put(POS, pos); + bundle.put(DEPTH, depth); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java index 6dd286a1c..19da47e04 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java @@ -152,7 +152,7 @@ public class Bag extends Item implements Iterable { public boolean canHold( Item item ){ if (items.contains(item) || item instanceof Bag || items.size() < capacity()){ return true; - } else { + } else if (item.stackable) { for (Item i : items) { if (item.isSimilar( i )) { return true; 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 eab5d82a7..cd9193fdd 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 @@ -171,6 +171,7 @@ public class CursedWand { GameScene.add( Blob.seed( bolt.collisionPos, 200, ParalyticGas.class ) ); break; } + Sample.INSTANCE.play( Assets.Sounds.GAS ); afterZap.call(); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java index bca83cafa..8c3d60cec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java @@ -77,7 +77,10 @@ public class WandOfFireblast extends DamageWand { continue; } - GameScene.add( Blob.seed( cell, 1+chargesPerCast(), Fire.class ) ); + //only ignite cells directly near caster if they are flammable + if (!Dungeon.level.adjacent(bolt.sourcePos, cell) || Dungeon.level.flamable[cell]){ + GameScene.add( Blob.seed( cell, 1+chargesPerCast(), Fire.class ) ); + } Char ch = Actor.findChar( cell ); if (ch != null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greatshield.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greatshield.java index c62d93ece..9f007645c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greatshield.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greatshield.java @@ -46,9 +46,9 @@ public class Greatshield extends MeleeWeapon { public String statsInfo(){ if (isIdentified()){ - return Messages.get(this, "stats_desc", 10+3*buffedLvl()); + return Messages.get(this, "stats_desc", 6+3*buffedLvl()); } else { - return Messages.get(this, "typical_stats_desc", 10); + return Messages.get(this, "typical_stats_desc", 6); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java index 21d9ccd56..ac442598a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java @@ -50,9 +50,9 @@ public class RoundShield extends MeleeWeapon { public String statsInfo(){ if (isIdentified()){ - return Messages.get(this, "stats_desc", 5+2*buffedLvl()); + return Messages.get(this, "stats_desc", 4+2*buffedLvl()); } else { - return Messages.get(this, "typical_stats_desc", 5); + return Messages.get(this, "typical_stats_desc", 4); } } } \ No newline at end of file diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 9cbdd236b..5223731cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -1094,6 +1094,7 @@ public abstract class Level implements Bundlable { } for (TalismanOfForesight.CharAwareness a : c.buffs(TalismanOfForesight.CharAwareness.class)){ + if (Dungeon.depth != a.depth) continue; Char ch = (Char) Actor.findById(a.charID); if (ch == null) { a.detach(); @@ -1105,9 +1106,9 @@ public abstract class Level implements Bundlable { } for (TalismanOfForesight.HeapAwareness h : c.buffs(TalismanOfForesight.HeapAwareness.class)){ - int p = h.pos; + if (Dungeon.depth != h.depth) continue; for (int i : PathFinder.NEIGHBOURS9) - fieldOfView[p+i] = true; + fieldOfView[h.pos+i] = true; } for (Mob m : mobs){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 239ef5fe1..27a1ff636 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -988,6 +988,9 @@ public class GameScene extends PixelScene { } public static void selectCell( CellSelector.Listener listener ) { + if (cellSelector.listener != null && cellSelector.listener != defaultCellListener){ + cellSelector.listener.onSelect(null); + } cellSelector.listener = listener; if (scene != null) scene.prompt( listener.prompt() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java index 699e812d7..bde07d40f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java @@ -270,6 +270,11 @@ public class HeroSelectScene extends PixelScene { uiAlpha = 2f; } + @Override + protected void onBackPressed() { + ShatteredPixelDungeon.switchScene( TitleScene.class ); + } + private class HeroBtn extends StyledButton { private HeroClass cl;