Search in sources :

Example 1 with DelayedMobSpawner

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);
            }
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) DelayedMobSpawner(com.watabou.pixeldungeon.actors.DelayedMobSpawner) Level(com.watabou.pixeldungeon.levels.Level)

Aggregations

DelayedMobSpawner (com.watabou.pixeldungeon.actors.DelayedMobSpawner)1 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)1 Level (com.watabou.pixeldungeon.levels.Level)1