* GUI: face down cards improved:

* now it show face up cards in game logs on game end;
 * now it show face up cards in battlefield on game end (#4635);
 * fixed that real card face was visible in network data;
This commit is contained in:
Oleg Agafonov 2023-04-01 18:39:38 +04:00
parent 6017f35517
commit 4bf3e43da6
4 changed files with 131 additions and 22 deletions

View file

@ -675,8 +675,8 @@ public abstract class GameImpl implements Game {
spell = (Spell) obj;
} else if (obj != null) {
logger.error(String.format(
"getSpellOrLKIStack got non-spell id %s correlating to non-spell object %s.",
obj.getClass().getName(), obj.getName()),
"getSpellOrLKIStack got non-spell id %s correlating to non-spell object %s.",
obj.getClass().getName(), obj.getName()),
new Throwable()
);
}
@ -1398,6 +1398,27 @@ public abstract class GameImpl implements Game {
logger.debug("END of gameId: " + this.getId());
endTime = new Date();
state.endGame();
// inform players about face down cards
state.getBattlefield().getAllPermanents()
.stream()
.filter(permanent -> permanent.isFaceDown(this))
.map(permanent -> {
Player player = this.getPlayer(permanent.getControllerId());
Card card = permanent.getMainCard();
if (card != null) {
return String.format("Face down card reveal: %s had %s",
(player == null ? "Unknown" : player.getLogName()),
permanent.getLogName());
} else {
return null;
}
})
.filter(Objects::nonNull)
.sorted()
.forEach(this::informPlayers);
// cancel all player dialogs/feedbacks
for (Player player : state.getPlayers().values()) {
player.abort();
}