Search in sources :

Example 1 with SetPowerToughnessTargetEffect

use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect 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 SetPowerToughnessTargetEffect

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

the class VhatiIlDalEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        DynamicValue power = null;
        DynamicValue toughness = null;
        if (controller.chooseUse(outcome, "Set power? (otherwise toughness is set)", source, game)) {
            power = StaticValue.get(1);
        } else {
            toughness = StaticValue.get(1);
        }
        ContinuousEffect effect = new SetPowerToughnessTargetEffect(power, toughness, Duration.EndOfTurn);
        game.addEffect(effect, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) ContinuousEffect(mage.abilities.effects.ContinuousEffect) SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) DynamicValue(mage.abilities.dynamicvalue.DynamicValue)

Example 3 with SetPowerToughnessTargetEffect

use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect 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 4 with SetPowerToughnessTargetEffect

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

the class SingingTreeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent targetCreature = game.getPermanent(source.getFirstTarget());
    if (targetCreature != null) {
        int toughness = targetCreature.getToughness().getBaseValueModified();
        game.addEffect(new SetPowerToughnessTargetEffect(0, toughness, Duration.EndOfTurn), source);
        return true;
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect)

Example 5 with SetPowerToughnessTargetEffect

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

the class MinscBelovedRangerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = source.getManaCostsToPay().getX();
    game.addEffect(new SetPowerToughnessTargetEffect(xValue, xValue, Duration.EndOfTurn), source);
    game.addEffect(new AddCardSubTypeTargetEffect(SubType.GIANT, Duration.EndOfTurn), source);
    return true;
}
Also used : SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Aggregations

SetPowerToughnessTargetEffect (mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect)10 Permanent (mage.game.permanent.Permanent)7 ContinuousEffect (mage.abilities.effects.ContinuousEffect)4 Player (mage.players.Player)4 AddCardTypeTargetEffect (mage.abilities.effects.common.continuous.AddCardTypeTargetEffect)3 FilterPermanent (mage.filter.FilterPermanent)3 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 TargetPermanent (mage.target.TargetPermanent)3 FixedTarget (mage.target.targetpointer.FixedTarget)3 FilterControlledArtifactPermanent (mage.filter.common.FilterControlledArtifactPermanent)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 Collection (java.util.Collection)1 Objects (java.util.Objects)1 DynamicValue (mage.abilities.dynamicvalue.DynamicValue)1 AddCardSubTypeTargetEffect (mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 FilterArtifactPermanent (mage.filter.common.FilterArtifactPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1