Search in sources :

Example 51 with SimpleStaticAbility

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)));
}
Also used : FilterCard(mage.filter.FilterCard) NamePredicate(mage.filter.predicate.mageobject.NamePredicate) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SpellsCostReductionAllEffect(mage.abilities.effects.common.cost.SpellsCostReductionAllEffect)

Example 52 with SimpleStaticAbility

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;
}
Also used : Player(mage.players.Player) ApprovingObject(mage.ApprovingObject) Permanent(mage.game.permanent.Permanent) SpellCostReductionSourceEffect(mage.abilities.effects.common.cost.SpellCostReductionSourceEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility)

Example 53 with SimpleStaticAbility

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;
}
Also used : DamageControllerEffect(mage.abilities.effects.common.DamageControllerEffect) FilterLandPermanent(mage.filter.common.FilterLandPermanent) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) BeginningOfUpkeepTriggeredAbility(mage.abilities.common.BeginningOfUpkeepTriggeredAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 54 with SimpleStaticAbility

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));
}
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 55 with SimpleStaticAbility

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

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)61 Test (org.junit.Test)27 Ability (mage.abilities.Ability)21 Player (mage.players.Player)14 Permanent (mage.game.permanent.Permanent)11 InfoEffect (mage.abilities.effects.common.InfoEffect)10 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)10 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)9 Card (mage.cards.Card)9 FixedTarget (mage.target.targetpointer.FixedTarget)9 UUID (java.util.UUID)8 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)6 FilterCard (mage.filter.FilterCard)5 MageObject (mage.MageObject)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 PreventAllDamageToAllEffect (mage.abilities.effects.common.PreventAllDamageToAllEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 AbilitiesCostReductionControllerEffect (mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect)4