use of com.shatteredpixel.shatteredpixeldungeon.levels.traps.ToxicTrap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CavesBossLevel method build.
@Override
protected boolean build() {
setSize(WIDTH, HEIGHT);
Rect space = new Rect();
space.set(Random.IntRange(2, 2 + (int) (width * 0.2f)), Random.IntRange(2, 2 + (int) (height * 0.2f)), Random.IntRange((int) (width * 0.8f - 2), width - 2), Random.IntRange((int) (height * 0.8f - 2), height - 2));
Painter.fillEllipse(this, space, Terrain.EMPTY);
exit = space.left + space.width() / 2 + (space.top - 1) * width();
map[exit] = Terrain.LOCKED_EXIT;
Painter.fill(this, ROOM_LEFT - 1, ROOM_TOP - 1, ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL);
Painter.fill(this, ROOM_LEFT, ROOM_TOP + 1, ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP, Terrain.EMPTY);
Painter.fill(this, ROOM_LEFT, ROOM_TOP, ROOM_RIGHT - ROOM_LEFT + 1, 1, Terrain.EMPTY_DECO);
arenaDoor = Random.Int(ROOM_LEFT, ROOM_RIGHT) + (ROOM_BOTTOM + 1) * width();
map[arenaDoor] = Terrain.DOOR;
entrance = Random.Int(ROOM_LEFT + 1, ROOM_RIGHT - 1) + Random.Int(ROOM_TOP + 1, ROOM_BOTTOM - 1) * width();
map[entrance] = Terrain.ENTRANCE;
boolean[] patch = Patch.generate(width, height, 0.30f, 6, true);
for (int i = 0; i < length(); i++) {
if (map[i] == Terrain.EMPTY && patch[i]) {
map[i] = Terrain.WATER;
}
}
for (int i = 0; i < length(); i++) {
if (map[i] == Terrain.EMPTY && Random.Int(6) == 0) {
map[i] = Terrain.INACTIVE_TRAP;
Trap t = new ToxicTrap().reveal();
t.active = false;
setTrap(t, i);
}
}
for (int i = width() + 1; i < length() - width(); i++) {
if (map[i] == Terrain.EMPTY) {
int n = 0;
if (map[i + 1] == Terrain.WALL) {
n++;
}
if (map[i - 1] == Terrain.WALL) {
n++;
}
if (map[i + width()] == Terrain.WALL) {
n++;
}
if (map[i - width()] == Terrain.WALL) {
n++;
}
if (Random.Int(8) <= n) {
map[i] = Terrain.EMPTY_DECO;
}
}
}
for (int i = 0; i < length() - width(); i++) {
if (map[i] == Terrain.WALL && DungeonTileSheet.floorTile(map[i + width()]) && Random.Int(3) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
return true;
}