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