Skip to content

Commit

Permalink
* Fixed player target handling of TargetPermanentOrPlayer.java (fixes…
Browse files Browse the repository at this point in the history
… Shalai + Burning Sun's Avatar #5252 problem).
  • Loading branch information
LevelX2 committed Jan 5, 2019
1 parent 7848c78 commit 285beab
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package mage.target.common;

import java.util.HashSet;
Expand Down Expand Up @@ -99,7 +98,8 @@ public boolean canTarget(UUID id, Ability source, Game game) {
}
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;
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
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;
Expand Down Expand Up @@ -163,7 +163,7 @@ public boolean canChoose(UUID sourceControllerId, Game game) {
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;
Expand All @@ -187,7 +187,7 @@ public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game ga
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);
}
}
Expand All @@ -204,7 +204,7 @@ public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
Set<UUID> 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);
}
}
Expand Down

0 comments on commit 285beab

Please sign in to comment.