Search in sources :

Example 11 with Room

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room in project shattered-pixel-dungeon-gdx by 00-Evan.

the class RegularPainter method paintGrass.

protected void paintGrass(Level l, ArrayList<Room> rooms) {
    boolean[] grass = Patch.generate(l.width(), l.height(), grassFill, grassSmoothness, true);
    ArrayList<Integer> grassCells = new ArrayList<>();
    if (!rooms.isEmpty()) {
        for (Room r : rooms) {
            for (Point p : r.grassPlaceablePoints()) {
                int i = l.pointToCell(p);
                if (grass[i] && l.map[i] == Terrain.EMPTY) {
                    grassCells.add(i);
                }
            }
        }
    } else {
        for (int i = 0; i < l.length(); i++) {
            if (grass[i] && l.map[i] == Terrain.EMPTY) {
                grassCells.add(i);
            }
        }
    }
    // low smoothing, or very low fill, will begin to push the ratio down, normally to 50-30%
    for (int i : grassCells) {
        if (l.heaps.get(i) != null || l.findMob(i) != null) {
            l.map[i] = Terrain.GRASS;
            continue;
        }
        int count = 1;
        for (int n : PathFinder.NEIGHBOURS8) {
            if (grass[i + n]) {
                count++;
            }
        }
        l.map[i] = (Random.Float() < count / 12f) ? Terrain.HIGH_GRASS : Terrain.GRASS;
    }
}
Also used : ArrayList(java.util.ArrayList) Point(com.watabou.utils.Point) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) Point(com.watabou.utils.Point)

Example 12 with Room

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SewerBossLevel method createMobs.

@Override
protected void createMobs() {
    Goo boss = new Goo();
    Room room;
    do {
        room = randomRoom(StandardRoom.class);
    } while (room == roomEntrance);
    boss.pos = pointToCell(room.random());
    mobs.add(boss);
}
Also used : Goo(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Goo) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) SewerBossEntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) RatKingRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)

Example 13 with Room

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SewerBossLevel method initRooms.

@Override
protected ArrayList<Room> initRooms() {
    ArrayList<Room> initRooms = new ArrayList<>();
    initRooms.add(roomEntrance = roomExit = new SewerBossEntranceRoom());
    int standards = standardRooms();
    for (int i = 0; i < standards; i++) {
        initRooms.add(new EmptyRoom());
    }
    initRooms.add(new RatKingRoom());
    return initRooms;
}
Also used : RatKingRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) ArrayList(java.util.ArrayList) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) SewerBossEntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) RatKingRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) SewerBossEntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom)

Example 14 with Room

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room 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 15 with Room

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WalkwayRoom method paint.

@Override
public void paint(Level level) {
    if (Math.min(width(), height()) > 3) {
        Painter.fill(level, this, 1, Terrain.CHASM);
    }
    super.paint(level);
    for (Room r : neigbours) {
        if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom) {
            Rect i = intersect(r);
            if (i.width() != 0) {
                i.left++;
                i.right--;
            } else {
                i.top++;
                i.bottom--;
            }
            Painter.fill(level, i.left, i.top, i.width() + 1, i.height() + 1, Terrain.CHASM);
        }
    }
}
Also used : Rect(com.watabou.utils.Rect) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room)

Aggregations

Room (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room)28 ArrayList (java.util.ArrayList)15 StandardRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)11 EntranceRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom)10 ExitRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom)9 SecretRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom)8 ShopRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom)8 EmptyRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom)8 Point (com.watabou.utils.Point)7 PitRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.PitRoom)6 SpecialRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom)6 Rect (com.watabou.utils.Rect)6 ConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom)5 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)2 RegularLevel (com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel)2 MazeConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.MazeConnectionRoom)2 RatKingRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom)2 SewerBossEntranceRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)1