Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void randomizeStatsWithinBST(Random random) {
- // Minimum 20 HP, 10 everything else
- int bst = bst() - 70;
- // Make weightings
- double hpW = random.nextDouble(), atkW = random.nextDouble(), defW = random.nextDouble();
- double spaW = random.nextDouble(), spdW = random.nextDouble(), speW = random.nextDouble();
- double totW = hpW + atkW + defW + spaW + spdW + speW;
- hp = (int) Math.max(1, Math.round(hpW / totW * bst)) + 20;
- attack = (int) Math.max(1, Math.round(atkW / totW * bst)) + 10;
- defense = (int) Math.max(1, Math.round(defW / totW * bst)) + 10;
- spatk = (int) Math.max(1, Math.round(spaW / totW * bst)) + 10;
- spdef = (int) Math.max(1, Math.round(spdW / totW * bst)) + 10;
- speed = (int) Math.max(1, Math.round(speW / totW * bst)) + 10:
- // Check for something we can't store
- if (hp > 255 || attack > 255 || defense > 255 || spatk > 255 || spdef > 255 || speed > 255) {
- // re roll
- randomizeStatsWithinBST(random);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement