From 7c741eb0dd7a060ba423e4dccf312a1dc26e51f3 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 4 Nov 2022 19:53:36 -0500 Subject: [PATCH] [BRO] Implemented Carrion Locust --- Mage.Sets/src/mage/cards/c/CarrionLocust.java | 90 +++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CarrionLocust.java diff --git a/Mage.Sets/src/mage/cards/c/CarrionLocust.java b/Mage.Sets/src/mage/cards/c/CarrionLocust.java new file mode 100644 index 00000000000..a63620464d1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CarrionLocust.java @@ -0,0 +1,90 @@ +package mage.cards.c; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInOpponentsGraveyard; + +/** + * + * @author weirddan455 + */ +public final class CarrionLocust extends CardImpl { + + private static final FilterCard filter = new FilterCard("card from an opponent's graveyard"); + + public CarrionLocust(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.INSECT); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Carrion Locust enters the battlefield, exile target card from an opponent's graveyard. If it was a creature card, that player loses 1 life. + Ability ability = new EntersBattlefieldTriggeredAbility(new CarrionLocustEffect()); + ability.addTarget(new TargetCardInOpponentsGraveyard(filter)); + this.addAbility(ability); + } + + private CarrionLocust(final CarrionLocust card) { + super(card); + } + + @Override + public CarrionLocust copy() { + return new CarrionLocust(this); + } +} + +class CarrionLocustEffect extends OneShotEffect { + + public CarrionLocustEffect() { + super(Outcome.Exile); + this.staticText = "exile target card from an opponent's graveyard. If it was a creature card, that player loses 1 life"; + } + + private CarrionLocustEffect(final CarrionLocustEffect effect) { + super(effect); + } + + @Override + public CarrionLocustEffect copy() { + return new CarrionLocustEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card targetCard = game.getCard(source.getFirstTarget()); + if (targetCard == null) { + return false; + } + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + boolean creature = targetCard.isCreature(game); + Player owner = game.getPlayer(targetCard.getOwnerId()); + controller.moveCards(targetCard, Zone.EXILED, source, game); + if (creature && owner != null) { + owner.loseLife(1, game, source, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 06b4968b5fd..b7918737c49 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -50,6 +50,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Brotherhood's End", 128, Rarity.RARE, mage.cards.b.BrotherhoodsEnd.class)); cards.add(new SetCardInfo("Brushland", 259, Rarity.RARE, mage.cards.b.Brushland.class)); cards.add(new SetCardInfo("Bushwhack", 174, Rarity.UNCOMMON, mage.cards.b.Bushwhack.class)); + cards.add(new SetCardInfo("Carrion Locust", 87, Rarity.COMMON, mage.cards.c.CarrionLocust.class)); cards.add(new SetCardInfo("Citanul Stalwart", 175, Rarity.COMMON, mage.cards.c.CitanulStalwart.class)); cards.add(new SetCardInfo("Clay Champion", 230, Rarity.MYTHIC, mage.cards.c.ClayChampion.class)); cards.add(new SetCardInfo("Clay Revenant", 118, Rarity.COMMON, mage.cards.c.ClayRevenant.class));