mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
SetInfo => EditionInfo, same rename for *utils
moved EditionUtils, FormatUtils from AllZone to FModel
This commit is contained in:
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -11060,10 +11060,10 @@ src/main/java/forge/card/CardRules.java -text
|
||||
src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain
|
||||
src/main/java/forge/card/CardSuperType.java -text
|
||||
src/main/java/forge/card/CardType.java -text
|
||||
src/main/java/forge/card/EditionInfo.java svneol=native#text/plain
|
||||
src/main/java/forge/card/EditionUtils.java svneol=native#text/plain
|
||||
src/main/java/forge/card/FormatUtils.java -text
|
||||
src/main/java/forge/card/MtgDataParser.java -text
|
||||
src/main/java/forge/card/SetInfo.java svneol=native#text/plain
|
||||
src/main/java/forge/card/SetUtils.java svneol=native#text/plain
|
||||
src/main/java/forge/card/TriggerReplacementBase.java -text
|
||||
src/main/java/forge/card/abilityfactory/AbilityFactory.java svneol=native#text/plain
|
||||
src/main/java/forge/card/abilityfactory/AbilityFactoryAlterLife.java svneol=native#text/plain
|
||||
|
||||
@@ -22,8 +22,6 @@ import java.util.List;
|
||||
|
||||
import net.slightlymagic.braids.util.UtilFunctions;
|
||||
import forge.Constant.Zone;
|
||||
import forge.card.FormatUtils;
|
||||
import forge.card.SetUtils;
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
import forge.card.cardfactory.PreloadingCardFactory;
|
||||
import forge.card.replacement.ReplacementHandler;
|
||||
@@ -533,18 +531,5 @@ public final class AllZone {
|
||||
return AllZone.cardRatings;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
private static SetUtils setUtils = null;
|
||||
public static SetUtils getEditions() {
|
||||
return setUtils != null ? setUtils : (setUtils = new SetUtils());
|
||||
}
|
||||
|
||||
private static FormatUtils formats = null;
|
||||
public static FormatUtils getFormats() {
|
||||
return formats != null ? formats : (formats = new FormatUtils());
|
||||
}
|
||||
|
||||
} // AllZone
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.Constant.Zone;
|
||||
import forge.card.CardCharacteristics;
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.mana.ManaCost;
|
||||
@@ -8239,9 +8239,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* </p>
|
||||
*
|
||||
* @param sInfo
|
||||
* a {@link forge.card.SetInfo} object.
|
||||
* a {@link forge.card.EditionInfo} object.
|
||||
*/
|
||||
public final void addSet(final SetInfo sInfo) {
|
||||
public final void addSet(final EditionInfo sInfo) {
|
||||
this.getCharacteristics().getSets().add(sInfo);
|
||||
}
|
||||
|
||||
@@ -8252,7 +8252,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public final ArrayList<SetInfo> getSets() {
|
||||
public final ArrayList<EditionInfo> getSets() {
|
||||
return this.getCharacteristics().getSets();
|
||||
}
|
||||
|
||||
@@ -8264,7 +8264,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @param siList
|
||||
* a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public final void setSets(final ArrayList<SetInfo> siList) {
|
||||
public final void setSets(final ArrayList<EditionInfo> siList) {
|
||||
this.getCharacteristics().setSets(siList);
|
||||
}
|
||||
|
||||
@@ -8302,7 +8302,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
final Random r = MyRandom.getRandom();
|
||||
final SetInfo si = this.getCharacteristics().getSets()
|
||||
final EditionInfo si = this.getCharacteristics().getSets()
|
||||
.get(r.nextInt(this.getCharacteristics().getSets().size()));
|
||||
|
||||
this.curSetCode = si.getCode();
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||
|
||||
import com.google.code.jyield.Generator;
|
||||
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -351,7 +351,7 @@ public class CardFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final SetInfo set : c.getSets()) {
|
||||
for (final EditionInfo set : c.getSets()) {
|
||||
if ((set != null) && sets.contains(set.toString())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
import com.google.code.jyield.Generator;
|
||||
import com.google.code.jyield.Yieldable;
|
||||
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class CardList implements Iterable<Card> {
|
||||
public final CardList getSets(final ArrayList<String> sets) {
|
||||
final CardList list = new CardList();
|
||||
for (final Card c : this) {
|
||||
for (final SetInfo set : c.getSets()) {
|
||||
for (final EditionInfo set : c.getSets()) {
|
||||
if (sets.contains(set.toString())) {
|
||||
list.add(c);
|
||||
break;
|
||||
|
||||
@@ -46,7 +46,7 @@ import com.google.code.jyield.YieldUtils;
|
||||
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesReader;
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.card.replacement.ReplacementHandler;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.error.ErrorViewer;
|
||||
@@ -466,7 +466,7 @@ public class CardReader implements Runnable {
|
||||
card.addReplacementEffect(ReplacementHandler.parseReplacement(value, card));
|
||||
} else if (line.startsWith("SetInfo:")) {
|
||||
final String value = line.substring("SetInfo:".length());
|
||||
card.addSet(new SetInfo(value));
|
||||
card.addSet(new EditionInfo(value));
|
||||
// 8/18/11 11:08 PM
|
||||
} else if (line.equals("ALTERNATE")) {
|
||||
String mode;
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.slightlymagic.maxmtg.Predicate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.card.CardCharacteristics;
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellAbilityList;
|
||||
@@ -676,13 +676,13 @@ public final class CardUtil {
|
||||
final boolean token = card.isToken() && !card.isCopiedToken();
|
||||
|
||||
final String set = card.getCurSetCode();
|
||||
final Predicate<SetInfo> findSetInfo = new Predicate<SetInfo>() {
|
||||
final Predicate<EditionInfo> findSetInfo = new Predicate<EditionInfo>() {
|
||||
@Override
|
||||
public boolean isTrue(final SetInfo subject) {
|
||||
public boolean isTrue(final EditionInfo subject) {
|
||||
return subject.getCode().equals(set);
|
||||
}
|
||||
};
|
||||
final SetInfo neededSet = findSetInfo.first(card.getSets());
|
||||
final EditionInfo neededSet = findSetInfo.first(card.getSets());
|
||||
final int cntPictures = neededSet == null ? 1 : neededSet.getPicCount();
|
||||
return CardUtil
|
||||
.buildFilename(card.getName(), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token);
|
||||
@@ -732,7 +732,7 @@ public final class CardUtil {
|
||||
}
|
||||
|
||||
// Second, try 2 letter set code with MWS filename format
|
||||
final String mwsSet2 = String.format("%s/%s%s.full", AllZone.getEditions().getCode2ByCode(setName), mwsCardName, nn);
|
||||
final String mwsSet2 = String.format("%s/%s%s.full", Singletons.getModel().getEditions().getCode2ByCode(setName), mwsCardName, nn);
|
||||
f = new File(path, mwsSet2 + ".jpg");
|
||||
if (f.exists()) {
|
||||
return mwsSet2;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
||||
final String urlBase = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/fpics/";
|
||||
|
||||
final String setCode3 = c.getEdition();
|
||||
final CardEdition thisSet = AllZone.getEditions().getEditionByCode(setCode3);
|
||||
final CardEdition thisSet = Singletons.getModel().getEditions().getEditionByCode(setCode3);
|
||||
final String setCode2 = thisSet.getCode2();
|
||||
|
||||
final String imgFN = CardUtil.buildFilename(c, cardName);
|
||||
|
||||
@@ -51,7 +51,7 @@ import javax.swing.event.ChangeListener;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.card.SetInfo;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
@@ -493,12 +493,12 @@ public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeMo
|
||||
// String url = c.getSVar("Picture");
|
||||
// String[] URLs = url.split("\\\\");
|
||||
|
||||
final ArrayList<SetInfo> cSetInfo = c.getSets();
|
||||
final ArrayList<EditionInfo> cSetInfo = c.getSets();
|
||||
if (cSetInfo.size() > 0) {
|
||||
for (int j = 0; j < cSetInfo.size(); j++) {
|
||||
c.setCurSetCode(cSetInfo.get(j).getCode());
|
||||
final String setCode3 = c.getCurSetCode();
|
||||
final String setCode2 = AllZone.getEditions().getCode2ByCode(c.getCurSetCode());
|
||||
final String setCode2 = Singletons.getModel().getEditions().getCode2ByCode(c.getCurSetCode());
|
||||
|
||||
int n = 0;
|
||||
if (cSetInfo.get(j).getPicCount() > 0) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CardCharacteristics {
|
||||
private ArrayList<String> staticAbilityStrings = new ArrayList<String>();
|
||||
private String imageFilename = "";
|
||||
private String imageName = "";
|
||||
private ArrayList<SetInfo> sets = new ArrayList<SetInfo>();
|
||||
private ArrayList<EditionInfo> sets = new ArrayList<EditionInfo>();
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
@@ -321,7 +321,7 @@ public class CardCharacteristics {
|
||||
*
|
||||
* @return the sets
|
||||
*/
|
||||
public final ArrayList<SetInfo> getSets() {
|
||||
public final ArrayList<EditionInfo> getSets() {
|
||||
return this.sets;
|
||||
}
|
||||
|
||||
@@ -331,8 +331,8 @@ public class CardCharacteristics {
|
||||
* @param sets0
|
||||
* the sets to set
|
||||
*/
|
||||
public final void setSets(final ArrayList<SetInfo> sets0) {
|
||||
this.sets = new ArrayList<SetInfo>(sets0);
|
||||
public final void setSets(final ArrayList<EditionInfo> sets0) {
|
||||
this.sets = new ArrayList<EditionInfo>(sets0);
|
||||
// name.
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ package forge.card;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SetInfo {
|
||||
public class EditionInfo {
|
||||
|
||||
/** The Code. */
|
||||
private String code;
|
||||
@@ -44,7 +44,7 @@ public class SetInfo {
|
||||
* Constructor for SetInfo.
|
||||
* </p>
|
||||
*/
|
||||
public SetInfo() {
|
||||
public EditionInfo() {
|
||||
this.setCode("");
|
||||
this.setRarity("");
|
||||
this.setUrl("");
|
||||
@@ -63,7 +63,7 @@ public class SetInfo {
|
||||
* @param u
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public SetInfo(final String c, final String r, final String u) {
|
||||
public EditionInfo(final String c, final String r, final String u) {
|
||||
this.setCode(c);
|
||||
this.setRarity(r);
|
||||
this.setUrl(u);
|
||||
@@ -84,7 +84,7 @@ public class SetInfo {
|
||||
* @param p
|
||||
* a int.
|
||||
*/
|
||||
public SetInfo(final String c, final String r, final String u, final int p) {
|
||||
public EditionInfo(final String c, final String r, final String u, final int p) {
|
||||
this.setCode(c);
|
||||
this.setRarity(r);
|
||||
this.setUrl(u);
|
||||
@@ -99,7 +99,7 @@ public class SetInfo {
|
||||
* @param parse
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public SetInfo(final String parse) {
|
||||
public EditionInfo(final String parse) {
|
||||
final String[] pp = parse.split("\\|");
|
||||
this.setCode(pp[0]);
|
||||
this.setRarity(pp[1]);
|
||||
@@ -126,8 +126,8 @@ public class SetInfo {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean equals(final Object o) {
|
||||
if (o instanceof SetInfo) {
|
||||
final SetInfo siO = (SetInfo) o;
|
||||
if (o instanceof EditionInfo) {
|
||||
final EditionInfo siO = (EditionInfo) o;
|
||||
return this.getCode().equals(siO.getCode());
|
||||
} else {
|
||||
return false;
|
||||
@@ -36,7 +36,7 @@ import forge.util.FileUtil;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class SetUtils {
|
||||
public final class EditionUtils {
|
||||
|
||||
private final List<CardEdition> allSets;
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class SetUtils {
|
||||
return allSets;
|
||||
}
|
||||
|
||||
public SetUtils() {
|
||||
public EditionUtils() {
|
||||
allSets = loadSetData(loadBoosterData());
|
||||
allBlocks = loadBlockData();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import net.slightlymagic.maxmtg.Predicate;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.game.GameFormat;
|
||||
import forge.util.FileUtil;
|
||||
|
||||
@@ -114,13 +114,13 @@ public final class FormatUtils {
|
||||
|
||||
/** The Constant setsInT2. */
|
||||
public static final Predicate<CardEdition> SETS_IN_STANDARD = Predicates
|
||||
.isLegalInFormat(AllZone.getFormats().getStandard());
|
||||
.isLegalInFormat(Singletons.getModel().getFormats().getStandard());
|
||||
|
||||
/** The Constant setsInExt. */
|
||||
public static final Predicate<CardEdition> SETS_IN_EXT = Predicates.isLegalInFormat(AllZone.getFormats().getExtended());
|
||||
public static final Predicate<CardEdition> SETS_IN_EXT = Predicates.isLegalInFormat(Singletons.getModel().getFormats().getExtended());
|
||||
|
||||
/** The Constant setsInModern. */
|
||||
public static final Predicate<CardEdition> SET_IN_MODERN = Predicates.isLegalInFormat(AllZone.getFormats().getModern());
|
||||
public static final Predicate<CardEdition> SET_IN_MODERN = Predicates.isLegalInFormat(Singletons.getModel().getFormats().getModern());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import javax.swing.JOptionPane;
|
||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||
import net.slightlymagic.maxmtg.Closure1;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.Constant;
|
||||
@@ -94,7 +93,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
break;
|
||||
|
||||
case Block: // Draft from cards by block or set
|
||||
final List<CardBlock> blocks = AllZone.getEditions().getBlocks();
|
||||
final List<CardBlock> blocks = Singletons.getModel().getEditions().getBlocks();
|
||||
|
||||
final Object o = GuiUtils.getChoice("Choose Block", blocks.toArray());
|
||||
final CardBlock block = (CardBlock) o;
|
||||
@@ -125,12 +124,12 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
final Object p = GuiUtils.getChoice("Choose Set Combination", setCombos.toArray());
|
||||
final String[] pp = p.toString().split("/");
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
final BoosterGenerator bpMulti = new BoosterGenerator(AllZone.getEditions().getEditionByCode(pp[i]));
|
||||
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(pp[i]));
|
||||
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
||||
}
|
||||
|
||||
} else {
|
||||
final BoosterGenerator bpOne = new BoosterGenerator(AllZone.getEditions().getEditionByCode(sets[0]));
|
||||
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(sets[0]));
|
||||
final Closure1<List<CardPrinted>, BoosterGenerator> pick1 = BoosterGenerator.getSimplePicker(bpOne);
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.packs.add(pick1);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SealedDeck {
|
||||
this.getLandSetCode()[0] = CardDb.instance().getCard("Plains").getEdition();
|
||||
} else if (sealedType.equals("Block")) {
|
||||
|
||||
final Object o = GuiUtils.getChoice("Choose Block", AllZone.getEditions().getBlocks().toArray());
|
||||
final Object o = GuiUtils.getChoice("Choose Block", Singletons.getModel().getEditions().getBlocks().toArray());
|
||||
final CardBlock block = (CardBlock) o;
|
||||
|
||||
final CardEdition[] cardSets = block.getSets();
|
||||
@@ -106,11 +106,11 @@ public class SealedDeck {
|
||||
|
||||
final String[] pp = p.toString().split("/");
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
final BoosterGenerator bpMulti = new BoosterGenerator(AllZone.getEditions().getEditionByCode(pp[i]));
|
||||
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(pp[i]));
|
||||
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
||||
}
|
||||
} else {
|
||||
final BoosterGenerator bpOne = new BoosterGenerator(AllZone.getEditions().getEditionByCode(sets[0]));
|
||||
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(sets[0]));
|
||||
final Closure1<List<CardPrinted>, BoosterGenerator> picker = BoosterGenerator.getSimplePicker(bpOne);
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
this.packs.add(picker);
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardColor;
|
||||
import forge.card.CardManaCost;
|
||||
import forge.card.CardRarity;
|
||||
@@ -55,7 +55,7 @@ public abstract class PresetColumns {
|
||||
}
|
||||
|
||||
private static CardEdition toSetCmp(final InventoryItem i) {
|
||||
return i instanceof InventoryItemFromSet ? AllZone.getEditions().getEditionByCode(((InventoryItemFromSet) i).getEdition())
|
||||
return i instanceof InventoryItemFromSet ? Singletons.getModel().getEditions().getEditionByCode(((InventoryItemFromSet) i).getEdition())
|
||||
: CardEdition.UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardEdition;
|
||||
import forge.gui.game.CardDetailPanel;
|
||||
import forge.gui.game.CardPicturePanel;
|
||||
@@ -116,7 +116,7 @@ public class CardPanelLite extends CardPanelBase {
|
||||
} else {
|
||||
if (card instanceof BoosterPack) {
|
||||
final BoosterPack booster = (BoosterPack) card;
|
||||
final CardEdition set = AllZone.getEditions().getEditionByCodeOrThrow(booster.getEdition());
|
||||
final CardEdition set = Singletons.getModel().getEditions().getEditionByCodeOrThrow(booster.getEdition());
|
||||
final String tpl = "%s booster pack.%n%nContains %d cards.%n%nBuy it to reveal the cards and add them to your inventory.";
|
||||
this.description.setText(String.format(tpl, set.getName(), set.getBoosterData().getTotal()));
|
||||
} else if (card instanceof PreconDeck) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.slightlymagic.maxmtg.PredicateString.StringOp;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardEdition;
|
||||
import forge.game.GameFormat;
|
||||
@@ -91,10 +91,10 @@ public class FilterNameTypeSetPanel extends JComponent {
|
||||
|
||||
this.searchSetCombo.removeAllItems();
|
||||
this.searchSetCombo.addItem("(all sets and formats)");
|
||||
for (final GameFormat s : AllZone.getFormats().getFormats()) {
|
||||
for (final GameFormat s : Singletons.getModel().getFormats().getFormats()) {
|
||||
this.searchSetCombo.addItem(s);
|
||||
}
|
||||
for (final CardEdition s : AllZone.getEditions().getAllSets()) {
|
||||
for (final CardEdition s : Singletons.getModel().getEditions().getAllSets()) {
|
||||
this.searchSetCombo.addItem(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||
import net.slightlymagic.maxmtg.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.BoosterGenerator;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardEdition;
|
||||
@@ -52,7 +52,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
||||
* the set
|
||||
*/
|
||||
public BoosterPack(final String set) {
|
||||
this(AllZone.getEditions().getEditionByCodeOrThrow(set));
|
||||
this(Singletons.getModel().getEditions().getEditionByCodeOrThrow(set));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
||||
}
|
||||
|
||||
private CardPrinted getLandFromNearestSet() {
|
||||
final List<CardEdition> sets = AllZone.getEditions().getAllSets();
|
||||
final List<CardEdition> sets = Singletons.getModel().getEditions().getAllSets();
|
||||
final int iThisSet = sets.indexOf(this.cardSet);
|
||||
for (int iSet = iThisSet; iSet < sets.size(); iSet++) {
|
||||
final CardPrinted land = this.getRandomBasicLand(sets.get(iSet));
|
||||
@@ -127,7 +127,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
||||
}
|
||||
}
|
||||
// if not found (though that's impossible)
|
||||
return this.getRandomBasicLand(AllZone.getEditions().getEditionByCode("M12"));
|
||||
return this.getRandomBasicLand(Singletons.getModel().getEditions().getEditionByCode("M12"));
|
||||
}
|
||||
|
||||
private void generate() {
|
||||
|
||||
@@ -31,8 +31,8 @@ import net.slightlymagic.maxmtg.Predicate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardInSet;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.MtgDataParser;
|
||||
@@ -392,10 +392,10 @@ public final class CardDb {
|
||||
|
||||
// Find card with maximal set index
|
||||
result = namedCards.get(0);
|
||||
int resIndex = AllZone.getEditions().getEditionByCode((result).getEdition()).getIndex();
|
||||
int resIndex = Singletons.getModel().getEditions().getEditionByCode((result).getEdition()).getIndex();
|
||||
for (final CardPrinted card : namedCards) {
|
||||
|
||||
final int thisIndex = AllZone.getEditions().getEditionByCode((card).getEdition()).getIndex();
|
||||
final int thisIndex = Singletons.getModel().getEditions().getEditionByCode((card).getEdition()).getIndex();
|
||||
if (thisIndex > resIndex) {
|
||||
result = card;
|
||||
resIndex = thisIndex;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.deck.Deck;
|
||||
import forge.quest.SellRules;
|
||||
import forge.util.FileSection;
|
||||
@@ -88,7 +88,7 @@ public class PreconDeck implements InventoryItemFromSet {
|
||||
|
||||
imageFilename = kv.get("Image");
|
||||
description = kv.get("Description");
|
||||
if (AllZone.getEditions().getEditionByCode(kv.get("set").toUpperCase()) != null) {
|
||||
if (Singletons.getModel().getEditions().getEditionByCode(kv.get("set").toUpperCase()) != null) {
|
||||
setProxy = kv.get("set");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ import forge.Constant;
|
||||
import forge.ConstantStringArrayList;
|
||||
import forge.GameAction;
|
||||
import forge.Singletons;
|
||||
import forge.card.EditionUtils;
|
||||
import forge.card.FormatUtils;
|
||||
import forge.control.input.InputControl;
|
||||
import forge.deck.CardCollections;
|
||||
import forge.game.GameState;
|
||||
@@ -75,6 +77,10 @@ public enum FModel {
|
||||
private final QuestEventManager questEventManager;
|
||||
private final GameState gameState;
|
||||
private final FMatchState matchState;
|
||||
|
||||
private final EditionUtils setUtils;
|
||||
private final FormatUtils formats;
|
||||
|
||||
|
||||
// have to implement lazy initialization - at the moment of FModel.ctor() CardDb is not ready yet.
|
||||
private CardCollections decks;
|
||||
@@ -117,6 +123,8 @@ public enum FModel {
|
||||
this.matchState = new FMatchState();
|
||||
this.questPreferences = new QuestPreferences();
|
||||
this.questEventManager = new QuestEventManager();
|
||||
this.setUtils = new EditionUtils();
|
||||
this.formats = new FormatUtils();
|
||||
|
||||
// TODO this single setting from preferences should not be here, or,
|
||||
// it should be here with all the other settings at the same time.
|
||||
@@ -147,6 +155,7 @@ public enum FModel {
|
||||
FModel.loadDynamicGamedata();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load dynamic gamedata.
|
||||
*/
|
||||
@@ -356,6 +365,21 @@ public enum FModel {
|
||||
return this.gameState.getGameSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public final EditionUtils getEditions() {
|
||||
return setUtils;
|
||||
}
|
||||
|
||||
|
||||
public final FormatUtils getFormats() {
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Needs to be reworked for efficiency with rest of prefs saves in
|
||||
* codebase.
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import net.slightlymagic.maxmtg.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.CardPrinted;
|
||||
@@ -235,7 +234,7 @@ public final class QuestData {
|
||||
public void newGame(final int diff, final String m0de, final boolean standardStart) {
|
||||
this.setDifficulty(diff);
|
||||
|
||||
final Predicate<CardPrinted> filter = standardStart ? AllZone.getFormats().getStandard().getFilterPrinted()
|
||||
final Predicate<CardPrinted> filter = standardStart ? Singletons.getModel().getFormats().getStandard().getFilterPrinted()
|
||||
: CardPrinted.Predicates.Presets.IS_TRUE;
|
||||
|
||||
this.myCards.setupNewGameCardPool(filter, diff);
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||
import net.slightlymagic.maxmtg.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.BoosterGenerator;
|
||||
import forge.card.BoosterUtils;
|
||||
@@ -343,7 +342,7 @@ public final class QuestUtilCards {
|
||||
final int rollD100 = MyRandom.getRandom().nextInt(100);
|
||||
final Predicate<CardEdition> filter = rollD100 < 40 ? this.filterT2booster
|
||||
: (rollD100 < 75 ? this.filterExtButT2 : this.filterNotExt);
|
||||
this.q.getShopList().addAllFlat(filter.random(AllZone.getEditions().getAllSets(), 1, BoosterPack.FN_FROM_SET));
|
||||
this.q.getShopList().addAllFlat(filter.random(Singletons.getModel().getEditions().getAllSets(), 1, BoosterPack.FN_FROM_SET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
*/
|
||||
private void awardBooster() {
|
||||
final GameFormat[] emptyFormatArray = {};
|
||||
final GameFormat[] formats = AllZone.getFormats().getFormats().toArray(emptyFormatArray);
|
||||
final GameFormat[] formats = Singletons.getModel().getFormats().getFormats().toArray(emptyFormatArray);
|
||||
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose bonus booster format", 1, formats);
|
||||
|
||||
String prefferedFormat = Singletons.getModel().getQuestPreferences().getPreference(QPref.BOOSTER_FORMAT);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
@Override
|
||||
public ItemPoolView<CardPrinted> nextChoice() {
|
||||
this.n--;
|
||||
final BoosterGenerator pack = new BoosterGenerator(AllZone.getEditions().getEditionByCode("M11"));
|
||||
final BoosterGenerator pack = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode("M11"));
|
||||
return ItemPool.createFrom(pack.getBoosterPack(), CardPrinted.class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user