mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Deck: commander decks may have 0-10 cards sideboard
This commit is contained in:
@@ -62,6 +62,7 @@ public class Deck extends DeckBase {
|
||||
private final DeckSection main;
|
||||
private final DeckSection sideboard; // commander, planes or schemes are also stored here
|
||||
private CardPrinted avatar;
|
||||
private CardPrinted commander;
|
||||
|
||||
// gameType is from Constant.GameType, like GameType.Regular
|
||||
/**
|
||||
@@ -132,6 +133,7 @@ public class Deck extends DeckBase {
|
||||
result.main.addAll(this.main);
|
||||
result.sideboard.addAll(this.sideboard);
|
||||
result.avatar = this.avatar;
|
||||
result.commander = this.commander;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -189,11 +191,15 @@ public class Deck extends DeckBase {
|
||||
// try also earlier deck formats
|
||||
if ( d.getSideboard().isEmpty() ) { d.getSideboard().set(Deck.readCardList(sections.get("schemes"))); }
|
||||
if ( d.getSideboard().isEmpty() ) { d.getSideboard().set(Deck.readCardList(sections.get("planes"))); }
|
||||
if ( d.getSideboard().isEmpty() ) { d.getSideboard().set(Deck.readCardList(sections.get("commander"))); }
|
||||
|
||||
List<String> av = Deck.readCardList(sections.get("avatar"));
|
||||
String avName = av.isEmpty() ? null : av.get(0);
|
||||
d.avatar = CardDb.instance().isCardSupported(avName) ? CardDb.instance().getCard(avName) : null;
|
||||
|
||||
List<String> cmd = Deck.readCardList(sections.get("commander"));
|
||||
String cmdName = cmd.isEmpty() ? null : cmd.get(0);
|
||||
d.commander = CardDb.instance().isCardSupported(cmdName) ? CardDb.instance().getCard(cmdName) : null;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
@@ -267,13 +273,18 @@ public class Deck extends DeckBase {
|
||||
out.add(String.format("%s", "[main]"));
|
||||
out.addAll(Deck.writeCardPool(this.getMain()));
|
||||
|
||||
out.add(String.format("%s", "[sideboard]"));
|
||||
out.add("[sideboard]");
|
||||
out.addAll(Deck.writeCardPool(this.getSideboard()));
|
||||
|
||||
if (getAvatar() != null) {
|
||||
out.add(String.format("%s", "[avatar]"));
|
||||
out.add("[avatar]");
|
||||
out.add(Deck.serializeSingleCard(getAvatar(), 1));
|
||||
}
|
||||
|
||||
if (getCommander() != null) {
|
||||
out.add("[commander]");
|
||||
out.add(Deck.serializeSingleCard(getCommander(), 1));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -281,7 +292,7 @@ public class Deck extends DeckBase {
|
||||
* @return the commander
|
||||
*/
|
||||
public CardPrinted getCommander() {
|
||||
return sideboard != null && !sideboard.isEmpty() ? sideboard.get(0) : null;
|
||||
return commander;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ import forge.util.Aggregates;
|
||||
public enum DeckFormat {
|
||||
|
||||
// Main board: allowed size SB: restriction Max distinct non basic cards
|
||||
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
||||
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
||||
Commander ( new IntRange(99 /* commndr in SB*/), new IntRange(1), 1),
|
||||
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||
Planechase ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||
Archenemy ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4);
|
||||
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
||||
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
||||
Commander ( new IntRange(99), new IntRange(0, 10), 1),
|
||||
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||
Planechase ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||
Archenemy ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4);
|
||||
|
||||
private final IntRange mainRange;
|
||||
private final IntRange sideRange; // null => no check
|
||||
@@ -131,11 +131,7 @@ public enum DeckFormat {
|
||||
if (!deck.getCommander().getCard().getType().isLegendary()) {
|
||||
return "has a commander that is not a legendary creature";
|
||||
}
|
||||
|
||||
//No sideboarding in Commander
|
||||
if (!deck.getSideboard().isEmpty()) {
|
||||
return "has sideboard";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Planechase: //Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package forge.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
Reference in New Issue
Block a user