use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class RodOfSpankingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player target = game.getPlayer(source.getFirstTarget());
new DamageTargetEffect(1).apply(game, source);
if (target != null) {
if (target.chooseUse(Outcome.Untap, "Say \"Thank you, sir. May I have another?\"", source, game)) {
game.informPlayers(target.getLogName() + ": Thank you, sir. May I have another?");
} else {
new UntapSourceEffect().apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ToralfsHammerEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedEvent dEvent = (DamagedEvent) event;
if (dEvent.getExcess() < 1 || dEvent.isCombatDamage() || !game.getOpponents(getControllerId()).contains(game.getControllerId(event.getTargetId()))) {
return false;
}
this.getEffects().clear();
this.getTargets().clear();
this.addEffect(new DamageTargetEffect(dEvent.getExcess()));
FilterCreaturePlayerOrPlaneswalker filter = new FilterCreaturePlayerOrPlaneswalker();
filter.getPermanentFilter().add(Predicates.not(new MageObjectReferencePredicate(new MageObjectReference(event.getTargetId(), game))));
this.addTarget(new TargetAnyTarget(filter));
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class HankyuCost method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) {
return false;
}
Permanent creature = game.getPermanent(permanent.getAttachedTo());
if (creature == null) {
return false;
}
creature.addAbility(new SimpleActivatedAbility(new AddCountersTargetEffect(CounterType.AIM.createInstance()).setTargetPointer(new FixedTarget(permanent, game)).setText("put an aim counter on " + permanent.getName()), new TapSourceCost()), source.getSourceId(), game);
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(HankyuValue.instance).setText("this creature deals damage to any target equal " + "to the number of aim counters removed this way"), new TapSourceCost());
ability.addCost(new HankyuCost().setMageObjectReference(source, game));
ability.addTarget(new TargetAnyTarget());
creature.addAbility(ability, source.getSourceId(), game);
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class MindWhipEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controllerOfEnchantedCreature = game.getPlayer(targetPointer.getFirst(game, source));
Permanent mindWhip = game.getPermanent(source.getSourceId());
if (controllerOfEnchantedCreature != null && mindWhip != null) {
Permanent enchantedCreature = game.getPermanent(mindWhip.getAttachedTo());
if (enchantedCreature != null) {
Effect effect = new DamageTargetEffect(2);
effect.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId()));
effect.apply(game, source);
enchantedCreature.tap(source, game);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class TephradermSpellDamageTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getTargetId().equals(this.getSourceId())) {
return false;
}
Permanent sourcePermanent = game.getPermanent(event.getSourceId());
if (sourcePermanent != null && FILTER_CREATURE.match(sourcePermanent, getSourceId(), getControllerId(), game)) {
for (Effect effect : getEffects()) {
if (effect instanceof DamageTargetEffect) {
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
((DamageTargetEffect) effect).setAmount(StaticValue.get(event.getAmount()));
}
}
return true;
}
return false;
}
Aggregations