diff --git a/Mage.Common/src/mage/view/CardsView.java b/Mage.Common/src/mage/view/CardsView.java index 021fb8bda6..8625ceb0a1 100644 --- a/Mage.Common/src/mage/view/CardsView.java +++ b/Mage.Common/src/mage/view/CardsView.java @@ -31,8 +31,10 @@ package mage.view; import java.util.Collection; import java.util.HashMap; import java.util.UUID; +import mage.Constants.Zone; import mage.abilities.Ability; import mage.cards.Card; +import mage.game.Game; import mage.game.GameState; /** @@ -57,6 +59,25 @@ public class CardsView extends HashMap { // } // } + public CardsView ( Collection abilities, Game game ) { + for ( Ability ability : abilities ) { + Card sourceCard = null; + String sourceName = null; + switch ( ability.getZone() ) { + case EXILED: + case GRAVEYARD: + sourceCard = game.getCard(ability.getSourceId()); + sourceName = sourceCard.getName(); + break; + case BATTLEFIELD: + sourceCard = game.getState().getPermanent(ability.getSourceId()); + sourceName = sourceCard.getName(); + break; + } + this.put(ability.getId(), new AbilityView(ability, sourceName, new CardView(sourceCard))); + } + } + public CardsView(Collection abilities, GameState state) { for (Ability ability: abilities) { Card sourceCard = state.getPermanent(ability.getSourceId()); diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 8cb0b38f69..33be4d2b80 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -343,7 +343,7 @@ public class GameController implements GameCallback { private synchronized void target(UUID playerId, String question, Collection abilities, boolean required) { if (gameSessions.containsKey(playerId)) - gameSessions.get(playerId).target(question, new CardsView(abilities, game.getState()), null, required, getGameView(playerId)); + gameSessions.get(playerId).target(question, new CardsView(abilities, game), null, required, getGameView(playerId)); informOthers(playerId); }