Search in sources :

Example 1 with Sheep

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep 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

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 SummoningTrap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap)1 Callback (com.watabou.utils.Callback)1