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);
}
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;
}
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;
}
}
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());
}
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);
}
}
Aggregations