mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- CheckStyle.
This commit is contained in:
@@ -282,8 +282,9 @@ public enum FControl {
|
||||
*/
|
||||
private Lobby lobby = null;
|
||||
public Lobby getLobby() {
|
||||
if( lobby == null )
|
||||
if (lobby == null) {
|
||||
lobby = new Lobby();
|
||||
}
|
||||
return lobby;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ public class Lobby {
|
||||
*/
|
||||
public LobbyPlayer findLocalPlayer(PlayerType type, String name) {
|
||||
|
||||
|
||||
return new LobbyPlayer(type, name);
|
||||
}
|
||||
|
||||
@@ -72,8 +71,9 @@ public class Lobby {
|
||||
* @return
|
||||
*/
|
||||
public LobbyPlayer findLocalPlayer(PlayerType type) {
|
||||
if ( type == PlayerType.HUMAN )
|
||||
if (type == PlayerType.HUMAN) {
|
||||
return new LobbyPlayer(type, "Human"); // need to get name!
|
||||
}
|
||||
|
||||
LobbyPlayer player = findLocalPlayer(type, getRandomName());
|
||||
player.setAvatarIndex(MyRandom.getRandom().nextInt(FSkin.getAvatars().size()));
|
||||
@@ -100,5 +100,4 @@ public class Lobby {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ public abstract class Input implements java.io.Serializable {
|
||||
* This method is used to mark old descendants of Input
|
||||
* TODO: Write javadoc for this method.
|
||||
*/
|
||||
public /*abstract */void isClassUpdated() {}//;
|
||||
public /*abstract */void isClassUpdated() {
|
||||
} //;
|
||||
|
||||
}
|
||||
|
||||
@@ -125,8 +125,8 @@ public class InputBlock extends Input {
|
||||
}
|
||||
|
||||
List<Card> attackersBlocked = this.allBlocking.get(card);
|
||||
if (!attackersBlocked.contains(this.currentAttacker) &&
|
||||
CombatUtil.canBlock(this.currentAttacker, card, Singletons.getModel().getGame().getCombat())) {
|
||||
if (!attackersBlocked.contains(this.currentAttacker)
|
||||
&& CombatUtil.canBlock(this.currentAttacker, card, Singletons.getModel().getGame().getCombat())) {
|
||||
attackersBlocked.add(this.currentAttacker);
|
||||
Singletons.getModel().getGame().getCombat().addBlocker(this.currentAttacker, card);
|
||||
reminder = false;
|
||||
|
||||
@@ -211,8 +211,9 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( priority.isHuman() )
|
||||
if (priority.isHuman()) {
|
||||
return new InputBlock(priority);
|
||||
}
|
||||
|
||||
// ai is under attack
|
||||
priority.getController().getAiInput().getComputer().declareBlockers();
|
||||
|
||||
@@ -94,7 +94,9 @@ public class InputMulligan extends Input {
|
||||
|
||||
// Computer mulligan
|
||||
for (Player ai : game.getPlayers()) {
|
||||
if ( ai.isHuman() ) continue;
|
||||
if (ai.isHuman()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean aiTakesMulligan = true;
|
||||
|
||||
@@ -161,8 +163,9 @@ public class InputMulligan extends Input {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c.getName().startsWith("Leyline") && !(c.getName().startsWith("Leyline of Singularity") &&
|
||||
(Iterables.any(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Leyline of Singularity"))))) {
|
||||
if (c.getName().startsWith("Leyline")
|
||||
&& !(c.getName().startsWith("Leyline of Singularity")
|
||||
&& (Iterables.any(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Leyline of Singularity"))))) {
|
||||
ga.moveToPlay(c);
|
||||
//ga.checkStateEffects();
|
||||
}
|
||||
|
||||
@@ -86,5 +86,6 @@ public class InputPassPriority extends Input {
|
||||
}
|
||||
} // selectCard()
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,5 +186,6 @@ public class InputPayDiscardCost extends Input {
|
||||
this.unpaid.execute();
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,5 +291,6 @@ public class InputPayManaCost extends InputPayMana {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,5 +156,6 @@ public class InputPayManaCost2 extends InputPayMana {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
@@ -248,6 +248,7 @@ public class InputPayManaCostAbility extends InputPayMana {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public class InputPayManaCostUtil {
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
|
||||
final StringBuilder cneeded = new StringBuilder();
|
||||
final StringBuilder colorRequired = new StringBuilder();
|
||||
boolean choice = true;
|
||||
|
||||
@@ -110,5 +110,6 @@ public class InputPayManaX extends InputPayMana {
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override
|
||||
public void isClassUpdated() {}
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
@@ -186,8 +186,7 @@ public class InputPayReturnCost extends Input {
|
||||
this.unpaid.execute();
|
||||
}
|
||||
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -187,5 +187,6 @@ public class InputPaySacCost extends Input {
|
||||
this.unpaid.execute();
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {}
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,11 @@ public abstract class InputSelectMany<T extends GameEntity> extends Input {
|
||||
|
||||
private String message = "Source-Card-Name - Select %d more card(s)";
|
||||
|
||||
protected InputSelectMany(int min, int max)
|
||||
{
|
||||
if( min > max ) throw new IllegalArgumentException("Min must not be greater than Max");
|
||||
protected InputSelectMany(int min, int max) {
|
||||
|
||||
if (min > max) {
|
||||
throw new IllegalArgumentException("Min must not be greater than Max");
|
||||
}
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
@@ -36,10 +38,18 @@ public abstract class InputSelectMany<T extends GameEntity> extends Input {
|
||||
boolean canCancel = (min == 0 && selected.isEmpty()) || canCancelWithSomethingSelected();
|
||||
boolean canOk = hasEnoughTargets();
|
||||
|
||||
if (canOk && canCancel) ButtonUtil.enableAll();
|
||||
if (!canOk && canCancel) ButtonUtil.enableOnlyCancel();
|
||||
if (canOk && !canCancel) ButtonUtil.enableOnlyOK();
|
||||
if (!canOk && !canCancel) ButtonUtil.disableAll();
|
||||
if (canOk && canCancel) {
|
||||
ButtonUtil.enableAll();
|
||||
}
|
||||
if (!canOk && canCancel) {
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
if (canOk && !canCancel) {
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
if (!canOk && !canCancel) {
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +71,11 @@ public abstract class InputSelectMany<T extends GameEntity> extends Input {
|
||||
// Singletons.getModel().getMatch().getInput().setInput(next);
|
||||
// }
|
||||
|
||||
if ( null == next )
|
||||
if (null == next) {
|
||||
this.stop();
|
||||
else
|
||||
} else {
|
||||
this.stopSetNext(next);
|
||||
}
|
||||
|
||||
// for a next use
|
||||
selected.clear();
|
||||
@@ -82,23 +93,24 @@ public abstract class InputSelectMany<T extends GameEntity> extends Input {
|
||||
// Singletons.getModel().getMatch().getInput().setInput(next);
|
||||
// }
|
||||
|
||||
if ( null == next )
|
||||
if (null == next) {
|
||||
this.stop();
|
||||
else
|
||||
} else {
|
||||
this.stopSetNext(next);
|
||||
}
|
||||
|
||||
// for a next use
|
||||
selected.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isClassUpdated() {}
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
|
||||
public void setMessage(String message0) {
|
||||
this.message = message0; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
|
||||
// must define these
|
||||
protected abstract Input onDone();
|
||||
protected abstract boolean isValidChoice(T choice);
|
||||
@@ -109,19 +121,18 @@ public abstract class InputSelectMany<T extends GameEntity> extends Input {
|
||||
protected boolean hasEnoughTargets() { return selected.size() >= min; }
|
||||
protected boolean hasAllTargets() { return selected.size() >= max; }
|
||||
|
||||
protected void selectEntity(T c) {
|
||||
|
||||
protected void selectEntity(T c)
|
||||
{
|
||||
if ( selected.contains(c) || !isValidChoice(c) ) return;
|
||||
if (selected.contains(c) || !isValidChoice(c)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.selected.add(c);
|
||||
this.showMessage();
|
||||
|
||||
if ( hasAllTargets() )
|
||||
if (hasAllTargets()) {
|
||||
selectButtonOK();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import forge.Card;
|
||||
public abstract class InputSelectManyCards extends InputSelectMany<Card> {
|
||||
private static final long serialVersionUID = -6609493252672573139L;
|
||||
|
||||
protected InputSelectManyCards(int min, int max)
|
||||
{
|
||||
protected InputSelectManyCards(int min, int max) {
|
||||
|
||||
super(min, max);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ public class InputSelectManyPlayers extends InputSelectMany<Player> {
|
||||
protected final Function<List<Player>, Input> onComplete;
|
||||
private final Predicate<Player> allowedFilter;
|
||||
|
||||
public InputSelectManyPlayers(final Predicate<Player> allowedRule, int min, int max, final Function<List<Player>, Input> onDone)
|
||||
{
|
||||
public InputSelectManyPlayers(final Predicate<Player> allowedRule, int min, int max, final Function<List<Player>, Input> onDone) {
|
||||
|
||||
super(min, max);
|
||||
allowedFilter = allowedRule;
|
||||
onComplete = onDone;
|
||||
@@ -27,7 +27,9 @@ public class InputSelectManyPlayers extends InputSelectMany<Player> {
|
||||
}
|
||||
|
||||
protected boolean isValidChoice(Player choice) {
|
||||
if ( allowedFilter != null && !allowedFilter.apply(choice)) return false;
|
||||
if (allowedFilter != null && !allowedFilter.apply(choice)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user