From 3b52b4b833e5d9e152da26d3a76ca0c4115df8c7 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Sep 2020 18:20:49 -0400 Subject: [PATCH] [ZNR] Implemented Grakmaw, Skyclave Ravager --- .../mage/cards/g/GrakmawSkyclaveRavager.java | 104 ++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + .../token/GrakmawSkyclaveRavagerToken.java | 29 +++++ 3 files changed, 134 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java diff --git a/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java new file mode 100644 index 0000000000..2eb69d794d --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java @@ -0,0 +1,104 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.GrakmawSkyclaveRavagerToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GrakmawSkyclaveRavager extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledCreaturePermanent("another creature you control"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(new CounterPredicate(CounterType.P1P1)); + } + + public GrakmawSkyclaveRavager(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HYDRA); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Grakmaw, Skyclave Ravager enters the battlefield with three +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), + "with three +1/+1 counters on it" + )); + + // Whenever another creature you control dies, if it had a +1/+1 counter on it, put a +1/+1 counter on Grakmaw. + this.addAbility(new DiesCreatureTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()) + .setText("if it had a +1/+1 counter on it, put a +1/+1 counter on {this}"), + false, filter + )); + + // When Grakmaw dies, create an X/X black and green Hydra creature token, where X is the number of +1/+1 counters on Grakmaw. + this.addAbility(new DiesTriggeredAbility(new GrakmawSkyclaveRavagerEffect())); + } + + private GrakmawSkyclaveRavager(final GrakmawSkyclaveRavager card) { + super(card); + } + + @Override + public GrakmawSkyclaveRavager copy() { + return new GrakmawSkyclaveRavager(this); + } +} + +class GrakmawSkyclaveRavagerEffect extends OneShotEffect { + + GrakmawSkyclaveRavagerEffect() { + super(Outcome.Benefit); + staticText = "create an X/X black and green Hydra creature token, " + + "where X is the number of +1/+1 counters on {this}"; + } + + private GrakmawSkyclaveRavagerEffect(final GrakmawSkyclaveRavagerEffect effect) { + super(effect); + } + + @Override + public GrakmawSkyclaveRavagerEffect copy() { + return new GrakmawSkyclaveRavagerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int counters = 0; + Permanent permanent = source.getSourcePermanentOrLKI(game); + if (permanent != null) { + counters = permanent.getCounters(game).getCount(CounterType.P1P1); + } + return new GrakmawSkyclaveRavagerToken(counters).putOntoBattlefield( + 1, game, source.getSourceId(), source.getControllerId() + ); + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index d837eaf61b..2b13cdb26a 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -189,6 +189,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Glasspool Shore", 60, Rarity.RARE, mage.cards.g.GlasspoolShore.class)); cards.add(new SetCardInfo("Gnarlid Colony", 185, Rarity.COMMON, mage.cards.g.GnarlidColony.class)); cards.add(new SetCardInfo("Goma Fada Vanguard", 141, Rarity.UNCOMMON, mage.cards.g.GomaFadaVanguard.class)); + cards.add(new SetCardInfo("Grakmaw, Skyclave Ravager", 223, Rarity.RARE, mage.cards.g.GrakmawSkyclaveRavager.class)); cards.add(new SetCardInfo("Grimclimb Pathway", 259, Rarity.RARE, mage.cards.g.GrimclimbPathway.class)); cards.add(new SetCardInfo("Grotag Bug-Catcher", 142, Rarity.COMMON, mage.cards.g.GrotagBugCatcher.class)); cards.add(new SetCardInfo("Grotag Night-Runner", 143, Rarity.UNCOMMON, mage.cards.g.GrotagNightRunner.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java b/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java new file mode 100644 index 0000000000..6a018a6319 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java @@ -0,0 +1,29 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class GrakmawSkyclaveRavagerToken extends TokenImpl { + + public GrakmawSkyclaveRavagerToken(int xValue) { + super("Hydra", "X/X black and green Hydra creature token"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + color.setGreen(true); + subtype.add(SubType.HYDRA); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + } + + private GrakmawSkyclaveRavagerToken(final GrakmawSkyclaveRavagerToken token) { + super(token); + } + + public GrakmawSkyclaveRavagerToken copy() { + return new GrakmawSkyclaveRavagerToken(this); + } +}