* Fixed player target handling of TargetPermanentOrPlayer.java (fixes Shalai + Burning Sun's Avatar #5252 problem).

This commit is contained in:
LevelX2 2019-01-05 17:00:31 +01:00
parent 7848c78563
commit 285beab3a2

View file

@ -1,4 +1,3 @@
package mage.target.common; package mage.target.common;
import java.util.HashSet; import java.util.HashSet;
@ -99,7 +98,8 @@ public class TargetPermanentOrPlayer extends TargetImpl {
} }
if (player != null) { if (player != null) {
if (!isNotTarget()) { 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; return false;
} }
} }
@ -130,7 +130,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
MageObject targetSource = game.getObject(sourceId); MageObject targetSource = game.getObject(sourceId);
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId); 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++; count++;
if (count >= this.minNumberOfTargets) { if (count >= this.minNumberOfTargets) {
return true; return true;
@ -163,7 +163,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
int count = 0; int count = 0;
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null && filter.match(player, game)) { if (player != null && filter.getPlayerFilter().match(player, game)) {
count++; count++;
if (count >= this.minNumberOfTargets) { if (count >= this.minNumberOfTargets) {
return true; return true;
@ -187,7 +187,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
MageObject targetSource = game.getObject(sourceId); MageObject targetSource = game.getObject(sourceId);
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId); 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); possibleTargets.add(playerId);
} }
} }
@ -204,7 +204,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
Set<UUID> possibleTargets = new HashSet<>(); Set<UUID> possibleTargets = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null && filter.match(player, game)) { if (player != null && filter.getPlayerFilter().match(player, game)) {
possibleTargets.add(playerId); possibleTargets.add(playerId);
} }
} }