Search in sources :

Example 36 with BoostTargetEffect

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

the class BoostEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    ContinuousEffect effect = new BoostTargetEffect(amount, amount, Duration.EndOfTurn);
    effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
    game.addEffect(effect, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 37 with BoostTargetEffect

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

the class ErraticMutationEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (controller != null && sourceObject != null) {
        CardsImpl toReveal = new CardsImpl();
        Card nonLandCard = null;
        for (Card card : controller.getLibrary().getCards(game)) {
            toReveal.add(card);
            if (!card.isLand(game)) {
                nonLandCard = card;
                break;
            }
        }
        // reveal cards
        controller.revealCards(sourceObject.getIdName(), toReveal, game);
        // the nonland card
        if (nonLandCard != null) {
            int boostValue = nonLandCard.getManaValue();
            // unboost target
            ContinuousEffect effect = new BoostTargetEffect(boostValue, -boostValue, Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source), game));
            game.addEffect(effect, source);
        }
        // put the cards on the bottom of the library in any order
        return controller.putCardsOnBottomOfLibrary(toReveal, game, source, true);
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) MageObject(mage.MageObject) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card)

Example 38 with BoostTargetEffect

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

the class FlareOfFaithEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    if (permanent.hasSubtype(SubType.HUMAN, game)) {
        game.addEffect(new BoostTargetEffect(3, 3), source);
        game.addEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), source);
    } else {
        game.addEffect(new BoostTargetEffect(2, 2), source);
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect)

Example 39 with BoostTargetEffect

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

the class InduceDespairEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
    Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
    if (cost != null && creature != null) {
        int cmcBoost = -1 * cost.manaValues;
        ContinuousEffect effect = new BoostTargetEffect(cmcBoost, cmcBoost, Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game)));
        game.addEffect(effect, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) RevealTargetFromHandCost(mage.abilities.costs.common.RevealTargetFromHandCost) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 40 with BoostTargetEffect

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

the class NightshadeAssassinEffect 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;
    }
    FilterCard filter = new FilterCard();
    filter.add(new ColorPredicate(ObjectColor.BLACK));
    int blackCards = controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game);
    int cardsToReveal = controller.getAmount(0, blackCards, "Reveal how many black cards?", game);
    game.informPlayers(controller.getLogName() + " chooses to reveal " + cardsToReveal + " black cards.");
    if (cardsToReveal > 0) {
        TargetCardInHand target = new TargetCardInHand(cardsToReveal, cardsToReveal, filter);
        if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
            controller.revealCards(sourceObject.getIdName(), new CardsImpl(target.getTargets()), game);
            int unboost = target.getTargets().size() * -1;
            ContinuousEffect effect = new BoostTargetEffect(unboost, unboost, Duration.EndOfTurn);
            effect.setTargetPointer(getTargetPointer());
            game.addEffect(effect, source);
        }
    }
    return true;
}
Also used : FilterCard(mage.filter.FilterCard) ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) Player(mage.players.Player) TargetCardInHand(mage.target.common.TargetCardInHand) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) MageObject(mage.MageObject) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CardsImpl(mage.cards.CardsImpl)

Aggregations

BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)81 Permanent (mage.game.permanent.Permanent)58 FixedTarget (mage.target.targetpointer.FixedTarget)46 ContinuousEffect (mage.abilities.effects.ContinuousEffect)36 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)34 Player (mage.players.Player)31 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)16 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)10 TargetPermanent (mage.target.TargetPermanent)10 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)10 Card (mage.cards.Card)9 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)8 CardsImpl (mage.cards.CardsImpl)7 FilterPermanent (mage.filter.FilterPermanent)7 UUID (java.util.UUID)5 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)5 OneShotEffect (mage.abilities.effects.OneShotEffect)5 TargetCardInHand (mage.target.common.TargetCardInHand)5 Ability (mage.abilities.Ability)4 MageObject (mage.MageObject)3