v0.6.4a: fixed unique items in bags being removed by ankh revive

This commit is contained in:
Evan Debenham 2018-04-06 01:33:28 -04:00
parent 01b575c005
commit f850f6d521
2 changed files with 7 additions and 1 deletions

View File

@ -206,7 +206,7 @@ public class Belongings implements Iterable<Item> {
item.detachAll(backpack);
//you keep the bag itself, not its contents.
if (item instanceof Bag){
((Bag)item).clear();
((Bag)item).resurrect();
}
item.collect();
} else if (!item.isEquipped( owner )) {

View File

@ -114,6 +114,12 @@ public class Bag extends Item implements Iterable<Item> {
items.clear();
}
public void resurrect() {
for (Item item : items.toArray(new Item[0])){
if (!item.unique) items.remove(item);
}
}
private static final String ITEMS = "inventory";
@Override