v0.7.3a: fixed all darts incorrect being consumed when tipping all

This commit is contained in:
Evan Debenham 2019-05-24 21:46:32 -04:00
parent 3e3d5f3364
commit 8d6b3835b1
2 changed files with 16 additions and 2 deletions

View File

@ -85,6 +85,16 @@ public class Tilemap extends Visual {
updateMap();
}
public Image image(int x, int y){
if (!needsRender(x + mapWidth*y)){
return null;
} else {
Image img = new Image(texture);
img.frame(tileset.get(data[x + mapWidth * y]));
return img;
}
}
//forces a full update, including new buffer
public synchronized void updateMap(){
@ -254,6 +264,6 @@ public class Tilemap extends Visual {
}
protected boolean needsRender(int pos){
return true;
return data[pos] >= 0;
}
}

View File

@ -189,7 +189,11 @@ public class Dart extends MissileWeapon {
item.quantity(item.quantity() - maxSeedsToUse);
}
curItem.detachAll( curUser.belongings.backpack );
if (maxToTip < curItem.quantity()){
curItem.quantity(curItem.quantity() - maxToTip);
} else {
curItem.detachAll(curUser.belongings.backpack);
}
TippedDart newDart = TippedDart.getTipped((Plant.Seed) item, maxToTip);
if (!newDart.collect()) Dungeon.level.drop(newDart, curUser.pos).sprite.drop();