Search in sources :

Example 6 with Level

use of com.shatteredpixel.shatteredpixeldungeon.levels.Level in project shattered-pixel-dungeon-gdx by 00-Evan.

the class InterlevelScene method returnTo.

private void returnTo() throws IOException {
    Actor.fixTime();
    DriedRose.holdGhostHero(Dungeon.level);
    Dungeon.saveAll();
    Dungeon.depth = returnDepth;
    Level level = Dungeon.loadLevel(GamesInProgress.curSlot);
    Dungeon.switchLevel(level, returnPos);
}
Also used : Level(com.shatteredpixel.shatteredpixeldungeon.levels.Level)

Example 7 with Level

use of com.shatteredpixel.shatteredpixeldungeon.levels.Level in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Dungeon method newLevel.

public static Level newLevel() {
    Dungeon.level = null;
    Actor.clear();
    depth++;
    if (depth > Statistics.deepestFloor) {
        Statistics.deepestFloor = depth;
        if (Statistics.qualifiedForNoKilling) {
            Statistics.completedWithNoKilling = true;
        } else {
            Statistics.completedWithNoKilling = false;
        }
    }
    Level level;
    switch(depth) {
        case 1:
        case 2:
        case 3:
        case 4:
            level = new SewerLevel();
            break;
        case 5:
            level = new SewerBossLevel();
            break;
        case 6:
        case 7:
        case 8:
        case 9:
            level = new PrisonLevel();
            break;
        case 10:
            level = new PrisonBossLevel();
            break;
        case 11:
        case 12:
        case 13:
        case 14:
            level = new CavesLevel();
            break;
        case 15:
            level = new CavesBossLevel();
            break;
        case 16:
        case 17:
        case 18:
        case 19:
            level = new CityLevel();
            break;
        case 20:
            level = new CityBossLevel();
            break;
        case 21:
            level = new LastShopLevel();
            break;
        case 22:
        case 23:
        case 24:
            level = new HallsLevel();
            break;
        case 25:
            level = new HallsBossLevel();
            break;
        case 26:
            level = new LastLevel();
            break;
        default:
            level = new DeadEndLevel();
            Statistics.deepestFloor--;
    }
    level.create();
    Statistics.qualifiedForNoKilling = !bossLevel();
    return level;
}
Also used : CityBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel) SewerLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel) SewerBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel) CityLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel) CavesBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel) PrisonBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel) LastShopLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel) LastLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastLevel) PrisonLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel) DeadEndLevel(com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel) SewerBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel) SewerLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel) PrisonBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel) CityBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel) CavesLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel) DeadEndLevel(com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel) LastLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastLevel) CityLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel) LastShopLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel) PrisonLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel) HallsBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsBossLevel) CavesBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel) HallsLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsLevel) Level(com.shatteredpixel.shatteredpixeldungeon.levels.Level) HallsLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsLevel) CavesLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel) HallsBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsBossLevel)

Example 8 with Level

use of com.shatteredpixel.shatteredpixeldungeon.levels.Level in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Dungeon method loadLevel.

public static Level loadLevel(int save) throws IOException {
    Dungeon.level = null;
    Actor.clear();
    Bundle bundle = FileUtils.bundleFromFile(GamesInProgress.depthFile(save, depth));
    Level level = (Level) bundle.get(LEVEL);
    if (level == null) {
        throw new IOException();
    } else {
        return level;
    }
}
Also used : Bundle(com.watabou.utils.Bundle) SewerBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel) SewerLevel(com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel) PrisonBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel) CityBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel) CavesLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel) DeadEndLevel(com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel) LastLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastLevel) CityLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel) LastShopLevel(com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel) PrisonLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel) HallsBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsBossLevel) CavesBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel) HallsLevel(com.shatteredpixel.shatteredpixeldungeon.levels.HallsLevel) Level(com.shatteredpixel.shatteredpixeldungeon.levels.Level) IOException(java.io.IOException)

Example 9 with Level

