Search in sources :

Example 16 with Level

use of com.watabou.pixeldungeon.levels.Level in project pixel-dungeon-remix by NYRDS.

the class InterlevelScene method returnTo.

private void returnTo() throws IOException {
    Actor.fixTime();
    Dungeon.level.removePets();
    Dungeon.save();
    Dungeon.depth = DungeonGenerator.getLevelDepth(returnTo.levelId);
    Level level = Dungeon.loadLevel(returnTo);
    returnTo.computeCell(level);
    Dungeon.switchLevel(level, returnTo.cellId, returnTo.levelId);
    Dungeon.hero.spawnPets(level);
}
Also used : Level(com.watabou.pixeldungeon.levels.Level)

Example 17 with Level

use of com.watabou.pixeldungeon.levels.Level 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)

Example 18 with Level

use of com.watabou.pixeldungeon.levels.Level in project pixel-dungeon-remix by NYRDS.

the class King method summon.

private void summon() {
    lastPedestal = targetPedestal;
    getSprite().centerEmitter().start(Speck.factory(Speck.SCREAM), 0.4f, 2);
    Sample.INSTANCE.play(Assets.SND_CHALLENGE);
    int undeadsToSummon = maxArmySize() - Undead.count;
    Level level = Dungeon.level;
    for (int i = 0; i < undeadsToSummon; i++) {
        int pos = level.getEmptyCellNextTo(lastPedestal);
        if (level.cellValid(pos)) {
            Mob servant = new Undead();
            servant.setPos(pos);
            level.spawnMob(servant, 0);
            WandOfBlink.appear(servant, pos);
            new Flare(3, 32).color(0x000000, false).show(servant.getSprite(), 2f);
            Actor.addDelayed(new Pushing(servant, lastPedestal, servant.getPos()), -1);
        }
    }
    yell(Game.getVar(R.string.King_Info2));
}
Also used : UndeadMob(com.nyrds.pixeldungeon.mobs.necropolis.UndeadMob) Flare(com.watabou.pixeldungeon.effects.Flare) Pushing(com.watabou.pixeldungeon.effects.Pushing) Level(com.watabou.pixeldungeon.levels.Level)

Example 19 with Level

use of com.watabou.pixeldungeon.levels.Level in project pixel-dungeon-remix by NYRDS.

the class Mob method chooseNearestEnemyFromFraction.

private Char chooseNearestEnemyFromFraction(Fraction enemyFraction) {
    Level level = Dungeon.level;
    Char bestEnemy = DUMMY;
    float dist = level.getWidth() + level.getHeight();
    if (enemyFraction.belongsTo(Fraction.HEROES)) {
        Hero hero = Dungeon.hero;
        if (!friendly(hero)) {
            bestEnemy = hero;
            dist = level.distanceL2(getPos(), bestEnemy.getPos());
        }
    }
    for (Mob mob : level.mobs) {
        if (!mob.friendly(this)) {
            float candidateDist = level.distanceL2(getPos(), mob.getPos());
            if (candidateDist < dist) {
                bestEnemy = mob;
                dist = candidateDist;
            }
        }
    }
    return bestEnemy;
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Hero(com.watabou.pixeldungeon.actors.hero.Hero) Level(com.watabou.pixeldungeon.levels.Level)

Example 20 with Level

use of com.watabou.pixeldungeon.levels.Level in project pixel-dungeon by watabou.

the class InterlevelScene method descend.

private void descend() throws Exception {
    Actor.fixTime();
    if (Dungeon.hero == null) {
        Dungeon.init();
        if (noStory) {
            Dungeon.chapters.add(WndStory.ID_SEWERS);
            noStory = false;
        }
        GameLog.wipe();
    } else {
        Dungeon.saveLevel();
    }
    Level level;
    if (Dungeon.depth >= Statistics.deepestFloor) {
        level = Dungeon.newLevel();
    } else {
        Dungeon.depth++;
        level = Dungeon.loadLevel(Dungeon.hero.heroClass);
    }
    Dungeon.switchLevel(level, level.entrance);
}
Also used : Level(com.watabou.pixeldungeon.levels.Level)

Aggregations

Level (com.watabou.pixeldungeon.levels.Level)37 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)7 Char (com.watabou.pixeldungeon.actors.Char)5 DeadEndLevel (com.watabou.pixeldungeon.levels.DeadEndLevel)5 LevelObject (com.nyrds.pixeldungeon.levels.objects.LevelObject)4 Pushing (com.watabou.pixeldungeon.effects.Pushing)4 IceCavesLevel (com.nyrds.pixeldungeon.levels.IceCavesLevel)3 NecroLevel (com.nyrds.pixeldungeon.levels.NecroLevel)3 Position (com.nyrds.pixeldungeon.utils.Position)3 Heap (com.watabou.pixeldungeon.items.Heap)3 CavesBossLevel (com.watabou.pixeldungeon.levels.CavesBossLevel)3 CavesLevel (com.watabou.pixeldungeon.levels.CavesLevel)3 CityBossLevel (com.watabou.pixeldungeon.levels.CityBossLevel)3 CityLevel (com.watabou.pixeldungeon.levels.CityLevel)3 HallsBossLevel (com.watabou.pixeldungeon.levels.HallsBossLevel)3 HallsLevel (com.watabou.pixeldungeon.levels.HallsLevel)3 LastLevel (com.watabou.pixeldungeon.levels.LastLevel)3 LastShopLevel (com.watabou.pixeldungeon.levels.LastShopLevel)3 PrisonBossLevel (com.watabou.pixeldungeon.levels.PrisonBossLevel)3 PrisonLevel (com.watabou.pixeldungeon.levels.PrisonLevel)3