revert previous change - because game won't start with it

This commit is contained in:
Maxmtg
2013-03-30 18:12:34 +00:00
parent cf3db753c4
commit 750226b60f

View File

@@ -19,10 +19,12 @@ package forge.control.input;
import forge.Card;
import forge.FThreads;
import forge.Singletons;
import forge.game.GameState;
import forge.game.player.Player;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.match.CMatchUI;
import forge.view.ButtonUtil;
/**
@@ -37,8 +39,6 @@ public class InputCleanup extends InputBase {
/** Constant <code>serialVersionUID=-4164275418971547948L</code>. */
private static final long serialVersionUID = -4164275418971547948L;
private final GameState game;
final Player activePlayer;
final Player turnOwner;
/**
* TODO: Write javadoc for Constructor.
@@ -47,20 +47,19 @@ public class InputCleanup extends InputBase {
public InputCleanup(GameState game) {
super();
this.game = game;
activePlayer = game.getPhaseHandler().getPriorityPlayer();
turnOwner = game.getPhaseHandler().getPlayerTurn();
}
/** {@inheritDoc} */
@Override
public final void showMessage() {
final Player active = game.getPhaseHandler().getPriorityPlayer();
final Player turnOwner = game.getPhaseHandler().getPlayerTurn();
final int n = activePlayer.getCardsIn(ZoneType.Hand).size();
final int max = activePlayer.getMaxHandSize();
final int n = active.getCardsIn(ZoneType.Hand).size();
final int max = active.getMaxHandSize();
// goes to the next phase
if (activePlayer.isUnlimitedHandSize() || n <= max || n <= 0 || activePlayer != turnOwner) {
activePlayer.getController().passPriority();
if (active.isUnlimitedHandSize() || n <= max || n <= 0 || active != turnOwner) {
active.getController().passPriority();
return;
}
ButtonUtil.disableAll();
@@ -70,20 +69,20 @@ public class InputCleanup extends InputBase {
final StringBuffer sb = new StringBuffer();
sb.append("Cleanup Phase: You can only have a maximum of ").append(max);
sb.append(" cards, you currently have ").append(n).append(" cards in your hand - select a card to discard");
showMessage(sb.toString());
CMatchUI.SINGLETON_INSTANCE.showMessage(sb.toString());
}
/** {@inheritDoc} */
@Override
public final void selectCard(final Card card) {
Zone zone = game.getZoneOf(card);
if (!zone.is(ZoneType.Hand, turnOwner))
if (!zone.is(ZoneType.Hand, Singletons.getControl().getPlayer()))
return;
FThreads.invokeInNewThread(new Runnable() {
@Override
public void run() {
turnOwner.discard(card, null);
card.getController().discard(card, null);
}
}, true);
}