mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Checkstyle fixes in some Input_* files
This commit is contained in:
@@ -1,6 +1,17 @@
|
|||||||
package forge.gui.input;
|
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$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class Input_Attack extends Input {
|
public class Input_Attack extends Input {
|
||||||
/** Constant <code>serialVersionUID=7849903731842214245L</code> */
|
/** Constant <code>serialVersionUID=7849903731842214245L</code>. */
|
||||||
private static final long serialVersionUID = 7849903731842214245L;
|
private static final long serialVersionUID = 7849903731842214245L;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public final void showMessage() {
|
||||||
// TODO: still seems to have some issues with multiple planeswalkers
|
// TODO still seems to have some issues with multiple planeswalkers
|
||||||
|
|
||||||
ButtonUtil.enableOnlyOK();
|
ButtonUtil.enableOnlyOK();
|
||||||
|
|
||||||
@@ -39,10 +50,9 @@ public class Input_Attack extends Input {
|
|||||||
Card c = possibleAttackers.get(i);
|
Card c = possibleAttackers.get(i);
|
||||||
if (c.hasKeyword("CARDNAME attacks each turn if able.")
|
if (c.hasKeyword("CARDNAME attacks each turn if able.")
|
||||||
&& CombatUtil.canAttack(c, AllZone.getCombat())
|
&& CombatUtil.canAttack(c, AllZone.getCombat())
|
||||||
&& !c.isAttacking()) {
|
&& !c.isAttacking())
|
||||||
|
{
|
||||||
AllZone.getCombat().addAttacker(c);
|
AllZone.getCombat().addAttacker(c);
|
||||||
//if(!c.hasKeyword("Vigilance"))
|
|
||||||
// c.tap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,12 +60,14 @@ public class Input_Attack extends Input {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void selectButtonOK() {
|
public final void selectButtonOK() {
|
||||||
if (AllZone.getCombat().getAttackers().length > 0)
|
if (AllZone.getCombat().getAttackers().length > 0) {
|
||||||
AllZone.getPhase().setCombat(true);
|
AllZone.getPhase().setCombat(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (AllZone.getCombat().getRemainingDefenders() != 0)
|
if (AllZone.getCombat().getRemainingDefenders() != 0) {
|
||||||
AllZone.getPhase().repeatPhase();
|
AllZone.getPhase().repeatPhase();
|
||||||
|
}
|
||||||
|
|
||||||
AllZone.getPhase().setNeedToNextPhase(true);
|
AllZone.getPhase().setNeedToNextPhase(true);
|
||||||
AllZone.getInputControl().resetInput();
|
AllZone.getInputControl().resetInput();
|
||||||
@@ -63,15 +75,18 @@ public class Input_Attack extends Input {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public final void selectCard(final Card card, final PlayerZone zone) {
|
||||||
if (card.isAttacking() || card.getController().isComputer())
|
if (card.isAttacking() || card.getController().isComputer()) {
|
||||||
return;
|
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()
|
// TODO add the propaganda code here and remove it in Phase.nextPhase()
|
||||||
// if (!CombatUtil.checkPropagandaEffects(card))
|
// if (!CombatUtil.checkPropagandaEffects(card))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
AllZone.getCombat().addAttacker(card);
|
AllZone.getCombat().addAttacker(card);
|
||||||
AllZone.getHumanBattlefield().updateObservers(); // just to make sure the attack symbol is marked
|
AllZone.getHumanBattlefield().updateObservers(); // just to make sure the attack symbol is marked
|
||||||
@@ -84,7 +99,7 @@ public class Input_Attack extends Input {
|
|||||||
|
|
||||||
CombatUtil.showCombat();
|
CombatUtil.showCombat();
|
||||||
}
|
}
|
||||||
}//selectCard()
|
} //selectCard()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>unselectCard.</p>
|
* <p>unselectCard.</p>
|
||||||
@@ -92,7 +107,7 @@ public class Input_Attack extends Input {
|
|||||||
* @param card a {@link forge.Card} object.
|
* @param card a {@link forge.Card} object.
|
||||||
* @param zone a {@link forge.PlayerZone} object.
|
* @param zone a {@link forge.PlayerZone} object.
|
||||||
*/
|
*/
|
||||||
public void unselectCard(Card card, PlayerZone zone) {
|
public void unselectCard(final Card card, final PlayerZone zone) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
package forge.gui.input;
|
package forge.gui.input;
|
||||||
|
|
||||||
|
|
||||||
import forge.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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>
|
* <p>Input_Block class.</p>
|
||||||
@@ -13,7 +20,7 @@ import java.util.ArrayList;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class Input_Block extends Input {
|
public class Input_Block extends Input {
|
||||||
/** Constant <code>serialVersionUID=6120743598368928128L</code> */
|
/** Constant <code>serialVersionUID=6120743598368928128L</code>. */
|
||||||
private static final long serialVersionUID = 6120743598368928128L;
|
private static final long serialVersionUID = 6120743598368928128L;
|
||||||
|
|
||||||
private Card currentAttacker = null;
|
private Card currentAttacker = null;
|
||||||
@@ -24,13 +31,13 @@ public class Input_Block extends Input {
|
|||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public void removeFromAllBlocking(Card c) {
|
public final void removeFromAllBlocking(final Card c) {
|
||||||
allBlocking.remove(c);
|
allBlocking.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public final void showMessage() {
|
||||||
//for Castle Raptors, since it gets a bonus if untapped
|
//for Castle Raptors, since it gets a bonus if untapped
|
||||||
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
|
||||||
Command com = GameActionUtil.commands.get(effect);
|
Command com = GameActionUtil.commands.get(effect);
|
||||||
@@ -69,7 +76,7 @@ public class Input_Block extends Input {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void selectButtonOK() {
|
public final void selectButtonOK() {
|
||||||
if (CombatUtil.finishedMandatotyBlocks(AllZone.getCombat())) {
|
if (CombatUtil.finishedMandatotyBlocks(AllZone.getCombat())) {
|
||||||
// Done blocking
|
// Done blocking
|
||||||
ButtonUtil.reset();
|
ButtonUtil.reset();
|
||||||
@@ -80,17 +87,18 @@ public class Input_Block extends Input {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(Card card, PlayerZone zone) {
|
public final void selectCard(final Card card, final PlayerZone zone) {
|
||||||
//is attacking?
|
//is attacking?
|
||||||
if (CardUtil.toList(AllZone.getCombat().getAttackers()).contains(card)) {
|
if (CardUtil.toList(AllZone.getCombat().getAttackers()).contains(card)) {
|
||||||
currentAttacker = card;
|
currentAttacker = card;
|
||||||
} else if (zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer()) && card.isCreature()
|
} 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))) {
|
if (currentAttacker != null && (!allBlocking.contains(card))) {
|
||||||
allBlocking.add(card);
|
allBlocking.add(card);
|
||||||
AllZone.getCombat().addBlocker(currentAttacker, card);
|
AllZone.getCombat().addBlocker(currentAttacker, card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showMessage();
|
showMessage();
|
||||||
}//selectCard()
|
} //selectCard()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
package forge.gui.input;
|
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>
|
* <p>Input_Cleanup class.</p>
|
||||||
@@ -9,12 +17,12 @@ import forge.*;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class Input_Cleanup extends Input {
|
public class Input_Cleanup extends Input {
|
||||||
/** Constant <code>serialVersionUID=-4164275418971547948L</code> */
|
/** Constant <code>serialVersionUID=-4164275418971547948L</code>. */
|
||||||
private static final long serialVersionUID = -4164275418971547948L;
|
private static final long serialVersionUID = -4164275418971547948L;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public final void showMessage() {
|
||||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||||
AI_CleanupDiscard();
|
AI_CleanupDiscard();
|
||||||
return;
|
return;
|
||||||
@@ -34,19 +42,20 @@ public class Input_Cleanup extends Input {
|
|||||||
CombatUtil.removeAllDamage();
|
CombatUtil.removeAllDamage();
|
||||||
|
|
||||||
AllZone.getPhase().setNeedToNextPhase(true);
|
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} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@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())) {
|
if (zone.is(Constant.Zone.Hand, AllZone.getHumanPlayer())) {
|
||||||
card.getController().discard(card, null);
|
card.getController().discard(card, null);
|
||||||
if (AllZone.getStack().size() == 0)
|
if (AllZone.getStack().size() == 0) {
|
||||||
showMessage();
|
showMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}//selectCard()
|
} //selectCard()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user