Checkstyle fixes in some Input_* files

This commit is contained in:
slapshot5
2011-09-03 09:37:39 +00:00
parent b8b4f58805
commit 1786c3e655
3 changed files with 65 additions and 33 deletions

View File

@@ -1,6 +1,17 @@
package forge.gui.input;
import forge.*;
import forge.AllZone;
import forge.AllZoneUtil;
import forge.ButtonUtil;
import forge.Card;
import forge.CardList;
import forge.CombatUtil;
import forge.Command;
import forge.Constant;
import forge.GameActionUtil;
import forge.PlayerZone;
/**
@@ -10,13 +21,13 @@ import forge.*;
* @version $Id$
*/
public class Input_Attack extends Input {
/** Constant <code>serialVersionUID=7849903731842214245L</code> */
/** Constant <code>serialVersionUID=7849903731842214245L</code>. */
private static final long serialVersionUID = 7849903731842214245L;
/** {@inheritDoc} */
@Override
public void showMessage() {
// TODO: still seems to have some issues with multiple planeswalkers
public final void showMessage() {
// TODO still seems to have some issues with multiple planeswalkers
ButtonUtil.enableOnlyOK();
@@ -39,10 +50,9 @@ public class Input_Attack extends Input {
Card c = possibleAttackers.get(i);
if (c.hasKeyword("CARDNAME attacks each turn if able.")
&& CombatUtil.canAttack(c, AllZone.getCombat())
&& !c.isAttacking()) {
&& !c.isAttacking())
{
AllZone.getCombat().addAttacker(c);
//if(!c.hasKeyword("Vigilance"))
// c.tap();
}
}
}
@@ -50,12 +60,14 @@ public class Input_Attack extends Input {
/** {@inheritDoc} */
@Override
public void selectButtonOK() {
if (AllZone.getCombat().getAttackers().length > 0)
public final void selectButtonOK() {
if (AllZone.getCombat().getAttackers().length > 0) {
AllZone.getPhase().setCombat(true);
}
if (AllZone.getCombat().getRemainingDefenders() != 0)
if (AllZone.getCombat().getRemainingDefenders() != 0) {
AllZone.getPhase().repeatPhase();
}
AllZone.getPhase().setNeedToNextPhase(true);
AllZone.getInputControl().resetInput();
@@ -63,11 +75,14 @@ public class Input_Attack extends Input {
/** {@inheritDoc} */
@Override
public void selectCard(Card card, PlayerZone zone) {
if (card.isAttacking() || card.getController().isComputer())
public final void selectCard(final Card card, final PlayerZone zone) {
if (card.isAttacking() || card.getController().isComputer()) {
return;
}
if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer()) && CombatUtil.canAttack(card, AllZone.getCombat())) {
if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer())
&& CombatUtil.canAttack(card, AllZone.getCombat()))
{
// TODO add the propaganda code here and remove it in Phase.nextPhase()
// if (!CombatUtil.checkPropagandaEffects(card))
@@ -84,7 +99,7 @@ public class Input_Attack extends Input {
CombatUtil.showCombat();
}
}//selectCard()
} //selectCard()
/**
* <p>unselectCard.</p>
@@ -92,7 +107,7 @@ public class Input_Attack extends Input {
* @param card a {@link forge.Card} object.
* @param zone a {@link forge.PlayerZone} object.
*/
public void unselectCard(Card card, PlayerZone zone) {
public void unselectCard(final Card card, final PlayerZone zone) {
}
}

View File

@@ -1,10 +1,17 @@
package forge.gui.input;
import forge.*;
import java.util.ArrayList;
import forge.AllZone;
import forge.ButtonUtil;
import forge.Card;
import forge.CardUtil;
import forge.CombatUtil;
import forge.Command;
import forge.Constant;
import forge.GameActionUtil;
import forge.PlayerZone;
/**
* <p>Input_Block class.</p>
@@ -13,7 +20,7 @@ import java.util.ArrayList;
* @version $Id$
*/
public class Input_Block extends Input {
/** Constant <code>serialVersionUID=6120743598368928128L</code> */
/** Constant <code>serialVersionUID=6120743598368928128L</code>. */
private static final long serialVersionUID = 6120743598368928128L;
private Card currentAttacker = null;
@@ -24,13 +31,13 @@ public class Input_Block extends Input {
*
* @param c a {@link forge.Card} object.
*/
public void removeFromAllBlocking(Card c) {
public final void removeFromAllBlocking(final Card c) {
allBlocking.remove(c);
}
/** {@inheritDoc} */
@Override
public void showMessage() {
public final void showMessage() {
//for Castle Raptors, since it gets a bonus if untapped
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
Command com = GameActionUtil.commands.get(effect);
@@ -69,7 +76,7 @@ public class Input_Block extends Input {
/** {@inheritDoc} */
@Override
public void selectButtonOK() {
public final void selectButtonOK() {
if (CombatUtil.finishedMandatotyBlocks(AllZone.getCombat())) {
// Done blocking
ButtonUtil.reset();
@@ -80,17 +87,18 @@ public class Input_Block extends Input {
/** {@inheritDoc} */
@Override
public void selectCard(Card card, PlayerZone zone) {
public final void selectCard(final Card card, final PlayerZone zone) {
//is attacking?
if (CardUtil.toList(AllZone.getCombat().getAttackers()).contains(card)) {
currentAttacker = card;
} else if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer()) && card.isCreature()
&& CombatUtil.canBlock(currentAttacker, card, AllZone.getCombat())) {
&& CombatUtil.canBlock(currentAttacker, card, AllZone.getCombat()))
{
if (currentAttacker != null && (!allBlocking.contains(card))) {
allBlocking.add(card);
AllZone.getCombat().addBlocker(currentAttacker, card);
}
}
showMessage();
}//selectCard()
} //selectCard()
}

View File

@@ -1,6 +1,14 @@
package forge.gui.input;
import forge.*;
import forge.AllZone;
import forge.AllZoneUtil;
import forge.ButtonUtil;
import forge.Card;
import forge.CombatUtil;
import forge.Constant;
import forge.PlayerZone;
/**
* <p>Input_Cleanup class.</p>
@@ -9,12 +17,12 @@ import forge.*;
* @version $Id$
*/
public class Input_Cleanup extends Input {
/** Constant <code>serialVersionUID=-4164275418971547948L</code> */
/** Constant <code>serialVersionUID=-4164275418971547948L</code>. */
private static final long serialVersionUID = -4164275418971547948L;
/** {@inheritDoc} */
@Override
public void showMessage() {
public final void showMessage() {
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
AI_CleanupDiscard();
return;
@@ -34,19 +42,20 @@ public class Input_Cleanup extends Input {
CombatUtil.removeAllDamage();
AllZone.getPhase().setNeedToNextPhase(true);
AllZone.getPhase().nextPhase(); // TODO: keep an eye on this code, see if we can get rid of it.
AllZone.getPhase().nextPhase(); // TODO keep an eye on this code, see if we can get rid of it.
}
}
/** {@inheritDoc} */
@Override
public void selectCard(Card card, PlayerZone zone) {
public final void selectCard(final Card card, final PlayerZone zone) {
if (zone.is(Constant.Zone.Hand, AllZone.getHumanPlayer())) {
card.getController().discard(card, null);
if (AllZone.getStack().size() == 0)
if (AllZone.getStack().size() == 0) {
showMessage();
}
}//selectCard()
}
} //selectCard()
/**