use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class CantStayAwayReplacementEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card targetCard = game.getCard(source.getFirstTarget());
if (controller == null || targetCard == null || game.getState().getZone(targetCard.getId()) != Zone.GRAVEYARD) {
return false;
}
controller.moveCards(targetCard, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(targetCard.getId());
if (permanent != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(new SimpleStaticAbility(new CantStayAwayReplacementEffect()), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.common.SimpleStaticAbility 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.common.SimpleStaticAbility 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.common.SimpleStaticAbility 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));
}
use of mage.abilities.common.SimpleStaticAbility 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));
}
Aggregations