Search in sources :

Example 1 with IslandwalkAbility

use of mage.abilities.keyword.IslandwalkAbility in project mage by magefree.

the class IllusionaryPresenceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    MageObject mageObject = game.getObject(source.getSourceId());
    if (mageObject != null) {
        SubType landTypeChoice = SubType.byDescription((String) game.getState().getValue(mageObject.getId().toString() + "BasicLandType"));
        if (landTypeChoice != null) {
            switch(landTypeChoice) {
                case PLAINS:
                    gainedAbility = new PlainswalkAbility();
                    break;
                case FOREST:
                    gainedAbility = new ForestwalkAbility();
                    break;
                case SWAMP:
                    gainedAbility = new SwampwalkAbility();
                    break;
                case ISLAND:
                    gainedAbility = new IslandwalkAbility();
                    break;
                case MOUNTAIN:
                    gainedAbility = new MountainwalkAbility();
                    break;
            }
            if (gainedAbility != null) {
                GainAbilitySourceEffect effect = new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn);
                game.addEffect(effect, source);
                return true;
            }
        }
    }
    return false;
}
Also used : IslandwalkAbility(mage.abilities.keyword.IslandwalkAbility) SubType(mage.constants.SubType) PlainswalkAbility(mage.abilities.keyword.PlainswalkAbility) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) MountainwalkAbility(mage.abilities.keyword.MountainwalkAbility) MageObject(mage.MageObject) ForestwalkAbility(mage.abilities.keyword.ForestwalkAbility) SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility)

Example 2 with IslandwalkAbility

use of mage.abilities.keyword.IslandwalkAbility in project mage by magefree.

the class MasterOfThePearlTridentTest method testLordAbility.

@Test
public void testLordAbility() {
    addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
    addCard(Zone.HAND, playerA, "Master of the Pearl Trident");
    addCard(Zone.BATTLEFIELD, playerA, "Merfolk of the Pearl Trident");
    addCard(Zone.BATTLEFIELD, playerB, "Llanowar Elves");
    addCard(Zone.BATTLEFIELD, playerB, "Island");
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master of the Pearl Trident");
    attack(3, playerA, "Merfolk of the Pearl Trident");
    block(3, playerB, "Llanowar Elves", "Merfolk of the Pearl Trident");
    setStopAt(3, PhaseStep.END_TURN);
    execute();
    assertPermanentCount(playerA, "Master of the Pearl Trident", 1);
    assertLife(playerB, 18);
    assertPowerToughness(playerA, "Merfolk of the Pearl Trident", 2, 2);
    assertAbility(playerA, "Merfolk of the Pearl Trident", new IslandwalkAbility(), true);
}
Also used : IslandwalkAbility(mage.abilities.keyword.IslandwalkAbility) Test(org.junit.Test)

Aggregations

IslandwalkAbility (mage.abilities.keyword.IslandwalkAbility)2 MageObject (mage.MageObject)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)1 ForestwalkAbility (mage.abilities.keyword.ForestwalkAbility)1 MountainwalkAbility (mage.abilities.keyword.MountainwalkAbility)1 PlainswalkAbility (mage.abilities.keyword.PlainswalkAbility)1 SwampwalkAbility (mage.abilities.keyword.SwampwalkAbility)1 SubType (mage.constants.SubType)1 Test (org.junit.Test)1