Search in sources :

Example 1 with ChoiceBasicLandType

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

the class TerraformerContinuousEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
        Choice choice = new ChoiceBasicLandType();
        if (player.choose(Outcome.Neutral, choice, game)) {
            game.getState().setValue(source.getSourceId().toString() + "_Terraformer", choice.getChoice());
        }
        game.addEffect(new TerraformerContinuousEffect(), source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType)

Example 2 with ChoiceBasicLandType

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

the class ChooseBasicLandTypeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject mageObject = game.getPermanentEntering(source.getSourceId());
    if (mageObject == null) {
        mageObject = game.getObject(source.getSourceId());
    }
    if (controller != null && mageObject != null) {
        ChoiceImpl choices = new ChoiceBasicLandType();
        if (controller.choose(Outcome.Neutral, choices, game)) {
            game.informPlayers(mageObject.getName() + ":  Chosen basic land type is " + choices.getChoice());
            game.getState().setValue(mageObject.getId().toString() + VALUE_KEY, choices.getChoice());
            if (mageObject instanceof Permanent) {
                ((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen basic land type: " + choices.getChoice()), game);
            }
            return true;
        }
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) MageObject(mage.MageObject) ChoiceImpl(mage.choices.ChoiceImpl) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType)

Example 3 with ChoiceBasicLandType

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

the class ChooseTwoBasicLandTypesEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject mageObject = game.getPermanentEntering(source.getSourceId());
    if (mageObject == null) {
        mageObject = game.getObject(source.getSourceId());
    }
    if (controller != null && mageObject != null) {
        ChoiceImpl choices = new ChoiceBasicLandType();
        if (controller.choose(Outcome.Neutral, choices, game)) {
            game.informPlayers(mageObject.getName() + ":  First chosen basic land type is " + choices.getChoice());
            game.getState().setValue(mageObject.getId().toString() + "firstChoice", choices.getChoice());
            choiceOne = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "firstChoice")).getDescription();
        }
        if (controller.choose(Outcome.Neutral, choices, game)) {
            game.informPlayers(mageObject.getName() + ":  Second chosen basic land type is " + choices.getChoice());
            game.getState().setValue(mageObject.getId().toString() + "secondChoice", choices.getChoice());
            choiceTwo = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "secondChoice")).getDescription();
            if (mageObject instanceof Permanent && choiceOne != null && choiceTwo != null) {
                ((Permanent) mageObject).addInfo("Chosen Types", CardUtil.addToolTipMarkTags("First chosen basic land type: " + choiceOne + "\n Second chosen basic land type: " + choiceTwo), game);
            }
            return true;
        }
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) MageObject(mage.MageObject) ChoiceImpl(mage.choices.ChoiceImpl) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType)

Example 4 with ChoiceBasicLandType

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

the class VisionCharmEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Choice choice = new ChoiceLandType();
        if (!controller.choose(outcome, choice, game)) {
            discard();
            return;
        }
        targetLandType = choice.getChoice();
        choice = new ChoiceBasicLandType();
        if (!controller.choose(outcome, choice, game)) {
            discard();
            return;
        }
        targetBasicLandType = SubType.byDescription(choice.getChoice());
        if (targetLandType == null || targetBasicLandType == null) {
            this.discard();
            return;
        }
    } else {
        this.discard();
        return;
    }
    FilterPermanent filter = new FilterLandPermanent();
    filter.add(SubType.byDescription(targetLandType).getPredicate());
    if (this.affectedObjectsSet) {
        for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
            affectedObjectList.add(new MageObjectReference(permanent, game));
        }
    }
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) Choice(mage.choices.Choice) ChoiceLandType(mage.choices.ChoiceLandType) FilterPermanent(mage.filter.FilterPermanent) FilterLandPermanent(mage.filter.common.FilterLandPermanent) FilterPermanent(mage.filter.FilterPermanent) FilterLandPermanent(mage.filter.common.FilterLandPermanent) TargetArtifactPermanent(mage.target.common.TargetArtifactPermanent) Permanent(mage.game.permanent.Permanent) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType) MageObjectReference(mage.MageObjectReference)

Example 5 with ChoiceBasicLandType

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

the class BecomesBasicLandTargetEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    // choose land type
    if (chooseLandType) {
        Player controller = game.getPlayer(source.getControllerId());
        Choice choice = new ChoiceBasicLandType();
        if (controller != null && controller.choose(outcome, choice, game)) {
            landTypes.add(SubType.byDescription(choice.getChoice()));
        } else {
            this.discard();
            return;
        }
    }
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) 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