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

View File

@@ -181,17 +181,23 @@ abstract public class KindOfWeapon extends EquipableItem {
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
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 (second){
hero.belongings.secondWep = null;
} else {
if (!second){
hero.belongings.weapon = null;
}
return true;
} else {
if (second){
hero.belongings.secondWep = this;
}
return false;
}