mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Prevent race condition when selecting multiple abilities using Shift+click
This commit is contained in:
@@ -19,6 +19,7 @@ package forge.game.phase;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.*;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
@@ -881,7 +882,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventPlayerPriority(playerTurn, phase, getPriorityPlayer()));
|
||||
SpellAbility chosenSa = null;
|
||||
List<SpellAbility> chosenSa = null;
|
||||
|
||||
int loopCount = 0;
|
||||
do {
|
||||
@@ -913,7 +914,9 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
System.out.print("... " + pPlayerPriority + " plays " + chosenSa);
|
||||
}
|
||||
pFirstPriority = pPlayerPriority; // all opponents have to pass before stack is allowed to resolve
|
||||
pPlayerPriority.getController().playChosenSpellAbility(chosenSa);
|
||||
for (SpellAbility sa : chosenSa) {
|
||||
pPlayerPriority.getController().playChosenSpellAbility(sa);
|
||||
}
|
||||
loopCount++;
|
||||
} while (chosenSa != null && (loopCount < 999 || !pPlayerPriority.getController().isAI()));
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ public abstract class PlayerController {
|
||||
|
||||
public abstract void declareAttackers(Player attacker, Combat combat);
|
||||
public abstract void declareBlockers(Player defender, Combat combat);
|
||||
public abstract SpellAbility chooseSpellAbilityToPlay();
|
||||
public abstract List<SpellAbility> chooseSpellAbilityToPlay();
|
||||
public abstract void playChosenSpellAbility(SpellAbility sa);
|
||||
|
||||
public abstract CardCollection chooseCardsToDiscardToMaximumHandSize(int numDiscard);
|
||||
|
||||
@@ -130,7 +130,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
ability.setHostCard(game.getAction().moveToStack(source));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Always add the ability here and always unfreeze the stack
|
||||
add(ability);
|
||||
unfreezeStack();
|
||||
|
||||
Reference in New Issue
Block a user