Search in sources :

Example 1 with SwampwalkAbility

use of mage.abilities.keyword.SwampwalkAbility 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 SwampwalkAbility

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

the class ChooseOneTest method testThirdMode.

@Test
public void testThirdMode() {
    addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
    // Choose one
    // - Target player discards a card
    // - Target creature gets +2/-1 until end of turn.
    // - Target creature gains swampwalk until end of turn.
    // Instant {B}
    addCard(Zone.HAND, playerA, "Funeral Charm");
    addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Funeral Charm", "Silvercoat Lion");
    setModeChoice(playerA, "3");
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertGraveyardCount(playerA, "Funeral Charm", 1);
    assertPowerToughness(playerB, "Silvercoat Lion", 2, 2);
    assertAbility(playerB, "Silvercoat Lion", new SwampwalkAbility(), true);
}
Also used : SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility) Test(org.junit.Test)

Example 3 with SwampwalkAbility

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

the class LoosingAbilitiesTest method testYixlidJailerRemovesAbilities.

/**
 * The Card in the graveyard should have no Swampwalk if Yixlid Jailer
 * effect was added later
 */
@Test
public void testYixlidJailerRemovesAbilities() {
    // Cards in graveyards lose all abilities.
    // Creature 2/1 - {1}{B}
    addCard(Zone.HAND, playerA, "Yixlid Jailer");
    addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
    // Swampwalk
    // As long as Filth is in your graveyard and you control a Swamp, creatures you control have swampwalk.
    addCard(Zone.GRAVEYARD, playerB, "Filth");
    addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
    addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Yixlid Jailer");
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertPermanentCount(playerB, "Silvercoat Lion", 1);
    assertAbility(playerB, "Silvercoat Lion", new SwampwalkAbility(), false);
}
Also used : SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility) Test(org.junit.Test)

Example 4 with SwampwalkAbility

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

the class LoosingAbilitiesTest method GivingSwampwalkFromGraveyard.

@Test
public void GivingSwampwalkFromGraveyard() {
    // Swampwalk
    // As long as Filth is in your graveyard and you control a Swamp, creatures you control have swampwalk.
    // Creature
    addCard(Zone.GRAVEYARD, playerB, "Filth");
    addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
    addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertPermanentCount(playerB, "Silvercoat Lion", 1);
    assertAbility(playerB, "Silvercoat Lion", new SwampwalkAbility(), true);
}
Also used : SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility) Test(org.junit.Test)

Example 5 with SwampwalkAbility

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

the class UrborgEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player == null || permanent == null) {
        return false;
    }
    Ability ability;
    if (player.chooseUse(Outcome.UnboostCreature, "Which ability should be lost?", null, "First Strike", "Swampwalk", source, game)) {
        ability = FirstStrikeAbility.getInstance();
    } else {
        ability = new SwampwalkAbility();
    }
    ContinuousEffect effect = new LoseAbilityTargetEffect(ability, Duration.EndOfTurn);
    // effect.setTargetPointer(new FixedTarget(permanent, game));
    game.addEffect(effect, source);
    return true;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) BlackManaAbility(mage.abilities.mana.BlackManaAbility) SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility) FirstStrikeAbility(mage.abilities.keyword.FirstStrikeAbility) Ability(mage.abilities.Ability) LoseAbilityTargetEffect(mage.abilities.effects.common.continuous.LoseAbilityTargetEffect) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) SwampwalkAbility(mage.abilities.keyword.SwampwalkAbility)

Aggregations

SwampwalkAbility (mage.abilities.keyword.SwampwalkAbility)5 Test (org.junit.Test)3 MageObject (mage.MageObject)1 Ability (mage.abilities.Ability)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)1 LoseAbilityTargetEffect (mage.abilities.effects.common.continuous.LoseAbilityTargetEffect)1 FirstStrikeAbility (mage.abilities.keyword.FirstStrikeAbility)1 ForestwalkAbility (mage.abilities.keyword.ForestwalkAbility)1 IslandwalkAbility (mage.abilities.keyword.IslandwalkAbility)1 MountainwalkAbility (mage.abilities.keyword.MountainwalkAbility)1 PlainswalkAbility (mage.abilities.keyword.PlainswalkAbility)1 BlackManaAbility (mage.abilities.mana.BlackManaAbility)1 SubType (mage.constants.SubType)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1