mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Deck moved to player (still hardcoded, but no longer in constants)
This commit is contained in:
@@ -20,7 +20,6 @@ package forge;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.deck.Deck;
|
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
@@ -42,36 +41,21 @@ public final class Constant {
|
|||||||
* The Class Runtime.
|
* The Class Runtime.
|
||||||
*/
|
*/
|
||||||
public static class Preferences {
|
public static class Preferences {
|
||||||
|
|
||||||
/** The Constant Mill. */
|
|
||||||
public static boolean MILL;
|
|
||||||
/** The Constant DevMode. */
|
/** The Constant DevMode. */
|
||||||
// one for normal mode, one for quest mode
|
// one for normal mode, one for quest mode
|
||||||
public static boolean DEV_MODE;
|
public static boolean DEV_MODE;
|
||||||
/** The Constant UpldDrft. */
|
/** The Constant UpldDrft. */
|
||||||
public static boolean UPLOAD_DRAFT;
|
public static boolean UPLOAD_DRAFT;
|
||||||
/** The Constant RndCFoil. */
|
|
||||||
public static boolean RANDOM_FOIL;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Runtime {
|
public static class Runtime {
|
||||||
|
|
||||||
/** The Constant HumanDeck. */
|
|
||||||
public static final Deck[] HUMAN_DECK = new Deck[1];
|
|
||||||
|
|
||||||
/** The Constant ComputerDeck. */
|
|
||||||
public static final Deck[] COMPUTER_DECK = new Deck[1];
|
|
||||||
|
|
||||||
/** The skin name. */
|
/** The skin name. */
|
||||||
private static String skinName = "default";
|
private static String skinName = "default";
|
||||||
|
|
||||||
/** The game type. */
|
/** The game type. */
|
||||||
private static GameType gameType = GameType.Constructed;
|
private static GameType gameType = GameType.Constructed;
|
||||||
|
|
||||||
/** The Constant Smooth. */
|
|
||||||
public static final boolean[] SMOOTH = new boolean[1];
|
|
||||||
|
|
||||||
/** The Constant NetConn. */
|
/** The Constant NetConn. */
|
||||||
public static final boolean[] NET_CONN = new boolean[1];
|
public static final boolean[] NET_CONN = new boolean[1];
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class GameNew {
|
|||||||
CMessage.SINGLETON_INSTANCE.updateGameInfo();
|
CMessage.SINGLETON_INSTANCE.updateGameInfo();
|
||||||
|
|
||||||
// friendliness
|
// friendliness
|
||||||
final boolean canRandomFoil = Preferences.RANDOM_FOIL
|
final boolean canRandomFoil = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_RANDOM_FOIL)
|
||||||
&& Constant.Runtime.getGameType().equals(GameType.Constructed);
|
&& Constant.Runtime.getGameType().equals(GameType.Constructed);
|
||||||
final Random generator = MyRandom.getRandom();
|
final Random generator = MyRandom.getRandom();
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ public class GameNew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do this instead of shuffling Computer's deck
|
// do this instead of shuffling Computer's deck
|
||||||
final boolean smoothLand = Constant.Runtime.SMOOTH[0];
|
final boolean smoothLand = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND);
|
||||||
|
|
||||||
if (smoothLand) {
|
if (smoothLand) {
|
||||||
final Iterable<Card> c1 = GameNew.smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(ZoneType.Library));
|
final Iterable<Card> c1 = GameNew.smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(ZoneType.Library));
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import forge.AllZone;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
@@ -91,8 +92,8 @@ public class GauntletMini {
|
|||||||
public void resetCurrentRound() {
|
public void resetCurrentRound() {
|
||||||
wins = 0;
|
wins = 0;
|
||||||
losses = 0;
|
losses = 0;
|
||||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
AllZone.getHumanPlayer().setDeck(humanDeck);
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = aiDecks.get(0);
|
AllZone.getComputerPlayer().setDeck(aiDecks.get(0));
|
||||||
currentRound = 1;
|
currentRound = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +109,8 @@ public class GauntletMini {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
AllZone.getHumanPlayer().setDeck(humanDeck);
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = aiDecks.get(currentRound);
|
AllZone.getComputerPlayer().setDeck(aiDecks.get(currentRound));
|
||||||
currentRound += 1;
|
currentRound += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ public class GauntletMini {
|
|||||||
|
|
||||||
Constant.Runtime.setGameType(gauntletType);
|
Constant.Runtime.setGameType(gauntletType);
|
||||||
|
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import forge.card.replacement.ReplacementResult;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.staticability.StaticAbility;
|
import forge.card.staticability.StaticAbility;
|
||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
|
import forge.deck.Deck;
|
||||||
import forge.game.GameLossReason;
|
import forge.game.GameLossReason;
|
||||||
import forge.game.phase.PhaseHandler;
|
import forge.game.phase.PhaseHandler;
|
||||||
import forge.game.zone.DefaultPlayerZone;
|
import forge.game.zone.DefaultPlayerZone;
|
||||||
@@ -149,6 +150,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
|
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
|
||||||
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante, ZoneType.Stack));
|
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante, ZoneType.Stack));
|
||||||
|
|
||||||
|
|
||||||
|
// Moved deck here from Constants.Runtime
|
||||||
|
private Deck deck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for Player.
|
* Constructor for Player.
|
||||||
@@ -1304,7 +1309,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
AllZone.getTriggerHandler().runTrigger(TriggerType.Drawn, runParams);
|
AllZone.getTriggerHandler().runTrigger(TriggerType.Drawn, runParams);
|
||||||
}
|
}
|
||||||
// lose:
|
// lose:
|
||||||
else if (!Preferences.DEV_MODE || Preferences.MILL) {
|
else if (!Preferences.DEV_MODE || Singletons.getModel().getPreferences().getPrefBoolean(FPref.DEV_MILLING_LOSS)) {
|
||||||
// if devMode is off, or canLoseByDecking is Enabled, run Lose condition
|
// if devMode is off, or canLoseByDecking is Enabled, run Lose condition
|
||||||
if (!this.cantLose()) {
|
if (!this.cantLose()) {
|
||||||
this.loseConditionMet(GameLossReason.Milled, null);
|
this.loseConditionMet(GameLossReason.Milled, null);
|
||||||
@@ -2691,4 +2696,12 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (41 * (41 + this.getName().hashCode()));
|
return (41 * (41 + this.getName().hashCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Deck getDeck() {
|
||||||
|
return deck;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeck(Deck deck) {
|
||||||
|
this.deck = deck;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package forge.gui.deckeditor.controllers;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.Constant;
|
import forge.AllZone;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
@@ -169,7 +169,7 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
|
|||||||
*/
|
*/
|
||||||
private Deck getPlayersDeck() {
|
private Deck getPlayersDeck() {
|
||||||
final Deck deck = new Deck();
|
final Deck deck = new Deck();
|
||||||
Constant.Runtime.HUMAN_DECK[0] = deck;
|
AllZone.getHumanPlayer().setDeck(deck);
|
||||||
|
|
||||||
// add sideboard to deck
|
// add sideboard to deck
|
||||||
deck.getSideboard().addAll(this.getTableDeck().getCards());
|
deck.getSideboard().addAll(this.getTableDeck().getCards());
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import com.google.common.base.Function;
|
|||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.Constant;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.gui.deckeditor.SEditorIO;
|
import forge.gui.deckeditor.SEditorIO;
|
||||||
import forge.gui.deckeditor.SEditorUtil;
|
import forge.gui.deckeditor.SEditorUtil;
|
||||||
@@ -222,8 +221,8 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
|
|||||||
this.getTableCatalog().setup(VCardCatalog.SINGLETON_INSTANCE, columnsCatalog);
|
this.getTableCatalog().setup(VCardCatalog.SINGLETON_INSTANCE, columnsCatalog);
|
||||||
this.getTableDeck().setup(VCurrentDeck.SINGLETON_INSTANCE, columnsDeck);
|
this.getTableDeck().setup(VCurrentDeck.SINGLETON_INSTANCE, columnsDeck);
|
||||||
|
|
||||||
Deck deck = Constant.Runtime.HUMAN_DECK[0] == null ? null : this.questData.getMyDecks().get(
|
Deck deck = AllZone.getHumanPlayer().getDeck() == null ? null : this.questData.getMyDecks().get(
|
||||||
Constant.Runtime.HUMAN_DECK[0].getName());
|
AllZone.getHumanPlayer().getDeck().getName());
|
||||||
|
|
||||||
if (deck == null) {
|
if (deck == null) {
|
||||||
deck = new Deck();
|
deck = new Deck();
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ public class SSubmenuQuestUtil {
|
|||||||
final SwingWorker<Object, Void> worker = new SwingWorker<Object, Void>() {
|
final SwingWorker<Object, Void> worker = new SwingWorker<Object, Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Object doInBackground() {
|
public Object doInBackground() {
|
||||||
Constant.Runtime.HUMAN_DECK[0] = SSubmenuQuestUtil.getCurrentDeck();
|
AllZone.getHumanPlayer().setDeck(SSubmenuQuestUtil.getCurrentDeck());
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = event.getEventDeck();
|
AllZone.getComputerPlayer().setDeck(event.getEventDeck());
|
||||||
Constant.Runtime.setGameType(GameType.Quest);
|
Constant.Runtime.setGameType(GameType.Quest);
|
||||||
|
|
||||||
qData.getChallengesManager().randomizeOpponents();
|
qData.getChallengesManager().randomizeOpponents();
|
||||||
@@ -255,8 +255,8 @@ public class SSubmenuQuestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GameNew.newGame(
|
GameNew.newGame(
|
||||||
Constant.Runtime.HUMAN_DECK[0],
|
AllZone.getHumanPlayer().getDeck(),
|
||||||
Constant.Runtime.COMPUTER_DECK[0],
|
AllZone.getComputerPlayer().getDeck(),
|
||||||
QuestUtil.getHumanStartingCards(qData, event),
|
QuestUtil.getHumanStartingCards(qData, event),
|
||||||
QuestUtil.getComputerStartingCards(event),
|
QuestUtil.getComputerStartingCards(event),
|
||||||
baseLifeHuman + extraLifeHuman,
|
baseLifeHuman + extraLifeHuman,
|
||||||
|
|||||||
@@ -344,15 +344,15 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
final SwingWorker<Object, Void> worker = new SwingWorker<Object, Void>() {
|
final SwingWorker<Object, Void> worker = new SwingWorker<Object, Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Object doInBackground() {
|
public Object doInBackground() {
|
||||||
Constant.Runtime.HUMAN_DECK[0] =
|
AllZone.getHumanPlayer().setDeck(
|
||||||
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstHumanDecks(), PlayerType.HUMAN);
|
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstHumanDecks(), PlayerType.HUMAN));
|
||||||
Constant.Runtime.COMPUTER_DECK[0] =
|
AllZone.getComputerPlayer().setDeck(
|
||||||
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstAIDecks(), PlayerType.COMPUTER);
|
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstAIDecks(), PlayerType.COMPUTER));
|
||||||
|
|
||||||
Constant.Runtime.setGameType(GameType.Constructed);
|
Constant.Runtime.setGameType(GameType.Constructed);
|
||||||
|
|
||||||
if (Constant.Runtime.HUMAN_DECK[0] != null && Constant.Runtime.COMPUTER_DECK[0] != null) {
|
if (AllZone.getHumanPlayer().getDeck() != null && AllZone.getComputerPlayer().getDeck() != null) {
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,15 +202,15 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
public Object doInBackground() {
|
public Object doInBackground() {
|
||||||
DeckGroup opponentDecks = Singletons.getModel().getDecks().getDraft().get(human.getName());
|
DeckGroup opponentDecks = Singletons.getModel().getDecks().getDraft().get(human.getName());
|
||||||
|
|
||||||
Constant.Runtime.HUMAN_DECK[0] = human;
|
AllZone.getHumanPlayer().setDeck(human);
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = opponentDecks.getAiDecks().get(aiIndex); //zero is human deck, so it must be +1
|
AllZone.getComputerPlayer().setDeck(opponentDecks.getAiDecks().get(aiIndex)); //zero is human deck, so it must be +1
|
||||||
|
|
||||||
if (Constant.Runtime.COMPUTER_DECK[0] == null) {
|
if (AllZone.getComputerPlayer().getDeck() == null) {
|
||||||
throw new IllegalStateException("Draft: Computer deck is null!");
|
throw new IllegalStateException("Draft: Computer deck is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant.Runtime.setGameType(GameType.Draft);
|
Constant.Runtime.setGameType(GameType.Draft);
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.awt.event.MouseEvent;
|
|||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Constant;
|
|
||||||
import forge.Constant.Preferences;
|
import forge.Constant.Preferences;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.RestartUtil;
|
import forge.control.RestartUtil;
|
||||||
@@ -120,9 +119,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
view.getCbStackLand().addItemListener(new ItemListener() {
|
view.getCbStackLand().addItemListener(new ItemListener() {
|
||||||
@Override
|
@Override
|
||||||
public void itemStateChanged(final ItemEvent arg0) {
|
public void itemStateChanged(final ItemEvent arg0) {
|
||||||
final boolean toggle = view.getCbStackLand().isSelected();
|
prefs.setPref(FPref.UI_SMOOTH_LAND, view.getCbRandomFoil().isSelected());
|
||||||
prefs.setPref(FPref.UI_SMOOTH_LAND, String.valueOf(toggle));
|
|
||||||
Constant.Runtime.SMOOTH[0] = toggle;
|
|
||||||
prefs.save();
|
prefs.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -130,9 +127,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
view.getCbRandomFoil().addItemListener(new ItemListener() {
|
view.getCbRandomFoil().addItemListener(new ItemListener() {
|
||||||
@Override
|
@Override
|
||||||
public void itemStateChanged(final ItemEvent arg0) {
|
public void itemStateChanged(final ItemEvent arg0) {
|
||||||
final boolean toggle = view.getCbRandomFoil().isSelected();
|
prefs.setPref(FPref.UI_RANDOM_FOIL, view.getCbRandomFoil().isSelected());
|
||||||
prefs.setPref(FPref.UI_RANDOM_FOIL, String.valueOf(toggle));
|
|
||||||
Preferences.RANDOM_FOIL = toggle;
|
|
||||||
prefs.save();
|
prefs.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -91,10 +91,11 @@ public class ControlWinLose {
|
|||||||
boolean isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
|
boolean isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
|
||||||
GameType gameType = Constant.Runtime.getGameType();
|
GameType gameType = Constant.Runtime.getGameType();
|
||||||
|
|
||||||
|
Deck hDeck = AllZone.getHumanPlayer().getDeck();
|
||||||
|
Deck cDeck = AllZone.getComputerPlayer().getDeck();
|
||||||
|
|
||||||
//This is called from QuestWinLoseHandler also. If we're in a quest, this is already handled elsewhere
|
//This is called from QuestWinLoseHandler also. If we're in a quest, this is already handled elsewhere
|
||||||
if (isAnte && !gameType.equals(GameType.Quest)) {
|
if (isAnte && !gameType.equals(GameType.Quest)) {
|
||||||
Deck hDeck = Constant.Runtime.HUMAN_DECK[0];
|
|
||||||
Deck cDeck = Constant.Runtime.COMPUTER_DECK[0];
|
|
||||||
if (Singletons.getModel().getMatchState().hasWonLastGame(AllZone.getHumanPlayer().getName())) {
|
if (Singletons.getModel().getMatchState().hasWonLastGame(AllZone.getHumanPlayer().getName())) {
|
||||||
List<Card> compAntes = AllZone.getComputerPlayer().getCardsIn(ZoneType.Ante);
|
List<Card> compAntes = AllZone.getComputerPlayer().getCardsIn(ZoneType.Ante);
|
||||||
|
|
||||||
@@ -104,8 +105,6 @@ public class ControlWinLose {
|
|||||||
cDeck.getMain().remove(toRemove);
|
cDeck.getMain().remove(toRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = cDeck;
|
|
||||||
|
|
||||||
List<Card> o = GuiChoose.noneOrMany("Select cards to add to your deck", compAntes);
|
List<Card> o = GuiChoose.noneOrMany("Select cards to add to your deck", compAntes);
|
||||||
if (null != o) {
|
if (null != o) {
|
||||||
for (Card c : o) {
|
for (Card c : o) {
|
||||||
@@ -121,11 +120,11 @@ public class ControlWinLose {
|
|||||||
CardPrinted toRemove = CardDb.instance().getCard(c);
|
CardPrinted toRemove = CardDb.instance().getCard(c);
|
||||||
hDeck.getMain().remove(toRemove);
|
hDeck.getMain().remove(toRemove);
|
||||||
}
|
}
|
||||||
Constant.Runtime.HUMAN_DECK[0] = hDeck;
|
AllZone.getHumanPlayer().setDeck(hDeck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Singletons.getModel().savePrefs();
|
Singletons.getModel().savePrefs();
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
GameNew.newGame(hDeck, cDeck);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package forge.gui.match;
|
|||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Constant;
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
|
|
||||||
@@ -133,7 +132,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
computerLife = ((QuestEventChallenge) qEvent).getAILife();
|
computerLife = ((QuestEventChallenge) qEvent).getAILife();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameNew.newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0],
|
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck(),
|
||||||
humanList, computerList, humanLife, computerLife, qEvent.getIconFilename());
|
humanList, computerList, humanLife, computerLife, qEvent.getIconFilename());
|
||||||
} else {
|
} else {
|
||||||
super.startNextRound();
|
super.startNextRound();
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import forge.Card;
|
|||||||
import forge.CardListUtil;
|
import forge.CardListUtil;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Constant;
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.phase.CombatUtil;
|
import forge.game.phase.CombatUtil;
|
||||||
@@ -194,10 +193,10 @@ public enum CDock implements ICDoc {
|
|||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
Deck targetDeck;
|
Deck targetDeck;
|
||||||
|
|
||||||
if (!Constant.Runtime.HUMAN_DECK[0].getMain().isEmpty()) {
|
if (!AllZone.getHumanPlayer().getDeck().getMain().isEmpty()) {
|
||||||
targetDeck = Constant.Runtime.HUMAN_DECK[0];
|
targetDeck = AllZone.getHumanPlayer().getDeck();
|
||||||
} else if (!Constant.Runtime.COMPUTER_DECK[0].getMain().isEmpty()) {
|
} else if (!AllZone.getComputerPlayer().getDeck().getMain().isEmpty()) {
|
||||||
targetDeck = Constant.Runtime.COMPUTER_DECK[0];
|
targetDeck = AllZone.getComputerPlayer().getDeck();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import javax.swing.border.MatteBorder;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Constant;
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.deck.CardCollections;
|
import forge.deck.CardCollections;
|
||||||
@@ -425,7 +424,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
private <T extends DeckBase> void editDeck(final Deck d0) {
|
private <T extends DeckBase> void editDeck(final Deck d0) {
|
||||||
switch (this.gametype) {
|
switch (this.gametype) {
|
||||||
case Quest:
|
case Quest:
|
||||||
Constant.Runtime.HUMAN_DECK[0] = d0;
|
AllZone.getHumanPlayer().setDeck(d0);
|
||||||
final CEditorQuest qEditor = new CEditorQuest(AllZone.getQuest());
|
final CEditorQuest qEditor = new CEditorQuest(AllZone.getQuest());
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setCurrentEditorController(qEditor);
|
CDeckEditorUI.SINGLETON_INSTANCE.setCurrentEditorController(qEditor);
|
||||||
FControl.SINGLETON_INSTANCE.changeState(FControl.DECK_EDITOR_QUEST);
|
FControl.SINGLETON_INSTANCE.changeState(FControl.DECK_EDITOR_QUEST);
|
||||||
|
|||||||
@@ -234,14 +234,13 @@ public class ForgePreferences {
|
|||||||
this.setPref(FPref.PHASE_HUMAN_COMBATDAMAGE, String.valueOf(fieldViews.get(1).getLblCombatDamage().getEnabled()));
|
this.setPref(FPref.PHASE_HUMAN_COMBATDAMAGE, String.valueOf(fieldViews.get(1).getLblCombatDamage().getEnabled()));
|
||||||
this.setPref(FPref.PHASE_HUMAN_ENDCOMBAT, String.valueOf(fieldViews.get(1).getLblEndCombat().getEnabled()));
|
this.setPref(FPref.PHASE_HUMAN_ENDCOMBAT, String.valueOf(fieldViews.get(1).getLblEndCombat().getEnabled()));
|
||||||
this.setPref(FPref.PHASE_HUMAN_MAIN2, String.valueOf(fieldViews.get(1).getLblMain2().getEnabled()));
|
this.setPref(FPref.PHASE_HUMAN_MAIN2, String.valueOf(fieldViews.get(1).getLblMain2().getEnabled()));
|
||||||
this.setPref(FPref.PHASE_HUMAN_EOT, String.valueOf(fieldViews.get(1).getLblEndTurn().getEnabled()));
|
this.setPref(FPref.PHASE_HUMAN_EOT, fieldViews.get(1).getLblEndTurn().getEnabled());
|
||||||
this.setPref(FPref.PHASE_HUMAN_CLEANUP, String.valueOf(fieldViews.get(1).getLblCleanup().getEnabled()));
|
this.setPref(FPref.PHASE_HUMAN_CLEANUP, fieldViews.get(1).getLblCleanup().getEnabled());
|
||||||
|
|
||||||
final VDev v = VDev.SINGLETON_INSTANCE;
|
final VDev v = VDev.SINGLETON_INSTANCE;
|
||||||
Preferences.MILL = v.getLblMilling().getEnabled();
|
|
||||||
|
this.setPref(FPref.DEV_MILLING_LOSS, v.getLblMilling().getEnabled());
|
||||||
this.setPref(FPref.DEV_MILLING_LOSS, String.valueOf(Preferences.MILL));
|
this.setPref(FPref.DEV_UNLIMITED_LAND, v.getLblUnlimitedLands().getEnabled());
|
||||||
this.setPref(FPref.DEV_UNLIMITED_LAND, String.valueOf(v.getLblUnlimitedLands().getEnabled()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,9 +250,7 @@ public class ForgePreferences {
|
|||||||
public void actuateMatchPreferences() {
|
public void actuateMatchPreferences() {
|
||||||
final List<VField> fieldViews = VMatchUI.SINGLETON_INSTANCE.getFieldViews();
|
final List<VField> fieldViews = VMatchUI.SINGLETON_INSTANCE.getFieldViews();
|
||||||
|
|
||||||
Preferences.MILL = this.getPrefBoolean(FPref.DEV_MILLING_LOSS);
|
|
||||||
Preferences.DEV_MODE = this.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
Preferences.DEV_MODE = this.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
||||||
Preferences.RANDOM_FOIL = this.getPrefBoolean(FPref.UI_RANDOM_FOIL);
|
|
||||||
Preferences.UPLOAD_DRAFT = (Constant.Runtime.NET_CONN[0] ? this.getPrefBoolean(FPref.UI_UPLOAD_DRAFT) : false);
|
Preferences.UPLOAD_DRAFT = (Constant.Runtime.NET_CONN[0] ? this.getPrefBoolean(FPref.UI_UPLOAD_DRAFT) : false);
|
||||||
|
|
||||||
// AI field is at index [0]
|
// AI field is at index [0]
|
||||||
@@ -336,6 +333,10 @@ public class ForgePreferences {
|
|||||||
preferenceValues.put(q0, s0);
|
preferenceValues.put(q0, s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPref(FPref q0, boolean val) {
|
||||||
|
setPref(q0, String.valueOf(val));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a non-difficulty-indexed preference value.
|
* Returns a non-difficulty-indexed preference value.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user