Search in sources :

Example 1 with GreenManaAbility

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

the class LifeAndLimbEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
        for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
            switch(layer) {
                case TypeChangingEffects_4:
                    permanent.addCardType(game, CardType.CREATURE);
                    permanent.addCardType(game, CardType.LAND);
                    permanent.addSubType(game, SubType.SAPROLING);
                    // land abilities are intrinsic, so add them here, not in layer 6
                    permanent.addSubType(game, SubType.FOREST);
                    if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) {
                        permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
                    }
                    break;
                case ColorChangingEffects_5:
                    permanent.getColor(game).setColor(ObjectColor.GREEN);
                    break;
                case PTChangingEffects_7:
                    if (sublayer == SubLayer.SetPT_7b) {
                        permanent.getPower().setValue(1);
                        permanent.getToughness().setValue(1);
                    }
                    break;
            }
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) GreenManaAbility(mage.abilities.mana.GreenManaAbility) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent)

Example 2 with GreenManaAbility

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

the class AshayaSoulOfTheWildTest method testAshaya.

@Test
public void testAshaya() {
    setStrictChooseMode(true);
    addCard(Zone.HAND, playerA, ashaya);
    addCard(Zone.BATTLEFIELD, playerA, forest, 5);
    addCard(Zone.BATTLEFIELD, playerA, bear);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ashaya);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertType(ashaya, CardType.LAND, SubType.FOREST);
    assertType(ashaya, CardType.CREATURE, SubType.ELEMENTAL);
    assertAbility(playerA, ashaya, new GreenManaAbility(), true);
    assertPowerToughness(playerA, ashaya, 5 + 1 + 1, 5 + 1 + 1);
    assertType(bear, CardType.LAND, SubType.FOREST);
    assertType(bear, CardType.CREATURE, SubType.BEAR);
    assertAbility(playerA, bear, new GreenManaAbility(), true);
}
Also used : GreenManaAbility(mage.abilities.mana.GreenManaAbility) Test(org.junit.Test)

Example 3 with GreenManaAbility

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

the class AshayaSoulOfTheWildTest method testAshayaVolrathsShapeshifter.

@Test
public void testAshayaVolrathsShapeshifter() {
    addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
    addCard(Zone.BATTLEFIELD, playerA, bear);
    addCard(Zone.HAND, playerA, shapeshifter);
    addCard(Zone.GRAVEYARD, playerA, ashaya);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shapeshifter);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertType(ashaya, CardType.LAND, SubType.FOREST);
    assertType(ashaya, CardType.CREATURE, SubType.ELEMENTAL);
    assertAbility(playerA, ashaya, new GreenManaAbility(), true);
    assertPowerToughness(playerA, ashaya, 3 + 1 + 1, 3 + 1 + 1);
    assertType(bear, CardType.LAND, SubType.FOREST);
    assertType(bear, CardType.CREATURE, SubType.BEAR);
    assertAbility(playerA, bear, new GreenManaAbility(), true);
}
Also used : GreenManaAbility(mage.abilities.mana.GreenManaAbility) Test(org.junit.Test)

Example 4 with GreenManaAbility

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

the class BecomesColorlessForestLandEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent enchantment = game.getPermanent(source.getSourceId());
    if (enchantment == null || enchantment.getAttachedTo() == null) {
        return false;
    }
    Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
    if (permanent == null) {
        return false;
    }
    switch(layer) {
        case ColorChangingEffects_5:
            permanent.getColor(game).setWhite(false);
            permanent.getColor(game).setGreen(false);
            permanent.getColor(game).setBlack(false);
            permanent.getColor(game).setBlue(false);
            permanent.getColor(game).setRed(false);
            break;
        case TypeChangingEffects_4:
            permanent.removeAllCardTypes(game);
            permanent.addCardType(game, CardType.LAND);
            permanent.removeAllSubTypes(game);
            permanent.addSubType(game, SubType.FOREST);
            permanent.removeAllAbilities(source.getSourceId(), game);
            permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
            break;
    }
    return true;
}
Also used : GreenManaAbility(mage.abilities.mana.GreenManaAbility) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent)

Example 5 with GreenManaAbility

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

the class YedoraGraveGardenerContinuousEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
    if (target == null || !target.isFaceDown(game)) {
        discard();
        return false;
    }
    target.getSuperType().clear();
    target.removeAllCardTypes(game);
    target.removeAllSubTypes(game);
    target.addCardType(game, CardType.LAND);
    target.addSubType(game, SubType.FOREST);
    target.removeAllAbilities(source.getSourceId(), game);
    target.addAbility(new GreenManaAbility(), source.getSourceId(), game);
    return true;
}
Also used : GreenManaAbility(mage.abilities.mana.GreenManaAbility) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent)

Aggregations

GreenManaAbility (mage.abilities.mana.GreenManaAbility)7 Permanent (mage.game.permanent.Permanent)4 Test (org.junit.Test)3 FilterPermanent (mage.filter.FilterPermanent)2 Player (mage.players.Player)2 BlackManaAbility (mage.abilities.mana.BlackManaAbility)1 BlueManaAbility (mage.abilities.mana.BlueManaAbility)1 RedManaAbility (mage.abilities.mana.RedManaAbility)1 WhiteManaAbility (mage.abilities.mana.WhiteManaAbility)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 TargetPermanent (mage.target.TargetPermanent)1