v0.9.1b: fixed various errors with for sale heaps

This commit is contained in:
Evan Debenham 2020-12-23 00:08:25 -05:00
parent 4e31f7d247
commit d44dbc04f1
2 changed files with 11 additions and 2 deletions

View File

@ -83,7 +83,12 @@ public class Shopkeeper extends NPC {
for (Heap heap: Dungeon.level.heaps.valueList()) {
if (heap.type == Heap.Type.FOR_SALE) {
CellEmitter.get( heap.pos ).burst( ElmoParticle.FACTORY, 4 );
heap.destroy();
if (heap.size() == 1) {
heap.destroy();
} else {
heap.items.remove(heap.size()-1);
heap.type = Heap.Type.HEAP;
}
}
}
}

View File

@ -349,7 +349,11 @@ public class Heap implements Bundlable {
switch(type){
case FOR_SALE:
Item i = peek();
return Messages.get(this, "for_sale", Shopkeeper.sellPrice(i), i.toString());
if (size() == 1) {
return Messages.get(this, "for_sale", Shopkeeper.sellPrice(i), i.toString());
} else {
return i.toString();
}
case CHEST:
case MIMIC:
return Messages.get(this, "chest");