mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
hide some readers, collections and simple enums as nested classes,
This commit is contained in:
13
.gitattributes
vendored
13
.gitattributes
vendored
@@ -22,12 +22,10 @@ forge-core/pom.xml -text
|
|||||||
forge-core/src/main/java/forge/ICardStorageReader.java -text
|
forge-core/src/main/java/forge/ICardStorageReader.java -text
|
||||||
forge-core/src/main/java/forge/IProgressObserver.java -text
|
forge-core/src/main/java/forge/IProgressObserver.java -text
|
||||||
forge-core/src/main/java/forge/StaticData.java -text
|
forge-core/src/main/java/forge/StaticData.java -text
|
||||||
forge-core/src/main/java/forge/card/AggregationMethod.java -text
|
|
||||||
forge-core/src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
forge-core/src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
||||||
forge-core/src/main/java/forge/card/BoosterSlots.java -text
|
forge-core/src/main/java/forge/card/BoosterSlots.java -text
|
||||||
forge-core/src/main/java/forge/card/CardAiHints.java -text
|
forge-core/src/main/java/forge/card/CardAiHints.java -text
|
||||||
forge-core/src/main/java/forge/card/CardCharacteristicName.java -text
|
forge-core/src/main/java/forge/card/CardCharacteristicName.java -text
|
||||||
forge-core/src/main/java/forge/card/CardCoreType.java -text
|
|
||||||
forge-core/src/main/java/forge/card/CardDb.java -text
|
forge-core/src/main/java/forge/card/CardDb.java -text
|
||||||
forge-core/src/main/java/forge/card/CardEdition.java -text
|
forge-core/src/main/java/forge/card/CardEdition.java -text
|
||||||
forge-core/src/main/java/forge/card/CardFace.java -text
|
forge-core/src/main/java/forge/card/CardFace.java -text
|
||||||
@@ -35,12 +33,9 @@ forge-core/src/main/java/forge/card/CardRarity.java -text
|
|||||||
forge-core/src/main/java/forge/card/CardRules.java -text
|
forge-core/src/main/java/forge/card/CardRules.java -text
|
||||||
forge-core/src/main/java/forge/card/CardRulesPredicates.java -text
|
forge-core/src/main/java/forge/card/CardRulesPredicates.java -text
|
||||||
forge-core/src/main/java/forge/card/CardSplitType.java -text
|
forge-core/src/main/java/forge/card/CardSplitType.java -text
|
||||||
forge-core/src/main/java/forge/card/CardSuperType.java -text
|
|
||||||
forge-core/src/main/java/forge/card/CardType.java -text
|
forge-core/src/main/java/forge/card/CardType.java -text
|
||||||
forge-core/src/main/java/forge/card/ColorSet.java -text
|
forge-core/src/main/java/forge/card/ColorSet.java -text
|
||||||
forge-core/src/main/java/forge/card/DeckHints.java -text
|
forge-core/src/main/java/forge/card/DeckHints.java -text
|
||||||
forge-core/src/main/java/forge/card/EditionCollection.java svneol=native#text/plain
|
|
||||||
forge-core/src/main/java/forge/card/FatPackTemplate.java -text
|
|
||||||
forge-core/src/main/java/forge/card/FormatCollection.java -text
|
forge-core/src/main/java/forge/card/FormatCollection.java -text
|
||||||
forge-core/src/main/java/forge/card/ICardCharacteristics.java -text
|
forge-core/src/main/java/forge/card/ICardCharacteristics.java -text
|
||||||
forge-core/src/main/java/forge/card/ICardDatabase.java -text
|
forge-core/src/main/java/forge/card/ICardDatabase.java -text
|
||||||
@@ -74,18 +69,16 @@ forge-core/src/main/java/forge/deck/io/DeckSerializer.java -text
|
|||||||
forge-core/src/main/java/forge/deck/io/OldDeckFileFormatException.java -text
|
forge-core/src/main/java/forge/deck/io/OldDeckFileFormatException.java -text
|
||||||
forge-core/src/main/java/forge/deck/io/package-info.java -text
|
forge-core/src/main/java/forge/deck/io/package-info.java -text
|
||||||
forge-core/src/main/java/forge/deck/package-info.java -text
|
forge-core/src/main/java/forge/deck/package-info.java -text
|
||||||
forge-core/src/main/java/forge/game/GameFormat.java -text
|
|
||||||
forge-core/src/main/java/forge/game/package-info.java -text
|
|
||||||
forge-core/src/main/java/forge/item/BoosterPack.java -text
|
forge-core/src/main/java/forge/item/BoosterPack.java -text
|
||||||
forge-core/src/main/java/forge/item/FatPack.java -text
|
forge-core/src/main/java/forge/item/FatPack.java -text
|
||||||
forge-core/src/main/java/forge/item/IPaperCard.java -text
|
forge-core/src/main/java/forge/item/IPaperCard.java -text
|
||||||
forge-core/src/main/java/forge/item/InventoryItem.java -text
|
forge-core/src/main/java/forge/item/InventoryItem.java -text
|
||||||
forge-core/src/main/java/forge/item/InventoryItemFromSet.java -text
|
forge-core/src/main/java/forge/item/InventoryItemFromSet.java -text
|
||||||
forge-core/src/main/java/forge/item/ItemPredicate.java -text
|
forge-core/src/main/java/forge/item/ItemPredicate.java -text
|
||||||
forge-core/src/main/java/forge/item/OpenablePack.java -text
|
|
||||||
forge-core/src/main/java/forge/item/PaperCard.java -text
|
forge-core/src/main/java/forge/item/PaperCard.java -text
|
||||||
forge-core/src/main/java/forge/item/PaperToken.java -text
|
forge-core/src/main/java/forge/item/PaperToken.java -text
|
||||||
forge-core/src/main/java/forge/item/PreconDeck.java -text
|
forge-core/src/main/java/forge/item/PreconDeck.java -text
|
||||||
|
forge-core/src/main/java/forge/item/SealedProduct.java -text
|
||||||
forge-core/src/main/java/forge/item/TournamentPack.java -text
|
forge-core/src/main/java/forge/item/TournamentPack.java -text
|
||||||
forge-core/src/main/java/forge/item/package-info.java -text
|
forge-core/src/main/java/forge/item/package-info.java -text
|
||||||
forge-core/src/main/java/forge/package-info.java -text
|
forge-core/src/main/java/forge/package-info.java -text
|
||||||
@@ -120,6 +113,9 @@ forge-game/.settings/org.eclipse.core.resources.prefs -text
|
|||||||
forge-game/.settings/org.eclipse.jdt.core.prefs -text
|
forge-game/.settings/org.eclipse.jdt.core.prefs -text
|
||||||
forge-game/.settings/org.eclipse.m2e.core.prefs -text
|
forge-game/.settings/org.eclipse.m2e.core.prefs -text
|
||||||
forge-game/pom.xml -text
|
forge-game/pom.xml -text
|
||||||
|
forge-game/src/main/java/forge/game/FormatCollection.java -text
|
||||||
|
forge-game/src/main/java/forge/game/GameFormat.java -text
|
||||||
|
forge-game/src/main/java/forge/game/package-info.java -text
|
||||||
forge-gui/.classpath -text
|
forge-gui/.classpath -text
|
||||||
forge-gui/.project -text
|
forge-gui/.project -text
|
||||||
forge-gui/.settings/org.eclipse.core.resources.prefs -text
|
forge-gui/.settings/org.eclipse.core.resources.prefs -text
|
||||||
@@ -128,6 +124,7 @@ forge-gui/.settings/org.eclipse.m2e.core.prefs -text
|
|||||||
forge-gui/CHANGES.txt -text
|
forge-gui/CHANGES.txt -text
|
||||||
forge-gui/LICENSE.txt -text
|
forge-gui/LICENSE.txt -text
|
||||||
forge-gui/README.txt -text
|
forge-gui/README.txt -text
|
||||||
|
forge-gui/forge.profile.properties -text
|
||||||
forge-gui/forge.profile.properties.example -text
|
forge-gui/forge.profile.properties.example -text
|
||||||
forge-gui/pom.xml -text
|
forge-gui/pom.xml -text
|
||||||
forge-gui/res/ai/Default.ai -text
|
forge-gui/res/ai/Default.ai -text
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ forge-ai/forge-ai.iml
|
|||||||
forge-ai/target
|
forge-ai/target
|
||||||
forge-core/forge-core.iml
|
forge-core/forge-core.iml
|
||||||
forge-core/target
|
forge-core/target
|
||||||
|
forge-game/target
|
||||||
forge-gui/forge-gui.iml
|
forge-gui/forge-gui.iml
|
||||||
forge-gui/res/*.log
|
forge-gui/res/*.log
|
||||||
forge-gui/res/PerSetTrackingResults
|
forge-gui/res/PerSetTrackingResults
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ import java.util.TreeMap;
|
|||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.EditionCollection;
|
|
||||||
import forge.card.FatPackTemplate;
|
|
||||||
import forge.card.FormatCollection;
|
|
||||||
import forge.card.PrintSheet;
|
import forge.card.PrintSheet;
|
||||||
import forge.card.SealedProductTemplate;
|
import forge.item.FatPack;
|
||||||
import forge.game.GameFormat;
|
import forge.item.SealedProduct;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
import forge.util.storage.StorageBase;
|
import forge.util.storage.StorageBase;
|
||||||
|
|
||||||
@@ -27,12 +24,11 @@ public class StaticData {
|
|||||||
|
|
||||||
private final CardDb commonCards;
|
private final CardDb commonCards;
|
||||||
private final CardDb variantCards;
|
private final CardDb variantCards;
|
||||||
private final EditionCollection editions;
|
private final CardEdition.Collection editions;
|
||||||
private final FormatCollection formats;
|
private final IStorage<SealedProduct.Template> boosters;
|
||||||
private final IStorage<SealedProductTemplate> boosters;
|
private final IStorage<SealedProduct.Template> specialBoosters;
|
||||||
private final IStorage<SealedProductTemplate> specialBoosters;
|
private final IStorage<SealedProduct.Template> tournaments;
|
||||||
private final IStorage<SealedProductTemplate> tournaments;
|
private final IStorage<FatPack.Template> fatPacks;
|
||||||
private final IStorage<FatPackTemplate> fatPacks;
|
|
||||||
private final IStorage<PrintSheet> printSheets;
|
private final IStorage<PrintSheet> printSheets;
|
||||||
|
|
||||||
private static StaticData lastInstance = null;
|
private static StaticData lastInstance = null;
|
||||||
@@ -40,7 +36,7 @@ public class StaticData {
|
|||||||
|
|
||||||
|
|
||||||
public StaticData(ICardStorageReader reader, String editionFolder, String blockDataFolder) {
|
public StaticData(ICardStorageReader reader, String editionFolder, String blockDataFolder) {
|
||||||
this.editions = new EditionCollection(new CardEdition.Reader(new File(editionFolder)));
|
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||||
lastInstance = this;
|
lastInstance = this;
|
||||||
|
|
||||||
final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||||
@@ -62,12 +58,10 @@ public class StaticData {
|
|||||||
variantCards = new CardDb(variantsCards, editions, false);
|
variantCards = new CardDb(variantsCards, editions, false);
|
||||||
|
|
||||||
|
|
||||||
|
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
||||||
this.formats = new FormatCollection(new GameFormat.Reader(new File(blockDataFolder, "formats.txt")));
|
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
||||||
this.boosters = new StorageBase<SealedProductTemplate>("Boosters", editions.getBoosterGenerator());
|
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
||||||
this.specialBoosters = new StorageBase<SealedProductTemplate>("Special boosters", new SealedProductTemplate.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader("res/blockdata/fatpacks.txt"));
|
||||||
this.tournaments = new StorageBase<SealedProductTemplate>("Starter sets", new SealedProductTemplate.Reader(new File(blockDataFolder, "starters.txt")));
|
|
||||||
this.fatPacks = new StorageBase<FatPackTemplate>("Fat packs", new FatPackTemplate.Reader("res/blockdata/fatpacks.txt"));
|
|
||||||
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,30 +70,26 @@ public class StaticData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final EditionCollection getEditions() {
|
public final CardEdition.Collection getEditions() {
|
||||||
return this.editions;
|
return this.editions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final FormatCollection getFormats() {
|
/** @return {@link forge.util.storage.IStorageView}<{@link forge.item.FatPackTemplate}> */
|
||||||
return this.formats;
|
public IStorage<FatPack.Template> getFatPacks() {
|
||||||
}
|
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.FatPackTemplate}> */
|
|
||||||
public IStorage<FatPackTemplate> getFatPacks() {
|
|
||||||
return fatPacks;
|
return fatPacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||||
public final IStorage<SealedProductTemplate> getTournamentPacks() {
|
public final IStorage<SealedProduct.Template> getTournamentPacks() {
|
||||||
return tournaments;
|
return tournaments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||||
public final IStorage<SealedProductTemplate> getBoosters() {
|
public final IStorage<SealedProduct.Template> getBoosters() {
|
||||||
return boosters;
|
return boosters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final IStorage<SealedProductTemplate> getSpecialBoosters() {
|
public final IStorage<SealedProduct.Template> getSpecialBoosters() {
|
||||||
return specialBoosters;
|
return specialBoosters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package forge.card;
|
|
||||||
|
|
||||||
public enum AggregationMethod {
|
|
||||||
USE_ACTIVE_FACE,
|
|
||||||
USE_PRIMARY_FACE,
|
|
||||||
AGGREGATE;
|
|
||||||
}
|
|
||||||
@@ -37,6 +37,7 @@ import com.google.common.collect.Lists;
|
|||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +58,7 @@ public class BoosterGenerator {
|
|||||||
return cachedSheets.get(key);
|
return cachedSheets.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final List<PaperCard> getBoosterPack(SealedProductTemplate booster) {
|
public static final List<PaperCard> getBoosterPack(SealedProduct.Template booster) {
|
||||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
List<PaperCard> result = new ArrayList<PaperCard>();
|
||||||
for(Pair<String, Integer> slot : booster.getSlots()) {
|
for(Pair<String, Integer> slot : booster.getSlots()) {
|
||||||
String slotType = slot.getLeft(); // add expansion symbol here?
|
String slotType = slot.getLeft(); // add expansion symbol here?
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Forge: Play Magic: the Gathering.
|
|
||||||
* Copyright (C) 2011 Forge Team
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package forge.card;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Enum CardCoreType.
|
|
||||||
*/
|
|
||||||
public enum CardCoreType {
|
|
||||||
|
|
||||||
/** The Artifact. */
|
|
||||||
Artifact,
|
|
||||||
/** The Creature. */
|
|
||||||
Creature,
|
|
||||||
/** The Enchantment. */
|
|
||||||
Enchantment,
|
|
||||||
/** The Instant. */
|
|
||||||
Instant,
|
|
||||||
/** The Land. */
|
|
||||||
Land,
|
|
||||||
/** The Plane. */
|
|
||||||
Plane,
|
|
||||||
/** The Planeswalker. */
|
|
||||||
Planeswalker,
|
|
||||||
/** The Scheme. */
|
|
||||||
Scheme,
|
|
||||||
/** The Sorcery. */
|
|
||||||
Sorcery,
|
|
||||||
/** The Tribal. */
|
|
||||||
Tribal,
|
|
||||||
/** The Vanguard. */
|
|
||||||
Vanguard,
|
|
||||||
/** The Phenomenon. */
|
|
||||||
Phenomenon
|
|
||||||
}
|
|
||||||
@@ -54,10 +54,10 @@ public final class CardDb implements ICardDatabase {
|
|||||||
private final List<PaperCard> allCards = new ArrayList<PaperCard>();
|
private final List<PaperCard> allCards = new ArrayList<PaperCard>();
|
||||||
private final List<PaperCard> roAllCards = Collections.unmodifiableList(allCards);
|
private final List<PaperCard> roAllCards = Collections.unmodifiableList(allCards);
|
||||||
private final Collection<PaperCard> roUniqueCards = Collections.unmodifiableCollection(uniqueCardsByName.values());
|
private final Collection<PaperCard> roUniqueCards = Collections.unmodifiableCollection(uniqueCardsByName.values());
|
||||||
private final EditionCollection editions;
|
private final CardEdition.Collection editions;
|
||||||
|
|
||||||
|
|
||||||
public CardDb(Map<String, CardRules> rules, EditionCollection editions0, boolean logMissingCards) {
|
public CardDb(Map<String, CardRules> rules, CardEdition.Collection editions0, boolean logMissingCards) {
|
||||||
this.rulesByName = rules;
|
this.rulesByName = rules;
|
||||||
this.editions = editions0;
|
this.editions = editions0;
|
||||||
List<String> missingCards = new ArrayList<String>();
|
List<String> missingCards = new ArrayList<String>();
|
||||||
|
|||||||
@@ -22,17 +22,25 @@ import java.io.FilenameFilter;
|
|||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
import forge.util.IItemReader;
|
||||||
|
import forge.util.storage.StorageBase;
|
||||||
|
import forge.util.storage.StorageReaderBase;
|
||||||
import forge.util.storage.StorageReaderFolder;
|
import forge.util.storage.StorageReaderFolder;
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +106,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
|
|
||||||
|
|
||||||
private int boosterArts = 1;
|
private int boosterArts = 1;
|
||||||
private SealedProductTemplate boosterTpl = null;
|
private SealedProduct.Template boosterTpl = null;
|
||||||
|
|
||||||
private CardEdition(CardInSet[] cards) {
|
private CardEdition(CardInSet[] cards) {
|
||||||
this.cards = cards;
|
this.cards = cards;
|
||||||
@@ -202,7 +210,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
return boosterArts;
|
return boosterArts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SealedProductTemplate getBoosterTemplate() {
|
public SealedProduct.Template getBoosterTemplate() {
|
||||||
return boosterTpl;
|
return boosterTpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +255,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
|
|
||||||
res.boosterArts = section.getInt("BoosterCovers", 1);
|
res.boosterArts = section.getInt("BoosterCovers", 1);
|
||||||
String boosterDesc = section.get("Booster");
|
String boosterDesc = section.get("Booster");
|
||||||
res.boosterTpl = boosterDesc == null ? null : new SealedProductTemplate(res.code, SealedProductTemplate.Reader.parseSlots(boosterDesc));
|
res.boosterTpl = boosterDesc == null ? null : new SealedProduct.Template(res.code, SealedProduct.Template.Reader.parseSlots(boosterDesc));
|
||||||
|
|
||||||
res.alias = section.get("alias");
|
res.alias = section.get("alias");
|
||||||
res.whiteBorder = "white".equalsIgnoreCase(section.get("border"));
|
res.whiteBorder = "white".equalsIgnoreCase(section.get("border"));
|
||||||
@@ -299,4 +307,100 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Collection extends StorageBase<CardEdition> {
|
||||||
|
|
||||||
|
private final Map<String, CardEdition> aliasToEdition = new TreeMap<String, CardEdition>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
|
public Collection(IItemReader<CardEdition> reader) {
|
||||||
|
super("Card editions", reader);
|
||||||
|
|
||||||
|
for (CardEdition ee : this) {
|
||||||
|
String alias = ee.getAlias();
|
||||||
|
if (null != alias) {
|
||||||
|
aliasToEdition.put(alias, ee);
|
||||||
|
}
|
||||||
|
aliasToEdition.put(ee.getCode2(), ee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sets by code. It will search first by three letter codes, then by aliases and two-letter codes.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the sets the by code
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CardEdition get(final String code) {
|
||||||
|
CardEdition baseResult = super.get(code);
|
||||||
|
return baseResult == null ? aliasToEdition.get(code) : baseResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Iterable<CardEdition> getOrderedEditions() {
|
||||||
|
List<CardEdition> res = Lists.newArrayList(this);
|
||||||
|
Collections.sort(res);
|
||||||
|
Collections.reverse(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sets by code or throw.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the sets the by code or throw
|
||||||
|
*/
|
||||||
|
public CardEdition getEditionByCodeOrThrow(final String code) {
|
||||||
|
final CardEdition set = this.get(code);
|
||||||
|
if (null == set) {
|
||||||
|
throw new RuntimeException(String.format("Edition with code '%s' not found", code));
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used by image generating code
|
||||||
|
/**
|
||||||
|
* Gets the code2 by code.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the code2 by code
|
||||||
|
*/
|
||||||
|
public String getCode2ByCode(final String code) {
|
||||||
|
final CardEdition set = this.get(code);
|
||||||
|
return set == null ? "" : set.getCode2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Function<String, CardEdition> FN_EDITION_BY_CODE = new Function<String, CardEdition>() {
|
||||||
|
@Override
|
||||||
|
public CardEdition apply(String code) {
|
||||||
|
return Collection.this.get(code);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IItemReader<SealedProduct.Template> getBoosterGenerator() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new StorageReaderBase<SealedProduct.Template>(null) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, SealedProduct.Template> readAll() {
|
||||||
|
Map<String, SealedProduct.Template> map = new TreeMap<String, SealedProduct.Template>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
for(CardEdition ce : Collection.this) {
|
||||||
|
map.put(ce.getCode(), ce.getBoosterTemplate());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemKey(SealedProduct.Template item) {
|
||||||
|
return item.getEdition();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ import forge.card.mana.ManaCost;
|
|||||||
*/
|
*/
|
||||||
final class CardFace implements ICardFace {
|
final class CardFace implements ICardFace {
|
||||||
|
|
||||||
|
public enum FaceSelectionMethod { //
|
||||||
|
USE_ACTIVE_FACE,
|
||||||
|
USE_PRIMARY_FACE,
|
||||||
|
COMBINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final static List<String> emptyList = Collections.unmodifiableList(new ArrayList<String>());
|
private final static List<String> emptyList = Collections.unmodifiableList(new ArrayList<String>());
|
||||||
private final static Map<String, String> emptyMap = Collections.unmodifiableMap(new TreeMap<String, String>());
|
private final static Map<String, String> emptyMap = Collections.unmodifiableMap(new TreeMap<String, String>());
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
switch(splitType.getAggregationMethod()) {
|
switch(splitType.getAggregationMethod()) {
|
||||||
case AGGREGATE:
|
case COMBINE:
|
||||||
return mainPart.getName() + " // " + otherPart.getName();
|
return mainPart.getName() + " // " + otherPart.getName();
|
||||||
default:
|
default:
|
||||||
return mainPart.getName();
|
return mainPart.getName();
|
||||||
@@ -134,7 +134,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
@Override
|
@Override
|
||||||
public CardType getType() {
|
public CardType getType() {
|
||||||
switch(splitType.getAggregationMethod()) {
|
switch(splitType.getAggregationMethod()) {
|
||||||
case AGGREGATE: // no cards currently have different types
|
case COMBINE: // no cards currently have different types
|
||||||
return CardType.combine(mainPart.getType(), otherPart.getType());
|
return CardType.combine(mainPart.getType(), otherPart.getType());
|
||||||
default:
|
default:
|
||||||
return mainPart.getType();
|
return mainPart.getType();
|
||||||
@@ -145,7 +145,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
@Override
|
@Override
|
||||||
public ManaCost getManaCost() {
|
public ManaCost getManaCost() {
|
||||||
switch(splitType.getAggregationMethod()) {
|
switch(splitType.getAggregationMethod()) {
|
||||||
case AGGREGATE:
|
case COMBINE:
|
||||||
return ManaCost.combine(mainPart.getManaCost(), otherPart.getManaCost());
|
return ManaCost.combine(mainPart.getManaCost(), otherPart.getManaCost());
|
||||||
default:
|
default:
|
||||||
return mainPart.getManaCost();
|
return mainPart.getManaCost();
|
||||||
@@ -155,7 +155,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
@Override
|
@Override
|
||||||
public ColorSet getColor() {
|
public ColorSet getColor() {
|
||||||
switch(splitType.getAggregationMethod()) {
|
switch(splitType.getAggregationMethod()) {
|
||||||
case AGGREGATE:
|
case COMBINE:
|
||||||
return ColorSet.fromMask(mainPart.getColor().getColor() | otherPart.getColor().getColor());
|
return ColorSet.fromMask(mainPart.getColor().getColor() | otherPart.getColor().getColor());
|
||||||
default:
|
default:
|
||||||
return mainPart.getColor();
|
return mainPart.getColor();
|
||||||
@@ -171,7 +171,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
@Override
|
@Override
|
||||||
public String getOracleText() {
|
public String getOracleText() {
|
||||||
switch(splitType.getAggregationMethod()) {
|
switch(splitType.getAggregationMethod()) {
|
||||||
case AGGREGATE:
|
case COMBINE:
|
||||||
return mainPart.getOracleText() + "\r\n\r\n" + otherPart.getOracleText();
|
return mainPart.getOracleText() + "\r\n\r\n" + otherPart.getOracleText();
|
||||||
default:
|
default:
|
||||||
return mainPart.getOracleText();
|
return mainPart.getOracleText();
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public final class CardRulesPredicates {
|
|||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> coreType(final boolean isEqual, final String what) {
|
public static Predicate<CardRules> coreType(final boolean isEqual, final String what) {
|
||||||
try {
|
try {
|
||||||
return CardRulesPredicates.coreType(isEqual, Enum.valueOf(CardCoreType.class, what));
|
return CardRulesPredicates.coreType(isEqual, Enum.valueOf(CardType.CoreType.class, what));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return com.google.common.base.Predicates.alwaysFalse();
|
return com.google.common.base.Predicates.alwaysFalse();
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ public final class CardRulesPredicates {
|
|||||||
* the type
|
* the type
|
||||||
* @return the predicate
|
* @return the predicate
|
||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> coreType(final boolean isEqual, final CardCoreType type) {
|
public static Predicate<CardRules> coreType(final boolean isEqual, final CardType.CoreType type) {
|
||||||
return new PredicateCoreType(type, isEqual);
|
return new PredicateCoreType(type, isEqual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ public final class CardRulesPredicates {
|
|||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> superType(final boolean isEqual, final String what) {
|
public static Predicate<CardRules> superType(final boolean isEqual, final String what) {
|
||||||
try {
|
try {
|
||||||
return CardRulesPredicates.superType(isEqual, Enum.valueOf(CardSuperType.class, what));
|
return CardRulesPredicates.superType(isEqual, Enum.valueOf(CardType.SuperType.class, what));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return com.google.common.base.Predicates.alwaysFalse();
|
return com.google.common.base.Predicates.alwaysFalse();
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ public final class CardRulesPredicates {
|
|||||||
* the type
|
* the type
|
||||||
* @return the predicate
|
* @return the predicate
|
||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> superType(final boolean isEqual, final CardSuperType type) {
|
public static Predicate<CardRules> superType(final boolean isEqual, final CardType.SuperType type) {
|
||||||
return new PredicateSuperType(type, isEqual);
|
return new PredicateSuperType(type, isEqual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +396,7 @@ public final class CardRulesPredicates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class PredicateCoreType implements Predicate<CardRules> {
|
private static class PredicateCoreType implements Predicate<CardRules> {
|
||||||
private final CardCoreType operand;
|
private final CardType.CoreType operand;
|
||||||
private final boolean shouldBeEqual;
|
private final boolean shouldBeEqual;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -407,14 +407,14 @@ public final class CardRulesPredicates {
|
|||||||
return this.shouldBeEqual == card.getType().typeContains(this.operand);
|
return this.shouldBeEqual == card.getType().typeContains(this.operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PredicateCoreType(final CardCoreType type, final boolean wantEqual) {
|
public PredicateCoreType(final CardType.CoreType type, final boolean wantEqual) {
|
||||||
this.operand = type;
|
this.operand = type;
|
||||||
this.shouldBeEqual = wantEqual;
|
this.shouldBeEqual = wantEqual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PredicateSuperType implements Predicate<CardRules> {
|
private static class PredicateSuperType implements Predicate<CardRules> {
|
||||||
private final CardSuperType operand;
|
private final CardType.SuperType operand;
|
||||||
private final boolean shouldBeEqual;
|
private final boolean shouldBeEqual;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -422,7 +422,7 @@ public final class CardRulesPredicates {
|
|||||||
return this.shouldBeEqual == card.getType().superTypeContains(this.operand);
|
return this.shouldBeEqual == card.getType().superTypeContains(this.operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PredicateSuperType(final CardSuperType type, final boolean wantEqual) {
|
public PredicateSuperType(final CardType.SuperType type, final boolean wantEqual) {
|
||||||
this.operand = type;
|
this.operand = type;
|
||||||
this.shouldBeEqual = wantEqual;
|
this.shouldBeEqual = wantEqual;
|
||||||
}
|
}
|
||||||
@@ -448,21 +448,21 @@ public final class CardRulesPredicates {
|
|||||||
|
|
||||||
/** The Constant isCreature. */
|
/** The Constant isCreature. */
|
||||||
public static final Predicate<CardRules> IS_CREATURE = CardRulesPredicates
|
public static final Predicate<CardRules> IS_CREATURE = CardRulesPredicates
|
||||||
.coreType(true, CardCoreType.Creature);
|
.coreType(true, CardType.CoreType.Creature);
|
||||||
|
|
||||||
public static final Predicate<CardRules> IS_LEGENDARY = CardRulesPredicates
|
public static final Predicate<CardRules> IS_LEGENDARY = CardRulesPredicates
|
||||||
.superType(true, CardSuperType.Legendary);
|
.superType(true, CardType.SuperType.Legendary);
|
||||||
|
|
||||||
/** The Constant isArtifact. */
|
/** The Constant isArtifact. */
|
||||||
public static final Predicate<CardRules> IS_ARTIFACT = CardRulesPredicates
|
public static final Predicate<CardRules> IS_ARTIFACT = CardRulesPredicates
|
||||||
.coreType(true, CardCoreType.Artifact);
|
.coreType(true, CardType.CoreType.Artifact);
|
||||||
|
|
||||||
/** The Constant isEquipment. */
|
/** The Constant isEquipment. */
|
||||||
public static final Predicate<CardRules> IS_EQUIPMENT = CardRulesPredicates
|
public static final Predicate<CardRules> IS_EQUIPMENT = CardRulesPredicates
|
||||||
.subType("Equipment");
|
.subType("Equipment");
|
||||||
|
|
||||||
/** The Constant isLand. */
|
/** The Constant isLand. */
|
||||||
public static final Predicate<CardRules> IS_LAND = CardRulesPredicates.coreType(true, CardCoreType.Land);
|
public static final Predicate<CardRules> IS_LAND = CardRulesPredicates.coreType(true, CardType.CoreType.Land);
|
||||||
|
|
||||||
/** The Constant isBasicLand. */
|
/** The Constant isBasicLand. */
|
||||||
public static final Predicate<CardRules> IS_BASIC_LAND = new Predicate<CardRules>() {
|
public static final Predicate<CardRules> IS_BASIC_LAND = new Predicate<CardRules>() {
|
||||||
@@ -480,31 +480,17 @@ public final class CardRulesPredicates {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The Constant isPlaneswalker. */
|
public static final Predicate<CardRules> IS_PLANESWALKER = CardRulesPredicates.coreType(true, CardType.CoreType.Planeswalker);
|
||||||
public static final Predicate<CardRules> IS_PLANESWALKER = CardRulesPredicates.coreType(true,
|
public static final Predicate<CardRules> IS_INSTANT = CardRulesPredicates.coreType(true, CardType.CoreType.Instant);
|
||||||
CardCoreType.Planeswalker);
|
public static final Predicate<CardRules> IS_SORCERY = CardRulesPredicates.coreType(true, CardType.CoreType.Sorcery);
|
||||||
|
public static final Predicate<CardRules> IS_ENCHANTMENT = CardRulesPredicates.coreType(true, CardType.CoreType.Enchantment);
|
||||||
/** The Constant isInstant. */
|
public static final Predicate<CardRules> IS_PLANE = CardRulesPredicates.coreType(true, CardType.CoreType.Plane);
|
||||||
public static final Predicate<CardRules> IS_INSTANT = CardRulesPredicates.coreType(true, CardCoreType.Instant);
|
public static final Predicate<CardRules> IS_PHENOMENON = CardRulesPredicates.coreType(true, CardType.CoreType.Phenomenon);
|
||||||
|
|
||||||
/** The Constant isSorcery. */
|
|
||||||
public static final Predicate<CardRules> IS_SORCERY = CardRulesPredicates.coreType(true, CardCoreType.Sorcery);
|
|
||||||
|
|
||||||
/** The Constant isEnchantment. */
|
|
||||||
public static final Predicate<CardRules> IS_ENCHANTMENT = CardRulesPredicates.coreType(true, CardCoreType.Enchantment);
|
|
||||||
|
|
||||||
public static final Predicate<CardRules> IS_PLANE = CardRulesPredicates.coreType(true, CardCoreType.Plane);
|
|
||||||
public static final Predicate<CardRules> IS_PHENOMENON = CardRulesPredicates.coreType(true, CardCoreType.Phenomenon);
|
|
||||||
public static final Predicate<CardRules> IS_PLANE_OR_PHENOMENON = Predicates.or(IS_PLANE, IS_PHENOMENON);
|
public static final Predicate<CardRules> IS_PLANE_OR_PHENOMENON = Predicates.or(IS_PLANE, IS_PHENOMENON);
|
||||||
public static final Predicate<CardRules> IS_SCHEME = CardRulesPredicates.coreType(true, CardCoreType.Scheme);
|
public static final Predicate<CardRules> IS_SCHEME = CardRulesPredicates.coreType(true, CardType.CoreType.Scheme);
|
||||||
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardCoreType.Vanguard);
|
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardType.CoreType.Vanguard);
|
||||||
|
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
|
||||||
/** The Constant isNonLand. */
|
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicates.not(Predicates.or(Presets.IS_CREATURE, Presets.IS_LAND));
|
||||||
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardCoreType.Land);
|
|
||||||
|
|
||||||
/** The Constant isNonCreatureSpell. */
|
|
||||||
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicates.not(Predicates.or(
|
|
||||||
Presets.IS_CREATURE, Presets.IS_LAND));
|
|
||||||
|
|
||||||
/** The Constant IS_NONCREATURE_SPELL_FOR_GENERATOR. **/
|
/** The Constant IS_NONCREATURE_SPELL_FOR_GENERATOR. **/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
|
import forge.card.CardFace.FaceSelectionMethod;
|
||||||
|
|
||||||
public enum CardSplitType
|
public enum CardSplitType
|
||||||
{
|
{
|
||||||
None(AggregationMethod.USE_PRIMARY_FACE, null),
|
None(FaceSelectionMethod.USE_PRIMARY_FACE, null),
|
||||||
Transform(AggregationMethod.USE_ACTIVE_FACE, CardCharacteristicName.Transformed),
|
Transform(FaceSelectionMethod.USE_ACTIVE_FACE, CardCharacteristicName.Transformed),
|
||||||
Split(AggregationMethod.AGGREGATE, CardCharacteristicName.RightSplit),
|
Split(FaceSelectionMethod.COMBINE, CardCharacteristicName.RightSplit),
|
||||||
Flip(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Flipped),
|
Flip(FaceSelectionMethod.USE_PRIMARY_FACE, CardCharacteristicName.Flipped),
|
||||||
// used by 12 licid creatures to switch type into enchantment aura
|
// used by 12 licid creatures to switch type into enchantment aura
|
||||||
Licid(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Licid);
|
Licid(FaceSelectionMethod.USE_PRIMARY_FACE, CardCharacteristicName.Licid);
|
||||||
|
|
||||||
private CardSplitType(AggregationMethod calcMode, CardCharacteristicName stateName) {
|
private CardSplitType(FaceSelectionMethod calcMode, CardCharacteristicName stateName) {
|
||||||
method = calcMode;
|
method = calcMode;
|
||||||
this.changedStateName = stateName;
|
this.changedStateName = stateName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AggregationMethod getAggregationMethod() {
|
public FaceSelectionMethod getAggregationMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final AggregationMethod method;
|
private final FaceSelectionMethod method;
|
||||||
private final CardCharacteristicName changedStateName;
|
private final CardCharacteristicName changedStateName;
|
||||||
|
|
||||||
public static CardSplitType smartValueOf(String text) {
|
public static CardSplitType smartValueOf(String text) {
|
||||||
|
|||||||
@@ -34,20 +34,64 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public final class CardType implements Comparable<CardType> {
|
public final class CardType implements Comparable<CardType> {
|
||||||
|
|
||||||
|
public enum CoreType {
|
||||||
|
|
||||||
|
/** The Artifact. */
|
||||||
|
Artifact,
|
||||||
|
/** The Creature. */
|
||||||
|
Creature,
|
||||||
|
/** The Enchantment. */
|
||||||
|
Enchantment,
|
||||||
|
/** The Instant. */
|
||||||
|
Instant,
|
||||||
|
/** The Land. */
|
||||||
|
Land,
|
||||||
|
/** The Plane. */
|
||||||
|
Plane,
|
||||||
|
/** The Planeswalker. */
|
||||||
|
Planeswalker,
|
||||||
|
/** The Scheme. */
|
||||||
|
Scheme,
|
||||||
|
/** The Sorcery. */
|
||||||
|
Sorcery,
|
||||||
|
/** The Tribal. */
|
||||||
|
Tribal,
|
||||||
|
/** The Vanguard. */
|
||||||
|
Vanguard,
|
||||||
|
/** The Phenomenon. */
|
||||||
|
Phenomenon
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SuperType {
|
||||||
|
|
||||||
|
/** The Basic. */
|
||||||
|
Basic,
|
||||||
|
/** The Legendary. */
|
||||||
|
Legendary,
|
||||||
|
/** The Snow. */
|
||||||
|
Snow,
|
||||||
|
/** The Ongoing. */
|
||||||
|
Ongoing,
|
||||||
|
/** The World. */
|
||||||
|
World
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final List<String> subType = new ArrayList<String>();
|
private final List<String> subType = new ArrayList<String>();
|
||||||
private final EnumSet<CardCoreType> coreType = EnumSet.noneOf(CardCoreType.class);
|
private final EnumSet<CardType.CoreType> coreType = EnumSet.noneOf(CardType.CoreType.class);
|
||||||
private final EnumSet<CardSuperType> superType = EnumSet.noneOf(CardSuperType.class);
|
private final EnumSet<CardType.SuperType> superType = EnumSet.noneOf(CardType.SuperType.class);
|
||||||
private String calculatedType = null; // since obj is immutable, this is
|
private String calculatedType = null; // since obj is immutable, this is
|
||||||
// calc'd once
|
// calc'd once
|
||||||
|
|
||||||
// This will be useful for faster parses
|
// This will be useful for faster parses
|
||||||
private static HashMap<String, CardCoreType> stringToCoreType = new HashMap<String, CardCoreType>();
|
private static HashMap<String, CardType.CoreType> stringToCoreType = new HashMap<String, CardType.CoreType>();
|
||||||
private static HashMap<String, CardSuperType> stringToSuperType = new HashMap<String, CardSuperType>();
|
private static HashMap<String, CardType.SuperType> stringToSuperType = new HashMap<String, CardType.SuperType>();
|
||||||
static {
|
static {
|
||||||
for (final CardSuperType st : CardSuperType.values()) {
|
for (final CardType.SuperType st : CardType.SuperType.values()) {
|
||||||
CardType.stringToSuperType.put(st.name(), st);
|
CardType.stringToSuperType.put(st.name(), st);
|
||||||
}
|
}
|
||||||
for (final CardCoreType ct : CardCoreType.values()) {
|
for (final CardType.CoreType ct : CardType.CoreType.values()) {
|
||||||
CardType.stringToCoreType.put(ct.name(), ct);
|
CardType.stringToCoreType.put(ct.name(), ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,13 +148,13 @@ public final class CardType implements Comparable<CardType> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardCoreType ct = CardType.stringToCoreType.get(type);
|
final CardType.CoreType ct = CardType.stringToCoreType.get(type);
|
||||||
if (ct != null) {
|
if (ct != null) {
|
||||||
this.coreType.add(ct);
|
this.coreType.add(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardSuperType st = CardType.stringToSuperType.get(type);
|
final CardType.SuperType st = CardType.stringToSuperType.get(type);
|
||||||
if (st != null) {
|
if (st != null) {
|
||||||
this.superType.add(st);
|
this.superType.add(st);
|
||||||
return;
|
return;
|
||||||
@@ -124,56 +168,56 @@ public final class CardType implements Comparable<CardType> {
|
|||||||
return this.subType.contains(operand);
|
return this.subType.contains(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean typeContains(final CardCoreType operand) {
|
public boolean typeContains(final CardType.CoreType operand) {
|
||||||
return this.coreType.contains(operand);
|
return this.coreType.contains(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean superTypeContains(final CardSuperType operand) {
|
public boolean superTypeContains(final CardType.SuperType operand) {
|
||||||
return this.superType.contains(operand);
|
return this.superType.contains(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCreature() {
|
public boolean isCreature() {
|
||||||
return this.coreType.contains(CardCoreType.Creature);
|
return this.coreType.contains(CardType.CoreType.Creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlaneswalker() {
|
public boolean isPlaneswalker() {
|
||||||
return this.coreType.contains(CardCoreType.Planeswalker);
|
return this.coreType.contains(CardType.CoreType.Planeswalker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLand() {
|
public boolean isLand() {
|
||||||
return this.coreType.contains(CardCoreType.Land);
|
return this.coreType.contains(CardType.CoreType.Land);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isArtifact() {
|
public boolean isArtifact() {
|
||||||
return this.coreType.contains(CardCoreType.Artifact);
|
return this.coreType.contains(CardType.CoreType.Artifact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInstant() {
|
public boolean isInstant() {
|
||||||
return this.coreType.contains(CardCoreType.Instant);
|
return this.coreType.contains(CardType.CoreType.Instant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSorcery() {
|
public boolean isSorcery() {
|
||||||
return this.coreType.contains(CardCoreType.Sorcery);
|
return this.coreType.contains(CardType.CoreType.Sorcery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVanguard() {
|
public boolean isVanguard() {
|
||||||
return this.coreType.contains(CardCoreType.Vanguard);
|
return this.coreType.contains(CardType.CoreType.Vanguard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isScheme() {
|
public boolean isScheme() {
|
||||||
return this.coreType.contains(CardCoreType.Scheme);
|
return this.coreType.contains(CardType.CoreType.Scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnchantment() {
|
public boolean isEnchantment() {
|
||||||
return this.coreType.contains(CardCoreType.Enchantment);
|
return this.coreType.contains(CardType.CoreType.Enchantment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBasic() {
|
public boolean isBasic() {
|
||||||
return this.superType.contains(CardSuperType.Basic);
|
return this.superType.contains(CardType.SuperType.Basic);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLegendary() {
|
public boolean isLegendary() {
|
||||||
return this.superType.contains(CardSuperType.Legendary);
|
return this.superType.contains(CardType.SuperType.Legendary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBasicLand() {
|
public boolean isBasicLand() {
|
||||||
@@ -198,10 +242,10 @@ public final class CardType implements Comparable<CardType> {
|
|||||||
|
|
||||||
public List<String> getTypesBeforeDash() {
|
public List<String> getTypesBeforeDash() {
|
||||||
final ArrayList<String> types = new ArrayList<String>();
|
final ArrayList<String> types = new ArrayList<String>();
|
||||||
for (final CardSuperType st : this.superType) {
|
for (final CardType.SuperType st : this.superType) {
|
||||||
types.add(st.name());
|
types.add(st.name());
|
||||||
}
|
}
|
||||||
for (final CardCoreType ct : this.coreType) {
|
for (final CardType.CoreType ct : this.coreType) {
|
||||||
types.add(ct.name());
|
types.add(ct.name());
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
@@ -227,11 +271,11 @@ public final class CardType implements Comparable<CardType> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlane() {
|
public boolean isPlane() {
|
||||||
return this.coreType.contains(CardCoreType.Plane);
|
return this.coreType.contains(CardType.CoreType.Plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPhenomenon() {
|
public boolean isPhenomenon() {
|
||||||
return this.coreType.contains(CardCoreType.Phenomenon);
|
return this.coreType.contains(CardType.CoreType.Phenomenon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
* Forge: Play Magic: the Gathering.
|
|
||||||
* Copyright (C) 2011 Forge Team
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package forge.card;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import forge.util.IItemReader;
|
|
||||||
import forge.util.storage.StorageBase;
|
|
||||||
import forge.util.storage.StorageReaderBase;
|
|
||||||
|
|
||||||
public final class EditionCollection extends StorageBase<CardEdition> {
|
|
||||||
|
|
||||||
private final Map<String, CardEdition> aliasToEdition = new TreeMap<String, CardEdition>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
public EditionCollection(IItemReader<CardEdition> reader) {
|
|
||||||
super("Card editions", reader);
|
|
||||||
|
|
||||||
for (CardEdition ee : this) {
|
|
||||||
String alias = ee.getAlias();
|
|
||||||
if (null != alias) {
|
|
||||||
aliasToEdition.put(alias, ee);
|
|
||||||
}
|
|
||||||
aliasToEdition.put(ee.getCode2(), ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a sets by code. It will search first by three letter codes, then by aliases and two-letter codes.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the sets the by code
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CardEdition get(final String code) {
|
|
||||||
CardEdition baseResult = super.get(code);
|
|
||||||
return baseResult == null ? aliasToEdition.get(code) : baseResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Iterable<CardEdition> getOrderedEditions() {
|
|
||||||
List<CardEdition> res = Lists.newArrayList(this);
|
|
||||||
Collections.sort(res);
|
|
||||||
Collections.reverse(res);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the sets by code or throw.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the sets the by code or throw
|
|
||||||
*/
|
|
||||||
public CardEdition getEditionByCodeOrThrow(final String code) {
|
|
||||||
final CardEdition set = this.get(code);
|
|
||||||
if (null == set) {
|
|
||||||
throw new RuntimeException(String.format("Edition with code '%s' not found", code));
|
|
||||||
}
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
// used by image generating code
|
|
||||||
/**
|
|
||||||
* Gets the code2 by code.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the code2 by code
|
|
||||||
*/
|
|
||||||
public String getCode2ByCode(final String code) {
|
|
||||||
final CardEdition set = this.get(code);
|
|
||||||
return set == null ? "" : set.getCode2();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Function<String, CardEdition> FN_EDITION_BY_CODE = new Function<String, CardEdition>() {
|
|
||||||
@Override
|
|
||||||
public CardEdition apply(String code) {
|
|
||||||
return EditionCollection.this.get(code);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Write javadoc for this method.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public IItemReader<SealedProductTemplate> getBoosterGenerator() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return new StorageReaderBase<SealedProductTemplate>(null) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, SealedProductTemplate> readAll() {
|
|
||||||
Map<String, SealedProductTemplate> map = new TreeMap<String, SealedProductTemplate>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
for(CardEdition ce : EditionCollection.this) {
|
|
||||||
map.put(ce.getCode(), ce.getBoosterTemplate());
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemKey(SealedProductTemplate item) {
|
|
||||||
return item.getEdition();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package forge.card;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import forge.util.TextUtil;
|
|
||||||
import forge.util.storage.StorageReaderFile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Write javadoc for this type.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class FatPackTemplate extends SealedProductTemplate {
|
|
||||||
private final int cntBoosters;
|
|
||||||
|
|
||||||
|
|
||||||
public int getCntBoosters() { return cntBoosters; }
|
|
||||||
|
|
||||||
private FatPackTemplate(String edition, int boosters, Iterable<Pair<String, Integer>> itrSlots)
|
|
||||||
{
|
|
||||||
super(edition, itrSlots);
|
|
||||||
cntBoosters = boosters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Reader extends StorageReaderFile<FatPackTemplate> {
|
|
||||||
public Reader(String pathname) {
|
|
||||||
super(pathname, FatPackTemplate.FN_GET_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected FatPackTemplate read(String line, int i) {
|
|
||||||
String[] headAndData = TextUtil.split(line, ':', 2);
|
|
||||||
final String edition = headAndData[0];
|
|
||||||
final String[] data = TextUtil.splitWithParenthesis(headAndData[1], ',');
|
|
||||||
int nBoosters = 6;
|
|
||||||
|
|
||||||
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
|
||||||
for(String slotDesc : data) {
|
|
||||||
String[] kv = TextUtil.split(slotDesc, ' ', 2);
|
|
||||||
if (kv[1].startsWith("Booster"))
|
|
||||||
nBoosters = Integer.parseInt(kv[0]);
|
|
||||||
else
|
|
||||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FatPackTemplate(edition, nBoosters, slots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
if (0 >= cntBoosters) {
|
|
||||||
return "no cards";
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
for(Pair<String, Integer> p : slots) {
|
|
||||||
s.append(p.getRight()).append(" ").append(p.getLeft()).append(", ");
|
|
||||||
}
|
|
||||||
// trim the last comma and space
|
|
||||||
if( s.length() > 0 )
|
|
||||||
s.replace(s.length() - 2, s.length(), "");
|
|
||||||
|
|
||||||
if (0 < cntBoosters) {
|
|
||||||
if( s.length() > 0 )
|
|
||||||
s.append(" and ");
|
|
||||||
|
|
||||||
s.append(cntBoosters).append(" booster packs ");
|
|
||||||
}
|
|
||||||
return s.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,12 +12,13 @@ import com.google.common.collect.Iterables;
|
|||||||
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.ItemPoolView;
|
import forge.util.ItemPoolView;
|
||||||
|
|
||||||
|
|
||||||
public class UnOpenedProduct implements IUnOpenedProduct {
|
public class UnOpenedProduct implements IUnOpenedProduct {
|
||||||
|
|
||||||
private final SealedProductTemplate tpl;
|
private final SealedProduct.Template tpl;
|
||||||
private final Map<String, PrintSheet> sheets;
|
private final Map<String, PrintSheet> sheets;
|
||||||
private boolean poolLimited = false; // if true after successful generation cards are removed from printsheets.
|
private boolean poolLimited = false; // if true after successful generation cards are removed from printsheets.
|
||||||
|
|
||||||
@@ -31,23 +32,23 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
|
|
||||||
|
|
||||||
// Means to select from all unique cards (from base game, ie. no schemes or avatars)
|
// Means to select from all unique cards (from base game, ie. no schemes or avatars)
|
||||||
public UnOpenedProduct(SealedProductTemplate template) {
|
public UnOpenedProduct(SealedProduct.Template template) {
|
||||||
tpl = template;
|
tpl = template;
|
||||||
sheets = null;
|
sheets = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke this constructor only if you are sure that the pool is not equal to deafult carddb
|
// Invoke this constructor only if you are sure that the pool is not equal to deafult carddb
|
||||||
public UnOpenedProduct(SealedProductTemplate template, ItemPoolView<PaperCard> pool) {
|
public UnOpenedProduct(SealedProduct.Template template, ItemPoolView<PaperCard> pool) {
|
||||||
this(template, pool.toFlatList());
|
this(template, pool.toFlatList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnOpenedProduct(SealedProductTemplate template, Iterable<PaperCard> cards) {
|
public UnOpenedProduct(SealedProduct.Template template, Iterable<PaperCard> cards) {
|
||||||
tpl = template;
|
tpl = template;
|
||||||
sheets = new TreeMap<String, PrintSheet>();
|
sheets = new TreeMap<String, PrintSheet>();
|
||||||
prebuildSheets(cards);
|
prebuildSheets(cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnOpenedProduct(SealedProductTemplate sealedProductTemplate, Predicate<PaperCard> filterPrinted) {
|
public UnOpenedProduct(SealedProduct.Template sealedProductTemplate, Predicate<PaperCard> filterPrinted) {
|
||||||
this(sealedProductTemplate, Iterables.filter(StaticData.instance().getCommonCards().getAllCards(), filterPrinted));
|
this(sealedProductTemplate, Iterables.filter(StaticData.instance().getCommonCards().getAllCards(), filterPrinted));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.Map.Entry;
|
|||||||
import org.apache.commons.lang3.Range;
|
import org.apache.commons.lang3.Range;
|
||||||
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.CardCoreType;
|
import forge.card.CardType;
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
@@ -178,7 +178,7 @@ public enum DeckFormat {
|
|||||||
int phenoms = 0;
|
int phenoms = 0;
|
||||||
for (Entry<PaperCard, Integer> cp : planes) {
|
for (Entry<PaperCard, Integer> cp : planes) {
|
||||||
|
|
||||||
if (cp.getKey().getRules().getType().typeContains(CardCoreType.Phenomenon)) {
|
if (cp.getKey().getRules().getType().typeContains(CardType.CoreType.Phenomenon)) {
|
||||||
phenoms++;
|
phenoms++;
|
||||||
}
|
}
|
||||||
if (cp.getValue() > 1) {
|
if (cp.getValue() > 1) {
|
||||||
|
|||||||
@@ -22,22 +22,21 @@ import com.google.common.base.Function;
|
|||||||
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
public class BoosterPack extends OpenablePack {
|
public class BoosterPack extends SealedProduct {
|
||||||
private final int artIndex;
|
private final int artIndex;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
|
|
||||||
public static final Function<CardEdition, BoosterPack> FN_FROM_SET = new Function<CardEdition, BoosterPack>() {
|
public static final Function<CardEdition, BoosterPack> FN_FROM_SET = new Function<CardEdition, BoosterPack>() {
|
||||||
@Override
|
@Override
|
||||||
public BoosterPack apply(final CardEdition arg1) {
|
public BoosterPack apply(final CardEdition arg1) {
|
||||||
SealedProductTemplate d = StaticData.instance().getBoosters().get(arg1.getCode());
|
Template d = StaticData.instance().getBoosters().get(arg1.getCode());
|
||||||
return new BoosterPack(arg1.getName(), d);
|
return new BoosterPack(arg1.getName(), d);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public BoosterPack(final String name0, final SealedProductTemplate boosterData) {
|
public BoosterPack(final String name0, final Template boosterData) {
|
||||||
super(name0, boosterData);
|
super(name0, boosterData);
|
||||||
int maxIdx = StaticData.instance().getEditions().get(boosterData.getEdition()).getCntBoosterPictures();
|
int maxIdx = StaticData.instance().getEditions().get(boosterData.getEdition()).getCntBoosterPictures();
|
||||||
artIndex = MyRandom.getRandom().nextInt(maxIdx) + 1;
|
artIndex = MyRandom.getRandom().nextInt(maxIdx) + 1;
|
||||||
@@ -58,7 +57,7 @@ public class BoosterPack extends OpenablePack {
|
|||||||
return new BoosterPack(name, contents);
|
return new BoosterPack(name, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SealedProductTemplate getBoosterData() {
|
public Template getBoosterData() {
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,25 +21,29 @@ package forge.item;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.FatPackTemplate;
|
import forge.util.TextUtil;
|
||||||
|
import forge.util.storage.StorageReaderFile;
|
||||||
|
|
||||||
public class FatPack extends OpenablePack {
|
public class FatPack extends SealedProduct {
|
||||||
public static final Function<CardEdition, FatPack> FN_FROM_SET = new Function<CardEdition, FatPack>() {
|
public static final Function<CardEdition, FatPack> FN_FROM_SET = new Function<CardEdition, FatPack>() {
|
||||||
@Override
|
@Override
|
||||||
public FatPack apply(final CardEdition arg1) {
|
public FatPack apply(final CardEdition arg1) {
|
||||||
FatPackTemplate d = StaticData.instance().getFatPacks().get(arg1.getCode());
|
FatPack.Template d = StaticData.instance().getFatPacks().get(arg1.getCode());
|
||||||
return new FatPack(arg1.getName(), d);
|
return new FatPack(arg1.getName(), d);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final FatPackTemplate fpData;
|
private final FatPack.Template fpData;
|
||||||
|
|
||||||
public FatPack(final String name0, final FatPackTemplate fpData0) {
|
public FatPack(final String name0, final FatPack.Template fpData0) {
|
||||||
super(name0, StaticData.instance().getBoosters().get(fpData0.getEdition()));
|
super(name0, StaticData.instance().getBoosters().get(fpData0.getEdition()));
|
||||||
fpData = fpData0;
|
fpData = fpData0;
|
||||||
}
|
}
|
||||||
@@ -73,4 +77,65 @@ public class FatPack extends OpenablePack {
|
|||||||
public int getTotalCards() {
|
public int getTotalCards() {
|
||||||
return super.getTotalCards() * fpData.getCntBoosters() + fpData.getNumberOfCardsExpected();
|
return super.getTotalCards() * fpData.getCntBoosters() + fpData.getNumberOfCardsExpected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Template extends SealedProduct.Template {
|
||||||
|
private final int cntBoosters;
|
||||||
|
|
||||||
|
|
||||||
|
public int getCntBoosters() { return cntBoosters; }
|
||||||
|
|
||||||
|
private Template(String edition, int boosters, Iterable<Pair<String, Integer>> itrSlots)
|
||||||
|
{
|
||||||
|
super(edition, itrSlots);
|
||||||
|
cntBoosters = boosters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Reader extends StorageReaderFile<Template> {
|
||||||
|
public Reader(String pathname) {
|
||||||
|
super(pathname, Template.FN_GET_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Template read(String line, int i) {
|
||||||
|
String[] headAndData = TextUtil.split(line, ':', 2);
|
||||||
|
final String edition = headAndData[0];
|
||||||
|
final String[] data = TextUtil.splitWithParenthesis(headAndData[1], ',');
|
||||||
|
int nBoosters = 6;
|
||||||
|
|
||||||
|
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
||||||
|
for(String slotDesc : data) {
|
||||||
|
String[] kv = TextUtil.split(slotDesc, ' ', 2);
|
||||||
|
if (kv[1].startsWith("Booster"))
|
||||||
|
nBoosters = Integer.parseInt(kv[0]);
|
||||||
|
else
|
||||||
|
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FatPack.Template(edition, nBoosters, slots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (0 >= cntBoosters) {
|
||||||
|
return "no cards";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
for(Pair<String, Integer> p : slots) {
|
||||||
|
s.append(p.getRight()).append(" ").append(p.getLeft()).append(", ");
|
||||||
|
}
|
||||||
|
// trim the last comma and space
|
||||||
|
if( s.length() > 0 )
|
||||||
|
s.replace(s.length() - 2, s.length(), "");
|
||||||
|
|
||||||
|
if (0 < cntBoosters) {
|
||||||
|
if( s.length() > 0 )
|
||||||
|
s.append(" and ");
|
||||||
|
|
||||||
|
s.append(cntBoosters).append(" booster packs ");
|
||||||
|
}
|
||||||
|
return s.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* Forge: Play Magic: the Gathering.
|
|
||||||
* Copyright (C) 2011 Forge Team
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package forge.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.base.Predicates;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
import forge.StaticData;
|
|
||||||
import forge.card.BoosterGenerator;
|
|
||||||
import forge.card.CardRulesPredicates;
|
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.util.Aggregates;
|
|
||||||
|
|
||||||
public abstract class OpenablePack implements InventoryItemFromSet {
|
|
||||||
protected final SealedProductTemplate contents;
|
|
||||||
protected final String name;
|
|
||||||
private final int hash;
|
|
||||||
private List<PaperCard> cards = null;
|
|
||||||
|
|
||||||
public OpenablePack(String name0, SealedProductTemplate boosterData) {
|
|
||||||
if (null == name0) { throw new IllegalArgumentException("name0 must not be null"); }
|
|
||||||
if (null == boosterData) { throw new IllegalArgumentException("boosterData must not be null"); }
|
|
||||||
contents = boosterData;
|
|
||||||
name = name0;
|
|
||||||
hash = name.hashCode() ^ getClass().hashCode() ^ contents.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final String getName() {
|
|
||||||
return name + " " + getItemType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return contents.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final String getEdition() {
|
|
||||||
return contents.getEdition();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final List<PaperCard> getCards() {
|
|
||||||
if (null == cards) {
|
|
||||||
cards = generate();
|
|
||||||
}
|
|
||||||
|
|
||||||
return cards;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalCards() {
|
|
||||||
return contents.getNumberOfCardsExpected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
OpenablePack other = (OpenablePack)obj;
|
|
||||||
return name.equals(other.name) && contents.equals(other.contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<PaperCard> generate() {
|
|
||||||
return BoosterGenerator.getBoosterPack(contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected PaperCard getRandomBasicLand(final String setCode) {
|
|
||||||
return this.getRandomBasicLands(setCode, 1).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<PaperCard> getRandomBasicLands(final String setCode, final int count) {
|
|
||||||
Predicate<PaperCard> cardsRule = Predicates.and(
|
|
||||||
IPaperCard.Predicates.printedInSet(setCode),
|
|
||||||
Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
|
||||||
return Aggregates.random(Iterables.filter(StaticData.instance().getCommonCards().getAllCards(), cardsRule), count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
213
forge-core/src/main/java/forge/item/SealedProduct.java
Normal file
213
forge-core/src/main/java/forge/item/SealedProduct.java
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
* Forge: Play Magic: the Gathering.
|
||||||
|
* Copyright (C) 2011 Forge Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package forge.item;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import forge.StaticData;
|
||||||
|
import forge.card.BoosterGenerator;
|
||||||
|
import forge.card.BoosterSlots;
|
||||||
|
import forge.card.CardRulesPredicates;
|
||||||
|
import forge.util.Aggregates;
|
||||||
|
import forge.util.TextUtil;
|
||||||
|
import forge.util.storage.StorageReaderFile;
|
||||||
|
|
||||||
|
public abstract class SealedProduct implements InventoryItemFromSet {
|
||||||
|
protected final Template contents;
|
||||||
|
protected final String name;
|
||||||
|
private final int hash;
|
||||||
|
private List<PaperCard> cards = null;
|
||||||
|
|
||||||
|
public SealedProduct(String name0, Template boosterData) {
|
||||||
|
if (null == name0) { throw new IllegalArgumentException("name0 must not be null"); }
|
||||||
|
if (null == boosterData) { throw new IllegalArgumentException("boosterData must not be null"); }
|
||||||
|
contents = boosterData;
|
||||||
|
name = name0;
|
||||||
|
hash = name.hashCode() ^ getClass().hashCode() ^ contents.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String getName() {
|
||||||
|
return name + " " + getItemType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return contents.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String getEdition() {
|
||||||
|
return contents.getEdition();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<PaperCard> getCards() {
|
||||||
|
if (null == cards) {
|
||||||
|
cards = generate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalCards() {
|
||||||
|
return contents.getNumberOfCardsExpected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SealedProduct other = (SealedProduct)obj;
|
||||||
|
return name.equals(other.name) && contents.equals(other.contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<PaperCard> generate() {
|
||||||
|
return BoosterGenerator.getBoosterPack(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PaperCard getRandomBasicLand(final String setCode) {
|
||||||
|
return this.getRandomBasicLands(setCode, 1).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<PaperCard> getRandomBasicLands(final String setCode, final int count) {
|
||||||
|
Predicate<PaperCard> cardsRule = Predicates.and(
|
||||||
|
IPaperCard.Predicates.printedInSet(setCode),
|
||||||
|
Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
||||||
|
return Aggregates.random(Iterables.filter(StaticData.instance().getCommonCards().getAllCards(), cardsRule), count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class Template {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public final static Template genericBooster = new Template(null, Lists.newArrayList(
|
||||||
|
Pair.of(BoosterSlots.COMMON, 10), Pair.of(BoosterSlots.UNCOMMON, 3),
|
||||||
|
Pair.of(BoosterSlots.RARE_MYTHIC, 1), Pair.of(BoosterSlots.BASIC_LAND, 1)
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
protected final List<Pair<String, Integer>> slots;
|
||||||
|
protected final String name;
|
||||||
|
|
||||||
|
|
||||||
|
public final List<Pair<String, Integer>> getSlots() {
|
||||||
|
return slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getEdition() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public Template(Iterable<Pair<String, Integer>> itrSlots)
|
||||||
|
{
|
||||||
|
this(null, itrSlots);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Template(String name0, Iterable<Pair<String, Integer>> itrSlots)
|
||||||
|
{
|
||||||
|
slots = Lists.newArrayList(itrSlots);
|
||||||
|
name = name0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Template(String code, String boosterDesc) {
|
||||||
|
this(code, Reader.parseSlots(boosterDesc));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumberOfCardsExpected() {
|
||||||
|
int sum = 0;
|
||||||
|
for(Pair<String, Integer> p : slots) {
|
||||||
|
sum += p.getRight().intValue();
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Function<? super Template, String> FN_GET_NAME = new Function<Template, String>() {
|
||||||
|
@Override
|
||||||
|
public String apply(Template arg1) {
|
||||||
|
return arg1.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
|
||||||
|
|
||||||
|
s.append("consisting of ");
|
||||||
|
for(Pair<String, Integer> p : slots) {
|
||||||
|
s.append(p.getRight()).append(" ").append(p.getLeft()).append(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// trim the last comma and space
|
||||||
|
s.replace(s.length() - 2, s.length(), "");
|
||||||
|
|
||||||
|
// put an 'and' before the previous comma
|
||||||
|
int lastCommaIdx = s.lastIndexOf(",");
|
||||||
|
if (0 < lastCommaIdx) {
|
||||||
|
s.replace(lastCommaIdx+1, lastCommaIdx+1, " and");
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static class Reader extends StorageReaderFile<Template> {
|
||||||
|
public Reader(File file) {
|
||||||
|
super(file, Template.FN_GET_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Pair<String, Integer>> parseSlots(String data) {
|
||||||
|
final String[] dataz = TextUtil.splitWithParenthesis(data, ',');
|
||||||
|
List<Pair<String, Integer>> slots = new ArrayList<Pair<String,Integer>>();
|
||||||
|
for(String slotDesc : dataz) {
|
||||||
|
String[] kv = TextUtil.splitWithParenthesis(slotDesc, ' ', 2);
|
||||||
|
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||||
|
}
|
||||||
|
return slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Template read(String line, int i) {
|
||||||
|
String[] headAndData = TextUtil.split(line, ':', 2);
|
||||||
|
return new Template(headAndData[0], parseSlots(headAndData[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package forge.card;
|
package forge.item;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import forge.card.BoosterSlots;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
import forge.util.storage.StorageReaderFile;
|
import forge.util.storage.StorageReaderFile;
|
||||||
|
|
||||||
@@ -24,20 +24,19 @@ import com.google.common.base.Function;
|
|||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
|
|
||||||
public class TournamentPack extends OpenablePack {
|
public class TournamentPack extends SealedProduct {
|
||||||
|
|
||||||
/** The Constant fnFromSet. */
|
/** The Constant fnFromSet. */
|
||||||
public static final Function<CardEdition, TournamentPack> FN_FROM_SET = new Function<CardEdition, TournamentPack>() {
|
public static final Function<CardEdition, TournamentPack> FN_FROM_SET = new Function<CardEdition, TournamentPack>() {
|
||||||
@Override
|
@Override
|
||||||
public TournamentPack apply(final CardEdition arg1) {
|
public TournamentPack apply(final CardEdition arg1) {
|
||||||
SealedProductTemplate d = StaticData.instance().getTournamentPacks().get(arg1.getCode());
|
Template d = StaticData.instance().getTournamentPacks().get(arg1.getCode());
|
||||||
return new TournamentPack(arg1.getName(), d);
|
return new TournamentPack(arg1.getName(), d);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public TournamentPack(final String name0, final SealedProductTemplate boosterData) {
|
public TournamentPack(final String name0, final Template boosterData) {
|
||||||
super(name0, boosterData);
|
super(name0, boosterData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,21 +15,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package forge.card;
|
package forge.game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum CardSuperType.
|
* The Class FormatUtils.
|
||||||
*/
|
*/
|
||||||
public enum CardSuperType {
|
|
||||||
|
|
||||||
/** The Basic. */
|
|
||||||
Basic,
|
/**
|
||||||
/** The Legendary. */
|
* TODO: Write javadoc for this type.
|
||||||
Legendary,
|
*
|
||||||
/** The Snow. */
|
*/
|
||||||
Snow,
|
|
||||||
/** The Ongoing. */
|
|
||||||
Ongoing,
|
|
||||||
/** The World. */
|
|
||||||
World
|
|
||||||
}
|
|
||||||
@@ -32,6 +32,8 @@ import forge.StaticData;
|
|||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
|
import forge.util.storage.StorageBase;
|
||||||
|
import forge.util.storage.StorageReaderBase;
|
||||||
import forge.util.storage.StorageReaderFileSections;
|
import forge.util.storage.StorageReaderFileSections;
|
||||||
|
|
||||||
|
|
||||||
@@ -211,5 +213,28 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
|
|
||||||
return new GameFormat(title, sets, bannedCards, 1 + idx);
|
return new GameFormat(title, sets, bannedCards, 1 + idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Collection extends StorageBase<GameFormat> {
|
||||||
|
public Collection(StorageReaderBase<GameFormat> reader) {
|
||||||
|
super("Format collections", reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameFormat getStandard() {
|
||||||
|
return this.map.get("Standard");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameFormat getExtended() {
|
||||||
|
return this.map.get("Extended");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameFormat getModern() {
|
||||||
|
return this.map.get("Modern");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameFormat getFormat(String format) {
|
||||||
|
return this.map.get(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
70
forge-gui/forge.profile.properties
Normal file
70
forge-gui/forge.profile.properties
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
#
|
||||||
|
# forge.profile.properties.example
|
||||||
|
#
|
||||||
|
# To get started using this file, just copy or rename it to
|
||||||
|
# forge.profile.properties and edit one or more of the paths below.
|
||||||
|
#
|
||||||
|
# Normally, users will not need to do anything here. Keeping the default paths
|
||||||
|
# is an easy way to make sure your Forge settings and data are kept safe when
|
||||||
|
# you upgrade Forge, even if you install to a different path or delete the
|
||||||
|
# entire Forge program directory before you upgrade.
|
||||||
|
#
|
||||||
|
# If you need to, though, you can use this file to set the locations that Forge
|
||||||
|
# will use to store your data. However, remember that whenever you install a
|
||||||
|
# new version of Forge into a different directory, it will not see your data
|
||||||
|
# unless you copy this file into the new program directory.
|
||||||
|
#
|
||||||
|
# If you specify a relative path in this file, it will be relative to the Forge
|
||||||
|
# program directory. Note that paths defined in this file will each have the
|
||||||
|
# whitespace trimmed from their start and end. If you need the path to start or
|
||||||
|
# end with a space or tab character, put a slash before or after it, as
|
||||||
|
# appropriate. For example, for the directory "<forge dir>/ local ", use:
|
||||||
|
# xxxDir=./ local /
|
||||||
|
#
|
||||||
|
# EXAMPLES
|
||||||
|
# --------
|
||||||
|
#
|
||||||
|
# To have Forge use the default directories:
|
||||||
|
# userDir=
|
||||||
|
# cacheDir=
|
||||||
|
# cardPicsDir=
|
||||||
|
#
|
||||||
|
# To use a specific user data directory but the default cache dir on Windows:
|
||||||
|
# userDir=D:/ForgeData
|
||||||
|
# cacheDir=
|
||||||
|
# cardPicsDir=
|
||||||
|
#
|
||||||
|
# To put everything under a specific path on a Unix-based system:
|
||||||
|
# userDir=/local/path/forge
|
||||||
|
# cacheDir=/local/path/forge/cache
|
||||||
|
cardPicsDir=A:\\mtg\\images
|
||||||
|
#cardPicsDir=D:\\Projects\\mtg\\img-unsorted
|
||||||
|
cardPicsSubDirs=LEA->LEA|LEB->LEB|2ED->2ED|ARN->ARN|ATQ->ATQ|3ED->3ED|LEG->LEG|DRK->DRK|FEM->FEM|4ED->4ED|ICE->ICE|CHR->CHR|HML->HML|ALL->ALL|MIR->MIR|VIS->VIS|5ED->5ED|POR->POR|WTH->WTH|TMP->TMP|STH->STH|EXO->EXO|PO2->P02|USG->USG|ULG->ULG|6ED->6ED|UDS->UDS|PTK->PTK|S99->S99|MMQ->MMQ|NMS->NEM|S00->S00|PCY->PCY|INV->INV|PLS->PLS|7ED->7ED|APC->APC|ODY->ODY|TOR->TOR|JUD->JUD|ONS->ONS|LGN->LGN|SCG->SCG|8ED->8ED|MRD->MRD|DST->DST|5DN->5DN|9ED->9ED|GPT->GPT|CSP->CSP|HOP->PCH|MBP->PR
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# This is where Forge will save your personal data, such as your saved decks,
|
||||||
|
# preferences, and quest progress. If you want to back up your data or copy it
|
||||||
|
# to another computer, this is the directory to copy. The default value is
|
||||||
|
# platform-specific, and may differ a bit from what is listed here if you have
|
||||||
|
# an older version of Windows:
|
||||||
|
# Windows: <your application data directory>/Forge/
|
||||||
|
# (usually, C:/Users/<your username>/Application Data/Roaming/Forge/)
|
||||||
|
# OSX: <your home directory>/Library/Application Support/Forge/
|
||||||
|
# Linux: <your home directory>/.forge/
|
||||||
|
#userDir=
|
||||||
|
|
||||||
|
# This is where forge will keep downloaded content, such as card pictures and
|
||||||
|
# updated price lists. The default values are:
|
||||||
|
# Windows: <your local application data directory>/Forge/Cache/
|
||||||
|
# (usually C:/Users/<your username>/Application Data/Local/Forge/Cache/)
|
||||||
|
# OSX: <your home directory>/Library/Caches/Forge/
|
||||||
|
# Linux: <your home directory>/.cache/forge/
|
||||||
|
#cacheDir=
|
||||||
|
|
||||||
|
# This is where forge will download and/or look for card picture data. The
|
||||||
|
# directory structure and filenames are the same as those used by Magic
|
||||||
|
# Workstation, and if you have both programs installed, you can share the same
|
||||||
|
# picture database between them. The default value (for all plaforms) is:
|
||||||
|
# <the cacheDir defined above>/pics/cards/
|
||||||
|
#cardPicsDir=
|
||||||
@@ -222,13 +222,13 @@ public final class CardBlock implements Comparable<CardBlock> {
|
|||||||
|
|
||||||
public static class Reader extends StorageReaderFile<CardBlock> {
|
public static class Reader extends StorageReaderFile<CardBlock> {
|
||||||
|
|
||||||
private final EditionCollection editions;
|
private final CardEdition.Collection editions;
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for Constructor.
|
* TODO: Write javadoc for Constructor.
|
||||||
* @param pathname
|
* @param pathname
|
||||||
* @param keySelector0
|
* @param keySelector0
|
||||||
*/
|
*/
|
||||||
public Reader(String pathname, EditionCollection editions0) {
|
public Reader(String pathname, CardEdition.Collection editions0) {
|
||||||
super(pathname, CardBlock.FN_GET_NAME);
|
super(pathname, CardBlock.FN_GET_NAME);
|
||||||
editions = editions0;
|
editions = editions0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import forge.Singletons;
|
|||||||
import forge.game.limited.CustomLimited;
|
import forge.game.limited.CustomLimited;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,7 +162,7 @@ public class MetaSet {
|
|||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case Full:
|
case Full:
|
||||||
return new UnOpenedProduct(SealedProductTemplate.genericBooster);
|
return new UnOpenedProduct(SealedProduct.Template.genericBooster);
|
||||||
|
|
||||||
case Booster:
|
case Booster:
|
||||||
return new UnOpenedProduct(Singletons.getMagicDb().getBoosters().get(data));
|
return new UnOpenedProduct(Singletons.getMagicDb().getBoosters().get(data));
|
||||||
@@ -174,7 +175,7 @@ public class MetaSet {
|
|||||||
|
|
||||||
case JoinedSet:
|
case JoinedSet:
|
||||||
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
Predicate<PaperCard> predicate = IPaperCard.Predicates.printedInSets(data.split(" "));
|
||||||
return new UnOpenedProduct(SealedProductTemplate.genericBooster, predicate);
|
return new UnOpenedProduct(SealedProduct.Template.genericBooster, predicate);
|
||||||
|
|
||||||
case Choose: return UnOpenedMeta.choose(data);
|
case Choose: return UnOpenedMeta.choose(data);
|
||||||
case Random: return UnOpenedMeta.random(data);
|
case Random: return UnOpenedMeta.random(data);
|
||||||
@@ -194,7 +195,7 @@ public class MetaSet {
|
|||||||
List<String> dfData = FileUtil.readFile("res/sealed/" + data + ".sealed");
|
List<String> dfData = FileUtil.readFile("res/sealed/" + data + ".sealed");
|
||||||
final CustomLimited myCube = CustomLimited.parse(dfData, Singletons.getModel().getDecks().getCubes());
|
final CustomLimited myCube = CustomLimited.parse(dfData, Singletons.getModel().getDecks().getCubes());
|
||||||
|
|
||||||
SealedProductTemplate fnPick = myCube.getSealedProductTemplate();
|
SealedProduct.Template fnPick = myCube.getSealedProductTemplate();
|
||||||
return new UnOpenedProduct(fnPick, myCube.getCardPool());
|
return new UnOpenedProduct(fnPick, myCube.getCardPool());
|
||||||
|
|
||||||
default: return null;
|
default: return null;
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ import forge.card.CardBlock;
|
|||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardEditionPredicates;
|
import forge.card.CardEditionPredicates;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.HttpUtil;
|
import forge.util.HttpUtil;
|
||||||
@@ -86,7 +86,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
|
|
||||||
switch (draftType) {
|
switch (draftType) {
|
||||||
case Full: // Draft from all cards in Forge
|
case Full: // Draft from all cards in Forge
|
||||||
Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProductTemplate.genericBooster);
|
Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericBooster);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) this.product.add(s);
|
for (int i = 0; i < 3; i++) this.product.add(s);
|
||||||
IBoosterDraft.LAND_SET_CODE[0] = CardEditionPredicates.getRandomSetWithAllBasicLands(Singletons.getMagicDb().getEditions());
|
IBoosterDraft.LAND_SET_CODE[0] = CardEditionPredicates.getRandomSetWithAllBasicLands(Singletons.getMagicDb().getEditions());
|
||||||
@@ -158,7 +158,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
throw new RuntimeException("BoosterGenerator : deck not found");
|
throw new RuntimeException("BoosterGenerator : deck not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
final SealedProductTemplate tpl = draft.getSealedProductTemplate();
|
final SealedProduct.Template tpl = draft.getSealedProductTemplate();
|
||||||
|
|
||||||
UnOpenedProduct toAdd = new UnOpenedProduct(tpl, dPool);
|
UnOpenedProduct toAdd = new UnOpenedProduct(tpl, dPool);
|
||||||
toAdd.setLimitedPool(draft.isSingleton());
|
toAdd.setLimitedPool(draft.isSingleton());
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEditionPredicates;
|
import forge.card.CardEditionPredicates;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckBase;
|
import forge.deck.DeckBase;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
import forge.util.ItemPoolView;
|
import forge.util.ItemPoolView;
|
||||||
@@ -45,7 +45,7 @@ import forge.util.storage.IStorage;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class CustomLimited extends DeckBase {
|
public class CustomLimited extends DeckBase {
|
||||||
private final SealedProductTemplate tpl;
|
private final SealedProduct.Template tpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for Constructor.
|
* TODO: Write javadoc for Constructor.
|
||||||
@@ -55,7 +55,7 @@ public class CustomLimited extends DeckBase {
|
|||||||
*/
|
*/
|
||||||
public CustomLimited(final String name0, List<Pair<String, Integer>> slots) {
|
public CustomLimited(final String name0, List<Pair<String, Integer>> slots) {
|
||||||
super(name0);
|
super(name0);
|
||||||
tpl = new SealedProductTemplate(slots);
|
tpl = new SealedProduct.Template(slots);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 7435640939026612173L;
|
private static final long serialVersionUID = 7435640939026612173L;
|
||||||
@@ -101,7 +101,7 @@ public class CustomLimited extends DeckBase {
|
|||||||
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
slots = SealedProductTemplate.genericBooster.getSlots();
|
slots = SealedProduct.Template.genericBooster.getSlots();
|
||||||
|
|
||||||
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
final CustomLimited cd = new CustomLimited(data.get("Name"), slots);
|
||||||
cd.landSetCode = data.get("LandSetCode");
|
cd.landSetCode = data.get("LandSetCode");
|
||||||
@@ -166,7 +166,7 @@ public class CustomLimited extends DeckBase {
|
|||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public SealedProductTemplate getSealedProductTemplate() {
|
public SealedProduct.Template getSealedProductTemplate() {
|
||||||
return tpl;
|
return tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ import forge.card.CardBlock;
|
|||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardEditionPredicates;
|
import forge.card.CardEditionPredicates;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.card.UnOpenedMeta;
|
import forge.card.UnOpenedMeta;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
@@ -71,7 +71,7 @@ public class SealedCardPoolGenerator {
|
|||||||
case Full:
|
case Full:
|
||||||
// Choose number of boosters
|
// Choose number of boosters
|
||||||
|
|
||||||
chooseNumberOfBoosters(new UnOpenedProduct(SealedProductTemplate.genericBooster));
|
chooseNumberOfBoosters(new UnOpenedProduct(SealedProduct.Template.genericBooster));
|
||||||
landSetCode = CardEditionPredicates.getRandomSetWithAllBasicLands(Singletons.getMagicDb().getEditions()).getCode();
|
landSetCode = CardEditionPredicates.getRandomSetWithAllBasicLands(Singletons.getMagicDb().getEditions()).getCode();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import forge.gui.toolbox.FSkin;
|
|||||||
import forge.gui.toolbox.FHtmlViewer;
|
import forge.gui.toolbox.FHtmlViewer;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.InventoryItemFromSet;
|
import forge.item.InventoryItemFromSet;
|
||||||
import forge.item.OpenablePack;
|
import forge.item.SealedProduct;
|
||||||
import forge.item.PreconDeck;
|
import forge.item.PreconDeck;
|
||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
|
|
||||||
@@ -159,8 +159,8 @@ public class CardDetailPanel extends FPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getItemDescription(InventoryItemFromSet i) {
|
public String getItemDescription(InventoryItemFromSet i) {
|
||||||
if( i instanceof OpenablePack )
|
if( i instanceof SealedProduct )
|
||||||
return ((OpenablePack)i).getDescription();
|
return ((SealedProduct)i).getDescription();
|
||||||
if( i instanceof PreconDeck)
|
if( i instanceof PreconDeck)
|
||||||
return ((PreconDeck) i).getDescription();
|
return ((PreconDeck) i).getDescription();
|
||||||
return i.getName();
|
return i.getName();
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import forge.ImageCache;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.EditionCollection;
|
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
@@ -404,7 +403,7 @@ public class ImportSourceAnalyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditionCollection editions = Singletons.getMagicDb().getEditions();
|
CardEdition.Collection editions = Singletons.getMagicDb().getEditions();
|
||||||
String editionCode = root.getName();
|
String editionCode = root.getName();
|
||||||
CardEdition edition = editions.get(editionCode);
|
CardEdition edition = editions.get(editionCode);
|
||||||
if (null == edition) {
|
if (null == edition) {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.common.base.Predicates;
|
|||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.EditionCollection;
|
|
||||||
import forge.deck.DeckBase;
|
import forge.deck.DeckBase;
|
||||||
import forge.game.GameFormat;
|
import forge.game.GameFormat;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
@@ -186,7 +185,7 @@ public enum CCardCatalog implements ICDoc {
|
|||||||
}
|
}
|
||||||
}, canSearch());
|
}, canSearch());
|
||||||
JMenu fmt = new JMenu("Format");
|
JMenu fmt = new JMenu("Format");
|
||||||
for (final GameFormat f : Singletons.getMagicDb().getFormats()) {
|
for (final GameFormat f : Singletons.getModel().getFormats()) {
|
||||||
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -503,7 +502,7 @@ public enum CCardCatalog implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Pair<FLabel, Predicate<PaperCard>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
private Pair<FLabel, Predicate<PaperCard>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
||||||
EditionCollection editions = Singletons.getMagicDb().getEditions();
|
CardEdition.Collection editions = Singletons.getMagicDb().getEditions();
|
||||||
StringBuilder tooltip = new StringBuilder("<html>Sets:");
|
StringBuilder tooltip = new StringBuilder("<html>Sets:");
|
||||||
|
|
||||||
int lastLen = 0;
|
int lastLen = 0;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import forge.item.PaperCard;
|
|||||||
import forge.item.FatPack;
|
import forge.item.FatPack;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.OpenablePack;
|
import forge.item.SealedProduct;
|
||||||
import forge.item.PreconDeck;
|
import forge.item.PreconDeck;
|
||||||
import forge.item.TournamentPack;
|
import forge.item.TournamentPack;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
@@ -309,9 +309,9 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
this.getDeckManager().addItem(card, qty);
|
this.getDeckManager().addItem(card, qty);
|
||||||
this.questData.getCards().buyCard(card, qty, value);
|
this.questData.getCards().buyCard(card, qty, value);
|
||||||
|
|
||||||
} else if (item instanceof OpenablePack) {
|
} else if (item instanceof SealedProduct) {
|
||||||
for (int i = 0; qty > i; ++i) {
|
for (int i = 0; qty > i; ++i) {
|
||||||
OpenablePack booster = null;
|
SealedProduct booster = null;
|
||||||
if (item instanceof BoosterPack) {
|
if (item instanceof BoosterPack) {
|
||||||
booster = (BoosterPack) ((BoosterPack) item).clone();
|
booster = (BoosterPack) ((BoosterPack) item).clone();
|
||||||
} else if (item instanceof TournamentPack) {
|
} else if (item instanceof TournamentPack) {
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
cbxPrizedCards.addItem(StartingPoolType.CustomFormat);
|
cbxPrizedCards.addItem(StartingPoolType.CustomFormat);
|
||||||
cbxPrizedCards.addActionListener(alPrizesPool);
|
cbxPrizedCards.addActionListener(alPrizesPool);
|
||||||
|
|
||||||
for (GameFormat gf : Singletons.getMagicDb().getFormats()) {
|
for (GameFormat gf : Singletons.getModel().getFormats()) {
|
||||||
cbxFormat.addItem(gf);
|
cbxFormat.addItem(gf);
|
||||||
cbxPrizeFormat.addItem(gf);
|
cbxPrizeFormat.addItem(gf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import forge.Card;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameEndReason;
|
import forge.game.GameEndReason;
|
||||||
@@ -56,7 +55,7 @@ import forge.gui.toolbox.FSkin.SkinIcon;
|
|||||||
import forge.item.BoosterPack;
|
import forge.item.BoosterPack;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.OpenablePack;
|
import forge.item.SealedProduct;
|
||||||
import forge.item.TournamentPack;
|
import forge.item.TournamentPack;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -542,7 +541,7 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
String preferredFormat = Singletons.getModel().getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
|
String preferredFormat = Singletons.getModel().getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
|
||||||
|
|
||||||
GameFormat pref = null;
|
GameFormat pref = null;
|
||||||
for (GameFormat f : Singletons.getMagicDb().getFormats()) {
|
for (GameFormat f : Singletons.getModel().getFormats()) {
|
||||||
formats.add(f);
|
formats.add(f);
|
||||||
if (f.toString().equals(preferredFormat)) {
|
if (f.toString().equals(preferredFormat)) {
|
||||||
pref = f;
|
pref = f;
|
||||||
@@ -563,7 +562,7 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
} else {
|
} else {
|
||||||
final List<String> sets = new ArrayList<String>();
|
final List<String> sets = new ArrayList<String>();
|
||||||
|
|
||||||
for (SealedProductTemplate bd : Singletons.getMagicDb().getBoosters()) {
|
for (SealedProduct.Template bd : Singletons.getMagicDb().getBoosters()) {
|
||||||
if (bd != null && qData.getFormat().isSetLegal(bd.getEdition())) {
|
if (bd != null && qData.getFormat().isSetLegal(bd.getEdition())) {
|
||||||
sets.add(bd.getEdition());
|
sets.add(bd.getEdition());
|
||||||
}
|
}
|
||||||
@@ -662,7 +661,7 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
cardsWon.add((PaperCard) ii);
|
cardsWon.add((PaperCard) ii);
|
||||||
} else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
|
} else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
|
||||||
List<PaperCard> boosterCards = new ArrayList<PaperCard>();
|
List<PaperCard> boosterCards = new ArrayList<PaperCard>();
|
||||||
OpenablePack booster = null;
|
SealedProduct booster = null;
|
||||||
if (ii instanceof BoosterPack) {
|
if (ii instanceof BoosterPack) {
|
||||||
booster = (BoosterPack) ((BoosterPack) ii).clone();
|
booster = (BoosterPack) ((BoosterPack) ii).clone();
|
||||||
boosterCards.addAll(booster.getCards());
|
boosterCards.addAll(booster.getCards());
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public final class CardManager extends ItemManager<PaperCard> {
|
|||||||
@Override
|
@Override
|
||||||
protected void buildFilterMenu(JPopupMenu menu) {
|
protected void buildFilterMenu(JPopupMenu menu) {
|
||||||
JMenu fmt = new JMenu("Format");
|
JMenu fmt = new JMenu("Format");
|
||||||
for (final GameFormat f : Singletons.getMagicDb().getFormats()) {
|
for (final GameFormat f : Singletons.getModel().getFormats()) {
|
||||||
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package forge.gui.toolbox.itemmanager.table;
|
|||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.EditionCollection;
|
import forge.card.CardEdition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper to show explanatory tooltips for edition set abbreviations.
|
* A wrapper to show explanatory tooltips for edition set abbreviations.
|
||||||
@@ -32,7 +32,7 @@ public class SetCodeRenderer extends DefaultTableCellRenderer implements AlwaysS
|
|||||||
String setAbbrev = getText();
|
String setAbbrev = getText();
|
||||||
String setFullName = "Unknown set";
|
String setFullName = "Unknown set";
|
||||||
|
|
||||||
EditionCollection editions = Singletons.getMagicDb().getEditions();
|
CardEdition.Collection editions = Singletons.getMagicDb().getEditions();
|
||||||
|
|
||||||
if (null != setAbbrev && editions.contains(setAbbrev)) {
|
if (null != setAbbrev && editions.contains(setAbbrev)) {
|
||||||
setFullName = editions.get(setAbbrev).getName();
|
setFullName = editions.get(setAbbrev).getName();
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.common.base.Predicates;
|
|||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.EditionCollection;
|
|
||||||
import forge.game.GameFormat;
|
import forge.game.GameFormat;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
import forge.gui.workshop.views.VWorkshopCatalog;
|
import forge.gui.workshop.views.VWorkshopCatalog;
|
||||||
@@ -174,7 +173,7 @@ public enum CWorkshopCatalog implements ICDoc {
|
|||||||
}
|
}
|
||||||
}, canSearch());
|
}, canSearch());
|
||||||
JMenu fmt = new JMenu("Format");
|
JMenu fmt = new JMenu("Format");
|
||||||
for (final GameFormat f : Singletons.getMagicDb().getFormats()) {
|
for (final GameFormat f : Singletons.getModel().getFormats()) {
|
||||||
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
GuiUtils.addMenuItem(fmt, f.getName(), null, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -490,7 +489,7 @@ public enum CWorkshopCatalog implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Pair<FLabel, Predicate<PaperCard>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
private Pair<FLabel, Predicate<PaperCard>> buildFormatRestriction(String displayName, GameFormat format, boolean allowReprints) {
|
||||||
EditionCollection editions = Singletons.getMagicDb().getEditions();
|
CardEdition.Collection editions = Singletons.getMagicDb().getEditions();
|
||||||
StringBuilder tooltip = new StringBuilder("<html>Sets:");
|
StringBuilder tooltip = new StringBuilder("<html>Sets:");
|
||||||
|
|
||||||
int lastLen = 0;
|
int lastLen = 0;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.Singletons;
|
|||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardType;
|
import forge.card.CardType;
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
|
import forge.game.GameFormat;
|
||||||
import forge.game.ai.AiProfileUtil;
|
import forge.game.ai.AiProfileUtil;
|
||||||
import forge.game.limited.GauntletMini;
|
import forge.game.limited.GauntletMini;
|
||||||
import forge.gauntlet.GauntletData;
|
import forge.gauntlet.GauntletData;
|
||||||
@@ -73,7 +74,8 @@ public class FModel {
|
|||||||
private final IStorage<CardBlock> blocks;
|
private final IStorage<CardBlock> blocks;
|
||||||
private final IStorage<CardBlock> fantasyBlocks;
|
private final IStorage<CardBlock> fantasyBlocks;
|
||||||
private final IStorage<QuestWorld> worlds;
|
private final IStorage<QuestWorld> worlds;
|
||||||
|
private final GameFormat.Collection formats;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static FModel instance = null;
|
private static FModel instance = null;
|
||||||
@@ -131,6 +133,8 @@ public class FModel {
|
|||||||
} catch (final Exception exn) {
|
} catch (final Exception exn) {
|
||||||
throw new RuntimeException(exn);
|
throw new RuntimeException(exn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.formats = new GameFormat.Collection(new GameFormat.Reader(new File("res/blockdata", "formats.txt")));
|
||||||
|
|
||||||
this.blocks = new StorageBase<CardBlock>("Block definitions", new CardBlock.Reader("res/blockdata/blocks.txt", Singletons.getMagicDb().getEditions()));
|
this.blocks = new StorageBase<CardBlock>("Block definitions", new CardBlock.Reader("res/blockdata/blocks.txt", Singletons.getMagicDb().getEditions()));
|
||||||
this.questPreferences = new QuestPreferences();
|
this.questPreferences = new QuestPreferences();
|
||||||
@@ -309,7 +313,9 @@ public class FModel {
|
|||||||
public final IStorage<QuestWorld> getWorlds() {
|
public final IStorage<QuestWorld> getWorlds() {
|
||||||
return this.worlds;
|
return this.worlds;
|
||||||
}
|
}
|
||||||
|
public final GameFormat.Collection getFormats() {
|
||||||
|
return this.formats;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Finalizer, generally should be avoided, but here closes the log file
|
* Finalizer, generally should be avoided, but here closes the log file
|
||||||
* stream and resets the system output streams.
|
* stream and resets the system output streams.
|
||||||
|
|||||||
@@ -34,19 +34,18 @@ import forge.card.BoosterSlots;
|
|||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardEditionPredicates;
|
import forge.card.CardEditionPredicates;
|
||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
import forge.card.FormatCollection;
|
|
||||||
import forge.card.ICardDatabase;
|
import forge.card.ICardDatabase;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
|
import forge.game.GameFormat;
|
||||||
import forge.item.BoosterPack;
|
import forge.item.BoosterPack;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.FatPack;
|
import forge.item.FatPack;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.OpenablePack;
|
import forge.item.SealedProduct;
|
||||||
import forge.item.PreconDeck;
|
import forge.item.PreconDeck;
|
||||||
import forge.item.TournamentPack;
|
import forge.item.TournamentPack;
|
||||||
import forge.quest.bazaar.QuestItemType;
|
import forge.quest.bazaar.QuestItemType;
|
||||||
@@ -269,7 +268,7 @@ public final class QuestUtilCards {
|
|||||||
* @param value
|
* @param value
|
||||||
* the value
|
* the value
|
||||||
*/
|
*/
|
||||||
public void buyPack(final OpenablePack booster, final int value) {
|
public void buyPack(final SealedProduct booster, final int value) {
|
||||||
if (this.qa.getCredits() >= value) {
|
if (this.qa.getCredits() >= value) {
|
||||||
this.qa.setCredits(this.qa.getCredits() - value);
|
this.qa.setCredits(this.qa.getCredits() - value);
|
||||||
this.qa.getShopList().remove(booster);
|
this.qa.getShopList().remove(booster);
|
||||||
@@ -429,7 +428,7 @@ public final class QuestUtilCards {
|
|||||||
/**
|
/**
|
||||||
* Generate cards in shop.
|
* Generate cards in shop.
|
||||||
*/
|
*/
|
||||||
private final FormatCollection formats = Singletons.getMagicDb().getFormats();
|
private final GameFormat.Collection formats = Singletons.getModel().getFormats();
|
||||||
private final Predicate<CardEdition> filterExt = CardEditionPredicates.isLegalInFormat(this.formats.getExtended());
|
private final Predicate<CardEdition> filterExt = CardEditionPredicates.isLegalInFormat(this.formats.getExtended());
|
||||||
|
|
||||||
/** The filter t2booster. */
|
/** The filter t2booster. */
|
||||||
@@ -524,8 +523,8 @@ public final class QuestUtilCards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private SealedProductTemplate getShopBoosterTemplate() {
|
private SealedProduct.Template getShopBoosterTemplate() {
|
||||||
return new SealedProductTemplate(Lists.newArrayList(
|
return new SealedProduct.Template(Lists.newArrayList(
|
||||||
Pair.of(BoosterSlots.COMMON, this.qpref.getPrefInt(QPref.SHOP_SINGLES_COMMON)),
|
Pair.of(BoosterSlots.COMMON, this.qpref.getPrefInt(QPref.SHOP_SINGLES_COMMON)),
|
||||||
Pair.of(BoosterSlots.UNCOMMON, this.qpref.getPrefInt(QPref.SHOP_SINGLES_UNCOMMON)),
|
Pair.of(BoosterSlots.UNCOMMON, this.qpref.getPrefInt(QPref.SHOP_SINGLES_UNCOMMON)),
|
||||||
Pair.of(BoosterSlots.RARE_MYTHIC, this.qpref.getPrefInt(QPref.SHOP_SINGLES_RARE))
|
Pair.of(BoosterSlots.RARE_MYTHIC, this.qpref.getPrefInt(QPref.SHOP_SINGLES_RARE))
|
||||||
@@ -533,8 +532,8 @@ public final class QuestUtilCards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private SealedProductTemplate getBoosterTemplate() {
|
private SealedProduct.Template getBoosterTemplate() {
|
||||||
return new SealedProductTemplate(Lists.newArrayList(
|
return new SealedProduct.Template(Lists.newArrayList(
|
||||||
Pair.of(BoosterSlots.COMMON, this.qpref.getPrefInt(QPref.BOOSTER_COMMONS)),
|
Pair.of(BoosterSlots.COMMON, this.qpref.getPrefInt(QPref.BOOSTER_COMMONS)),
|
||||||
Pair.of(BoosterSlots.UNCOMMON, this.qpref.getPrefInt(QPref.BOOSTER_UNCOMMONS)),
|
Pair.of(BoosterSlots.UNCOMMON, this.qpref.getPrefInt(QPref.BOOSTER_UNCOMMONS)),
|
||||||
Pair.of(BoosterSlots.RARE_MYTHIC, this.qpref.getPrefInt(QPref.BOOSTER_RARES))
|
Pair.of(BoosterSlots.RARE_MYTHIC, this.qpref.getPrefInt(QPref.BOOSTER_RARES))
|
||||||
@@ -556,7 +555,7 @@ public final class QuestUtilCards {
|
|||||||
final int totalPacks = Math.min(levelPacks + winPacks, maxPacks);
|
final int totalPacks = Math.min(levelPacks + winPacks, maxPacks);
|
||||||
|
|
||||||
|
|
||||||
SealedProductTemplate tpl = getShopBoosterTemplate();
|
SealedProduct.Template tpl = getShopBoosterTemplate();
|
||||||
UnOpenedProduct unopened = qc.getFormat() == null ? new UnOpenedProduct(tpl) : new UnOpenedProduct(tpl, qc.getFormat().getFilterPrinted());
|
UnOpenedProduct unopened = qc.getFormat() == null ? new UnOpenedProduct(tpl) : new UnOpenedProduct(tpl, qc.getFormat().getFilterPrinted());
|
||||||
|
|
||||||
for (int i = 0; i < totalPacks; i++) {
|
for (int i = 0; i < totalPacks; i++) {
|
||||||
@@ -681,8 +680,8 @@ public final class QuestUtilCards {
|
|||||||
} else if (i instanceof PreconDeck) {
|
} else if (i instanceof PreconDeck) {
|
||||||
PreconDeck pDeck = (PreconDeck) i;
|
PreconDeck pDeck = (PreconDeck) i;
|
||||||
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? -1 : -2;
|
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? -1 : -2;
|
||||||
} else if (i instanceof OpenablePack) {
|
} else if (i instanceof SealedProduct) {
|
||||||
OpenablePack oPack = (OpenablePack) i;
|
SealedProduct oPack = (SealedProduct) i;
|
||||||
return getCompletionPercent(oPack.getEdition()) - 103;
|
return getCompletionPercent(oPack.getEdition()) - 103;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -699,8 +698,8 @@ public final class QuestUtilCards {
|
|||||||
} else if (i instanceof PreconDeck) {
|
} else if (i instanceof PreconDeck) {
|
||||||
PreconDeck pDeck = (PreconDeck) i;
|
PreconDeck pDeck = (PreconDeck) i;
|
||||||
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? "YES" : "NO";
|
return Singletons.getModel().getQuest().getMyDecks().contains(pDeck.getName()) ? "YES" : "NO";
|
||||||
} else if (i instanceof OpenablePack) {
|
} else if (i instanceof SealedProduct) {
|
||||||
OpenablePack oPack = (OpenablePack) i;
|
SealedProduct oPack = (SealedProduct) i;
|
||||||
return String.format("%d%%", getCompletionPercent(oPack.getEdition()));
|
return String.format("%d%%", getCompletionPercent(oPack.getEdition()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.gui.CardListViewer;
|
import forge.gui.CardListViewer;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.quest.io.ReadPriceList;
|
import forge.quest.io.ReadPriceList;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
|
|
||||||
@@ -182,8 +182,8 @@ public class QuestUtilUnlockSets {
|
|||||||
*/
|
*/
|
||||||
public static void doUnlock(QuestController qData, final CardEdition unlockedSet) {
|
public static void doUnlock(QuestController qData, final CardEdition unlockedSet) {
|
||||||
|
|
||||||
IStorage<SealedProductTemplate> starters = Singletons.getMagicDb().getTournamentPacks();
|
IStorage<SealedProduct.Template> starters = Singletons.getMagicDb().getTournamentPacks();
|
||||||
IStorage<SealedProductTemplate> boosters = Singletons.getMagicDb().getBoosters();
|
IStorage<SealedProduct.Template> boosters = Singletons.getMagicDb().getBoosters();
|
||||||
qData.getFormat().unlockSet(unlockedSet.getCode());
|
qData.getFormat().unlockSet(unlockedSet.getCode());
|
||||||
|
|
||||||
List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import java.util.List;
|
|||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.SealedProductTemplate;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.limited.IBoosterDraft;
|
import forge.game.limited.IBoosterDraft;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
|
import forge.item.SealedProduct;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
import forge.util.ItemPoolView;
|
import forge.util.ItemPoolView;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
|||||||
@Override
|
@Override
|
||||||
public ItemPoolView<PaperCard> nextChoice() {
|
public ItemPoolView<PaperCard> nextChoice() {
|
||||||
this.n--;
|
this.n--;
|
||||||
SealedProductTemplate booster = Singletons.getMagicDb().getBoosters().get("M11");
|
SealedProduct.Template booster = Singletons.getMagicDb().getBoosters().get("M11");
|
||||||
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
return ItemPool.createFrom(BoosterGenerator.getBoosterPack(booster), PaperCard.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user