mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
AllZone is gone. Its members moved to Fmodel while colorchanger went to GameState
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -12371,7 +12371,6 @@ src/main/config/forge.ico -text svneol=unset#image/ico
|
||||
src/main/config/forge.sh svneol=native#text/x-sh
|
||||
src/main/config/forge_checks.xml svneol=native#text/xml
|
||||
src/main/config/support/template.applescript -text
|
||||
src/main/java/forge/AllZone.java svneol=native#text/plain
|
||||
src/main/java/forge/Card.java svneol=native#text/plain
|
||||
src/main/java/forge/CardCharacteristicName.java -text
|
||||
src/main/java/forge/CardColor.java svneol=native#text/plain
|
||||
|
||||
@@ -1,123 +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;
|
||||
|
||||
import forge.card.cardfactory.CardFactory;
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
import forge.game.limited.GauntletMini;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
|
||||
/**
|
||||
* Please use public getters and setters instead of direct field access.
|
||||
* <p/>
|
||||
* If you need a setter, by all means, add it.
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class AllZone {
|
||||
// only for testing, should read decks from local directory
|
||||
// public static final IO IO = new IO("all-decks");
|
||||
|
||||
/**
|
||||
* Do not instantiate.
|
||||
*/
|
||||
private AllZone() {
|
||||
// blank
|
||||
}
|
||||
|
||||
/** Global <code>gauntletData</code>. */
|
||||
private static forge.game.limited.GauntletMini gauntlet = null;
|
||||
|
||||
/** Constant <code>COLOR_CHANGER</code>. */
|
||||
private static final ColorChanger COLOR_CHANGER = new ColorChanger();
|
||||
|
||||
// Phase is now a prerequisite for CardFactory
|
||||
/** Global <code>cardFactory</code>. */
|
||||
private static CardFactoryInterface cardFactory = null;
|
||||
|
||||
// initialized at Runtime since it has to be the last object constructed
|
||||
|
||||
// shared between Input_Attack, Input_Block, Input_CombatDamage ,
|
||||
// InputState_Computer
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getGauntletData.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.quest.data.QuestData} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static forge.game.limited.GauntletMini getGauntlet() {
|
||||
|
||||
if (gauntlet == null) {
|
||||
gauntlet = new GauntletMini();
|
||||
}
|
||||
return AllZone.gauntlet;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getCardFactory.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.card.cardfactory.CardFactoryInterface} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static CardFactoryInterface getCardFactory() {
|
||||
if (AllZone.cardFactory == null) {
|
||||
AllZone.setCardFactory(new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)));
|
||||
}
|
||||
return AllZone.cardFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for cardFactory.
|
||||
*
|
||||
* @param factory
|
||||
* the factory to set
|
||||
*/
|
||||
private static void setCardFactory(final CardFactoryInterface factory) {
|
||||
AllZone.cardFactory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return the next timestamp.
|
||||
*
|
||||
* Will eventually be marked deprecated.
|
||||
*
|
||||
* @return the next timestamp
|
||||
*/
|
||||
public static long getNextTimestamp() {
|
||||
return Singletons.getModel().getGameState().getNextTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for colorChanger.
|
||||
*
|
||||
* @return the colorChanger
|
||||
*/
|
||||
public static ColorChanger getColorChanger() {
|
||||
return AllZone.COLOR_CHANGER;
|
||||
}
|
||||
|
||||
|
||||
} // AllZone
|
||||
@@ -1733,7 +1733,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return new CardColor(this);
|
||||
}
|
||||
CardColor colors = null;
|
||||
final ArrayList<CardColor> globalChanges = AllZone.getColorChanger().getColorChanges();
|
||||
final ArrayList<CardColor> globalChanges = Singletons.getModel().getGameState().getColorChanger().getColorChanges();
|
||||
colors = this.determineColor(globalChanges);
|
||||
colors.fixColorless();
|
||||
return colors;
|
||||
@@ -3975,7 +3975,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public final void addEquipping(final Card c) {
|
||||
this.equipping.add(c);
|
||||
this.setTimestamp(AllZone.getNextTimestamp());
|
||||
this.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -4160,7 +4160,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public final void addEnchanting(final GameEntity e) {
|
||||
this.enchanting = e;
|
||||
this.setTimestamp(AllZone.getNextTimestamp());
|
||||
this.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
|
||||
@@ -691,7 +691,7 @@ public final class CardUtil {
|
||||
if (c.isInAlternateState()) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
final Card res = AllZone.getCardFactory().copyCard(c);
|
||||
final Card res = Singletons.getModel().getCardFactory().copyCard(c);
|
||||
c.setState(state);
|
||||
res.setState(state);
|
||||
res.setControllerObjects(c.getControllerObjects());
|
||||
|
||||
@@ -162,7 +162,7 @@ public class GameAction {
|
||||
if (zoneFrom.is(ZoneType.Battlefield)) {
|
||||
c.setFlipStaus(false);
|
||||
}
|
||||
copied = AllZone.getCardFactory().copyCard(c);
|
||||
copied = Singletons.getModel().getCardFactory().copyCard(c);
|
||||
copied.setUnearthed(c.isUnearthed());
|
||||
copied.setTapped(false);
|
||||
for (final Trigger trigger : copied.getTriggers()) {
|
||||
@@ -303,7 +303,7 @@ public class GameAction {
|
||||
copied.turnFaceUp();
|
||||
}
|
||||
} else if (zoneTo.is(ZoneType.Battlefield)) {
|
||||
copied.setTimestamp(AllZone.getNextTimestamp());
|
||||
copied.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
|
||||
for (String s : copied.getKeyword()) {
|
||||
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|
||||
|| s.startsWith("May be played by your opponent")
|
||||
@@ -313,7 +313,7 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
} else if (zoneTo.is(ZoneType.Graveyard)) {
|
||||
copied.setTimestamp(AllZone.getNextTimestamp());
|
||||
copied.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
|
||||
for (String s : copied.getKeyword()) {
|
||||
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|
||||
|| s.startsWith("May be played by your opponent")
|
||||
@@ -687,7 +687,7 @@ public class GameAction {
|
||||
if (p != null && p.is(ZoneType.Battlefield)) {
|
||||
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||
c.clearCounters(); // remove all counters
|
||||
library.add(AllZone.getCardFactory().copyCard(c), libPosition);
|
||||
library.add(Singletons.getModel().getCardFactory().copyCard(c), libPosition);
|
||||
} else {
|
||||
c.clearCounters(); // remove all counters
|
||||
library.add(c, libPosition);
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
|
||||
import forge.CardLists;
|
||||
@@ -557,7 +556,7 @@ public final class AbilityFactoryAnimate {
|
||||
}
|
||||
|
||||
// Every Animate event needs a unique time stamp
|
||||
timest = AllZone.getNextTimestamp();
|
||||
timest = Singletons.getModel().getGameState().getNextTimestamp();
|
||||
|
||||
final long timestamp = timest;
|
||||
|
||||
@@ -1207,7 +1206,7 @@ public final class AbilityFactoryAnimate {
|
||||
}
|
||||
|
||||
// Every Animate event needs a unique time stamp
|
||||
timest = AllZone.getNextTimestamp();
|
||||
timest = Singletons.getModel().getGameState().getNextTimestamp();
|
||||
|
||||
final long timestamp = timest;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
|
||||
import forge.CardLists;
|
||||
@@ -1630,7 +1629,7 @@ public final class AbilityFactoryChoose {
|
||||
// still missing a listener to display the card preview
|
||||
// in the right
|
||||
name = choice.getSelectedValue();
|
||||
if (AllZone.getCardFactory().getCard(CardDb.instance().getCard(name), p).isValid(valid, host.getController(), host)) {
|
||||
if (Singletons.getModel().getCardFactory().getCard(CardDb.instance().getCard(name), p).isValid(valid, host.getController(), host)) {
|
||||
host.setNamedCard(choice.getSelectedValue());
|
||||
ok = true;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
|
||||
@@ -411,7 +410,7 @@ public final class AbilityFactoryCopy {
|
||||
if (!c.isToken() || c.isCopiedToken()) {
|
||||
// copy creature and put it onto the battlefield
|
||||
|
||||
copy = AllZone.getCardFactory().getCard(CardDb.instance().getCard(c), sa.getActivatingPlayer());
|
||||
copy = Singletons.getModel().getCardFactory().getCard(CardDb.instance().getCard(c), sa.getActivatingPlayer());
|
||||
|
||||
// when copying something stolen:
|
||||
copy.addController(sa.getActivatingPlayer());
|
||||
@@ -828,7 +827,7 @@ public final class AbilityFactoryCopy {
|
||||
for (final SpellAbility chosenSAcopy : chosenSAs) {
|
||||
chosenSAcopy.setActivatingPlayer(controller);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
AllZone.getCardFactory().copySpellontoStack(card, chosenSAcopy.getSourceCard(), chosenSAcopy, true);
|
||||
Singletons.getModel().getCardFactory().copySpellontoStack(card, chosenSAcopy.getSourceCard(), chosenSAcopy, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -844,7 +843,7 @@ public final class AbilityFactoryCopy {
|
||||
|
||||
chosenSA.setActivatingPlayer(controller);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
AllZone.getCardFactory().copySpellontoStack(card, chosenSA.getSourceCard(), chosenSA, true);
|
||||
Singletons.getModel().getCardFactory().copySpellontoStack(card, chosenSA.getSourceCard(), chosenSA, true);
|
||||
}
|
||||
}
|
||||
} // end resolve
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
|
||||
@@ -445,7 +444,7 @@ public final class AbilityFactoryPlay {
|
||||
source.clearRemembered();
|
||||
}
|
||||
if (params.containsKey("CopyCard")) {
|
||||
tgtCard = AllZone.getCardFactory().getCard(CardDb.instance().getCard(tgtCard), sa.getActivatingPlayer());
|
||||
tgtCard = Singletons.getModel().getCardFactory().getCard(CardDb.instance().getCard(tgtCard), sa.getActivatingPlayer());
|
||||
// when copying something stolen:
|
||||
tgtCard.addController(sa.getActivatingPlayer());
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardUtil;
|
||||
@@ -156,7 +155,7 @@ public class CardFactory implements CardFactoryInterface {
|
||||
final boolean bCopyDetails) {
|
||||
Player originalController = original.getController();
|
||||
Player controller = sa.getActivatingPlayer();
|
||||
final Card c = AllZone.getCardFactory().copyCard(original);
|
||||
final Card c = Singletons.getModel().getCardFactory().copyCard(original);
|
||||
|
||||
// change the color of the copy (eg: Fork)
|
||||
// Currently won't work for abilities, only for spells
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.esotericsoftware.minlog.Log;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
|
||||
import forge.CardLists;
|
||||
@@ -212,7 +211,7 @@ class CardFactoryAuras {
|
||||
crd.removeSpellAbility(cardAbilitie);
|
||||
}
|
||||
}
|
||||
final Card c = AllZone.getCardFactory().copyCard(crd);
|
||||
final Card c = Singletons.getModel().getCardFactory().copyCard(crd);
|
||||
final ArrayList<String> types = c.getType();
|
||||
final SpellAbility[] abilities = card.getSpellAbility();
|
||||
for (int i = 0; i < types.size(); i++) {
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
|
||||
@@ -243,7 +242,7 @@ public class CardFactoryCreatures {
|
||||
card.setChosenColor(colors);
|
||||
final String s = CardUtil.getShortColor(color[0]);
|
||||
|
||||
timeStamp[0] = AllZone.getColorChanger().addColorChanges(s, card, true, true);
|
||||
timeStamp[0] = Singletons.getModel().getGameState().getColorChanger().addColorChanges(s, card, true, true);
|
||||
}
|
||||
}; // Command
|
||||
|
||||
@@ -253,7 +252,7 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public void execute() {
|
||||
final String s = CardUtil.getShortColor(color[0]);
|
||||
AllZone.getColorChanger().removeColorChanges(s, card, true, timeStamp[0]);
|
||||
Singletons.getModel().getGameState().getColorChanger().removeColorChanges(s, card, true, timeStamp[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import javax.swing.JLayeredPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.control.KeyboardShortcuts.Shortcut;
|
||||
import forge.game.player.Player;
|
||||
@@ -143,9 +142,6 @@ public enum FControl {
|
||||
|
||||
/** After view and model have been initialized, control can start. */
|
||||
public void initialize() {
|
||||
// Preloads all cards (using progress bar).
|
||||
AllZone.getCardFactory();
|
||||
|
||||
// Preloads skin components (using progress bar).
|
||||
FSkin.loadFull();
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates;
|
||||
@@ -98,7 +97,6 @@ public class GameNew {
|
||||
*/
|
||||
public static void newGame(final Map<Player, PlayerStartConditions> playersConditions, GameType gameType) {
|
||||
Singletons.getModel().getMatch().getInput().clearInput();
|
||||
AllZone.getColorChanger().reset();
|
||||
|
||||
Card.resetUniqueNumber();
|
||||
// need this code here, otherwise observables fail
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.ColorChanger;
|
||||
import forge.GameLog;
|
||||
import forge.StaticEffects;
|
||||
import forge.card.replacement.ReplacementHandler;
|
||||
@@ -60,6 +61,7 @@ public class GameState {
|
||||
private final ReplacementHandler replacementHandler = new ReplacementHandler();
|
||||
private Combat combat = new Combat();
|
||||
private final GameLog gameLog = new GameLog();
|
||||
private final ColorChanger colorChanger = new ColorChanger();
|
||||
private boolean gameOver = false;
|
||||
|
||||
private final PlayerZone stackZone = new PlayerZone(ZoneType.Stack, null);
|
||||
@@ -422,14 +424,10 @@ public class GameState {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getTokenDoublersMagnitude.
|
||||
* </p>
|
||||
*
|
||||
* @param player
|
||||
* the {@link forge.game.player.Player} player to determine if is affected by
|
||||
* Doubling Season
|
||||
* @return a int.
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public ColorChanger getColorChanger() {
|
||||
return colorChanger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Stack;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
|
||||
import forge.CardLists;
|
||||
@@ -659,7 +658,7 @@ public class MagicStack extends MyObservable {
|
||||
@Override
|
||||
public void execute() {
|
||||
for (int i = 0; i < sp.getSourceCard().getReplicateMagnitude(); i++) {
|
||||
AllZone.getCardFactory().copySpellontoStack(sp.getSourceCard(), sp.getSourceCard(), sp, false);
|
||||
Singletons.getModel().getCardFactory().copySpellontoStack(sp.getSourceCard(), sp.getSourceCard(), sp, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@ import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
|
||||
@@ -575,7 +574,7 @@ public final class GuiDisplayUtil {
|
||||
for (final String element : data) {
|
||||
final String[] cardinfo = element.trim().split("\\|");
|
||||
|
||||
final Card c = AllZone.getCardFactory().getCard(CardDb.instance().getCard(cardinfo[0]), player);
|
||||
final Card c = Singletons.getModel().getCardFactory().getCard(CardDb.instance().getCard(cardinfo[0]), player);
|
||||
|
||||
boolean hasSetCurSet = false;
|
||||
for (final String info : cardinfo) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
@@ -109,11 +108,11 @@ public enum CSubmenuDraft implements ICDoc {
|
||||
return;
|
||||
}
|
||||
|
||||
AllZone.getGauntlet().resetGauntletDraft();
|
||||
Singletons.getModel().getGauntletMini().resetGauntletDraft();
|
||||
|
||||
if (gauntlet) {
|
||||
int rounds = Singletons.getModel().getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size();
|
||||
AllZone.getGauntlet().launch(rounds, humanDeck, GameType.Draft);
|
||||
Singletons.getModel().getGauntletMini().launch(rounds, humanDeck, GameType.Draft);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
@@ -123,7 +122,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
|
||||
int matches = Singletons.getModel().getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
||||
|
||||
AllZone.getGauntlet().launch(matches, human, GameType.Sealed);
|
||||
Singletons.getModel().getGauntletMini().launch(matches, human, GameType.Sealed);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.game.MatchController;
|
||||
import forge.game.limited.GauntletMini;
|
||||
@@ -57,7 +56,7 @@ public class GauntletWinLose extends ControlWinLose {
|
||||
public GauntletWinLose(final ViewWinLose view0, MatchController match) {
|
||||
super(view0, match);
|
||||
this.view = view0;
|
||||
gauntlet = AllZone.getGauntlet();
|
||||
gauntlet = Singletons.getModel().getGauntletMini();
|
||||
this.wonMatch = match.isWonBy(Singletons.getControl().getPlayer().getLobbyPlayer());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.game.MatchController;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
@@ -59,7 +58,7 @@ public class ViewWinLose {
|
||||
control = new QuestWinLoseHandler(this, match);
|
||||
break;
|
||||
case Draft:
|
||||
if (!AllZone.getGauntlet().isGauntletDraft()) break;
|
||||
if (!Singletons.getModel().getGauntletMini().isGauntletDraft()) break;
|
||||
case Sealed:
|
||||
control = new GauntletWinLose(this, match);
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
|
||||
import forge.Command;
|
||||
@@ -296,7 +295,7 @@ public class CField implements ICDoc {
|
||||
faceDown.setName("Face Down");
|
||||
choices2.add(faceDown);
|
||||
} else {
|
||||
final Card faceDown = AllZone.getCardFactory().copyCard(crd);
|
||||
final Card faceDown = Singletons.getModel().getCardFactory().copyCard(crd);
|
||||
faceDown.turnFaceUp();
|
||||
choices2.add(faceDown);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardUtil;
|
||||
import forge.Singletons;
|
||||
@@ -299,7 +298,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
||||
* @return the card
|
||||
*/
|
||||
public Card toForgeCard(Player owner) {
|
||||
final Card c = AllZone.getCardFactory().getCard(this, owner);
|
||||
final Card c = Singletons.getModel().getCardFactory().getCard(this, owner);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,13 @@ import forge.card.CardBlock;
|
||||
import forge.card.EditionCollection;
|
||||
import forge.card.FatPackData;
|
||||
import forge.card.FormatCollection;
|
||||
import forge.card.cardfactory.CardFactory;
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
import forge.deck.CardCollections;
|
||||
import forge.error.ExceptionHandler;
|
||||
import forge.game.GameState;
|
||||
import forge.game.MatchController;
|
||||
import forge.game.limited.GauntletMini;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.gauntlet.GauntletData;
|
||||
import forge.properties.ForgePreferences;
|
||||
@@ -76,9 +79,14 @@ public enum FModel {
|
||||
private final ForgePreferences preferences;
|
||||
private GameState gameState;
|
||||
private GameAction gameAction;
|
||||
// Someone should take care of 2 gauntlets here
|
||||
private GauntletData gauntletData;
|
||||
private GauntletMini gauntlet;
|
||||
|
||||
private final CardFactory cardFactory;
|
||||
private final QuestController quest;
|
||||
private final CardCollections decks;
|
||||
|
||||
private QuestController quest = null;
|
||||
private final MatchController match;
|
||||
|
||||
private final EditionCollection editions;
|
||||
@@ -89,8 +97,8 @@ public enum FModel {
|
||||
private final IStorageView<CardBlock> blocks;
|
||||
private final IStorageView<CardBlock> fantasyBlocks;
|
||||
|
||||
// Lazy, since CardDb not ready.
|
||||
private CardCollections decks;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -147,12 +155,14 @@ public enum FModel {
|
||||
|
||||
this.setBuildInfo(new BuildInfo());
|
||||
this.loadDynamicGamedata();
|
||||
|
||||
// Loads all cards (using progress bar).
|
||||
this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
|
||||
this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS));
|
||||
this.quest = new QuestController();
|
||||
}
|
||||
|
||||
public final QuestController getQuest() {
|
||||
if (quest == null) {
|
||||
this.quest = new QuestController();
|
||||
}
|
||||
return quest;
|
||||
}
|
||||
|
||||
@@ -324,9 +334,6 @@ public enum FModel {
|
||||
* @return {@link forge.decks.CardCollections}
|
||||
*/
|
||||
public final CardCollections getDecks() {
|
||||
if (this.decks == null) {
|
||||
this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS));
|
||||
}
|
||||
return this.decks;
|
||||
}
|
||||
|
||||
@@ -427,4 +434,20 @@ public enum FModel {
|
||||
gameAction = new GameAction(gameState);
|
||||
return gameState;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
public CardFactoryInterface getCardFactory() {
|
||||
return cardFactory;
|
||||
}
|
||||
|
||||
public GauntletMini getGauntletMini() {
|
||||
|
||||
if (gauntlet == null) {
|
||||
gauntlet = new GauntletMini();
|
||||
}
|
||||
return gauntlet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@ public class QuestController {
|
||||
private QuestPetStorage pets = null;
|
||||
|
||||
// This is used by shop. Had no idea where else to place this
|
||||
private static transient IStorageView<PreconDeck> preconManager = new StorageView<PreconDeck>(new PreconReader(
|
||||
ForgeProps.getFile(NewConstants.Quest.PRECONS)));
|
||||
private static transient IStorageView<PreconDeck> preconManager = null;
|
||||
|
||||
/** The Constant RANK_TITLES. */
|
||||
public static final String[] RANK_TITLES = new String[] { "Level 0 - Confused Wizard", "Level 1 - Mana Mage",
|
||||
@@ -161,6 +160,9 @@ public class QuestController {
|
||||
* @return QuestPreconManager
|
||||
*/
|
||||
public static IStorageView<PreconDeck> getPrecons() {
|
||||
if ( null == preconManager )
|
||||
preconManager = new StorageView<PreconDeck>(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS)));
|
||||
|
||||
return QuestController.preconManager;
|
||||
}
|
||||
|
||||
@@ -224,7 +226,7 @@ public class QuestController {
|
||||
final Predicate<CardPrinted> filter;
|
||||
switch (startPool) {
|
||||
case Precon:
|
||||
this.myCards.addPreconDeck(QuestController.preconManager.get(preconName));
|
||||
this.myCards.addPreconDeck(QuestController.getPrecons().get(preconName));
|
||||
return;
|
||||
|
||||
case Rotating:
|
||||
|
||||
@@ -25,7 +25,7 @@ public class RunTest {
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
void test() {
|
||||
Card c;
|
||||
final CardFactoryInterface cf = AllZone.getCardFactory();
|
||||
final CardFactoryInterface cf = Singletons.getModel().getCardFactory();
|
||||
// ********* test Card
|
||||
/*
|
||||
c = cf.getCard("Elvish Warrior", AllZone.getComputerPlayer());
|
||||
|
||||
Reference in New Issue
Block a user