Search in sources :

Example 1 with SplinterToken

use of mage.game.permanent.token.SplinterToken in project mage by magefree.

the class SplinteringWindDelayedTriggeredAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player sourceController = game.getPlayer(source.getControllerId());
    Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (sourceController != null && sourceObject != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new SplinterToken());
        effect.apply(game, source);
        game.getState().setValue(source.getSourceId() + "_token", effect.getLastAddedTokenIds());
        for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
            game.addDelayedTriggeredAbility(new SplinteringWindDelayedTriggeredAbility(addedTokenId), source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) SplinterToken(mage.game.permanent.token.SplinterToken) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 SplinterToken (mage.game.permanent.token.SplinterToken)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1