use of com.shatteredpixel.shatteredpixeldungeon.levels.Level in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Tengu method jump.

private void jump() {
    Level level = Dungeon.level;
    // incase tengu hasn't had a chance to act yet
    if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()) {
        fieldOfView = new boolean[Dungeon.level.length()];
        Dungeon.level.updateFieldOfView(this, fieldOfView);
    }
    if (enemy == null)
        enemy = chooseEnemy();
    if (enemy == null)
        return;
    int newPos;
    // if we're in phase 1, want to warp around within the room
    if (HP > HT / 2) {
        // place new traps
        for (int i = 0; i < 4; i++) {
            int trapPos;
            do {
                trapPos = Random.Int(level.length());
            } while (level.map[trapPos] != Terrain.INACTIVE_TRAP && level.map[trapPos] != Terrain.TRAP);
            if (level.map[trapPos] == Terrain.INACTIVE_TRAP) {
                level.setTrap(new GrippingTrap().reveal(), trapPos);
                Level.set(trapPos, Terrain.TRAP);
                ScrollOfMagicMapping.discover(trapPos);
            }
        }
        int tries = 50;
        do {
            newPos = Random.IntRange(3, 7) + 32 * Random.IntRange(26, 30);
        } while ((level.adjacent(newPos, enemy.pos) || Actor.findChar(newPos) != null) && --tries > 0);
        if (tries <= 0)
            return;
    // otherwise go wherever, as long as it's a little bit away
    } else {
        do {
            newPos = Random.Int(level.length());
        } while (level.solid[newPos] || level.distance(newPos, enemy.pos) < 8 || Actor.findChar(newPos) != null);
    }
    if (level.heroFOV[pos])
        CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6);
    sprite.move(pos, newPos);
    move(newPos);
    if (level.heroFOV[newPos])
        CellEmitter.get(newPos).burst(Speck.factory(Speck.WOOL), 6);
    Sample.INSTANCE.play(Assets.SND_PUFF);
    spend(1 / speed());
}
Also used : GrippingTrap(com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap) PrisonBossLevel(com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel) Level(com.shatteredpixel.shatteredpixeldungeon.levels.Level)

Example 10 with Level

use of com.shatteredpixel.shatteredpixeldungeon.levels.Level in project shattered-pixel-dungeon-gdx by 00-Evan.

the class InterlevelScene method restore.

private void restore() throws IOException {
    Actor.fixTime();
    DriedRose.clearHeldGhostHero();
    GameLog.wipe();
    Dungeon.loadGame(GamesInProgress.curSlot);
    if (Dungeon.depth == -1) {
        Dungeon.depth = Statistics.deepestFloor;
        Dungeon.switchLevel(Dungeon.loadLevel(GamesInProgress.curSlot), -1);
    } else {
        Level level = Dungeon.loadLevel(GamesInProgress.curSlot);
        Dungeon.switchLevel(level, Dungeon.hero.pos);
    }
}
Also used : Level(com.shatteredpixel.shatteredpixeldungeon.levels.Level)

Aggregations

Level (com.shatteredpixel.shatteredpixeldungeon.levels.Level)11 PrisonBossLevel (com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel)3 CavesBossLevel (com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel)2 CavesLevel (com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel)2 CityBossLevel (com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel)2 CityLevel (com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel)2 DeadEndLevel (com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel)2 HallsBossLevel (com.shatteredpixel.shatteredpixeldungeon.levels.HallsBossLevel)2 HallsLevel (com.shatteredpixel.shatteredpixeldungeon.levels.HallsLevel)2 LastLevel (com.shatteredpixel.shatteredpixeldungeon.levels.LastLevel)2 LastShopLevel (com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel)2 PrisonLevel (com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel)2 SewerBossLevel (com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel)2 SewerLevel (com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel)2 GrippingTrap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap)1 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)1 Starflower (com.shatteredpixel.shatteredpixeldungeon.plants.Starflower)1 Bundle (com.watabou.utils.Bundle)1 IOException (java.io.IOException)1