Search in sources :

Example 1 with Room

use of com.watabou.pixeldungeon.levels.Room in project pixel-dungeon by watabou.

the class PoolPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.WATER);
    Room.Door door = room.entrance();
    door.set(Room.Door.Type.REGULAR);
    int x = -1;
    int y = -1;
    if (door.x == room.left) {
        x = room.right - 1;
        y = room.top + room.height() / 2;
    } else if (door.x == room.right) {
        x = room.left + 1;
        y = room.top + room.height() / 2;
    } else if (door.y == room.top) {
        x = room.left + room.width() / 2;
        y = room.bottom - 1;
    } else if (door.y == room.bottom) {
        x = room.left + room.width() / 2;
        y = room.top + 1;
    }
    int pos = x + y * Level.WIDTH;
    level.drop(prize(level), pos).type = Random.Int(3) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
    set(level, pos, Terrain.PEDESTAL);
    level.addItemToSpawn(new PotionOfInvisibility());
    for (int i = 0; i < NPIRANHAS; i++) {
        Piranha piranha = new Piranha();
        do {
            piranha.pos = room.random();
        } while (level.map[piranha.pos] != Terrain.WATER || Actor.findChar(piranha.pos) != null);
        level.mobs.add(piranha);
        Actor.occupyCell(piranha);
    }
}
Also used : PotionOfInvisibility(com.watabou.pixeldungeon.items.potions.PotionOfInvisibility) Piranha(com.watabou.pixeldungeon.actors.mobs.Piranha) Room(com.watabou.pixeldungeon.levels.Room)

Example 2 with Room

use of com.watabou.pixeldungeon.levels.Room in project pixel-dungeon by watabou.

the class RatKingPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    Room.Door entrance = room.entrance();
    entrance.set(Room.Door.Type.HIDDEN);
    int door = entrance.x + entrance.y * Level.WIDTH;
    for (int i = room.left + 1; i < room.right; i++) {
        addChest(level, (room.top + 1) * Level.WIDTH + i, door);
        addChest(level, (room.bottom - 1) * Level.WIDTH + i, door);
    }
    for (int i = room.top + 2; i < room.bottom - 1; i++) {
        addChest(level, i * Level.WIDTH + room.left + 1, door);
        addChest(level, i * Level.WIDTH + room.right - 1, door);
    }
    while (true) {
        Heap chest = level.heaps.get(room.random());
        if (chest != null) {
            chest.type = Heap.Type.MIMIC;
            break;
        }
    }
    RatKing king = new RatKing();
    king.pos = room.random(1);
    level.mobs.add(king);
}
Also used : RatKing(com.watabou.pixeldungeon.actors.mobs.npcs.RatKing) Room(com.watabou.pixeldungeon.levels.Room) Heap(com.watabou.pixeldungeon.items.Heap)

Example 3 with Room

use of com.watabou.pixeldungeon.levels.Room in project pixel-dungeon by watabou.

the class BlacksmithPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.FIRE_TRAP);
    fill(level, room, 2, Terrain.EMPTY_SP);
    for (int i = 0; i < 2; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY_SP);
        level.drop(Generator.random(Random.oneOf(Generator.Category.ARMOR, Generator.Category.WEAPON)), pos);
    }
    for (Room.Door door : room.connected.values()) {
        door.set(Room.Door.Type.UNLOCKED);
        drawInside(level, room, door, 1, Terrain.EMPTY);
    }
    Blacksmith npc = new Blacksmith();
    do {
        npc.pos = room.random(1);
    } while (level.heaps.get(npc.pos) != null);
    level.mobs.add(npc);
    Actor.occupyCell(npc);
}
Also used : Blacksmith(com.watabou.pixeldungeon.actors.mobs.npcs.Blacksmith) Room(com.watabou.pixeldungeon.levels.Room)

Example 4 with Room

use of com.watabou.pixeldungeon.levels.Room in project pixel-dungeon by watabou.

the class LaboratoryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    Room.Door entrance = room.entrance();
    Point pot = null;
    if (entrance.x == room.left) {
        pot = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.x == room.right) {
        pot = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.y == room.top) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
    } else if (entrance.y == room.bottom) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
    }
    set(level, pot, Terrain.ALCHEMY);
    Alchemy alchemy = new Alchemy();
    alchemy.seed(pot.x + Level.WIDTH * pot.y, 1);
    level.blobs.put(Alchemy.class, alchemy);
    int n = Random.IntRange(2, 3);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : Alchemy(com.watabou.pixeldungeon.actors.blobs.Alchemy) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 5 with Room

use of com.watabou.pixeldungeon.levels.Room in project pixel-dungeon by watabou.

the class LibraryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY);
    Room.Door entrance = room.entrance();
    Point a = null;
    Point b = null;
    if (entrance.x == room.left) {
        a = new Point(room.left + 1, entrance.y - 1);
        b = new Point(room.left + 1, entrance.y + 1);
        fill(level, room.right - 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.x == room.right) {
        a = new Point(room.right - 1, entrance.y - 1);
        b = new Point(room.right - 1, entrance.y + 1);
        fill(level, room.left + 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.top) {
        a = new Point(entrance.x + 1, room.top + 1);
        b = new Point(entrance.x - 1, room.top + 1);
        fill(level, room.left + 1, room.bottom - 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.bottom) {
        a = new Point(entrance.x + 1, room.bottom - 1);
        b = new Point(entrance.x - 1, room.bottom - 1);
        fill(level, room.left + 1, room.top + 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    }
    if (a != null && level.map[a.x + a.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, a, Terrain.STATUE);
    }
    if (b != null && level.map[b.x + b.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, b, Terrain.STATUE);
    }
    int n = Random.IntRange(2, 3);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Aggregations

Room (com.watabou.pixeldungeon.levels.Room)16 Point (com.watabou.utils.Point)11 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)6 Alchemy (com.watabou.pixeldungeon.actors.blobs.Alchemy)1 SacrificialFire (com.watabou.pixeldungeon.actors.blobs.SacrificialFire)1 Piranha (com.watabou.pixeldungeon.actors.mobs.Piranha)1 Statue (com.watabou.pixeldungeon.actors.mobs.Statue)1 Blacksmith (com.watabou.pixeldungeon.actors.mobs.npcs.Blacksmith)1 RatKing (com.watabou.pixeldungeon.actors.mobs.npcs.RatKing)1 Heap (com.watabou.pixeldungeon.items.Heap)1 Item (com.watabou.pixeldungeon.items.Item)1 PotionOfInvisibility (com.watabou.pixeldungeon.items.potions.PotionOfInvisibility)1 PotionOfLevitation (com.watabou.pixeldungeon.items.potions.PotionOfLevitation)1 RegularLevel (com.watabou.pixeldungeon.levels.RegularLevel)1 ArrayList (java.util.ArrayList)1