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 otherType = null;
|
||||||
Player justAnyone = null;
|
Player justAnyone = null;
|
||||||
for (Player p : game.getPlayers()) {
|
for (Player p : game.getPlayers()) {
|
||||||
if ( p == this ) continue;
|
if (p == this) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
justAnyone = p;
|
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;
|
return otherType != null ? otherType : justAnyone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* returns all opponents
|
* returns all opponents.
|
||||||
* Should keep player relations somewhere in the match structure
|
* Should keep player relations somewhere in the match structure
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public final List<Player> getOpponents() {
|
public final List<Player> getOpponents() {
|
||||||
List<Player> result = new ArrayList<Player>();
|
List<Player> result = new ArrayList<Player>();
|
||||||
for (Player p : game.getPlayers()) {
|
for (Player p : game.getPlayers()) {
|
||||||
if (p == this || p.getType() == this.getType())
|
if (p == this || p.getType() == this.getType()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
result.add(p);
|
result.add(p);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns allied players
|
* returns allied players.
|
||||||
* Should keep player relations somewhere in the match structure
|
* Should keep player relations somewhere in the match structure
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public final List<Player> getAllies() {
|
public final List<Player> getAllies() {
|
||||||
List<Player> result = new ArrayList<Player>();
|
List<Player> result = new ArrayList<Player>();
|
||||||
for (Player p : game.getPlayers()) {
|
for (Player p : game.getPlayers()) {
|
||||||
if (p == this || p.getType() != this.getType())
|
if (p == this || p.getType() != this.getType()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
result.add(p);
|
result.add(p);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1599,8 +1605,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
|
|
||||||
game.getAction().discardMadness(c);
|
game.getAction().discardMadness(c);
|
||||||
|
|
||||||
boolean hasPutIntoPlayInsteadOfDiscard = c.hasKeyword("If a spell or ability an opponent controls causes you " +
|
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.");
|
+ "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, "
|
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.");
|
+ "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() {
|
public final boolean cantWin() {
|
||||||
boolean isAnyOppLoseProof = false;
|
boolean isAnyOppLoseProof = false;
|
||||||
for (Player p : game.getPlayers()) {
|
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.");
|
isAnyOppLoseProof |= p.hasKeyword("You can't lose the game.");
|
||||||
}
|
}
|
||||||
return this.hasKeyword("You can't win the game.") || isAnyOppLoseProof;
|
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() {
|
public final boolean checkLoseCondition() {
|
||||||
|
|
||||||
if ( this.getOutcome() != null )
|
if (this.getOutcome() != null) {
|
||||||
return this.getOutcome().lossState != null;
|
return this.getOutcome().lossState != null;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.poisonCounters >= 10) {
|
if (this.poisonCounters >= 10) {
|
||||||
return this.loseConditionMet(GameLossReason.Poisoned, null);
|
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.
|
* TODO: Write javadoc for this method.
|
||||||
*/
|
*/
|
||||||
public void onGameOver() {
|
public void onGameOver() {
|
||||||
if ( null == stats.getOutcome() ) // not lost?
|
if (null == stats.getOutcome()) {
|
||||||
|
|
||||||
setOutcome(PlayerOutcome.win()); // then won!
|
setOutcome(PlayerOutcome.win()); // then won!
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use to get a list of creatures in play for a given player.
|
* 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() {
|
public void onCleanupPhase() {
|
||||||
for (Card c : getCardsIn(ZoneType.Hand))
|
for (Card c : getCardsIn(ZoneType.Hand)) {
|
||||||
c.setDrawnThisTurn(false);
|
c.setDrawnThisTurn(false);
|
||||||
|
}
|
||||||
resetPreventNextDamage();
|
resetPreventNextDamage();
|
||||||
resetNumDrawnThisTurn();
|
resetNumDrawnThisTurn();
|
||||||
setAttackedWithCreatureThisTurn(false);
|
setAttackedWithCreatureThisTurn(false);
|
||||||
@@ -2981,8 +2993,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isHostileTo(Player other) {
|
public boolean isHostileTo(Player other) {
|
||||||
if ( other.equals(getOpponent()) )
|
if (other.equals(getOpponent())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return other.getType() != this.getType();
|
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);
|
return phase.isBefore(autoPassUntil);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,4 @@ public class PlayerController {
|
|||||||
aiInput = computerAIInput;
|
aiInput = computerAIInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user