Search in sources :

Example 1 with Key

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

the class Belongings method resurrect.

public void resurrect(int depth) {
    for (Item item : backpack.items.toArray(new Item[0])) {
        if (item instanceof Key) {
            if (((Key) item).depth == depth) {
                item.detachAll(backpack);
            }
        } else if (item.unique) {
        // Keep unique items
        } 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) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Key(com.watabou.pixeldungeon.items.keys.Key)

Example 2 with Key

use of com.watabou.pixeldungeon.items.keys.Key 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)

Aggregations

Item (com.watabou.pixeldungeon.items.Item)2 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)2 Key (com.watabou.pixeldungeon.items.keys.Key)2 Amulet (com.watabou.pixeldungeon.items.Amulet)1