- CheckStyle.

This commit is contained in:
Chris
2012-11-26 15:16:56 +00:00
parent 6bbfc103cd
commit 8e434e85b3
7 changed files with 87 additions and 78 deletions

View File

@@ -46,7 +46,7 @@ import forge.game.zone.ZoneType;
*/ */
public class ComputerAIGeneral implements Computer { public class ComputerAIGeneral implements Computer {
final private Player player; private final Player player;
private final GameState game; private final GameState game;
/** /**
* <p> * <p>
@@ -306,8 +306,9 @@ public class ComputerAIGeneral implements Computer {
game.getPhaseHandler().setPlayerMayHavePriority(false); game.getPhaseHandler().setPlayerMayHavePriority(false);
// ai is about to attack, cancel all phase skipping // ai is about to attack, cancel all phase skipping
for (Player p : game.getPlayers()) for (Player p : game.getPlayers()) {
p.getController().autoPassCancel(); p.getController().autoPassCancel();
}
} }
/** /**

View File

@@ -64,8 +64,9 @@ public class ComputerAIInput extends Input {
@Override @Override
public final void showMessage() { public final void showMessage() {
// should not think when the game is over // should not think when the game is over
if( Singletons.getModel().getGame().isGameOver() ) if (Singletons.getModel().getGame().isGameOver()) {
return; return;
}
/* /*
* //put this back in ButtonUtil.disableAll(); * //put this back in ButtonUtil.disableAll();
@@ -124,5 +125,5 @@ public class ComputerAIInput extends Input {
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.control.input.Input#isClassUpdated() * @see forge.control.input.Input#isClassUpdated()
*/ */
@Override public void isClassUpdated() {} @Override public void isClassUpdated() { }
} }

View File

@@ -1539,8 +1539,8 @@ public class ComputerUtil {
Card prefCard = null; Card prefCard = null;
if (sa != null && sa.getActivatingPlayer() != null && sa.getActivatingPlayer().isHuman()) { if (sa != null && sa.getActivatingPlayer() != null && sa.getActivatingPlayer().isHuman()) {
for (Card c : hand) { for (Card c : hand) {
if (c.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME," + if (c.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME,"
" put it onto the battlefield instead of putting it into your graveyard.")) { + " put it onto the battlefield instead of putting it into your graveyard.")) {
prefCard = c; prefCard = c;
break; break;
} }

View File

@@ -78,10 +78,11 @@ public class ComputerUtilAttack {
this.computerList = ai.getCreaturesInPlay(); this.computerList = ai.getCreaturesInPlay();
this.attackers = new ArrayList<Card>(); this.attackers = new ArrayList<Card>();
for(Card c : computerList) for (Card c : computerList) {
if (CombatUtil.canAttack(c, human)) if (CombatUtil.canAttack(c, human)) {
attackers.add(c); attackers.add(c);
}
}
this.blockers = this.getPossibleBlockers(humanList, this.attackers); this.blockers = this.getPossibleBlockers(humanList, this.attackers);
} // constructor } // constructor
@@ -875,7 +876,7 @@ public class ComputerUtilAttack {
boolean hasCombatEffect = attacker.getSVar("HasCombatEffect").equals("TRUE"); boolean hasCombatEffect = attacker.getSVar("HasCombatEffect").equals("TRUE");
if (!hasCombatEffect) { if (!hasCombatEffect) {
for (String keyword : attacker.getKeyword()) { for (String keyword : attacker.getKeyword()) {
if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink") ) { if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink")) {
hasCombatEffect = true; hasCombatEffect = true;
break; break;
} }
@@ -914,7 +915,7 @@ public class ComputerUtilAttack {
canKillAllDangerous = false; canKillAllDangerous = false;
} else { } else {
for (String keyword : defender.getKeyword()) { for (String keyword : defender.getKeyword()) {
if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink") ) { if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink")) {
canKillAllDangerous = false; canKillAllDangerous = false;
break; break;
// there is a creature that can survive an attack from this creature // there is a creature that can survive an attack from this creature

View File

@@ -404,7 +404,7 @@ public class ComputerUtilBlock {
* a {@link forge.game.phase.Combat} object. * a {@link forge.game.phase.Combat} object.
* @return a {@link forge.game.phase.Combat} object. * @return a {@link forge.game.phase.Combat} object.
*/ */
final static Predicate<Card> rampagesOrNeedsManyToBlock = Predicates.or( CardPredicates.containsKeyword("Rampage"), CardPredicates.containsKeyword("CARDNAME can't be blocked by more than one creature.")); static final Predicate<Card> rampagesOrNeedsManyToBlock = Predicates.or(CardPredicates.containsKeyword("Rampage"), CardPredicates.containsKeyword("CARDNAME can't be blocked by more than one creature."));
private static Combat makeGangBlocks(final Player ai, final Combat combat) { private static Combat makeGangBlocks(final Player ai, final Combat combat) {
List<Card> currentAttackers = CardLists.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock)); List<Card> currentAttackers = CardLists.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock));

View File

@@ -8,20 +8,20 @@ package forge.game.player;
*/ */
public class LobbyPlayer { public class LobbyPlayer {
final protected PlayerType type; protected final PlayerType type;
public final PlayerType getType() { public final PlayerType getType() {
return type; return type;
} }
final protected String name; protected final String name;
// string with picture is more important than avatar index // string with picture is more important than avatar index
protected String picture; protected String picture;
private int avatarIndex = -1; private int avatarIndex = -1;
public LobbyPlayer(PlayerType type, String name) public LobbyPlayer(PlayerType type, String name) {
{
this.type = type; this.type = type;
this.name = name; this.name = name;
} }
@@ -53,20 +53,26 @@ public class LobbyPlayer {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
LobbyPlayer other = (LobbyPlayer) obj; LobbyPlayer other = (LobbyPlayer) obj;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null) {
return false; return false;
} else if (!name.equals(other.name)) }
} else if (!name.equals(other.name)) {
return false; return false;
if (type != other.type) }
if (type != other.type) {
return false; return false;
}
return true; return true;
} }