mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
* Move cards from battlefield - fixed that some abilities can duplicates moving cards (#4655); For devs: all cards with CardsImpl and moveCards calls like Winds of Abandon;
This commit is contained in:
parent
fa973d9a90
commit
90a5a55a72
1 changed files with 9 additions and 7 deletions
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
package mage.cards;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.MageObject;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.RandomUtil;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -135,13 +135,15 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
@Override
|
||||
public Set<Card> getCards(Game game) {
|
||||
Set<Card> cards = new LinkedHashSet<>();
|
||||
for (Iterator<UUID> it = this.iterator(); it.hasNext();) { // Changed to iterator because of ConcurrentModificationException
|
||||
for (Iterator<UUID> it = this.iterator(); it.hasNext(); ) { // Changed to iterator because of ConcurrentModificationException
|
||||
UUID cardId = it.next();
|
||||
|
||||
Card card = game.getCard(cardId);
|
||||
// cards from battlefield must be as permanent, not card (moveCards uses instanceOf Permanent)
|
||||
Card card = game.getPermanent(cardId);
|
||||
if (card == null) {
|
||||
card = game.getPermanent(cardId); // needed to get TokenCard objects
|
||||
card = game.getCard(cardId);
|
||||
}
|
||||
|
||||
if (card != null) { // this can happen during the cancelation (player concedes) of a game
|
||||
cards.add(card);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue