use of mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility in project mage by magefree.
the class ArcaneDenialEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = null;
boolean countered = false;
UUID targetId = this.getTargetPointer().getFirst(game, source);
if (targetId != null) {
controller = game.getPlayer(game.getControllerId(targetId));
}
if (targetId != null && game.getStack().counter(targetId, source, game)) {
countered = true;
}
if (controller != null) {
Effect effect = new DrawCardTargetEffect(StaticValue.get(2), false, true);
effect.setTargetPointer(new FixedTarget(controller.getId()));
effect.setText("Its controller may draw up to two cards");
DelayedTriggeredAbility ability = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(ability, source);
}
return countered;
}
use of mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility in project mage by magefree.
the class LatNamsLegacyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && !controller.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library"));
controller.choose(Outcome.Detriment, controller.getHand(), target, game);
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
boolean successful = controller.moveCards(card, Zone.LIBRARY, source, game);
controller.shuffleLibrary(source, game);
if (successful) {
new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(2)), false).apply(game, source);
}
}
return true;
}
return true;
}
Aggregations