Search in sources :

Example 6 with AddCardSubTypeTargetEffect

use of mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect in project mage by magefree.

the class MistformSliverEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player != null && permanent != null) {
        Choice typeChoice = new ChoiceCreatureType(permanent);
        if (!player.choose(Outcome.Detriment, typeChoice, game)) {
            return false;
        }
        game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
        ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.byDescription(typeChoice.getChoice()), Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Choice(mage.choices.Choice) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) ChoiceCreatureType(mage.choices.ChoiceCreatureType) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Aggregations

AddCardSubTypeTargetEffect (mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)6 FixedTarget (mage.target.targetpointer.FixedTarget)5 Permanent (mage.game.permanent.Permanent)4 Player (mage.players.Player)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 Card (mage.cards.Card)3 FilterPermanent (mage.filter.FilterPermanent)2 TargetPermanent (mage.target.TargetPermanent)2 Cost (mage.abilities.costs.Cost)1 PayLifeCost (mage.abilities.costs.common.PayLifeCost)1 SetPowerToughnessTargetEffect (mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect)1 Choice (mage.choices.Choice)1 ChoiceCreatureType (mage.choices.ChoiceCreatureType)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 EntersTheBattlefieldEvent (mage.game.events.EntersTheBattlefieldEvent)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1