Search in sources :

Example 66 with Item

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);
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Recipe(com.shatteredpixel.shatteredpixeldungeon.items.Recipe)

Example 67 with Item

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);
    }
}
Also used : EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Belongings(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings)

Aggregations

Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)67 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)14 ArrayList (java.util.ArrayList)14 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)9 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)7 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)7 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)7 Point (com.watabou.utils.Point)7 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)6 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)5 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)4 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)4 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)4 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)3 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)3 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)3 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)2 Belongings (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings)2 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)2 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)2