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