Search in sources :

Example 6 with ChoiceBasicLandType

use of mage.choices.ChoiceBasicLandType in project mage by magefree.

the class GiantSlugEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (controller == null || sourcePermanent == null) {
        return false;
    }
    ChoiceImpl choices = new ChoiceBasicLandType();
    if (!controller.choose(outcome, choices, game)) {
        return false;
    }
    game.informPlayers(sourcePermanent.getName() + ":  Chosen basic land type is " + choices.getChoice());
    switch(choices.getChoice()) {
        case "Plains":
            game.addEffect(new GainAbilitySourceEffect(new PlainswalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Island":
            game.addEffect(new GainAbilitySourceEffect(new IslandwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Swamp":
            game.addEffect(new GainAbilitySourceEffect(new SwampwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Mountain":
            game.addEffect(new GainAbilitySourceEffect(new MountainwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Forest":
            game.addEffect(new GainAbilitySourceEffect(new ForestwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        default:
            return false;
    }
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) ChoiceImpl(mage.choices.ChoiceImpl) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType)

Aggregations

ChoiceBasicLandType (mage.choices.ChoiceBasicLandType)6 Player (mage.players.Player)6 Permanent (mage.game.permanent.Permanent)4 Choice (mage.choices.Choice)3 ChoiceImpl (mage.choices.ChoiceImpl)3 MageObject (mage.MageObject)2 MageObjectReference (mage.MageObjectReference)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)1 ChoiceLandType (mage.choices.ChoiceLandType)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 TargetPlayer (mage.target.TargetPlayer)1 TargetArtifactPermanent (mage.target.common.TargetArtifactPermanent)1