v0.9.4: improved unequipped item handling when invent is lost

This commit is contained in:
Evan Debenham 2021-08-11 18:29:17 -04:00
parent 4c1300aa21
commit 440694cd47
2 changed files with 6 additions and 3 deletions

View File

@ -127,12 +127,16 @@ public abstract class EquipableItem extends Item {
hero.spend( time2equip( hero ) );
}
//temporarily keep this item so it can be collected
boolean wasKept = keptThoughLostInvent;
keptThoughLostInvent = true;
if (!collect || !collect( hero.belongings.backpack )) {
onDetach();
Dungeon.quickslot.clearItem(this);
updateQuickslot();
if (collect) Dungeon.level.drop( this, hero.pos );
}
keptThoughLostInvent = wasKept;
return true;
}

View File

@ -130,9 +130,8 @@ public class WndResurrect extends Window {
@Override
public boolean itemSelectable(Item item) {
//cannot select ankhs, bags or equippable items that aren't equipped
return !(item instanceof Ankh) && !(item instanceof Bag) &&
(!(item instanceof EquipableItem) || item.isEquipped(Dungeon.hero) || item instanceof MissileWeapon);
//cannot select ankhs or bags or equippable items that aren't equipped
return !(item instanceof Ankh || item instanceof Bag);
}
@Override