mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Cleanup and NPE protection.
This commit is contained in:
@@ -1407,19 +1407,17 @@ public class GameAction {
|
||||
}
|
||||
|
||||
// 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<>();
|
||||
for (Card c : powerPlays) {
|
||||
powerPlayers.add(c.getOwner());
|
||||
}
|
||||
Set<Player> powerPlayers = new HashSet<>();
|
||||
for (Card c : game.getCardsIn(ZoneType.Command)) {
|
||||
if (c.getName().equals("Power Play")) {
|
||||
powerPlayers.add(c.getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
if (powerPlayers.size() > 0) {
|
||||
ArrayList<Player> players = Lists.newArrayList(powerPlayers);
|
||||
Collections.shuffle(players);
|
||||
return players.get(0);
|
||||
}
|
||||
if (!powerPlayers.isEmpty()) {
|
||||
ArrayList<Player> players = Lists.newArrayList(powerPlayers);
|
||||
Collections.shuffle(players);
|
||||
return players.get(0);
|
||||
}
|
||||
|
||||
boolean isFirstGame = lastGameOutcome == null;
|
||||
|
||||
Reference in New Issue
Block a user