Search in sources :

Example 11 with SimpleActivatedAbility

use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.

the class CustomTestCard method addCustomEffect_ReturnFromAnyToHand.

/**
 * Return target card to hand that can be called by text "return from ..."
 *
 * @param controller
 */
protected void addCustomEffect_ReturnFromAnyToHand(TestPlayer controller) {
    // graveyard
    Ability ability = new SimpleActivatedAbility(new ReturnFromGraveyardToHandTargetEffect().setText("return from graveyard"), new ManaCostsImpl(""));
    ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD));
    addCustomCardWithAbility("return from graveyard for " + controller.getName(), controller, ability);
    // exile
    ability = new SimpleActivatedAbility(new ReturnFromExileEffect(Zone.HAND).setText("return from exile"), new ManaCostsImpl(""));
    ability.addTarget(new TargetCardInExile(StaticFilters.FILTER_CARD));
    addCustomCardWithAbility("return from exile for " + controller.getName(), controller, ability);
    // library
    ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD)).setText("return from library"), new ManaCostsImpl(""));
    addCustomCardWithAbility("return from library for " + controller.getName(), controller, ability);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SpellAbility(mage.abilities.SpellAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) TargetCardInGraveyard(mage.target.common.TargetCardInGraveyard) ReturnFromExileEffect(mage.abilities.effects.common.ReturnFromExileEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetCardInExile(mage.target.common.TargetCardInExile) SearchLibraryPutInHandEffect(mage.abilities.effects.common.search.SearchLibraryPutInHandEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetCardInLibrary(mage.target.common.TargetCardInLibrary)

Example 12 with SimpleActivatedAbility

use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.

the class CustomTestCard method addCustomEffect_DestroyTarget.

/**
 * Add target destroy ability that can be called by text "target destroy"
 *
 * @param controller
 */
protected void addCustomEffect_DestroyTarget(TestPlayer controller) {
    Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect().setText("target destroy"), new ManaCostsImpl(""));
    ability.addTarget(new TargetPermanent());
    addCustomCardWithAbility("target destroy for " + controller.getName(), controller, ability);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SpellAbility(mage.abilities.SpellAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetPermanent(mage.target.TargetPermanent) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 13 with SimpleActivatedAbility

use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.

the class ManaPoolTest method test_MultipleMana_OneXAbility.

@Test
public void test_MultipleMana_OneXAbility() {
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
    // 
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
    ability.addTarget(new TargetAnyTarget());
    addCustomCardWithAbility("damage X", playerA, ability);
    // make mana
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    checkManaPool("mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 4);
    // use for ability
    // showAvailableAbilities("before ability", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{X}:", playerB);
    setChoice(playerA, "X=3");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkManaPool("mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 4 - 3);
    checkLife("after", 1, PhaseStep.END_TURN, playerB, 20 - 3);
    setStopAt(1, PhaseStep.END_TURN);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetAnyTarget(mage.target.common.TargetAnyTarget) Test(org.junit.Test)

Example 14 with SimpleActivatedAbility

use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.

the class ManaPoolTest method test_ConditionalMana_OneXPart.

@Test
public void test_ConditionalMana_OneXPart() {
    // {R}
    addCard(Zone.HAND, playerA, "Lightning Bolt");
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    addCustomCardWithAbility("add 10", playerA, new SimpleManaAbility(Zone.ALL, new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()), new ManaCostsImpl("")));
    // 
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl(""));
    ability.addTarget(new TargetAnyTarget());
    addCustomCardWithAbility("damage X", playerA, ability);
    // 
    // {X}: Counter target spell
    ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
    ability.addTarget(new TargetSpell());
    addCustomCardWithAbility("counter until pay X", playerB, ability);
    addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
    // make mana for spell
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    checkManaPool("mana spell", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 1);
    // cast spell
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
    // make mana for pay X to prevent
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {R}");
    checkManaPool("mana prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 10);
    // counter by X=3
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{X}: Counter");
    setChoice(playerB, "X=3");
    addTarget(playerB, "Lightning Bolt");
    // pay to prevent
    // pay 3 to prevent counter
    setChoice(playerA, true);
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkManaPool("mana after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 10 + 1 - 1 - 3);
    checkLife("after", 1, PhaseStep.END_TURN, playerB, 20 - 3);
    setStopAt(1, PhaseStep.END_TURN);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) Ability(mage.abilities.Ability) AddConditionalManaEffect(mage.abilities.effects.mana.AddConditionalManaEffect) CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect) SimpleActivatedAbilityManaBuilder(mage.abilities.mana.builder.common.SimpleActivatedAbilityManaBuilder) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetSpell(mage.target.TargetSpell) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetAnyTarget(mage.target.common.TargetAnyTarget) Test(org.junit.Test)

Example 15 with SimpleActivatedAbility

use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.

the class LazavTheMultifariousCopyApplier method apply.

@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
    Ability ability = new SimpleActivatedAbility(new LazavTheMultifariousEffect(), new ManaCostsImpl("{X}"));
    ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
    blueprint.getAbilities().add(ability);
    blueprint.setName("Lazav, the Multifarious");
    blueprint.addSuperType(SuperType.LEGENDARY);
    return true;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Aggregations

SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)30 Ability (mage.abilities.Ability)27 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)21 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)12 Test (org.junit.Test)12 TapSourceCost (mage.abilities.costs.common.TapSourceCost)8 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)8 TargetAnyTarget (mage.target.common.TargetAnyTarget)7 SpellAbility (mage.abilities.SpellAbility)6 Permanent (mage.game.permanent.Permanent)6 SimpleManaAbility (mage.abilities.mana.SimpleManaAbility)5 TargetPermanent (mage.target.TargetPermanent)5 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)4 AddConditionalManaEffect (mage.abilities.effects.mana.AddConditionalManaEffect)4 EntersBattlefieldAbility (mage.abilities.common.EntersBattlefieldAbility)3 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)3 AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)3 EnchantAbility (mage.abilities.keyword.EnchantAbility)3 Effect (mage.abilities.effects.Effect)2 CounterUnlessPaysEffect (mage.abilities.effects.common.CounterUnlessPaysEffect)2