From 462b1027ccdcce9caf4411313955a71287727180 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 31 Jul 2020 19:32:43 -0400 Subject: [PATCH] v0.8.2: Various bugfixes: - Added a safety check to AndroidGame - fixed Burning not checking if a thieve's item is null - fixed wand of regrowth overriding tall grass and placing grass where it shouldn't - fixed unique potions being vulnerable to explosions - fixed tengu placing traps over plants - fixed items not being IDed in rankings if players dies with an ankh --- .../shatteredpixeldungeon/android/AndroidGame.java | 7 ++++++- .../shatteredpixeldungeon/actors/buffs/Burning.java | 2 +- .../shatteredpixeldungeon/items/Heap.java | 11 ++++++++--- .../items/wands/WandOfRegrowth.java | 12 ++++++++++-- .../levels/NewPrisonBossLevel.java | 1 + .../shatteredpixeldungeon/windows/WndResurrect.java | 4 ++-- 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java index ed494884f..d711ff6d3 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java @@ -107,7 +107,12 @@ public class AndroidGame extends AndroidApplication { view = (GLSurfaceView)graphics.getView(); } - + + @Override + public void onBackPressed() { + //do nothing, game should catch all back presses + } + @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index fe43baa10..bfae605ad 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -119,7 +119,7 @@ public class Burning extends Buff implements Hero.Doom { target.damage( damage, this ); } - if (target instanceof Thief) { + if (target instanceof Thief && ((Thief) target).item != null) { Item item = ((Thief) target).item; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index aa9b235d7..3189af87c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -257,6 +257,11 @@ public class Heap implements Bundlable { for (Item item : items.toArray( new Item[0] )) { + //unique items aren't affect by explosions + if (item.unique || (item instanceof Armor && ((Armor) item).checkSeal() != null)){ + continue; + } + if (item instanceof Potion) { items.remove(item); ((Potion) item).shatter(pos); @@ -273,10 +278,10 @@ public class Heap implements Bundlable { return; } - //unique and upgraded items can endure the blast - } else if (!(item.level() > 0 || item.unique - || (item instanceof Armor && ((Armor) item).checkSeal() != null))) + //upgraded items can endure the blast + } else if (item.level() <= 0) { items.remove( item ); + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index f8546cdf9..7d81ab28c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -98,9 +98,15 @@ public class WandOfRegrowth extends Wand { terr == Terrain.HIGH_GRASS || terr == Terrain.FURROWED_GRASS)) { i.remove(); + } else if (Char.hasProp(Actor.findChar(cell), Char.Property.IMMOVABLE)) { + i.remove(); + } else if (Dungeon.level.plants.get(cell) != null){ + i.remove(); } else { - Level.set( cell, Terrain.GRASS ); - GameScene.updateMap( cell ); + if (terr != Terrain.HIGH_GRASS && terr != Terrain.FURROWED_GRASS) { + Level.set(cell, Terrain.GRASS); + GameScene.updateMap( cell ); + } Char ch = Actor.findChar(cell); if (ch != null){ processSoulMark(ch, chargesPerCast()); @@ -162,6 +168,8 @@ public class WandOfRegrowth extends Wand { for (int cell : cells){ if (grassToPlace <= 0 || bolt.path.contains(cell)) break; + if (Dungeon.level.map[cell] == Terrain.HIGH_GRASS) continue; + if (Random.Float() > furrowedChance) { Level.set(cell, Terrain.HIGH_GRASS); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java index 5f0f39300..8be71a35a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java @@ -582,6 +582,7 @@ public class NewPrisonBossLevel extends Level { int cell = x+tenguCell.left+1 + (y+tenguCell.top+1)*width(); if (Blob.volumeAt(cell, StormCloud.class) == 0 && Blob.volumeAt(cell, Regrowth.class) <= 9 + && Dungeon.level.plants.get(cell) == null && Actor.findChar(cell) == null) { Level.set(cell, Terrain.SECRET_TRAP); setTrap(new TenguDartTrap().hide(), cell); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java index d1aa74389..55dc7988c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java @@ -79,9 +79,9 @@ public class WndResurrect extends Window { @Override protected void onClick() { hide(); - - Rankings.INSTANCE.submit( false, WndResurrect.causeOfDeath.getClass() ); + Hero.reallyDie( WndResurrect.causeOfDeath ); + Rankings.INSTANCE.submit( false, WndResurrect.causeOfDeath.getClass() ); } }; btnNo.setRect( 0, btnYes.bottom() + GAP, WIDTH, BTN_HEIGHT );