Search in sources :

Example 6 with CreateTokenCopyTargetEffect

use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.

the class WeddingRingTriggeredAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    Permanent permanent = source.getSourcePermanentOrLKI(game);
    if (player == null || permanent == null) {
        return false;
    }
    return new CreateTokenCopyTargetEffect(player.getId()).setTargetPointer(new FixedTarget(permanent, game)).apply(game, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterControlledArtifactPermanent(mage.filter.common.FilterControlledArtifactPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect)

Example 7 with CreateTokenCopyTargetEffect

use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.

the class CleaverSkaabEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = CardUtil.castStream(source.getCosts().stream(), SacrificeTargetCost.class).map(SacrificeTargetCost::getPermanents).flatMap(Collection::stream).findFirst().orElse(null);
    if (permanent == null) {
        return false;
    }
    CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect();
    effect.setSavedPermanent(permanent);
    effect.setNumber(2);
    return effect.apply(game, source);
}
Also used : FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) Collection(java.util.Collection) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect)

Example 8 with CreateTokenCopyTargetEffect

use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.

the class JaceMirrorMageDrawEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (permanent == null) {
        return false;
    }
    CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 1);
    effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
    effect.setIsntLegendary(true);
    effect.setStartingLoyalty(1);
    return effect.apply(game, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect)

Example 9 with CreateTokenCopyTargetEffect

use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.

the class BrambleSovereignEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    if (permanent != null) {
        CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
        effect.setTargetPointer(targetPointer);
        effect.apply(game, source);
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect)

Example 10 with CreateTokenCopyTargetEffect

use of mage.abilities.effects.common.CreateTokenCopyTargetEffect 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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect)

Aggregations

CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)64 FixedTarget (mage.target.targetpointer.FixedTarget)50 Permanent (mage.game.permanent.Permanent)46 Player (mage.players.Player)31 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)20 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)17 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)14 Card (mage.cards.Card)12 TargetPermanent (mage.target.TargetPermanent)10 UUID (java.util.UUID)9 Effect (mage.abilities.effects.Effect)8 OneShotEffect (mage.abilities.effects.OneShotEffect)8 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)7 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)7 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)7 FixedTargets (mage.target.targetpointer.FixedTargets)6 AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)5 FilterPermanent (mage.filter.FilterPermanent)5 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)5 FilterCard (mage.filter.FilterCard)4