use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class PrimalAdversaryToken method apply.
@Override
public boolean apply(Game game, Ability source) {
Integer timesPaid = (Integer) getValue("timesPaid");
if (timesPaid == null || timesPaid <= 0) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(timesPaid)), false, staticText);
ability.addEffect(new BecomesCreatureTargetEffect(new PrimalAdversaryToken(), false, true, Duration.Custom));
ability.addTarget(new TargetPermanent(0, timesPaid, StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS));
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class SpareDaggerEffect method makeAbility.
@Override
protected Ability makeAbility(Game game, Ability source) {
if (source == null || game == null) {
return null;
}
String sourceName = source.getSourcePermanentIfItStillExists(game).getName();
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(1), false, "This creature deals 1 damage to any target");
ability.addTarget(new TargetAnyTarget());
return new AttacksTriggeredAbility(new DoWhenCostPaid(ability, useAttachedCost.copy().setMageObjectReference(source, game), "Sacrifice " + sourceName + "?"), false, "Whenever this creature attacks, you may sacrifice " + sourceName + ". When you do, this creature deals 1 damage to any target.");
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class TaintedAdversaryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Integer timesPaid = (Integer) getValue("timesPaid");
if (timesPaid == null || timesPaid <= 0) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(timesPaid)), false, staticText);
ability.addEffect(new CreateTokenEffect(new ZombieDecayedToken(), 2 * timesPaid));
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class LeylineTyrantDamageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
String manaString;
if (costX == 0) {
manaString = "{0}";
} else {
manaString = "";
for (int i = 0; i < costX; i++) {
manaString += "{R}";
}
}
Cost cost = new ManaCostsImpl<>(manaString);
cost.clearPaid();
if (!cost.pay(source, game, source, source.getControllerId(), false)) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(costX), false, "{this} deals " + costX + " damage to any target");
ability.addTarget(new TargetAnyTarget());
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.common.delayed.ReflexiveTriggeredAbility in project mage by magefree.
the class MagmaPummelerEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int damage = event.getAmount();
preventDamageAction(event, source, game);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
return false;
}
int beforeCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
permanent.removeCounters(CounterType.P1P1.createInstance(damage), source, game);
int countersRemoved = beforeCounters - permanent.getCounters(game).getCount(CounterType.P1P1);
if (countersRemoved > 0) {
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(countersRemoved), false, "{this} deals that much damage to any target");
ability.addTarget(new TargetAnyTarget());
game.fireReflexiveTriggeredAbility(ability, source);
}
return false;
}
Aggregations