diff --git a/Mage.Sets/src/mage/cards/o/ObscuraAscendancy.java b/Mage.Sets/src/mage/cards/o/ObscuraAscendancy.java new file mode 100644 index 0000000000..84899720a7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/ObscuraAscendancy.java @@ -0,0 +1,81 @@ +package mage.cards.o; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.SourceHasCounterCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.Effects; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Spirit22Token; +import mage.game.stack.Spell; + +/** + * + * @author weirddan455 + */ +public final class ObscuraAscendancy extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.SPIRIT, "Spirits"); + + public ObscuraAscendancy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}{U}{B}"); + + // Whenever you cast a spell, if its mana value is equal to the number of soul counters on Obscura Ascendancy plus one, put a soul counter on Obscura Ascendancy, then create a 2/2 white Spirit creature token with flying. + SpellCastControllerTriggeredAbility triggeredAbility = new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.SOUL.createInstance()), false); + triggeredAbility.addEffect(new CreateTokenEffect(new Spirit22Token())); + this.addAbility(new ConditionalInterveningIfTriggeredAbility(triggeredAbility, ObscuraAscendancyCondition.instance, + "Whenever you cast a spell, if its mana value is equal to the number of soul counters on {this} plus one, put a soul counter on {this}, then create a 2/2 white Spirit creature token with flying." + )); + + // As long as Obscura Ascendancy has five or more soul counters on it, Spirits you control get +3/+3. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostControlledEffect(3, 3, Duration.WhileOnBattlefield, filter), + new SourceHasCounterCondition(CounterType.SOUL, 5), + "as long as {this} has five or more soul counters on it, Spirits you control get +3/+3" + ))); + } + + private ObscuraAscendancy(final ObscuraAscendancy card) { + super(card); + } + + @Override + public ObscuraAscendancy copy() { + return new ObscuraAscendancy(this); + } +} + +enum ObscuraAscendancyCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentOrLKI(game); + if (permanent != null) { + Effects effects = source.getEffects(); + if (!effects.isEmpty()) { + Object spellCast = effects.get(0).getValue("spellCast"); + if (spellCast instanceof Spell) { + return ((Spell) spellCast).getManaValue() == permanent.getCounters(game).getCount(CounterType.SOUL) + 1; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index d64527b8f5..a9fa558dd4 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -99,6 +99,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Mountain", 268, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Murder", 88, Rarity.COMMON, mage.cards.m.Murder.class)); cards.add(new SetCardInfo("Nimble Larcenist", 205, Rarity.UNCOMMON, mage.cards.n.NimbleLarcenist.class)); + cards.add(new SetCardInfo("Obscura Ascendancy", 207, Rarity.RARE, mage.cards.o.ObscuraAscendancy.class)); cards.add(new SetCardInfo("Obscura Charm", 208, Rarity.UNCOMMON, mage.cards.o.ObscuraCharm.class)); cards.add(new SetCardInfo("Obscura Initiate", 50, Rarity.COMMON, mage.cards.o.ObscuraInitiate.class)); cards.add(new SetCardInfo("Obscura Interceptor", 209, Rarity.RARE, mage.cards.o.ObscuraInterceptor.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/Spirit22Token.java b/Mage/src/main/java/mage/game/permanent/token/Spirit22Token.java new file mode 100644 index 0000000000..8ab0b9c707 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/Spirit22Token.java @@ -0,0 +1,32 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * + * @author weirddan455 + */ +public class Spirit22Token extends TokenImpl { + + public Spirit22Token() { + super("Spirit Token", "2/2 white Spirit creature token with flying"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.SPIRIT); + color.setWhite(true); + power = new MageInt(2); + toughness = new MageInt(2); + addAbility(FlyingAbility.getInstance()); + } + + private Spirit22Token(final Spirit22Token token) { + super(token); + } + + @Override + public Spirit22Token copy() { + return new Spirit22Token(this); + } +}