newGame routine

eliminating global references to getXXXXplayer
This commit is contained in:
Maxmtg
2012-10-05 20:26:20 +00:00
parent 36dd173dd5
commit 14834c0a92
32 changed files with 561 additions and 584 deletions

1
.gitattributes vendored
View File

@@ -12601,6 +12601,7 @@ src/main/java/forge/game/GamePlayerRating.java -text
src/main/java/forge/game/GameState.java -text src/main/java/forge/game/GameState.java -text
src/main/java/forge/game/GameSummary.java svneol=native#text/plain src/main/java/forge/game/GameSummary.java svneol=native#text/plain
src/main/java/forge/game/GameType.java -text src/main/java/forge/game/GameType.java -text
src/main/java/forge/game/PlayerStartsGame.java -text
src/main/java/forge/game/limited/BoosterDeck.java -text src/main/java/forge/game/limited/BoosterDeck.java -text
src/main/java/forge/game/limited/BoosterDraft.java svneol=native#text/plain src/main/java/forge/game/limited/BoosterDraft.java svneol=native#text/plain
src/main/java/forge/game/limited/BoosterDraftAI.java svneol=native#text/plain src/main/java/forge/game/limited/BoosterDraftAI.java svneol=native#text/plain

View File

@@ -1035,14 +1035,7 @@ public class GameAction {
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
AllZone.getTriggerHandler().runTrigger(TriggerType.Always, runParams); AllZone.getTriggerHandler().runTrigger(TriggerType.Always, runParams);
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); for (Card c : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) {
Card c;
final Iterator<Card> it = list.iterator();
while (it.hasNext()) {
c = it.next();
if (c.isEquipped()) { if (c.isEquipped()) {
final List<Card> equipments = new ArrayList<Card>(c.getEquippedBy()); final List<Card> equipments = new ArrayList<Card>(c.getEquippedBy());
for (final Card equipment : equipments) { for (final Card equipment : equipments) {

View File

@@ -1154,7 +1154,7 @@ public class AbilityFactoryAttach {
if (!mandatory && card.isEquipment() && !targets.isEmpty()) { if (!mandatory && card.isEquipment() && !targets.isEmpty()) {
Card newTarget = (Card) targets.get(0); Card newTarget = (Card) targets.get(0);
//don't equip human creatures //don't equip human creatures
if (newTarget.getController().isPlayer(AllZone.getHumanPlayer())) { if (newTarget.getController().isHuman()) {
return false; return false;
} }

View File

@@ -300,8 +300,8 @@ public class AbilityFactoryEffect {
} else if (logic.equals("Always")) { } else if (logic.equals("Always")) {
randomReturn = true; randomReturn = true;
} else if (logic.equals("Evasion")) { } else if (logic.equals("Evasion")) {
List<Card> comp = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); List<Card> comp = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
List<Card> human = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); List<Card> human = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
// only count creatures that can attack or block // only count creatures that can attack or block
comp = CardListUtil.filter(comp, new Predicate<Card>() { comp = CardListUtil.filter(comp, new Predicate<Card>() {

View File

@@ -2,6 +2,8 @@ package forge.card.cardfactory;
import java.util.List; import java.util.List;
import com.google.common.collect.Iterables;
import forge.AllZone; import forge.AllZone;
import forge.AllZoneUtil; import forge.AllZoneUtil;
import forge.Card; import forge.Card;
@@ -70,10 +72,16 @@ class CardFactoryEnchantments {
@Override @Override
public boolean canPlay() { public boolean canPlay() {
final List<Card> grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard); boolean haveGraveWithSomeCreatures = false;
final List<Card> aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard); for( Player p : AllZone.getPlayersInGame()) {
return ((CardListUtil.getType(grave, "Creature").size() > 1) || (CardListUtil.getType(aiGrave, "Creature").size() > 1)) Iterable<Card> grave = CardListUtil.filter(p.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
&& super.canPlay(); if( Iterables.size(grave) > 1)
{
haveGraveWithSomeCreatures = true;
break;
}
}
return haveGraveWithSomeCreatures && super.canPlay();
} }
}; };
final Input soilTarget = new Input() { final Input soilTarget = new Input() {

View File

@@ -1889,11 +1889,10 @@ public class CardFactoryUtil {
cl = CardListUtil.filter(cl, new Predicate<Card>() { cl = CardListUtil.filter(cl, new Predicate<Card>() {
@Override @Override
public boolean apply(final Card c) { public boolean apply(final Card c) {
if (zone.is(ZoneType.Graveyard)) { if (zone.is(ZoneType.Graveyard) && c.hasUnearth()) {
if (c.hasUnearth()) { return true;
return true;
}
} }
if (c.hasKeyword("You may look at this card.")) { if (c.hasKeyword("You may look at this card.")) {
return true; return true;
} }

View File

@@ -19,22 +19,12 @@ package forge.card.cost;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import forge.AllZone;
import forge.Card; import forge.Card;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.card.trigger.TriggerType;
import forge.control.input.Input;
import forge.control.input.InputMana;
import forge.control.input.InputPayManaCostUtil; import forge.control.input.InputPayManaCostUtil;
import forge.game.phase.PhaseHandler;
import forge.game.player.ComputerUtil; import forge.game.player.ComputerUtil;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.gui.match.CMatchUI;
import forge.view.ButtonUtil;
/** /**
* The Class CostMana. * The Class CostMana.
@@ -229,9 +219,9 @@ public class CostMana extends CostPart {
} }
} }
if (!this.getManaToPay().equals("0") || (manaToAdd > 0)) { if (!this.getManaToPay().equals("0") || (manaToAdd > 0)) {
CostUtil.setInput(CostMana.inputPayMana(ability, payment, this, manaToAdd)); CostUtil.setInput(InputPayManaCostUtil.inputPayMana(ability, payment, this, manaToAdd));
} else if (this.getXMana() > 0) { } else if (this.getXMana() > 0) {
CostUtil.setInput(CostMana.inputPayXMana(ability, payment, this, this.getXMana())); CostUtil.setInput(InputPayManaCostUtil.inputPayXMana(ability, payment, this, this.getXMana()));
} else { } else {
payment.paidCost(this); payment.paidCost(this);
} }
@@ -255,274 +245,4 @@ public class CostMana extends CostPart {
// Inputs // Inputs
/**
* <p>
* input_payXMana.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param payment
* a {@link forge.card.cost.CostPayment} object.
* @param costMana
* TODO
* @param numX
* a int.
*
* @return a {@link forge.control.input.Input} object.
*/
public static Input inputPayXMana(final SpellAbility sa, final CostPayment payment, final CostMana costMana,
final int numX) {
final Input payX = new InputMana() {
private static final long serialVersionUID = -6900234444347364050L;
private int xPaid = 0;
private String colorsPaid = sa.getSourceCard().getColorsPaid();
private ManaCost manaCost = new ManaCost(Integer.toString(numX));
@Override
public void showMessage() {
if ((xPaid == 0 && costMana.isxCantBe0()) ||
!this.manaCost.toString().equals(Integer.toString(numX))) {
ButtonUtil.enableOnlyCancel();
// only cancel if partially paid an X value
// or X is 0, and x can't be 0
} else {
ButtonUtil.enableAll();
}
StringBuilder msg = new StringBuilder("Pay X Mana Cost for ");
msg.append(sa.getSourceCard().getName()).append("\n").append(this.xPaid);
msg.append(" Paid so far.");
if (costMana.isxCantBe0()) {
msg.append(" X Can't be 0.");
}
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
}
// selectCard
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
// this really shouldn't happen but just in case
return;
}
this.manaCost = InputPayManaCostUtil.activateManaAbility(sa, card, this.manaCost);
if (this.manaCost.isPaid()) {
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {
this.colorsPaid += this.manaCost.getColorsPaid();
}
this.manaCost = new ManaCost(Integer.toString(numX));
this.xPaid++;
}
if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
@Override
public void selectButtonCancel() {
this.stop();
payment.cancelCost();
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
}
@Override
public void selectButtonOK() {
this.stop();
payment.getCard().setXManaCostPaid(this.xPaid);
payment.paidCost(costMana);
payment.getCard().setColorsPaid(this.colorsPaid);
payment.getCard().setSunburstValue(this.colorsPaid.length());
}
@Override
public void selectManaPool(String color) {
this.manaCost = InputPayManaCostUtil.activateManaAbility(color, sa, this.manaCost);
if (this.manaCost.isPaid()) {
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {
this.colorsPaid += this.manaCost.getColorsPaid();
}
this.manaCost = new ManaCost(Integer.toString(numX));
this.xPaid++;
}
if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
};
return payX;
}
/**
* <p>
* input_payMana.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param payment
* a {@link forge.card.cost.CostPayment} object.
* @param costMana
* the cost mana
* @param manaToAdd
* a int.
* @return a {@link forge.control.input.Input} object.
*/
public static Input inputPayMana(final SpellAbility sa, final CostPayment payment, final CostMana costMana,
final int manaToAdd) {
final ManaCost manaCost;
if (PhaseHandler.getGameBegins() == 1) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
manaCost = new ManaCost("0");
} else {
final String mana = costMana.getManaToPay();
manaCost = new ManaCost(mana);
manaCost.increaseColorlessMana(manaToAdd);
}
} else {
System.out.println("Is input_payMana ever called when the Game isn't in progress?");
manaCost = new ManaCost(sa.getManaCost());
}
final Input payMana = new InputMana() {
private ManaCost mana = manaCost;
private static final long serialVersionUID = 3467312982164195091L;
private final String originalManaCost = costMana.getMana();
private int phyLifeToLose = 0;
private void resetManaCost() {
this.mana = new ManaCost(this.originalManaCost);
this.phyLifeToLose = 0;
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
// prevent cards from tapping themselves if ability is a
// tapability, although it should already be tapped
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
return;
}
this.mana = InputPayManaCostUtil.activateManaAbility(sa, card, this.mana);
if (this.mana.isPaid()) {
this.done();
} else if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
@Override
public void selectPlayer(final Player player) {
if (player.isHuman()) {
if (manaCost.payPhyrexian()) {
this.phyLifeToLose += 2;
}
this.showMessage();
}
}
private void done() {
final Card source = sa.getSourceCard();
if (this.phyLifeToLose > 0) {
AllZone.getHumanPlayer().payLife(this.phyLifeToLose, source);
}
source.setColorsPaid(this.mana.getColorsPaid());
source.setSunburstValue(this.mana.getSunburst());
this.resetManaCost();
this.stop();
if (costMana.hasNoXManaCost() || (manaToAdd > 0)) {
payment.paidCost(costMana);
} else {
source.setXManaCostPaid(0);
CostUtil.setInput(CostMana.inputPayXMana(sa, payment, costMana, costMana.getXMana()));
}
// If this is a spell with convoke, re-tap all creatures used
// for it.
// This is done to make sure Taps triggers go off at the right
// time
// (i.e. AFTER cost payment, they are tapped previously as well
// so that
// any mana tapabilities can't be used in payment as well as
// being tapped for convoke)
if (sa.getTappedForConvoke() != null) {
AllZone.getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
c.tap();
}
AllZone.getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}
}
@Override
public void selectButtonCancel() {
// If we're paying for a spell with convoke, untap all creatures
// used for it.
if (sa.getTappedForConvoke() != null) {
AllZone.getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
}
AllZone.getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}
this.stop();
this.resetManaCost();
payment.cancelCost();
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
}
@Override
public void showMessage() {
ButtonUtil.enableOnlyCancel();
final String displayMana = this.mana.toString().replace("X", "").trim();
CMatchUI.SINGLETON_INSTANCE.showMessage("Pay Mana Cost: " + displayMana);
final StringBuilder msg = new StringBuilder("Pay Mana Cost: " + displayMana);
if (this.phyLifeToLose > 0) {
msg.append(" (");
msg.append(this.phyLifeToLose);
msg.append(" life paid for phyrexian mana)");
}
if (this.mana.containsPhyrexianMana()) {
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
}
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
if (this.mana.isPaid()) {
this.done();
}
}
@Override
public void selectManaPool(String color) {
this.mana = InputPayManaCostUtil.activateManaAbility(color, sa, this.mana);
if (this.mana.isPaid()) {
this.done();
} else if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
};
return payMana;
}
} }

View File

@@ -197,7 +197,7 @@ public class InputPayManaCost extends InputMana {
*/ */
private void done() { private void done() {
if (this.phyLifeToLose > 0) { if (this.phyLifeToLose > 0) {
AllZone.getHumanPlayer().payLife(this.phyLifeToLose, this.originalCard); Singletons.getControl().getPlayer().payLife(this.phyLifeToLose, this.originalCard);
} }
if (this.spell.getSourceCard().isCopiedSpell()) { if (this.spell.getSourceCard().isCopiedSpell()) {
if (this.spell.getAfterPayMana() != null) { if (this.spell.getAfterPayMana() != null) {
@@ -206,7 +206,7 @@ public class InputPayManaCost extends InputMana {
AllZone.getInputControl().resetInput(); AllZone.getInputControl().resetInput();
} }
} else { } else {
AllZone.getHumanPlayer().getManaPool().clearManaPaid(this.spell, false); Singletons.getControl().getPlayer().getManaPool().clearManaPaid(this.spell, false);
this.resetManaCost(); this.resetManaCost();
// if tap ability, tap card // if tap ability, tap card

View File

@@ -20,6 +20,7 @@ package forge.control.input;
import forge.AllZone; import forge.AllZone;
import forge.Card; import forge.Card;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.game.player.Player; import forge.game.player.Player;
@@ -188,11 +189,11 @@ public class InputPayManaCostAbility extends InputMana {
private void done() { private void done() {
if (this.phyLifeToLose > 0) { if (this.phyLifeToLose > 0) {
AllZone.getHumanPlayer().payLife(this.phyLifeToLose, null); Singletons.getControl().getPlayer().payLife(this.phyLifeToLose, null);
} }
this.paidCommand.execute(); this.paidCommand.execute();
this.resetManaCost(); this.resetManaCost();
AllZone.getHumanPlayer().getManaPool().clearManaPaid(this.fakeAbility, false); Singletons.getControl().getPlayer().getManaPool().clearManaPaid(this.fakeAbility, false);
this.stop(); this.stop();
} }

View File

@@ -29,11 +29,21 @@ import forge.Constant;
import forge.Singletons; import forge.Singletons;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.abilityfactory.AbilityFactoryMana; import forge.card.abilityfactory.AbilityFactoryMana;
import forge.card.cost.CostMana;
import forge.card.cost.CostPayment;
import forge.card.cost.CostUtil;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
import forge.card.mana.ManaPool; import forge.card.mana.ManaPool;
import forge.card.spellability.AbilityMana; import forge.card.spellability.AbilityMana;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.card.trigger.TriggerType;
import forge.game.phase.PhaseHandler;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
import forge.gui.match.CMatchUI;
import forge.view.ButtonUtil;
/** /**
* <p> * <p>
@@ -84,7 +94,7 @@ public class InputPayManaCostUtil {
final Iterator<AbilityMana> it = abilities.iterator(); final Iterator<AbilityMana> it = abilities.iterator();
while (it.hasNext()) { while (it.hasNext()) {
final AbilityMana ma = it.next(); final AbilityMana ma = it.next();
ma.setActivatingPlayer(AllZone.getHumanPlayer()); ma.setActivatingPlayer(Singletons.getControl().getPlayer());
if (!ma.canPlay()) { if (!ma.canPlay()) {
it.remove(); it.remove();
} else if (!InputPayManaCostUtil.canMake(ma, cneeded.toString())) { } else if (!InputPayManaCostUtil.canMake(ma, cneeded.toString())) {
@@ -197,7 +207,7 @@ public class InputPayManaCostUtil {
Singletons.getModel().getGameAction().playSpellAbility(chosen); Singletons.getModel().getGameAction().playSpellAbility(chosen);
manaCost = AllZone.getHumanPlayer().getManaPool().payManaFromAbility(sa, manaCost, chosen); manaCost = Singletons.getControl().getPlayer().getManaPool().payManaFromAbility(sa, manaCost, chosen);
//AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers(); //AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
// DO NOT REMOVE THIS, otherwise the cards don't always tap (copied) // DO NOT REMOVE THIS, otherwise the cards don't always tap (copied)
@@ -216,7 +226,7 @@ public class InputPayManaCostUtil {
* @return ManaCost the amount of mana remaining to be paid after the mana is activated * @return ManaCost the amount of mana remaining to be paid after the mana is activated
*/ */
public static ManaCost activateManaAbility(String color, final SpellAbility sa, ManaCost manaCost) { public static ManaCost activateManaAbility(String color, final SpellAbility sa, ManaCost manaCost) {
ManaPool mp = AllZone.getHumanPlayer().getManaPool(); ManaPool mp = Singletons.getControl().getPlayer().getManaPool();
// Convert Color to short String // Convert Color to short String
String manaStr = "1"; String manaStr = "1";
@@ -337,4 +347,275 @@ public class InputPayManaCostUtil {
return o.toString(); return o.toString();
} }
/**
* <p>
* input_payXMana.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param payment
* a {@link forge.card.cost.CostPayment} object.
* @param costMana
* TODO
* @param numX
* a int.
*
* @return a {@link forge.control.input.Input} object.
*/
public static Input inputPayXMana(final SpellAbility sa, final CostPayment payment, final CostMana costMana,
final int numX) {
final Input payX = new InputMana() {
private static final long serialVersionUID = -6900234444347364050L;
private int xPaid = 0;
private String colorsPaid = sa.getSourceCard().getColorsPaid();
private ManaCost manaCost = new ManaCost(Integer.toString(numX));
@Override
public void showMessage() {
if ((xPaid == 0 && costMana.isxCantBe0()) ||
!this.manaCost.toString().equals(Integer.toString(numX))) {
ButtonUtil.enableOnlyCancel();
// only cancel if partially paid an X value
// or X is 0, and x can't be 0
} else {
ButtonUtil.enableAll();
}
StringBuilder msg = new StringBuilder("Pay X Mana Cost for ");
msg.append(sa.getSourceCard().getName()).append("\n").append(this.xPaid);
msg.append(" Paid so far.");
if (costMana.isxCantBe0()) {
msg.append(" X Can't be 0.");
}
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
}
// selectCard
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
// this really shouldn't happen but just in case
return;
}
this.manaCost = activateManaAbility(sa, card, this.manaCost);
if (this.manaCost.isPaid()) {
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {
this.colorsPaid += this.manaCost.getColorsPaid();
}
this.manaCost = new ManaCost(Integer.toString(numX));
this.xPaid++;
}
if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
@Override
public void selectButtonCancel() {
this.stop();
payment.cancelCost();
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
}
@Override
public void selectButtonOK() {
this.stop();
payment.getCard().setXManaCostPaid(this.xPaid);
payment.paidCost(costMana);
payment.getCard().setColorsPaid(this.colorsPaid);
payment.getCard().setSunburstValue(this.colorsPaid.length());
}
@Override
public void selectManaPool(String color) {
this.manaCost = activateManaAbility(color, sa, this.manaCost);
if (this.manaCost.isPaid()) {
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {
this.colorsPaid += this.manaCost.getColorsPaid();
}
this.manaCost = new ManaCost(Integer.toString(numX));
this.xPaid++;
}
if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
};
return payX;
}
/**
* <p>
* input_payMana.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param payment
* a {@link forge.card.cost.CostPayment} object.
* @param costMana
* the cost mana
* @param manaToAdd
* a int.
* @return a {@link forge.control.input.Input} object.
*/
public static Input inputPayMana(final SpellAbility sa, final CostPayment payment, final CostMana costMana,
final int manaToAdd) {
final ManaCost manaCost;
if (PhaseHandler.getGameBegins() == 1) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
manaCost = new ManaCost("0");
} else {
final String mana = costMana.getManaToPay();
manaCost = new ManaCost(mana);
manaCost.increaseColorlessMana(manaToAdd);
}
} else {
System.out.println("Is input_payMana ever called when the Game isn't in progress?");
manaCost = new ManaCost(sa.getManaCost());
}
final Input payMana = new InputMana() {
private ManaCost mana = manaCost;
private static final long serialVersionUID = 3467312982164195091L;
private final String originalManaCost = costMana.getMana();
private int phyLifeToLose = 0;
private void resetManaCost() {
this.mana = new ManaCost(this.originalManaCost);
this.phyLifeToLose = 0;
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
// prevent cards from tapping themselves if ability is a
// tapability, although it should already be tapped
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
return;
}
this.mana = activateManaAbility(sa, card, this.mana);
if (this.mana.isPaid()) {
this.done();
} else if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
@Override
public void selectPlayer(final Player player) {
if (player.isHuman()) {
if (manaCost.payPhyrexian()) {
this.phyLifeToLose += 2;
}
this.showMessage();
}
}
private void done() {
final Card source = sa.getSourceCard();
if (this.phyLifeToLose > 0) {
Singletons.getControl().getPlayer().payLife(this.phyLifeToLose, source);
}
source.setColorsPaid(this.mana.getColorsPaid());
source.setSunburstValue(this.mana.getSunburst());
this.resetManaCost();
this.stop();
if (costMana.hasNoXManaCost() || (manaToAdd > 0)) {
payment.paidCost(costMana);
} else {
source.setXManaCostPaid(0);
CostUtil.setInput(InputPayManaCostUtil.inputPayXMana(sa, payment, costMana, costMana.getXMana()));
}
// If this is a spell with convoke, re-tap all creatures used
// for it.
// This is done to make sure Taps triggers go off at the right
// time
// (i.e. AFTER cost payment, they are tapped previously as well
// so that
// any mana tapabilities can't be used in payment as well as
// being tapped for convoke)
if (sa.getTappedForConvoke() != null) {
AllZone.getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
c.tap();
}
AllZone.getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}
}
@Override
public void selectButtonCancel() {
// If we're paying for a spell with convoke, untap all creatures
// used for it.
if (sa.getTappedForConvoke() != null) {
AllZone.getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
}
AllZone.getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}
this.stop();
this.resetManaCost();
payment.cancelCost();
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
}
@Override
public void showMessage() {
ButtonUtil.enableOnlyCancel();
final String displayMana = this.mana.toString().replace("X", "").trim();
CMatchUI.SINGLETON_INSTANCE.showMessage("Pay Mana Cost: " + displayMana);
final StringBuilder msg = new StringBuilder("Pay Mana Cost: " + displayMana);
if (this.phyLifeToLose > 0) {
msg.append(" (");
msg.append(this.phyLifeToLose);
msg.append(" life paid for phyrexian mana)");
}
if (this.mana.containsPhyrexianMana()) {
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
}
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
if (this.mana.isPaid()) {
this.done();
}
}
@Override
public void selectManaPool(String color) {
this.mana = activateManaAbility(color, sa, this.mana);
if (this.mana.isPaid()) {
this.done();
} else if (AllZone.getInputControl().getInput() == this) {
this.showMessage();
}
}
};
return payMana;
}
} }

View File

@@ -1,7 +1,9 @@
package forge.game; package forge.game;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Random; import java.util.Random;
@@ -24,7 +26,6 @@ import forge.GameAction;
import forge.Singletons; import forge.Singletons;
import forge.control.FControl; import forge.control.FControl;
import forge.control.input.InputMulligan; import forge.control.input.InputMulligan;
import forge.deck.Deck;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.zone.PlayerZone; import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
@@ -50,74 +51,35 @@ public class GameNew {
* Constructor for new game allowing card lists to be put into play * Constructor for new game allowing card lists to be put into play
* immediately, and life totals to be adjusted, for computer and human. * immediately, and life totals to be adjusted, for computer and human.
* *
* @param humanDeck * TODO: Accept something like match state as parameter. Match should be aware of players,
* &emsp; {@link forge.deck.Deck} object. * their decks and other special starting conditions.
* @param computerDeck
* &emsp; {@link forge.deck.Deck} object.
* @param human
* &emsp; {@link forge.CardList} object.
* @param computer
* &emsp; {@link forge.CardList} object.
* @param humanLife
* &emsp; int.
* @param computerLife
* &emsp; int.
* @param iconEnemy
* &emsp; {@link java.lang.String}
*/ */
public static void newGame(final Deck humanDeck, final Deck computerDeck, final List<Card> humanStart, public static void newGame(final PlayerStartsGame... players) {
final List<Card> computerStart, final int humanLife, final int computerLife, String iconEnemy) {
Singletons.getControl().changeState(FControl.MATCH_SCREEN); Singletons.getControl().changeState(FControl.MATCH_SCREEN);
CMatchUI.SINGLETON_INSTANCE.initMatch(iconEnemy);
GameNew.newGameCleanup(); GameNew.newGameCleanup();
GameNew.newMatchCleanup(); GameNew.newMatchCleanup();
Player human = AllZone.getHumanPlayer();
Player computer = AllZone.getComputerPlayer();
computer.setStartingLife(computerLife);
human.setStartingLife(humanLife);
human.updateObservers();
Card.resetUniqueNumber(); Card.resetUniqueNumber();
PlayerZone humanBf = human.getZone(ZoneType.Battlefield); for( PlayerStartsGame p : players ) {
if (humanStart != null) { p.getPlayer().setStartingLife(p.initialLives);
for (final Card c : humanStart) { // what if I call it for AI player?
humanBf.add(c, false); p.getPlayer().updateObservers();
c.setSickness(true); p.getPlayer().setDeck(p.getDeck());
c.setStartsGameInPlay(true); PlayerZone bf = p.getPlayer().getZone(ZoneType.Battlefield);
c.refreshUniqueNumber(); if (p.cardsOnBattlefield != null) {
for (final Card c : p.cardsOnBattlefield) {
bf.add(c, false);
c.setSickness(true);
c.setStartsGameInPlay(true);
c.refreshUniqueNumber();
}
} }
bf.updateObservers();
} }
PlayerZone aiBf = AllZone.getComputerPlayer().getZone(ZoneType.Battlefield); GameNew.actuateGame(players);
if (computerStart != null) {
for (final Card c : computerStart) {
aiBf.add(c, false);
c.setSickness(true);
c.setStartsGameInPlay(true);
c.refreshUniqueNumber();
}
}
GameNew.actuateGame(humanDeck, computerDeck);
humanBf.updateObservers();
aiBf.updateObservers();
}
/**
* The default constructor for a new game.
*
* @param humanDeck
* &emsp; {@link forge.deck.Deck} object.
* @param computerDeck
* &emsp; {@link forge.deck.Deck} object.
*/
public static void newGame(final Deck humanDeck, final Deck computerDeck) {
newGame(humanDeck, computerDeck, null, null, 20, 20, null);
} }
/** /**
@@ -127,7 +89,7 @@ public class GameNew {
* That process (also cleanup and observer updates) should be done in * That process (also cleanup and observer updates) should be done in
* newGame, then when all is ready, call this function. * newGame, then when all is ready, call this function.
*/ */
private static void actuateGame(final Deck humanDeck, final Deck computerDeck) { private static void actuateGame(final PlayerStartsGame... players) {
forge.card.trigger.Trigger.resetIDs(); forge.card.trigger.Trigger.resetIDs();
AllZone.getTriggerHandler().clearTriggerSettings(); AllZone.getTriggerHandler().clearTriggerSettings();
AllZone.getTriggerHandler().clearDelayedTrigger(); AllZone.getTriggerHandler().clearDelayedTrigger();
@@ -138,124 +100,114 @@ public class GameNew {
&& Singletons.getModel().getMatchState().getGameType().equals(GameType.Constructed); && Singletons.getModel().getMatchState().getGameType().equals(GameType.Constructed);
final Random generator = MyRandom.getRandom(); final Random generator = MyRandom.getRandom();
final ArrayList<String> hAnteRemoved = new ArrayList<String>();
final ArrayList<String> cAnteRemoved = new ArrayList<String>(); boolean useAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
final Map<Player, List<String>> removedAnteCards = new HashMap<Player, List<String>>();
final List<String> rAICards = new ArrayList<String>();
// Create Card libraries out of decks (CardPrinted)
for( PlayerStartsGame p : players )
{
PlayerZone library = p.getPlayer().getZone(ZoneType.Library);
for (final Entry<CardPrinted, Integer> stackOfCards : p.getDeck().getMain()) {
final CardPrinted cardPrinted = stackOfCards.getKey();
for (int i = 0; i < stackOfCards.getValue(); i++) {
for (final Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) { final Card card = cardPrinted.toForgeCard(p.getPlayer());
final CardPrinted cardPrinted = stackOfCards.getKey();
for (int i = 0; i < stackOfCards.getValue(); i++) { // apply random pictures for cards
if ( p.getPlayer().isComputer() ) {
final int cntVariants = cardPrinted.getCard().getEditionInfo(cardPrinted.getEdition()).getCopiesCount();
if (cntVariants > 1) {
card.setRandomPicture(generator.nextInt(cntVariants - 1) + 1);
card.setImageFilename(CardUtil.buildFilename(card));
}
}
final Card card = cardPrinted.toForgeCard(AllZone.getHumanPlayer()); // Assign random foiling on approximately 1:20 cards
if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) {
final int iFoil = MyRandom.getRandom().nextInt(9) + 1;
card.setFoil(iFoil);
}
// Assign random foiling on approximately 1:20 cards if (!useAnte && card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) { if(!removedAnteCards.containsKey(p.getPlayer()))
final int iFoil = MyRandom.getRandom().nextInt(9) + 1; removedAnteCards.put(p.getPlayer(), new ArrayList<String>());
card.setFoil(iFoil); removedAnteCards.get(p.getPlayer()).add(card.getName());
} } else {
library.add(card);
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE) }
&& card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
hAnteRemoved.add(card.getName()); // mark card as difficult for AI to play
} else { if ( p.getPlayer().isComputer() && card.getSVar("RemAIDeck").equals("True") && !rAICards.contains(card.getName())) {
AllZone.getHumanPlayer().getZone(ZoneType.Library).add(card); rAICards.add(card.getName());
// get card picture so that it is in the image cache
// ImageCache.getImage(card);
}
} }
} }
} }
final ArrayList<String> rAICards = new ArrayList<String>();
for (final Entry<CardPrinted, Integer> stackOfCards : computerDeck.getMain()) {
final CardPrinted cardPrinted = stackOfCards.getKey();
for (int i = 0; i < stackOfCards.getValue(); i++) {
final Card card = cardPrinted.toForgeCard(AllZone.getComputerPlayer());
final int cntVariants = cardPrinted.getCard().getEditionInfo(cardPrinted.getEdition()).getCopiesCount();
if (cntVariants > 1) {
card.setRandomPicture(generator.nextInt(cntVariants - 1) + 1);
card.setImageFilename(CardUtil.buildFilename(card));
}
// Assign random foiling on approximately 1:20 cards
if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) {
final int iFoil = MyRandom.getRandom().nextInt(9) + 1;
card.setFoil(iFoil);
}
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)
&& card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
cAnteRemoved.add(card.getName());
} else {
AllZone.getComputerPlayer().getZone(ZoneType.Library).add(card);
}
if (card.getSVar("RemAIDeck").equals("True") && !rAICards.contains(card.getName())) {
rAICards.add(card.getName());
// get card picture so that it is in the image cache
// ImageCache.getImage(card);
}
}
}
if (rAICards.size() > 0) { if (rAICards.size() > 0) {
final StringBuilder sb = new StringBuilder( String message = buildFourColumnList("AI deck contains the following cards that it can't play or may be buggy:", rAICards);
"AI deck contains the following cards that it can't play or may be buggy:\n"); JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < rAICards.size(); i++) { }
sb.append(rAICards.get(i));
if (((i % 4) == 0) && (i > 0)) { if (!removedAnteCards.isEmpty()) {
sb.append("\n"); StringBuilder ante = new StringBuilder("The following ante cards were removed:\n\n");
} else if (i != (rAICards.size() - 1)) { for(Entry<Player, List<String>> ants : removedAnteCards.entrySet() ) {
sb.append(", "); ante.append(buildFourColumnList( "From the " + ants.getKey().getName() + "'s deck:", ants.getValue()));
}
} }
JOptionPane.showMessageDialog(null, ante.toString(), "", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE);
} }
if (hAnteRemoved.size() > 0) {
final StringBuilder sb = new StringBuilder("The following ante cards were removed from the human's deck:\n");
for (int i = 0; i < hAnteRemoved.size(); i++) {
sb.append(hAnteRemoved.get(i));
if (((i % 4) == 0) && (i > 0)) {
sb.append("\n");
} else if (i != (hAnteRemoved.size() - 1)) {
sb.append(", ");
}
}
JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE); // It is supposed that some code to-be-written adds all players passed to this method into game here.
// So, the upcoming code already refers to AllZone.getPlayersInGame()
} // Shuffling
if (cAnteRemoved.size() > 0) {
final StringBuilder sb = new StringBuilder(
"The following ante cards were removed from the computer's deck:\n");
for (int i = 0; i < cAnteRemoved.size(); i++) {
sb.append(cAnteRemoved.get(i));
if (((i % 4) == 0) && (i > 0)) {
sb.append("\n");
} else if (i != (cAnteRemoved.size() - 1)) {
sb.append(", ");
}
}
JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE);
}
for (int i = 0; i < 100; i++) {
AllZone.getHumanPlayer().shuffle();
}
// do this instead of shuffling Computer's deck
final boolean smoothLand = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND); final boolean smoothLand = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_SMOOTH_LAND);
for( Player player : AllZone.getPlayersInGame() )
if (smoothLand) { {
final Iterable<Card> c1 = GameNew.smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(ZoneType.Library)); if ( player.isHuman() ) {
AllZone.getComputerPlayer().getZone(ZoneType.Library).setCards(c1); for (int i = 0; i < 100; i++) {
} else { AllZone.getHumanPlayer().shuffle();
// WTF? (it was so before refactor) }
AllZone.getComputerPlayer().getZone(ZoneType.Library) }
.setCards(AllZone.getComputerPlayer().getCardsIn(ZoneType.Library));
AllZone.getComputerPlayer().shuffle(); // Ai may cheat
if ( player.isComputer() ) {
if (smoothLand) {
// do this instead of shuffling Computer's deck
final Iterable<Card> c1 = GameNew.smoothComputerManaCurve(player.getCardsIn(ZoneType.Library));
player.getZone(ZoneType.Library).setCards(c1);
} else {
player.shuffle();
}
}
} }
// Deciding which cards go to ante
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
final String nl = System.getProperty("line.separator");
final StringBuilder msg = new StringBuilder();
for (final Player p : AllZone.getPlayersInGame()) {
final List<Card> lib = p.getCardsIn(ZoneType.Library);
Predicate<Card> goodForAnte = Predicates.not(CardPredicates.Presets.BASIC_LANDS);
Card ante = Aggregates.random(Iterables.filter(lib, goodForAnte));
if (ante == null) {
throw new RuntimeException(p + " library is empty.");
}
AllZone.getGameLog().add("Ante", p + " anted " + ante, 0);
VAntes.SINGLETON_INSTANCE.addAnteCard(p, ante);
Singletons.getModel().getGameAction().moveTo(ZoneType.Ante, ante);
msg.append(p.getName()).append(" ante: ").append(ante).append(nl);
}
JOptionPane.showMessageDialog(null, msg, "Ante", JOptionPane.INFORMATION_MESSAGE);
}
// Only cut/coin toss if it's the first game of the match // Only cut/coin toss if it's the first game of the match
if (Singletons.getModel().getMatchState().getGamesPlayedCount() == 0) { if (Singletons.getModel().getMatchState().getGamesPlayedCount() == 0) {
@@ -273,36 +225,32 @@ public class GameNew {
GameNew.humanPlayOrDraw("Human lost the last game."); GameNew.humanPlayOrDraw("Human lost the last game.");
} }
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
final String nl = System.getProperty("line.separator");
final StringBuilder msg = new StringBuilder();
for (final Player p : AllZone.getPlayersInGame()) {
final List<Card> lib = p.getCardsIn(ZoneType.Library);
Predicate<Card> goodForAnte = Predicates.not(CardPredicates.Presets.BASIC_LANDS);
Card ante = Aggregates.random(Iterables.filter(lib, goodForAnte));
if (ante == null ) {
if (!lib.isEmpty())
ante = lib.get(0);
else
throw new RuntimeException(p + " library is empty.");
}
AllZone.getGameLog().add("Ante", p + " anted " + ante, 0);
VAntes.SINGLETON_INSTANCE.addAnteCard(p, ante);
Singletons.getModel().getGameAction().moveTo(ZoneType.Ante, ante);
msg.append(p.getName()).append(" ante: ").append(ante).append(nl);
}
JOptionPane.showMessageDialog(null, msg, "Ante", JOptionPane.INFORMATION_MESSAGE);
}
for (int i = 0; i < 7; i++) { // Draw 7 cards
AllZone.getHumanPlayer().drawCard(); for (final Player p : AllZone.getPlayersInGame())
AllZone.getComputerPlayer().drawCard(); {
for (int i = 0; i < 7; i++) {
p.drawCard();
}
} }
CMatchUI.SINGLETON_INSTANCE.setCard(AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand).get(0)); CMatchUI.SINGLETON_INSTANCE.setCard(AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand).get(0));
AllZone.getInputControl().setInput(new InputMulligan()); AllZone.getInputControl().setInput(new InputMulligan());
} // newGame() } // newGame()
private static String buildFourColumnList(String firstLine, List<String> cAnteRemoved ) {
StringBuilder sb = new StringBuilder(firstLine);
sb.append("\n");
for (int i = 0; i < cAnteRemoved.size(); i++) {
sb.append(cAnteRemoved.get(i));
if (((i % 4) == 0) && (i > 0)) {
sb.append("\n");
} else if (i != (cAnteRemoved.size() - 1)) {
sb.append(", ");
}
}
return sb.toString();
}
private static void newGameCleanup() { private static void newGameCleanup() {
final GameState gs = Singletons.getModel().getGameState(); final GameState gs = Singletons.getModel().getGameState();

View File

@@ -0,0 +1,35 @@
package forge.game;
import java.util.List;
import forge.Card;
import forge.deck.Deck;
import forge.game.player.Player;
/**
* TODO: Write javadoc for this type.
* @param <Card>
*
*/
public class PlayerStartsGame {
private final Player player;
private final Deck deck;
public int initialLives = 20;
public List<Card> cardsOnBattlefield = null;
public PlayerStartsGame(Player who, Deck cards) {
player = who;
deck = cards;
}
public Player getPlayer() {
return player;
}
public Deck getDeck() {
return deck;
}
}

View File

@@ -26,7 +26,9 @@ import forge.Singletons;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GameType; import forge.game.GameType;
import forge.game.PlayerStartsGame;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
import forge.gui.match.CMatchUI;
/** /**
* <p> * <p>
@@ -91,8 +93,6 @@ public class GauntletMini {
public void resetCurrentRound() { public void resetCurrentRound() {
wins = 0; wins = 0;
losses = 0; losses = 0;
AllZone.getHumanPlayer().setDeck(humanDeck);
AllZone.getComputerPlayer().setDeck(aiDecks.get(0));
currentRound = 1; currentRound = 1;
} }
@@ -108,8 +108,6 @@ public class GauntletMini {
return; return;
} }
AllZone.getHumanPlayer().setDeck(humanDeck);
AllZone.getComputerPlayer().setDeck(aiDecks.get(currentRound));
currentRound += 1; currentRound += 1;
} }
@@ -160,11 +158,10 @@ public class GauntletMini {
@Override @Override
public Object doInBackground() { public Object doInBackground() {
CMatchUI.SINGLETON_INSTANCE.initMatch(null);
Singletons.getModel().getMatchState().setGameType(gauntletType); Singletons.getModel().getMatchState().setGameType(gauntletType);
GameNew.newGame( new PlayerStartsGame(AllZone.getHumanPlayer(), humanDeck),
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck()); new PlayerStartsGame(AllZone.getComputerPlayer(), aiDecks.get(currentRound)));
return null; return null;
} }

View File

@@ -113,7 +113,7 @@ public class Untap extends Phase implements java.io.Serializable {
private static void doUntap() { private static void doUntap() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Predicate<Card> tappedCanUntap = Predicates.and(Presets.TAPPED, Presets.CANUNTAP); final Predicate<Card> tappedCanUntap = Predicates.and(Presets.TAPPED, Presets.CANUNTAP);
List<Card> list = player.getCardsIn(ZoneType.Battlefield); List<Card> list = player.getCardsIn(ZoneType.Battlefield);
for (final Card c : list) { for (final Card c : list) {
@@ -198,10 +198,9 @@ public class Untap extends Phase implements java.io.Serializable {
} }
if (Untap.canOnlyUntapOneLand()) { if (Untap.canOnlyUntapOneLand()) {
if (player.isComputer()) {
if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) {
// search for lands the computer has and only untap 1 // search for lands the computer has and only untap 1
List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer()); List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(player);
landList = CardListUtil.filter(landList, tappedCanUntap); landList = CardListUtil.filter(landList, tappedCanUntap);
if (landList.size() > 0) { if (landList.size() > 0) {
@@ -230,7 +229,7 @@ public class Untap extends Phase implements java.io.Serializable {
} }
} // selectCard() } // selectCard()
}; // Input }; // Input
List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()); List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(player);
landList = CardListUtil.filter(landList, tappedCanUntap); landList = CardListUtil.filter(landList, tappedCanUntap);
if (landList.size() > 0) { if (landList.size() > 0) {
AllZone.getInputControl().setInput(target); AllZone.getInputControl().setInput(target);
@@ -278,8 +277,8 @@ public class Untap extends Phase implements java.io.Serializable {
} }
} }
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) { if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) { if (player.isComputer()) {
List<Card> creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); List<Card> creatures = AllZoneUtil.getCreaturesInPlay(player);
creatures = CardListUtil.filter(creatures, tappedCanUntap); creatures = CardListUtil.filter(creatures, tappedCanUntap);
if (creatures.size() > 0) { if (creatures.size() > 0) {
creatures.get(0).untap(); creatures.get(0).untap();
@@ -308,7 +307,7 @@ public class Untap extends Phase implements java.io.Serializable {
} }
} // selectCard() } // selectCard()
}; // Input }; // Input
List<Card> creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); List<Card> creatures = AllZoneUtil.getCreaturesInPlay(player);
creatures = CardListUtil.filter(creatures, tappedCanUntap); creatures = CardListUtil.filter(creatures, tappedCanUntap);
if (creatures.size() > 0) { if (creatures.size() > 0) {
AllZone.getInputControl().setInput(target); AllZone.getInputControl().setInput(target);

View File

@@ -131,14 +131,14 @@ public class HumanPlayer extends Player {
if (o.equals("Yes")) { if (o.equals("Yes")) {
final Card c = GuiChoose.one("Select card to dredge", this.getDredge()); final Card c = GuiChoose.one("Select card to dredge", this.getDredge());
// rule 702.49a // rule 702.49a
if (this.getDredgeNumber(c) <= AllZone.getHumanPlayer().getZone(ZoneType.Library).size()) { if (this.getDredgeNumber(c) <= getZone(ZoneType.Library).size()) {
// might have to make this more sophisticated // might have to make this more sophisticated
// dredge library, put card in hand // dredge library, put card in hand
Singletons.getModel().getGameAction().moveToHand(c); Singletons.getModel().getGameAction().moveToHand(c);
for (int i = 0; i < this.getDredgeNumber(c); i++) { for (int i = 0; i < this.getDredgeNumber(c); i++) {
final Card c2 = AllZone.getHumanPlayer().getZone(ZoneType.Library).get(0); final Card c2 = getZone(ZoneType.Library).get(0);
Singletons.getModel().getGameAction().moveToGraveyard(c2); Singletons.getModel().getGameAction().moveToGraveyard(c2);
} }
dredged = true; dredged = true;

View File

@@ -211,7 +211,7 @@ public final class PlayerUtil {
private void done() { private void done() {
this.stop(); this.stop();
// hack to not trigger Chains of Mephistopheles recursively // hack to not trigger Chains of Mephistopheles recursively
AllZone.getHumanPlayer().drawCards(1, true); Singletons.getControl().getPlayer().drawCards(1, true);
} }
}; };
return target; return target;

View File

@@ -673,7 +673,7 @@ public class MagicStack extends MyObservable {
} }
}; };
if (sp.getSourceCard().getController().equals(AllZone.getHumanPlayer())) { if (sp.getSourceCard().getController().isHuman()) {
final ManaCost manaCost = this.getMultiKickerSpellCostChange(ability); final ManaCost manaCost = this.getMultiKickerSpellCostChange(ability);
if (manaCost.isPaid()) { if (manaCost.isPaid()) {

View File

@@ -103,8 +103,9 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
final String[] k = keyword.split(":"); final String[] k = keyword.split(":");
addMax = Integer.valueOf(k[2]); addMax = Integer.valueOf(k[2]);
if (k[1].equals("Each")) { if (k[1].equals("Each")) {
AllZone.getHumanPlayer().addMaxLandsToPlay(addMax); for( Player p : AllZone.getPlayersInGame() ){
AllZone.getComputerPlayer().addMaxLandsToPlay(addMax); p.addMaxLandsToPlay(addMax);
}
} else { } else {
c.getController().addMaxLandsToPlay(addMax); c.getController().addMaxLandsToPlay(addMax);
} }

View File

@@ -169,7 +169,6 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
*/ */
private Deck getPlayersDeck() { private Deck getPlayersDeck() {
final Deck deck = new Deck(); final Deck deck = new 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());

View File

@@ -221,8 +221,7 @@ 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 = AllZone.getHumanPlayer().getDeck() == null ? null : this.questData.getMyDecks().get( Deck deck = null;
AllZone.getHumanPlayer().getDeck().getName());
if (deck == null) { if (deck == null) {
deck = new Deck(); deck = new Deck();

View File

@@ -4,9 +4,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
@@ -162,23 +159,21 @@ public enum CFilters implements ICDoc {
public <TItem extends InventoryItem, TModel extends DeckBase> void buildFilter() { public <TItem extends InventoryItem, TModel extends DeckBase> void buildFilter() {
// The main trick here is to apply a CardPrinted predicate // The main trick here is to apply a CardPrinted predicate
// to the table. CardRules will lead to difficulties. // to the table. CardRules will lead to difficulties.
final List<Predicate<? super CardPrinted>> lstFilters = new ArrayList<Predicate<? super CardPrinted>>();
final ACEditorBase<TItem, TModel> ed = (ACEditorBase<TItem, TModel>) final ACEditorBase<TItem, TModel> ed = (ACEditorBase<TItem, TModel>)
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
lstFilters.add(Predicates.instanceOf(CardPrinted.class)); Predicate<? super CardPrinted> classFilter = Predicates.instanceOf(CardPrinted.class);
lstFilters.add(SFilterUtil.buildColorFilter()); Predicate<CardPrinted> color = SFilterUtil.buildColorFilter();
lstFilters.add(SFilterUtil.buildTypeFilter()); Predicate<CardPrinted> type = SFilterUtil.buildTypeFilter();
lstFilters.add(SFilterUtil.buildSetAndFormatFilter()); Predicate<CardPrinted> set = SFilterUtil.buildSetAndFormatFilter();
lstFilters.add(SFilterUtil.buildTextFilter()); Predicate<CardPrinted> text = SFilterUtil.buildTextFilter();
lstFilters.add(SFilterUtil.buildIntervalFilter()); Predicate<CardPrinted> interval = SFilterUtil.buildIntervalFilter();
// Until this is filterable, always show packs and decks in the card shop. // Until this is filterable, always show packs and decks in the card shop.
com.google.common.base.Predicate<? super CardPrinted> itemFilter = Predicates.and(lstFilters); Predicate<? super CardPrinted> cardFilter = Predicates.and(classFilter, color, type, set, text, interval);
itemFilter = Predicates.or(itemFilter, ItemPredicate.Presets.IS_PACK); Predicate<? super CardPrinted> itemFilter = Predicates.or(cardFilter, ItemPredicate.Presets.IS_PACK, ItemPredicate.Presets.IS_DECK);
itemFilter = Predicates.or(itemFilter, ItemPredicate.Presets.IS_DECK);
// Apply to table // Apply to table
ed.getTableCatalog().setFilter((Predicate<TItem>) itemFilter); ed.getTableCatalog().setFilter((Predicate<TItem>) itemFilter);

View File

@@ -18,9 +18,11 @@ import forge.control.FControl;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GameType; import forge.game.GameType;
import forge.game.PlayerStartsGame;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
import forge.gui.deckeditor.CDeckEditorUI; import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.controllers.CEditorQuestCardShop; import forge.gui.deckeditor.controllers.CEditorQuestCardShop;
import forge.gui.match.CMatchUI;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FPanel; import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
@@ -231,8 +233,6 @@ 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() {
AllZone.getHumanPlayer().setDeck(SSubmenuQuestUtil.getCurrentDeck());
AllZone.getComputerPlayer().setDeck(event.getEventDeck());
Singletons.getModel().getMatchState().setGameType(GameType.Quest); Singletons.getModel().getMatchState().setGameType(GameType.Quest);
qData.getChallengesManager().randomizeOpponents(); qData.getChallengesManager().randomizeOpponents();
@@ -240,9 +240,12 @@ public class SSubmenuQuestUtil {
qData.setCurrentEvent(event); qData.setCurrentEvent(event);
qData.save(); qData.save();
PlayerStartsGame p1 = new PlayerStartsGame(AllZone.getHumanPlayer(), SSubmenuQuestUtil.getCurrentDeck());
PlayerStartsGame p2 = new PlayerStartsGame(AllZone.getComputerPlayer(), event.getEventDeck());
if (qData.getMode() == QuestMode.Fantasy) { if (qData.getMode() == QuestMode.Fantasy) {
int lifeAI = 20; int lifeAI = 20;
int baseLifeHuman = qData.getAssets().getLife(qData.getMode());
int extraLifeHuman = 0; int extraLifeHuman = 0;
if (selectedOpponent.getEvent() instanceof QuestEventChallenge) { if (selectedOpponent.getEvent() instanceof QuestEventChallenge) {
@@ -253,18 +256,14 @@ public class SSubmenuQuestUtil {
} }
} }
GameNew.newGame( p1.initialLives = qData.getAssets().getLife(qData.getMode()) + extraLifeHuman;
AllZone.getHumanPlayer().getDeck(), p1.cardsOnBattlefield = QuestUtil.getHumanStartingCards(qData, event);
AllZone.getComputerPlayer().getDeck(), p2.initialLives = lifeAI;
QuestUtil.getHumanStartingCards(qData, event), p2.cardsOnBattlefield = QuestUtil.getComputerStartingCards(event);
QuestUtil.getComputerStartingCards(event),
baseLifeHuman + extraLifeHuman,
lifeAI,
event.getIconFilename());
} // End isFantasy } // End isFantasy
else {
GameNew.newGame(SSubmenuQuestUtil.getCurrentDeck(), event.getEventDeck()); CMatchUI.SINGLETON_INSTANCE.initMatch(event.getIconFilename());
} GameNew.newGame(p1, p2);
return null; return null;
} }

View File

@@ -33,9 +33,11 @@ import forge.deck.generate.Generate5ColorDeck;
import forge.deck.generate.GenerateThemeDeck; import forge.deck.generate.GenerateThemeDeck;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GameType; import forge.game.GameType;
import forge.game.PlayerStartsGame;
import forge.game.player.PlayerType; import forge.game.player.PlayerType;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
import forge.gui.framework.ICDoc; import forge.gui.framework.ICDoc;
import forge.gui.match.CMatchUI;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.item.CardPrinted; import forge.item.CardPrinted;
import forge.item.ItemPoolView; import forge.item.ItemPoolView;
@@ -343,15 +345,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() {
AllZone.getHumanPlayer().setDeck( Deck humanDeck = generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstHumanDecks(), PlayerType.HUMAN);
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstHumanDecks(), PlayerType.HUMAN)); Deck aiDeck = generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstAIDecks(), PlayerType.COMPUTER);
AllZone.getComputerPlayer().setDeck(
generateDeck(VSubmenuConstructed.SINGLETON_INSTANCE.getLstAIDecks(), PlayerType.COMPUTER));
CMatchUI.SINGLETON_INSTANCE.initMatch(null);
Singletons.getModel().getMatchState().setGameType(GameType.Constructed); Singletons.getModel().getMatchState().setGameType(GameType.Constructed);
if (AllZone.getHumanPlayer().getDeck() != null && AllZone.getComputerPlayer().getDeck() != null) { if (humanDeck != null && aiDeck != null) {
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck()); GameNew.newGame( new PlayerStartsGame(AllZone.getHumanPlayer(), humanDeck),
new PlayerStartsGame(AllZone.getComputerPlayer(), aiDeck) );
} }
return null; return null;
} }

View File

@@ -18,6 +18,7 @@ import forge.deck.Deck;
import forge.deck.DeckGroup; import forge.deck.DeckGroup;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GameType; import forge.game.GameType;
import forge.game.PlayerStartsGame;
import forge.game.limited.BoosterDraft; import forge.game.limited.BoosterDraft;
import forge.game.limited.CardPoolLimitation; import forge.game.limited.CardPoolLimitation;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
@@ -25,6 +26,7 @@ import forge.gui.SOverlayUtils;
import forge.gui.deckeditor.CDeckEditorUI; import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.controllers.CEditorDraftingProcess; import forge.gui.deckeditor.controllers.CEditorDraftingProcess;
import forge.gui.framework.ICDoc; import forge.gui.framework.ICDoc;
import forge.gui.match.CMatchUI;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
/** /**
@@ -201,15 +203,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());
AllZone.getHumanPlayer().setDeck(human); Deck aiDeck = opponentDecks.getAiDecks().get(aiIndex);
AllZone.getComputerPlayer().setDeck(opponentDecks.getAiDecks().get(aiIndex)); //zero is human deck, so it must be +1 if (aiDeck == null) {
if (AllZone.getComputerPlayer().getDeck() == null) {
throw new IllegalStateException("Draft: Computer deck is null!"); throw new IllegalStateException("Draft: Computer deck is null!");
} }
CMatchUI.SINGLETON_INSTANCE.initMatch(null);
Singletons.getModel().getMatchState().setGameType(GameType.Draft); Singletons.getModel().getMatchState().setGameType(GameType.Draft);
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck()); GameNew.newGame( new PlayerStartsGame(AllZone.getHumanPlayer(), human),
new PlayerStartsGame(AllZone.getComputerPlayer(), aiDeck) );
return null; return null;
} }

View File

@@ -14,6 +14,7 @@ import forge.control.FControl;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GameType; import forge.game.GameType;
import forge.game.PlayerStartsGame;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
@@ -119,11 +120,13 @@ public class ControlWinLose {
CardPrinted toRemove = CardDb.instance().getCard(c); CardPrinted toRemove = CardDb.instance().getCard(c);
hDeck.getMain().remove(toRemove); hDeck.getMain().remove(toRemove);
} }
AllZone.getHumanPlayer().setDeck(hDeck);
} }
} }
Singletons.getModel().savePrefs(); Singletons.getModel().savePrefs();
GameNew.newGame(hDeck, cDeck); CMatchUI.SINGLETON_INSTANCE.initMatch(null);
GameNew.newGame( new PlayerStartsGame(AllZone.getHumanPlayer(), hDeck),
new PlayerStartsGame(AllZone.getComputerPlayer(), cDeck));
} }
/** /**

View File

@@ -31,6 +31,7 @@ import forge.game.GameLossReason;
import forge.game.GameNew; import forge.game.GameNew;
import forge.game.GamePlayerRating; import forge.game.GamePlayerRating;
import forge.game.GameSummary; import forge.game.GameSummary;
import forge.game.PlayerStartsGame;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
@@ -127,17 +128,17 @@ public class QuestWinLoseHandler extends ControlWinLose {
} }
} }
final List<Card> humanList = QuestUtil.getHumanStartingCards(qData, qEvent); CMatchUI.SINGLETON_INSTANCE.initMatch(qEvent.getIconFilename());
final List<Card> computerList = QuestUtil.getComputerStartingCards(qEvent);
PlayerStartsGame p1 = new PlayerStartsGame(AllZone.getHumanPlayer(),AllZone.getHumanPlayer().getDeck() );
final int humanLife = qa.getLife(qData.getMode()) + extraLife; p1.cardsOnBattlefield = QuestUtil.getHumanStartingCards(qData, qEvent);
int computerLife = 20; p1.initialLives = qa.getLife(qData.getMode()) + extraLife;
if (qEvent instanceof QuestEventChallenge) {
computerLife = ((QuestEventChallenge) qEvent).getAILife(); PlayerStartsGame p2 = new PlayerStartsGame(AllZone.getComputerPlayer(), AllZone.getComputerPlayer().getDeck());
} p2.cardsOnBattlefield = QuestUtil.getComputerStartingCards(qEvent);
p2.initialLives = qEvent instanceof QuestEventChallenge ? ((QuestEventChallenge) qEvent).getAILife() : 20;
GameNew.newGame(AllZone.getHumanPlayer().getDeck(), AllZone.getComputerPlayer().getDeck(),
humanList, computerList, humanLife, computerLife, qEvent.getIconFilename()); GameNew.newGame( p1, p2 );
} else { } else {
super.startNextRound(); super.startNextRound();
} }

View File

@@ -144,7 +144,7 @@ public enum CDock implements ICDoc {
public void alphaStrike() { public void alphaStrike() {
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler(); final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final Player human = AllZone.getHumanPlayer(); final Player human = Singletons.getControl().getPlayer();
if (ph.is(PhaseType.COMBAT_DECLARE_ATTACKERS, human)) { if (ph.is(PhaseType.COMBAT_DECLARE_ATTACKERS, human)) {
for (Card c : CardListUtil.filter(human.getCardsIn(ZoneType.Battlefield), Presets.CREATURES)) { for (Card c : CardListUtil.filter(human.getCardsIn(ZoneType.Battlefield), Presets.CREATURES)) {

View File

@@ -471,7 +471,7 @@ public class CField implements ICDoc {
CombatUtil.showCombat(); CombatUtil.showCombat();
} }
else if (input instanceof InputPaySacCost) { else if (input instanceof InputPaySacCost) {
((InputPaySacCost) input).unselectCard(c, AllZone.getHumanPlayer().getZone(ZoneType.Battlefield)); ((InputPaySacCost) input).unselectCard(c, Singletons.getControl().getPlayer().getZone(ZoneType.Battlefield));
} }
} else { } else {
//Yosei, the Morning Star required cards to be chosen on computer side //Yosei, the Morning Star required cards to be chosen on computer side
@@ -482,7 +482,7 @@ public class CField implements ICDoc {
input.selectCard(c, c.getController().getZone(ZoneType.Battlefield)); input.selectCard(c, c.getController().getZone(ZoneType.Battlefield));
} else { } else {
//in weird case card has no controller revert to default behaviour //in weird case card has no controller revert to default behaviour
input.selectCard(c, AllZone.getHumanPlayer().getZone(ZoneType.Battlefield)); input.selectCard(c, Singletons.getControl().getPlayer().getZone(ZoneType.Battlefield));
} }
} }
} }

View File

@@ -186,7 +186,7 @@ public class CHand implements ICDoc {
} }
final Card c = view.getHandArea().getCardFromMouseOverPanel(); final Card c = view.getHandArea().getCardFromMouseOverPanel();
if (c != null) { if (c != null) {
CMessage.SINGLETON_INSTANCE.getInputControl().selectCard(c, AllZone.getHumanPlayer().getZone(ZoneType.Hand)); CMessage.SINGLETON_INSTANCE.getInputControl().selectCard(c, Singletons.getControl().getPlayer().getZone(ZoneType.Hand));
VMatchUI.SINGLETON_INSTANCE.getBtnOK().requestFocusInWindow(); VMatchUI.SINGLETON_INSTANCE.getBtnOK().requestFocusInWindow();
} }
} }

View File

@@ -424,7 +424,6 @@ 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:
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);

View File

@@ -32,10 +32,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
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 com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.Card; import forge.Card;
import forge.Singletons;
import forge.card.CardInSet; import forge.card.CardInSet;
import forge.card.CardRules; import forge.card.CardRules;
import forge.card.MtgDataParser; import forge.card.MtgDataParser;

View File

@@ -20,8 +20,6 @@ package forge.quest;
import forge.Singletons; import forge.Singletons;
import forge.card.BoosterGenerator; import forge.card.BoosterGenerator;
import forge.card.CardEdition; import forge.card.CardEdition;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
import forge.card.FormatCollection; import forge.card.FormatCollection;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameFormatQuest; import forge.game.GameFormatQuest;