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