diff --git a/src/main/java/forge/gui/input/Input.java b/src/main/java/forge/gui/input/Input.java
index d4b95654843..a6004e11a6f 100644
--- a/src/main/java/forge/gui/input/Input.java
+++ b/src/main/java/forge/gui/input/Input.java
@@ -78,7 +78,7 @@ public abstract class Input implements java.io.Serializable {
* stop.
*
*/
- final public void stop() {
+ public final void stop() {
// clears a "temp" Input like Input_PayManaCost if there is one
AllZone.getInputControl().resetInput();
@@ -98,8 +98,8 @@ public abstract class Input implements java.io.Serializable {
* @param in
* a {@link forge.gui.input.Input} object.
*/
- final public void stopSetNext(Input in) {
- stop();
+ public final void stopSetNext(final Input in) {
+ this.stop();
AllZone.getInputControl().setInput(in);
}
@@ -107,7 +107,7 @@ public abstract class Input implements java.io.Serializable {
@Override
public String toString() {
return "blank";
- }// returns the Input name like "EmptyStack"
+ } // returns the Input name like "EmptyStack"
/**
*
@@ -117,7 +117,7 @@ public abstract class Input implements java.io.Serializable {
* @param isFree
* a boolean.
*/
- public void setFree(boolean isFree) {
+ public void setFree(final boolean isFree) {
this.isFree = isFree;
}
@@ -129,6 +129,6 @@ public abstract class Input implements java.io.Serializable {
* @return a boolean.
*/
public boolean isFree() {
- return isFree;
+ return this.isFree;
}
}
diff --git a/src/main/java/forge/gui/input/InputControl.java b/src/main/java/forge/gui/input/InputControl.java
index d7de1c2af6d..3f45fedda74 100644
--- a/src/main/java/forge/gui/input/InputControl.java
+++ b/src/main/java/forge/gui/input/InputControl.java
@@ -25,10 +25,10 @@ public class InputControl extends MyObservable implements java.io.Serializable {
private Input input;
/** Constant n=0. */
- static int n = 0;
- private Stack inputStack = new Stack();
- private Stack resolvingStack = new Stack();
- private LinkedList resolvingQueue = new LinkedList();
+ private static int n = 0;
+ private final Stack inputStack = new Stack();
+ private final Stack resolvingStack = new Stack();
+ private final LinkedList resolvingQueue = new LinkedList();
private final FModel model;
private ComputerAI_Input aiInput; // initialized at runtime to be the latest
@@ -41,7 +41,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* the f model
*/
public InputControl(final FModel fModel) {
- model = fModel;
+ this.model = fModel;
}
/**
@@ -53,12 +53,13 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* a {@link forge.gui.input.Input} object.
*/
public final void setInput(final Input in) {
- if (model.getGameState().getStack().getResolving() || !(input == null || input instanceof Input_PassPriority)) {
- inputStack.add(in);
+ if (this.model.getGameState().getStack().getResolving()
+ || !((this.input == null) || (this.input instanceof Input_PassPriority))) {
+ this.inputStack.add(in);
} else {
- input = in;
+ this.input = in;
}
- updateObservers();
+ this.updateObservers();
}
/**
@@ -74,13 +75,13 @@ public class InputControl extends MyObservable implements java.io.Serializable {
public final void setInput(final Input in, final boolean bAddToResolving) {
// Make this
if (!bAddToResolving) {
- setInput(in);
+ this.setInput(in);
return;
}
- Input old = input;
- resolvingStack.add(old);
- changeInput(in);
+ final Input old = this.input;
+ this.resolvingStack.add(old);
+ this.changeInput(in);
}
/**
@@ -92,8 +93,8 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* a {@link forge.gui.input.Input} object.
*/
private void changeInput(final Input in) {
- input = in;
- updateObservers();
+ this.input = in;
+ this.updateObservers();
}
/**
@@ -104,7 +105,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* @return a {@link forge.gui.input.Input} object.
*/
public final Input getInput() {
- return input;
+ return this.input;
}
/**
@@ -113,9 +114,9 @@ public class InputControl extends MyObservable implements java.io.Serializable {
*
*/
public final void clearInput() {
- input = null;
- resolvingQueue.clear();
- inputStack.clear();
+ this.input = null;
+ this.resolvingQueue.clear();
+ this.inputStack.clear();
}
/**
@@ -124,8 +125,8 @@ public class InputControl extends MyObservable implements java.io.Serializable {
*
*/
public final void resetInput() {
- input = null;
- updateObservers();
+ this.input = null;
+ this.updateObservers();
}
/**
@@ -137,9 +138,9 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* a boolean.
*/
public final void resetInput(final boolean update) {
- input = null;
+ this.input = null;
if (update) {
- updateObservers();
+ this.updateObservers();
}
}
@@ -151,62 +152,62 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* @return a {@link forge.gui.input.Input} object.
*/
public final Input updateInput() {
- final String phase = model.getGameState().getPhase().getPhase();
- final Player playerTurn = model.getGameState().getPhase().getPlayerTurn();
- final Player priority = model.getGameState().getPhase().getPriorityPlayer();
+ final String phase = this.model.getGameState().getPhase().getPhase();
+ final Player playerTurn = this.model.getGameState().getPhase().getPlayerTurn();
+ final Player priority = this.model.getGameState().getPhase().getPriorityPlayer();
// TODO this resolving portion needs more work, but fixes Death Cloud
// issues
- if (resolvingStack.size() > 0) {
- if (input != null) {
- return input;
+ if (this.resolvingStack.size() > 0) {
+ if (this.input != null) {
+ return this.input;
}
// if an SA is resolving, only change input for something that is
// part of the resolving SA
- changeInput(resolvingStack.pop());
- return input;
+ this.changeInput(this.resolvingStack.pop());
+ return this.input;
}
- if (model.getGameState().getStack().getResolving()) {
+ if (this.model.getGameState().getStack().getResolving()) {
return null;
}
- if (input != null) {
- return input;
- } else if (inputStack.size() > 0) { // incoming input to Control
- changeInput(inputStack.pop());
- return input;
+ if (this.input != null) {
+ return this.input;
+ } else if (this.inputStack.size() > 0) { // incoming input to Control
+ this.changeInput(this.inputStack.pop());
+ return this.input;
}
- if (Phase.getGameBegins() != 0 && model.getGameState().getPhase().doPhaseEffects()) {
+ if ((Phase.getGameBegins() != 0) && this.model.getGameState().getPhase().doPhaseEffects()) {
// Handle begin phase stuff, then start back from the top
- model.getGameState().getPhase().handleBeginPhase();
- return updateInput();
+ this.model.getGameState().getPhase().handleBeginPhase();
+ return this.updateInput();
}
// If the Phase we're in doesn't allow for Priority, return null to move
// to next phase
- if (model.getGameState().getPhase().isNeedToNextPhase()) {
+ if (this.model.getGameState().getPhase().isNeedToNextPhase()) {
return null;
}
// Special Inputs needed for the following phases:
if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
- model.getGameState().getStack().freezeStack();
+ this.model.getGameState().getStack().freezeStack();
if (playerTurn.isHuman()) {
return new Input_Attack();
}
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
- model.getGameState().getStack().freezeStack();
+ this.model.getGameState().getStack().freezeStack();
if (playerTurn.isHuman()) {
- aiInput.getComputer().declareBlockers();
+ this.aiInput.getComputer().declareBlockers();
return null;
} else {
- if (model.getGameState().getCombat().getAttackers().length == 0) {
+ if (this.model.getGameState().getCombat().getAttackers().length == 0) {
// no active attackers, skip the Blocking phase
- model.getGameState().getPhase().setNeedToNextPhase(true);
+ this.model.getGameState().getPhase().setNeedToNextPhase(true);
return null;
} else {
return new Input_Block();
@@ -214,9 +215,9 @@ public class InputControl extends MyObservable implements java.io.Serializable {
}
} else if (phase.equals(Constant.Phase.CLEANUP)) {
// discard
- if (model.getGameState().getStack().size() == 0) {
+ if (this.model.getGameState().getStack().size() == 0) {
// resolve things
- // like Madness
+ // like Madness
return new Input_Cleanup();
}
}
@@ -226,22 +227,22 @@ public class InputControl extends MyObservable implements java.io.Serializable {
// priority
if (priority.isHuman()) {
- boolean skip = model.getGameState().getPhase().doSkipPhase();
- model.getGameState().getPhase().setSkipPhase(false);
- if (model.getGameState().getStack().size() == 0
+ final boolean skip = this.model.getGameState().getPhase().doSkipPhase();
+ this.model.getGameState().getPhase().setSkipPhase(false);
+ if ((this.model.getGameState().getStack().size() == 0)
&& !forge.AllZone.getDisplay().stopAtPhase(playerTurn, phase) && skip) {
- model.getGameState().getPhase().passPriority();
+ this.model.getGameState().getPhase().passPriority();
return null;
} else {
return new Input_PassPriority();
}
} else if (playerTurn.isComputer()) {
- return aiInput;
+ return this.aiInput;
} else {
- aiInput.getComputer().stackNotEmpty();
+ this.aiInput.getComputer().stackNotEmpty();
return null;
}
- }// getInput()
+ } // getInput()
/**
* Sets the computer.
@@ -250,6 +251,6 @@ public class InputControl extends MyObservable implements java.io.Serializable {
* the new computer
*/
public final void setComputer(final ComputerAI_Input computerAI_Input) {
- aiInput = computerAI_Input;
+ this.aiInput = computerAI_Input;
}
-}// InputControl
+} // InputControl
diff --git a/src/main/java/forge/gui/input/Input_Attack.java b/src/main/java/forge/gui/input/Input_Attack.java
index 2848040a9bb..60a2fb522ea 100644
--- a/src/main/java/forge/gui/input/Input_Attack.java
+++ b/src/main/java/forge/gui/input/Input_Attack.java
@@ -30,12 +30,12 @@ public class Input_Attack extends Input {
ButtonUtil.enableOnlyOK();
- Object o = AllZone.getCombat().nextDefender();
+ final Object o = AllZone.getCombat().nextDefender();
if (o == null) {
return;
}
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Declare Attackers: Select Creatures to Attack ");
sb.append(o.toString());
@@ -46,7 +46,7 @@ public class Input_Attack extends Input {
CardList possibleAttackers = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
possibleAttackers = possibleAttackers.getType("Creature");
for (int i = 0; i < possibleAttackers.size(); i++) {
- Card c = possibleAttackers.get(i);
+ final Card c = possibleAttackers.get(i);
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, AllZone.getCombat())
&& !c.isAttacking()) {
AllZone.getCombat().addAttacker(c);
@@ -97,8 +97,8 @@ public class Input_Attack extends Input {
// marked
// for Castle Raptors, since it gets a bonus if untapped
- for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
- Command com = GameActionUtil.getCommands().get(effect);
+ for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
+ final Command com = GameActionUtil.getCommands().get(effect);
com.execute();
}
diff --git a/src/main/java/forge/gui/input/Input_Block.java b/src/main/java/forge/gui/input/Input_Block.java
index c57ac69109e..99b1efe270b 100644
--- a/src/main/java/forge/gui/input/Input_Block.java
+++ b/src/main/java/forge/gui/input/Input_Block.java
@@ -25,7 +25,7 @@ public class Input_Block extends Input {
private static final long serialVersionUID = 6120743598368928128L;
private Card currentAttacker = null;
- private ArrayList allBlocking = new ArrayList();
+ private final ArrayList allBlocking = new ArrayList();
/**
*
@@ -36,22 +36,22 @@ public class Input_Block extends Input {
* a {@link forge.Card} object.
*/
public final void removeFromAllBlocking(final Card c) {
- allBlocking.remove(c);
+ this.allBlocking.remove(c);
}
/** {@inheritDoc} */
@Override
public final void showMessage() {
// for Castle Raptors, since it gets a bonus if untapped
- for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
- Command com = GameActionUtil.getCommands().get(effect);
+ for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
+ final Command com = GameActionUtil.getCommands().get(effect);
com.execute();
}
// could add "Reset Blockers" button
ButtonUtil.enableOnlyOK();
- if (currentAttacker == null) {
+ if (this.currentAttacker == null) {
/*
* //Lure CardList attackers = new
* CardList(AllZone.getCombat().getAttackers()); for(Card
@@ -66,9 +66,11 @@ public class Input_Block extends Input {
AllZone.getDisplay().showMessage("To Block, click on your Opponents attacker first, then your blocker(s)");
} else {
- String attackerName = currentAttacker.isFaceDown() ? "Morph" : currentAttacker.getName();
- AllZone.getDisplay().showMessage(
- "Select a creature to block " + attackerName + " (" + currentAttacker.getUniqueNumber() + ") ");
+ final String attackerName = this.currentAttacker.isFaceDown() ? "Morph" : this.currentAttacker.getName();
+ AllZone.getDisplay()
+ .showMessage(
+ "Select a creature to block " + attackerName + " ("
+ + this.currentAttacker.getUniqueNumber() + ") ");
}
CombatUtil.showCombat();
@@ -90,14 +92,14 @@ public class Input_Block extends Input {
public final void selectCard(final Card card, final PlayerZone zone) {
// is attacking?
if (CardUtil.toList(AllZone.getCombat().getAttackers()).contains(card)) {
- currentAttacker = card;
+ this.currentAttacker = card;
} else if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer()) && card.isCreature()
- && CombatUtil.canBlock(currentAttacker, card, AllZone.getCombat())) {
- if (currentAttacker != null && (!allBlocking.contains(card))) {
- allBlocking.add(card);
- AllZone.getCombat().addBlocker(currentAttacker, card);
+ && CombatUtil.canBlock(this.currentAttacker, card, AllZone.getCombat())) {
+ if ((this.currentAttacker != null) && (!this.allBlocking.contains(card))) {
+ this.allBlocking.add(card);
+ AllZone.getCombat().addBlocker(this.currentAttacker, card);
}
}
- showMessage();
+ this.showMessage();
} // selectCard()
}
diff --git a/src/main/java/forge/gui/input/Input_Cleanup.java b/src/main/java/forge/gui/input/Input_Cleanup.java
index 6d84f0e3a41..b4a5b257c21 100644
--- a/src/main/java/forge/gui/input/Input_Cleanup.java
+++ b/src/main/java/forge/gui/input/Input_Cleanup.java
@@ -24,22 +24,22 @@ public class Input_Cleanup extends Input {
@Override
public final void showMessage() {
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
- AI_CleanupDiscard();
+ this.aiCleanupDiscard();
return;
}
ButtonUtil.disableAll();
- int n = AllZone.getHumanPlayer().getCardsIn(Zone.Hand).size();
+ final int n = AllZone.getHumanPlayer().getCardsIn(Zone.Hand).size();
// MUST showMessage() before stop() or it will overwrite the next
// Input's message
- StringBuffer sb = new StringBuffer();
+ final StringBuffer sb = new StringBuffer();
sb.append("Cleanup Phase: You can only have a maximum of ").append(AllZone.getHumanPlayer().getMaxHandSize());
sb.append(" cards, you currently have ").append(n).append(" cards in your hand - select a card to discard");
AllZone.getDisplay().showMessage(sb.toString());
// goes to the next phase
- if (n <= AllZone.getHumanPlayer().getMaxHandSize() || AllZone.getHumanPlayer().getMaxHandSize() == -1) {
+ if ((n <= AllZone.getHumanPlayer().getMaxHandSize()) || (AllZone.getHumanPlayer().getMaxHandSize() == -1)) {
CombatUtil.removeAllDamage();
AllZone.getPhase().setNeedToNextPhase(true);
@@ -54,7 +54,7 @@ public class Input_Cleanup extends Input {
if (zone.is(Constant.Zone.Hand, AllZone.getHumanPlayer())) {
card.getController().discard(card, null);
if (AllZone.getStack().size() == 0) {
- showMessage();
+ this.showMessage();
}
}
} // selectCard()
@@ -64,11 +64,11 @@ public class Input_Cleanup extends Input {
* AI_CleanupDiscard.
*
*/
- public void AI_CleanupDiscard() {
- int size = AllZone.getComputerPlayer().getCardsIn(Zone.Hand).size();
+ public void aiCleanupDiscard() {
+ final int size = AllZone.getComputerPlayer().getCardsIn(Zone.Hand).size();
if (AllZone.getComputerPlayer().getMaxHandSize() != -1) {
- int numDiscards = size - AllZone.getComputerPlayer().getMaxHandSize();
+ final int numDiscards = size - AllZone.getComputerPlayer().getMaxHandSize();
AllZone.getComputerPlayer().discard(numDiscards, null, false);
}
CombatUtil.removeAllDamage();
diff --git a/src/main/java/forge/gui/input/Input_Mulligan.java b/src/main/java/forge/gui/input/Input_Mulligan.java
index e346b318068..32a7e5a337b 100644
--- a/src/main/java/forge/gui/input/Input_Mulligan.java
+++ b/src/main/java/forge/gui/input/Input_Mulligan.java
@@ -45,7 +45,7 @@ public class Input_Mulligan extends Input {
/** {@inheritDoc} */
@Override
public final void selectButtonOK() {
- end();
+ this.end();
}
/**
@@ -59,14 +59,14 @@ public class Input_Mulligan extends Input {
* @return an int
*/
public final int doMulligan(final Player player, final GamePlayerRating playerRating) {
- CardList hand = player.getCardsIn(Zone.Hand);
- for (Card c : hand) {
+ final CardList hand = player.getCardsIn(Zone.Hand);
+ for (final Card c : hand) {
AllZone.getGameAction().moveToLibrary(c);
}
- for (int i = 0; i < MAGIC_NUMBER_OF_SHUFFLES; i++) {
+ for (int i = 0; i < Input_Mulligan.MAGIC_NUMBER_OF_SHUFFLES; i++) {
player.shuffle();
}
- int newHand = hand.size() - 1;
+ final int newHand = hand.size() - 1;
for (int i = 0; i < newHand; i++) {
player.drawCard();
}
@@ -78,19 +78,19 @@ public class Input_Mulligan extends Input {
/** {@inheritDoc} */
@Override
public final void selectButtonCancel() {
- Player humanPlayer = AllZone.getHumanPlayer();
- GamePlayerRating humanRating = AllZone.getGameInfo().getPlayerRating(humanPlayer.getName());
+ final Player humanPlayer = AllZone.getHumanPlayer();
+ final GamePlayerRating humanRating = AllZone.getGameInfo().getPlayerRating(humanPlayer.getName());
- int newHand = doMulligan(humanPlayer, humanRating);
+ final int newHand = this.doMulligan(humanPlayer, humanRating);
- QuestData quest = AllZone.getQuestData();
- if (quest != null && quest.getInventory().hasItem("Sleight") && humanRating.getMulliganCount() == 1) {
+ final QuestData quest = AllZone.getQuestData();
+ if ((quest != null) && quest.getInventory().hasItem("Sleight") && (humanRating.getMulliganCount() == 1)) {
AllZone.getHumanPlayer().drawCard();
humanRating.notifyOpeningHandSize(newHand + 1);
}
if (newHand == 0) {
- end();
+ this.end();
}
} // selectButtonOK()
@@ -101,37 +101,37 @@ public class Input_Mulligan extends Input {
*/
final void end() {
// Computer mulligan
- Player aiPlayer = AllZone.getComputerPlayer();
- GamePlayerRating aiRating = AllZone.getGameInfo().getPlayerRating(aiPlayer.getName());
+ final Player aiPlayer = AllZone.getComputerPlayer();
+ final GamePlayerRating aiRating = AllZone.getGameInfo().getPlayerRating(aiPlayer.getName());
boolean aiTakesMulligan = true;
// Computer mulligans if there are no cards with converted mana cost of
// 0 in its hand
while (aiTakesMulligan) {
- CardList handList = aiPlayer.getCardsIn(Zone.Hand);
- boolean hasLittleCmc0Cards = handList.getValidCards("Card.cmcEQ0", aiPlayer, null).size() < 2;
- aiTakesMulligan = handList.size() > AI_MULLIGAN_THRESHOLD && hasLittleCmc0Cards;
+ final CardList handList = aiPlayer.getCardsIn(Zone.Hand);
+ final boolean hasLittleCmc0Cards = handList.getValidCards("Card.cmcEQ0", aiPlayer, null).size() < 2;
+ aiTakesMulligan = (handList.size() > Input_Mulligan.AI_MULLIGAN_THRESHOLD) && hasLittleCmc0Cards;
if (aiTakesMulligan) {
- doMulligan(aiPlayer, aiRating);
+ this.doMulligan(aiPlayer, aiRating);
}
}
// Human Leylines & Chancellors
ButtonUtil.reset();
- AbilityFactory af = new AbilityFactory();
- CardList humanOpeningHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
+ final AbilityFactory af = new AbilityFactory();
+ final CardList humanOpeningHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
- for (Card c : humanOpeningHand) {
- ArrayList kws = c.getKeyword();
+ for (final Card c : humanOpeningHand) {
+ final ArrayList kws = c.getKeyword();
for (int i = 0; i < kws.size(); i++) {
- String kw = kws.get(i);
+ final String kw = kws.get(i);
if (kw.startsWith("MayEffectFromOpeningHand")) {
- String effName = kw.split(":")[1];
+ final String effName = kw.split(":")[1];
- SpellAbility effect = af.getAbility(c.getSVar(effName), c);
+ final SpellAbility effect = af.getAbility(c.getSVar(effName), c);
if (GameActionUtil.showYesNoDialog(c, "Use this card's ability?")) {
// If we ever let the AI memorize cards in the players
// hand, this would be a place to do so.
@@ -147,17 +147,17 @@ public class Input_Mulligan extends Input {
}
// Computer Leylines & Chancellors
- CardList aiOpeningHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
- for (Card c : aiOpeningHand) {
+ final CardList aiOpeningHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
+ for (final Card c : aiOpeningHand) {
if (!c.getName().startsWith("Leyline")) {
- ArrayList kws = c.getKeyword();
+ final ArrayList kws = c.getKeyword();
for (int i = 0; i < kws.size(); i++) {
- String kw = kws.get(i);
+ final String kw = kws.get(i);
if (kw.startsWith("MayEffectFromOpeningHand")) {
- String effName = kw.split(":")[1];
+ final String effName = kw.split(":")[1];
- SpellAbility effect = af.getAbility(c.getSVar(effName), c);
+ final SpellAbility effect = af.getAbility(c.getSVar(effName), c);
// Is there a better way for the AI to decide this?
if (effect.doTrigger(false)) {
@@ -169,8 +169,8 @@ public class Input_Mulligan extends Input {
}
}
if (c.getName().startsWith("Leyline")
- && !(c.getName().startsWith("Leyline of Singularity") && AllZoneUtil.getCardsIn(Zone.Battlefield,
- "Leyline of Singularity").size() > 0)) {
+ && !(c.getName().startsWith("Leyline of Singularity") && (AllZoneUtil.getCardsIn(Zone.Battlefield,
+ "Leyline of Singularity").size() > 0))) {
AllZone.getGameAction().moveToPlay(c);
AllZone.getGameAction().checkStateEffects();
}
@@ -188,6 +188,6 @@ public class Input_Mulligan extends Input {
AllZone.getGameAction().checkStateEffects();
Phase.setGameBegins(1);
AllZone.getPhase().setNeedToNextPhase(false);
- stop();
+ this.stop();
}
}
diff --git a/src/main/java/forge/gui/input/Input_PassPriority.java b/src/main/java/forge/gui/input/Input_PassPriority.java
index d3b2e4fffde..261ad80a5df 100644
--- a/src/main/java/forge/gui/input/Input_PassPriority.java
+++ b/src/main/java/forge/gui/input/Input_PassPriority.java
@@ -25,14 +25,14 @@ public class Input_PassPriority extends Input implements java.io.Serializable {
GuiDisplayUtil.updateGUI();
ButtonUtil.enableOnlyOK();
- String phase = AllZone.getPhase().getPhase();
- Player player = AllZone.getPhase().getPriorityPlayer();
+ final String phase = AllZone.getPhase().getPhase();
+ final Player player = AllZone.getPhase().getPriorityPlayer();
if (player.isComputer()) {
System.out.println(phase + ": Computer in passpriority");
}
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Turn : ").append(AllZone.getPhase().getPlayerTurn()).append("\n");
sb.append("Phase: ").append(phase).append("\n");
@@ -53,10 +53,10 @@ public class Input_PassPriority extends Input implements java.io.Serializable {
public final void selectButtonOK() {
AllZone.getPhase().passPriority();
GuiDisplayUtil.updateGUI();
- Input in = AllZone.getInputControl().getInput();
- if (in == this || in == null) {
+ final Input in = AllZone.getInputControl().getInput();
+ if ((in == this) || (in == null)) {
AllZone.getInputControl().resetInput();
- // Clear out PassPriority after clicking button
+ // Clear out PassPriority after clicking button
}
}
diff --git a/src/main/java/forge/gui/input/Input_PayManaCost.java b/src/main/java/forge/gui/input/Input_PayManaCost.java
index dbc0fc16bb5..31381b29aae 100644
--- a/src/main/java/forge/gui/input/Input_PayManaCost.java
+++ b/src/main/java/forge/gui/input/Input_PayManaCost.java
@@ -31,7 +31,7 @@ public class Input_PayManaCost extends Input {
private final Card originalCard;
/** The mana cost. */
- public ManaCost manaCost;
+ private ManaCost manaCost;
private final SpellAbility spell;
@@ -50,25 +50,25 @@ public class Input_PayManaCost extends Input {
* a boolean.
*/
public Input_PayManaCost(final SpellAbility sa, final boolean noStack) {
- skipStack = noStack;
- originalManaCost = sa.getManaCost(); // Change
- originalCard = sa.getSourceCard();
+ this.skipStack = noStack;
+ this.originalManaCost = sa.getManaCost(); // Change
+ this.originalCard = sa.getSourceCard();
- spell = sa;
+ this.spell = sa;
if (Phase.getGameBegins() == 1) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
- if (spell.getAfterPayMana() != null) {
- stopSetNext(spell.getAfterPayMana());
+ if (this.spell.getAfterPayMana() != null) {
+ this.stopSetNext(this.spell.getAfterPayMana());
} else {
- manaCost = new ManaCost("0");
- AllZone.getStack().add(spell);
+ this.manaCost = new ManaCost("0");
+ AllZone.getStack().add(this.spell);
}
} else {
- manaCost = AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(originalManaCost));
+ this.manaCost = AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(this.originalManaCost));
}
} else {
- manaCost = new ManaCost(sa.getManaCost());
+ this.manaCost = new ManaCost(sa.getManaCost());
}
}
@@ -81,24 +81,24 @@ public class Input_PayManaCost extends Input {
* a {@link forge.card.spellability.SpellAbility} object.
*/
public Input_PayManaCost(final SpellAbility sa) {
- originalManaCost = sa.getManaCost(); // Change
- originalCard = sa.getSourceCard();
+ this.originalManaCost = sa.getManaCost(); // Change
+ this.originalCard = sa.getSourceCard();
- spell = sa;
+ this.spell = sa;
if (Phase.getGameBegins() == 1) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
- if (spell.getAfterPayMana() != null) {
- stopSetNext(spell.getAfterPayMana());
+ if (this.spell.getAfterPayMana() != null) {
+ this.stopSetNext(this.spell.getAfterPayMana());
} else {
- manaCost = new ManaCost("0");
- AllZone.getStack().add(spell);
+ this.manaCost = new ManaCost("0");
+ AllZone.getStack().add(this.spell);
}
} else {
- manaCost = AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(originalManaCost));
+ this.manaCost = AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(this.originalManaCost));
}
} else {
- manaCost = new ManaCost(sa.getManaCost());
+ this.manaCost = new ManaCost(sa.getManaCost());
}
}
@@ -108,8 +108,8 @@ public class Input_PayManaCost extends Input {
*
*/
private void resetManaCost() {
- manaCost = new ManaCost(originalManaCost);
- phyLifeToLose = 0;
+ this.manaCost = new ManaCost(this.originalManaCost);
+ this.phyLifeToLose = 0;
}
/** {@inheritDoc} */
@@ -120,22 +120,22 @@ public class Input_PayManaCost extends Input {
// Kher Keep, Pendelhaven, Blinkmoth Nexus, and Mikokoro, Center of the
// Sea, ....
- if (originalCard.equals(card) && spell.isTapAbility()) {
+ if (this.originalCard.equals(card) && this.spell.isTapAbility()) {
// I'm not sure if this actually prevents anything that wouldn't be
// handled by canPlay below
return;
}
- manaCost = Input_PayManaCostUtil.activateManaAbility(spell, card, manaCost);
+ this.manaCost = Input_PayManaCostUtil.activateManaAbility(this.spell, card, this.manaCost);
// only show message if this is the active input
if (AllZone.getInputControl().getInput() == this) {
- showMessage();
+ this.showMessage();
}
- if (manaCost.isPaid()) {
- originalCard.setSunburstValue(manaCost.getSunburst());
- done();
+ if (this.manaCost.isPaid()) {
+ this.originalCard.setSunburstValue(this.manaCost.getSunburst());
+ this.done();
}
}
@@ -144,11 +144,11 @@ public class Input_PayManaCost extends Input {
public final void selectPlayer(final Player player) {
if (player.isHuman()) {
- if (manaCost.payPhyrexian()) {
- phyLifeToLose += 2;
+ if (this.manaCost.payPhyrexian()) {
+ this.phyLifeToLose += 2;
}
- showMessage();
+ this.showMessage();
}
}
@@ -159,40 +159,40 @@ public class Input_PayManaCost extends Input {
*
*/
private void done() {
- if (phyLifeToLose > 0) {
- AllZone.getHumanPlayer().payLife(phyLifeToLose, originalCard);
+ if (this.phyLifeToLose > 0) {
+ AllZone.getHumanPlayer().payLife(this.phyLifeToLose, this.originalCard);
}
- if (spell.getSourceCard().isCopiedSpell()) {
- if (spell.getAfterPayMana() != null) {
- stopSetNext(spell.getAfterPayMana());
+ if (this.spell.getSourceCard().isCopiedSpell()) {
+ if (this.spell.getAfterPayMana() != null) {
+ this.stopSetNext(this.spell.getAfterPayMana());
} else {
AllZone.getInputControl().resetInput();
}
} else {
- AllZone.getHumanPlayer().getManaPool().clearPay(spell, false);
- resetManaCost();
+ AllZone.getHumanPlayer().getManaPool().clearPay(this.spell, false);
+ this.resetManaCost();
// if tap ability, tap card
- if (spell.isTapAbility()) {
- originalCard.tap();
+ if (this.spell.isTapAbility()) {
+ this.originalCard.tap();
}
- if (spell.isUntapAbility()) {
- originalCard.untap();
+ if (this.spell.isUntapAbility()) {
+ this.originalCard.untap();
}
// if this is a spell, move it to the Stack ZOne
- if (spell.isSpell()) {
- spell.setSourceCard(AllZone.getGameAction().moveToStack(originalCard));
+ if (this.spell.isSpell()) {
+ this.spell.setSourceCard(AllZone.getGameAction().moveToStack(this.originalCard));
}
- if (spell.getAfterPayMana() != null) {
- stopSetNext(spell.getAfterPayMana());
+ if (this.spell.getAfterPayMana() != null) {
+ this.stopSetNext(this.spell.getAfterPayMana());
} else {
- if (skipStack) {
- spell.resolve();
+ if (this.skipStack) {
+ this.spell.resolve();
} else {
- AllZone.getStack().add(spell);
+ AllZone.getStack().add(this.spell);
}
AllZone.getInputControl().resetInput();
}
@@ -202,20 +202,20 @@ public class Input_PayManaCost extends Input {
/** {@inheritDoc} */
@Override
public final void selectButtonCancel() {
- resetManaCost();
- AllZone.getHumanPlayer().getManaPool().unpaid(spell, true);
+ this.resetManaCost();
+ AllZone.getHumanPlayer().getManaPool().unpaid(this.spell, true);
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers(); // DO
- // NOT
- // REMOVE
- // THIS,
- // otherwise
- // the
- // cards
- // don't
- // always
- // tap
+ // NOT
+ // REMOVE
+ // THIS,
+ // otherwise
+ // the
+ // cards
+ // don't
+ // always
+ // tap
- stop();
+ this.stop();
}
/** {@inheritDoc} */
@@ -223,21 +223,21 @@ public class Input_PayManaCost extends Input {
public final void showMessage() {
ButtonUtil.enableOnlyCancel();
- StringBuilder msg = new StringBuilder("Pay Mana Cost: " + manaCost.toString());
- if (phyLifeToLose > 0) {
+ final StringBuilder msg = new StringBuilder("Pay Mana Cost: " + this.manaCost.toString());
+ if (this.phyLifeToLose > 0) {
msg.append(" (");
- msg.append(phyLifeToLose);
+ msg.append(this.phyLifeToLose);
msg.append(" life paid for phyrexian mana)");
}
- if (manaCost.containsPhyrexianMana()) {
+ if (this.manaCost.containsPhyrexianMana()) {
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
}
AllZone.getDisplay().showMessage(msg.toString());
- if (manaCost.isPaid() && !new ManaCost(originalManaCost).isPaid()) {
- originalCard.setSunburstValue(manaCost.getSunburst());
- done();
+ if (this.manaCost.isPaid() && !new ManaCost(this.originalManaCost).isPaid()) {
+ this.originalCard.setSunburstValue(this.manaCost.getSunburst());
+ this.done();
}
}
diff --git a/src/main/java/forge/gui/input/Input_PayManaCostUtil.java b/src/main/java/forge/gui/input/Input_PayManaCostUtil.java
index 1122dd02b5b..caa6034e72d 100644
--- a/src/main/java/forge/gui/input/Input_PayManaCostUtil.java
+++ b/src/main/java/forge/gui/input/Input_PayManaCostUtil.java
@@ -51,28 +51,29 @@ public class Input_PayManaCostUtil {
return ((ManaPool) card).subtractMana(sa, manaCost);
}
- ArrayList abilities = getManaAbilities(card);
- StringBuilder cneeded = new StringBuilder();
+ ArrayList abilities = Input_PayManaCostUtil.getManaAbilities(card);
+ final StringBuilder cneeded = new StringBuilder();
boolean choice = true;
boolean skipExpress = false;
- for (String color : Constant.Color.MANA_COLORS) {
+ for (final String color : Constant.Color.MANA_COLORS) {
if (manaCost.isNeeded(color)) {
- cneeded.append(getShortColorString(color));
+ cneeded.append(Input_PayManaCostUtil.getShortColorString(color));
}
}
- Iterator it = abilities.iterator(); // you can't remove
- // unneeded abilities
- // inside a
- // for(am:abilities)
- // loop :(
+ final Iterator it = abilities.iterator(); // you can't
+ // remove
+ // unneeded abilities
+ // inside a
+ // for(am:abilities)
+ // loop :(
while (it.hasNext()) {
- Ability_Mana ma = it.next();
+ final Ability_Mana ma = it.next();
ma.setActivatingPlayer(AllZone.getHumanPlayer());
if (!ma.canPlay()) {
it.remove();
- } else if (!canMake(ma, cneeded.toString())) {
+ } else if (!Input_PayManaCostUtil.canMake(ma, cneeded.toString())) {
it.remove();
}
@@ -95,21 +96,21 @@ public class Input_PayManaCostUtil {
if (!skipExpress) {
// express Mana Choice
- ArrayList colorMatches = new ArrayList();
+ final ArrayList colorMatches = new ArrayList();
- for (Ability_Mana am : abilities) {
+ for (final Ability_Mana am : abilities) {
if (am.isReflectedMana()) {
- ArrayList reflectableColors = AbilityFactory_Mana.reflectableMana(am,
+ final ArrayList reflectableColors = AbilityFactory_Mana.reflectableMana(am,
am.getAbilityFactory(), new ArrayList(), new ArrayList());
- for (String color : reflectableColors) {
+ for (final String color : reflectableColors) {
if (manaCost.isColor(color)) {
// checking if color
colorMatches.add(am);
}
}
} else {
- String[] m = ManaPool.formatMana(am);
- for (String color : m) {
+ final String[] m = ManaPool.formatMana(am);
+ for (final String color : m) {
if (manaCost.isColor(color)) {
// checking if color
colorMatches.add(am);
@@ -118,7 +119,7 @@ public class Input_PayManaCostUtil {
}
}
- if (colorMatches.size() == 0 || colorMatches.size() == abilities.size()) {
+ if ((colorMatches.size() == 0) || (colorMatches.size() == abilities.size())) {
// can only match colorless just grab the first and move on.
choice = false;
} else if (colorMatches.size() < abilities.size()) {
@@ -128,9 +129,9 @@ public class Input_PayManaCostUtil {
}
Ability_Mana chosen = abilities.get(0);
- if (1 < abilities.size() && choice) {
- HashMap ability = new HashMap();
- for (Ability_Mana am : abilities) {
+ if ((1 < abilities.size()) && choice) {
+ final HashMap ability = new HashMap();
+ for (final Ability_Mana am : abilities) {
ability.put(am.toString(), am);
}
chosen = (Ability_Mana) GuiUtils.getChoice("Choose mana ability", abilities.toArray());
@@ -180,15 +181,15 @@ public class Input_PayManaCostUtil {
}
if (am.isReflectedMana()) {
- ArrayList reflectableColors = AbilityFactory_Mana.reflectableMana(am, am.getAbilityFactory(),
+ final ArrayList reflectableColors = AbilityFactory_Mana.reflectableMana(am, am.getAbilityFactory(),
new ArrayList(), new ArrayList());
- for (String color : reflectableColors) {
- if (mana.contains(getShortColorString(color))) {
+ for (final String color : reflectableColors) {
+ if (mana.contains(Input_PayManaCostUtil.getShortColorString(color))) {
return true;
}
}
} else {
- for (String color : ManaPool.formatMana(am)) {
+ for (final String color : ManaPool.formatMana(am)) {
if (mana.contains(color)) {
return true;
}
@@ -207,7 +208,7 @@ public class Input_PayManaCostUtil {
* @return a {@link java.lang.String} object.
*/
public static String getLongColorString(final String color) {
- Map m = new HashMap();
+ final Map m = new HashMap();
m.put("G", Constant.Color.GREEN);
m.put("R", Constant.Color.RED);
m.put("U", Constant.Color.BLUE);
@@ -234,7 +235,7 @@ public class Input_PayManaCostUtil {
* @return a {@link java.lang.String} object.
*/
public static String getShortColorString(final String color) {
- Map m = new HashMap();
+ final Map m = new HashMap();
m.put(Constant.Color.GREEN, "G");
m.put(Constant.Color.RED, "R");
m.put(Constant.Color.BLUE, "U");
@@ -243,7 +244,7 @@ public class Input_PayManaCostUtil {
m.put(Constant.Color.COLORLESS, "1");
m.put(Constant.Color.SNOW, "S");
- Object o = m.get(color);
+ final Object o = m.get(color);
return o.toString();
}
diff --git a/src/main/java/forge/gui/input/Input_PayManaCost_Ability.java b/src/main/java/forge/gui/input/Input_PayManaCost_Ability.java
index fedf87700dd..eaa6f42a0a2 100644
--- a/src/main/java/forge/gui/input/Input_PayManaCost_Ability.java
+++ b/src/main/java/forge/gui/input/Input_PayManaCost_Ability.java
@@ -54,16 +54,15 @@ public class Input_PayManaCost_Ability extends Input {
* Constructor for Input_PayManaCost_Ability.
*
*
- * @param manaCost_2
+ * @param manaCost2
* a {@link java.lang.String} object.
- * @param paidCommand_2
+ * @param paidCommand2
* a {@link forge.Command} object.
- * @param unpaidCommand_2
+ * @param unpaidCommand2
* a {@link forge.Command} object.
*/
- public Input_PayManaCost_Ability(final String manaCost_2,
- final Command paidCommand_2, final Command unpaidCommand_2) {
- this("", manaCost_2, paidCommand_2, unpaidCommand_2);
+ public Input_PayManaCost_Ability(final String manaCost2, final Command paidCommand2, final Command unpaidCommand2) {
+ this("", manaCost2, paidCommand2, unpaidCommand2);
}
/**
@@ -73,16 +72,16 @@ public class Input_PayManaCost_Ability extends Input {
*
* @param m
* a {@link java.lang.String} object.
- * @param manaCost_2
+ * @param manaCost2
* a {@link java.lang.String} object.
- * @param paidCommand_2
+ * @param paidCommand2
* a {@link forge.Command} object.
- * @param unpaidCommand_2
+ * @param unpaidCommand2
* a {@link forge.Command} object.
*/
- public Input_PayManaCost_Ability(final String m, final String manaCost_2,
- final Command paidCommand_2, final Command unpaidCommand_2) {
- this(m, manaCost_2, paidCommand_2, unpaidCommand_2, false);
+ public Input_PayManaCost_Ability(final String m, final String manaCost2, final Command paidCommand2,
+ final Command unpaidCommand2) {
+ this(m, manaCost2, paidCommand2, unpaidCommand2, false);
}
/**
@@ -92,19 +91,18 @@ public class Input_PayManaCost_Ability extends Input {
*
* @param m
* a {@link java.lang.String} object.
- * @param manaCost_2
+ * @param manaCost2
* a {@link java.lang.String} object.
- * @param paidCommand_2
+ * @param paidCommand2
* a {@link forge.Command} object.
- * @param unpaidCommand_2
+ * @param unpaidCommand2
* a {@link forge.Command} object.
* @param showOKButton
* a boolean.
*/
- public Input_PayManaCost_Ability(final String m, final String manaCost_2,
- final Command paidCommand_2, final Command unpaidCommand_2,
- final boolean showOKButton) {
- fakeAbility = new SpellAbility(SpellAbility.getAbility(), null) {
+ public Input_PayManaCost_Ability(final String m, final String manaCost2, final Command paidCommand2,
+ final Command unpaidCommand2, final boolean showOKButton) {
+ this.fakeAbility = new SpellAbility(SpellAbility.getAbility(), null) {
@Override
public void resolve() {
}
@@ -114,13 +112,13 @@ public class Input_PayManaCost_Ability extends Input {
return false;
}
};
- originalManaCost = manaCost_2;
- message = m;
+ this.originalManaCost = manaCost2;
+ this.message = m;
- manaCost = new ManaCost(originalManaCost);
- paidCommand = paidCommand_2;
- unpaidCommand = unpaidCommand_2;
- showOnlyOKButton = showOKButton;
+ this.manaCost = new ManaCost(this.originalManaCost);
+ this.paidCommand = paidCommand2;
+ this.unpaidCommand = unpaidCommand2;
+ this.showOnlyOKButton = showOKButton;
}
/**
@@ -129,40 +127,40 @@ public class Input_PayManaCost_Ability extends Input {
*
*/
public final void resetManaCost() {
- manaCost = new ManaCost(originalManaCost);
+ this.manaCost = new ManaCost(this.originalManaCost);
}
/** {@inheritDoc} */
@Override
public final void selectCard(final Card card, final PlayerZone zone) {
// only tap card if the mana is needed
- manaCost = Input_PayManaCostUtil.activateManaAbility(fakeAbility, card, manaCost);
+ this.manaCost = Input_PayManaCostUtil.activateManaAbility(this.fakeAbility, card, this.manaCost);
- if (manaCost.isPaid()) {
- resetManaCost();
- AllZone.getHumanPlayer().getManaPool().clearPay(fakeAbility, false);
- stop();
- paidCommand.execute();
+ if (this.manaCost.isPaid()) {
+ this.resetManaCost();
+ AllZone.getHumanPlayer().getManaPool().clearPay(this.fakeAbility, false);
+ this.stop();
+ this.paidCommand.execute();
} else {
- showMessage();
+ this.showMessage();
}
}
/** {@inheritDoc} */
@Override
public final void selectButtonCancel() {
- resetManaCost();
- AllZone.getHumanPlayer().getManaPool().unpaid(fakeAbility, true);
- stop();
- unpaidCommand.execute();
+ this.resetManaCost();
+ AllZone.getHumanPlayer().getManaPool().unpaid(this.fakeAbility, true);
+ this.stop();
+ this.unpaidCommand.execute();
}
/** {@inheritDoc} */
@Override
public final void selectButtonOK() {
- if (showOnlyOKButton) {
- stop();
- unpaidCommand.execute();
+ if (this.showOnlyOKButton) {
+ this.stop();
+ this.unpaidCommand.execute();
}
}
@@ -170,10 +168,10 @@ public class Input_PayManaCost_Ability extends Input {
@Override
public final void showMessage() {
ButtonUtil.enableOnlyCancel();
- if (showOnlyOKButton) {
+ if (this.showOnlyOKButton) {
ButtonUtil.enableOnlyOK();
}
- AllZone.getDisplay().showMessage(message + "Pay Mana Cost: \r\n" + manaCost.toString());
+ AllZone.getDisplay().showMessage(this.message + "Pay Mana Cost: \r\n" + this.manaCost.toString());
}
}
diff --git a/src/main/java/forge/gui/input/package-info.java b/src/main/java/forge/gui/input/package-info.java
index c72a362af11..753795cab47 100644
--- a/src/main/java/forge/gui/input/package-info.java
+++ b/src/main/java/forge/gui/input/package-info.java
@@ -1,2 +1,3 @@
/** Forge Card Game. */
package forge.gui.input;
+