Search in sources :

Example 6 with ManaCostsImpl

use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.

the class ConditionalAsThoughTest method test_TargetCardInLibrary_CantUseAsAbilityTarget.

@Test(expected = IllegalArgumentException.class)
public void test_TargetCardInLibrary_CantUseAsAbilityTarget() {
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new InfoEffect("test"), new ManaCostsImpl("{R}"));
    ability.addTarget(new TargetCardInLibrary());
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) InfoEffect(mage.abilities.effects.common.InfoEffect) Test(org.junit.Test)

Example 7 with ManaCostsImpl

use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.

the class ProwlAbility method addProwlCost.

public final AlternativeCost2 addProwlCost(String manaString) {
    AlternativeCost2 prowlCost = new AlternativeCost2Impl(PROWL_KEYWORD, reminderText, new ManaCostsImpl(manaString));
    prowlCosts.add(prowlCost);
    return prowlCost;
}
Also used : ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 8 with ManaCostsImpl

use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.

the class ProwlAbility method askToActivateAlternativeCosts.

@Override
public boolean askToActivateAlternativeCosts(Ability ability, Game game) {
    if (ability instanceof SpellAbility) {
        Player player = game.getPlayer(ability.getControllerId());
        if (player == null) {
            return false;
        }
        if (ProwlCondition.instance.apply(game, ability)) {
            this.resetProwl();
            for (AlternativeCost2 prowlCost : prowlCosts) {
                if (prowlCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(Outcome.Benefit, "Cast for " + PROWL_KEYWORD + " cost " + prowlCost.getText(true) + " ?", ability, game)) {
                    prowlCost.activate();
                    ability.getManaCostsToPay().clear();
                    ability.getCosts().clear();
                    for (Iterator it = ((Costs) prowlCost).iterator(); it.hasNext(); ) {
                        Cost cost = (Cost) it.next();
                        if (cost instanceof ManaCostsImpl) {
                            ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
                        } else {
                            ability.getCosts().add(cost.copy());
                        }
                    }
                }
            }
        }
    }
    return isActivated(ability, game);
}
Also used : Player(mage.players.Player) Iterator(java.util.Iterator) SpellAbility(mage.abilities.SpellAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 9 with ManaCostsImpl

use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.

the class KickerAbility method addKickerCost.

public final OptionalAdditionalCost addKickerCost(String manaString) {
    OptionalAdditionalCost newCost = new OptionalAdditionalCostImpl(keywordText, reminderText, new ManaCostsImpl(manaString));
    addKickerCostAndSetup(newCost);
    return newCost;
}
Also used : ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 10 with ManaCostsImpl

use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.

the class CemeteryPucaEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent copyToCreature = game.getPermanent(source.getSourceId());
    if (copyToCreature != null) {
        Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
        if (copyFromCreature != null) {
            game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
            ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, StaticFilters.FILTER_PERMANENT_A_CREATURE, true), Duration.WhileOnBattlefield);
            effect.setTargetPointer(new FixedTarget(copyToCreature.getId(), game));
            game.addEffect(effect, source);
            return true;
        }
    }
    return false;
}
Also used : DiesCreatureTriggeredAbility(mage.abilities.common.DiesCreatureTriggeredAbility) FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) EmptyCopyApplier(mage.util.functions.EmptyCopyApplier) DoIfCostPaid(mage.abilities.effects.common.DoIfCostPaid) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Aggregations

ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)98 Player (mage.players.Player)63 Permanent (mage.game.permanent.Permanent)33 Ability (mage.abilities.Ability)26 Cost (mage.abilities.costs.Cost)26 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)23 UUID (java.util.UUID)16 Card (mage.cards.Card)16 ManaCosts (mage.abilities.costs.mana.ManaCosts)15 SpellAbility (mage.abilities.SpellAbility)14 FixedTarget (mage.target.targetpointer.FixedTarget)13 Test (org.junit.Test)13 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)12 ManaCost (mage.abilities.costs.mana.ManaCost)11 ContinuousEffect (mage.abilities.effects.ContinuousEffect)8 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)7 TargetPermanent (mage.target.TargetPermanent)7 MageObjectReference (mage.MageObjectReference)6 Effect (mage.abilities.effects.Effect)6 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)6