mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Cleanup and NPE protection.
This commit is contained in:
@@ -110,6 +110,7 @@ public class GameCopier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (newSa != null) {
|
||||||
newSa.setActivatingPlayer(map.map(origSa.getActivatingPlayer()));
|
newSa.setActivatingPlayer(map.map(origSa.getActivatingPlayer()));
|
||||||
if (origSa.usesTargeting()) {
|
if (origSa.usesTargeting()) {
|
||||||
for (GameObject o : origSa.getTargets().getTargets()) {
|
for (GameObject o : origSa.getTargets().getTargets()) {
|
||||||
@@ -119,6 +120,7 @@ public class GameCopier {
|
|||||||
newGame.getStack().add(newSa);
|
newGame.getStack().add(newSa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private RegisteredPlayer clonePlayer(RegisteredPlayer p) {
|
private RegisteredPlayer clonePlayer(RegisteredPlayer p) {
|
||||||
RegisteredPlayer clone = new RegisteredPlayer(p.getDeck());
|
RegisteredPlayer clone = new RegisteredPlayer(p.getDeck());
|
||||||
|
|||||||
@@ -162,13 +162,8 @@ public class GameSimulator {
|
|||||||
return Integer.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
// TODO: Support multiple opponents.
|
// TODO: Support multiple opponents.
|
||||||
Player opponent = null;
|
Player opponent = aiPlayer.getOpponent();
|
||||||
for (Player p : simGame.getPlayers()) {
|
|
||||||
if (p != aiPlayer) {
|
|
||||||
opponent = p;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resolveStack(simGame, opponent);
|
resolveStack(simGame, opponent);
|
||||||
|
|
||||||
// TODO: If this is during combat, before blockers are declared,
|
// TODO: If this is during combat, before blockers are declared,
|
||||||
|
|||||||
@@ -1407,20 +1407,18 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Power Play - Each player with a Power Play in the CommandZone becomes the Starting Player
|
// Power Play - Each player with a Power Play in the CommandZone becomes the Starting Player
|
||||||
CardCollectionView commandCards = game.getCardsIn(ZoneType.Command);
|
|
||||||
if (commandCards.size() > 0) {
|
|
||||||
CardCollection powerPlays = CardLists.getValidCards(commandCards, "Card.namedPower Play", game.getPlayers().getFirst(), commandCards.getFirst());
|
|
||||||
Set<Player> powerPlayers = new HashSet<>();
|
Set<Player> powerPlayers = new HashSet<>();
|
||||||
for (Card c : powerPlays) {
|
for (Card c : game.getCardsIn(ZoneType.Command)) {
|
||||||
|
if (c.getName().equals("Power Play")) {
|
||||||
powerPlayers.add(c.getOwner());
|
powerPlayers.add(c.getOwner());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (powerPlayers.size() > 0) {
|
if (!powerPlayers.isEmpty()) {
|
||||||
ArrayList<Player> players = Lists.newArrayList(powerPlayers);
|
ArrayList<Player> players = Lists.newArrayList(powerPlayers);
|
||||||
Collections.shuffle(players);
|
Collections.shuffle(players);
|
||||||
return players.get(0);
|
return players.get(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
boolean isFirstGame = lastGameOutcome == null;
|
boolean isFirstGame = lastGameOutcome == null;
|
||||||
if (isFirstGame) {
|
if (isFirstGame) {
|
||||||
|
|||||||
Reference in New Issue
Block a user