Search in sources :

Example 1 with HornetToken

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

the class HornetCannonEffect method apply.

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

Aggregations

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