mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
Merge fix
This commit is contained in:
parent
2eac541b80
commit
1af601bf11
3 changed files with 7 additions and 20 deletions
|
|
@ -27,10 +27,7 @@ import mage.players.Player;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -46,8 +43,8 @@ public class GameView implements Serializable {
|
|||
private UUID myPlayerId = null; // null for watcher
|
||||
private final CardsView myHand = new CardsView();
|
||||
private PlayableObjectsList canPlayObjects;
|
||||
private Map<String, SimpleCardsView> opponentHands;
|
||||
private Map<String, SimpleCardsView> watchedHands;
|
||||
private Map<String, SimpleCardsView> opponentHands = new HashMap<>();
|
||||
private Map<String, SimpleCardsView> watchedHands = new HashMap<>();
|
||||
private final CardsView stack = new CardsView();
|
||||
private final List<ExileView> exiles = new ArrayList<>();
|
||||
private final List<RevealedView> revealed = new ArrayList<>();
|
||||
|
|
@ -250,18 +247,10 @@ public class GameView implements Serializable {
|
|||
return opponentHands;
|
||||
}
|
||||
|
||||
public void setOpponentHands(Map<String, SimpleCardsView> opponentHands) {
|
||||
this.opponentHands = opponentHands;
|
||||
}
|
||||
|
||||
public Map<String, SimpleCardsView> getWatchedHands() {
|
||||
return watchedHands;
|
||||
}
|
||||
|
||||
public void setWatchedHands(Map<String, SimpleCardsView> watchedHands) {
|
||||
this.watchedHands = watchedHands;
|
||||
}
|
||||
|
||||
public TurnPhase getPhase() {
|
||||
return phase;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,13 +229,12 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
// ignore watcher
|
||||
return;
|
||||
}
|
||||
gameView.getOpponentHands().clear();
|
||||
if (!player.getPlayersUnderYourControl().isEmpty()) {
|
||||
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||
for (UUID controlledPlayerId : player.getPlayersUnderYourControl()) {
|
||||
Player opponent = game.getPlayer(controlledPlayerId);
|
||||
handCards.put(opponent.getName(), new SimpleCardsView(opponent.getHand().getCards(game), true));
|
||||
gameView.getOpponentHands().put(opponent.getName(), new SimpleCardsView(opponent.getHand().getCards(game), true));
|
||||
}
|
||||
gameView.setOpponentHands(handCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,11 +103,10 @@ public class GameSessionWatcher {
|
|||
}
|
||||
|
||||
protected static void processWatchedHands(Game game, UUID userId, GameView gameView) {
|
||||
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||
gameView.getWatchedHands().clear();
|
||||
for (Player player : game.getPlayers().values()) {
|
||||
if (player.hasUserPermissionToSeeHand(userId)) {
|
||||
handCards.put(player.getName(), new SimpleCardsView(player.getHand().getCards(game), true));
|
||||
gameView.setWatchedHands(handCards);
|
||||
gameView.getWatchedHands().put(player.getName(), new SimpleCardsView(player.getHand().getCards(game), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue