mirror of
https://github.com/correl/mage.git
synced 2025-04-02 03:18:09 -09:00
Added for computer player missing handling of choosing TargetCardInGraveyard. This fixes issue #57.
This commit is contained in:
parent
fcd24572dd
commit
e96203b10b
1 changed files with 19 additions and 1 deletions
|
@ -285,7 +285,25 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
if (!target.isRequired())
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
if (target instanceof TargetCardInGraveyard) {
|
||||
List<Card> cards = new ArrayList<Card>();
|
||||
for (Player player: game.getPlayers().values()) {
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
if (target.canTarget(card.getId(), game)) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Card card: cards) {
|
||||
target.add(card.getId(), game);
|
||||
if (target.isChosen()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return target.isChosen();
|
||||
}
|
||||
throw new IllegalStateException("Target wasn't handled. class:" + target.getClass().toString());
|
||||
// return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue