* Fixed a problem where for copies of cards/permanent the included spell ability was not correctly copied and the copied card had the spell ability twice. That could cause in some rare cases problems with spell ids of copies (this fixes #6824) or did allow on the other side some unproper handling of things (Animate Dead).

This commit is contained in:
LevelX2 2020-07-14 21:28:45 +02:00
parent 9f92377eef
commit eecaa232f5
12 changed files with 300 additions and 149 deletions

View file

@ -1,6 +1,12 @@
package mage.cards;
import com.google.common.collect.ImmutableList;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.MageObjectImpl;
import mage.Mana;
@ -27,13 +33,6 @@ import mage.util.SubTypeList;
import mage.watchers.Watcher;
import org.apache.log4j.Logger;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public abstract class CardImpl extends MageObjectImpl implements Card {
private static final long serialVersionUID = 1L;
@ -137,7 +136,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
nightCard = card.nightCard;
}
if (card.spellAbility != null) {
spellAbility = card.getSpellAbility().copy();
spellAbility = (SpellAbility) abilities.get(0);
} else {
spellAbility = null;
}
@ -397,10 +396,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
}
/**
* Dynamic cost modification for card (process only own abilities).
* Example: if it need stack related info (like real targets) then must check two states (game.inCheckPlayableState):
* 1. In playable state it must check all possible use cases (e.g. allow to reduce on any available target and modes)
* 2. In real cast state it must check current use case (e.g. real selected targets and modes)
* Dynamic cost modification for card (process only own abilities). Example:
* if it need stack related info (like real targets) then must check two
* states (game.inCheckPlayableState):
*
* 1. In playable state it must check all possible use cases (e.g. allow to
* reduce on any available target and modes)
*
* 2. In real cast state it must check current use case (e.g. real selected
* targets and modes)
*
* @param ability
* @param game