diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index bd0265c0593..7061782f75d 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -247,11 +247,10 @@ public class HumanPlayer extends PlayerImpl { public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) { game.getState().setPriorityPlayerId(getId()); while (!abort) { - game.fireSelectTargetEvent(playerId, target.getMessage(), - target.possibleTargets(source==null?null:source.getId(), playerId, game), - target.isRequired(), getOptions(target)); + Set possibleTargets = target.possibleTargets(source==null?null:source.getId(), playerId, game); + game.fireSelectTargetEvent(playerId, target.getMessage(), possibleTargets, target.isRequired(), getOptions(target)); waitForResponse(); - if (response.getUUID() != null) { + if (response.getUUID() != null && possibleTargets.contains(response.getUUID())) { if (target instanceof TargetPermanent) { if (((TargetPermanent)target).canTarget(playerId, response.getUUID(), source, game)) { target.addTarget(response.getUUID(), source, game); diff --git a/Mage.Server/plugins/mage-player-human.jar b/Mage.Server/plugins/mage-player-human.jar index 19b42be602c..e508df5b877 100644 Binary files a/Mage.Server/plugins/mage-player-human.jar and b/Mage.Server/plugins/mage-player-human.jar differ diff --git a/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java b/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java index e57969ed98e..30362d51535 100644 --- a/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java +++ b/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java @@ -35,6 +35,7 @@ import mage.Constants.CardType; import mage.Constants.Outcome; import mage.Constants.Rarity; import mage.Constants.Zone; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; @@ -44,6 +45,7 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; +import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.TargetPlayer; @@ -167,7 +169,7 @@ class SearingBlazeTarget> extends TargetPer public boolean canTarget(UUID id, Ability source, Game game) { UUID firstTarget = source.getFirstTarget(); Permanent permanent = game.getPermanent(id); - if (firstTarget != null && permanent != null && !permanent.getControllerId().equals(firstTarget)) { + if (firstTarget != null && permanent != null && permanent.getControllerId().equals(firstTarget)) { return super.canTarget(id, source, game); } return false; @@ -177,12 +179,14 @@ class SearingBlazeTarget> extends TargetPer public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set possibleTargets = new HashSet(); - // TODO: sourceId is the Id of an Ability; at the time this is passed the first target is selected but the call below return null - UUID playerId = game.getObject(sourceId).getAbilities().get(0).getFirstTarget(); - for (UUID targetId : availablePossibleTargets) { - Permanent permanent = game.getPermanent(targetId); - if(permanent != null && permanent.getControllerId().equals(playerId)){ - possibleTargets.add(targetId); + MageObject object = game.getObject(sourceId); + if (object instanceof StackObject) { + UUID playerId = ((StackObject)object).getStackAbility().getFirstTarget(); + for (UUID targetId : availablePossibleTargets) { + Permanent permanent = game.getPermanent(targetId); + if(permanent != null && permanent.getControllerId().equals(playerId)){ + possibleTargets.add(targetId); + } } } return possibleTargets;