From 9fad271f637747606d0c38f651738b63c90a2f46 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 1 Mar 2022 20:00:08 -0500 Subject: [PATCH] [JUD] Implemented Wormfang Behemoth --- .../src/mage/cards/w/WormfangBehemoth.java | 82 +++++++++++++++++++ Mage.Sets/src/mage/sets/Judgment.java | 1 + 2 files changed, 83 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WormfangBehemoth.java diff --git a/Mage.Sets/src/mage/cards/w/WormfangBehemoth.java b/Mage.Sets/src/mage/cards/w/WormfangBehemoth.java new file mode 100644 index 0000000000..4aa410d93a --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WormfangBehemoth.java @@ -0,0 +1,82 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromExileForSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WormfangBehemoth extends CardImpl { + + public WormfangBehemoth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.subtype.add(SubType.NIGHTMARE); + this.subtype.add(SubType.FISH); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // When Wormfang Behemoth enters the battlefield, exile all cards from your hand. + this.addAbility(new EntersBattlefieldTriggeredAbility(new WormfangBehemothEffect())); + + // When Wormfang Behemoth leaves the battlefield, return the exiled cards to their owner's hand. + this.addAbility(new LeavesBattlefieldTriggeredAbility( + new ReturnFromExileForSourceEffect(Zone.HAND), false + )); + } + + private WormfangBehemoth(final WormfangBehemoth card) { + super(card); + } + + @Override + public WormfangBehemoth copy() { + return new WormfangBehemoth(this); + } +} + +class WormfangBehemothEffect extends OneShotEffect { + + WormfangBehemothEffect() { + super(Outcome.Benefit); + staticText = "exile all cards from your hand"; + } + + private WormfangBehemothEffect(final WormfangBehemothEffect effect) { + super(effect); + } + + @Override + public WormfangBehemothEffect copy() { + return new WormfangBehemothEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || player.getHand().isEmpty()) { + return false; + } + return player.moveCardsToExile( + player.getHand().getCards(game), source, game, true, + CardUtil.getExileZoneId(game, source), + CardUtil.getSourceName(game, source) + ); + } +} diff --git a/Mage.Sets/src/mage/sets/Judgment.java b/Mage.Sets/src/mage/sets/Judgment.java index 2ec3f16394..5ae5e9af36 100644 --- a/Mage.Sets/src/mage/sets/Judgment.java +++ b/Mage.Sets/src/mage/sets/Judgment.java @@ -162,6 +162,7 @@ public final class Judgment extends ExpansionSet { cards.add(new SetCardInfo("Web of Inertia", 53, Rarity.UNCOMMON, mage.cards.w.WebOfInertia.class)); cards.add(new SetCardInfo("Wonder", 54, Rarity.UNCOMMON, mage.cards.w.Wonder.class)); cards.add(new SetCardInfo("Worldgorger Dragon", 103, Rarity.RARE, mage.cards.w.WorldgorgerDragon.class)); + cards.add(new SetCardInfo("Wormfang Behemoth", 55, Rarity.RARE, mage.cards.w.WormfangBehemoth.class)); cards.add(new SetCardInfo("Wormfang Drake", 57, Rarity.COMMON, mage.cards.w.WormfangDrake.class)); cards.add(new SetCardInfo("Wormfang Manta", 58, Rarity.RARE, mage.cards.w.WormfangManta.class)); cards.add(new SetCardInfo("Wormfang Newt", 59, Rarity.COMMON, mage.cards.w.WormfangNewt.class));