Search in sources :

Example 71 with GainAbilityTargetEffect

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

the class GoryosVengeanceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    Card card = game.getCard(targetPointer.getFirst(game, source));
    if (card == null || !controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
        return false;
    }
    Permanent permanent = game.getPermanent(card.getId());
    if (permanent == null) {
        return false;
    }
    // Haste
    ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
    effect.setTargetPointer(new FixedTarget(permanent, game));
    game.addEffect(effect, source);
    // Exile it at end of turn
    Effect exileEffect = new ExileTargetEffect("Exile " + permanent.getName() + " at the beginning of the next end step");
    exileEffect.setTargetPointer(new FixedTarget(permanent, game));
    DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
    game.addDelayedTriggeredAbility(delayedAbility, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Effect(mage.abilities.effects.Effect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) FilterCard(mage.filter.FilterCard) FilterCreatureCard(mage.filter.common.FilterCreatureCard) Card(mage.cards.Card) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 72 with GainAbilityTargetEffect

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

the class InciteHysteriaEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (target != null) {
            ObjectColor color = target.getColor(game);
            for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
                if (permanent.getColor(game).shares(color)) {
                    ContinuousEffect effect = new GainAbilityTargetEffect(new CantBlockAbility(), Duration.EndOfTurn);
                    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) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) ObjectColor(mage.ObjectColor) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CantBlockAbility(mage.abilities.common.CantBlockAbility)

Example 73 with GainAbilityTargetEffect

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

the class JusticiarsPortalEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    UUID targetId = source.getFirstTarget();
    new ExileTargetForSourceEffect().apply(game, source);
    new ReturnToBattlefieldUnderYourControlTargetEffect().apply(game, source);
    ContinuousEffect effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
    effect.setTargetPointer(new FixedTarget(targetId, game));
    game.addEffect(effect, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) ExileTargetForSourceEffect(mage.abilities.effects.common.ExileTargetForSourceEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID)

Example 74 with GainAbilityTargetEffect

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

the class KheruLichLordReplacementEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, source.getSourceId(), source.getControllerId(), game));
        Card card = cards.getRandom(game);
        if (card != null) {
            controller.moveCards(card, Zone.BATTLEFIELD, source, game);
            Permanent permanent = game.getPermanent(card.getId());
            if (permanent != null) {
                FixedTarget fixedTarget = new FixedTarget(permanent, game);
                ContinuousEffect effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
                effect.setTargetPointer(fixedTarget);
                game.addEffect(effect, source);
                effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
                effect.setTargetPointer(fixedTarget);
                game.addEffect(effect, source);
                effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
                effect.setTargetPointer(fixedTarget);
                game.addEffect(effect, source);
                ExileTargetEffect exileEffect = new ExileTargetEffect();
                exileEffect.setTargetPointer(fixedTarget);
                DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
                game.addDelayedTriggeredAbility(delayedAbility, source);
                KheruLichLordReplacementEffect replacementEffect = new KheruLichLordReplacementEffect();
                replacementEffect.setTargetPointer(fixedTarget);
                game.addEffect(replacementEffect, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 75 with GainAbilityTargetEffect

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

the class OutmuscleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    if (AdamantCondition.GREEN.apply(game, source)) {
        ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
    }
    permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
    Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
    if (creature == null) {
        return true;
    }
    game.getState().processAction(game);
    return creature.fight(permanent, source, game);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Aggregations

GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)125 FixedTarget (mage.target.targetpointer.FixedTarget)96 Permanent (mage.game.permanent.Permanent)93 ContinuousEffect (mage.abilities.effects.ContinuousEffect)76 Player (mage.players.Player)76 Card (mage.cards.Card)42 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)28 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)22 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)21 UUID (java.util.UUID)18 BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)17 Effect (mage.abilities.effects.Effect)16 OneShotEffect (mage.abilities.effects.OneShotEffect)15 FilterCard (mage.filter.FilterCard)15 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)15 TargetPermanent (mage.target.TargetPermanent)15 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)14 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)13 FilterCreatureCard (mage.filter.common.FilterCreatureCard)12 FixedTargets (mage.target.targetpointer.FixedTargets)12