Search in sources :

Example 1 with ShopRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom 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 ShopRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom 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)

Aggregations

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