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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations