use of com.shatteredpixel.shatteredpixeldungeon.actors.Actor in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Level method respawner.
public Actor respawner() {
return new Actor() {
{
// as if it were a buff.
actPriority = BUFF_PRIO;
}
@Override
protected boolean act() {
int count = 0;
for (Mob mob : mobs.toArray(new Mob[0])) {
if (mob.alignment == Char.Alignment.ENEMY)
count++;
}
if (count < nMobs()) {
Mob mob = createMob();
mob.state = mob.WANDERING;
mob.pos = randomRespawnCell();
if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos, mob.pos) >= 4) {
GameScene.add(mob);
if (Statistics.amuletObtained) {
mob.beckon(Dungeon.hero.pos);
}
}
}
if (Statistics.amuletObtained) {
spend(TIME_TO_RESPAWN / 2f);
} else if (Dungeon.level.feeling == Feeling.DARK) {
spend(2 * TIME_TO_RESPAWN / 3f);
} else {
spend(TIME_TO_RESPAWN);
}
return true;
}
};
}
Aggregations