* Spellskite - Fixed a bug of log message. Fixed a bug that multiple targets from different target instances could be changed with one activation.

This commit is contained in:
LevelX2 2015-08-30 21:14:11 +02:00
parent f2bb7470cf
commit a6662b5dcc

View file

@ -120,7 +120,9 @@ class SpellskiteEffect extends OneShotEffect {
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
}
} else {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
boolean validTargets = false;
do {
for (Target target : targets) {
for (UUID targetId : target.getTargets()) {
MageObject object = game.getObject(targetId);
@ -136,9 +138,11 @@ class SpellskiteEffect extends OneShotEffect {
twoTimesTarget = true;
continue;
}
if (name != null && player.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) {
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
oldTarget = game.getObject(targets.getFirstTarget());
validTargets = true;
if (name != null
&& controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) {
oldTarget = game.getObject(targetId);
target.remove(targetId);
// The source is still the spell on the stack
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
@ -146,8 +150,15 @@ class SpellskiteEffect extends OneShotEffect {
}
}
}
if (oldTarget != null) {
break;
}
}
if (oldTarget == null) {
game.informPlayer(controller, "You have to select at least one target to change to spellskite!");
}
} while (validTargets && oldTarget == null);
}
if (oldTarget != null) {
game.informPlayers(sourceObject.getLogName() + ": Changed target of " + stackObject.getLogName() + " from " + oldTarget.getLogName() + " to " + sourceObject.getLogName());
} else {