use of com.watabou.pixeldungeon.actors.DelayedMobSpawner in project pixel-dungeon-remix by NYRDS.
the class SummoningTrap method trigger.
public static void trigger(int pos, @Nullable Char c) {
if (Dungeon.bossLevel()) {
return;
}
if (c != null) {
Actor.occupyCell(c);
}
int nMobs = 3;
if (Random.Int(2) == 0) {
nMobs++;
if (Random.Int(2) == 0) {
nMobs++;
}
}
Level level = Dungeon.level;
for (int i = 0; i < nMobs; ++i) {
int cell = level.getEmptyCellNextTo(pos);
if (level.cellValid(cell)) {
Mob mob = placeMob(level, cell);
if (mob != null) {
mob.setState(mob.WANDERING);
Actor.addDelayed(new DelayedMobSpawner(mob, cell), 0.1f);
}
}
}
}
Aggregations