From 63df7bcfffc9b03c509569e8f01be2ec3c746805 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 25 Apr 2022 19:28:31 -0400 Subject: [PATCH] [NCC] Implemented First Responder --- .../src/mage/cards/f/FirstResponder.java | 92 +++++++++++++++++++ .../src/mage/sets/NewCapennaCommander.java | 1 + 2 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FirstResponder.java diff --git a/Mage.Sets/src/mage/cards/f/FirstResponder.java b/Mage.Sets/src/mage/cards/f/FirstResponder.java new file mode 100644 index 00000000000..2bd3634a1b8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FirstResponder.java @@ -0,0 +1,92 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FirstResponder extends CardImpl { + + public FirstResponder(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.subtype.add(SubType.OGRE); + this.subtype.add(SubType.CITIZEN); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // At the beginning of your end step, you may return another creature you control to its owner's hand, then put a number of +1/+1 counters equal to that creature's power on First Responder. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new FirstResponderEffect(), TargetController.YOU, false + )); + } + + private FirstResponder(final FirstResponder card) { + super(card); + } + + @Override + public FirstResponder copy() { + return new FirstResponder(this); + } +} + +class FirstResponderEffect extends OneShotEffect { + + FirstResponderEffect() { + super(Outcome.Benefit); + staticText = "you may return another creature you control to its owner's hand, " + + "then put a number of +1/+1 counters equal to that creature's power on {this}"; + } + + private FirstResponderEffect(final FirstResponderEffect effect) { + super(effect); + } + + @Override + public FirstResponderEffect copy() { + return new FirstResponderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetPermanent( + 0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE + ); + target.setNotTarget(true); + player.choose(Outcome.ReturnToHand, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null) { + return false; + } + player.moveCards(permanent, Zone.HAND, source, game); + int power = permanent.getPower().getValue(); + Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); + if (power < 1 || sourcePermanent == null) { + sourcePermanent.addCounters(CounterType.P1P1.createInstance(power), source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index 5e7e36411bb..2028898c138 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -121,6 +121,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Fell the Mighty", 200, Rarity.RARE, mage.cards.f.FellTheMighty.class)); cards.add(new SetCardInfo("Fellwar Stone", 367, Rarity.UNCOMMON, mage.cards.f.FellwarStone.class)); cards.add(new SetCardInfo("Fetid Heath", 401, Rarity.RARE, mage.cards.f.FetidHeath.class)); + cards.add(new SetCardInfo("First Responder", 60, Rarity.RARE, mage.cards.f.FirstResponder.class)); cards.add(new SetCardInfo("Flooded Grove", 402, Rarity.RARE, mage.cards.f.FloodedGrove.class)); cards.add(new SetCardInfo("Foreboding Ruins", 403, Rarity.RARE, mage.cards.f.ForebodingRuins.class)); cards.add(new SetCardInfo("Forgotten Ancient", 291, Rarity.RARE, mage.cards.f.ForgottenAncient.class));