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;
}
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;
}
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));
}
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));
}
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));
}
Aggregations