mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
revert previous change - because game won't start with it
This commit is contained in:
@@ -19,10 +19,12 @@ package forge.control.input;
|
|||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,8 +39,6 @@ public class InputCleanup extends InputBase {
|
|||||||
/** Constant <code>serialVersionUID=-4164275418971547948L</code>. */
|
/** Constant <code>serialVersionUID=-4164275418971547948L</code>. */
|
||||||
private static final long serialVersionUID = -4164275418971547948L;
|
private static final long serialVersionUID = -4164275418971547948L;
|
||||||
private final GameState game;
|
private final GameState game;
|
||||||
final Player activePlayer;
|
|
||||||
final Player turnOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for Constructor.
|
* TODO: Write javadoc for Constructor.
|
||||||
@@ -47,20 +47,19 @@ public class InputCleanup extends InputBase {
|
|||||||
public InputCleanup(GameState game) {
|
public InputCleanup(GameState game) {
|
||||||
super();
|
super();
|
||||||
this.game = game;
|
this.game = game;
|
||||||
activePlayer = game.getPhaseHandler().getPriorityPlayer();
|
|
||||||
turnOwner = game.getPhaseHandler().getPlayerTurn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void showMessage() {
|
public final void showMessage() {
|
||||||
|
final Player active = game.getPhaseHandler().getPriorityPlayer();
|
||||||
|
final Player turnOwner = game.getPhaseHandler().getPlayerTurn();
|
||||||
|
|
||||||
|
final int n = active.getCardsIn(ZoneType.Hand).size();
|
||||||
final int n = activePlayer.getCardsIn(ZoneType.Hand).size();
|
final int max = active.getMaxHandSize();
|
||||||
final int max = activePlayer.getMaxHandSize();
|
|
||||||
// goes to the next phase
|
// goes to the next phase
|
||||||
if (activePlayer.isUnlimitedHandSize() || n <= max || n <= 0 || activePlayer != turnOwner) {
|
if (active.isUnlimitedHandSize() || n <= max || n <= 0 || active != turnOwner) {
|
||||||
activePlayer.getController().passPriority();
|
active.getController().passPriority();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
@@ -70,20 +69,20 @@ public class InputCleanup extends InputBase {
|
|||||||
final StringBuffer sb = new StringBuffer();
|
final StringBuffer sb = new StringBuffer();
|
||||||
sb.append("Cleanup Phase: You can only have a maximum of ").append(max);
|
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");
|
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} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void selectCard(final Card card) {
|
public final void selectCard(final Card card) {
|
||||||
Zone zone = game.getZoneOf(card);
|
Zone zone = game.getZoneOf(card);
|
||||||
if (!zone.is(ZoneType.Hand, turnOwner))
|
if (!zone.is(ZoneType.Hand, Singletons.getControl().getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FThreads.invokeInNewThread(new Runnable() {
|
FThreads.invokeInNewThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
turnOwner.discard(card, null);
|
card.getController().discard(card, null);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user