Search in sources :

Example 26 with CreateTokenEffect

use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.

the class SharkTyphoonTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (!event.getSourceId().equals(this.getSourceId())) {
        return false;
    }
    StackObject object = game.getStack().getStackObject(event.getSourceId());
    if (object == null || !(object.getStackAbility() instanceof CyclingAbility)) {
        return false;
    }
    this.getEffects().clear();
    this.addEffect(new CreateTokenEffect(new SharkToken(object.getStackAbility().getManaCostsToPay().getX())));
    return true;
}
Also used : CyclingAbility(mage.abilities.keyword.CyclingAbility) StackObject(mage.game.stack.StackObject) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SharkToken(mage.game.permanent.token.SharkToken)

Example 27 with CreateTokenEffect

use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.

the class StitcherGeralfEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Cards cards = new CardsImpl();
        for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                cards.addAll(player.millCards(3, source, game));
            }
        }
        cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.GRAVEYARD);
        TargetCard target = new TargetCard(0, 2, Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile"));
        controller.chooseTarget(outcome, cards, target, source, game);
        int power = 0;
        for (UUID cardId : target.getTargets()) {
            Card card = game.getCard(cardId);
            if (card != null) {
                power += card.getPower().getValue();
                controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true);
            }
        }
        return new CreateTokenEffect(new StitcherGeralfZombieToken(power)).apply(game, source);
    }
    return false;
}
Also used : Player(mage.players.Player) FilterCreatureCard(mage.filter.common.FilterCreatureCard) StitcherGeralfZombieToken(mage.game.permanent.token.StitcherGeralfZombieToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) TargetCard(mage.target.TargetCard) UUID(java.util.UUID) FilterCreatureCard(mage.filter.common.FilterCreatureCard) TargetCard(mage.target.TargetCard)

Example 28 with CreateTokenEffect

use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.

the class ChandraDrawEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new ElementalTokenWithHaste(), 2);
        effect.apply(game, source);
        effect.exileTokensCreatedAtNextEndStep(game, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) ElementalTokenWithHaste(mage.game.permanent.token.ElementalTokenWithHaste)

Example 29 with CreateTokenEffect

use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.

the class CorpseweftEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        int amount = 0;
        for (Cost cost : source.getCosts()) {
            if (cost instanceof ExileFromGraveCost) {
                amount = ((ExileFromGraveCost) cost).getExiledCards().size() * 2;
                new CreateTokenEffect(new CorpseweftZombieToken(amount, amount), 1, true, false).apply(game, source);
            }
        }
        if (amount > 0) {
        }
    }
    return false;
}
Also used : Player(mage.players.Player) ExileFromGraveCost(mage.abilities.costs.common.ExileFromGraveCost) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) Cost(mage.abilities.costs.Cost) ExileFromGraveCost(mage.abilities.costs.common.ExileFromGraveCost) CorpseweftZombieToken(mage.game.permanent.token.CorpseweftZombieToken)

Example 30 with CreateTokenEffect

use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.

the class GeistOfSaintTraftEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    CreateTokenEffect effect = new CreateTokenEffect(new AngelToken(), 1, true, true);
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null && effect.apply(game, source)) {
        effect.exileTokensCreatedAtEndOfCombat(game, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) AngelToken(mage.game.permanent.token.AngelToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect)

Aggregations

CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)68 Player (mage.players.Player)45 Permanent (mage.game.permanent.Permanent)31 UUID (java.util.UUID)25 FixedTarget (mage.target.targetpointer.FixedTarget)11 OneShotEffect (mage.abilities.effects.OneShotEffect)8 Effect (mage.abilities.effects.Effect)7 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)7 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)7 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)5 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)5 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)4 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)4 Cost (mage.abilities.costs.Cost)4 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)4 HashSet (java.util.HashSet)3 MageObjectReference (mage.MageObjectReference)3 Ability (mage.abilities.Ability)3 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)3