Beispiel #1
0
 public void prepare() {
   long seed = rand.getSeed();
   items.setSeed(seed);
   properties.setSeed(seed);
   createContent();
   Collections.sort(content);
   int coin = 5;
   int index = 1;
   for (Item item : content) {
     while (coin < item.cost) {
       itemsForCoins.put(coin, index);
       coin += 5;
     }
   }
 }
Beispiel #2
0
 public Item random(int coins, Randomizer rand) {
   Integer max = itemsForCoins.get(coins);
   if (max == null) max = items.size() - 1;
   return content.get(rand.nextInt(0, max));
 }