Search in sources :

Example 1 with MountainwalkAbility

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

Aggregations

MageObject (mage.MageObject)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)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 SwampwalkAbility (mage.abilities.keyword.SwampwalkAbility)1 SubType (mage.constants.SubType)1