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.getWidth() * 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(level); } while (level.map[pos] != Terrain.EMPTY_SP || level.getHeap(pos) != null); level.drop(prize(level), pos); } entrance.set(Room.Door.Type.LOCKED); level.addItemToSpawn(new IronKey()); }
public static void paint(Level level, Room room) { fill(level, room, Terrain.WALL); fill(level, room, 1, Terrain.EMPTY); Room.Door entrance = room.entrance(); entrance.set(Room.Door.Type.LOCKED); Point well = null; if (entrance.x == room.left) { well = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1); } else if (entrance.x == room.right) { well = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1); } else if (entrance.y == room.top) { well = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1); } else if (entrance.y == room.bottom) { well = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1); } set(level, well, Terrain.EMPTY_WELL); int remains = room.random(); while (level.map[remains] == Terrain.EMPTY_WELL) { remains = room.random(); } level.drop(new IronKey(), remains).type = Type.SKELETON; if (Random.Int(5) == 0) { level.drop(Generator.random(Generator.Category.RING), remains); } else { level.drop( Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR)), remains); } int n = Random.IntRange(1, 2); for (int i = 0; i < n; i++) { level.drop(prize(level), remains); } }