Search in sources :

Example 1 with BecomesCreatureTypeTargetEffect

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

the class BecomesChosenCreatureTypeControlledEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Card card = game.getCard(source.getSourceId());
    String chosenType = "";
    if (player != null && card != null) {
        Choice typeChoice = new ChoiceCreatureType();
        String msg = "Choose a creature type";
        typeChoice.setMessage(msg);
        while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
            if (!player.canRespond()) {
                return false;
            }
        }
        game.informPlayers(card.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
        chosenType = typeChoice.getChoice();
        if (chosenType != null && !chosenType.isEmpty()) {
            for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
                ContinuousEffect effect = new BecomesCreatureTypeTargetEffect(Duration.EndOfTurn, SubType.byDescription(chosenType));
                effect.setTargetPointer(new FixedTarget(permanent, game));
                game.addEffect(effect, source);
            }
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Choice(mage.choices.Choice) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) BecomesCreatureTypeTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTypeTargetEffect) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) ChoiceCreatureType(mage.choices.ChoiceCreatureType) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Card(mage.cards.Card)

Example 2 with BecomesCreatureTypeTargetEffect

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

the class ChainerDementiaMasterEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        UUID cardId = this.getTargetPointer().getFirst(game, source);
        new ReturnFromGraveyardToBattlefieldTargetEffect().apply(game, source);
        Permanent permanent = game.getPermanent(cardId);
        if (permanent != null) {
            ContinuousEffectImpl effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield);
            effect.setTargetPointer(new FixedTarget(permanent, game));
            game.addEffect(effect, source);
            effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, SubType.NIGHTMARE, false);
            effect.setTargetPointer(new FixedTarget(permanent, game));
            game.addEffect(effect, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) BecomesColorTargetEffect(mage.abilities.effects.common.continuous.BecomesColorTargetEffect) Player(mage.players.Player) BecomesCreatureTypeTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTypeTargetEffect) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) FilterPermanent(mage.filter.FilterPermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) ContinuousEffectImpl(mage.abilities.effects.ContinuousEffectImpl) UUID(java.util.UUID)

Aggregations

BecomesCreatureTypeTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTypeTargetEffect)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 Permanent (mage.game.permanent.Permanent)2 Player (mage.players.Player)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 ContinuousEffectImpl (mage.abilities.effects.ContinuousEffectImpl)1 ReturnFromGraveyardToBattlefieldTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect)1 BecomesColorTargetEffect (mage.abilities.effects.common.continuous.BecomesColorTargetEffect)1 Card (mage.cards.Card)1 Choice (mage.choices.Choice)1 ChoiceCreatureType (mage.choices.ChoiceCreatureType)1 FilterPermanent (mage.filter.FilterPermanent)1