use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RegularLevel method initRooms.
protected ArrayList<Room> initRooms() {
ArrayList<Room> initRooms = new ArrayList<>();
initRooms.add(roomEntrance = new EntranceRoom());
initRooms.add(roomExit = new ExitRoom());
int standards = standardRooms();
for (int i = 0; i < standards; i++) {
StandardRoom s;
do {
s = StandardRoom.createRoom();
} while (!s.setSizeCat(standards - i));
i += s.sizeCat.roomValue - 1;
initRooms.add(s);
}
if (Dungeon.shopOnLevel())
initRooms.add(new ShopRoom());
int specials = specialRooms();
SpecialRoom.initForFloor();
for (int i = 0; i < specials; i++) initRooms.add(SpecialRoom.createRoom());
int secrets = SecretRoom.secretsForFloor(Dungeon.depth);
for (int i = 0; i < secrets; i++) initRooms.add(SecretRoom.createRoom());
return initRooms;
}
use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RegularBuilder method setupRooms.
protected void setupRooms(ArrayList<Room> rooms) {
for (Room r : rooms) {
r.setEmpty();
}
entrance = exit = shop = null;
singleConnections.clear();
multiConnections.clear();
for (Room r : rooms) {
if (r instanceof EntranceRoom) {
entrance = r;
} else if (r instanceof ExitRoom) {
exit = r;
} else if (r instanceof ShopRoom && r.maxConnections(Room.ALL) == 1) {
shop = r;
} else if (r.maxConnections(Room.ALL) > 1) {
multiConnections.add(r);
} else if (r.maxConnections(Room.ALL) == 1) {
singleConnections.add(r);
}
}
// this weights larger rooms to be much more likely to appear in the main loop, by placing them earlier in the multiconnections list
weightRooms(multiConnections);
Random.shuffle(multiConnections);
multiConnections = new ArrayList<>(new LinkedHashSet<>(multiConnections));
}
use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom in project shattered-pixel-dungeon-gdx by 00-Evan.
the class PrisonPainter method decorate.
@Override
protected void decorate(Level level, ArrayList<Room> rooms) {
for (Room r : rooms) {
if (r instanceof EntranceRoom) {
Wandmaker.Quest.spawnWandmaker(level, r);
break;
}
}
int w = level.width();
int l = level.length();
int[] map = level.map;
for (int i = w + 1; i < l - w - 1; i++) {
if (map[i] == Terrain.EMPTY) {
float c = 0.05f;
if (map[i + 1] == Terrain.WALL && map[i + w] == Terrain.WALL) {
c += 0.2f;
}
if (map[i - 1] == Terrain.WALL && map[i + w] == Terrain.WALL) {
c += 0.2f;
}
if (map[i + 1] == Terrain.WALL && map[i - w] == Terrain.WALL) {
c += 0.2f;
}
if (map[i - 1] == Terrain.WALL && map[i - w] == Terrain.WALL) {
c += 0.2f;
}
if (Random.Float() < c) {
map[i] = Terrain.EMPTY_DECO;
}
}
}
for (int i = 0; i < w; i++) {
if (map[i] == Terrain.WALL && (map[i + w] == Terrain.EMPTY || map[i + w] == Terrain.EMPTY_SP) && Random.Int(6) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
for (int i = w; i < l - w; i++) {
if (map[i] == Terrain.WALL && map[i - w] == Terrain.WALL && (map[i + w] == Terrain.EMPTY || map[i + w] == Terrain.EMPTY_SP) && Random.Int(3) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom in project shattered-pixel-dungeon-gdx by 00-Evan.
the class LastShopLevel method initRooms.
@Override
protected ArrayList<Room> initRooms() {
ArrayList<Room> rooms = new ArrayList<>();
rooms.add(roomEntrance = new EntranceRoom());
rooms.add(new ImpShopRoom());
rooms.add(roomExit = new ExitRoom());
return rooms;
}
use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RegularLevel method restoreFromBundle.
@SuppressWarnings("unchecked")
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
rooms = new ArrayList<>((Collection<Room>) ((Collection<?>) bundle.getCollection("rooms")));
for (Room r : rooms) {
r.onLevelLoad(this);
if (r instanceof EntranceRoom || r.legacyType.equals("ENTRANCE")) {
roomEntrance = r;
} else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")) {
roomExit = r;
}
}
if (bundle.contains("mobs_to_spawn")) {
for (Class<? extends Mob> mob : bundle.getClassArray("mobs_to_spawn")) {
if (mob != null)
mobsToSpawn.add(mob);
}
}
}
Aggregations