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,33 +120,44 @@ class SpellskiteEffect extends OneShotEffect {
|
||||||
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
for (Target target : targets) {
|
boolean validTargets = false;
|
||||||
for (UUID targetId : target.getTargets()) {
|
do {
|
||||||
MageObject object = game.getObject(targetId);
|
for (Target target : targets) {
|
||||||
String name;
|
for (UUID targetId : target.getTargets()) {
|
||||||
if (object == null) {
|
MageObject object = game.getObject(targetId);
|
||||||
Player targetPlayer = game.getPlayer(targetId);
|
String name;
|
||||||
name = targetPlayer.getLogName();
|
if (object == null) {
|
||||||
} else {
|
Player targetPlayer = game.getPlayer(targetId);
|
||||||
name = object.getLogName();
|
name = targetPlayer.getLogName();
|
||||||
}
|
} else {
|
||||||
if (!targetId.equals(source.getSourceId()) && target.getTargets().contains(source.getSourceId())) {
|
name = object.getLogName();
|
||||||
// you can't change this target to Spellskite because Spellskite is already another targetId of that target.
|
}
|
||||||
twoTimesTarget = true;
|
if (!targetId.equals(source.getSourceId()) && target.getTargets().contains(source.getSourceId())) {
|
||||||
continue;
|
// you can't change this target to Spellskite because Spellskite is already another targetId of that target.
|
||||||
}
|
twoTimesTarget = true;
|
||||||
if (name != null && player.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) {
|
continue;
|
||||||
|
}
|
||||||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
||||||
oldTarget = game.getObject(targets.getFirstTarget());
|
validTargets = true;
|
||||||
target.remove(targetId);
|
if (name != null
|
||||||
// The source is still the spell on the stack
|
&& controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) {
|
||||||
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
oldTarget = game.getObject(targetId);
|
||||||
break;
|
target.remove(targetId);
|
||||||
|
// The source is still the spell on the stack
|
||||||
|
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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) {
|
if (oldTarget != null) {
|
||||||
game.informPlayers(sourceObject.getLogName() + ": Changed target of " + stackObject.getLogName() + " from " + oldTarget.getLogName() + " to " + sourceObject.getLogName());
|
game.informPlayers(sourceObject.getLogName() + ": Changed target of " + stackObject.getLogName() + " from " + oldTarget.getLogName() + " to " + sourceObject.getLogName());
|
||||||
|
|
Loading…
Reference in a new issue