mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* 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:
parent
f2bb7470cf
commit
a6662b5dcc
1 changed files with 34 additions and 23 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue