Search in sources :

Example 46 with Item

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

the class DisarmingTrap method activate.

@Override
public void activate() {
    Heap heap = Dungeon.level.heaps.get(pos);
    if (heap != null) {
        int cell = Dungeon.level.randomRespawnCell();
        if (cell != -1) {
            Item item = heap.pickUp();
            Dungeon.level.drop(item, cell).seen = true;
            for (int i : PathFinder.NEIGHBOURS9) Dungeon.level.visited[cell + i] = true;
            GameScene.updateFog();
            Sample.INSTANCE.play(Assets.SND_TELEPORT);
            CellEmitter.get(pos).burst(Speck.factory(Speck.LIGHT), 4);
        }
    }
    if (Dungeon.hero.pos == pos) {
        Hero hero = Dungeon.hero;
        KindOfWeapon weapon = hero.belongings.weapon;
        if (weapon != null && !(weapon instanceof Knuckles) && !weapon.cursed) {
            int cell = Dungeon.level.randomRespawnCell();
            if (cell != -1) {
                hero.belongings.weapon = null;
                Dungeon.quickslot.clearItem(weapon);
                weapon.updateQuickslot();
                Dungeon.level.drop(weapon, cell).seen = true;
                for (int i : PathFinder.NEIGHBOURS9) Dungeon.level.visited[cell + i] = true;
                GameScene.updateFog();
                GLog.w(Messages.get(this, "disarm"));
                Sample.INSTANCE.play(Assets.SND_TELEPORT);
                CellEmitter.get(pos).burst(Speck.factory(Speck.LIGHT), 4);
            }
        }
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Knuckles(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 47 with Item

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

the class DistortionTrap method activate.

@Override
public void activate() {
    InterlevelScene.returnDepth = Dungeon.depth;
    Belongings belongings = Dungeon.hero.belongings;
    for (Notes.Record rec : Notes.getRecords()) {
        if (rec.depth() == Dungeon.depth) {
            Notes.remove(rec);
        }
    }
    for (Item i : belongings) {
        if (i instanceof LloydsBeacon && ((LloydsBeacon) i).returnDepth == Dungeon.depth)
            ((LloydsBeacon) i).returnDepth = -1;
    }
    InterlevelScene.mode = InterlevelScene.Mode.RESET;
    Game.switchScene(InterlevelScene.class);
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Belongings(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings) LloydsBeacon(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon) Notes(com.shatteredpixel.shatteredpixeldungeon.journal.Notes)

Example 48 with Item

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

the class ScrollOfRemoveCurse method uncurse.

public static boolean uncurse(Hero hero, Item... items) {
    boolean procced = false;
    for (Item item : items) {
        if (item != null && item.cursed) {
            item.cursed = false;
            procced = true;
        }
        if (item instanceof Weapon) {
            Weapon w = (Weapon) item;
            if (w.hasCurseEnchant()) {
                w.enchant(null);
                w.cursed = false;
                procced = true;
            }
        }
        if (item instanceof Armor) {
            Armor a = (Armor) item;
            if (a.hasCurseGlyph()) {
                a.inscribe(null);
                a.cursed = false;
                procced = true;
            }
        }
        if (item instanceof Bag) {
            for (Item bagItem : ((Bag) item).items) {
                if (bagItem != null && bagItem.cursed) {
                    bagItem.cursed = false;
                    procced = true;
                }
            }
        }
    }
    if (procced) {
        hero.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
        // for ring of might
        hero.updateHT(false);
    }
    return procced;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) WndBag(com.shatteredpixel.shatteredpixeldungeon.windows.WndBag) Bag(com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 49 with Item

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

the class Bag method onDetach.

@Override
public void onDetach() {
    this.owner = null;
    for (Item item : items) Dungeon.quickslot.clearItem(item);
    updateQuickslot();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item)

Example 50 with Item

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

the class PitfallTrap method activate.

@Override
public void activate() {
    Heap heap = Dungeon.level.heaps.get(pos);
    if (heap != null) {
        for (Item item : heap.items) {
            Dungeon.dropToChasm(item);
        }
        heap.sprite.kill();
        GameScene.discard(heap);
        Dungeon.level.heaps.remove(pos);
    }
    Char ch = Actor.findChar(pos);
    if (ch == Dungeon.hero) {
        Chasm.heroFall(pos);
    } else if (ch != null) {
        Chasm.mobFall((Mob) ch);
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Aggregations

Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)67 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)14 ArrayList (java.util.ArrayList)14 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)9 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)7 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)7 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)7 Point (com.watabou.utils.Point)7 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)6 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)5 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)4 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)4 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)4 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)3 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)3 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)3 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)2 Belongings (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings)2 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)2 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)2