From 56d5ad3dbc8bc92a6d0064ffa86f8a5b671934b0 Mon Sep 17 00:00:00 2001 From: arketec Date: Wed, 17 Aug 2022 18:01:49 -0700 Subject: [PATCH] [NCC] Implement The Beamtown Bullies (#9378) --- .../src/mage/cards/t/TheBeamtownBullies.java | 132 ++++++++++++++++++ .../src/mage/sets/NewCapennaCommander.java | 1 + .../common/TargetOpponentWhoseTurnItIs.java | 31 ++++ 3 files changed, 164 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TheBeamtownBullies.java create mode 100644 Mage/src/main/java/mage/target/common/TargetOpponentWhoseTurnItIs.java diff --git a/Mage.Sets/src/mage/cards/t/TheBeamtownBullies.java b/Mage.Sets/src/mage/cards/t/TheBeamtownBullies.java new file mode 100644 index 00000000000..fdeaeed9a03 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheBeamtownBullies.java @@ -0,0 +1,132 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.combat.GoadTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetOpponentWhoseTurnItIs; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author Arketec + */ +public final class TheBeamtownBullies extends CardImpl { + + private static final FilterCard filter = new FilterCard("nonlegendary creature card"); + + static { + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + filter.add(CardType.CREATURE.getPredicate()); + } + public TheBeamtownBullies(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.OGRE); + this.subtype.add(SubType.DEVIL); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Vigilance, Haste + this.addAbility(VigilanceAbility.getInstance()); + this.addAbility(HasteAbility.getInstance()); + + // Target opponent whose turn it is puts target nonlegendary creature card from your graveyard onto the battlefield under their control. It gains haste. Goad it. At the beginning of the next end step, exile it. + Ability ability = new SimpleActivatedAbility(new TheBeamtownBulliesEffect(), new TapSourceCost()); + + // Choose a non-legendary creature to put on the battlefield under their control + ability.addTarget(new TargetCardInYourGraveyard(filter)); + + this.addAbility(ability); + } + + private TheBeamtownBullies(final TheBeamtownBullies card) { + super(card); + } + + @Override + public TheBeamtownBullies copy() { + return new TheBeamtownBullies(this); + } +} + +class TheBeamtownBulliesEffect extends OneShotEffect { + public TheBeamtownBulliesEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Target opponent whose turn it is puts target nonlegendary creature card from your graveyard onto the battlefield under their control. It gains haste. Goad it. At the beginning of the next end step, exile it."; + } + private TheBeamtownBulliesEffect(final TheBeamtownBulliesEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + // Ability is targeted + TargetPlayer targetOpponent = new TargetOpponentWhoseTurnItIs(game); + Player controller = game.getPlayer(source.getControllerId()); + controller.chooseTarget(Outcome.Neutral, targetOpponent, source, game); + Player opponent = game.getPlayer(targetOpponent.getFirstTarget()); + + // check to ensure it is the chosen opponent's turn + if (opponent != null && opponent.getId().equals(game.getActivePlayerId())) + { + // Put the chosen card onto the battlefield under opponents control + Card card = game.getCard(source.getTargets().getFirstTarget()); + if (card == null || !opponent.moveCards(card, Zone.BATTLEFIELD, source, game)) { + return false; + } + + // Add continuous effects + Permanent permanent = game.getPermanent(card.getId()); + if (permanent == null) { + return false; + } + // Apply Haste + ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); + hasteEffect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(hasteEffect, source); + + // Goad the creature + GoadTargetEffect goadEffect = new GoadTargetEffect(); + goadEffect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(goadEffect, source); + + // Exile it at end of turn + Effect exileEffect = new ExileTargetEffect("At the beginning of the next end step, exile it"); + exileEffect.setTargetPointer(new FixedTarget(permanent, game)); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + return true; + } + return false; + } + + @Override + public Effect copy() { + return new TheBeamtownBulliesEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index be8c0bba6a1..634cd86b802 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -301,6 +301,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Temur Sabertooth", 315, Rarity.UNCOMMON, mage.cards.t.TemurSabertooth.class)); cards.add(new SetCardInfo("Terminate", 353, Rarity.UNCOMMON, mage.cards.t.Terminate.class)); cards.add(new SetCardInfo("Tezzeret's Gambit", 235, Rarity.RARE, mage.cards.t.TezzeretsGambit.class)); + cards.add(new SetCardInfo("The Beamtown Bullies", 6, Rarity.MYTHIC, mage.cards.t.TheBeamtownBullies.class)); cards.add(new SetCardInfo("Thief of Sanity", 354, Rarity.RARE, mage.cards.t.ThiefOfSanity.class)); cards.add(new SetCardInfo("Thragtusk", 316, Rarity.RARE, mage.cards.t.Thragtusk.class)); cards.add(new SetCardInfo("Thriving Bluff", 438, Rarity.COMMON, mage.cards.t.ThrivingBluff.class)); diff --git a/Mage/src/main/java/mage/target/common/TargetOpponentWhoseTurnItIs.java b/Mage/src/main/java/mage/target/common/TargetOpponentWhoseTurnItIs.java new file mode 100644 index 00000000000..a8495048da8 --- /dev/null +++ b/Mage/src/main/java/mage/target/common/TargetOpponentWhoseTurnItIs.java @@ -0,0 +1,31 @@ +package mage.target.common; + +import mage.filter.FilterOpponent; +import mage.filter.predicate.other.PlayerIdPredicate; +import mage.game.Game; +import mage.target.TargetPlayer; + +/** + * @author Arketec + */ +public class TargetOpponentWhoseTurnItIs extends TargetPlayer { + + public TargetOpponentWhoseTurnItIs(Game game) { + this(game,false); + + } + + public TargetOpponentWhoseTurnItIs(Game game, boolean notTarget) { + super(1, 1, notTarget, new FilterOpponent()); + super.filter.add(new PlayerIdPredicate(game.getActivePlayerId())); + } + + private TargetOpponentWhoseTurnItIs(final TargetOpponentWhoseTurnItIs target) { + super(target); + } + + @Override + public TargetOpponentWhoseTurnItIs copy() { + return new TargetOpponentWhoseTurnItIs(this); + } +}