- CheckStyle.

This commit is contained in:
Chris
2012-11-27 15:08:04 +00:00
parent e38b1e0e68
commit 203a432255
4 changed files with 106 additions and 96 deletions

View File

@@ -140,12 +140,12 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield, public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante)); ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante));
private final PlayerController controller; private final PlayerController controller;
protected final LobbyPlayer lobbyPlayer; protected final LobbyPlayer lobbyPlayer;
protected final GameState game; protected final GameState game;
public final PlayerOutcome getOutcome() { public final PlayerOutcome getOutcome() {
return stats.getOutcome(); return stats.getOutcome();
} }
@@ -166,7 +166,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
lobbyPlayer = lobbyPlayer0; lobbyPlayer = lobbyPlayer0;
game = game0; game = game0;
for (final ZoneType z : Player.ALL_ZONES) { for (final ZoneType z : Player.ALL_ZONES) {
final PlayerZone toPut = z == ZoneType.Battlefield final PlayerZone toPut = z == ZoneType.Battlefield
? new PlayerZoneBattlefield(z, this) ? new PlayerZoneBattlefield(z, this)
: new PlayerZone(z, this); : new PlayerZone(z, this);
this.zones.put(z, toPut); this.zones.put(z, toPut);
@@ -201,7 +201,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
/** /**
* <p> * <p>
* getOpponent. Used by current-generation AI. * getOpponent. Used by current-generation AI.
* </p> * </p>
* *
* @return a {@link forge.game.player.Player} object. * @return a {@link forge.game.player.Player} object.
@@ -210,45 +210,51 @@ 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;
} }
// //////////////////////// // ////////////////////////
// //
@@ -588,7 +594,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
// Predict replacement effects // Predict replacement effects
for (final Card ca : game.getCardsIn(ZoneType.Battlefield)) { for (final Card ca : game.getCardsIn(ZoneType.Battlefield)) {
for (final ReplacementEffect re : ca.getReplacementEffects()) { for (final ReplacementEffect re : ca.getReplacementEffects()) {
HashMap<String,String> params = re.getMapParams(); HashMap<String, String> params = re.getMapParams();
if (!"DamageDone".equals(params.get("Event")) || !params.containsKey("PreventionEffect")) { if (!"DamageDone".equals(params.get("Event")) || !params.containsKey("PreventionEffect")) {
continue; continue;
} }
@@ -610,7 +616,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
continue; continue;
} }
} }
} }
return 0; return 0;
} }
@@ -966,7 +972,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public final void addPoisonCounters(final int num, final Card source) { public final void addPoisonCounters(final int num, final Card source) {
if (!this.hasKeyword("You can't get poison counters")) { if (!this.hasKeyword("You can't get poison counters")) {
this.poisonCounters += num; this.poisonCounters += num;
game.getEvents().post(new PoisonCounterEvent(this, source, num)); game.getEvents().post(new PoisonCounterEvent(this, source, num));
game.getGameLog().add("Poison", this + " receives a poison counter from " + source, 3); game.getGameLog().add("Poison", this + " receives a poison counter from " + source, 3);
@@ -1264,7 +1270,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
return drawn; return drawn;
} }
/** /**
* *
* TODO Write javadoc for this method. * TODO Write javadoc for this method.
@@ -1289,7 +1295,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
stats.notifyHasMulliganed(); stats.notifyHasMulliganed();
stats.notifyOpeningHandSize(newHand); stats.notifyOpeningHandSize(newHand);
return newHand; return newHand;
} }
/** /**
* <p> * <p>
@@ -1367,7 +1373,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public final PlayerZone getZone(final ZoneType zone) { public final PlayerZone getZone(final ZoneType zone) {
return this.zones.get(zone); return this.zones.get(zone);
} }
public final List<Card> getCardsIn(final ZoneType zoneType) { public final List<Card> getCardsIn(final ZoneType zoneType) {
return getCardsIn(zoneType, true); return getCardsIn(zoneType, true);
} }
@@ -1442,7 +1448,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
} }
return result; return result;
} }
/** /**
* gets a list of all cards with requested cardName in a given player's * gets a list of all cards with requested cardName in a given player's
* requested zone. This function makes a List<Card> from Card[]. * requested zone. This function makes a List<Card> from Card[].
@@ -1480,7 +1486,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
int cntLibrary = this.getCardsIn(ZoneType.Library).size(); int cntLibrary = this.getCardsIn(ZoneType.Library).size();
for (final Card c : this.getCardsIn(ZoneType.Graveyard)) { for (final Card c : this.getCardsIn(ZoneType.Graveyard)) {
int nDr = getDredgeNumber(c); int nDr = getDredgeNumber(c);
if ( nDr > 0 && cntLibrary >= nDr) { if (nDr > 0 && cntLibrary >= nDr) {
dredge.add(c); dredge.add(c);
} }
} }
@@ -1598,16 +1604,16 @@ 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.");
if ( ( hasPutIntoPlayInsteadOfDiscard || hasPutIntoPlayWith2xP1P1InsteadOfDiscard ) if ((hasPutIntoPlayInsteadOfDiscard || hasPutIntoPlayWith2xP1P1InsteadOfDiscard)
&& null != sa && sa.getSourceCard().getController().isHostileTo(c.getController())) { && null != sa && sa.getSourceCard().getController().isHostileTo(c.getController())) {
game.getAction().moveToPlay(c); game.getAction().moveToPlay(c);
if (hasPutIntoPlayWith2xP1P1InsteadOfDiscard) { if (hasPutIntoPlayWith2xP1P1InsteadOfDiscard) {
c.addCounter(CounterType.P1P1, 2, false); c.addCounter(CounterType.P1P1, 2, false);
} }
@@ -1692,7 +1698,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public final List<Card> discardRandom(final int num, final SpellAbility sa, final String valid) { public final List<Card> discardRandom(final int num, final SpellAbility sa, final String valid) {
final List<Card> discarded = new ArrayList<Card>(); final List<Card> discarded = new ArrayList<Card>();
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
final List<Card> list = final List<Card> list =
CardLists.getValidCards(this.getCardsIn(ZoneType.Hand), valid, sa.getSourceCard().getController(), sa.getSourceCard()); CardLists.getValidCards(this.getCardsIn(ZoneType.Hand), valid, sa.getSourceCard().getController(), sa.getSourceCard());
if (list.size() != 0) { if (list.size() != 0) {
final Card disc = CardUtil.getRandom(list); final Card disc = CardUtil.getRandom(list);
@@ -1786,7 +1792,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
int s = list.size(); int s = list.size();
for (int i = 0; i < s; i++) { for (int i = 0; i < s; i++) {
list.add(random.nextInt(s-1), list.remove(random.nextInt(s))); list.add(random.nextInt(s - 1), list.remove(random.nextInt(s)));
} }
Collections.shuffle(list, random); Collections.shuffle(list, random);
@@ -2169,17 +2175,17 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* @return a boolean. * @return a boolean.
*/ */
public final boolean loseConditionMet(final GameLossReason state, final String spellName) { public final boolean loseConditionMet(final GameLossReason state, final String spellName) {
if ( state != GameLossReason.OpponentWon ) { if (state != GameLossReason.OpponentWon) {
if (this.cantLose()) { if (this.cantLose()) {
System.out.println("Tried to lose, but currently can't."); System.out.println("Tried to lose, but currently can't.");
return false; return false;
} }
// Replacement effects // Replacement effects
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Affected", this); runParams.put("Affected", this);
runParams.put("Event", "GameLoss"); runParams.put("Event", "GameLoss");
if (game.getReplacementHandler().run(runParams) != ReplacementResult.NotReplaced) { if (game.getReplacementHandler().run(runParams) != ReplacementResult.NotReplaced) {
return false; return false;
} }
@@ -2231,8 +2237,11 @@ 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;
@@ -2246,9 +2255,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* @return a boolean. * @return a boolean.
*/ */
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);
@@ -2324,7 +2334,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
final List<Card> list = this.getZone(ZoneType.Battlefield).getCardsAddedThisTurn(null); final List<Card> list = this.getZone(ZoneType.Battlefield).getCardsAddedThisTurn(null);
return Iterables.any(list, CardPredicates.Presets.LANDS); return Iterables.any(list, CardPredicates.Presets.LANDS);
} }
/** /**
* <p> * <p>
* hasBloodthirst. * hasBloodthirst.
@@ -2340,7 +2350,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
} }
return false; return false;
} }
/** /**
* <p> * <p>
* getBloodthirstAmount. * getBloodthirstAmount.
@@ -2727,17 +2737,17 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
if (subtractedHash == 0) { if (subtractedHash == 0) {
return 0; return 0;
} }
return Math.abs(subtractedHash)/subtractedHash; return Math.abs(subtractedHash) / subtractedHash;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int hashCode() { public int hashCode() {
return (41 * (41 + this.getName().hashCode())); return (41 * (41 + this.getName().hashCode()));
} }
public static class Predicates { public static class Predicates {
public static final Predicate<Player> NOT_LOST = new Predicate<Player>() { public static final Predicate<Player> NOT_LOST = new Predicate<Player>() {
@Override @Override
@@ -2749,44 +2759,44 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public static Predicate<Player> isType(final PlayerType type) { public static Predicate<Player> isType(final PlayerType type) {
return new Predicate<Player>() { return new Predicate<Player>() {
@Override @Override
public boolean apply(Player input){ public boolean apply(Player input) {
return input.getType() == type; return input.getType() == type;
} }
}; };
} }
} }
public static class Accessors { public static class Accessors {
public static Function<Player, LobbyPlayer> FN_GET_LOBBY_PLAYER = new Function<Player, LobbyPlayer>(){ public static Function<Player, LobbyPlayer> FN_GET_LOBBY_PLAYER = new Function<Player, LobbyPlayer>() {
@Override @Override
public LobbyPlayer apply(Player input) { public LobbyPlayer apply(Player input) {
return input.getLobbyPlayer(); return input.getLobbyPlayer();
} }
}; };
public static Function<Player, Integer> FN_GET_LIFE = new Function<Player, Integer>(){ public static Function<Player, Integer> FN_GET_LIFE = new Function<Player, Integer>() {
@Override @Override
public Integer apply(Player input) { public Integer apply(Player input) {
return input.getLife(); return input.getLife();
} }
}; };
public static Function<Player, PlayerType> FN_GET_TYPE = new Function<Player, PlayerType>(){ public static Function<Player, PlayerType> FN_GET_TYPE = new Function<Player, PlayerType>() {
@Override @Override
public PlayerType apply(Player input) { public PlayerType apply(Player input) {
return input.getType(); return input.getType();
} }
}; };
public static Function<Player, String> FN_GET_NAME = new Function<Player, String>(){ public static Function<Player, String> FN_GET_NAME = new Function<Player, String>() {
@Override @Override
public String apply(Player input) { public String apply(Player input) {
return input.getName(); return input.getName();
} }
}; };
public static Function<Player, Integer> countCardsInZone(final ZoneType zone){ public static Function<Player, Integer> countCardsInZone(final ZoneType zone) {
return new Function<Player, Integer>(){ return new Function<Player, Integer>() {
@Override @Override
public Integer apply(Player input) { public Integer apply(Player input) {
return input.getZone(zone).size(); return input.getZone(zone).size();
@@ -2804,15 +2814,17 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
} }
private void setOutcome(PlayerOutcome outcome) { private void setOutcome(PlayerOutcome outcome) {
stats.setOutcome(outcome); stats.setOutcome(outcome);
} }
/** /**
* 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!
}
} }
/** /**
@@ -2840,7 +2852,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
return Iterables.any(getZone(ZoneType.Battlefield), CardPredicates.nameEquals(cardName)); return Iterables.any(getZone(ZoneType.Battlefield), CardPredicates.nameEquals(cardName));
} }
public List<Card> getColoredCardsInPlay(final String color) { public List<Card> getColoredCardsInPlay(final String color) {
return CardLists.filter(getCardsIn(ZoneType.Battlefield), new Predicate<Card>() { return CardLists.filter(getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
@Override @Override
@@ -2852,12 +2864,12 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
public int getCounterDoublersMagnitude(final CounterType type) { public int getCounterDoublersMagnitude(final CounterType type) {
int counterDoublers = getCardsIn(ZoneType.Battlefield, "Doubling Season").size(); int counterDoublers = getCardsIn(ZoneType.Battlefield, "Doubling Season").size();
if(type == CounterType.P1P1) { if (type == CounterType.P1P1) {
counterDoublers += getCardsIn(ZoneType.Battlefield, "Corpsejack Menace").size(); counterDoublers += getCardsIn(ZoneType.Battlefield, "Corpsejack Menace").size();
} }
return 1 << counterDoublers; return 1 << counterDoublers;
} }
public int getTokenDoublersMagnitude() { public int getTokenDoublersMagnitude() {
final int tokenDoublers = getCardsIn(ZoneType.Battlefield, "Parallel Lives").size() final int tokenDoublers = getCardsIn(ZoneType.Battlefield, "Parallel Lives").size()
+ getCardsIn(ZoneType.Battlefield, "Doubling Season").size(); + getCardsIn(ZoneType.Battlefield, "Doubling Season").size();
@@ -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);
@@ -2880,8 +2892,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
PhaseHandler now = game.getPhaseHandler(); PhaseHandler now = game.getPhaseHandler();
return now.isPlayerTurn(this) && now.getPhase().isMain() && game.getStack().size() == 0; return now.isPlayerTurn(this) && now.getPhase().isMain() && game.getStack().size() == 0;
} }
/** /**
* <p> * <p>
* couldCastSorcery. * couldCastSorcery.
@@ -2905,7 +2917,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
//System.out.println("StackCard: " + card + " vs SourceCard: " + source); //System.out.println("StackCard: " + card + " vs SourceCard: " + source);
} }
} }
PhaseHandler now = game.getPhaseHandler(); PhaseHandler now = game.getPhaseHandler();
//System.out.println("now.isPlayerTurn(player) - " + now.isPlayerTurn(player)); //System.out.println("now.isPlayerTurn(player) - " + now.isPlayerTurn(player));
//System.out.println("now.getPhase().isMain() - " + now.getPhase().isMain()); //System.out.println("now.getPhase().isMain() - " + now.getPhase().isMain());
@@ -2929,7 +2941,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* @return a boolean. * @return a boolean.
*/ */
public boolean isSkippingCombat() { public boolean isSkippingCombat() {
if (hasKeyword("Skip your next combat phase.")) { if (hasKeyword("Skip your next combat phase.")) {
return true; return true;
} }
@@ -2944,7 +2956,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
if (hasKeyword("Skip all combat phases of this turn.")) { if (hasKeyword("Skip all combat phases of this turn.")) {
return true; return true;
} }
return false; return false;
} }
@@ -2959,10 +2971,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
// time vault: // time vault:
List<Card> vaults = getCardsIn(ZoneType.Battlefield, "Time Vault"); List<Card> vaults = getCardsIn(ZoneType.Battlefield, "Time Vault");
vaults = CardLists.filter(vaults, Presets.TAPPED); vaults = CardLists.filter(vaults, Presets.TAPPED);
if (vaults.size() > 0) { if (vaults.size() > 0) {
final Card crd = vaults.get(0); final Card crd = vaults.get(0);
if (isHuman()) { if (isHuman()) {
if (GameActionUtil.showYesNoDialog(crd, "Untap " + crd + "?")) { if (GameActionUtil.showYesNoDialog(crd, "Untap " + crd + "?")) {
crd.untap(); crd.untap();
@@ -2981,10 +2993,11 @@ 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();
} }
} }

View File

@@ -12,10 +12,10 @@ import forge.gui.match.CMatchUI;
*/ */
public class PlayerController { public class PlayerController {
// Should keep some 'Model' of player here. // Should keep some 'Model' of player here.
// Yet I have little idea of what is model now. // Yet I have little idea of what is model now.
private final Player player; private final Player player;
private PhaseType autoPassUntil = null; private PhaseType autoPassUntil = null;
private ComputerAIInput aiInput; private ComputerAIInput aiInput;
@@ -38,14 +38,14 @@ public class PlayerController {
public void autoPassCancel() { public void autoPassCancel() {
autoPassUntil = null; autoPassUntil = null;
} }
public boolean mayAutoPass(PhaseType phase) public boolean mayAutoPass(PhaseType phase) {
{
return phase.isBefore(autoPassUntil); return phase.isBefore(autoPassUntil);
} }
public boolean isUiSetToSkipPhase(final Player turn, final PhaseType phase) { public boolean isUiSetToSkipPhase(final Player turn, final PhaseType phase) {
return player.equals(Singletons.getControl().getPlayer()) && !CMatchUI.SINGLETON_INSTANCE.stopAtPhase(turn, phase); return player.equals(Singletons.getControl().getPlayer()) && !CMatchUI.SINGLETON_INSTANCE.stopAtPhase(turn, phase);
} }
@@ -55,10 +55,7 @@ public class PlayerController {
* @param computerAIInput * @param computerAIInput
*/ */
public void setAiInput(ComputerAIInput computerAIInput) { public void setAiInput(ComputerAIInput computerAIInput) {
aiInput = computerAIInput; aiInput = computerAIInput;
} }
} }

View File

@@ -12,9 +12,9 @@ public class PlayerOutcome {
public final GameLossReason lossState; public final GameLossReason lossState;
/** The lose condition spell. */ /** The lose condition spell. */
public final String loseConditionSpell; public final String loseConditionSpell;
private PlayerOutcome(String altWinSourceName, GameLossReason lossState, String loseConditionSpell) { private PlayerOutcome(String altWinSourceName, GameLossReason lossState, String loseConditionSpell) {
this.altWinSourceName= altWinSourceName; this.altWinSourceName = altWinSourceName;
this.loseConditionSpell = loseConditionSpell; this.loseConditionSpell = loseConditionSpell;
this.lossState = lossState; this.lossState = lossState;
} }
@@ -26,8 +26,8 @@ public class PlayerOutcome {
*/ */
public static PlayerOutcome win() { public static PlayerOutcome win() {
return new PlayerOutcome(null, null, null); return new PlayerOutcome(null, null, null);
} }
public static PlayerOutcome altWin(String sourceName) { public static PlayerOutcome altWin(String sourceName) {
return new PlayerOutcome(sourceName, null, null); return new PlayerOutcome(sourceName, null, null);
} }
@@ -49,9 +49,9 @@ public class PlayerOutcome {
public static PlayerOutcome concede() { public static PlayerOutcome concede() {
return new PlayerOutcome(null, GameLossReason.Conceded, null); return new PlayerOutcome(null, GameLossReason.Conceded, null);
} }
public boolean hasWon() { public boolean hasWon() {
return lossState == null; return lossState == null;
} }
} }

View File

@@ -32,7 +32,7 @@ public class PlayerStatistics {
private int turnsPlayed = 0; private int turnsPlayed = 0;
private PlayerOutcome outcome; private PlayerOutcome outcome;
/** /**
@@ -75,7 +75,7 @@ public class PlayerStatistics {
} }
public void nextTurn() { public void nextTurn() {
this.turnsPlayed++; this.turnsPlayed++;
} }
public PlayerOutcome getOutcome() { public PlayerOutcome getOutcome() {
@@ -83,7 +83,7 @@ public class PlayerStatistics {
} }
public void setOutcome(PlayerOutcome gameOutcome) { public void setOutcome(PlayerOutcome gameOutcome) {
this.outcome = gameOutcome; this.outcome = gameOutcome;
} }
} }