mirror of
https://github.com/correl/mage.git
synced 2025-04-07 17:00:08 -09:00
Fixed Issue 271
This commit is contained in:
parent
cb51589293
commit
b3ac9c2f87
3 changed files with 14 additions and 11 deletions
Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human
Mage.Server/plugins
Mage.Sets/src/mage/sets/worldwake
|
@ -247,11 +247,10 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
|||
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<UUID> 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);
|
||||
|
|
Binary file not shown.
|
@ -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<T extends TargetCreaturePermanent<T>> 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<T extends TargetCreaturePermanent<T>> extends TargetPer
|
|||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||
// 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue