Search in sources :

Example 11 with RevealTargetFromHandCost

use of mage.abilities.costs.common.RevealTargetFromHandCost 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 12 with RevealTargetFromHandCost

use of mage.abilities.costs.common.RevealTargetFromHandCost in project mage by magefree.

the class NightshadeSeerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
    if (!cost.pay(source, game, source, source.getControllerId(), true)) {
        return false;
    }
    int xValue = -1 * cost.getNumberRevealedCards();
    game.addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn), source);
    return true;
}
Also used : RevealTargetFromHandCost(mage.abilities.costs.common.RevealTargetFromHandCost) TargetCardInHand(mage.target.common.TargetCardInHand) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect)

Example 13 with RevealTargetFromHandCost

use of mage.abilities.costs.common.RevealTargetFromHandCost in project mage by magefree.

the class LivingDestinyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
    if (cost != null) {
        Player player = game.getPlayer(source.getControllerId());
        int CMC = cost.manaValues;
        if (player != null) {
            player.gainLife(CMC, game, source);
        }
    }
    return true;
}
Also used : RevealTargetFromHandCost(mage.abilities.costs.common.RevealTargetFromHandCost) Player(mage.players.Player)

Example 14 with RevealTargetFromHandCost

use of mage.abilities.costs.common.RevealTargetFromHandCost in project mage by magefree.

the class ChargeOfTheForeverBeastEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
    if (permanent == null || cost == null) {
        return false;
    }
    Card card = cost.getRevealedCards().get(0);
    if (card == null) {
        return false;
    }
    return permanent.damage(card.getPower().getValue(), source.getSourceId(), source, game) > 0;
}
Also used : RevealTargetFromHandCost(mage.abilities.costs.common.RevealTargetFromHandCost) Permanent(mage.game.permanent.Permanent) Card(mage.cards.Card)

Aggregations

RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)14 TargetCardInHand (mage.target.common.TargetCardInHand)10 BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)5 Permanent (mage.game.permanent.Permanent)3 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)2 CounterUnlessPaysEffect (mage.abilities.effects.common.CounterUnlessPaysEffect)2 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)2 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)2 Card (mage.cards.Card)2 Player (mage.players.Player)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 FilterCreatureCard (mage.filter.common.FilterCreatureCard)1 FixedTarget (mage.target.targetpointer.FixedTarget)1