Search in sources :

Example 46 with Item

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

the class WndChooseWay method btnBreakSpell.

private void btnBreakSpell(RedButton btnWay1) {
    RedButton btnWay2 = new RedButton(Utils.capitalize(TXT_BREAK_SPELL_BTN)) {

        @Override
        protected void onClick() {
            hide();
            Hero hero = Dungeon.hero;
            Item a = hero.belongings.getItem(BlackSkullOfMastery.class);
            a.removeItemFrom(hero);
            Item b = new BlackSkull();
            Dungeon.level.drop(b, hero.getPos()).sprite.drop();
        }
    };
    btnWay2.setRect(btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT);
    add(btnWay2);
}
Also used : Item(com.watabou.pixeldungeon.items.Item) MasteryItem(com.nyrds.pixeldungeon.items.common.MasteryItem) Hero(com.watabou.pixeldungeon.actors.hero.Hero) RedButton(com.watabou.pixeldungeon.ui.RedButton) BlackSkull(com.nyrds.pixeldungeon.items.necropolis.BlackSkull)

Example 47 with Item

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

the class Skeleton method dropLoot.

@Override
protected void dropLoot() {
    if (Random.Int(5) == 0) {
        Item loot = Generator.random(Generator.Category.WEAPON);
        for (int i = 0; i < 2; i++) {
            Item l = Generator.random(Generator.Category.WEAPON);
            if (l.level() < loot.level()) {
                loot = l;
            }
        }
        Dungeon.level.drop(loot, pos).sprite.drop();
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 48 with Item

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

the class Mob method dropLoot.

@SuppressWarnings("unchecked")
protected void dropLoot() {
    if (loot != null && Random.Float() < lootChance) {
        Item item = null;
        if (loot instanceof Generator.Category) {
            item = Generator.random((Generator.Category) loot);
        } else if (loot instanceof Class<?>) {
            item = Generator.random((Class<? extends Item>) loot);
        } else {
            item = (Item) loot;
        }
        Dungeon.level.drop(item, pos).sprite.drop();
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 49 with Item

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

the class Bag method collect.

@Override
public boolean collect(Bag container) {
    if (super.collect(container)) {
        owner = container.owner;
        for (Item item : container.items.toArray(new Item[0])) {
            if (grab(item)) {
                item.detachAll(container);
                item.collect(this);
            }
        }
        Badges.validateAllBagsBought(this);
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 50 with Item

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

the class CityBossLevel method createItems.

@Override
protected void createItems() {
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = Random.IntRange(LEFT + 1, LEFT + HALL_WIDTH - 2) + Random.IntRange(TOP + HALL_HEIGHT + 1, TOP + HALL_HEIGHT + CHAMBER_HEIGHT) * WIDTH;
        } while (pos == entrance || map[pos] == Terrain.SIGN);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

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