Search in sources :

Example 1 with Key

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

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) {
            item.detachAll(backpack);
            // you keep the bag itself, not its contents.
            if (item instanceof Bag) {
                ((Bag) item).clear();
            }
            item.collect();
        } else if (!item.isEquipped(owner)) {
            item.detachAll(backpack);
        }
    }
    if (weapon != null) {
        weapon.cursed = false;
        weapon.activate(owner);
    }
    if (armor != null) {
        armor.cursed = false;
        armor.activate(owner);
    }
    if (misc1 != null) {
        misc1.cursed = false;
        misc1.activate(owner);
    }
    if (misc2 != null) {
        misc2.cursed = false;
        misc2.activate(owner);
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Bag(com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey) GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) Key(com.shatteredpixel.shatteredpixeldungeon.items.keys.Key)

Example 2 with Key

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

the class Hero method actPickUp.

private boolean actPickUp(HeroAction.PickUp action) {
    int dst = action.dst;
    if (pos == dst) {
        Heap heap = Dungeon.level.heaps.get(pos);
        if (heap != null) {
            Item item = heap.peek();
            if (item.doPickUp(this)) {
                heap.pickUp();
                if (item instanceof Dewdrop || item instanceof TimekeepersHourglass.sandBag || item instanceof DriedRose.Petal || item instanceof Key) {
                // Do Nothing
                } else {
                    boolean important = ((item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion) && ((Scroll) item).isKnown()) || ((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion) item).isKnown());
                    if (important) {
                        GLog.p(Messages.get(this, "you_now_have", item.name()));
                    } else {
                        GLog.i(Messages.get(this, "you_now_have", item.name()));
                    }
                }
                curAction = null;
            } else {
                heap.sprite.drop();
                ready();
            }
        } else {
            ready();
        }
        return false;
    } else if (getCloser(dst)) {
        return true;
    } else {
        ready();
        return false;
    }
}
Also used : PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) WndTradeItem(com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem) Dewdrop(com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey) GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) Key(com.shatteredpixel.shatteredpixeldungeon.items.keys.Key) CrystalKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)

Aggregations

Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)2 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)2 Key (com.shatteredpixel.shatteredpixeldungeon.items.keys.Key)2 SkeletonKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)2 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 Bag (com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag)1 CrystalKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey)1 PotionOfMight (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight)1 PotionOfStrength (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength)1 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)1 ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)1 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)1