use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class CalibratedBlastEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
for (Card card : player.getLibrary().getCards(game)) {
cards.add(card);
if (card.isLand(game)) {
continue;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(card.getManaValue()), false, "When you reveal " + "a nonland card this way, {this} deals damage equal to that card's mana value to any target");
ability.addTarget(new TargetAnyTarget());
game.fireReflexiveTriggeredAbility(ability, source);
break;
}
player.revealCards(source, cards, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class BedazzleEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.destroy(source, game, false);
}
Effect effect = new DamageTargetEffect(StaticValue.get(2), true, "", true);
effect.setTargetPointer(new FixedTarget(source.getTargets().get(1).getFirstTarget(), game));
effect.apply(game, source);
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ChandrasIncineratorTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent dEvent = (DamagedPlayerEvent) event;
if (dEvent.isCombatDamage() || !game.getOpponents(event.getTargetId()).contains(getControllerId()) || !game.getControllerId(event.getSourceId()).equals(getControllerId())) {
return false;
}
this.getEffects().clear();
this.addEffect(new DamageTargetEffect(event.getAmount()));
FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker");
filter.add(new ControllerIdPredicate(event.getTargetId()));
this.getTargets().clear();
this.addTarget(new TargetPermanent(filter));
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ChandraFireArtisanEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getAmount() == 0 || !event.getData().equals("loyalty") || !event.getTargetId().equals(this.getSourceId())) {
return false;
}
this.getEffects().clear();
this.addEffect(new DamageTargetEffect(event.getAmount()));
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ArcheryTrainingValue method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura == null) {
return false;
}
Permanent permanent = game.getPermanent(aura.getAttachedTo());
if (permanent == null) {
return false;
}
String rule = "this creature deals X damage to target attacking or blocking creature, " + "where X is the number of arrow counters on " + aura.getName();
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(new ArcheryTrainingValue(aura)).setText(rule), new TapSourceCost());
ability.addTarget(new TargetAttackingOrBlockingCreature());
permanent.addAbility(ability, source.getSourceId(), game);
return true;
}
Aggregations