From 1067a646fa296456a0e19e546e10be687b5e115a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 30 Oct 2022 21:12:31 -0400 Subject: [PATCH] [BRC] Implemented Wreck Hunter --- Mage.Sets/src/mage/cards/w/WreckHunter.java | 91 +++++++++++++++++++ .../mage/sets/TheBrothersWarCommander.java | 1 + 2 files changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WreckHunter.java diff --git a/Mage.Sets/src/mage/cards/w/WreckHunter.java b/Mage.Sets/src/mage/cards/w/WreckHunter.java new file mode 100644 index 0000000000..b7d8a491a1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WreckHunter.java @@ -0,0 +1,91 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.common.FilterNonlandCard; +import mage.filter.predicate.card.PutIntoGraveFromBattlefieldThisTurnPredicate; +import mage.game.Game; +import mage.game.permanent.token.PowerstoneToken; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.watchers.common.CardsPutIntoGraveyardWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WreckHunter extends CardImpl { + + public WreckHunter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // When Wreck Hunter enters the battlefield, choose target player. You create a tapped Powerstone token for each nonland card in that player's graveyard that was put there from the battlefield this turn. + Ability ability = new EntersBattlefieldTriggeredAbility(new WreckHunterEffect()); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability, new CardsPutIntoGraveyardWatcher()); + } + + private WreckHunter(final WreckHunter card) { + super(card); + } + + @Override + public WreckHunter copy() { + return new WreckHunter(this); + } +} + +class WreckHunterEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterNonlandCard(); + + static { + filter.add(PutIntoGraveFromBattlefieldThisTurnPredicate.instance); + } + + WreckHunterEffect() { + super(Outcome.Benefit); + staticText = "choose target player. You create a tapped Powerstone token for each nonland card " + + "in that player's graveyard that was put there from the battlefield this turn"; + } + + private WreckHunterEffect(final WreckHunterEffect effect) { + super(effect); + } + + @Override + public WreckHunterEffect copy() { + return new WreckHunterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null) { + return false; + } + int count = player.getGraveyard().count(filter, game); + return count > 0 && new PowerstoneToken().putOntoBattlefield( + count, game, source, source.getControllerId(), true, false + ); + } +} + diff --git a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java index c0fd07b7b9..46b435aed7 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java @@ -174,5 +174,6 @@ public final class TheBrothersWarCommander extends ExpansionSet { cards.add(new SetCardInfo("Whirler Rogue", 101, Rarity.UNCOMMON, mage.cards.w.WhirlerRogue.class)); cards.add(new SetCardInfo("Wire Surgeons", 10, Rarity.RARE, mage.cards.w.WireSurgeons.class)); cards.add(new SetCardInfo("Workshop Elders", 102, Rarity.RARE, mage.cards.w.WorkshopElders.class)); + cards.add(new SetCardInfo("Wreck Hunter", 11, Rarity.RARE, mage.cards.w.WreckHunter.class)); } }