Search in sources :

Example 86 with ContinuousEffect

use of mage.abilities.effects.ContinuousEffect in project mage by magefree.

the class NicolBolasGodPharaohPlusTwoEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
    if (opponent == null) {
        return false;
    }
    Library library = opponent.getLibrary();
    Card card;
    do {
        card = library.getFromTop(game);
        if (card == null) {
            continue;
        }
        opponent.moveCards(card, Zone.EXILED, source, game);
        if (card.isLand(game)) {
            continue;
        }
        ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, true);
        effect.setTargetPointer(new FixedTarget(card, game));
        game.addEffect(effect, source);
        break;
    } while (library.hasCards() && card != null);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) PlayFromNotOwnHandZoneTargetEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect) Library(mage.players.Library) ContinuousEffect(mage.abilities.effects.ContinuousEffect) FilterCard(mage.filter.FilterCard)

Example 87 with ContinuousEffect

use of mage.abilities.effects.ContinuousEffect in project mage by magefree.

the class ChangeCreatureTypeTargetEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
        ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true);
        effect.setTargetPointer(new FixedTarget(targetPermanent, game));
        game.addEffect(effect, source);
        effect = new ChangeCreatureTypeTargetEffect(null, SubType.VAMPIRE, Duration.Custom);
        effect.setTargetPointer(new FixedTarget(targetPermanent, game));
        game.addEffect(effect, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetControlledPermanent(mage.target.common.TargetControlledPermanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

Example 88 with ContinuousEffect

use of mage.abilities.effects.ContinuousEffect in project mage by magefree.

the class OverwhelmingStampedeInitEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int maxPower = 0;
    for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
        if (perm.getPower().getValue() > maxPower) {
            maxPower = perm.getPower().getValue();
        }
    }
    ContinuousEffect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
    game.addEffect(effect, source);
    if (maxPower != 0) {
        effect = new BoostControlledEffect(maxPower, maxPower, Duration.EndOfTurn);
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) BoostControlledEffect(mage.abilities.effects.common.continuous.BoostControlledEffect)

Example 89 with ContinuousEffect

use of mage.abilities.effects.ContinuousEffect in project mage by magefree.

the class PyrrhicRevivalEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    Set<Card> toBattlefield = new HashSet<>();
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
        Player player = game.getPlayer(playerId);
        if (player != null) {
            for (Card card : player.getGraveyard().getCards(game)) {
                if (card != null && card.isCreature(game)) {
                    toBattlefield.add(card);
                    ContinuousEffect effect = new EntersBattlefieldEffect(new AddCountersTargetEffect(CounterType.M1M1.createInstance()));
                    effect.setDuration(Duration.OneUse);
                    effect.setTargetPointer(new FixedTarget(card.getId()));
                    game.addEffect(effect, source);
                }
            }
        }
    }
    controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) EntersBattlefieldEffect(mage.abilities.effects.EntersBattlefieldEffect) Card(mage.cards.Card) HashSet(java.util.HashSet)

Example 90 with ContinuousEffect

use of mage.abilities.effects.ContinuousEffect in project mage by magefree.

the class RevengeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
    if (target != null && target.isCreature(game)) {
        ContinuousEffect effect = new BoostTargetEffect(4, 0, Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(target.getId(), game));
        game.addEffect(effect, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetOpponentsCreaturePermanent(mage.target.common.TargetOpponentsCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Aggregations

ContinuousEffect (mage.abilities.effects.ContinuousEffect)322 FixedTarget (mage.target.targetpointer.FixedTarget)245 Player (mage.players.Player)225 Permanent (mage.game.permanent.Permanent)202 Card (mage.cards.Card)97 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)76 UUID (java.util.UUID)65 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)55 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)50 MageObject (mage.MageObject)47 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)43 BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)37 FilterCard (mage.filter.FilterCard)34 TargetPermanent (mage.target.TargetPermanent)33 Effect (mage.abilities.effects.Effect)32 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)31 OneShotEffect (mage.abilities.effects.OneShotEffect)30 Target (mage.target.Target)30 FilterPermanent (mage.filter.FilterPermanent)24 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)23