mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Fixed that computer player could discard cards that did not match the given filter (to pay e.g. discard costs of Mox Diamond - fixes #7028).
This commit is contained in:
parent
61315ec741
commit
668a21fc18
1 changed files with 12 additions and 12 deletions
|
@ -512,10 +512,10 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|| target.getOriginalTarget() instanceof TargetCardInHand) {
|
||||
if (outcome.isGood()) {
|
||||
// good
|
||||
Cards cards = new CardsImpl(target.possibleTargets(sourceId, getId(), game));
|
||||
Cards cards = new CardsImpl(possibleTargets);
|
||||
List<Card> cardsInHand = new ArrayList<>(cards.getCards(game));
|
||||
while (!target.isChosen()
|
||||
&& !target.possibleTargets(sourceId, getId(), game).isEmpty()
|
||||
&& !cardsInHand.isEmpty()
|
||||
&& target.getMaxNumberOfTargets() > target.getTargets().size()) {
|
||||
Card card = pickBestCard(cardsInHand, null, target, source, game);
|
||||
if (card != null) {
|
||||
|
@ -531,20 +531,20 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
} else {
|
||||
// bad
|
||||
findPlayables(game);
|
||||
if (!unplayable.isEmpty()) {
|
||||
for (int i = unplayable.size() - 1; i >= 0; i--) {
|
||||
if (target.canTarget(abilityControllerId, unplayable.values().toArray(new Card[0])[i].getId(), source, game)) {
|
||||
target.addTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game);
|
||||
for (Card card : unplayable.values()) {
|
||||
if (possibleTargets.contains(card.getId())
|
||||
&& target.canTarget(abilityControllerId, card.getId(), source, game)) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
if (target.isChosen()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hand.isEmpty()) {
|
||||
for (int i = 0; i < hand.size(); i++) {
|
||||
if (target.canTarget(abilityControllerId, hand.toArray(new UUID[0])[i], source, game)) {
|
||||
target.addTarget(hand.toArray(new UUID[0])[i], source, game);
|
||||
for (Card card : hand.getCards(game)) {
|
||||
if (possibleTargets.contains(card.getId())
|
||||
&& target.canTarget(abilityControllerId, card.getId(), source, game)) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
if (target.isChosen()) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue