Search in sources :

Example 1 with ChoiceLandType

use of mage.choices.ChoiceLandType 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)

Aggregations

MageObjectReference (mage.MageObjectReference)1 Choice (mage.choices.Choice)1 ChoiceBasicLandType (mage.choices.ChoiceBasicLandType)1 ChoiceLandType (mage.choices.ChoiceLandType)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1 TargetPlayer (mage.target.TargetPlayer)1 TargetArtifactPermanent (mage.target.common.TargetArtifactPermanent)1