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