mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Delay triggered abilities - fixed that copied spell with multiple delayed triggered abilities can freeze the game or missing from stack (#5437);
This commit is contained in:
parent
5aaec29361
commit
2ca1643b54
4 changed files with 53 additions and 28 deletions
|
|
@ -13,14 +13,18 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
import mage.target.targetpointer.TargetPointer;
|
||||
import mage.util.GameLog;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardsView extends LinkedHashMap<UUID, CardView> {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(CardsView.class);
|
||||
|
||||
public CardsView() {
|
||||
}
|
||||
|
||||
|
|
@ -151,6 +155,11 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
this.put(ability.getId(), abilityView);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.size() != abilities.size()) {
|
||||
LOGGER.error("Can't translate abilities list to cards view (need " + abilities.size() + ", but get " + this.size() + "). Abilities:\n"
|
||||
+ abilities.stream().map(a -> a.getClass().getSimpleName() + " - " + a.getRule()).collect(Collectors.joining("\n")));
|
||||
}
|
||||
}
|
||||
|
||||
public CardsView(Collection<? extends Ability> abilities, GameState state) {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@ package mage.view;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -30,6 +25,12 @@ import mage.players.Player;
|
|||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -124,7 +125,6 @@ public class GameView implements Serializable {
|
|||
} else {
|
||||
LOGGER.fatal("Designation object not found: " + object.getName() + ' ' + object.toString() + ' ' + object.getClass().toString());
|
||||
}
|
||||
|
||||
} else if (object instanceof StackAbility) {
|
||||
StackAbility stackAbility = ((StackAbility) object);
|
||||
stackAbility.newId();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue