From 154d9256f4038faf96e8ea14d3857188cd7b65c7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 6 Mar 2022 12:08:41 -0500 Subject: [PATCH] v1.2.0: improved logic for swapping misc items and light cloak talent --- .../shatteredpixeldungeon/items/KindofMisc.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java index 106c7446d..f43bd5985 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java @@ -96,8 +96,11 @@ public abstract class KindofMisc extends EquipableItem { protected void onSelect(int index) { KindofMisc equipped = miscs[index]; + //we directly remove the item because we want to have inventory capacity + // to unequip the equipped one, but don't want to trigger any other + // item detaching logic int slot = Dungeon.quickslot.getSlot(KindofMisc.this); - detach(hero.belongings.backpack); + Dungeon.hero.belongings.backpack.items.remove(KindofMisc.this); if (equipped.doUnequip(hero, true, false)) { //swap out equip in misc slot if needed if (index == 0 && KindofMisc.this instanceof Ring){ @@ -107,9 +110,10 @@ public abstract class KindofMisc extends EquipableItem { hero.belongings.ring = (Ring) hero.belongings.misc; hero.belongings.misc = null; } + Dungeon.hero.belongings.backpack.items.add(KindofMisc.this); doEquip(hero); } else { - collect(); + Dungeon.hero.belongings.backpack.items.add(KindofMisc.this); } if (slot != -1) Dungeon.quickslot.setSlot(slot, KindofMisc.this); updateQuickslot();