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); }
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)); }
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; }