From 7eaeeef67670d6f98f4cd47cb18c4b8aeedcb8d9 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 7 Apr 2023 08:38:45 -0400 Subject: [PATCH] [MOM] Implement Thrashing Frontliner --- .../src/mage/cards/t/ThrashingFrontliner.java | 86 +++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ThrashingFrontliner.java diff --git a/Mage.Sets/src/mage/cards/t/ThrashingFrontliner.java b/Mage.Sets/src/mage/cards/t/ThrashingFrontliner.java new file mode 100644 index 0000000000..04fbb22fbe --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThrashingFrontliner.java @@ -0,0 +1,86 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ThrashingFrontliner extends CardImpl { + + public ThrashingFrontliner(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.PHYREXIAN); + this.subtype.add(SubType.VIASHINO); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever Thrashing Frontliner attacks a battle, it gets +1/+1 until end of turn. + this.addAbility(new ThrashingFrontlinerTriggeredAbility()); + } + + private ThrashingFrontliner(final ThrashingFrontliner card) { + super(card); + } + + @Override + public ThrashingFrontliner copy() { + return new ThrashingFrontliner(this); + } +} + +class ThrashingFrontlinerTriggeredAbility extends TriggeredAbilityImpl { + + ThrashingFrontlinerTriggeredAbility() { + super(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn)); + } + + private ThrashingFrontlinerTriggeredAbility(final ThrashingFrontlinerTriggeredAbility ability) { + super(ability); + } + + @Override + public ThrashingFrontlinerTriggeredAbility copy() { + return new ThrashingFrontlinerTriggeredAbility(this); + } + + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return Optional + .ofNullable(this.getSourceId()) + .map(game.getCombat()::getDefenderId) + .map(game::getPermanent) + .filter(Objects::nonNull) + .map(permanent -> permanent.isBattle(game)) + .orElse(false); + } + + @Override + public String getRule() { + return "Whenever {this} attacks a battle, it gets +1/+1 until end of turn."; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index e33c4aee31..6554ed3d8b 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -196,6 +196,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Tarkir Duneshaper", 43, Rarity.COMMON, mage.cards.t.TarkirDuneshaper.class)); cards.add(new SetCardInfo("Tenured Oilcaster", 126, Rarity.COMMON, mage.cards.t.TenuredOilcaster.class)); cards.add(new SetCardInfo("Thornwood Falls", 274, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class)); + cards.add(new SetCardInfo("Thrashing Frontliner", 167, Rarity.COMMON, mage.cards.t.ThrashingFrontliner.class)); cards.add(new SetCardInfo("Thunderhead Squadron", 81, Rarity.COMMON, mage.cards.t.ThunderheadSquadron.class)); cards.add(new SetCardInfo("Tiller of Flesh", 44, Rarity.UNCOMMON, mage.cards.t.TillerOfFlesh.class)); cards.add(new SetCardInfo("Timberland Ancient", 210, Rarity.COMMON, mage.cards.t.TimberlandAncient.class));