use of mage.game.permanent.token.WaylayToken in project mage by magefree.
the class WaylayEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new WaylayToken();
token.putOntoBattlefield(3, game, source, source.getControllerId());
List<Permanent> toExile = new ArrayList<>();
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
toExile.add(tokenPermanent);
}
}
Effect effect = new ExileTargetEffect();
effect.setTargetPointer(new FixedTargets(toExile, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextCleanupDelayedTriggeredAbility(effect), source);
return true;
}
Aggregations