Search in sources :

Example 86 with Item

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

the class Belongings method resurrect.

public void resurrect(int depth) {
    for (Item item : backpack.items.toArray(new Item[backpack.items.size()])) {
        if (item instanceof Key) {
            if (((Key) item).depth == depth) {
                item.detachAll(backpack);
            }
        } else if (item instanceof Amulet) {
        } else if (!item.isEquipped(owner)) {
            item.detachAll(backpack);
        }
    }
    if (weapon != null) {
        weapon.cursed = false;
        weapon.activate(owner);
    }
    if (armor != null) {
        armor.cursed = false;
    }
    if (ring1 != null) {
        ring1.cursed = false;
        ring1.activate(owner);
    }
    if (ring2 != null) {
        ring2.cursed = false;
        ring2.activate(owner);
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Amulet(com.watabou.pixeldungeon.items.Amulet) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Key(com.watabou.pixeldungeon.items.keys.Key)

Example 87 with Item

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

the class Belongings method charge.

public int charge(boolean full) {
    int count = 0;
    for (Item item : this) {
        if (item instanceof Wand) {
            Wand wand = (Wand) item;
            if (wand.curCharges() < wand.maxCharges()) {
                wand.curCharges(full ? wand.maxCharges() : wand.curCharges() + 1);
                count++;
                wand.updateQuickslot();
            }
        }
    }
    return count;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Wand(com.watabou.pixeldungeon.items.wands.Wand)

Example 88 with Item

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

the class Belongings method observe.

public void observe() {
    if (weapon != null) {
        weapon.identify();
        Badges.validateItemLevelAcquired(weapon);
    }
    if (armor != null) {
        armor.identify();
        Badges.validateItemLevelAcquired(armor);
    }
    if (ring1 != null) {
        ring1.identify();
        Badges.validateItemLevelAcquired(ring1);
    }
    if (ring2 != null) {
        ring2.identify();
        Badges.validateItemLevelAcquired(ring2);
    }
    for (Item item : backpack) {
        item.cursedKnown = true;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 89 with Item

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

the class Hero method actPickUp.

private boolean actPickUp(HeroAction.PickUp action) {
    int dst = action.dst;
    if (getPos() == dst) {
        Heap heap = Dungeon.level.getHeap(getPos());
        if (heap != null) {
            Item item = heap.pickUp();
            item = item.pick(this, getPos());
            if (item != null) {
                if (item.doPickUp(this)) {
                    itemPickedUp(item);
                    if (!heap.isEmpty()) {
                        GLog.i(TXT_SOMETHING_ELSE);
                    }
                    curAction = null;
                } else {
                    Heap newHeap = Dungeon.level.drop(item, getPos());
                    newHeap.sprite.drop();
                    newHeap.pickUpFailed();
                    ready();
                }
            } else {
                ready();
            }
        } else {
            ready();
        }
        return false;
    } else if (getCloser(dst)) {
        return true;
    } else {
        ready();
        return false;
    }
}
Also used : IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) Item(com.watabou.pixeldungeon.items.Item) WndTradeItem(com.watabou.pixeldungeon.windows.WndTradeItem) IActingItem(com.nyrds.pixeldungeon.items.artifacts.IActingItem) Heap(com.watabou.pixeldungeon.items.Heap)

Example 90 with Item

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

the class Hero method damage.

@Override
public void damage(int dmg, Object src) {
    restoreHealth = false;
    super.damage(dmg, src);
    checkIfFurious();
    interrupt();
    if (belongings.armor instanceof SpiderArmor) {
        // Armor proc
        if (Random.Int(100) < 50) {
            GameScene.add(Blob.seed(getPos(), Random.Int(5, 7), Web.class));
        }
    }
    for (Item item : belongings) {
        if (item instanceof IChaosItem && item.isEquipped(this)) {
            if (!(src instanceof Hunger)) {
                ((IChaosItem) item).ownerTakesDamage(dmg);
            }
        }
    }
}
Also used : IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) Item(com.watabou.pixeldungeon.items.Item) WndTradeItem(com.watabou.pixeldungeon.windows.WndTradeItem) IActingItem(com.nyrds.pixeldungeon.items.artifacts.IActingItem) Hunger(com.watabou.pixeldungeon.actors.buffs.Hunger) Web(com.watabou.pixeldungeon.actors.blobs.Web) IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) SpiderArmor(com.nyrds.pixeldungeon.items.common.armor.SpiderArmor)

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