mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
removed global references in 2 files
This commit is contained in:
@@ -19,12 +19,10 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +37,8 @@ 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,19 +47,20 @@ 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 max = active.getMaxHandSize();
|
final int n = activePlayer.getCardsIn(ZoneType.Hand).size();
|
||||||
|
final int max = activePlayer.getMaxHandSize();
|
||||||
// goes to the next phase
|
// goes to the next phase
|
||||||
if (active.isUnlimitedHandSize() || n <= max || n <= 0 || active != turnOwner) {
|
if (activePlayer.isUnlimitedHandSize() || n <= max || n <= 0 || activePlayer != turnOwner) {
|
||||||
active.getController().passPriority();
|
activePlayer.getController().passPriority();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ButtonUtil.disableAll();
|
ButtonUtil.disableAll();
|
||||||
@@ -69,20 +70,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");
|
||||||
CMatchUI.SINGLETON_INSTANCE.showMessage(sb.toString());
|
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, Singletons.getControl().getPlayer()))
|
if (!zone.is(ZoneType.Hand, turnOwner))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FThreads.invokeInNewThread(new Runnable() {
|
FThreads.invokeInNewThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
card.getController().discard(card, null);
|
turnOwner.discard(card, null);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import forge.Card;
|
|||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Singletons;
|
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.card.ability.ApiType;
|
import forge.card.ability.ApiType;
|
||||||
import forge.card.mana.ManaCostBeingPaid;
|
import forge.card.mana.ManaCostBeingPaid;
|
||||||
@@ -116,7 +115,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
|||||||
* @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
|
||||||
*/
|
*/
|
||||||
protected void useManaFromPool(String color, ManaCostBeingPaid manaCost) {
|
protected void useManaFromPool(String color, ManaCostBeingPaid manaCost) {
|
||||||
ManaPool mp = Singletons.getControl().getPlayer().getManaPool();
|
ManaPool mp = whoPays.getManaPool();
|
||||||
|
|
||||||
// Convert Color to short String
|
// Convert Color to short String
|
||||||
String manaStr = "1";
|
String manaStr = "1";
|
||||||
|
|||||||
Reference in New Issue
Block a user