Search in sources :

Example 1 with TidalWaveWallToken

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

the class TidalWaveEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token token = new TidalWaveWallToken();
    if (token.putOntoBattlefield(1, game, source, source.getControllerId())) {
        for (UUID tokenId : token.getLastAddedTokenIds()) {
            Permanent tokenPermanent = game.getPermanent(tokenId);
            if (tokenPermanent != null) {
                SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
                sacrificeEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
                game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) TidalWaveWallToken(mage.game.permanent.token.TidalWaveWallToken) Permanent(mage.game.permanent.Permanent) TidalWaveWallToken(mage.game.permanent.token.TidalWaveWallToken) Token(mage.game.permanent.token.Token) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)1 Permanent (mage.game.permanent.Permanent)1 TidalWaveWallToken (mage.game.permanent.token.TidalWaveWallToken)1 Token (mage.game.permanent.token.Token)1 FixedTarget (mage.target.targetpointer.FixedTarget)1