Search in sources :

Example 41 with SimpleStaticAbility

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

the class ConditionalCostModificationTest method test_ModificationConditionalNotActive.

@Test
public void test_ModificationConditionalNotActive() {
    addCustomCardWithAbility("mod", playerA, new SimpleStaticAbility(new ConditionalCostModificationEffect(new AbilitiesCostReductionControllerEffect(EquipAbility.class, "equip"), NotMyTurnCondition.instance, "")));
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Dagger of the Worthy", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Balduvian Bears");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertTappedCount("Mountain", true, 2);
    assertTappedCount("Mountain", false, 0);
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalCostModificationEffect(mage.abilities.decorator.ConditionalCostModificationEffect) AbilitiesCostReductionControllerEffect(mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect) EquipAbility(mage.abilities.keyword.EquipAbility) Test(org.junit.Test)

Example 42 with SimpleStaticAbility

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

the class EndOfTurnOneOpponentTest method test_UntilEndOfYourNextTurnSingle.

@Test
public void test_UntilEndOfYourNextTurnSingle() {
    addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilEndOfYourNextTurn)));
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerA, true, PhaseStep.END_TURN);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerA, true, PhaseStep.END_TURN);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerA, true, null);
    addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
    addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
    attack(1, playerA, cardBear2);
    attack(2, playerB, cardBear2);
    attack(3, playerA, cardBear2);
    attack(4, playerB, cardBear2);
    setStopAt(4, PhaseStep.CLEANUP);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect) Test(org.junit.Test)

Example 43 with SimpleStaticAbility

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

the class EndOfTurnOneOpponentTest method test_UntilYourNextTurnSingle.

@Test
public void test_UntilYourNextTurnSingle() {
    addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilYourNextTurn)));
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerA, true, PhaseStep.END_TURN);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerA, true, null);
    prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerA, true, null);
    addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
    addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
    attack(1, playerA, cardBear2);
    attack(2, playerB, cardBear2);
    attack(3, playerA, cardBear2);
    attack(4, playerB, cardBear2);
    setStopAt(4, PhaseStep.CLEANUP);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect) Test(org.junit.Test)

Example 44 with SimpleStaticAbility

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

the class ConditionalAsThoughTest method test_PlayFromNotOwnHandZoneAllEffect.

@Test
public void test_PlayFromNotOwnHandZoneAllEffect() {
    removeAllCardsFromLibrary(playerA);
    removeAllCardsFromLibrary(playerB);
    addCustomCardWithAbility("play any library on any creature", playerA, new SimpleStaticAbility(Zone.ALL, new ConditionalAsThoughEffect(new PlayFromNotOwnHandZoneAllEffect(StaticFilters.FILTER_CARD, Zone.LIBRARY, false, TargetController.ANY, Duration.EndOfTurn), new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_PERMANENT_CREATURE, ComparisonType.MORE_THAN, 0))));
    addCard(Zone.HAND, playerA, "Grizzly Bears");
    addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
    addCard(Zone.LIBRARY, playerB, "Lightning Bolt");
    addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
    addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
    // can't play lib's card before good condition
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", true);
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Silvercoat Lion", false);
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false);
    // make good condition - now we can play any lib's card
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", false);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Silvercoat Lion", true);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", true);
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
    execute();
    assertAllCommandsUsed();
}
Also used : ConditionalAsThoughEffect(mage.abilities.decorator.ConditionalAsThoughEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) PermanentsOnTheBattlefieldCondition(mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition) PlayFromNotOwnHandZoneAllEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect) Test(org.junit.Test)

Example 45 with SimpleStaticAbility

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

the class InfoEffect method addCardHintToPermanentConditional.

/**
 * Add temporary card hint to permanent (visible in rules list)
 * Will be visible on conditional only
 *
 * @param game
 * @param source
 * @param permanent
 * @param cardHint
 * @param duration
 * @param condition
 */
public static void addCardHintToPermanentConditional(Game game, Ability source, Permanent permanent, Hint cardHint, Duration duration, Condition condition) {
    SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("hint"));
    ability.setRuleVisible(false);
    ability.addHint(cardHint);
    GainAbilityTargetEffect gainEffect = new GainAbilityTargetEffect(ability, duration);
    gainEffect.setTargetPointer(new FixedTarget(permanent, game));
    ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(gainEffect, condition, "test");
    conditionalEffect.setTargetPointer(new FixedTarget(permanent, game));
    game.addEffect(conditionalEffect, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ConditionalContinuousEffect(mage.abilities.decorator.ConditionalContinuousEffect)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)61 Test (org.junit.Test)27 Ability (mage.abilities.Ability)21 Player (mage.players.Player)14 Permanent (mage.game.permanent.Permanent)11 InfoEffect (mage.abilities.effects.common.InfoEffect)10 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)10 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)9 Card (mage.cards.Card)9 FixedTarget (mage.target.targetpointer.FixedTarget)9 UUID (java.util.UUID)8 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)6 FilterCard (mage.filter.FilterCard)5 MageObject (mage.MageObject)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 PreventAllDamageToAllEffect (mage.abilities.effects.common.PreventAllDamageToAllEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 AbilitiesCostReductionControllerEffect (mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect)4