diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java index c37f03fece1..1d5e9938860 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java @@ -1,17 +1,13 @@ - - package mage.deck; import mage.cards.ExpansionSet; import mage.cards.Sets; import mage.cards.decks.Constructed; -import mage.constants.SetType; import java.util.Calendar; import java.util.GregorianCalendar; /** - * * @author BetaSteward_at_googlemail.com */ public class Extended extends Constructed { @@ -22,13 +18,11 @@ public class Extended extends Constructed { GregorianCalendar cutoff; if (current.get(Calendar.MONTH) > 9) { cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 3, Calendar.SEPTEMBER, 1); - } - else { + } else { cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 4, Calendar.SEPTEMBER, 1); } - for (ExpansionSet set: Sets.getInstance().values()) { - if (set.getReleaseDate().after(cutoff.getTime()) && - (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION)) { + for (ExpansionSet set : Sets.getInstance().values()) { + if (set.isStandardLegal() && set.getReleaseDate().after(cutoff.getTime())) { setCodes.add(set.getCode()); } } @@ -38,6 +32,6 @@ public class Extended extends Constructed { banned.add("Ponder"); banned.add("Preordain"); banned.add("Stoneforge Mystic"); - + } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Frontier.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Frontier.java index 843825bdf57..8c9a30a67fa 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Frontier.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Frontier.java @@ -1,15 +1,13 @@ - package mage.deck; -import java.util.Date; -import java.util.GregorianCalendar; import mage.cards.ExpansionSet; import mage.cards.Sets; import mage.cards.decks.Constructed; -import mage.constants.SetType; + +import java.util.Date; +import java.util.GregorianCalendar; /** - * * @author fireshoes */ public class Frontier extends Constructed { @@ -19,8 +17,7 @@ public class Frontier extends Constructed { Date cutoff = new GregorianCalendar(2014, 6, 18).getTime(); // M15 release date for (ExpansionSet set : Sets.getInstance().values()) { - if ((set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff)) - && (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION)) { + if (set.isStandardLegal() && (set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff))) { setCodes.add(set.getCode()); } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/HistoricalType2.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/HistoricalType2.java index 02aff6b5ab3..ed2a3f037ed 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/HistoricalType2.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/HistoricalType2.java @@ -1,24 +1,19 @@ package mage.deck; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Map; import mage.cards.ExpansionSet; import mage.cards.Sets; import mage.cards.decks.Constructed; import mage.cards.decks.Deck; -import mage.constants.SetType; + +import java.util.*; /** * This class represents a deck from any past standard. - * + *
* This class was originally made to work with the historical standard ruleset. * Data taken from http://thattournament.website/historic-tournament.php (site * changed, originally http://mtgt.nfshost.com/historic-tournament.php) - * + *
* If there are any questions or corrections, feel free to contact me.
*
* @author Marthinwurer (at gmail.com)
@@ -30,54 +25,54 @@ public class HistoricalType2 extends Constructed {
* Kamigawa/Ravnica standard, where rotation stabilized.
*/
protected static final String[][] standards = {
- // 1st standard: The Dark, Fallen Empires, and 4th.
- {"DRK", "FEM", "4ED"},
- // 2nd standard: 4th, Fallen Empires, Ice Age, Chronicles, Homelands,
- // Alliances, and Mirage.
- {"FEM", "4ED", "ICE", "CHR", "HML", "ALL", "MIR"},
- // 3rd standard: 4th, Chronicles, Alliances, Mirage, Visions.
- {"4ED", "CHR", "ALL", "MIR", "VIS"},
- // 4th Standard: Ice Age, Homelands, Alliances, Mirage, Visions, 5th,
- // and Weatherlight.
- {"ICE", "HML", "ALL", "MIR", "VIS", "5ED", "WTH"},
- // 5th Standard: Mirage, Visions, 5th, Weatherlight, Tempest,
- // Stronghold, and Exodus.
- {"MIR", "VIS", "5ED", "WTH", "TMP", "STH", "EXO"},
- // 6th Standard: 5th, Tempest, Stronghold, Exodus, Urza's Saga, Urza's
- // Legacy, Urza's Destiny.
- {"5ED", "TMP", "STH", "EXO", "USG", "ULG"},
- // 7th Standard: Tempest, Stronghold, Exodus, Urza's Saga, Urza's
- // Legacy, 6th, Urza's Destiny.
- {"TMP", "STH", "EXO", "USG", "ULG", "6ED", "UDS"},
- // 8th Standard: Urza's Saga, Urza's Legacy, 6th, Urza's Destiny,
- // Mercadian Masques, Nemesis, Prophecy.
- {"USG", "ULG", "6ED", "UDS", "MMQ", "NEM", "PCY"},
- // 9th Standard
- {"6ED", "MMQ", "NEM", "PCY", "INV", "PLS"},
- // 10th Standard
- {"7ED", "MMQ", "NEM", "PCY", "INV", "PLS", "APC"},
- // 11th Standard
- {"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
- // 12th Standard
- {"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
- // 13th Standard
- {"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
- // 14th Standard
- {"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
- // 15th Standard
- {"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
- // 16th Standard
- {"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
- // 17th Standard
- {"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
- // 18th Standard
- {"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
- // 19th Standard
- {"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
- // 20th Standard
- {"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
- // 21st Standard
- {"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
+ // 1st standard: The Dark, Fallen Empires, and 4th.
+ {"DRK", "FEM", "4ED"},
+ // 2nd standard: 4th, Fallen Empires, Ice Age, Chronicles, Homelands,
+ // Alliances, and Mirage.
+ {"FEM", "4ED", "ICE", "CHR", "HML", "ALL", "MIR"},
+ // 3rd standard: 4th, Chronicles, Alliances, Mirage, Visions.
+ {"4ED", "CHR", "ALL", "MIR", "VIS"},
+ // 4th Standard: Ice Age, Homelands, Alliances, Mirage, Visions, 5th,
+ // and Weatherlight.
+ {"ICE", "HML", "ALL", "MIR", "VIS", "5ED", "WTH"},
+ // 5th Standard: Mirage, Visions, 5th, Weatherlight, Tempest,
+ // Stronghold, and Exodus.
+ {"MIR", "VIS", "5ED", "WTH", "TMP", "STH", "EXO"},
+ // 6th Standard: 5th, Tempest, Stronghold, Exodus, Urza's Saga, Urza's
+ // Legacy, Urza's Destiny.
+ {"5ED", "TMP", "STH", "EXO", "USG", "ULG"},
+ // 7th Standard: Tempest, Stronghold, Exodus, Urza's Saga, Urza's
+ // Legacy, 6th, Urza's Destiny.
+ {"TMP", "STH", "EXO", "USG", "ULG", "6ED", "UDS"},
+ // 8th Standard: Urza's Saga, Urza's Legacy, 6th, Urza's Destiny,
+ // Mercadian Masques, Nemesis, Prophecy.
+ {"USG", "ULG", "6ED", "UDS", "MMQ", "NEM", "PCY"},
+ // 9th Standard
+ {"6ED", "MMQ", "NEM", "PCY", "INV", "PLS"},
+ // 10th Standard
+ {"7ED", "MMQ", "NEM", "PCY", "INV", "PLS", "APC"},
+ // 11th Standard
+ {"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
+ // 12th Standard
+ {"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
+ // 13th Standard
+ {"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
+ // 14th Standard
+ {"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
+ // 15th Standard
+ {"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
+ // 16th Standard
+ {"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
+ // 17th Standard
+ {"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
+ // 18th Standard
+ {"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
+ // 19th Standard
+ {"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
+ // 20th Standard
+ {"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
+ // 21st Standard
+ {"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
};
/**
@@ -109,15 +104,6 @@ public class HistoricalType2 extends Constructed {
@Override
public boolean validate(Deck deck) {
- // debug code for finding set info
-// System.out.println();
-// for (ExpansionSet set : Sets.getInstance().values()) {
-// if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION) {
-// System.out.println("Set:\t" + set.getCode() + "\t" + set.getReleaseDate() + "\t" + set.getName() + "\t" + set.getBlockName());
-// }
-// }
-
-
Map
* This class was originally made to work with the historical standard ruleset.
* Data taken from http://thattournament.website/historic-tournament.php (site
* changed, originally http://mtgt.nfshost.com/historic-tournament.php)
- *
+ *
* If there are any questions or corrections, feel free to contact me.
*
* @author Marthinwurer (at gmail.com)
@@ -32,28 +27,28 @@ public class SuperType2 extends Constructed {
* Data taken from http://thattournament.website/historic-tournament.php
*/
protected static final String[][] standards = {
- // 11th Standard
- {"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
- // 12th Standard
- {"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
- // 13th Standard
- {"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
- // 14th Standard
- {"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
- // 15th Standard
- {"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
- // 16th Standard
- {"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
- // 17th Standard
- {"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
- // 18th Standard
- {"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
- // 19th Standard
- {"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
- // 20th Standard
- {"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
- // 21st Standard
- {"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
+ // 11th Standard
+ {"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
+ // 12th Standard
+ {"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
+ // 13th Standard
+ {"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
+ // 14th Standard
+ {"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
+ // 15th Standard
+ {"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
+ // 16th Standard
+ {"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
+ // 17th Standard
+ {"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
+ // 18th Standard
+ {"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
+ // 19th Standard
+ {"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
+ // 20th Standard
+ {"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
+ // 21st Standard
+ {"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
};
/**
@@ -159,9 +154,9 @@ public class SuperType2 extends Constructed {
// Get the sets in that time period.
// (code taken from standard.java)
for (ExpansionSet set : Sets.getInstance().values()) {
- if (set.getReleaseDate().after(start.getTime())
- && set.getReleaseDate().before(end.getTime())
- && (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION)) {
+ if (set.isStandardLegal()
+ && set.getReleaseDate().after(start.getTime())
+ && set.getReleaseDate().before(end.getTime())) {
setCodes.add(set.getCode());
}
}
diff --git a/Mage/src/main/java/mage/cards/ExpansionSet.java b/Mage/src/main/java/mage/cards/ExpansionSet.java
index 688538ae18c..50e6a7bfde9 100644
--- a/Mage/src/main/java/mage/cards/ExpansionSet.java
+++ b/Mage/src/main/java/mage/cards/ExpansionSet.java
@@ -1,4 +1,3 @@
-
package mage.cards;
import mage.ObjectColor;
@@ -255,9 +254,7 @@ public abstract class ExpansionSet implements Serializable {
}
if (needsLegendCreature) {
- if (booster.stream().noneMatch(card -> card.isLegendary() && card.isCreature())) {
- return false;
- }
+ return booster.stream().anyMatch(card -> card.isLegendary() && card.isCreature());
}
// TODO: add partner check
@@ -311,9 +308,7 @@ public abstract class ExpansionSet implements Serializable {
// check that we don't have 3 or more uncommons/rares of the same color
if (magicColors.stream().anyMatch(color -> uncommonWeight.get(color) >= 180)) {
// reject only part of the boosters
- if (RandomUtil.nextDouble() < rejectSameColorUncommonsProbability) {
- return false;
- }
+ return !(RandomUtil.nextDouble() < rejectSameColorUncommonsProbability);
}
return true;
@@ -610,8 +605,13 @@ public abstract class ExpansionSet implements Serializable {
}
public boolean isEternalLegal() {
- return setType != SetType.CUSTOM_SET
- && setType != SetType.JOKESET;
+ // any official sets except un-sets
+ return setType != SetType.CUSTOM_SET && setType != SetType.JOKESET;
+ }
+
+ public boolean isStandardLegal() {
+ // any official sets that was in standard
+ return setType == SetType.CORE || setType == SetType.EXPANSION || setType == SetType.SUPPLEMENTAL_STANDARD_LEGAL;
}
public void removeSavedCards() {