mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Added support for mixing targets in test framework
This commit is contained in:
parent
b3b0d25af7
commit
92a9c10c16
1 changed files with 20 additions and 7 deletions
|
|
@ -226,14 +226,26 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
||||||
else if (group.startsWith("target=")) {
|
else if (group.startsWith("target=")) {
|
||||||
target = group.substring(group.indexOf("target=") + 7);
|
target = group.substring(group.indexOf("target=") + 7);
|
||||||
String[] targets = target.split("\\^");
|
String[] targets = target.split("\\^");
|
||||||
|
int index = 0;
|
||||||
for (String t: targets) {
|
for (String t: targets) {
|
||||||
|
if (t.startsWith("targetPlayer=")) {
|
||||||
|
target = t.substring(t.indexOf("targetPlayer=") + 13);
|
||||||
|
for (Player player: game.getPlayers().values()) {
|
||||||
|
if (player.getName().equals(target)) {
|
||||||
|
ability.getTargets().get(index).addTarget(player.getId(), ability, game);
|
||||||
|
index++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
||||||
MageObject object = game.getObject(id);
|
MageObject object = game.getObject(id);
|
||||||
if (object != null && object.getName().equals(t)) {
|
if (object != null && object.getName().equals(t)) {
|
||||||
if (ability.getTargets().get(0).getNumberOfTargets() == 1) {
|
if (ability.getTargets().get(index).getNumberOfTargets() == 1) {
|
||||||
ability.getTargets().get(0).clearChosen();
|
ability.getTargets().get(index).clearChosen();
|
||||||
}
|
}
|
||||||
ability.getTargets().get(0).addTarget(id, ability, game);
|
ability.getTargets().get(index).addTarget(id, ability, game);
|
||||||
|
index++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -241,5 +253,6 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue