mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
* Fixed a bug that prevented players from paying costs during spell resolution (e.g. Mana Leak) - (fixes #3715).
This commit is contained in:
parent
a9e2303f7e
commit
878ba90625
2 changed files with 119 additions and 64 deletions
|
@ -140,7 +140,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (action.getString() != null
|
if (action.getString() != null
|
||||||
&& action.getString().equals("resolveStack")) {
|
&& action.getString().equals("resolveStack")) {
|
||||||
action = actionQueue.poll();
|
action = actionQueue.poll();
|
||||||
if (action == null) return false;
|
if (action == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, game, null);
|
sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, game, null);
|
||||||
}
|
}
|
||||||
synchronized (response) {
|
synchronized (response) {
|
||||||
|
@ -188,7 +190,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
Map<String, Serializable> options = new HashMap<>();
|
Map<String, Serializable> options = new HashMap<>();
|
||||||
options.put("UI.left.btn.text", "Mulligan");
|
options.put("UI.left.btn.text", "Mulligan");
|
||||||
options.put("UI.right.btn.text", "Keep");
|
options.put("UI.right.btn.text", "Keep");
|
||||||
if(!isExecutingMacro()) game.fireAskPlayerEvent(playerId, new MessageToClient(message), null, options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireAskPlayerEvent(playerId, new MessageToClient(message), null, options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getBoolean() == null && !abort);
|
} while (response.getBoolean() == null && !abort);
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
|
@ -228,7 +232,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (messageToClient.getSecondMessage() == null) {
|
if (messageToClient.getSecondMessage() == null) {
|
||||||
messageToClient.setSecondMessage(getRelatedObjectName(source, game));
|
messageToClient.setSecondMessage(getRelatedObjectName(source, game));
|
||||||
}
|
}
|
||||||
if(!isExecutingMacro()) game.fireAskPlayerEvent(playerId, messageToClient, source, options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireAskPlayerEvent(playerId, messageToClient, source, options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getBoolean() == null && !abort);
|
} while (response.getBoolean() == null && !abort);
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
|
@ -287,7 +293,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
replacementEffectChoice.setKeyChoices(rEffects);
|
replacementEffectChoice.setKeyChoices(rEffects);
|
||||||
|
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireChooseChoiceEvent(playerId, replacementEffectChoice);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireChooseChoiceEvent(playerId, replacementEffectChoice);
|
||||||
|
}
|
||||||
updateGameStatePriority("chooseEffect", game);
|
updateGameStatePriority("chooseEffect", game);
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
logger.debug("Choose effect: " + response.getString());
|
logger.debug("Choose effect: " + response.getString());
|
||||||
|
@ -322,7 +330,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
updateGameStatePriority("choose(3)", game);
|
updateGameStatePriority("choose(3)", game);
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireChooseChoiceEvent(playerId, choice);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireChooseChoiceEvent(playerId, choice);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getString() != null) {
|
if (response.getString() != null) {
|
||||||
choice.setChoice(response.getString());
|
choice.setChoice(response.getString());
|
||||||
|
@ -364,7 +374,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
List<UUID> chosen = target.getTargets();
|
List<UUID> chosen = target.getTargets();
|
||||||
options.put("chosen", (Serializable) chosen);
|
options.put("chosen", (Serializable) chosen);
|
||||||
|
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(sourceId, game)), targetIds, required, getOptions(target, options));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(sourceId, game)), targetIds, required, getOptions(target, options));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (!targetIds.contains(response.getUUID())) {
|
if (!targetIds.contains(response.getUUID())) {
|
||||||
|
@ -429,7 +441,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
required = false;
|
required = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), possibleTargets, required, getOptions(target, null));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), possibleTargets, required, getOptions(target, null));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (target.getTargets().contains(response.getUUID())) {
|
if (target.getTargets().contains(response.getUUID())) {
|
||||||
|
@ -497,7 +511,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
options.put("choosable", (Serializable) choosable);
|
options.put("choosable", (Serializable) choosable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage()), cards, required, options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage()), cards, required, options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (target.canTarget(response.getUUID(), cards, game)) {
|
if (target.canTarget(response.getUUID(), cards, game)) {
|
||||||
|
@ -556,7 +572,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (!choosable.isEmpty()) {
|
if (!choosable.isEmpty()) {
|
||||||
options.put("choosable", (Serializable) choosable);
|
options.put("choosable", (Serializable) choosable);
|
||||||
}
|
}
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), cards, required, options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), cards, required, options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (target.getTargets().contains(response.getUUID())) { // if already included remove it
|
if (target.getTargets().contains(response.getUUID())) { // if already included remove it
|
||||||
|
@ -583,10 +601,12 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
||||||
updateGameStatePriority("chooseTargetAmount", game);
|
updateGameStatePriority("chooseTargetAmount", game);
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage() + "\n Amount remaining:" + target.getAmountRemaining(), getRelatedObjectName(source, game)),
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage() + "\n Amount remaining:" + target.getAmountRemaining(), getRelatedObjectName(source, game)),
|
||||||
target.possibleTargets(source == null ? null : source.getSourceId(), playerId, game),
|
target.possibleTargets(source == null ? null : source.getSourceId(), playerId, game),
|
||||||
target.isRequired(source),
|
target.isRequired(source),
|
||||||
getOptions(target, null));
|
getOptions(target, null));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (target.canTarget(response.getUUID(), source, game)) {
|
if (target.canTarget(response.getUUID(), source, game)) {
|
||||||
|
@ -721,7 +741,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
while (canRespond()) {
|
while (canRespond()) {
|
||||||
updateGameStatePriority("priority", game);
|
updateGameStatePriority("priority", game);
|
||||||
holdingPriority = false;
|
holdingPriority = false;
|
||||||
if(!isExecutingMacro()) game.firePriorityEvent(playerId);
|
if (!isExecutingMacro()) {
|
||||||
|
game.firePriorityEvent(playerId);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (game.executingRollback()) {
|
if (game.executingRollback()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -731,8 +753,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (passWithManaPoolCheck(game) && !activatingMacro) {
|
if (passWithManaPoolCheck(game) && !activatingMacro) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if(activatingMacro){
|
if (activatingMacro) {
|
||||||
synchronized(actionQueue) {
|
synchronized (actionQueue) {
|
||||||
actionQueue.notifyAll();
|
actionQueue.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -840,7 +862,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
macroTriggeredSelectionFlag = true;
|
macroTriggeredSelectionFlag = true;
|
||||||
updateGameStatePriority("chooseTriggeredAbility", game);
|
updateGameStatePriority("chooseTriggeredAbility", game);
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetTriggeredAbilityEvent(playerId, "Pick triggered ability (goes to the stack first)", abilitiesWithNoOrderSet);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetTriggeredAbilityEvent(playerId, "Pick triggered ability (goes to the stack first)", abilitiesWithNoOrderSet);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
for (TriggeredAbility ability : abilitiesWithNoOrderSet) {
|
for (TriggeredAbility ability : abilitiesWithNoOrderSet) {
|
||||||
|
@ -874,7 +898,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
protected boolean playManaHandling(Ability abilityToCast, ManaCost unpaid, String promptText, Game game) {
|
protected boolean playManaHandling(Ability abilityToCast, ManaCost unpaid, String promptText, Game game) {
|
||||||
updateGameStatePriority("playMana", game);
|
updateGameStatePriority("playMana", game);
|
||||||
Map<String, Serializable> options = new HashMap<>();
|
Map<String, Serializable> options = new HashMap<>();
|
||||||
if(!isExecutingMacro()) game.firePlayManaEvent(playerId, "Pay " + promptText, options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.firePlayManaEvent(playerId, "Pay " + promptText, options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (!this.canRespond()) {
|
if (!this.canRespond()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -934,7 +960,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
int xValue = 0;
|
int xValue = 0;
|
||||||
updateGameStatePriority("announceXMana", game);
|
updateGameStatePriority("announceXMana", game);
|
||||||
do {
|
do {
|
||||||
if(!isExecutingMacro()) game.fireGetAmountEvent(playerId, message, min, max);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getInteger() == null
|
} while (response.getInteger() == null
|
||||||
&& !abort);
|
&& !abort);
|
||||||
|
@ -950,7 +978,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
int xValue = 0;
|
int xValue = 0;
|
||||||
updateGameStatePriority("announceXCost", game);
|
updateGameStatePriority("announceXCost", game);
|
||||||
do {
|
do {
|
||||||
if(!isExecutingMacro()) game.fireGetAmountEvent(playerId, message, min, max);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getInteger() == null
|
} while (response.getInteger() == null
|
||||||
&& !abort);
|
&& !abort);
|
||||||
|
@ -968,7 +998,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
||||||
if (spell != null
|
if (spell != null && !spell.isResolving()
|
||||||
&& spell.isDoneActivatingManaAbilities()) {
|
&& spell.isDoneActivatingManaAbilities()) {
|
||||||
game.informPlayer(this, "You can no longer use activated mana abilities to pay for the current spell. Cancel and recast the spell and activate mana abilities first.");
|
game.informPlayer(this, "You can no longer use activated mana abilities to pay for the current spell. Cancel and recast the spell and activate mana abilities first.");
|
||||||
return;
|
return;
|
||||||
|
@ -1014,7 +1044,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack");
|
options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isExecutingMacro()) game.fireSelectEvent(playerId, "Select attackers", options);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectEvent(playerId, "Select attackers", options);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getString() != null
|
if (response.getString() != null
|
||||||
&& response.getString().equals("special")) { // All attack
|
&& response.getString().equals("special")) { // All attack
|
||||||
|
@ -1174,7 +1206,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireSelectEvent(playerId, "Select blockers");
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectEvent(playerId, "Select blockers");
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getBoolean() != null) {
|
if (response.getBoolean() != null) {
|
||||||
return;
|
return;
|
||||||
|
@ -1204,7 +1238,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public UUID chooseAttackerOrder(List<Permanent> attackers, Game game) {
|
public UUID chooseAttackerOrder(List<Permanent> attackers, Game game) {
|
||||||
updateGameStatePriority("chooseAttackerOrder", game);
|
updateGameStatePriority("chooseAttackerOrder", game);
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, "Pick attacker", attackers, true);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, "Pick attacker", attackers, true);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
for (Permanent perm : attackers) {
|
for (Permanent perm : attackers) {
|
||||||
|
@ -1221,7 +1257,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public UUID chooseBlockerOrder(List<Permanent> blockers, CombatGroup combatGroup, List<UUID> blockerOrder, Game game) {
|
public UUID chooseBlockerOrder(List<Permanent> blockers, CombatGroup combatGroup, List<UUID> blockerOrder, Game game) {
|
||||||
updateGameStatePriority("chooseBlockerOrder", game);
|
updateGameStatePriority("chooseBlockerOrder", game);
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, "Pick blocker", blockers, true);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, "Pick blocker", blockers, true);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
for (Permanent perm : blockers) {
|
for (Permanent perm : blockers) {
|
||||||
|
@ -1237,8 +1275,10 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
protected void selectCombatGroup(UUID defenderId, UUID blockerId, Game game) {
|
protected void selectCombatGroup(UUID defenderId, UUID blockerId, Game game) {
|
||||||
updateGameStatePriority("selectCombatGroup", game);
|
updateGameStatePriority("selectCombatGroup", game);
|
||||||
TargetAttackingCreature target = new TargetAttackingCreature();
|
TargetAttackingCreature target = new TargetAttackingCreature();
|
||||||
if(!isExecutingMacro()) game.fireSelectTargetEvent(playerId, new MessageToClient("Select attacker to block", getRelatedObjectName(blockerId, game)),
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireSelectTargetEvent(playerId, new MessageToClient("Select attacker to block", getRelatedObjectName(blockerId, game)),
|
||||||
target.possibleTargets(null, playerId, game), false, getOptions(target, null));
|
target.possibleTargets(null, playerId, game), false, getOptions(target, null));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getBoolean() != null) {
|
if (response.getBoolean() != null) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -1287,7 +1327,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public int getAmount(int min, int max, String message, Game game) {
|
public int getAmount(int min, int max, String message, Game game) {
|
||||||
updateGameStatePriority("getAmount", game);
|
updateGameStatePriority("getAmount", game);
|
||||||
do {
|
do {
|
||||||
if(!isExecutingMacro()) game.fireGetAmountEvent(playerId, message, min, max);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getInteger() == null && !abort);
|
} while (response.getInteger() == null && !abort);
|
||||||
if (response != null && response.getInteger() != null) {
|
if (response != null && response.getInteger() != null) {
|
||||||
|
@ -1316,7 +1358,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, false);
|
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, false);
|
||||||
if (!specialActions.isEmpty()) {
|
if (!specialActions.isEmpty()) {
|
||||||
updateGameStatePriority("specialAction", game);
|
updateGameStatePriority("specialAction", game);
|
||||||
if(!isExecutingMacro()) game.fireGetChoiceEvent(playerId, name, null, new ArrayList<>(specialActions.values()));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetChoiceEvent(playerId, name, null, new ArrayList<>(specialActions.values()));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (specialActions.containsKey(response.getUUID())) {
|
if (specialActions.containsKey(response.getUUID())) {
|
||||||
|
@ -1330,7 +1374,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, true);
|
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, true);
|
||||||
if (!specialActions.isEmpty()) {
|
if (!specialActions.isEmpty()) {
|
||||||
updateGameStatePriority("specialAction", game);
|
updateGameStatePriority("specialAction", game);
|
||||||
if(!isExecutingMacro()) game.fireGetChoiceEvent(playerId, name, null, new ArrayList<>(specialActions.values()));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetChoiceEvent(playerId, name, null, new ArrayList<>(specialActions.values()));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (specialActions.containsKey(response.getUUID())) {
|
if (specialActions.containsKey(response.getUUID())) {
|
||||||
|
@ -1373,7 +1419,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isExecutingMacro()) game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(abilities.values()));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(abilities.values()));
|
||||||
|
}
|
||||||
|
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null && isInGame()) {
|
if (response.getUUID() != null && isInGame()) {
|
||||||
|
@ -1411,7 +1459,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return (SpellAbility) useableAbilities.values().iterator().next();
|
return (SpellAbility) useableAbilities.values().iterator().next();
|
||||||
} else if (useableAbilities != null
|
} else if (useableAbilities != null
|
||||||
&& !useableAbilities.isEmpty()) {
|
&& !useableAbilities.isEmpty()) {
|
||||||
if(!isExecutingMacro()) game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
if (useableAbilities.containsKey(response.getUUID())) {
|
if (useableAbilities.containsKey(response.getUUID())) {
|
||||||
|
@ -1461,7 +1511,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (!modeMap.isEmpty()) {
|
if (!modeMap.isEmpty()) {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
if(!isExecutingMacro()) game.fireGetModeEvent(playerId, "Choose Mode", modeMap);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireGetModeEvent(playerId, "Choose Mode", modeMap);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
for (Mode mode : modes.getAvailableModes(source, game)) {
|
for (Mode mode : modes.getAvailableModes(source, game)) {
|
||||||
|
@ -1488,7 +1540,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public boolean choosePile(Outcome outcome, String message, List<? extends Card> pile1, List<? extends Card> pile2, Game game) {
|
public boolean choosePile(Outcome outcome, String message, List<? extends Card> pile1, List<? extends Card> pile2, Game game) {
|
||||||
updateGameStatePriority("choosePile", game);
|
updateGameStatePriority("choosePile", game);
|
||||||
do {
|
do {
|
||||||
if(!isExecutingMacro()) game.fireChoosePileEvent(playerId, message, pile1, pile2);
|
if (!isExecutingMacro()) {
|
||||||
|
game.fireChoosePileEvent(playerId, message, pile1, pile2);
|
||||||
|
}
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getBoolean() == null && !abort);
|
} while (response.getBoolean() == null && !abort);
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
|
@ -1605,16 +1659,16 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
holdingPriority = false;
|
holdingPriority = false;
|
||||||
break;
|
break;
|
||||||
case TOGGLE_RECORD_MACRO:
|
case TOGGLE_RECORD_MACRO:
|
||||||
if(recordingMacro) {
|
if (recordingMacro) {
|
||||||
logger.debug("Finished Recording Macro");
|
logger.debug("Finished Recording Macro");
|
||||||
activatingMacro = true;
|
activatingMacro = true;
|
||||||
recordingMacro = false;
|
recordingMacro = false;
|
||||||
actionIterations = announceRepetitions(game);
|
actionIterations = announceRepetitions(game);
|
||||||
try {
|
try {
|
||||||
synchronized(actionQueue) {
|
synchronized (actionQueue) {
|
||||||
actionQueue.wait();
|
actionQueue.wait();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ex){
|
} catch (InterruptedException ex) {
|
||||||
} finally {
|
} finally {
|
||||||
activatingMacro = false;
|
activatingMacro = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.stack;
|
package mage.game.stack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
|
@ -59,16 +63,6 @@ import mage.players.Player;
|
||||||
import mage.util.GameLog;
|
import mage.util.GameLog;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -90,6 +84,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
private boolean copiedSpell;
|
private boolean copiedSpell;
|
||||||
private boolean faceDown;
|
private boolean faceDown;
|
||||||
private boolean countered;
|
private boolean countered;
|
||||||
|
private boolean resolving = false;
|
||||||
|
|
||||||
private boolean doneActivatingManaAbilities; // if this is true, the player is no longer allowed to pay the spell costs with activating of mana abilies
|
private boolean doneActivatingManaAbilities; // if this is true, the player is no longer allowed to pay the spell costs with activating of mana abilies
|
||||||
|
|
||||||
|
@ -196,6 +191,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.resolving = true;
|
||||||
if (this.isInstant() || this.isSorcery()) {
|
if (this.isInstant() || this.isSorcery()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
result = false;
|
result = false;
|
||||||
|
@ -262,7 +258,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
if (permanent != null && permanent instanceof PermanentCard) {
|
if (permanent != null && permanent instanceof PermanentCard) {
|
||||||
permanent.setSpellAbility(ability); // otherwise spell ability without bestow will be set
|
permanent.setSpellAbility(ability); // otherwise spell ability without bestow will be set
|
||||||
card.addCardType(CardType.CREATURE);
|
card.addCardType(CardType.CREATURE);
|
||||||
card.getSubtype(game).remove("Aura");
|
card.getSubtype(game).remove(SubType.AURA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ability.resolve(game);
|
return ability.resolve(game);
|
||||||
|
@ -279,7 +275,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
Permanent permanent = game.getPermanent(card.getId());
|
Permanent permanent = game.getPermanent(card.getId());
|
||||||
if (permanent != null && permanent instanceof PermanentCard) {
|
if (permanent != null && permanent instanceof PermanentCard) {
|
||||||
((PermanentCard) permanent).getCard().addCardType(CardType.CREATURE);
|
((PermanentCard) permanent).getCard().addCardType(CardType.CREATURE);
|
||||||
((PermanentCard) permanent).getCard().getSubtype(game).remove("Aura");
|
((PermanentCard) permanent).getCard().getSubtype(game).remove(SubType.AURA);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -907,6 +903,10 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
return countered;
|
return countered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isResolving() {
|
||||||
|
return resolving;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkForCountersToAdd(Permanent permanent, Game game) {
|
public void checkForCountersToAdd(Permanent permanent, Game game) {
|
||||||
card.checkForCountersToAdd(permanent, game);
|
card.checkForCountersToAdd(permanent, game);
|
||||||
|
@ -923,9 +923,10 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllCreatureTypes(){
|
public boolean isAllCreatureTypes() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAllCreatureTypes(boolean value){}
|
public void setIsAllCreatureTypes(boolean value) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue