mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Add CustomPool property to deck file for filtering from HomeScreen's deck list.
This commit is contained in:
@@ -32,6 +32,8 @@ public final class Deck implements Comparable<Deck>, Serializable {
|
||||
private String comment = null;
|
||||
private PlayerType playerType = null;
|
||||
|
||||
private boolean customPool = false;
|
||||
|
||||
private ItemPool<CardPrinted> main;
|
||||
private ItemPool<CardPrinted> sideboard;
|
||||
|
||||
@@ -254,4 +256,12 @@ public final class Deck implements Comparable<Deck>, Serializable {
|
||||
public final void setPlayerType(PlayerType recommendedPlayer0) {
|
||||
this.playerType = recommendedPlayer0;
|
||||
}
|
||||
|
||||
public boolean isCustomPool() {
|
||||
return customPool;
|
||||
}
|
||||
|
||||
public void setCustomPool(boolean cp) {
|
||||
customPool = cp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public class DeckManager {
|
||||
private static final String DECK_TYPE = "Deck Type";
|
||||
private static final String COMMENT = "Comment";
|
||||
private static final String PLAYER = "Player";
|
||||
private static final String CSTM_POOL = "Custom Pool";
|
||||
|
||||
private File deckDir;
|
||||
Map<String, Deck> deckMap;
|
||||
@@ -330,15 +331,27 @@ public class DeckManager {
|
||||
|
||||
String[] linedata = line.split("=", 2);
|
||||
String field = linedata[0].toLowerCase();
|
||||
String value = "";
|
||||
|
||||
if (linedata.length > 1)
|
||||
value = linedata[1];
|
||||
|
||||
if (NAME.equalsIgnoreCase(field)) {
|
||||
d.setName(linedata[1]);
|
||||
d.setName(value);
|
||||
|
||||
} else if (COMMENT.equalsIgnoreCase(field)) {
|
||||
d.setComment(linedata[1]);
|
||||
d.setComment(value);
|
||||
|
||||
} else if (DECK_TYPE.equalsIgnoreCase(field)) {
|
||||
d.setDeckType(GameType.smartValueOf(linedata[1]));
|
||||
d.setDeckType(GameType.smartValueOf(value));
|
||||
|
||||
} else if (CSTM_POOL.equalsIgnoreCase(field)) {
|
||||
d.setCustomPool(value.equalsIgnoreCase("true"));
|
||||
|
||||
} else if (PLAYER.equalsIgnoreCase(field)) {
|
||||
if ("human".equalsIgnoreCase(linedata[1])) {
|
||||
if ("human".equalsIgnoreCase(value)) {
|
||||
d.setPlayerType(PlayerType.HUMAN);
|
||||
|
||||
} else {
|
||||
d.setPlayerType(PlayerType.COMPUTER);
|
||||
}
|
||||
@@ -467,6 +480,8 @@ public class DeckManager {
|
||||
if (d.getComment() != null) { out.write(format("%s=%s%n", COMMENT, d.getComment().replaceAll("\n", ""))); }
|
||||
if (d.getPlayerType() != null) { out.write(format("%s=%s%n", PLAYER, d.getPlayerType())); }
|
||||
|
||||
if (d.isCustomPool()) { out.write(format("%s=%s%n", CSTM_POOL, "true")); }
|
||||
|
||||
out.write(format("%s%n", "[main]"));
|
||||
writeCardPool(d.getMain(), out);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user