Little fixes

This commit is contained in:
Oleg Agafonov 2019-11-30 00:23:51 +04:00
parent 11f5ae5b59
commit c02069114d
2 changed files with 31 additions and 31 deletions

View file

@ -480,19 +480,32 @@ public class AddLandDialog extends MageDialog {
white += m.getWhite();
}
int total = red + green + black + blue + white;
int redcards = Math.round(land_number * ((float) red / (float) total));
total -= red;
land_number -= redcards;
int greencards = Math.round(land_number * ((float) green / (float) total));
total -= green;
land_number -= greencards;
int blackcards = Math.round(land_number * ((float) black / (float) total));
total -= black;
land_number -= blackcards;
int bluecards = Math.round(land_number * ((float) blue / (float) total));
total -= blue;
land_number -= bluecards;
int whitecards = land_number;
int redcards = 0;
int greencards = 0;
int blackcards = 0;
int bluecards = 0;
int whitecards = 0;
if (total > 0) {
redcards = Math.round(land_number * ((float) red / (float) total));
total -= red;
land_number -= redcards;
greencards = Math.round(land_number * ((float) green / (float) total));
total -= green;
land_number -= greencards;
blackcards = Math.round(land_number * ((float) black / (float) total));
total -= black;
land_number -= blackcards;
bluecards = Math.round(land_number * ((float) blue / (float) total));
total -= blue;
land_number -= bluecards;
whitecards = land_number;
}
spnMountain.setValue(redcards);
spnForest.setValue(greencards);
spnSwamp.setValue(blackcards);