Search in sources :

Example 1 with PotionOfMight

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

the class Frost method attachTo.

@Override
public boolean attachTo(Char target) {
    if (super.attachTo(target)) {
        target.paralysed++;
        Buff.detach(target, Burning.class);
        Buff.detach(target, Chill.class);
        if (target instanceof Hero) {
            Hero hero = (Hero) target;
            ArrayList<Item> freezable = new ArrayList<>();
            // does not reach inside of containers
            for (Item i : hero.belongings.backpack.items) {
                if ((i instanceof Potion && !(i instanceof PotionOfStrength || i instanceof PotionOfMight)) || i instanceof MysteryMeat) {
                    freezable.add(i);
                }
            }
            if (!freezable.isEmpty()) {
                Item toFreeze = Random.element(freezable).detach(hero.belongings.backpack);
                if (toFreeze instanceof Potion) {
                    ((Potion) toFreeze).shatter(hero.pos);
                } else if (toFreeze instanceof MysteryMeat) {
                    FrozenCarpaccio carpaccio = new FrozenCarpaccio();
                    if (!carpaccio.collect(hero.belongings.backpack)) {
                        Dungeon.level.drop(carpaccio, target.pos).sprite.drop();
                    }
                }
                GLog.w(Messages.get(this, "freezes", toFreeze.toString()));
            }
        } else if (target instanceof Thief) {
            Item item = ((Thief) target).item;
            if (item instanceof Potion && !(item instanceof PotionOfStrength || item instanceof PotionOfMight)) {
                ((Potion) ((Thief) target).item).shatter(target.pos);
                ((Thief) target).item = null;
            } else if (item instanceof MysteryMeat) {
                ((Thief) target).item = new FrozenCarpaccio();
                ;
            }
        }
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) FrozenCarpaccio(com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio) PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ArrayList(java.util.ArrayList) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)

Example 2 with PotionOfMight

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

the class Heap method freeze.

public void freeze() {
    if (type == Type.MIMIC) {
        Mimic m = Mimic.spawnAt(pos, items);
        if (m != null) {
            Buff.prolong(m, Frost.class, Frost.duration(m) * Random.Float(1.0f, 1.5f));
            destroy();
        }
    }
    if (type != Type.HEAP) {
        return;
    }
    boolean frozen = false;
    for (Item item : items.toArray(new Item[0])) {
        if (item instanceof MysteryMeat) {
            replace(item, FrozenCarpaccio.cook((MysteryMeat) item));
            frozen = true;
        } else if (item instanceof Potion && !(item instanceof PotionOfStrength || item instanceof PotionOfMight)) {
            items.remove(item);
            ((Potion) item).shatter(pos);
            frozen = true;
        } else if (item instanceof Bomb) {
            ((Bomb) item).fuse = null;
            frozen = true;
        }
    }
    if (frozen) {
        if (isEmpty()) {
            destroy();
        } else if (sprite != null) {
            sprite.view(items.peek());
        }
    }
}
Also used : PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)

Example 3 with PotionOfMight

use of com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight 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

PotionOfMight (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight)3 PotionOfStrength (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength)3 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)2 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)2 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)1 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 FrozenCarpaccio (com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio)1 CrystalKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey)1 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)1 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)1 Key (com.shatteredpixel.shatteredpixeldungeon.items.keys.Key)1 SkeletonKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)1 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)1 ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)1 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)1