use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class CastSplitCardsWithCostModificationTest method prepareReduceEffect.
private void prepareReduceEffect(String cardNameToReduce, int reduceAmount) {
FilterCard filter = new FilterCard();
filter.add(new NamePredicate(cardNameToReduce));
addCustomCardWithAbility("reduce", playerA, new SimpleStaticAbility(new SpellsCostReductionAllEffect(filter, reduceAmount)));
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class GodEternalKefnetDrawCardReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
// reveal top card and drawn (return false to continue default draw)
Permanent god = game.getPermanent(source.getSourceId());
Player you = game.getPlayer(source.getControllerId());
if (god == null && you == null) {
return false;
}
Card topCard = you.getLibrary().getFromTop(game);
if (topCard == null) {
return false;
}
// reveal
you.setTopCardRevealed(true);
// cast copy
if (topCard.isInstantOrSorcery(game) && you.chooseUse(outcome, "Copy " + topCard.getName() + " and cast it for {2} less?", source, game)) {
Card blueprint = topCard.copy();
if (blueprint instanceof SplitCard) {
((SplitCard) blueprint).getLeftHalfCard().addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2)));
((SplitCard) blueprint).getRightHalfCard().addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2)));
} else if (blueprint instanceof ModalDoubleFacesCard) {
((ModalDoubleFacesCard) blueprint).getLeftHalfCard().addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2)));
((ModalDoubleFacesCard) blueprint).getRightHalfCard().addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2)));
} else {
blueprint.addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2)));
}
Card copiedCard = game.copyCard(blueprint, source, source.getControllerId());
// The copy is created in and cast from your hand. (2019-05-03)
you.moveCardToHandWithInfo(copiedCard, source, game, true);
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE);
you.cast(you.chooseAbilityForCast(copiedCard, game, false), game, false, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null);
}
// draw (return false for default draw)
return false;
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class ObsidianFireheartGainAbilityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
// If the owner/controller of this card leaves the game, the blaze counters
// presence on the targeted land will continue to deal 1 damage every upkeep
// to the lands controller.
Permanent targetLand = game.getPermanent(source.getFirstTarget());
if (targetLand != null && source.getTargets().get(0) != null) {
ContinuousEffect effect = new ObsidianFireheartGainAbilityEffect(new BeginningOfUpkeepTriggeredAbility(new DamageControllerEffect(1), TargetController.YOU, false), Duration.Custom, "");
// add a new independent ability that is not reliant on the source ability
SimpleStaticAbility gainAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
// set sourcecard of the independent ability to the targeted permanent of the source ability
gainAbility.setSourceId(targetLand.getId());
// the target of the source ability is added to the new independent ability
gainAbility.getTargets().add(source.getTargets().get(0));
// add the continuous effect to the game with the independent ability
game.addEffect(effect, gainAbility);
return true;
}
return false;
}
use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.
the class OutcomesTest method test_FromEffects_MultiCombine.
@Test
public void test_FromEffects_MultiCombine() {
Ability ability = new SimpleStaticAbility(new GainLifeEffect(10));
ability.addEffect(new BoostSourceEffect(10, 10, Duration.EndOfTurn));
ability.addEffect(new ExileTargetEffect());
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_FromEffects_Single.
/**
* Normal outcome from effects
*/
@Test
public void test_FromEffects_Single() {
Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
Assert.assertEquals(1, abilityGood.getEffects().getOutcomeScore(abilityGood));
Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
Assert.assertEquals(-1, abilityBad.getEffects().getOutcomeScore(abilityBad));
}
Aggregations