forked from External/mage
* Copy spells - improved combo support with other abilities like Kicker or Entwine (#7192):
* Now ZCC of copied spells syncs with source card or coping spell (allows to keep ability settings that depends on ZCC); * Fixed bug that allows to lost kicked status in copied spells after counter the original spell or moves the original card (see #7192); * Test framework: improved support of targeting copy or non copy spells on stack;
This commit is contained in:
parent
936be75a66
commit
4d362d7edc
32 changed files with 522 additions and 302 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.util.functions;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -8,9 +7,11 @@ import mage.cards.Card;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
|
@ -27,7 +28,7 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Token apply(Card source) {
|
||||
public Token apply(Card source, Game game) {
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("Target can't be null");
|
||||
}
|
||||
|
|
@ -94,7 +95,22 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
|||
return target;
|
||||
}
|
||||
|
||||
public Token from(Card source) {
|
||||
return apply(source);
|
||||
public Token from(Card source, Game game) {
|
||||
return from(source, game, null);
|
||||
}
|
||||
|
||||
public Token from(Card source, Game game, Spell spell) {
|
||||
apply(source, game);
|
||||
|
||||
// token's ZCC must be synced with original card to keep abilities settings
|
||||
// Example: kicker ability and kicked status
|
||||
if (spell != null) {
|
||||
// copied spell puts to battlefield as token, so that token's ZCC must be synced with spell instead card (card can be moved before resolve)
|
||||
target.setZoneChangeCounter(spell.getZoneChangeCounter(game), game);
|
||||
} else {
|
||||
target.setZoneChangeCounter(source.getZoneChangeCounter(game), game);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
package mage.util.functions;
|
||||
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Function<X, Y> {
|
||||
X apply(Y in);
|
||||
X apply(Y in, Game game);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue