Search in sources :

Example 1 with AddCardTypeSourceEffect

use of mage.abilities.effects.common.continuous.AddCardTypeSourceEffect in project mage by magefree.

the class MirrorOfTheForebearsCopyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (sourcePermanent != null && copyFromPermanent != null) {
        game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
        game.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), source);
        return true;
    }
    return false;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) EmptyCopyApplier(mage.util.functions.EmptyCopyApplier) AddCardTypeSourceEffect(mage.abilities.effects.common.continuous.AddCardTypeSourceEffect)

Aggregations

AddCardTypeSourceEffect (mage.abilities.effects.common.continuous.AddCardTypeSourceEffect)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1 EmptyCopyApplier (mage.util.functions.EmptyCopyApplier)1