Search in sources :

Example 1 with AddCardSubTypeTargetEffect

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

the class LorcanWarlockCollectorReplacementEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Card card = game.getCard(getTargetPointer().getFirst(game, source));
    if (player == null || card == null) {
        return false;
    }
    Cost cost = new PayLifeCost(card.getManaValue());
    if (!cost.canPay(source, source, source.getControllerId(), game) || !cost.pay(source, game, source, source.getControllerId(), true)) {
        return false;
    }
    game.addEffect(new AddCardSubTypeTargetEffect(SubType.WARLOCK, Duration.Custom).setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game) + 1)), source);
    player.moveCards(card, Zone.BATTLEFIELD, source, game);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) PayLifeCost(mage.abilities.costs.common.PayLifeCost) PayLifeCost(mage.abilities.costs.common.PayLifeCost) Cost(mage.abilities.costs.Cost) Card(mage.cards.Card) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Example 2 with AddCardSubTypeTargetEffect

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

the class AscentOfTheWorthyReturnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Card card = game.getCard(source.getFirstTarget());
    if (player == null || card == null) {
        return false;
    }
    player.moveCards(card, Zone.BATTLEFIELD, source, game);
    Permanent permanent = game.getPermanent(card.getId());
    if (permanent == null) {
        return false;
    }
    permanent.addCounters(CounterType.FLYING.createInstance(), source.getControllerId(), source, game);
    game.addEffect(new AddCardSubTypeTargetEffect(SubType.ANGEL, Duration.Custom).setTargetPointer(new FixedTarget(permanent, game)), source);
    game.addEffect(new AddCardSubTypeTargetEffect(SubType.WARRIOR, Duration.Custom).setTargetPointer(new FixedTarget(permanent, game)), source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) Card(mage.cards.Card) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Example 3 with AddCardSubTypeTargetEffect

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

the class MasterBiomancerEntersBattlefieldEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Permanent sourceCreature = game.getPermanent(source.getSourceId());
    Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
    if (sourceCreature != null && creature != null) {
        int power = sourceCreature.getPower().getValue();
        if (power > 0) {
            creature.addCounters(CounterType.P1P1.createInstance(power), source.getControllerId(), source, game);
        }
        ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.MUTANT, Duration.Custom);
        effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
        game.addEffect(effect, source);
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Example 4 with AddCardSubTypeTargetEffect

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

the class MinscBelovedRangerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = source.getManaCostsToPay().getX();
    game.addEffect(new SetPowerToughnessTargetEffect(xValue, xValue, Duration.EndOfTurn), source);
    game.addEffect(new AddCardSubTypeTargetEffect(SubType.GIANT, Duration.EndOfTurn), source);
    return true;
}
Also used : SetPowerToughnessTargetEffect(mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect) AddCardSubTypeTargetEffect(mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect)

Example 5 with AddCardSubTypeTargetEffect

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

the class LimDulTheNecromancerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Card card = game.getCard(targetPointer.getFirst(game, source));
        if (card != null) {
            if (controller.moveCards(card, Zone.BATTLEFIELD, source, game) && card.isCreature(game)) {
                Permanent creature = game.getPermanent(card.getId());
                ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.ZOMBIE, Duration.WhileOnBattlefield);
                effect.setTargetPointer(new FixedTarget(creature.getId(), game));
                game.addEffect(effect, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Card(mage.cards.Card) 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