* Fixed a problem with selecting cards from other players hand, failing because canTarget check with wrong player id. Changed/simplified canTarget method of TargetCardInHand to solve that problem. (#6532 Gruesome Discovery and Distended Mindbender and probably other changed made with 75577cdbe9).

This commit is contained in:
LevelX2 2020-05-27 13:59:16 +02:00
parent d8bb67cffe
commit e1c96efa1e
2 changed files with 45 additions and 2 deletions

View file

@ -41,8 +41,10 @@ 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 != null ? source.getSourceId() : null, playerId, game);
// Has to be a card in the hand of a player in range. We don't know here, from which player's hand so we have to check all possible players
// And because a card in hand is never targeted we can omitt specific targeting related checks
return game.getState().getZone(id) == Zone.HAND
&& game.getState().getPlayersInRange(getTargetController() == null ? playerId : getTargetController(), game).contains(game.getOwnerId(id));
}
@Override