From 14fd76fb182d558dfee27771e6295043794d1b9e Mon Sep 17 00:00:00 2001 From: jmlundeen Date: Thu, 27 Feb 2025 07:13:17 -0600 Subject: [PATCH] [DFT] Implement Full Throttle --- Mage.Sets/src/mage/cards/f/FullThrottle.java | 74 +++++++++++++++++++ Mage.Sets/src/mage/sets/Aetherdrift.java | 3 + .../common/AdditionalCombatPhaseEffect.java | 45 ++++++++++- 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/f/FullThrottle.java diff --git a/Mage.Sets/src/mage/cards/f/FullThrottle.java b/Mage.Sets/src/mage/cards/f/FullThrottle.java new file mode 100644 index 00000000000..2f2577ef2bf --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FullThrottle.java @@ -0,0 +1,74 @@ +package mage.cards.f; + +import java.util.UUID; + +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.condition.OrCondition; +import mage.abilities.condition.common.IsPhaseCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.turn.Turn; + +/** + * + * @author Jmlundeen + */ +public final class FullThrottle extends CardImpl { + + public FullThrottle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}{R}"); + + + // After this main phase, there are two additional combat phases. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new AdditionalCombatPhaseEffect(2, TargetController.ANY), + new OrCondition(new IsPhaseCondition(TurnPhase.PRECOMBAT_MAIN), new IsPhaseCondition(TurnPhase.POSTCOMBAT_MAIN)), + "After this main phase, there are two additional combat phases." + )); + // At the beginning of each combat this turn, untap all creatures that attacked this turn. + DelayedTriggeredAbility ability = new FullThrottleTriggeredAbility(); + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(ability).concatBy("
")); + } + + private FullThrottle(final FullThrottle card) { + super(card); + } + + @Override + public FullThrottle copy() { + return new FullThrottle(this); + } +} + +class FullThrottleTriggeredAbility extends DelayedTriggeredAbility { + + public FullThrottleTriggeredAbility() { + super(new UntapAllThatAttackedEffect(), Duration.EndOfTurn, false); + setTriggerPhrase("At the beginning of each combat this turn, "); + } + + private FullThrottleTriggeredAbility(final FullThrottleTriggeredAbility ability) { + super(ability); + } + + @Override + public FullThrottleTriggeredAbility copy() { + return new FullThrottleTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Turn turn = game.getState().getTurn(); + return turn.getPhase().getType() == TurnPhase.COMBAT; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Aetherdrift.java b/Mage.Sets/src/mage/sets/Aetherdrift.java index fa0196632dd..0fbb3b30af2 100644 --- a/Mage.Sets/src/mage/sets/Aetherdrift.java +++ b/Mage.Sets/src/mage/sets/Aetherdrift.java @@ -118,6 +118,9 @@ public final class Aetherdrift extends ExpansionSet { cards.add(new SetCardInfo("Forest", 289, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Foul Roads", 255, Rarity.UNCOMMON, mage.cards.f.FoulRoads.class)); cards.add(new SetCardInfo("Fuel the Flames", 126, Rarity.UNCOMMON, mage.cards.f.FuelTheFlames.class)); + cards.add(new SetCardInfo("Full Throttle", 127, Rarity.RARE, mage.cards.f.FullThrottle.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Full Throttle", 386, Rarity.RARE, mage.cards.f.FullThrottle.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Full Throttle", 460, Rarity.RARE, mage.cards.f.FullThrottle.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gallant Strike", 13, Rarity.UNCOMMON, mage.cards.g.GallantStrike.class)); cards.add(new SetCardInfo("Gas Guzzler", 85, Rarity.RARE, mage.cards.g.GasGuzzler.class)); cards.add(new SetCardInfo("Gastal Blockbuster", 128, Rarity.COMMON, mage.cards.g.GastalBlockbuster.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/AdditionalCombatPhaseEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AdditionalCombatPhaseEffect.java index 23163ca9c79..52012fa514c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AdditionalCombatPhaseEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AdditionalCombatPhaseEffect.java @@ -3,19 +3,48 @@ package mage.abilities.effects.common; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; +import mage.constants.TargetController; import mage.constants.TurnPhase; import mage.game.Game; import mage.game.turn.TurnMod; +import java.util.UUID; + public class AdditionalCombatPhaseEffect extends OneShotEffect { + private final int additionalPhases; + private final TargetController targetController; + public AdditionalCombatPhaseEffect() { super(Outcome.Benefit); + this.additionalPhases = 1; + this.targetController = TargetController.YOU; staticText = "after this phase, there is an additional combat phase"; } + public AdditionalCombatPhaseEffect(int additionalPhases) { + this(additionalPhases, TargetController.YOU); + } + + public AdditionalCombatPhaseEffect(int additionalPhases, TargetController targetController) { + super(Outcome.Benefit); + if (additionalPhases < 1) { + throw new IllegalArgumentException("Number of additional phases must be at least 1"); + } + if (additionalPhases == 1) { + this.additionalPhases = 1; + staticText = "after this phase, there is an additional combat phase"; + } else { + this.additionalPhases = additionalPhases; + staticText = "after this phase, there are " + additionalPhases + " additional combat phases"; + } + this.targetController = targetController; + } + protected AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) { super(effect); + this.additionalPhases = effect.additionalPhases; + this.targetController = effect.targetController; } @Override @@ -25,7 +54,21 @@ public class AdditionalCombatPhaseEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - game.getState().getTurnMods().add(new TurnMod(game.getState().getActivePlayerId()).withExtraPhase(TurnPhase.COMBAT)); + UUID controllerId; + switch (targetController) { + case YOU: + controllerId = source.getControllerId(); + break; + case ANY: + controllerId = game.getActivePlayerId(); + break; + default: + throw new UnsupportedOperationException("Unsupported TargetController in AdditionalCombatPhaseEffect: " + targetController); + } + for (int i = 0; i < additionalPhases; i++) { + TurnMod combat = new TurnMod(controllerId).withExtraPhase(TurnPhase.COMBAT); + game.getState().getTurnMods().add(combat); + } return true; } }