Search in sources :

Example 11 with Level

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

the class LevelObject method push.

public boolean push(Char hero) {
    Level level = Dungeon.level;
    int hx = level.cellX(hero.getPos());
    int hy = level.cellY(hero.getPos());
    int x = level.cellX(getPos());
    int y = level.cellY(getPos());
    int dx = x - hx;
    int dy = y - hy;
    if (dx * dy != 0) {
        return false;
    }
    int nextCell = level.cell(x + Util.signum(dx), y + Util.signum(dy));
    if (!level.cellValid(nextCell)) {
        return false;
    }
    if (level.solid[nextCell] || level.getLevelObject(nextCell, layer) != null) {
        return false;
    } else {
        level.press(nextCell, this);
        setPos(nextCell);
        level.levelObjectMoved(this);
    }
    return true;
}
Also used : Level(com.watabou.pixeldungeon.levels.Level)

Example 12 with Level

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

the class IceGuardianCore method die.

@Override
public void die(Object cause) {
    super.die(cause);
    Level level = Dungeon.level;
    for (Mob mob : level.getCopyOfMobsArray()) {
        if (mob instanceof IceGuardian) {
            mob.die(cause);
        }
    }
    level.unseal();
    GameScene.bossSlain();
    level.drop(new SkeletonKey(), getPos()).sprite.drop();
    level.drop(new IceKey(), getPos()).sprite.drop();
    Badges.validateBossSlain(Badges.Badge.ICE_GUARDIAN_SLAIN);
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) IceKey(com.nyrds.pixeldungeon.items.icecaves.IceKey) Level(com.watabou.pixeldungeon.levels.Level) SkeletonKey(com.watabou.pixeldungeon.items.keys.SkeletonKey)

Example 13 with Level

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

the class InterlevelScene method descend.

private void descend() throws IOException {
    Actor.fixTime();
    if (Dungeon.hero == null) {
        Dungeon.init();
        if (noStory) {
            Dungeon.chapters.add(WndStory.ID_SEWERS);
            noStory = false;
        }
    } else {
        Dungeon.level.removePets();
        Dungeon.save();
    }
    Position next = DungeonGenerator.descend(Dungeon.currentPosition());
    Dungeon.depth = DungeonGenerator.getLevelDepth(next.levelId);
    Level level = Dungeon.loadLevel(next);
    Dungeon.switchLevel(level, level.entrance, next.levelId);
    Dungeon.hero.spawnPets(level);
}
Also used : Position(com.nyrds.pixeldungeon.utils.Position) Level(com.watabou.pixeldungeon.levels.Level)

Example 14 with Level

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

the class InterlevelScene method fall.

private void fall() throws IOException {
    Actor.fixTime();
    Dungeon.level.removePets();
    Dungeon.save();
    Position next = DungeonGenerator.descend(Dungeon.currentPosition());
    Dungeon.depth = DungeonGenerator.getLevelDepth(next.levelId);
    Level level = Dungeon.loadLevel(next);
    Dungeon.switchLevel(level, fallIntoPit ? level.pitCell() : level.randomRespawnCell(), next.levelId);
}
Also used : Position(com.nyrds.pixeldungeon.utils.Position) Level(com.watabou.pixeldungeon.levels.Level)

Example 15 with Level

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

the class InterlevelScene method restore.

private void restore() throws IOException {
    Actor.fixTime();
    Dungeon.loadGame();
    if (Dungeon.hero == null) {
        problemWithSave();
    }
    if (Dungeon.depth == -1) {
        Dungeon.depth = Statistics.deepestFloor;
        Dungeon.switchLevel(Dungeon.loadLevel(Dungeon.currentPosition()), -1, Dungeon.hero.levelId);
    } else {
        Level level = Dungeon.loadLevel(Dungeon.currentPosition());
        if (level == null) {
            // save file fucked up :(
            problemWithSave();
            return;
        }
        Dungeon.switchLevel(level, Dungeon.hero.getPos(), Dungeon.hero.levelId);
    }
}
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