mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
Some more fixed in choosing targets.
This commit is contained in:
parent
3cadbeb68b
commit
a81dde0cdb
2 changed files with 19 additions and 19 deletions
|
@ -252,32 +252,32 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
|||
game.getState().setPriorityPlayerId(getId());
|
||||
while (!abort) {
|
||||
Set<UUID> possibleTargets = target.possibleTargets(source==null?null:source.getId(), playerId, game);
|
||||
game.fireSelectTargetEvent(playerId, target.getMessage(), possibleTargets, target.isRequired(), getOptions(target));
|
||||
boolean required = possibleTargets.size() == 0 ? false : target.isRequired();
|
||||
game.fireSelectTargetEvent(playerId, target.getMessage(), possibleTargets, required, getOptions(target));
|
||||
waitForResponse();
|
||||
if (response.getUUID() != null && possibleTargets.contains(response.getUUID())) {
|
||||
if (target instanceof TargetPermanent) {
|
||||
if (((TargetPermanent)target).canTarget(playerId, response.getUUID(), source, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if(target.doneChosing()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (target.canTarget(response.getUUID(), source, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if(target.doneChosing()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (response.getUUID() != null) {
|
||||
if (possibleTargets.contains(response.getUUID())) {
|
||||
if (target instanceof TargetPermanent) {
|
||||
if (((TargetPermanent)target).canTarget(playerId, response.getUUID(), source, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if(target.doneChosing()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (target.canTarget(response.getUUID(), source, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if(target.doneChosing()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // else do nothing - allow to pick another target
|
||||
} else {
|
||||
if (target.getTargets().size() >= target.getNumberOfTargets()) {
|
||||
return true;
|
||||
}
|
||||
if (!target.isRequired()) {
|
||||
if (!required) {
|
||||
return false;
|
||||
}
|
||||
if (possibleTargets.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue