v2.0.0: unequipping secon wep with a full inventory no longer drops it

This commit is contained in:
Evan Debenham
2023-02-13 16:34:37 -05:00
parent 853e6050b1
commit f765600876
@@ -181,17 +181,23 @@ abstract public class KindOfWeapon extends EquipableItem {
public boolean doUnequip( Hero hero, boolean collect, boolean single ) { public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
boolean second = hero.belongings.secondWep == this; boolean second = hero.belongings.secondWep == this;
if (second){
//do this first so that the item can go to a full inventory
hero.belongings.secondWep = null;
}
if (super.doUnequip( hero, collect, single )) { if (super.doUnequip( hero, collect, single )) {
if (second){ if (!second){
hero.belongings.secondWep = null;
} else {
hero.belongings.weapon = null; hero.belongings.weapon = null;
} }
return true; return true;
} else { } else {
if (second){
hero.belongings.secondWep = this;
}
return false; return false;
} }