mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -210,39 +210,45 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
Player otherType = null;
|
||||
Player justAnyone = null;
|
||||
for (Player p : game.getPlayers()) {
|
||||
if ( p == this ) continue;
|
||||
if (p == this) {
|
||||
continue;
|
||||
}
|
||||
justAnyone = p;
|
||||
if( otherType == null && p.getType() != this.getType() ) otherType = p;
|
||||
if (otherType == null && p.getType() != this.getType()) {
|
||||
otherType = p;
|
||||
}
|
||||
}
|
||||
return otherType != null ? otherType : justAnyone;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returns all opponents
|
||||
* returns all opponents.
|
||||
* Should keep player relations somewhere in the match structure
|
||||
* @return
|
||||
*/
|
||||
public final List<Player> getOpponents() {
|
||||
List<Player> result = new ArrayList<Player>();
|
||||
for (Player p : game.getPlayers()) {
|
||||
if (p == this || p.getType() == this.getType())
|
||||
if (p == this || p.getType() == this.getType()) {
|
||||
continue;
|
||||
}
|
||||
result.add(p);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns allied players
|
||||
* returns allied players.
|
||||
* Should keep player relations somewhere in the match structure
|
||||
* @return
|
||||
*/
|
||||
public final List<Player> getAllies() {
|
||||
List<Player> result = new ArrayList<Player>();
|
||||
for (Player p : game.getPlayers()) {
|
||||
if (p == this || p.getType() != this.getType())
|
||||
if (p == this || p.getType() != this.getType()) {
|
||||
continue;
|
||||
}
|
||||
result.add(p);
|
||||
}
|
||||
return result;
|
||||
@@ -1599,8 +1605,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
game.getAction().discardMadness(c);
|
||||
|
||||
boolean hasPutIntoPlayInsteadOfDiscard = 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.");
|
||||
boolean hasPutIntoPlayInsteadOfDiscard = 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.");
|
||||
boolean hasPutIntoPlayWith2xP1P1InsteadOfDiscard = c.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME, "
|
||||
+ "put it onto the battlefield with two +1/+1 counters on it instead of putting it into your graveyard.");
|
||||
|
||||
@@ -2232,7 +2238,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
public final boolean cantWin() {
|
||||
boolean isAnyOppLoseProof = false;
|
||||
for (Player p : game.getPlayers()) {
|
||||
if ( p == this || p.getOutcome() != null ) continue; // except self and already dead
|
||||
if (p == this || p.getOutcome() != null) {
|
||||
|
||||
continue; // except self and already dead
|
||||
}
|
||||
isAnyOppLoseProof |= p.hasKeyword("You can't lose the game.");
|
||||
}
|
||||
return this.hasKeyword("You can't win the game.") || isAnyOppLoseProof;
|
||||
@@ -2247,8 +2256,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*/
|
||||
public final boolean checkLoseCondition() {
|
||||
|
||||
if ( this.getOutcome() != null )
|
||||
if (this.getOutcome() != null) {
|
||||
return this.getOutcome().lossState != null;
|
||||
}
|
||||
|
||||
if (this.poisonCounters >= 10) {
|
||||
return this.loseConditionMet(GameLossReason.Poisoned, null);
|
||||
@@ -2811,9 +2821,11 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* TODO: Write javadoc for this method.
|
||||
*/
|
||||
public void onGameOver() {
|
||||
if ( null == stats.getOutcome() ) // not lost?
|
||||
if (null == stats.getOutcome()) {
|
||||
|
||||
setOutcome(PlayerOutcome.win()); // then won!
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* use to get a list of creatures in play for a given player.
|
||||
@@ -2865,9 +2877,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
public void onCleanupPhase() {
|
||||
for (Card c : getCardsIn(ZoneType.Hand))
|
||||
for (Card c : getCardsIn(ZoneType.Hand)) {
|
||||
c.setDrawnThisTurn(false);
|
||||
|
||||
}
|
||||
resetPreventNextDamage();
|
||||
resetNumDrawnThisTurn();
|
||||
setAttackedWithCreatureThisTurn(false);
|
||||
@@ -2981,8 +2993,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @return
|
||||
*/
|
||||
public boolean isHostileTo(Player other) {
|
||||
if ( other.equals(getOpponent()) )
|
||||
if (other.equals(getOpponent())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return other.getType() != this.getType();
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public class PlayerController {
|
||||
}
|
||||
|
||||
|
||||
public boolean mayAutoPass(PhaseType phase)
|
||||
{
|
||||
public boolean mayAutoPass(PhaseType phase) {
|
||||
|
||||
return phase.isBefore(autoPassUntil);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,4 @@ public class PlayerController {
|
||||
aiInput = computerAIInput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user