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;
}
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);
}
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);
}
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;
}
Aggregations