use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class TearsOfRageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId());
effect.setTargetPointer(new FixedTargets(game.getBattlefield().getAllActivePermanents(new FilterAttackingCreature(), controller.getId(), game), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class KillerInstinctEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (player == null || sourceObject == null) {
return false;
}
Library library = player.getLibrary();
if (library == null || !library.hasCards()) {
return false;
}
Card card = library.getFromTop(game);
if (card == null) {
return false;
}
player.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
if (card.isCreature(game) && player.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
FixedTarget ft = new FixedTarget(permanent, game);
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(ft);
game.addEffect(effect, source);
Effect sacrificeEffect = new SacrificeTargetEffect("Sacrifice it at the beginning of the next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(ft);
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class KikiJikiMirrorBreakerEffect 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()) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(addedToken.getId()));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class SeraphDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card creatureCard = game.getCard(targetPointer.getFirst(game, source));
if (controller != null && creatureCard != null && game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) {
// must be still in the graveyard
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game, false, false, false, null);
OneShotEffect effect = new SacrificeTargetEffect();
effect.setText("Sacrifice this if Seraph leaves the battlefield or its current controller loses control of it.");
effect.setTargetPointer(new FixedTarget(creatureCard.getId()));
SeraphDelayedTriggeredAbility dTA = new SeraphDelayedTriggeredAbility(effect, source.getSourceId());
game.addDelayedTriggeredAbility(dTA, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class PlaneboundAccompliceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (!controller.chooseUse(Outcome.PutCardInPlay, "Put a planeswalker card from your hand onto the battlefield?", source, game)) {
return true;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (!controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
return true;
}
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
if (!controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
return false;
}
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return true;
}
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + card.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
Aggregations