Search in sources :

Example 1 with DiesCreatureTriggeredAbility

use of mage.abilities.common.DiesCreatureTriggeredAbility in project mage by magefree.

the class CemeteryPucaEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent copyToCreature = game.getPermanent(source.getSourceId());
    if (copyToCreature != null) {
        Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
        if (copyFromCreature != null) {
            game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
            ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, StaticFilters.FILTER_PERMANENT_A_CREATURE, true), Duration.WhileOnBattlefield);
            effect.setTargetPointer(new FixedTarget(copyToCreature.getId(), game));
            game.addEffect(effect, source);
            return true;
        }
    }
    return false;
}
Also used : DiesCreatureTriggeredAbility(mage.abilities.common.DiesCreatureTriggeredAbility) FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) EmptyCopyApplier(mage.util.functions.EmptyCopyApplier) DoIfCostPaid(mage.abilities.effects.common.DoIfCostPaid) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Aggregations

DiesCreatureTriggeredAbility (mage.abilities.common.DiesCreatureTriggeredAbility)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 DoIfCostPaid (mage.abilities.effects.common.DoIfCostPaid)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1 EmptyCopyApplier (mage.util.functions.EmptyCopyApplier)1