mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
* Fixed handling of standard set rotation(fixes #3260).
This commit is contained in:
parent
be03cf7a8f
commit
ab352a3c6b
1 changed files with 16 additions and 4 deletions
|
@ -24,11 +24,11 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.deck;
|
package mage.deck;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
@ -56,13 +56,18 @@ public class Standard extends Constructed {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
int blocksAdded = 0;
|
int blocksAdded = 0;
|
||||||
for (Iterator<ExpansionSet> iter = sets.iterator(); iter.hasNext() && blocksAdded < 3; ) {
|
int blocksToAdd = 3;
|
||||||
|
for (Iterator<ExpansionSet> iter = sets.iterator(); iter.hasNext() && blocksAdded < blocksToAdd;) {
|
||||||
ExpansionSet set = iter.next();
|
ExpansionSet set = iter.next();
|
||||||
if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION || set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) { // Still adding core sets because of Magic Origins
|
if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION || set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) { // Still adding core sets because of Magic Origins
|
||||||
|
|
||||||
setCodes.add(set.getCode());
|
setCodes.add(set.getCode());
|
||||||
if (set.getReleaseDate().before(current.getTime()) // This stops spoiled sets from counting as "new" blocks
|
if (set.getReleaseDate().before(current.getTime()) // This stops spoiled sets from counting as "new" blocks
|
||||||
&& set.getParentSet() == null
|
&& set.getParentSet() == null
|
||||||
&& set.getSetType() == SetType.EXPANSION) {
|
&& set.getSetType() == SetType.EXPANSION) {
|
||||||
|
if (blocksAdded == 0 && !isFallBlock(set)) { // if the most current block is a fall block, 4 blocks are added
|
||||||
|
blocksToAdd++;
|
||||||
|
}
|
||||||
blocksAdded++;
|
blocksAdded++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,4 +77,11 @@ public class Standard extends Constructed {
|
||||||
banned.add("Smuggler's Copter");
|
banned.add("Smuggler's Copter");
|
||||||
banned.add("Felidar Guardian");
|
banned.add("Felidar Guardian");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFallBlock(ExpansionSet set) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(set.getReleaseDate());
|
||||||
|
// Sets from fall block are normally released in September and January
|
||||||
|
return cal.get(Calendar.MONTH) > 8 || cal.get(Calendar.MONTH) < 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue