v0.7.5: added a new property for items that fall into the bottom of a heap, and added a convenience method for removing a specific item from a heap.

This commit is contained in:
Evan Debenham 2019-09-25 13:10:56 -04:00
parent 6c18bc613c
commit 5b8125a659
4 changed files with 15 additions and 1 deletions

View File

@ -36,6 +36,7 @@ public class Dewdrop extends Item {
image = ItemSpriteSheet.DEWDROP;
stackable = true;
dropsDownHeap = true;
}
@Override

View File

@ -206,7 +206,7 @@ public class Heap implements Bundlable {
}
if ((item instanceof Dewdrop || item instanceof DriedRose.Petal) && type != Type.FOR_SALE) {
if (item.dropsDownHeap && type != Type.FOR_SALE) {
items.add( item );
} else {
items.addFirst( item );
@ -229,6 +229,16 @@ public class Heap implements Bundlable {
}
}
public void remove( Item a ){
items.remove(a);
if (items.isEmpty()){
destroy();
} else {
sprite.view( image(), glowing() );
sprite.place( pos );
}
}
public void burn() {
if (type == Type.MIMIC) {

View File

@ -69,6 +69,7 @@ public class Item implements Bundlable {
public boolean stackable = false;
protected int quantity = 1;
public boolean dropsDownHeap = false;
private int level = 0;

View File

@ -443,6 +443,8 @@ public class DriedRose extends Artifact {
{
stackable = true;
dropsDownHeap = true;
image = ItemSpriteSheet.PETAL;
}