[ONE] Implement Nissa, Ascended Animist

This commit is contained in:
theelk801 2023-01-16 16:57:43 -05:00
parent 7996e08286
commit 43c9a98ecd
5 changed files with 151 additions and 12 deletions

View file

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

View file

@ -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")

View file

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

View file

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

View file

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