From 517c9e35c52a241847ef5492178bdfd0eac3d7dd Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Jan 2019 00:14:56 -0500 Subject: [PATCH] Implemented Galloping Lizrog --- .../src/mage/cards/g/GallopingLizrog.java | 87 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 88 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GallopingLizrog.java diff --git a/Mage.Sets/src/mage/cards/g/GallopingLizrog.java b/Mage.Sets/src/mage/cards/g/GallopingLizrog.java new file mode 100644 index 0000000000..34362d524e --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GallopingLizrog.java @@ -0,0 +1,87 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RemoveVariableCountersTargetCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GallopingLizrog extends CardImpl { + + public GallopingLizrog(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}"); + + this.subtype.add(SubType.FROG); + this.subtype.add(SubType.LIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // When Galloping Lizrog enters the battlefield, you may remove any number of +1/+1 counters from among creatures you control. If you do, put twice that many +1/+1 counters on Galloping Lizrog. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GallopingLizrogEffect(), true)); + } + + private GallopingLizrog(final GallopingLizrog card) { + super(card); + } + + @Override + public GallopingLizrog copy() { + return new GallopingLizrog(this); + } +} + +class GallopingLizrogEffect extends OneShotEffect { + + GallopingLizrogEffect() { + super(Outcome.Benefit); + staticText = "remove any number of +1/+1 counters from among creatures you control. " + + "If you do, put twice that many +1/+1 counters on {this}"; + } + + private GallopingLizrogEffect(final GallopingLizrogEffect effect) { + super(effect); + } + + @Override + public GallopingLizrogEffect copy() { + return new GallopingLizrogEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + RemoveVariableCountersTargetCost variableCost + = new RemoveVariableCountersTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE, CounterType.P1P1); + int toPay = variableCost.announceXValue(source, game); + Cost cost = variableCost.getFixedCostsFromAnnouncedValue(toPay); + if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + return false; + } + return new AddCountersSourceEffect( + CounterType.P1P1.createInstance(2 * toPay) + ).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 8cd69754cd..e992776ef0 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -93,6 +93,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Forbidding Spirit", 9, Rarity.UNCOMMON, mage.cards.f.ForbiddingSpirit.class)); cards.add(new SetCardInfo("Frenzied Arynx", 173, Rarity.COMMON, mage.cards.f.FrenziedArynx.class)); cards.add(new SetCardInfo("Frilled Mystic", 174, Rarity.UNCOMMON, mage.cards.f.FrilledMystic.class)); + cards.add(new SetCardInfo("Galloping Lizrog", 175, Rarity.UNCOMMON, mage.cards.g.GallopingLizrog.class)); cards.add(new SetCardInfo("Gate Colossus", 232, Rarity.UNCOMMON, mage.cards.g.GateColossus.class)); cards.add(new SetCardInfo("Gatebreaker Ram", 126, Rarity.UNCOMMON, mage.cards.g.GatebreakerRam.class)); cards.add(new SetCardInfo("Gates Ablaze", 102, Rarity.UNCOMMON, mage.cards.g.GatesAblaze.class));