From f4dbb59365f7fe3189d891fdbfcf0501986e3ae2 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 30 Dec 2018 16:15:23 -0500 Subject: [PATCH] v0.7.1b: bugfixes: - fixed prison guards not correctly incrementing their potion drop count - added safety checks to high grass and spirit bow --- .../shatteredpixeldungeon/actors/mobs/Guard.java | 2 +- .../shatteredpixeldungeon/items/Item.java | 2 ++ .../shatteredpixeldungeon/items/weapon/SpiritBow.java | 11 ++++++++++- .../levels/features/HighGrass.java | 11 +++++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java index 12881c2af..aeae3faba 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java @@ -139,7 +139,7 @@ public class Guard extends Mob { //with 0 potions dropped that simplifies to 1/8 } else { if (Random.Float() < ((6f - Dungeon.LimitedDrops.GUARD_HP.count) / 6f)){ - Dungeon.LimitedDrops.GUARD_HP.drop(); + Dungeon.LimitedDrops.GUARD_HP.count++; return new PotionOfHealing(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 962ba51f2..7123bf8bc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -518,6 +518,7 @@ public class Item implements Bundlable { new Callback() { @Override public void call() { + curUser = user; Item.this.detach(user.belongings.backpack).onThrow(cell); user.spendAndNext(delay); } @@ -530,6 +531,7 @@ public class Item implements Bundlable { new Callback() { @Override public void call() { + curUser = user; Item.this.detach(user.belongings.backpack).onThrow(cell); user.spendAndNext(delay); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java index d69fa3e6b..94127d8b9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java @@ -68,9 +68,15 @@ public class SpiritBow extends Weapon { @Override public void execute(Hero hero, String action) { + super.execute(hero, action); + if (action.equals(AC_SHOOT)) { + + curUser = hero; + curItem = this; GameScene.selectCell( shooter ); + } } @@ -293,7 +299,10 @@ public class SpiritBow extends Weapon { new Callback() { @Override public void call() { - if (enemy.isAlive()) onThrow(cell); + if (enemy.isAlive()) { + curUser = user; + onThrow(cell); + } if (last) { user.spendAndNext(castDelay(user, dst)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 4d9281240..04e308749 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -103,9 +104,11 @@ public class HighGrass { freezeTrample = false; - GameScene.updateMap( pos ); - - CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, 4 ); - if (Dungeon.level.heroFOV[pos]) Dungeon.observe(); + if (ShatteredPixelDungeon.scene() instanceof GameScene) { + GameScene.updateMap(pos); + + CellEmitter.get(pos).burst(LeafParticle.LEVEL_SPECIFIC, 4); + if (Dungeon.level.heroFOV[pos]) Dungeon.observe(); + } } }