use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.
the class SparkDoubleTest method test_CopyOfSparksCopy_ByAbility.
@Test
public void test_CopyOfSparksCopy_ByAbility() {
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(), new ManaCostsImpl(""));
ability.addTarget(new TargetPermanent());
addCustomCardWithAbility("copy", playerA, ability);
// {3}{U}
addCard(Zone.HAND, playerA, "Spark Double");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
//
// legendary
addCard(Zone.BATTLEFIELD, playerA, "Akroma, Angel of Wrath", 1);
//
// Create a 1/1 white Bird creature token with flying, then populate. (Create a token that’s a copy of a creature token you control.)
// {3}{W}
addCard(Zone.HAND, playerA, "Eyes in the Skies");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
// make copy of legendary creature (it's not legendary now)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spark Double");
setChoice(playerA, true);
setChoice(playerA, "Akroma, Angel of Wrath");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 2);
// make copy of copy by CreateTokenCopyTargetEffect
// showBattlefield("before last copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
// showAvailableAbilities("before last copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "create a token that");
addTarget(playerA, "Akroma, Angel of Wrath[only copy]");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 3);
// showBattlefield("after all", 1, PhaseStep.BEGIN_COMBAT, playerA);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertAllCommandsUsed();
}
use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.
the class CommanderAffinityTest method test_Gained_Affinity.
@Test
public void test_Gained_Affinity() {
// bug: Mycosynth Golem did not allow my commander, Karn, Silver Golem, to cost 0 even though I had 7+ artifacts on the board.
Ability ability = new SimpleActivatedAbility(Zone.ALL, new CreateTokenEffect(new ArtifactWallToken(), 7), new ManaCostsImpl("R"));
addCustomCardWithAbility("generate tokens", playerA, ability);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
//
// {5}
addCard(Zone.COMMAND, playerA, "Karn, Silver Golem", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
//
// Destroy target artifact.
// {1}{R}
addCard(Zone.HAND, playerA, "Ancient Grudge", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
//
// Artifact creature spells you cast have affinity for artifacts. (They cost {1} less to cast for each artifact you control.)
addCard(Zone.BATTLEFIELD, playerA, "Mycosynth Golem", 1);
// Affinity for artifacts
// Artifact creature spells you cast have affinity for artifacts.
// addCard(Zone.BATTLEFIELD, playerA, "Mycosynth Golem");
// addCard(Zone.HAND, playerA, "Alpha Myr"); // Creature - Myr 2/1
checkCommandCardCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem", 1);
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", true);
// first cast for 5 and destroy (prepare commander with additional cost)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ancient Grudge", "Karn, Silver Golem");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkCommandCardCount("after destroy ", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem", 1);
checkPlayableAbility("after destroy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", false);
// move to command zone
setChoice(playerA, true);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
// can't do the second cast with additional cost (must pay 2 + 5, but have only R)
checkPlayableAbility("after move", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", false);
// generate artifact tokens
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: Create");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("after tokens", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wall", 7);
checkPlayableAbility("after tokens", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", true);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.
the class KothOfTheHammerThirdEffect method apply.
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
switch(layer) {
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(mountains, source.getControllerId(), source.getSourceId(), game)) {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetAnyTarget());
permanent.addAbility(ability, source.getSourceId(), game);
}
}
break;
}
return true;
}
use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.
the class ArcheryTrainingValue method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura == null) {
return false;
}
Permanent permanent = game.getPermanent(aura.getAttachedTo());
if (permanent == null) {
return false;
}
String rule = "this creature deals X damage to target attacking or blocking creature, " + "where X is the number of arrow counters on " + aura.getName();
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(new ArcheryTrainingValue(aura)).setText(rule), new TapSourceCost());
ability.addTarget(new TargetAttackingOrBlockingCreature());
permanent.addAbility(ability, source.getSourceId(), game);
return true;
}
use of mage.abilities.common.SimpleActivatedAbility in project mage by magefree.
the class DimirDoppelgangerCopyApplier method apply.
@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}"));
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
blueprint.getAbilities().add(ability);
return true;
}
Aggregations