Search in sources :

Example 81 with Item

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

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[container.items.size()])) {
            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 82 with Item

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

the class Thief method steal.

protected boolean steal(Hero hero) {
    Item item = hero.belongings.randomUnequipped();
    if (item != null) {
        GLog.w(TXT_STOLE, this.getName(), item.name());
        item.detachAll(hero.belongings.backpack);
        this.item = item;
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 83 with Item

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

the class Ghost method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (hero.heroClass.equals(HeroClass.NECROMANCER)) {
        if (!introduced) {
            window = new WndSadGhostNecro();
            GameScene.show(window);
            introduced = true;
            return true;
        } else {
            if (window != null) {
                persuade = window.getPersuade();
            }
        }
    }
    Sample.INSTANCE.play(Assets.SND_GHOST);
    if (persuade || Quest.given) {
        Item item = Quest.alternative ? hero.belongings.getItem(RatSkull.class) : hero.belongings.getItem(DriedRose.class);
        if (persuade) {
            item = Quest.alternative ? new RatSkull() : new DriedRose();
        }
        if (persuade || item != null) {
            GameScene.show(new WndSadGhost(this, item));
        } else {
            GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT2 : TXT_ROSE2));
            int newPos = -1;
            for (int i = 0; i < 10; i++) {
                newPos = Dungeon.level.randomRespawnCell();
                if (newPos != -1) {
                    break;
                }
            }
            if (newPos != -1) {
                Actor.freeCell(getPos());
                CellEmitter.get(getPos()).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
                setPos(newPos);
                getSprite().place(getPos());
                getSprite().setVisible(Dungeon.visible[getPos()]);
            }
        }
    } else {
        GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT1 : TXT_ROSE1));
        Quest.given = true;
        Journal.add(Journal.Feature.GHOST.desc());
    }
    return true;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) WndQuest(com.watabou.pixeldungeon.windows.WndQuest) WndSadGhostNecro(com.nyrds.pixeldungeon.windows.WndSadGhostNecro) WndSadGhost(com.watabou.pixeldungeon.windows.WndSadGhost) DriedRose(com.watabou.pixeldungeon.items.quest.DriedRose) RatSkull(com.watabou.pixeldungeon.items.quest.RatSkull)

Example 84 with Item

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

the class HuntressArmor method doSpecial.

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

                @Override
                public void call() {
                    getCurUser().attack(targets.get(this));
                    targets.remove(this);
                    if (targets.isEmpty()) {
                        getCurUser().spendAndNext(getCurUser().attackDelay());
                    }
                }
            };
            ((MissileSprite) getCurUser().getSprite().getParent().recycle(MissileSprite.class)).reset(getCurUser().getPos(), mob.getPos(), proto, callback);
            targets.put(callback, mob);
        }
    }
    if (targets.size() == 0) {
        GLog.w(TXT_NO_ENEMIES);
        return;
    }
    getCurUser().getSprite().zap(getCurUser().getPos());
    getCurUser().busy();
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Shuriken(com.watabou.pixeldungeon.items.weapon.missiles.Shuriken) MissileSprite(com.watabou.pixeldungeon.sprites.MissileSprite)

Example 85 with Item

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

the class Belongings method discharge.

public int discharge() {
    int count = 0;
    for (Item item : this) {
        if (item instanceof Wand) {
            Wand wand = (Wand) item;
            if (wand.curCharges() > 0) {
                wand.curCharges(wand.curCharges() - 1);
                count++;
                wand.updateQuickslot();
            }
        }
    }
    return count;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Wand(com.watabou.pixeldungeon.items.wands.Wand)

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