Updated how Standard and Brawl share legality

This commit is contained in:
Evan Kranzler 2018-07-09 10:31:30 -04:00
parent 2dc673207e
commit 0324c1ad9f
2 changed files with 27 additions and 61 deletions

View file

@ -3,11 +3,8 @@ package mage.deck;
import java.util.*;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
import mage.filter.FilterMana;
/**
@ -22,50 +19,11 @@ public class Brawl extends Constructed {
super("Brawl");
// Copy of standard sets
GregorianCalendar current = new GregorianCalendar();
List<ExpansionSet> sets = new ArrayList(Sets.getInstance().values());
Collections.sort(sets, new Comparator<ExpansionSet>() {
@Override
public int compare(final ExpansionSet lhs, ExpansionSet rhs) {
return lhs.getReleaseDate().after(rhs.getReleaseDate()) ? -1 : 1;
}
});
int fallSetsAdded = 0;
Date earliestDate = null;
// Get the second most recent fall set that's been released.
for (ExpansionSet set : sets) {
if (set.getReleaseDate().after(current.getTime())) {
continue;
}
if (isFallSet(set)) {
fallSetsAdded++;
if (fallSetsAdded == 2) {
earliestDate = set.getReleaseDate();
break;
}
}
}
// Get all sets released on or after the second most recent fall set's release
for (ExpansionSet set : sets) {
if ((set.getSetType() == SetType.CORE
|| set.getSetType() == SetType.EXPANSION
|| set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL)
&& (!set.getReleaseDate().before(earliestDate)
&& !set.getReleaseDate().after(current.getTime()))) {
setCodes.add(set.getCode());
}
}
setCodes.addAll(Standard.makeLegalSets());
banned.add("Baral, Chief of Compliance");
banned.add("Smuggler's Copter");
banned.add("Sorcerers' Spyglass");
}
private static boolean isFallSet(ExpansionSet set) {
Calendar cal = Calendar.getInstance();
cal.setTime(set.getReleaseDate());
// Fall sets are normally released during or after September
return set.getSetType() == SetType.EXPANSION
&& (cal.get(Calendar.MONTH) > 7);
banned.add("Sorcerous Spyglass");
}
public Brawl(String name) {

View file

@ -20,6 +20,28 @@ public class Standard extends Constructed {
public Standard() {
super("Constructed - Standard");
setCodes.addAll(makeLegalSets());
banned.add("Attune with Aether"); // since 2018-01-15
banned.add("Aetherworks Marvel");
banned.add("Felidar Guardian");
banned.add("Rampaging Ferocidon"); // since 2018-01-15
banned.add("Ramunap Ruins"); // since 2018-01-15
banned.add("Rogue Refiner"); // since 2018-01-15
banned.add("Smuggler's Copter");
}
private static boolean isFallSet(ExpansionSet set) {
Calendar cal = Calendar.getInstance();
cal.setTime(set.getReleaseDate());
// Fall sets are normally released during or after September
return set.getSetType() == SetType.EXPANSION
&& (cal.get(Calendar.MONTH) > 7);
}
public static List<String> makeLegalSets() {
List<String> codes = new ArrayList();
GregorianCalendar current = new GregorianCalendar();
List<ExpansionSet> sets = new ArrayList(Sets.getInstance().values());
Collections.sort(sets, new Comparator<ExpansionSet>() {
@ -50,23 +72,9 @@ public class Standard extends Constructed {
|| set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL)
&& !set.getReleaseDate().before(earliestDate)) {
// && !set.getReleaseDate().after(current.getTime()))) {
setCodes.add(set.getCode());
codes.add(set.getCode());
}
}
banned.add("Attune with Aether"); // since 2018-01-15
banned.add("Aetherworks Marvel");
banned.add("Felidar Guardian");
banned.add("Rampaging Ferocidon"); // since 2018-01-15
banned.add("Ramunap Ruins"); // since 2018-01-15
banned.add("Rogue Refiner"); // since 2018-01-15
banned.add("Smuggler's Copter");
}
private static boolean isFallSet(ExpansionSet set) {
Calendar cal = Calendar.getInstance();
cal.setTime(set.getReleaseDate());
// Fall sets are normally released during or after September
return set.getSetType() == SetType.EXPANSION
&& (cal.get(Calendar.MONTH) > 7);
return codes;
}
}