Search in sources :

Example 6 with GainLifeEffect

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

the class AnsweredPrayersToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    new GainLifeEffect(1).apply(game, source);
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent == null) {
        return false;
    }
    if (permanent.isCreature(game)) {
        return true;
    }
    game.addEffect(new BecomesCreatureSourceEffect(new AnsweredPrayersToken(), "enchantment", Duration.EndOfTurn), source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 7 with GainLifeEffect

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

the class CurseOfFoolsWisdomTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
    if (enchantment == null || !event.getPlayerId().equals(enchantment.getAttachedTo())) {
        return false;
    }
    this.getEffects().clear();
    Effect effect = new LoseLifeTargetEffect(2);
    effect.setTargetPointer(new FixedTarget(event.getPlayerId(), game));
    this.addEffect(effect);
    this.addEffect(new GainLifeEffect(2));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) LoseLifeTargetEffect(mage.abilities.effects.common.LoseLifeTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) Effect(mage.abilities.effects.Effect) AttachEffect(mage.abilities.effects.common.AttachEffect) LoseLifeTargetEffect(mage.abilities.effects.common.LoseLifeTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 8 with GainLifeEffect

use of mage.abilities.effects.common.GainLifeEffect 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 9 with GainLifeEffect

use of mage.abilities.effects.common.GainLifeEffect 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 10 with GainLifeEffect

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

the class OutcomesTest method test_FromAbility_Single.

/**
 * Special outcome from ability (AI activates only good abilities)
 */
@Test
public void test_FromAbility_Single() {
    Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
    abilityGood.addCustomOutcome(Outcome.Detriment);
    Assert.assertEquals(-1, abilityGood.getEffects().getOutcomeScore(abilityGood));
    Assert.assertEquals(Outcome.Detriment, abilityGood.getEffects().getOutcome(abilityGood));
    Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
    abilityBad.addCustomOutcome(Outcome.Neutral);
    Assert.assertEquals(1, abilityBad.getEffects().getOutcomeScore(abilityBad));
    Assert.assertEquals(Outcome.Neutral, abilityBad.getEffects().getOutcome(abilityBad));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) Test(org.junit.Test)

Aggregations

GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)27 Permanent (mage.game.permanent.Permanent)11 Ability (mage.abilities.Ability)7 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)6 Player (mage.players.Player)6 Test (org.junit.Test)6 DamagedEvent (mage.game.events.DamagedEvent)5 UUID (java.util.UUID)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)2 Choice (mage.choices.Choice)2 TargetCardInHand (mage.target.common.TargetCardInHand)2 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)2 ArrayList (java.util.ArrayList)1 MageInt (mage.MageInt)1 SacrificeTargetCost (mage.abilities.costs.common.SacrificeTargetCost)1 PermanentsOnBattlefieldCount (mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount)1