use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WndAlchemy method combine.
private void combine() {
ArrayList<Item> ingredients = filterInput(Item.class);
Recipe recipe = Recipe.findRecipe(ingredients);
Item result = null;
if (recipe != null) {
result = recipe.brew(ingredients);
}
if (result != null) {
bubbleEmitter.start(Speck.factory(Speck.BUBBLE), 0.2f, 10);
smokeEmitter.burst(Speck.factory(Speck.WOOL), 10);
Sample.INSTANCE.play(Assets.SND_PUFF);
output.item(result);
if (!result.collect()) {
Dungeon.level.drop(result, Dungeon.hero.pos);
}
synchronized (inputs) {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i] != null && inputs[i].item != null) {
if (inputs[i].item.quantity() <= 0) {
inputs[i].slot.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
inputs[i].item = null;
} else {
inputs[i].slot.item(inputs[i].item);
}
}
}
}
btnCombine.enable(false);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WndBag method placeItems.
protected void placeItems(Bag container) {
// Equipped items
Belongings stuff = Dungeon.hero.belongings;
placeItem(stuff.weapon != null ? stuff.weapon : new Placeholder(ItemSpriteSheet.WEAPON_HOLDER));
placeItem(stuff.armor != null ? stuff.armor : new Placeholder(ItemSpriteSheet.ARMOR_HOLDER));
placeItem(stuff.misc1 != null ? stuff.misc1 : new Placeholder(ItemSpriteSheet.RING_HOLDER));
placeItem(stuff.misc2 != null ? stuff.misc2 : new Placeholder(ItemSpriteSheet.RING_HOLDER));
boolean backpack = (container == Dungeon.hero.belongings.backpack);
if (!backpack) {
count = nCols;
col = 0;
row = 1;
}
// Items in the bag
for (Item item : container.items.toArray(new Item[0])) {
placeItem(item);
}
// Free Space
while (count - (backpack ? 4 : nCols) < container.size) {
placeItem(null);
}
}
Aggregations