Search in sources :

Example 41 with Item

use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.

the class WandMaker method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (Quest.given) {
        Item item = Quest.alternative ? hero.belongings.getItem(CorpseDust.class) : hero.belongings.getItem(Rotberry.Seed.class);
        if (item != null) {
            GameScene.show(new WndWandmaker(this, item));
        } else {
            tell(Quest.alternative ? TXT_DUST2 : TXT_BERRY2, hero.className());
        }
    } else {
        tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1);
        Quest.given = true;
        Quest.placeItem();
        Journal.add(Journal.Feature.WANDMAKER.desc());
    }
    return true;
}
Also used : WndWandmaker(com.watabou.pixeldungeon.windows.WndWandmaker) Item(com.watabou.pixeldungeon.items.Item) CorpseDust(com.watabou.pixeldungeon.items.quest.CorpseDust)

Example 42 with Item

use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.

the class WndTradeItem method buy.

private void buy(Heap heap) {
    Hero hero = Dungeon.hero;
    Item item = heap.pickUp();
    int price = price(item);
    Dungeon.gold(Dungeon.gold() - price);
    GLog.i(TXT_BOUGHT, item.name(), price);
    if (!item.doPickUp(hero)) {
        Dungeon.level.drop(item, heap.pos).sprite.drop();
    }
    Item newItem;
    do {
        newItem = Generator.random();
    } while (newItem instanceof Gold);
    placeItemInShop(newItem);
}
Also used : Item(com.watabou.pixeldungeon.items.Item) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem) Gold(com.watabou.pixeldungeon.items.Gold) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 43 with Item

use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.

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));
    placeItem(stuff.armor != null ? stuff.armor : new Placeholder(ItemSpriteSheet.ARMOR));
    placeItem(stuff.ring1 != null ? stuff.ring1 : new Placeholder(ItemSpriteSheet.RING));
    placeItem(stuff.ring2 != null ? stuff.ring2 : new Placeholder(ItemSpriteSheet.RING));
    // Unequipped items
    for (Item item : container.items) {
        placeItem(item);
    }
    // Empty slots
    while (count - 4 < container.size) {
        placeItem(null);
    }
    // Gold
    if (container == Dungeon.hero.belongings.backpack) {
        row = nRows - 1;
        col = nCols - 1;
        placeItem(new Gold(Dungeon.gold()));
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) Gold(com.watabou.pixeldungeon.items.Gold) Belongings(com.watabou.pixeldungeon.actors.hero.Belongings)

Example 44 with Item

use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.

the class LootIndicator method update.

@Override
public void update() {
    if (Dungeon.hero.isReady()) {
        Heap heap = Dungeon.level.getHeap(Dungeon.hero.getPos());
        if (heap != null) {
            Item item = heap.type == Heap.Type.CHEST || heap.type == Heap.Type.MIMIC ? ItemSlot.CHEST : heap.type == Heap.Type.LOCKED_CHEST ? ItemSlot.LOCKED_CHEST : heap.type == Heap.Type.TOMB ? ItemSlot.TOMB : heap.type == Heap.Type.SKELETON ? ItemSlot.SKELETON : heap.peek();
            if (item != lastItem || item.quantity() != lastQuantity) {
                lastItem = item;
                lastQuantity = item.quantity();
                slot.item(item);
                flash();
            }
            setVisible(true);
        } else {
            lastItem = null;
            setVisible(false);
        }
    }
    slot.enable(getVisible() && Dungeon.hero.isReady());
    super.update();
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Heap(com.watabou.pixeldungeon.items.Heap)

Example 45 with Item

use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.

the class QuickSlot method createChildren.

@Override
protected void createChildren() {
    super.createChildren();
    slot = new ItemSlot() {

        @Override
        protected void onClick() {
            if (targeting) {
                GameScene.handleCell(lastTarget.getPos());
            } else {
                Item item = select();
                if (item == lastItem) {
                    useTargeting();
                } else {
                    lastItem = item;
                }
                if (item != null) {
                    item.execute(Dungeon.hero);
                }
            }
        }

        @Override
        protected boolean onLongClick() {
            return QuickSlot.this.onLongClick();
        }

        @Override
        protected void onTouchDown() {
            icon.lightness(0.7f);
        }

        @Override
        protected void onTouchUp() {
            icon.resetColor();
        }
    };
    add(slot);
    crossB = Icons.TARGET.get();
    crossB.setVisible(false);
    add(crossB);
    crossM = new Image();
    crossM.copy(crossB);
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Image(com.watabou.noosa.Image)

Aggregations

Item (com.watabou.pixeldungeon.items.Item)93 Hero (com.watabou.pixeldungeon.actors.hero.Hero)8 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)8 Heap (com.watabou.pixeldungeon.items.Heap)6 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)6 Point (com.watabou.utils.Point)6 ArrayList (java.util.ArrayList)6 IChaosItem (com.nyrds.pixeldungeon.items.chaos.IChaosItem)5 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)5 Gold (com.watabou.pixeldungeon.items.Gold)5 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)5 IActingItem (com.nyrds.pixeldungeon.items.artifacts.IActingItem)4 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)4 Wand (com.watabou.pixeldungeon.items.wands.Wand)4 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)3 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)3 TomeOfKnowledge (com.nyrds.pixeldungeon.items.books.TomeOfKnowledge)2 BlackSkull (com.nyrds.pixeldungeon.items.necropolis.BlackSkull)2 Char (com.watabou.pixeldungeon.actors.Char)2 Belongings (com.watabou.pixeldungeon.actors.hero.Belongings)2