Search in sources :

Example 1 with SummoningTrap

use of com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SecretSummoningRoom method paint.

@Override
public void paint(Level level) {
    super.paint(level);
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.SECRET_TRAP);
    Point center = center();
    level.drop(Generator.random(), level.pointToCell(center)).type = Heap.Type.SKELETON;
    for (Point p : getPoints()) {
        int cell = level.pointToCell(p);
        if (level.map[cell] == Terrain.SECRET_TRAP) {
            level.setTrap(new SummoningTrap().hide(), cell);
        }
    }
    entrance().set(Door.Type.HIDDEN);
}
Also used : Point(com.watabou.utils.Point) SummoningTrap(com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap) Point(com.watabou.utils.Point)

Example 2 with SummoningTrap

use of com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap in project shattered-pixel-dungeon-gdx by 00-Evan.

the class CursedWand method rareEffect.

private static void rareEffect(final Wand wand, final Hero user, final Ballistica bolt) {
    switch(Random.Int(4)) {
        // sheep transformation
        case 0:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    Char ch = Actor.findChar(bolt.collisionPos);
                    if (ch != null && ch != user && !ch.properties().contains(Char.Property.BOSS) && !ch.properties().contains(Char.Property.MINIBOSS)) {
                        Sheep sheep = new Sheep();
                        sheep.lifespan = 10;
                        sheep.pos = ch.pos;
                        ch.destroy();
                        ch.sprite.killAndErase();
                        Dungeon.level.mobs.remove(ch);
                        TargetHealthIndicator.instance.target(null);
                        GameScene.add(sheep);
                        CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4);
                    } else {
                        GLog.i(Messages.get(CursedWand.class, "nothing"));
                    }
                    wand.wandUsed();
                }
            });
            break;
        // curses!
        case 1:
            CursingTrap.curse(user);
            wand.wandUsed();
            break;
        // inter-level teleportation
        case 2:
            if (Dungeon.depth > 1 && !Dungeon.bossLevel()) {
                // each depth has 1 more weight than the previous depth.
                float[] depths = new float[Dungeon.depth - 1];
                for (int i = 1; i < Dungeon.depth; i++) depths[i - 1] = i;
                int depth = 1 + Random.chances(depths);
                Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
                if (buff != null)
                    buff.detach();
                InterlevelScene.mode = InterlevelScene.Mode.RETURN;
                InterlevelScene.returnDepth = depth;
                InterlevelScene.returnPos = -1;
                Game.switchScene(InterlevelScene.class);
            } else {
                ScrollOfTeleportation.teleportHero(user);
                wand.wandUsed();
            }
            break;
        // summon monsters
        case 3:
            new SummoningTrap().set(user.pos).activate();
            wand.wandUsed();
            break;
    }
}
Also used : Callback(com.watabou.utils.Callback) TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Sheep(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep) SummoningTrap(com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)

Aggregations

SummoningTrap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)1 Sheep (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 Callback (com.watabou.utils.Callback)1 Point (com.watabou.utils.Point)1