Search in sources :

Example 1 with CreateTokenEffect

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

the class ElementalAppealEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    CreateTokenEffect effect = new CreateTokenEffect(new RedElementalWithTrampleAndHaste());
    if (effect.apply(game, source)) {
        effect.exileTokensCreatedAtNextEndStep(game, source);
        if (KickedCondition.instance.apply(game, source)) {
            List<Predicate<MageObject>> predList = new ArrayList<>();
            for (UUID tokenId : effect.getLastAddedTokenIds()) {
                predList.add(new CardIdPredicate(tokenId));
            }
            if (!predList.isEmpty()) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent();
                filter.add(Predicates.or(predList));
                game.addEffect(new BoostAllEffect(7, 0, Duration.EndOfTurn, filter, false), source);
            }
        }
        return true;
    }
    return false;
}
Also used : FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) ArrayList(java.util.ArrayList) RedElementalWithTrampleAndHaste(mage.game.permanent.token.RedElementalWithTrampleAndHaste) UUID(java.util.UUID) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect) Predicate(mage.filter.predicate.Predicate) CardIdPredicate(mage.filter.predicate.mageobject.CardIdPredicate) CardIdPredicate(mage.filter.predicate.mageobject.CardIdPredicate)

Example 2 with CreateTokenEffect

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

the class FeudkillersVerdictEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        controller.gainLife(10, game, source);
        boolean moreLife = false;
        for (UUID opponentId : game.getOpponents(source.getControllerId())) {
            Player opponent = game.getPlayer(opponentId);
            if (opponent != null) {
                if (controller.getLife() > opponent.getLife()) {
                    moreLife = true;
                    break;
                }
            }
        }
        if (moreLife) {
            return new CreateTokenEffect(new GiantWarriorToken(), 1).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) GiantWarriorToken(mage.game.permanent.token.GiantWarriorToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) UUID(java.util.UUID)

Example 3 with CreateTokenEffect

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

the class HazezonTamarEntersEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Effect effect = new CreateTokenEffect(new HazezonTamarSandWarriorToken(), new PermanentsOnBattlefieldCount(new FilterControlledLandPermanent()));
        effect.setText("create X 1/1 Sand Warrior creature tokens that are red, green, and white, where X is the number of lands you control at that time");
        DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect);
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) PermanentsOnBattlefieldCount(mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount) ExileAllEffect(mage.abilities.effects.common.ExileAllEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) HazezonTamarSandWarriorToken(mage.game.permanent.token.HazezonTamarSandWarriorToken) FilterControlledLandPermanent(mage.filter.common.FilterControlledLandPermanent)

Example 4 with CreateTokenEffect

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

the class MyrIncubatorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null && controller.searchLibrary(target, source, game)) {
        if (!target.getTargets().isEmpty()) {
            tokensToCreate = target.getTargets().size();
            controller.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
        }
        CreateTokenEffect effect = new CreateTokenEffect(new MyrToken(), tokensToCreate);
        effect.apply(game, source);
        controller.shuffleLibrary(source, game);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) MyrToken(mage.game.permanent.token.MyrToken) CardsImpl(mage.cards.CardsImpl)

Example 5 with CreateTokenEffect

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

the class NoosegrafMobEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
        permanent.removeCounters(CounterType.P1P1.createInstance(), source, game);
        Effect effect = new CreateTokenEffect(new ZombieToken());
        return effect.apply(game, source);
    }
    return false;
}
Also used : Player(mage.players.Player) ZombieToken(mage.game.permanent.token.ZombieToken) Permanent(mage.game.permanent.Permanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) Effect(mage.abilities.effects.Effect) 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