use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class ScrollOfTerror method doRead.
@Override
protected void doRead() {
new Flare(5, 32).color(0xFF0000, true).show(curUser.sprite, 2f);
Sample.INSTANCE.play(Assets.SND_READ);
Invisibility.dispel();
int count = 0;
Mob affected = null;
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Level.fieldOfView[mob.pos]) {
Buff.affect(mob, Terror.class, Terror.DURATION).object = curUser.id();
count++;
affected = mob;
}
}
switch(count) {
case 0:
GLog.i("The scroll emits a brilliant flash of red light");
break;
case 1:
GLog.i("The scroll emits a brilliant flash of red light and the " + affected.name + " flees!");
break;
default:
GLog.i("The scroll emits a brilliant flash of red light and the monsters flee!");
}
setKnown();
readAnimation();
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class WandOfAvalanche method onZap.
@Override
protected void onZap(int cell) {
Sample.INSTANCE.play(Assets.SND_ROCKS);
int level = power();
Ballistica.distance = Math.min(Ballistica.distance, 8 + level);
int size = 1 + level / 3;
PathFinder.buildDistanceMap(cell, BArray.not(Level.solid, null), size);
int shake = 0;
for (int i = 0; i < Level.LENGTH; i++) {
int d = PathFinder.distance[i];
if (d < Integer.MAX_VALUE) {
Char ch = Actor.findChar(i);
if (ch != null) {
ch.sprite.flash();
ch.damage(Random.Int(2, 6 + (size - d) * 2), this);
if (ch.isAlive() && Random.Int(2 + d) == 0) {
Buff.prolong(ch, Paralysis.class, Random.IntRange(2, 6));
}
}
if (ch != null && ch.isAlive()) {
if (ch instanceof Mob) {
Dungeon.level.mobPress((Mob) ch);
} else {
Dungeon.level.press(i, ch);
}
} else {
Dungeon.level.press(i, null);
}
if (Dungeon.visible[i]) {
CellEmitter.get(i).start(Speck.factory(Speck.ROCK), 0.07f, 3 + (size - d));
if (Level.water[i]) {
GameScene.ripple(i);
}
if (shake < size - d) {
shake = size - d;
}
}
}
Camera.main.shake(3, 0.07f * (3 + shake));
}
if (!curUser.isAlive()) {
Dungeon.fail(Utils.format(ResultDescriptions.WAND, name, Dungeon.depth));
GLog.n("You killed yourself with your own Wand of Avalanche...");
}
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class CavesBossLevel method press.
@Override
public void press(int cell, Char hero) {
super.press(cell, hero);
if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
enteredArena = true;
Mob boss = Bestiary.mob(Dungeon.depth);
boss.state = boss.HUNTING;
do {
boss.pos = Random.Int(LENGTH);
} while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || Dungeon.visible[boss.pos]);
GameScene.add(boss);
set(arenaDoor, Terrain.WALL);
GameScene.updateMap(arenaDoor);
Dungeon.observe();
CellEmitter.get(arenaDoor).start(Speck.factory(Speck.ROCK), 0.07f, 10);
Camera.main.shake(3, 0.7f);
Sample.INSTANCE.play(Assets.SND_ROCKS);
}
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class CityBossLevel method press.
@Override
public void press(int cell, Char hero) {
super.press(cell, hero);
if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
enteredArena = true;
Mob boss = Bestiary.mob(Dungeon.depth);
boss.state = boss.HUNTING;
int count = 0;
do {
boss.pos = Random.Int(LENGTH);
} while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || (Dungeon.visible[boss.pos] && count++ < 20));
GameScene.add(boss);
if (Dungeon.visible[boss.pos]) {
boss.notice();
boss.sprite.alpha(0);
boss.sprite.parent.add(new AlphaTweener(boss.sprite, 1, 0.1f));
}
set(arenaDoor, Terrain.LOCKED_DOOR);
GameScene.updateMap(arenaDoor);
Dungeon.observe();
}
}
Aggregations