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:
Evan Kranzler 2023-08-18 13:25:48 -04:00 committed by GitHub
parent 93cfb86a0f
commit b892562b95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 148 additions and 63 deletions

View file

@ -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);
}