mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixes issue 19.
This commit is contained in:
parent
efe55aff76
commit
f929d79b24
2 changed files with 22 additions and 1 deletions
|
@ -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<UUID, CardView> {
|
|||
// }
|
||||
// }
|
||||
|
||||
public CardsView ( Collection<? extends Ability> 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<? extends Ability> abilities, GameState state) {
|
||||
for (Ability ability: abilities) {
|
||||
Card sourceCard = state.getPermanent(ability.getSourceId());
|
||||
|
|
|
@ -343,7 +343,7 @@ public class GameController implements GameCallback {
|
|||
|
||||
private synchronized void target(UUID playerId, String question, Collection<? extends Ability> 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue