private static Item prize(Level level) { Item prize = level.itemToSpanAsPrize(); if (prize != null) { return prize; } prize = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR)); for (int i = 0; i < 3; i++) { Item another = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR)); if (another.level > prize.level) { prize = another; } } return prize; }
private static Item prize(Level level) { Item prize = level.itemToSpanAsPrize(); if (prize instanceof Potion) { return prize; } else if (prize != null) { level.addItemToSpawn(prize); } return Generator.random(Generator.Category.POTION); }
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); } }
public Statue() { super(); do { weapon = (Weapon) Generator.random(Generator.Category.WEAPON); } while (!(weapon instanceof MeleeWeapon) || weapon.level < 0); weapon.identify(); weapon.enchant(Enchantment.random()); HP = HT = 15 + Dungeon.depth * 5; defenseSkill = 4 + Dungeon.depth; }
private static Item prize(Level level) { Item prize = level.itemToSpanAsPrize(); if (prize != null) { return prize; } return Generator.random( Random.oneOf( Generator.Category.POTION, Generator.Category.SCROLL, Generator.Category.FOOD, Generator.Category.GOLD)); }
public void wither() { Dungeon.level.uproot(pos); sprite.kill(); if (Dungeon.visible[pos]) { CellEmitter.get(pos).burst(LeafParticle.GENERAL, 6); } if (Dungeon.hero.subClass == HeroSubClass.WARDEN) { if (Random.Int(5) == 0) { Dungeon.level.drop(Generator.random(Generator.Category.SEED), pos).sprite.drop(); } if (Random.Int(5) == 0) { Dungeon.level.drop(new Dewdrop(), pos).sprite.drop(); } } }