Search in sources :

Example 1 with ElementalCatToken

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

the class FirecatBlitzEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        int xValue = source.getManaCostsToPay().getX();
        for (Cost cost : source.getCosts()) {
            if (cost instanceof SacrificeTargetCost) {
                xValue = ((SacrificeTargetCost) cost).getPermanents().size();
            }
        }
        CreateTokenEffect effect = new CreateTokenEffect(new ElementalCatToken(), xValue);
        effect.apply(game, source);
        for (UUID tokenId : effect.getLastAddedTokenIds()) {
            Permanent tokenPermanent = game.getPermanent(tokenId);
            if (tokenPermanent != null) {
                ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
                exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
                game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) SacrificeTargetCost(mage.abilities.costs.common.SacrificeTargetCost) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) FilterControlledLandPermanent(mage.filter.common.FilterControlledLandPermanent) ElementalCatToken(mage.game.permanent.token.ElementalCatToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) UUID(java.util.UUID) SacrificeXTargetCost(mage.abilities.costs.common.SacrificeXTargetCost) Cost(mage.abilities.costs.Cost) SacrificeTargetCost(mage.abilities.costs.common.SacrificeTargetCost) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Aggregations

UUID (java.util.UUID)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 Cost (mage.abilities.costs.Cost)1 SacrificeTargetCost (mage.abilities.costs.common.SacrificeTargetCost)1 SacrificeXTargetCost (mage.abilities.costs.common.SacrificeXTargetCost)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)1 FilterControlledLandPermanent (mage.filter.common.FilterControlledLandPermanent)1 Permanent (mage.game.permanent.Permanent)1 ElementalCatToken (mage.game.permanent.token.ElementalCatToken)1 Player (mage.players.Player)1 FixedTarget (mage.target.targetpointer.FixedTarget)1