forked from External/mage
Fixing aura token creation (#10858)
* rework aura token creation * add missing copy constructor * add message for token if unable to be created * add a few extra role tests
This commit is contained in:
parent
93cfb86a0f
commit
b892562b95
9 changed files with 148 additions and 63 deletions
|
|
@ -42,6 +42,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
private final CardType additionalCardType;
|
||||
private SubType additionalSubType;
|
||||
private final UUID attackedPlayer;
|
||||
private UUID attachedTo = null;
|
||||
private final boolean attacking;
|
||||
private boolean becomesArtifact;
|
||||
private ObjectColor color;
|
||||
|
|
@ -134,6 +135,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
this.additionalCardType = effect.additionalCardType;
|
||||
this.additionalSubType = effect.additionalSubType;
|
||||
this.attackedPlayer = effect.attackedPlayer;
|
||||
this.attachedTo = effect.attachedTo;
|
||||
this.attacking = effect.attacking;
|
||||
this.becomesArtifact = effect.becomesArtifact;
|
||||
this.color = effect.color;
|
||||
|
|
@ -264,7 +266,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
token.putOntoBattlefield(number, game, source, playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer);
|
||||
token.putOntoBattlefield(number, game, source, playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer, attachedTo);
|
||||
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||
if (tokenPermanent != null) {
|
||||
|
|
@ -386,6 +388,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CreateTokenCopyTargetEffect setAttachedTo(UUID attachedTo) {
|
||||
this.attachedTo = attachedTo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void sacrificeTokensCreatedAtNextEndStep(Game game, Ability source) {
|
||||
this.removeTokensCreatedAtEndOf(game, source, PhaseStep.END_TURN, false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue