Changed ability handling of modal spells to be able to select the same mode multiple times with different targets.

This commit is contained in:
LevelX2 2015-11-14 01:56:56 +01:00
parent b18cae5100
commit 4711e0cf99
40 changed files with 488 additions and 421 deletions

View file

@ -1568,9 +1568,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return modes.getMode();
}
//TODO: improve this;
AvailableMode:
for (Mode mode : modes.getAvailableModes(source, game)) {
if (!modes.getSelectedModes().contains(mode.getId()) // select only modes not already selected
&& mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
for (Mode selectedMode : modes.getSelectedModes()) {
if (selectedMode.getId().equals(mode.getId())) {
continue AvailableMode;
}
}
if (mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
return mode;
}
}