Search in sources :

Example 1 with AnyColorManaAbility

use of mage.abilities.mana.AnyColorManaAbility in project mage by magefree.

the class AlpineMoonEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
    if (cardName == null) {
        return false;
    }
    FilterPermanent filter2 = filter.copy();
    filter2.add(new NamePredicate(cardName));
    for (Permanent land : game.getBattlefield().getActivePermanents(filter2, source.getControllerId(), game)) {
        switch(layer) {
            case TypeChangingEffects_4:
                // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
                // So the ability removing has to be done before Layer 6
                land.removeAllAbilities(source.getSourceId(), game);
                land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
                break;
            case AbilityAddingRemovingEffects_6:
                land.addAbility(new AnyColorManaAbility(), source.getSourceId(), game);
                break;
        }
    }
    return true;
}
Also used : NamePredicate(mage.filter.predicate.mageobject.NamePredicate) FilterPermanent(mage.filter.FilterPermanent) FilterPermanent(mage.filter.FilterPermanent) FilterLandPermanent(mage.filter.common.FilterLandPermanent) Permanent(mage.game.permanent.Permanent) AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility)

Example 2 with AnyColorManaAbility

use of mage.abilities.mana.AnyColorManaAbility in project mage by magefree.

the class LandTypeChangingEffectsTest method testChromaticLanternBeforeMagusOfTheMoon.

@Test
public void testChromaticLanternBeforeMagusOfTheMoon() {
    // Nonbasic lands are Mountains.
    // {2}{R}
    addCard(Zone.HAND, playerA, "Magus of the Moon");
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
    addCard(Zone.BATTLEFIELD, playerB, "Canopy Vista", 1);
    addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
    // Lands you control have "{T}: Add one mana of any color."
    // {T}: Add one mana of any color.
    addCard(Zone.HAND, playerB, "Chromatic Lantern");
    castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Chromatic Lantern");
    castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Magus of the Moon");
    setStrictChooseMode(true);
    setStopAt(3, PhaseStep.BEGIN_COMBAT);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerB, "Chromatic Lantern", 1);
    assertPermanentCount(playerA, "Magus of the Moon", 1);
    assertType("Canopy Vista", CardType.LAND, SubType.MOUNTAIN);
    assertAbility(playerB, "Canopy Vista", new AnyColorManaAbility(), true);
}
Also used : AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) Test(org.junit.Test)

Example 3 with AnyColorManaAbility

use of mage.abilities.mana.AnyColorManaAbility in project mage by magefree.

the class LandTypeChangingEffectsTest method testMagusOfTheMoonAndChromaticLantern.

/**
 * Playing a commander game. Opponent had a Magus of the Moon, and I later
 * dropped a Chromatic Lantern.
 * <p>
 * I was not allowed to use the Chromatic Lantern's ability. Since layers
 * are tricky I asked on the Judge's chat to confirm and the user "luma"
 * said it should work on this scenario.
 */
@Test
public void testMagusOfTheMoonAndChromaticLantern() {
    // Nonbasic lands are Mountains.
    addCard(Zone.BATTLEFIELD, playerA, "Magus of the Moon");
    addCard(Zone.BATTLEFIELD, playerB, "Canopy Vista", 1);
    addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
    // Lands you control have "{T}: Add one mana of any color."
    // {T}: Add one mana of any color.
    addCard(Zone.HAND, playerB, "Chromatic Lantern");
    castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Chromatic Lantern");
    setStrictChooseMode(true);
    setStopAt(2, PhaseStep.BEGIN_COMBAT);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerB, "Chromatic Lantern", 1);
    assertType("Canopy Vista", CardType.LAND, SubType.MOUNTAIN);
    assertAbility(playerB, "Canopy Vista", new AnyColorManaAbility(), true);
}
Also used : AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) Test(org.junit.Test)

Example 4 with AnyColorManaAbility

use of mage.abilities.mana.AnyColorManaAbility in project mage by magefree.

the class ChangeLandAttachedEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent enchantment = game.getPermanent(source.getSourceId());
    if (enchantment == null) {
        return false;
    }
    Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
    if (permanent == null) {
        return true;
    }
    switch(layer) {
        case TypeChangingEffects_4:
            permanent.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
            break;
        case AbilityAddingRemovingEffects_6:
            permanent.removeAllAbilities(source.getSourceId(), game);
            permanent.addAbility(new ColorlessManaAbility(), source.getSourceId(), game);
            Ability ability = new AnyColorManaAbility();
            ability.addCost(new PayLifeCost(1));
            permanent.addAbility(ability, source.getSourceId(), game);
            break;
    }
    return true;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility) Ability(mage.abilities.Ability) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) AnyColorManaAbility(mage.abilities.mana.AnyColorManaAbility) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility) PayLifeCost(mage.abilities.costs.common.PayLifeCost)

Aggregations

AnyColorManaAbility (mage.abilities.mana.AnyColorManaAbility)4 Permanent (mage.game.permanent.Permanent)2 Test (org.junit.Test)2 Ability (mage.abilities.Ability)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 PayLifeCost (mage.abilities.costs.common.PayLifeCost)1 EnchantAbility (mage.abilities.keyword.EnchantAbility)1 ColorlessManaAbility (mage.abilities.mana.ColorlessManaAbility)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 NamePredicate (mage.filter.predicate.mageobject.NamePredicate)1 TargetPermanent (mage.target.TargetPermanent)1 TargetLandPermanent (mage.target.common.TargetLandPermanent)1