Search in sources :

Example 21 with Heap

use of com.shatteredpixel.shatteredpixeldungeon.items.Heap 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 22 with Heap

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

the class ScrollOfRage method doRead.

@Override
public void doRead() {
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        mob.beckon(curUser.pos);
        if (Dungeon.level.heroFOV[mob.pos]) {
            Buff.prolong(mob, Amok.class, 5f);
        }
    }
    for (Heap heap : Dungeon.level.heaps.values()) {
        if (heap.type == Heap.Type.MIMIC) {
            Mimic m = Mimic.spawnAt(heap.pos, heap.items);
            if (m != null) {
                m.beckon(curUser.pos);
                heap.destroy();
            }
        }
    }
    GLog.w(Messages.get(this, "roar"));
    setKnown();
    curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
    Sample.INSTANCE.play(Assets.SND_CHALLENGE);
    Invisibility.dispel();
    readAnimation();
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 23 with Heap

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

the class CellSelector method onClick.

@Override
protected void onClick(NoosaInputProcessor.Touch touch) {
    if (dragging) {
        dragging = false;
    } else {
        PointF p = Camera.main.screenToCamera((int) touch.current.x, (int) touch.current.y);
        for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])) {
            if (mob.sprite != null && mob.sprite.overlapsPoint(p.x, p.y)) {
                select(mob.pos);
                return;
            }
        }
        for (Heap heap : Dungeon.level.heaps.values()) {
            if (heap.sprite != null && heap.sprite.overlapsPoint(p.x, p.y)) {
                select(heap.pos);
                return;
            }
        }
        select(((DungeonTilemap) target).screenToTile((int) touch.current.x, (int) touch.current.y, true));
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) PointF(com.watabou.utils.PointF) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 24 with Heap

use of com.shatteredpixel.shatteredpixeldungeon.items.Heap 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)

Example 25 with Heap

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

the class TeleportationTrap method activate.

@Override
public void activate() {
    CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
    Sample.INSTANCE.play(Assets.SND_TELEPORT);
    Char ch = Actor.findChar(pos);
    if (ch instanceof Hero) {
        ScrollOfTeleportation.teleportHero((Hero) ch);
    } else if (ch != null) {
        int count = 10;
        int pos;
        do {
            pos = Dungeon.level.randomRespawnCell();
            if (count-- <= 0) {
                break;
            }
        } while (pos == -1);
        if (pos == -1 || Dungeon.bossLevel()) {
            GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
        } else {
            ch.pos = pos;
            if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
                ((Mob) ch).state = ((Mob) ch).WANDERING;
            }
            ch.sprite.place(ch.pos);
            ch.sprite.visible = Dungeon.level.heroFOV[pos];
        }
    }
    Heap heap = Dungeon.level.heaps.get(pos);
    if (heap != null) {
        int cell = Dungeon.level.randomRespawnCell();
        Item item = heap.pickUp();
        if (cell != -1) {
            Dungeon.level.drop(item, cell);
        }
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Aggregations

Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)33 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)14 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)13 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)11 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)5 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)4 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)4 ArrayList (java.util.ArrayList)4 CrystalKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey)3 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)2 Awareness (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness)2 Chill (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill)2 Frost (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost)2 MindVision (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision)2 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)2 SkeletonKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)2 Trap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap)2 CustomTiledVisual (com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual)2 WndInfoMob (com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoMob)2 WndInfoPlant (com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant)2