use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class InfoEffect method addInfoToPermanent.
/**
* Add temporary information string to permanent (visible in rules list)
*
* @param game
* @param source
* @param permanent
* @param info
* @param duration
*/
public static void addInfoToPermanent(Game game, Ability source, Permanent permanent, String info, Duration duration) {
// add simple static info to permanent's rules
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect(info));
GainAbilityTargetEffect gainEffect = new GainAbilityTargetEffect(ability, duration);
gainEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(gainEffect, source);
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class MonkClassCastEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
player.moveCards(card, Zone.EXILED, source, game);
game.addEffect(new GainAbilityTargetEffect(new SimpleStaticAbility(Zone.EXILED, new MonkClassCastEffect()), Duration.Custom, null, true).setTargetPointer(new FixedTarget(card, game)), source);
return true;
}
use of mage.abilities.common.SimpleStaticAbility 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;
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class TakeControlWhileSearchingLibraryTest method test_SimpleSearchingLibrary_TakeControl.
@Test
public void test_SimpleSearchingLibrary_TakeControl() {
removeAllCardsFromLibrary(playerA);
removeAllCardsFromLibrary(playerB);
addCard(Zone.LIBRARY, playerA, "Balduvian Bears", 1);
addCard(Zone.LIBRARY, playerB, "Kitesail Corsair", 1);
//
// Search your library for up to three creature cards and put them into your graveyard. Then shuffle your library.
// {2}{B}
addCard(Zone.HAND, playerA, "Buried Alive", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
//
// You control your opponents while they’re searching their libraries.
addCustomCardWithAbility("control", playerB, new SimpleStaticAbility(new YouControlYourOpponentsWhileSearchingReplacementEffect()));
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// before
checkGraveyardCount("before a", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 0);
checkGraveyardCount("before b", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Kitesail Corsair", 0);
// search under control of B
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Buried Alive");
// continue
setChoice(playerB, true);
// player B must take control for searching
addTarget(playerB, "Balduvian Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
// after
checkGraveyardCount("after a", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
checkGraveyardCount("after b", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Kitesail Corsair", 0);
// check that control returned
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt");
addTarget(playerA, playerB);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class WallOfDustNextTurnTest method test_SingleOpponentMustAttack.
@Test
public void test_SingleOpponentMustAttack() {
// Whenever Wall of Dust blocks a creature, that creature can't attack during its controller's next turn.
addCard(Zone.BATTLEFIELD, playerA, "Wall of Dust");
// 2/2
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1);
// 2/2
addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 1);
//
Ability ability = new SimpleStaticAbility(new AttacksIfAbleAllEffect(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, Duration.EndOfGame));
ability.addWatcher(new AttackedThisTurnWatcher());
addCustomCardWithAbility("all attacks", playerA, ability);
// 1 - nothing
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, 20);
// 2 - auto-attack B -> A, 1 attacked, 1 blocked (by wall)
block(2, playerA, "Wall of Dust", "Balduvian Bears");
checkPermanentCount("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
// 3 - nothing
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
// 4 - auto-attack, B -> A, 1 attacked, 1 can't attacked (by wall's abilitiy during next turn)
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2);
// 5 - nothing
checkPermanentCount("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2);
// 6 - auto-attack, B -> A, 2 attacked
checkPermanentCount("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2 - 2 * 2);
setStopAt(6, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
Aggregations