From a9348270f1cfab0a2ca9f5d8ea4e9b526ecfbd2b Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 4 Nov 2022 16:41:42 -0500 Subject: [PATCH] [BRO] Implemented Zephyr Sentinel --- .../src/mage/cards/z/ZephyrSentinel.java | 103 ++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 1 + 2 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/z/ZephyrSentinel.java diff --git a/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java b/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java new file mode 100644 index 00000000000..09b6f3350c3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java @@ -0,0 +1,103 @@ +package mage.cards.z; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author weirddan455 + */ +public final class ZephyrSentinel extends CardImpl { + + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent("other creature you control"); + + static { + filter.add(AnotherPredicate.instance); + } + + public ZephyrSentinel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Zephyr Sentinel enters the battlefield, return up to one other target creature you control to its owner's hand. If it was a Soldier, put a +1/+1 counter on Zephyr Sentinel. + Ability ability = new EntersBattlefieldTriggeredAbility(new ZephyrSentinelEffect()); + ability.addTarget(new TargetControlledCreaturePermanent(0, 1, filter, false)); + this.addAbility(ability); + } + + private ZephyrSentinel(final ZephyrSentinel card) { + super(card); + } + + @Override + public ZephyrSentinel copy() { + return new ZephyrSentinel(this); + } +} + +class ZephyrSentinelEffect extends OneShotEffect { + + public ZephyrSentinelEffect() { + super(Outcome.ReturnToHand); + this.staticText = "return up to one other target creature you control to its owner's hand. If it was a Soldier, put a +1/+1 counter on {this}"; + } + + private ZephyrSentinelEffect(final ZephyrSentinelEffect effect) { + super(effect); + } + + @Override + public ZephyrSentinelEffect copy() { + return new ZephyrSentinelEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent targetPermanent = game.getPermanent(source.getFirstTarget()); + if (targetPermanent == null) { + return false; + } + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + boolean soldier = targetPermanent.hasSubtype(SubType.SOLDIER, game); + controller.moveCards(targetPermanent, Zone.HAND, source, game); + if (soldier) { + Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); + if (sourcePermanent != null) { + sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 67e20f6100a..8404fdd296b 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -199,6 +199,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Yotian Frontliner", 42, Rarity.UNCOMMON, mage.cards.y.YotianFrontliner.class)); cards.add(new SetCardInfo("Yotian Medic", 33, Rarity.COMMON, mage.cards.y.YotianMedic.class)); cards.add(new SetCardInfo("Yotian Tactician", 228, Rarity.UNCOMMON, mage.cards.y.YotianTactician.class)); + cards.add(new SetCardInfo("Zephyr Sentinel", 74, Rarity.UNCOMMON, mage.cards.z.ZephyrSentinel.class)); cards.removeIf(setCardInfo -> unfinished.contains(setCardInfo.getName())); // remove when mechanic is implemented }