From ab69653cd7d9cfe6dde5758015ce2cca7a89aaaa Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+Cguy7777@users.noreply.github.com> Date: Sat, 9 Dec 2023 15:04:08 -0600 Subject: [PATCH] [MIR] Implement Barreling Attack (#11529) --- .../src/mage/cards/b/BarrelingAttack.java | 75 +++++++++++++++++++ Mage.Sets/src/mage/sets/Mirage.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BarrelingAttack.java diff --git a/Mage.Sets/src/mage/cards/b/BarrelingAttack.java b/Mage.Sets/src/mage/cards/b/BarrelingAttack.java new file mode 100644 index 00000000000..19d8531fabf --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BarrelingAttack.java @@ -0,0 +1,75 @@ +package mage.cards.b; + +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.dynamicvalue.common.BlockingCreatureCount; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author Cguy7777 + */ +public final class BarrelingAttack extends CardImpl { + + public BarrelingAttack(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}{R}"); + + // Target creature gains trample until end of turn. + // When that creature becomes blocked this turn, it gets +1/+1 until end of turn for each creature blocking it. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new BarrelingAttackTriggeredAbility())); + } + + private BarrelingAttack(final BarrelingAttack card) { + super(card); + } + + @Override + public BarrelingAttack copy() { + return new BarrelingAttack(this); + } +} + +class BarrelingAttackTriggeredAbility extends DelayedTriggeredAbility { + + BarrelingAttackTriggeredAbility() { + super(new BoostTargetEffect(BlockingCreatureCount.TARGET, BlockingCreatureCount.TARGET, Duration.EndOfTurn), + Duration.EndOfTurn, false); + setTriggerPhrase("When that creature becomes blocked this turn, "); + } + + private BarrelingAttackTriggeredAbility(final BarrelingAttackTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CREATURE_BLOCKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getTargetId().equals(this.getFirstTarget())) { + Permanent attackingCreature = game.getPermanentOrLKIBattlefield(event.getTargetId()); + return attackingCreature != null; + } + return false; + } + + @Override + public BarrelingAttackTriggeredAbility copy() { + return new BarrelingAttackTriggeredAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index d534aa0de59..a13874b3c96 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -43,6 +43,7 @@ public final class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Bad River", 324, Rarity.UNCOMMON, mage.cards.b.BadRiver.class)); cards.add(new SetCardInfo("Barbed Foliage", 207, Rarity.UNCOMMON, mage.cards.b.BarbedFoliage.class)); cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class)); + cards.add(new SetCardInfo("Barreling Attack", 157, Rarity.RARE, mage.cards.b.BarrelingAttack.class)); cards.add(new SetCardInfo("Basalt Golem", 294, Rarity.UNCOMMON, mage.cards.b.BasaltGolem.class)); cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class)); cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class));