From cd124d23203ccbc73e3a1cfdbbcb0da5249fa145 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 1 Nov 2014 17:14:49 -0400 Subject: [PATCH] v0.2.2: fixed a couple bugs with keys and stackable items --- .../shatteredpixeldungeon/actors/hero/Belongings.java | 2 +- .../shatteredpixel/shatteredpixeldungeon/items/Item.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java index 604e4a0cd..78520bf12 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java @@ -124,7 +124,7 @@ public class Belongings implements Iterable { for (Item item : backpack) { if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) { - IronKey.curDepthQuantity++; + IronKey.curDepthQuantity += item.quantity(); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index a4f910295..21af82be5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -211,7 +211,14 @@ public class Item implements Bundlable { updateQuickslot(); try { + + //pssh, who needs copy constructors? Item detached = getClass().newInstance(); + Bundle copy = new Bundle(); + this.storeInBundle(copy); + detached.restoreFromBundle(copy); + detached.quantity(1); + detached.onDetach( ); return detached; } catch (Exception e) {