From 9df6f290191abac6fad718642aca5783a4f7413f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 12 Aug 2018 21:43:32 -0400 Subject: [PATCH] v0.7.0: bugfixes to corpse dust and alchemy interface --- .../shatteredpixeldungeon/items/quest/CorpseDust.java | 10 +++++++--- .../shatteredpixeldungeon/windows/WndBag.java | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java index f36e46f2e..def87acd8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java @@ -101,11 +101,15 @@ public class CorpseDust extends Item { if (powerNeeded <= spawnPower){ spawnPower -= powerNeeded; int pos = 0; + int tries = 20; do{ pos = Random.Int(Dungeon.level.length()); - } while (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null); - Wraith.spawnAt(pos); - Sample.INSTANCE.play(Assets.SND_CURSED); + tries --; + } while (tries > 0 && (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null)); + if (tries > 0) { + Wraith.spawnAt(pos); + Sample.INSTANCE.play(Assets.SND_CURSED); + } } spend(TICK); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java index 116dcfe10..3a4f0ddc2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java @@ -47,7 +47,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; -import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -57,6 +56,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; import com.watabou.gltextures.TextureCache; import com.watabou.noosa.BitmapText; import com.watabou.noosa.ColorBlock; +import com.watabou.noosa.Game; import com.watabou.noosa.Image; import com.watabou.noosa.RenderedText; import com.watabou.noosa.audio.Sample; @@ -251,7 +251,7 @@ public class WndBag extends WndTabbed { @Override protected void onClick( Tab tab ) { hide(); - GameScene.show( new WndBag( ((BagTab)tab).bag, listener, mode, title ) ); + Game.scene().addToFront(new WndBag(((BagTab) tab).bag, listener, mode, title)); } @Override @@ -439,7 +439,7 @@ public class WndBag extends WndTabbed { } else { - GameScene.show(new WndItem( WndBag.this, item ) ); + Game.scene().addToFront(new WndItem( WndBag.this, item ) ); } }