mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Fixed potential freeze on put cards order
This commit is contained in:
parent
2d5e1fdc34
commit
529153312f
3 changed files with 16 additions and 15 deletions
|
|
@ -86,7 +86,7 @@ class CascadeEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
ExileZone exile = game.getExile().createZone(source.getSourceId(),
|
||||
ExileZone exile = game.getExile().createZone(source.getSourceId(),
|
||||
controller.getName() + " Cascade");
|
||||
card = game.getCard(source.getSourceId());
|
||||
if (card == null) {
|
||||
|
|
@ -99,7 +99,7 @@ class CascadeEffect extends OneShotEffect {
|
|||
break;
|
||||
}
|
||||
controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName());
|
||||
} while (controller.isInGame()
|
||||
} while (controller.canRespond()
|
||||
&& (card.isLand()
|
||||
|| !cardThatCostsLess(sourceCost, card, game)));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
package mage.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import mage.MageException;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.*;
|
||||
|
|
@ -71,6 +67,11 @@ import mage.util.functions.ApplyToPermanent;
|
|||
import mage.watchers.common.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class GameImpl implements Game, Serializable {
|
||||
|
||||
private static final int ROLLBACK_TURNS_MAX = 4;
|
||||
|
|
@ -353,7 +354,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
// can be an ability of a sacrificed Token trying to get it's source object
|
||||
object = getLastKnownInformation(objectId, Zone.BATTLEFIELD);
|
||||
}
|
||||
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
@ -1798,13 +1799,13 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
state.getTriggers().checkStateTriggers(this);
|
||||
for (UUID playerId : state.getPlayerList(state.getActivePlayerId())) {
|
||||
Player player = getPlayer(playerId);
|
||||
while (player.isInGame()) { // player can die or win caused by triggered abilities or leave the game
|
||||
while (player.canRespond()) { // player can die or win caused by triggered abilities or leave the game
|
||||
List<TriggeredAbility> abilities = state.getTriggered(player.getId());
|
||||
if (abilities.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
// triggered abilities that don't use the stack have to be executed first (e.g. Banisher Priest Return exiled creature
|
||||
for (Iterator<TriggeredAbility> it = abilities.iterator(); it.hasNext();) {
|
||||
for (Iterator<TriggeredAbility> it = abilities.iterator(); it.hasNext(); ) {
|
||||
TriggeredAbility triggeredAbility = it.next();
|
||||
if (!triggeredAbility.isUsesStack()) {
|
||||
state.removeTriggeredAbility(triggeredAbility);
|
||||
|
|
@ -1879,7 +1880,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
Zone currentZone = this.getState().getZone(card.getId());
|
||||
String currentZoneInfo = (currentZone == null ? "(error)" : "(" + currentZone.name() + ")");
|
||||
if (player.chooseUse(Outcome.Benefit, "Move " + card.getIdName()
|
||||
+ " to the command zone or leave it in current zone " + currentZoneInfo + "?", "You can only make this choice once per object",
|
||||
+ " to the command zone or leave it in current zone " + currentZoneInfo + "?", "You can only make this choice once per object",
|
||||
"Move to command", "Leave in current zone " + currentZoneInfo, null, this)) {
|
||||
toMove.add(card);
|
||||
} else {
|
||||
|
|
@ -2595,7 +2596,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
//20100423 - 800.4a
|
||||
Set<Card> toOutside = new HashSet<>();
|
||||
for (Iterator<Permanent> it = getBattlefield().getAllPermanents().iterator(); it.hasNext();) {
|
||||
for (Iterator<Permanent> it = getBattlefield().getAllPermanents().iterator(); it.hasNext(); ) {
|
||||
Permanent perm = it.next();
|
||||
if (perm.isOwnedBy(playerId)) {
|
||||
if (perm.getAttachedTo() != null) {
|
||||
|
|
@ -2645,7 +2646,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
player.moveCards(toOutside, Zone.OUTSIDE, null, this);
|
||||
// triggered abilities that don't use the stack have to be executed
|
||||
List<TriggeredAbility> abilities = state.getTriggered(player.getId());
|
||||
for (Iterator<TriggeredAbility> it = abilities.iterator(); it.hasNext();) {
|
||||
for (Iterator<TriggeredAbility> it = abilities.iterator(); it.hasNext(); ) {
|
||||
TriggeredAbility triggeredAbility = it.next();
|
||||
if (!triggeredAbility.isUsesStack()) {
|
||||
state.removeTriggeredAbility(triggeredAbility);
|
||||
|
|
@ -2665,7 +2666,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
// Remove cards from the player in all exile zones
|
||||
for (ExileZone exile : this.getExile().getExileZones()) {
|
||||
for (Iterator<UUID> it = exile.iterator(); it.hasNext();) {
|
||||
for (Iterator<UUID> it = exile.iterator(); it.hasNext(); ) {
|
||||
Card card = this.getCard(it.next());
|
||||
if (card != null && card.isOwnedBy(playerId)) {
|
||||
it.remove();
|
||||
|
|
@ -2675,7 +2676,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
//Remove all commander/emblems/plane the player controls
|
||||
boolean addPlaneAgain = false;
|
||||
for (Iterator<CommandObject> it = this.getState().getCommand().iterator(); it.hasNext();) {
|
||||
for (Iterator<CommandObject> it = this.getState().getCommand().iterator(); it.hasNext(); ) {
|
||||
CommandObject obj = it.next();
|
||||
if (obj.isControlledBy(playerId)) {
|
||||
if (obj instanceof Emblem) {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ public final class ZonesHandler {
|
|||
}
|
||||
TargetCard target = new TargetCard(Zone.ALL, new FilterCard(message));
|
||||
target.setRequired(true);
|
||||
while (player.isInGame() && cards.size() > 1) {
|
||||
while (player.canRespond() && cards.size() > 1) {
|
||||
player.choose(Outcome.Neutral, cards, target, game);
|
||||
UUID targetObjectId = target.getFirstTarget();
|
||||
order.add(cards.get(targetObjectId, game));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue