Search in sources :

Example 21 with SimpleActivatedAbility

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

the class CustomTestCard method addCustomEffect_TargetDamage.

/**
 * Add target damage ability that can be called by text: "target damage xxx"
 *
 * @param controller
 * @param damageAmount
 */
protected void addCustomEffect_TargetDamage(TestPlayer controller, int damageAmount) {
    Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(damageAmount).setText("target damage " + damageAmount), new ManaCostsImpl(""));
    ability.addTarget(new TargetAnyTarget());
    addCustomCardWithAbility("target damage " + damageAmount + " 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) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Example 22 with SimpleActivatedAbility

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

the class OldGrowthTrollContinuousEffect method makeAbility.

private static final Ability makeAbility() {
    Ability activatedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TrollWarriorToken(), 1, true, false), new GenericManaCost(1));
    activatedAbility.addCost(new TapSourceCost());
    Cost cost = new SacrificeSourceCost();
    cost.setText("sacrifice this land");
    activatedAbility.addCost(cost);
    Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost()), AttachmentType.AURA).setText("enchanted Forest has \"{T}: Add {G}{G}\""));
    ability.addEffect(new GainAbilityAttachedEffect(activatedAbility, AttachmentType.AURA).setText("and \"{1}, {T}, Sacrifice this land: Create a tapped 4/4 green Troll Warrior creature token with trample.\""));
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DiesSourceTriggeredAbility(mage.abilities.common.DiesSourceTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) SpellAbility(mage.abilities.SpellAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) TrampleAbility(mage.abilities.keyword.TrampleAbility) Ability(mage.abilities.Ability) TrollWarriorToken(mage.game.permanent.token.TrollWarriorToken) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) TapSourceCost(mage.abilities.costs.common.TapSourceCost) Cost(mage.abilities.costs.Cost) TapSourceCost(mage.abilities.costs.common.TapSourceCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost)

Example 23 with SimpleActivatedAbility

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

the class RakdosRiteknifeEffect method makeAbility.

private static Ability makeAbility(Permanent permanent, Game game) {
    Ability ability = new SimpleActivatedAbility(new AddCountersTargetEffect(CounterType.BLOOD.createInstance()).setText("put a blood counter on " + permanent.getName()).setTargetPointer(new FixedTarget(permanent, game)), new TapSourceCost());
    ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EquipAbility(mage.abilities.keyword.EquipAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) Ability(mage.abilities.Ability) FixedTarget(mage.target.targetpointer.FixedTarget) SacrificeTargetCost(mage.abilities.costs.common.SacrificeTargetCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) TapSourceCost(mage.abilities.costs.common.TapSourceCost) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent)

Example 24 with SimpleActivatedAbility

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

the class TargetPriorityTest method test_targetAmount_Performance.

@Test
// do not enable it in production, only for devs
@Ignore
public void test_targetAmount_Performance() {
    int cardsMultiplier = 3;
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageMultiEffect(3), new ManaCostsImpl("R"));
    ability.addTarget(new TargetCreaturePermanentAmount(3));
    addCustomCardWithAbility("damage 3", playerA, ability);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    // 1/1
    addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1 * cardsMultiplier);
    // 2/2
    addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1 * cardsMultiplier);
    // 2/2 with ability
    addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 1 * cardsMultiplier);
    // 4/3
    addCard(Zone.BATTLEFIELD, playerB, "Golden Bear", 1 * cardsMultiplier);
    // 4/4 with ability
    addCard(Zone.BATTLEFIELD, playerB, "Battering Sliver", 1 * cardsMultiplier);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerB, "Memnite", 1 * cardsMultiplier);
    assertPermanentCount(playerB, "Balduvian Bears", 1 * cardsMultiplier);
    assertPermanentCount(playerB, "Ashcoat Bear", 1 * cardsMultiplier);
    assertPermanentCount(playerB, "Golden Bear", 1 * cardsMultiplier - 1);
    assertPermanentCount(playerB, "Battering Sliver", 1 * cardsMultiplier);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) SpellAbility(mage.abilities.SpellAbility) Ability(mage.abilities.Ability) TargetCreaturePermanentAmount(mage.target.common.TargetCreaturePermanentAmount) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageMultiEffect(mage.abilities.effects.common.DamageMultiEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 25 with SimpleActivatedAbility

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

the class TargetPriorityTest method test_targetAmount_NormalCase.

@Test
public void test_targetAmount_NormalCase() {
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageMultiEffect(3), new ManaCostsImpl("R"));
    ability.addTarget(new TargetCreaturePermanentAmount(3));
    addCustomCardWithAbility("damage 3", playerA, ability);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    // 1/1
    addCard(Zone.BATTLEFIELD, playerB, "Memnite", 3);
    // 2/2
    addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 3);
    // 2/2 with ability
    addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 3);
    // 4/3
    addCard(Zone.BATTLEFIELD, playerB, "Golden Bear", 3);
    // 4/4 with ability
    addCard(Zone.BATTLEFIELD, playerB, "Battering Sliver", 3);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerB, "Memnite", 3);
    assertPermanentCount(playerB, "Balduvian Bears", 3);
    assertPermanentCount(playerB, "Ashcoat Bear", 3);
    assertPermanentCount(playerB, "Golden Bear", 3 - 1);
    assertPermanentCount(playerB, "Battering Sliver", 3);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) SpellAbility(mage.abilities.SpellAbility) Ability(mage.abilities.Ability) TargetCreaturePermanentAmount(mage.target.common.TargetCreaturePermanentAmount) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageMultiEffect(mage.abilities.effects.common.DamageMultiEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) Test(org.junit.Test)

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