Search in sources :

Example 1 with ExitRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom 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;
}
Also used : ShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom) ArrayList(java.util.ArrayList) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) PitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.PitRoom) ShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom) SpecialRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) SecretRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)

Example 2 with ExitRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom 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));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) MazeConnectionRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.MazeConnectionRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) ShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom) ConnectionRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom) SecretRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom)

Example 3 with ExitRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom 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;
}
Also used : ArrayList(java.util.ArrayList) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) ImpShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ImpShopRoom) ImpShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ImpShopRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom)

Example 4 with ExitRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom 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);
        }
    }
}
Also used : Collection(java.util.Collection) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) PitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.PitRoom) ShopRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom) SpecialRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom) ExitRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) SecretRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom) EntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom)

Aggregations

Room (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room)4 EntranceRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom)4 ExitRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom)4 SecretRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom)3 ShopRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom)3 StandardRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)3 PitRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.PitRoom)2 SpecialRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom)2 ArrayList (java.util.ArrayList)2 ConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom)1 MazeConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.MazeConnectionRoom)1 ImpShopRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ImpShopRoom)1 Collection (java.util.Collection)1 LinkedHashSet (java.util.LinkedHashSet)1