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 ce83c2bb2..8b98e5be7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -113,8 +113,10 @@ public class Item implements Bundlable { } public void doDrop( Hero hero ) { - hero.spendAndNext( TIME_TO_DROP ); - Dungeon.level.drop( detachAll( hero.belongings.backpack ), hero.pos ).sprite.drop( hero.pos ); + if (hero.belongings.backpack.contains(this)) { + hero.spendAndNext(TIME_TO_DROP); + Dungeon.level.drop(detachAll(hero.belongings.backpack), hero.pos).sprite.drop(hero.pos); + } } //resets an item's properties, to ensure consistency between runs @@ -124,7 +126,9 @@ public class Item implements Bundlable { } public void doThrow( Hero hero ) { - GameScene.selectCell( thrower ); + if (hero.belongings.backpack.contains(this)) { + GameScene.selectCell(thrower); + } } public void execute( Hero hero, String action ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/Brew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/Brew.java index 96d4944da..f7fd42bd7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/Brew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/Brew.java @@ -45,7 +45,9 @@ public abstract class Brew extends Potion { @Override public void doThrow(Hero hero) { //identical to Item.doThrow - GameScene.selectCell( thrower ); + if (hero.belongings.backpack.contains(this)) { + GameScene.selectCell(thrower); + } } @Override