use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class ForceProjectionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (controller != null && permanent != null) {
// Create a token that is a copy of target creature
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true);
effect.setTargetPointer(new FixedTarget(permanent, game));
// except that it is an Illusion in addition to its other types
effect.setAdditionalSubType(SubType.SPIRIT);
effect.apply(game, source);
// and gains "When this creature becomes the target of a spell, sacrifice it."
Effect sacrificeEffect = new SacrificeSourceEffect();
sacrificeEffect.setTargetPointer(new FixedTarget(effect.getAddedPermanents().get(0), game));
TriggeredAbility ability = new BecomesTargetTriggeredAbility(sacrificeEffect, new FilterSpell());
game.addTriggeredAbility(ability, null);
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class GoblinKitesEffect 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)) {
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 InitiatesOfTheEbonHandEffect 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 PillarTombsOfAkuEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer == null) {
return false;
}
if (activePlayer.chooseUse(Outcome.Sacrifice, "Sacrifice a creature?", source, game)) {
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
if (cost.canPay(source, source, activePlayer.getId(), game) && cost.pay(source, game, source, activePlayer.getId(), true)) {
return true;
}
}
activePlayer.loseLife(5, game, source, false);
return new SacrificeSourceEffect().apply(game, source);
}
use of mage.abilities.effects.common.SacrificeSourceEffect in project mage by magefree.
the class DragonWhelpEffect 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;
}
Aggregations