* Telepathy - Fixed that not the opponents hands were revealed (fixes #559).

This commit is contained in:
LevelX2 2014-09-11 08:15:01 +02:00
parent fb4876ddcd
commit ffb373b1fb
3 changed files with 22 additions and 12 deletions

View file

@ -36,6 +36,7 @@ import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
import mage.MageObject;
/**
*
@ -76,12 +77,13 @@ class OpponentsPlayWithTheTopCardRevealedEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (UUID opponentId : game.getOpponents(player.getId())) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null) {
for (UUID opponentId : game.getOpponents(controller.getId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
opponent.setTopCardRevealed(true);
controller.revealCards(sourceObject.getName() + " " + opponent.getName(), opponent.getHand(), game, false);
}
}
return true;

View file

@ -265,6 +265,7 @@ public interface Player extends MageItem, Copyable<Player> {
void resetStoredBookmark(Game game);
void revealCards(String name, Cards cards, Game game);
void revealCards(String name, Cards cards, Game game, boolean postToLog);
void lookAtCards(String name, Cards cards, Game game);
@Override

View file

@ -1116,17 +1116,24 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public void revealCards(String name, Cards cards, Game game) {
revealCards(name, cards, game, true);
}
@Override
public void revealCards(String name, Cards cards, Game game, boolean postToLog) {
game.getState().getRevealed().add(name, cards);
StringBuilder sb = new StringBuilder(this.getName()).append(" reveals ");
int current = 0, last = cards.size();
for (Card card :cards.getCards(game)) {
current++;
sb.append(card.getName());
if (current < last) {
sb.append(", ");
if (postToLog) {
StringBuilder sb = new StringBuilder(this.getName()).append(" reveals ");
int current = 0, last = cards.size();
for (Card card :cards.getCards(game)) {
current++;
sb.append(card.getName());
if (current < last) {
sb.append(", ");
}
}
game.informPlayers(sb.toString());
}
game.informPlayers(sb.toString());
}
@Override