Search in sources :

Example 61 with ContinuousEffect

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

the class GodEternalRhonasEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent godEternalRhonas = game.getPermanent(source.getSourceId());
    for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
        if (permanent == null || godEternalRhonas != null && permanent == godEternalRhonas) {
            continue;
        }
        ContinuousEffect effect = new BoostTargetEffect(permanent.getPower().getValue(), 0, Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
        ContinuousEffect effect2 = new GainAbilityTargetEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn);
        effect2.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect2, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 62 with ContinuousEffect

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

the class HalfdaneSetPowerToughnessEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
        if (permanent != null) {
            ContinuousEffect effect = new HalfdaneSetPowerToughnessEffect(permanent.getPower().getValue(), permanent.getToughness().getValue());
            game.addEffect(effect, source);
            return true;
        }
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 63 with ContinuousEffect

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

the class GuardianOfTazeemEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent land = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    Permanent targetCreature = game.getPermanent(source.getFirstTarget());
    if (land != null && targetCreature != null && land.hasSubtype(SubType.ISLAND, game)) {
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that creature");
        effect.setTargetPointer(new FixedTarget(targetCreature, game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 64 with ContinuousEffect

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

the class KnacksawCliqueCastFromExileEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (sourceObject != null && opponent != null) {
        if (opponent.getLibrary().hasCards()) {
            Library library = opponent.getLibrary();
            Card card = library.getFromTop(game);
            if (card != null) {
                opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source, game, Zone.LIBRARY, true);
                ContinuousEffect effect = new KnacksawCliqueCastFromExileEffect();
                effect.setTargetPointer(new FixedTarget(card.getId(), game));
                game.addEffect(effect, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) MageObject(mage.MageObject) Library(mage.players.Library) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Card(mage.cards.Card)

Example 65 with ContinuousEffect

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

the class MassMutinyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    boolean result = false;
    for (Target target : source.getTargets()) {
        if (target instanceof TargetCreaturePermanent) {
            Permanent targetCreature = game.getPermanent(target.getFirstTarget());
            if (targetCreature != null) {
                ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
                effect1.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
                game.addEffect(effect1, source);
                ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
                effect2.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
                game.addEffect(effect2, source);
                targetCreature.untap(game);
                result = true;
            }
        }
    }
    return result;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

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