From 43c9a98ecd9c3952fc7affe95b828c523801bdd3 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 16 Jan 2023 16:57:43 -0500 Subject: [PATCH] [ONE] Implement Nissa, Ascended Animist --- .../mage/cards/n/NissaAscendedAnimist.java | 106 ++++++++++++++++++ .../src/mage/cards/u/UrabrasksForge.java | 8 +- .../src/mage/sets/PhyrexiaAllWillBeOne.java | 1 + .../token/PhyrexianHorrorGreenToken.java | 36 ++++++ ...oken.java => PhyrexianHorrorRedToken.java} | 12 +- 5 files changed, 151 insertions(+), 12 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/n/NissaAscendedAnimist.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorGreenToken.java rename Mage/src/main/java/mage/game/permanent/token/{PhyrexianHorrorToken.java => PhyrexianHorrorRedToken.java} (64%) diff --git a/Mage.Sets/src/mage/cards/n/NissaAscendedAnimist.java b/Mage.Sets/src/mage/cards/n/NissaAscendedAnimist.java new file mode 100644 index 0000000000..18fc736b28 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NissaAscendedAnimist.java @@ -0,0 +1,106 @@ +package mage.cards.n; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.*; +import mage.abilities.keyword.CompleatedAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.token.PhyrexianHorrorGreenToken; +import mage.game.permanent.token.PhyrexianHorrorRedToken; +import mage.target.TargetPermanent; + +/** + * @author TheElk801 + */ +public final class NissaAscendedAnimist extends CardImpl { + + private static final DynamicValue xValue + = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.FOREST)); + private static final Hint hint = new ValueHint("Forests you control", xValue); + + public NissaAscendedAnimist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{G}{G}{G/P}{G/P}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.NISSA); + this.setStartingLoyalty(7); + + // Compleated + this.addAbility(CompleatedAbility.getInstance()); + + // +1: Create an X/X green Phyrexian Horror creature token, where X is Nissa, Ascended Animist's loyalty. + this.addAbility(new LoyaltyAbility(new NissaAscendedAnimistEffect(), 1)); + + // -1: Destroy target artifact or enchantment. + Ability ability = new LoyaltyAbility(new DestroyTargetEffect(), -1); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT)); + this.addAbility(ability); + + // -7: Until end of turn, creatures you control get +1/+1 for each Forest you control and gain trample. + ability = new LoyaltyAbility(new BoostControlledEffect( + xValue, xValue, Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE, + false, true + ).setText("until end of turn, creatures you control get +1/+1 for each Forest you control"), -7); + ability.addEffect(new GainAbilityControlledEffect( + TrampleAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("and gain trample")); + this.addAbility(ability.addHint(hint)); + } + + private NissaAscendedAnimist(final NissaAscendedAnimist card) { + super(card); + } + + @Override + public NissaAscendedAnimist copy() { + return new NissaAscendedAnimist(this); + } +} + +class NissaAscendedAnimistEffect extends OneShotEffect { + + NissaAscendedAnimistEffect() { + super(Outcome.Benefit); + staticText = "create an X/X green Phyrexian Horror creature token, where X is {this}'s loyalty"; + } + + private NissaAscendedAnimistEffect(final NissaAscendedAnimistEffect effect) { + super(effect); + } + + @Override + public NissaAscendedAnimistEffect copy() { + return new NissaAscendedAnimistEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int loyalty = Optional + .ofNullable(source.getSourcePermanentOrLKI(game)) + .filter(Objects::nonNull) + .map(permanent -> permanent.getCounters(game)) + .map(counters -> counters.getCount(CounterType.LOYALTY)) + .orElse(0); + return new PhyrexianHorrorGreenToken(loyalty).putOntoBattlefield(1, game, source); + } +} diff --git a/Mage.Sets/src/mage/cards/u/UrabrasksForge.java b/Mage.Sets/src/mage/cards/u/UrabrasksForge.java index 03d4fea5e1..2820f1db95 100644 --- a/Mage.Sets/src/mage/cards/u/UrabrasksForge.java +++ b/Mage.Sets/src/mage/cards/u/UrabrasksForge.java @@ -8,8 +8,6 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfCombatTriggeredAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ExileTargetEffect; -import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.effects.common.SacrificeTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; @@ -17,12 +15,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.TargetController; -import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; -import mage.game.permanent.token.PhyrexianHorrorToken; +import mage.game.permanent.token.PhyrexianHorrorRedToken; import mage.game.permanent.token.Token; -import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTargets; /** @@ -77,7 +73,7 @@ class UrabrasksForgeEffect extends OneShotEffect { .map(permanent -> permanent.getCounters(game)) .map(counters -> counters.getCount(CounterType.OIL)) .orElse(0); - Token token = new PhyrexianHorrorToken(amount); + Token token = new PhyrexianHorrorRedToken(amount); token.putOntoBattlefield(1, game, source); game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility( new SacrificeTargetEffect().setText("sacrifice it") diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index dbe67d7292..bbe357c220 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -42,6 +42,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Mirrex", 254, Rarity.RARE, mage.cards.m.Mirrex.class)); cards.add(new SetCardInfo("Monument to Perfection", 233, Rarity.RARE, mage.cards.m.MonumentToPerfection.class)); cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Nissa, Ascended Animist", 175, Rarity.MYTHIC, mage.cards.n.NissaAscendedAnimist.class)); cards.add(new SetCardInfo("Norn's Wellspring", 24, Rarity.RARE, mage.cards.n.NornsWellspring.class)); cards.add(new SetCardInfo("Ovika, Enigma Goliath", 213, Rarity.RARE, mage.cards.o.OvikaEnigmaGoliath.class)); cards.add(new SetCardInfo("Phyrexian Arena", 104, Rarity.RARE, mage.cards.p.PhyrexianArena.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorGreenToken.java b/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorGreenToken.java new file mode 100644 index 0000000000..028b595bf0 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorGreenToken.java @@ -0,0 +1,36 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class PhyrexianHorrorGreenToken extends TokenImpl { + + public PhyrexianHorrorGreenToken(int xValue) { + super("Phyrexian Horror Token", "X/X green Phyrexian Horror creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add(SubType.PHYREXIAN); + subtype.add(SubType.HORROR); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + + availableImageSetCodes = Arrays.asList("ONE"); + } + + public PhyrexianHorrorGreenToken(final PhyrexianHorrorGreenToken token) { + super(token); + } + + @Override + public PhyrexianHorrorGreenToken copy() { + return new PhyrexianHorrorGreenToken(this); + } +} diff --git a/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorToken.java b/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorRedToken.java similarity index 64% rename from Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorToken.java rename to Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorRedToken.java index e3f4cde5d9..3cd4f5f50c 100644 --- a/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/PhyrexianHorrorRedToken.java @@ -11,10 +11,10 @@ import java.util.Arrays; /** * @author TheElk801 */ -public final class PhyrexianHorrorToken extends TokenImpl { +public final class PhyrexianHorrorRedToken extends TokenImpl { - public PhyrexianHorrorToken(int xValue) { - super("Phyrexian Token", "X/1 red Phyrexian Horror creature token with trample and haste"); + public PhyrexianHorrorRedToken(int xValue) { + super("Phyrexian Horror Token", "X/1 red Phyrexian Horror creature token with trample and haste"); cardType.add(CardType.CREATURE); color.setRed(true); subtype.add(SubType.PHYREXIAN); @@ -28,12 +28,12 @@ public final class PhyrexianHorrorToken extends TokenImpl { availableImageSetCodes = Arrays.asList("ONE"); } - public PhyrexianHorrorToken(final PhyrexianHorrorToken token) { + public PhyrexianHorrorRedToken(final PhyrexianHorrorRedToken token) { super(token); } @Override - public PhyrexianHorrorToken copy() { - return new PhyrexianHorrorToken(this); + public PhyrexianHorrorRedToken copy() { + return new PhyrexianHorrorRedToken(this); } }