Search in sources :

Example 31 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class VaultRoom method prize.

private Item prize(Level level) {
    Generator.Category cat = prizeClasses.remove(0);
    Item prize = null;
    do {
        prize = Generator.random(cat);
    } while (prize == null || Challenges.isItemBlocked(prize));
    return prize;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Generator(com.shatteredpixel.shatteredpixeldungeon.items.Generator)

Example 32 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class HuntressArmor method doSpecial.

@Override
public void doSpecial() {
    Item proto = new Shuriken();
    for (Mob mob : Dungeon.level.mobs) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Callback callback = new Callback() {

                @Override
                public void call() {
                    curUser.attack(targets.get(this));
                    targets.remove(this);
                    if (targets.isEmpty()) {
                        curUser.spendAndNext(curUser.attackDelay());
                    }
                }
            };
            ((MissileSprite) curUser.sprite.parent.recycle(MissileSprite.class)).reset(curUser.pos, mob.pos, proto, callback);
            targets.put(callback, mob);
        }
    }
    if (targets.size() == 0) {
        GLog.w(Messages.get(this, "no_enemies"));
        return;
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.sprite.zap(curUser.pos);
    curUser.busy();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Shuriken(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken) MissileSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite)

Example 33 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ScrollOfIdentify method empoweredRead.

@Override
public void empoweredRead() {
    ArrayList<Item> unIDed = new ArrayList<>();
    for (Item i : curUser.belongings) {
        if (!i.isIdentified()) {
            unIDed.add(i);
        }
    }
    if (unIDed.size() > 1) {
        Random.element(unIDed).identify();
        Sample.INSTANCE.play(Assets.SND_TELEPORT);
    }
    doRead();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) ArrayList(java.util.ArrayList)

Example 34 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Bag method collect.

@Override
public boolean collect(Bag container) {
    for (Item item : container.items.toArray(new Item[0])) {
        if (grab(item)) {
            int slot = Dungeon.quickslot.getSlot(item);
            item.detachAll(container);
            if (!item.collect(this)) {
                item.collect(container);
            }
            if (slot != -1) {
                Dungeon.quickslot.setSlot(slot, item);
            }
        }
    }
    if (super.collect(container)) {
        owner = container.owner;
        Badges.validateAllBagsBought(this);
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item)

Example 35 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class QuickSlotButton method createChildren.

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

        @Override
        protected void onClick() {
            if (!Dungeon.hero.isAlive())
                return;
            if (NoosaInputProcessor.modifier) {
                onLongClick();
                return;
            }
            if (targeting) {
                int cell = autoAim(lastTarget, select(slotNum));
                if (cell != -1) {
                    GameScene.handleCell(cell);
                } else {
                    // couldn't auto-aim, just target the position and hope for the best.
                    GameScene.handleCell(lastTarget.pos);
                }
            } else {
                Item item = select(slotNum);
                if (item.usesTargeting)
                    useTargeting();
                item.execute(Dungeon.hero);
            }
        }

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

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

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

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