mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
* Fixed that library selections could not be deslected if multiple cards have to be selected.
This commit is contained in:
parent
e5da40976c
commit
8849538723
2 changed files with 22 additions and 6 deletions
|
@ -432,13 +432,29 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (target.getTargets().size() >= target.getNumberOfTargets()) {
|
||||
required = false;
|
||||
}
|
||||
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, required, getOptions(target, null));
|
||||
Map<String, Serializable> options = getOptions(target, null);
|
||||
List<UUID> chosen = target.getTargets();
|
||||
options.put("chosen", (Serializable)chosen);
|
||||
List<UUID> choosable = new ArrayList<>();
|
||||
for (UUID cardId : cards) {
|
||||
if (target.canTarget(cardId, cards, game)) {
|
||||
choosable.add(cardId);
|
||||
}
|
||||
}
|
||||
if (!choosable.isEmpty()) {
|
||||
options.put("choosable", (Serializable) choosable);
|
||||
}
|
||||
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, required, options);
|
||||
waitForResponse(game);
|
||||
if (response.getUUID() != null) {
|
||||
if (target.canTarget(response.getUUID(), cards, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if(target.doneChosing()){
|
||||
return true;
|
||||
if (target.getTargets().contains(response.getUUID())) { // if already included remove it
|
||||
target.remove(response.getUUID());
|
||||
} else {
|
||||
if (target.canTarget(response.getUUID(), cards, game)) {
|
||||
target.addTarget(response.getUUID(), source, game);
|
||||
if (target.doneChosing()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TargetCardInLibrary extends TargetCard {
|
|||
Collections.sort(cards, new CardNameComparator());
|
||||
while (!isChosen() && !doneChosing()) {
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
if (!player.choose(outcome, new CardsImpl(Zone.LIBRARY, cards), this, game)) {
|
||||
if (!player.chooseTarget(outcome, new CardsImpl(Zone.LIBRARY, cards), this, null, game)) {
|
||||
return chosen;
|
||||
}
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
|
|
Loading…
Reference in a new issue