use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class ViashinoSandswimmerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller != null && permanent != null) {
if (controller.flipCoin(source, game, true)) {
new ReturnToHandSourceEffect().apply(game, source);
return true;
} else {
new SacrificeSourceEffect().apply(game, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class NalathniDragonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() >= 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class VaporSnareEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean targetChosen = false;
Player controller = game.getPlayer(source.getControllerId());
TargetPermanent target = new TargetPermanent(1, 1, filter, false);
if (controller != null && target.canChoose(source.getSourceId(), controller.getId(), game)) {
controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetChosen = true;
controller.moveCards(permanent, Zone.HAND, source, game);
}
}
if (!targetChosen) {
new SacrificeSourceEffect().apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class FarrelitePriestEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() == 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class MinionReflectorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true);
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanents()) {
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(new BeginningOfEndStepTriggeredAbility(new SacrificeSourceEffect(), TargetController.ANY, false), Duration.Custom);
continuousEffect.setTargetPointer(new FixedTarget(addedToken.getId()));
game.addEffect(continuousEffect, source);
}
return true;
}
return false;
}
Aggregations