* Spark Double - fixed duplicated counters on copying of another Spark Double (#7553);

This commit is contained in:
Oleg Agafonov 2021-02-22 21:22:31 +04:00
parent f6c0f4c712
commit 2accab79c5
10 changed files with 113 additions and 56 deletions

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.game.Game;
import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;
/**
@ -20,10 +19,14 @@ public abstract class CopyApplier implements Serializable {
// 2. It applies to the blueprint, not the real object (the real object is targetObjectId and can be card or token, even from outside the game like EmptyToken);
// 3. "source" is the current copy ability and can be different from the original copy ability (copy of copy);
// 4. Don't use "source" param at all;
// 5. Use isCopyOfCopy() to detect it (some effects can apply to copy of copy, but others can't -- see Spark Double as an example).
// 5. For exception/non-copyable effects use isCopyOfCopy() to detect that situation (example: 706.9e, Spark Double, Altered Ego).
public abstract boolean apply(Game game, MageObject blueprint, Ability source, UUID targetObjectId);
public boolean isCopyOfCopy(Ability source, UUID targetObjectId) {
return !Objects.equals(targetObjectId, source.getSourceId());
public boolean isCopyOfCopy(Ability source, MageObject blueprint, UUID targetObjectId) {
return blueprint.isCopy();
}
public String getText() {
return "";
}
}