mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixed a bug that no lands were added to sealed/draft decks, if drafted with a set not included in a block and that itself does not include basic lands.
This commit is contained in:
parent
5317239a1b
commit
bbfd8de276
2 changed files with 22 additions and 0 deletions
|
@ -46,6 +46,7 @@ public class ModernMasters extends ExpansionSet {
|
||||||
|
|
||||||
private ModernMasters() {
|
private ModernMasters() {
|
||||||
super("Modern Masters", "MMA", "", "mage.sets.modernmasters", new GregorianCalendar(2016, 6, 7).getTime(), SetType.REPRINT);
|
super("Modern Masters", "MMA", "", "mage.sets.modernmasters", new GregorianCalendar(2016, 6, 7).getTime(), SetType.REPRINT);
|
||||||
|
this.hasBasicLands = false;
|
||||||
this.hasBoosters = true;
|
this.hasBoosters = true;
|
||||||
this.numBoosterLands = 0;
|
this.numBoosterLands = 0;
|
||||||
this.numBoosterCommon = 11;
|
this.numBoosterCommon = 11;
|
||||||
|
|
|
@ -215,6 +215,27 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (landSets.isEmpty()) {
|
||||||
|
// if set has no lands and also it has no parent or parent has no lands get last set with lands
|
||||||
|
// select a set with basic lands by random
|
||||||
|
Random generator = new Random();
|
||||||
|
int maxRndValue = 0;
|
||||||
|
String selectedSetCode = null;
|
||||||
|
for (ExpansionSet set :Sets.getInstance().getSortedByReleaseDate()) {
|
||||||
|
if (set.hasBasicLands) {
|
||||||
|
int rndValue = generator.nextInt(100);
|
||||||
|
if (rndValue >= maxRndValue) {
|
||||||
|
maxRndValue = rndValue;
|
||||||
|
selectedSetCode = set.getCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedSetCode != null) {
|
||||||
|
landSets.add(selectedSetCode);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("No set with basic land was found");
|
||||||
|
}
|
||||||
|
}
|
||||||
return landSets;
|
return landSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue