Search in sources :

Example 16 with ExileTargetEffect

use of mage.abilities.effects.common.ExileTargetEffect in project mage by magefree.

the class OutcomesTest method test_FromEffects_Multi.

@Test
public void test_FromEffects_Multi() {
    Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
    abilityGood.addEffect(new BoostSourceEffect(10, 10, Duration.EndOfTurn));
    Assert.assertEquals(1 + 1, abilityGood.getEffects().getOutcomeScore(abilityGood));
    Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
    abilityBad.addEffect(new ExileTargetEffect());
    Assert.assertEquals(-1 + -1, abilityBad.getEffects().getOutcomeScore(abilityBad));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) Test(org.junit.Test)

Example 17 with ExileTargetEffect

use of mage.abilities.effects.common.ExileTargetEffect in project mage by magefree.

the class OutcomesTest method test_FromAbility_MultiCombine.

@Test
public void test_FromAbility_MultiCombine() {
    Ability ability = new SimpleStaticAbility(new GainLifeEffect(10));
    ability.addEffect(new BoostSourceEffect(10, 10, Duration.EndOfTurn));
    ability.addEffect(new ExileTargetEffect());
    // must "convert" all effects to good
    ability.addCustomOutcome(Outcome.Neutral);
    Assert.assertEquals(1 + 1 + 1, ability.getEffects().getOutcomeScore(ability));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) Test(org.junit.Test)

Example 18 with ExileTargetEffect

use of mage.abilities.effects.common.ExileTargetEffect in project mage by magefree.

the class OutcomesTest method test_FromAbility_Multi.

@Test
public void test_FromAbility_Multi() {
    Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
    abilityGood.addEffect(new BoostSourceEffect(10, 10, Duration.EndOfTurn));
    abilityGood.addCustomOutcome(Outcome.Detriment);
    Assert.assertEquals(-1 + -1, abilityGood.getEffects().getOutcomeScore(abilityGood));
    Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
    abilityBad.addEffect(new ExileTargetEffect());
    abilityBad.addCustomOutcome(Outcome.Neutral);
    Assert.assertEquals(1 + 1, abilityBad.getEffects().getOutcomeScore(abilityBad));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) Test(org.junit.Test)

Example 19 with ExileTargetEffect

use of mage.abilities.effects.common.ExileTargetEffect in project mage by magefree.

the class ActOfAuthorityGainControlEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (targetPermanent != null && new ExileTargetEffect().apply(game, source)) {
        Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
        if (sourcePermanent != null) {
            ContinuousEffect effect = new ActOfAuthorityGainControlEffect(Duration.Custom, targetPermanent.getControllerId());
            effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
            game.addEffect(effect, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 20 with ExileTargetEffect

use of mage.abilities.effects.common.ExileTargetEffect in project mage by magefree.

the class MirrorMockeryEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // In the case that the enchantment is blinked
    Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
    if (enchantment == null) {
        // It was not blinked, use the standard method
        enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
    }
    if (enchantment == null) {
        return false;
    }
    Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
    if (enchanted != null) {
        CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect();
        effect.setTargetPointer(new FixedTarget(enchanted, game));
        effect.apply(game, source);
        for (Permanent addedToken : effect.getAddedPermanents()) {
            if (addedToken != null) {
                ExileTargetEffect exileEffect = new ExileTargetEffect();
                exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
                game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Aggregations

ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)51 Permanent (mage.game.permanent.Permanent)40 FixedTarget (mage.target.targetpointer.FixedTarget)38 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)31 Player (mage.players.Player)31 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)26 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)20 Card (mage.cards.Card)20 ContinuousEffect (mage.abilities.effects.ContinuousEffect)15 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)13 Effect (mage.abilities.effects.Effect)12 OneShotEffect (mage.abilities.effects.OneShotEffect)12 FixedTargets (mage.target.targetpointer.FixedTargets)10 UUID (java.util.UUID)9 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)9 TargetPermanent (mage.target.TargetPermanent)8 ArrayList (java.util.ArrayList)6 AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)6 FilterCreatureCard (mage.filter.common.FilterCreatureCard)6 FilterCard (mage.filter.FilterCard)5