use of com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class PrisonBossLevel method resetTraps.
private void resetTraps() {
traps.clear();
for (int i = 0; i < length(); i++) {
if (map[i] == Terrain.INACTIVE_TRAP) {
Trap t = new GrippingTrap().reveal();
t.active = false;
setTrap(t, i);
map[i] = Terrain.INACTIVE_TRAP;
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap 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());
}
Aggregations