* Spellskite - Fixed that target could wrongly not be changed to spellskite in some cases.

This commit is contained in:
LevelX2 2014-07-29 17:44:42 +02:00
parent 48f0437bc7
commit ea1a098300
7 changed files with 8 additions and 8 deletions

View file

@ -665,7 +665,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
card = pickWorstCard(cards, null, target, source, game);
}
if (source != null) {
if (target.canTarget(card.getId(), this.getId(), source, game)) {
if (target.canTarget(this.getId(), card.getId(), source, game)) {
return card;
}
}

View file

@ -293,7 +293,7 @@ public class HumanPlayer extends PlayerImpl {
return true;
}
}
} else if (target.canTarget(response.getUUID(), playerId, source, game)) {
} else if (target.canTarget(playerId, response.getUUID(), source, game)) {
target.addTarget(response.getUUID(), source, game);
if(target.doneChosing()){
return true;

View file

@ -109,7 +109,7 @@ class SpellskiteEffect extends OneShotEffect {
}
if (targets.size() == 1 && targets.get(0).getTargets().size() == 1) {
Target target = targets.get(0);
if (target.canTarget(source.getSourceId(), stackObject.getControllerId(), sourceAbility, game)) {
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
oldTarget = game.getObject(targets.getFirstTarget());
target.clearChosen();
target.add(source.getSourceId(), game);
@ -128,7 +128,7 @@ class SpellskiteEffect extends OneShotEffect {
name = object.getName();
}
if (name != null && player.chooseUse(Outcome.Neutral, new StringBuilder("Change target from ").append(name).append(" to ").append(sourceObject.getName()).append("?").toString(), game)) {
if (target.canTarget(source.getSourceId(), stackObject.getControllerId(), sourceAbility, game)) {
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
oldTarget = game.getObject(targets.getFirstTarget());
target.remove(targetId);
target.addTarget(source.getSourceId(), source, game);

View file

@ -66,7 +66,7 @@ public interface Target extends Serializable {
void addTarget(UUID id, int amount, Ability source, Game game, boolean skipEvent);
boolean canTarget(UUID id, Game game);
boolean canTarget(UUID id, Ability source, Game game);
boolean canTarget(UUID id, UUID playerId, Ability source, Game game);
boolean canTarget(UUID playerId, UUID id, Ability source, Game game);
boolean isLegal(Ability source, Game game);
List<? extends Target> getTargetOptions(Ability source, Game game);

View file

@ -90,7 +90,7 @@ public abstract class TargetObject extends TargetImpl {
}
@Override
public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) {
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
return canTarget(id, source, game);
}

View file

@ -78,7 +78,7 @@ public class TargetCardInHand extends TargetCard {
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
return this.canTarget(id, source.getControllerId(), source, game);
return this.canTarget(source.getControllerId(), id, source, game);
}
@Override

View file

@ -92,7 +92,7 @@ public class TargetCreatureOrPlayer extends TargetImpl {
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
return canTarget(null, id, source, game);
return canTarget(source.getControllerId(), id, source, game);
}
@Override