use of mage.game.permanent.token.TatsumaDragonToken in project mage by magefree.
the class TatsumaTheDragonsFangTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
CreateTokenEffect effect = new CreateTokenEffect(new TatsumaDragonToken());
effect.apply(game, source);
for (UUID tokenId : effect.getLastAddedTokenIds()) {
// by cards like Doubling Season multiple tokens can be added to the battlefield
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
FixedTarget fixedTarget = new FixedTarget(tokenPermanent, game);
Effect returnEffect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false);
returnEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
DelayedTriggeredAbility delayedAbility = new TatsumaTheDragonsFangTriggeredAbility(fixedTarget, returnEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
return true;
}
Aggregations