use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class KappaTechWreckerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment that player controls");
filter.add(new ControllerIdPredicate(getTargetPointer().getFirst(game, source)));
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new ExileTargetEffect(), false);
ability.addTarget(new TargetPermanent(filter));
return new DoWhenCostPaid(ability, new RemoveCountersSourceCost(CounterType.DEATHTOUCH.createInstance()), "Remove a deathtouch counter?").apply(game, source);
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class NumaJoragaChieftainEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
ManaCosts cost = new ManaCostsImpl("{X}{X}");
if (!player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) {
return false;
}
int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
cost.add(new GenericManaCost(2 * costX));
if (!cost.pay(source, game, source, source.getControllerId(), false, null)) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, costX, false, ""), false, "distribute " + costX + " +1/+1 counters among any number of target Elves");
ability.addTarget(new TargetCreaturePermanentAmount(costX, filter));
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class BlindZealotTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent == null || !event.getSourceId().equals(getSourceId()) || !((DamagedEvent) event).isCombatDamage()) {
return false;
}
FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker" + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DestroyTargetEffect(), false, "destroy target creature or planeswalker that player controls");
this.getEffects().clear();
this.addEffect(new DoWhenCostPaid(ability, new DiscardTargetCost(new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE)), "Discard a creature card?"));
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class FieryEncoreEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.discardOne(false, false, source, game);
player.drawCards(1, source, game);
if (card == null || card.isLand(game)) {
return true;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(card.getManaValue()), false, "when you discard a nonland " + "card this way, {this} deals damage equal to that card's mana value to target creature or planeswalker");
ability.addTarget(new TargetCreatureOrPlaneswalker());
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class KirinTouchedOrochiCounterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
UUID targetId = source.getFirstTarget();
Card card = game.getCard(targetId);
if (controller == null || card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
return false;
}
if (!controller.moveCards(card, Zone.EXILED, source, game)) {
return false;
}
ReflexiveTriggeredAbility reflexiveTokenAbility = new ReflexiveTriggeredAbility(new CreateTokenEffect(new SpiritToken()), false);
game.fireReflexiveTriggeredAbility(reflexiveTokenAbility, source);
return true;
}
Aggregations