Search in sources :

Example 1 with AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility 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 2 with AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility in project mage by magefree.

the class RallyTheAncestorsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
        int xValue = source.getManaCostsToPay().getX();
        FilterCreatureCard filter = new FilterCreatureCard();
        filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));
        Set<Card> cards = player.getGraveyard().getCards(filter, game);
        player.moveCards(cards, Zone.BATTLEFIELD, source, game);
        List<Permanent> toExile = new ArrayList<>(cards.size());
        for (Card card : cards) {
            if (card != null) {
                Permanent permanent = game.getPermanent(card.getId());
                if (permanent != null) {
                    toExile.add(permanent);
                }
            }
        }
        Effect exileEffect = new ExileTargetEffect("Exile those creatures at the beginning of your next upkeep");
        exileEffect.setTargetPointer(new FixedTargets(toExile, game));
        DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(exileEffect);
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) ArrayList(java.util.ArrayList) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) FilterCreatureCard(mage.filter.common.FilterCreatureCard) Card(mage.cards.Card) FilterCreatureCard(mage.filter.common.FilterCreatureCard) ManaValuePredicate(mage.filter.predicate.mageobject.ManaValuePredicate) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ExileSpellEffect(mage.abilities.effects.common.ExileSpellEffect) Effect(mage.abilities.effects.Effect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 3 with AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility in project mage by magefree.

the class EpicPushEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    Spell spell = (Spell) source.getSourceObject(game);
    if (spell == null) {
        return false;
    }
    // it's a fake spell (template), real copy with events in EpicPushEffect
    spell = spell.copy();
    spell.getSpellAbility().getEffects().removeIf(EpicEffect.class::isInstance);
    game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new EpicPushEffect(spell, rule), Duration.EndOfGame, false), source);
    game.addEffect(new EpicReplacementEffect(), source);
    return true;
}
Also used : Player(mage.players.Player) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) Spell(mage.game.stack.Spell)

Example 4 with AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility in project mage by magefree.

the class ForceOfRageEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token token = new AkoumStonewakerElementalToken();
    token.putOntoBattlefield(2, game, source, source.getControllerId());
    List<Permanent> permanentList = new ArrayList();
    for (UUID permId : token.getLastAddedTokenIds()) {
        permanentList.add(game.getPermanent(permId));
    }
    Effect effect = new SacrificeTargetEffect("sacrifice those tokens");
    effect.setTargetPointer(new FixedTargets(permanentList, game));
    game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect), source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) ArrayList(java.util.ArrayList) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) Token(mage.game.permanent.token.Token) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Example 5 with AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility in project mage by magefree.

the class PhytotitanEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // create delayed triggered ability
    Effect effect = new ReturnSourceFromGraveyardToBattlefieldEffect(true, true);
    effect.setText(staticText);
    DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect);
    game.addDelayedTriggeredAbility(delayedAbility, source);
    return true;
}
Also used : ReturnSourceFromGraveyardToBattlefieldEffect(mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ReturnSourceFromGraveyardToBattlefieldEffect(mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility)

Aggregations

AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility)6 Effect (mage.abilities.effects.Effect)5 OneShotEffect (mage.abilities.effects.OneShotEffect)5 Player (mage.players.Player)4 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)3 Permanent (mage.game.permanent.Permanent)3 ArrayList (java.util.ArrayList)2 FixedTargets (mage.target.targetpointer.FixedTargets)2 UUID (java.util.UUID)1 PermanentsOnBattlefieldCount (mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 DrawCardSourceControllerEffect (mage.abilities.effects.common.DrawCardSourceControllerEffect)1 ExileAllEffect (mage.abilities.effects.common.ExileAllEffect)1 ExileSpellEffect (mage.abilities.effects.common.ExileSpellEffect)1 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)1 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 LoseLifeOpponentsEffect (mage.abilities.effects.common.LoseLifeOpponentsEffect)1 ReturnSourceFromGraveyardToBattlefieldEffect (mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect)1 ReturnToBattlefieldUnderOwnerControlTargetEffect (mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect)1 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)1