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