Search in sources :

Example 11 with Room

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

the class StatuePainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY);
    Point c = room.center();
    int cx = c.x;
    int cy = c.y;
    Room.Door door = room.entrance();
    door.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
    if (door.x == room.left) {
        fill(level, room.right - 1, room.top + 1, 1, room.height() - 1, Terrain.STATUE);
        cx = room.right - 2;
    } else if (door.x == room.right) {
        fill(level, room.left + 1, room.top + 1, 1, room.height() - 1, Terrain.STATUE);
        cx = room.left + 2;
    } else if (door.y == room.top) {
        fill(level, room.left + 1, room.bottom - 1, room.width() - 1, 1, Terrain.STATUE);
        cy = room.bottom - 2;
    } else if (door.y == room.bottom) {
        fill(level, room.left + 1, room.top + 1, room.width() - 1, 1, Terrain.STATUE);
        cy = room.top + 2;
    }
    Statue statue = new Statue();
    statue.pos = cx + cy * Level.WIDTH;
    level.mobs.add(statue);
    Actor.occupyCell(statue);
}
Also used : Statue(com.watabou.pixeldungeon.actors.mobs.Statue) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 12 with Room

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

the class TrapsPainter method paint.

public static void paint(Level level, Room room) {
    Integer[] traps = { Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, Terrain.PARALYTIC_TRAP, Terrain.PARALYTIC_TRAP, !Dungeon.bossLevel(Dungeon.depth + 1) ? Terrain.CHASM : Terrain.SUMMONING_TRAP };
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Random.element(traps));
    Room.Door door = room.entrance();
    door.set(Room.Door.Type.REGULAR);
    int lastRow = level.map[room.left + 1 + (room.top + 1) * Level.WIDTH] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY;
    int x = -1;
    int y = -1;
    if (door.x == room.left) {
        x = room.right - 1;
        y = room.top + room.height() / 2;
        fill(level, x, room.top + 1, 1, room.height() - 1, lastRow);
    } else if (door.x == room.right) {
        x = room.left + 1;
        y = room.top + room.height() / 2;
        fill(level, x, room.top + 1, 1, room.height() - 1, lastRow);
    } else if (door.y == room.top) {
        x = room.left + room.width() / 2;
        y = room.bottom - 1;
        fill(level, room.left + 1, y, room.width() - 1, 1, lastRow);
    } else if (door.y == room.bottom) {
        x = room.left + room.width() / 2;
        y = room.top + 1;
        fill(level, room.left + 1, y, room.width() - 1, 1, lastRow);
    }
    int pos = x + y * Level.WIDTH;
    if (Random.Int(3) == 0) {
        if (lastRow == Terrain.CHASM) {
            set(level, pos, Terrain.EMPTY);
        }
        level.drop(prize(level), pos).type = Heap.Type.CHEST;
    } else {
        set(level, pos, Terrain.PEDESTAL);
        level.drop(prize(level), pos);
    }
    level.addItemToSpawn(new PotionOfLevitation());
}
Also used : PotionOfLevitation(com.watabou.pixeldungeon.items.potions.PotionOfLevitation) Room(com.watabou.pixeldungeon.levels.Room)

Example 13 with Room

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

the class TunnelPainter method paint.

public static void paint(Level level, Room room) {
    int floor = level.tunnelTile();
    Point c = room.center();
    if (room.width() > room.height() || (room.width() == room.height() && Random.Int(2) == 0)) {
        int from = room.right - 1;
        int to = room.left + 1;
        for (Room.Door door : room.connected.values()) {
            int step = door.y < c.y ? +1 : -1;
            if (door.x == room.left) {
                from = room.left + 1;
                for (int i = door.y; i != c.y; i += step) {
                    set(level, from, i, floor);
                }
            } else if (door.x == room.right) {
                to = room.right - 1;
                for (int i = door.y; i != c.y; i += step) {
                    set(level, to, i, floor);
                }
            } else {
                if (door.x < from) {
                    from = door.x;
                }
                if (door.x > to) {
                    to = door.x;
                }
                for (int i = door.y + step; i != c.y; i += step) {
                    set(level, door.x, i, floor);
                }
            }
        }
        for (int i = from; i <= to; i++) {
            set(level, i, c.y, floor);
        }
    } else {
        int from = room.bottom - 1;
        int to = room.top + 1;
        for (Room.Door door : room.connected.values()) {
            int step = door.x < c.x ? +1 : -1;
            if (door.y == room.top) {
                from = room.top + 1;
                for (int i = door.x; i != c.x; i += step) {
                    set(level, i, from, floor);
                }
            } else if (door.y == room.bottom) {
                to = room.bottom - 1;
                for (int i = door.x; i != c.x; i += step) {
                    set(level, i, to, floor);
                }
            } else {
                if (door.y < from) {
                    from = door.y;
                }
                if (door.y > to) {
                    to = door.y;
                }
                for (int i = door.x + step; i != c.x; i += step) {
                    set(level, i, door.y, floor);
                }
            }
        }
        for (int i = from; i <= to; i++) {
            set(level, c.x, i, floor);
        }
    }
    for (Room.Door door : room.connected.values()) {
        door.set(Room.Door.Type.TUNNEL);
    }
}
Also used : Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 14 with Room

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

the class AltarPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Dungeon.bossLevel(Dungeon.depth + 1) ? Terrain.HIGH_GRASS : Terrain.CHASM);
    Point c = room.center();
    Room.Door door = room.entrance();
    if (door.x == room.left || door.x == room.right) {
        Point p = drawInside(level, room, door, Math.abs(door.x - c.x) - 2, Terrain.EMPTY_SP);
        for (; p.y != c.y; p.y += p.y < c.y ? +1 : -1) {
            set(level, p, Terrain.EMPTY_SP);
        }
    } else {
        Point p = drawInside(level, room, door, Math.abs(door.y - c.y) - 2, Terrain.EMPTY_SP);
        for (; p.x != c.x; p.x += p.x < c.x ? +1 : -1) {
            set(level, p, Terrain.EMPTY_SP);
        }
    }
    fill(level, c.x - 1, c.y - 1, 3, 3, Terrain.EMBERS);
    set(level, c, Terrain.PEDESTAL);
    SacrificialFire fire = (SacrificialFire) level.blobs.get(SacrificialFire.class);
    if (fire == null) {
        fire = new SacrificialFire();
    }
    fire.seed(c.x + c.y * Level.WIDTH, 5 + Dungeon.depth * 5);
    level.blobs.put(SacrificialFire.class, fire);
    door.set(Room.Door.Type.EMPTY);
}
Also used : SacrificialFire(com.watabou.pixeldungeon.actors.blobs.SacrificialFire) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room)

Example 15 with Room

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

the class ArmoryPainter 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 statue = null;
    if (entrance.x == room.left) {
        statue = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.x == room.right) {
        statue = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.y == room.top) {
        statue = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
    } else if (entrance.y == room.bottom) {
        statue = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
    }
    if (statue != null) {
        set(level, statue, Terrain.STATUE);
    }
    int n = 3 + (Random.Int(4) == 0 ? 1 : 0);
    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