Search in sources :

Example 1 with AddCardTypeTargetEffect

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

the class DanceOfTheManseEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Cards cards = new CardsImpl(source.getTargets().stream().map(Target::getTargets).flatMap(Collection::stream).map(game::getCard).filter(Objects::nonNull).collect(Collectors.toSet()));
    player.moveCards(cards, Zone.BATTLEFIELD, source, game);
    if (source.getManaCostsToPay().getX() < 6) {
        return true;
    }
    cards.stream().map(game::getPermanent).filter(Objects::nonNull).forEach(permanent -> {
        ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.CREATURE);
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
        effect = new SetPowerToughnessTargetEffect(4, 4, Duration.EndOfGame);
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
    });
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Objects(java.util.Objects) Collection(java.util.Collection) ContinuousEffect(mage.abilities.effects.ContinuousEffect) SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) AddCardTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardTypeTargetEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl)

Example 2 with AddCardTypeTargetEffect

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

the class SaheeliSublimeArtificerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent copyTo = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (copyTo != null) {
        Permanent copyFrom = game.getPermanentOrLKIBattlefield(source.getTargets().get(1).getFirstTarget());
        if (copyFrom != null) {
            game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyCopyApplier());
            ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT);
            effect.setTargetPointer(new FixedTarget(copyTo, game));
            game.addEffect(effect, source);
        }
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterControlledArtifactPermanent(mage.filter.common.FilterControlledArtifactPermanent) FilterPermanent(mage.filter.FilterPermanent) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) EmptyCopyApplier(mage.util.functions.EmptyCopyApplier) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCardTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardTypeTargetEffect)

Example 3 with AddCardTypeTargetEffect

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

the class ArbiterOfTheIdealEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller == null || sourceObject == null) {
        return false;
    }
    Card card = controller.getLibrary().getFromTop(game);
    if (card != null) {
        controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
        if (filter.match(card, game) && controller.chooseUse(outcome, "Put " + card.getName() + "onto battlefield?", source, game)) {
            controller.moveCards(card, Zone.BATTLEFIELD, source, game);
            Permanent permanent = game.getPermanent(card.getId());
            if (permanent != null) {
                permanent.addCounters(CounterType.MANIFESTATION.createInstance(), source.getControllerId(), source, game);
                ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ENCHANTMENT);
                effect.setTargetPointer(new FixedTarget(permanent, game));
                game.addEffect(effect, source);
            }
        }
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) MageObject(mage.MageObject) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCardTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardTypeTargetEffect) FilterCard(mage.filter.FilterCard)

Example 4 with AddCardTypeTargetEffect

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

the class KatsumasaTheAnimatorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    game.addEffect(new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE), source);
    game.addEffect(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
    if (permanent.hasSubtype(SubType.VEHICLE, game)) {
        game.addEffect(new SetPowerToughnessTargetEffect(1, 1, Duration.EndOfTurn), source);
    }
    return true;
}
Also used : FilterControlledArtifactPermanent(mage.filter.common.FilterControlledArtifactPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterArtifactPermanent(mage.filter.common.FilterArtifactPermanent) TargetPermanent(mage.target.TargetPermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) AddCardTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardTypeTargetEffect)

Example 5 with AddCardTypeTargetEffect

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

the class RiseAndShineEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    List<Permanent> permanents = game.getBattlefield().getActivePermanents(RiseAndShine.filter, source.getControllerId(), source.getSourceId(), game);
    if (permanents.isEmpty()) {
        return false;
    }
    game.addEffect(new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE).setTargetPointer(new FixedTargets(permanents, game)), source);
    game.addEffect(new SetPowerToughnessTargetEffect(0, 0, Duration.EndOfGame).setTargetPointer(new FixedTargets(permanents, game)), source);
    for (Permanent permanent : permanents) {
        permanent.addCounters(CounterType.P1P1.createInstance(4), source.getControllerId(), source, game);
    }
    return true;
}
Also used : FilterControlledArtifactPermanent(mage.filter.common.FilterControlledArtifactPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) FixedTargets(mage.target.targetpointer.FixedTargets) SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) AddCardTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardTypeTargetEffect)

Aggregations

AddCardTypeTargetEffect (mage.abilities.effects.common.continuous.AddCardTypeTargetEffect)5 Permanent (mage.game.permanent.Permanent)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 SetPowerToughnessTargetEffect (mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect)3 FilterPermanent (mage.filter.FilterPermanent)3 FilterControlledArtifactPermanent (mage.filter.common.FilterControlledArtifactPermanent)3 TargetPermanent (mage.target.TargetPermanent)3 FixedTarget (mage.target.targetpointer.FixedTarget)3 Player (mage.players.Player)2 Collection (java.util.Collection)1 Objects (java.util.Objects)1 MageObject (mage.MageObject)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 FilterCard (mage.filter.FilterCard)1 FilterArtifactPermanent (mage.filter.common.FilterArtifactPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 FixedTargets (mage.target.targetpointer.FixedTargets)1 EmptyCopyApplier (mage.util.functions.EmptyCopyApplier)1