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;
}
}
Aggregations