* Choose card in hand - fixed rollback error for some cards like Nicol Bolas, Dragon-God;

This commit is contained in:
Oleg Agafonov 2020-01-11 08:47:54 +04:00
parent a9c3206026
commit 5f5d9046f9
2 changed files with 39 additions and 39 deletions

View file

@ -1,7 +1,5 @@
package mage.players;
import java.io.Serializable;
import java.util.*;
import mage.MageItem;
import mage.MageObject;
import mage.MageObjectReference;
@ -40,6 +38,9 @@ import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import mage.util.Copyable;
import java.io.Serializable;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -506,7 +507,7 @@ public interface Player extends MageItem, Copyable<Player> {
boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map<String, Serializable> options);
boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game);
boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game); // TODO: remove to use choose with "Ability source"
boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game);

View file

@ -1,9 +1,5 @@
package mage.target.common;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.constants.Zone;
@ -13,8 +9,11 @@ import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TargetCardInHand extends TargetCard {
@ -43,7 +42,7 @@ public class TargetCardInHand extends TargetCard {
@Override
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
Card card = game.getPlayer(playerId).getHand().get(id, game);
return card != null && filter.match(card, source.getSourceId(), playerId, game);
return card != null && filter.match(card, source != null ? source.getSourceId() : null, playerId, game);
}
@Override