From 285beab3a24b78964eaf69c9a4880c5ab6ecec9f Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 5 Jan 2019 17:00:31 +0100 Subject: [PATCH] * Fixed player target handling of TargetPermanentOrPlayer.java (fixes Shalai + Burning Sun's Avatar #5252 problem). --- .../mage/target/common/TargetPermanentOrPlayer.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java index ac4156a25c..70dab46b02 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java @@ -1,4 +1,3 @@ - package mage.target.common; import java.util.HashSet; @@ -99,7 +98,8 @@ public class TargetPermanentOrPlayer extends TargetImpl { } if (player != null) { if (!isNotTarget()) { - if (!player.canBeTargetedBy(targetSource, source.getControllerId(), game)) { + if (!player.canBeTargetedBy(targetSource, source.getControllerId(), game) + || !filter.match(player, source.getSourceId(), source.getControllerId(), game)) { return false; } } @@ -130,7 +130,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { MageObject targetSource = game.getObject(sourceId); for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(player, game)) { + if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.getPlayerFilter().match(player, sourceId, sourceControllerId, game)) { count++; if (count >= this.minNumberOfTargets) { return true; @@ -163,7 +163,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { int count = 0; for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (player != null && filter.getPlayerFilter().match(player, game)) { count++; if (count >= this.minNumberOfTargets) { return true; @@ -187,7 +187,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { MageObject targetSource = game.getObject(sourceId); for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && (notTarget || player.canBeTargetedBy(targetSource, sourceControllerId, game)) && filter.match(player, game)) { + if (player != null && (notTarget || player.canBeTargetedBy(targetSource, sourceControllerId, game)) && filter.getPlayerFilter().match(player, sourceId, sourceControllerId, game)) { possibleTargets.add(playerId); } } @@ -204,7 +204,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { Set possibleTargets = new HashSet<>(); for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (player != null && filter.getPlayerFilter().match(player, game)) { possibleTargets.add(playerId); } }