From 0d038b1737e6fcafbeb17ce8e97398ac9ca60a75 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 18 Mar 2022 09:49:34 -0400 Subject: [PATCH] reorganized various constructed formats --- .../src/mage/deck/AbstractCommander.java | 57 ------------------- .../src/mage/deck/CenturionCommander.java | 3 - .../src/mage/deck/Commander.java | 18 +++--- .../src/mage/deck/Freeform.java | 6 +- .../src/mage/deck/FreeformCommander.java | 4 -- .../src/mage/deck/MTGO1v1Commander.java | 3 +- .../src/mage/deck/Oathbreaker.java | 3 +- .../src/mage/deck/PennyDreadfulCommander.java | 2 +- .../src/mage/deck/Vintage.java | 6 +- .../src/mage/deck/Limited.java | 2 +- .../java/mage/cards/decks/Constructed.java | 6 +- .../java/mage/cards/decks/DeckValidator.java | 15 ++--- 12 files changed, 23 insertions(+), 102 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java index 6f9264a825..fce6e12402 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java @@ -10,8 +10,6 @@ import mage.abilities.keyword.FriendsForeverAbility; import mage.abilities.keyword.PartnerAbility; import mage.abilities.keyword.PartnerWithAbility; import mage.cards.Card; -import mage.cards.ExpansionSet; -import mage.cards.Sets; import mage.cards.decks.Constructed; import mage.cards.decks.Deck; import mage.cards.decks.DeckValidatorErrorType; @@ -32,65 +30,10 @@ public abstract class AbstractCommander extends Constructed { protected final List bannedPartner = new ArrayList<>(); protected boolean partnerAllowed = true; - public AbstractCommander() { - super("Commander"); - for (ExpansionSet set : Sets.getInstance().values()) { - if (set.getSetType().isEternalLegal()) { - setCodes.add(set.getCode()); - } - } - banned.add("Ancestral Recall"); - banned.add("Balance"); - banned.add("Biorhythm"); - banned.add("Black Lotus"); - banned.add("Braids, Cabal Minion"); - banned.add("Channel"); - banned.add("Coalition Victory"); - banned.add("Emrakul, the Aeons Torn"); - banned.add("Erayo, Soratami Ascendant"); - banned.add("Fastbond"); - banned.add("Flash"); - banned.add("Gifts Ungiven"); - banned.add("Griselbrand"); - banned.add("Hullbreacher"); - banned.add("Iona, Shield of Emeria"); - banned.add("Karakas"); - banned.add("Leovold, Emissary of Trest"); - banned.add("Library of Alexandria"); - banned.add("Limited Resources"); - banned.add("Lutri, the Spellchaser"); - banned.add("Mox Emerald"); - banned.add("Mox Jet"); - banned.add("Mox Pearl"); - banned.add("Mox Ruby"); - banned.add("Mox Sapphire"); - banned.add("Panoptic Mirror"); - banned.add("Paradox Engine"); - banned.add("Primeval Titan"); - banned.add("Prophet of Kruphix"); - banned.add("Recurring Nightmare"); - banned.add("Rofellos, Llanowar Emissary"); - banned.add("Sundering Titan"); - banned.add("Sway of the Stars"); - banned.add("Sylvan Primordial"); - banned.add("Time Vault"); - banned.add("Time Walk"); - banned.add("Tinker"); - banned.add("Tolarian Academy"); - banned.add("Trade Secrets"); - banned.add("Upheaval"); - banned.add("Worldfire"); - banned.add("Yawgmoth's Bargain"); - } - public AbstractCommander(String name) { super(name); } - public AbstractCommander(String name, String shortName) { - super(name, shortName); - } - @Override public int getDeckMinSize() { return 98; diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/CenturionCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/CenturionCommander.java index f4e3977e6d..b3fa207197 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/CenturionCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/CenturionCommander.java @@ -1,8 +1,6 @@ - package mage.deck; /** - * * @author andreacosta */ public class CenturionCommander extends Commander { @@ -83,5 +81,4 @@ public class CenturionCommander extends Commander { bannedPartner.add("Kraum, Ludevic's Opus"); bannedPartner.add("Thrasios, Triton Hero "); } - } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index 18827f9c4a..f5d53f2670 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -12,12 +12,7 @@ import java.util.Map; public class Commander extends AbstractCommander { public Commander() { - super("Commander"); - for (ExpansionSet set : Sets.getInstance().values()) { - if (set.getSetType().isEternalLegal()) { - setCodes.add(set.getCode()); - } - } + this("Commander"); banned.add("Ancestral Recall"); banned.add("Balance"); banned.add("Biorhythm"); @@ -69,12 +64,13 @@ public class Commander extends AbstractCommander { banned.add("Yawgmoth's Bargain"); } - public Commander(String name) { + protected Commander(String name) { super(name); - } - - public Commander(String name, String shortName) { - super(name, shortName); + for (ExpansionSet set : Sets.getInstance().values()) { + if (set.getSetType().isEternalLegal()) { + setCodes.add(set.getCode()); + } + } } @Override diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Freeform.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Freeform.java index f1336bf102..db1e72f91c 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Freeform.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Freeform.java @@ -10,11 +10,7 @@ import mage.cards.decks.DeckValidatorErrorType; public class Freeform extends DeckValidator { public Freeform() { - super("Constructed - Freeform"); - } - - public Freeform(String name) { - super(name); + this("Constructed - Freeform", null); } public Freeform(String name, String shortName) { diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java index ba17a30494..dbaba363a5 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java @@ -27,10 +27,6 @@ public class FreeformCommander extends AbstractCommander { super(name); } - public FreeformCommander(String name, String shortName) { - super(name, shortName); - } - @Override protected boolean checkBanned(Map counts) { return true; diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/MTGO1v1Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/MTGO1v1Commander.java index 511d0d3f0e..4f90d5de4e 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/MTGO1v1Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/MTGO1v1Commander.java @@ -1,7 +1,6 @@ package mage.deck; /** - * * @author fireshoes */ public class MTGO1v1Commander extends Commander { @@ -9,7 +8,7 @@ public class MTGO1v1Commander extends Commander { public MTGO1v1Commander() { super("MTGO 1v1 Commander"); partnerAllowed = false; - + banned.add("Ancestral Recall"); banned.add("Back to Basics"); banned.add("Balance"); diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Oathbreaker.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Oathbreaker.java index 9a86f63284..74d24583da 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Oathbreaker.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Oathbreaker.java @@ -21,8 +21,7 @@ public class Oathbreaker extends Vintage { private static final Map pdAllowed = new HashMap<>(); public Oathbreaker() { - super(); - setName("Oathbreaker"); + super("Oathbreaker"); // banned = vintage + oathbreaker's list: https://oathbreakermtg.org/banned-list/ banned.add("Ad Nauseam"); diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java index 4e81e03b71..49f01d483f 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java @@ -16,7 +16,7 @@ public class PennyDreadfulCommander extends AbstractCommander { private static final Map pdAllowed = new HashMap<>(); public PennyDreadfulCommander() { - super("Penny Dreadful Commander", "Penny"); + super("Penny Dreadful Commander"); for (ExpansionSet set : Sets.getInstance().values()) { if (set.getSetType().isEternalLegal()) { setCodes.add(set.getCode()); diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Vintage.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Vintage.java index 3a7f2662ca..d9fd214c2c 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Vintage.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Vintage.java @@ -10,7 +10,11 @@ import mage.cards.decks.Constructed; public class Vintage extends Constructed { public Vintage() { - super("Constructed - Vintage"); + this("Constructed - Vintage"); + } + + protected Vintage(String name) { + super(name); for (ExpansionSet set : Sets.getInstance().values()) { if (set.getSetType().isEternalLegal()) { setCodes.add(set.getCode()); diff --git a/Mage.Server.Plugins/Mage.Deck.Limited/src/mage/deck/Limited.java b/Mage.Server.Plugins/Mage.Deck.Limited/src/mage/deck/Limited.java index d2391aab2f..3b9445e36e 100644 --- a/Mage.Server.Plugins/Mage.Deck.Limited/src/mage/deck/Limited.java +++ b/Mage.Server.Plugins/Mage.Deck.Limited/src/mage/deck/Limited.java @@ -13,7 +13,7 @@ import java.util.Map; public class Limited extends DeckValidator { public Limited() { - super("Limited"); + super("Limited", null); } @Override diff --git a/Mage/src/main/java/mage/cards/decks/Constructed.java b/Mage/src/main/java/mage/cards/decks/Constructed.java index cb12cfc797..61092f9984 100644 --- a/Mage/src/main/java/mage/cards/decks/Constructed.java +++ b/Mage/src/main/java/mage/cards/decks/Constructed.java @@ -30,12 +30,8 @@ public class Constructed extends DeckValidator { protected List rarities = new ArrayList<>(); protected Set singleCards = new HashSet<>(); - public Constructed() { - super("Constructed"); - } - protected Constructed(String name) { - super(name); + this(name, null); } protected Constructed(String name, String shortName) { diff --git a/Mage/src/main/java/mage/cards/decks/DeckValidator.java b/Mage/src/main/java/mage/cards/decks/DeckValidator.java index 8457f83569..07c51cdb33 100644 --- a/Mage/src/main/java/mage/cards/decks/DeckValidator.java +++ b/Mage/src/main/java/mage/cards/decks/DeckValidator.java @@ -15,10 +15,6 @@ public abstract class DeckValidator implements Serializable { protected String shortName; protected List errorsList = new ArrayList<>(); - public DeckValidator(String name) { - setName(name); - } - public DeckValidator(String name, String shortName) { setName(name, shortName); } @@ -33,14 +29,13 @@ public abstract class DeckValidator implements Serializable { return shortName; } - protected void setName(String name) { - this.name = name; - this.shortName = name.contains("-") ? name.substring(name.indexOf("-") + 1).trim() : name; - } - protected void setName(String name, String shortName) { this.name = name; - this.shortName = shortName; + if (shortName != null) { + this.shortName = shortName; + } else { + this.shortName = name.contains("-") ? name.substring(name.indexOf("-") + 1).trim() : name; + } } protected void setShortName(String shortName) {