From d098ca5346398079fddb8fdb169beb3fa115c203 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 4 Feb 2025 10:50:42 -0500 Subject: [PATCH] [DFT] Implement Redshift, Rocketeer Chief --- Mage.Sets/src/mage/cards/b/Boommobile.java | 51 +------ .../src/mage/cards/c/CrypticTrilobite.java | 47 +----- Mage.Sets/src/mage/cards/o/OmenHawker.java | 48 +----- .../mage/cards/r/RedshiftRocketeerChief.java | 144 ++++++++++++++++++ .../src/mage/cards/t/TheEnigmaJewel.java | 49 +----- Mage.Sets/src/mage/sets/Aetherdrift.java | 1 + .../common/ActivatedAbilityManaBuilder.java | 52 +++++++ 7 files changed, 207 insertions(+), 185 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/r/RedshiftRocketeerChief.java create mode 100644 Mage/src/main/java/mage/abilities/mana/builder/common/ActivatedAbilityManaBuilder.java diff --git a/Mage.Sets/src/mage/cards/b/Boommobile.java b/Mage.Sets/src/mage/cards/b/Boommobile.java index 1f580e8f366..6bf3fc54c61 100644 --- a/Mage.Sets/src/mage/cards/b/Boommobile.java +++ b/Mage.Sets/src/mage/cards/b/Boommobile.java @@ -1,11 +1,8 @@ package mage.cards.b; -import mage.ConditionalMana; import mage.MageInt; -import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.common.GetXValue; import mage.abilities.effects.common.DamageTargetEffect; @@ -14,14 +11,12 @@ import mage.abilities.effects.mana.AddConditionalManaOfAnyColorEffect; import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.CrewAbility; import mage.abilities.keyword.ExhaustAbility; -import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.counters.CounterType; -import mage.game.Game; import mage.target.common.TargetAnyTarget; import java.util.UUID; @@ -37,12 +32,12 @@ public final class Boommobile extends CardImpl { this.subtype.add(SubType.VEHICLE); this.power = new MageInt(5); this.toughness = new MageInt(5); - + // When this Vehicle enters, add four mana of any one color. Spend this mana only to activate abilities. - ManaEffect entersEffect = new AddConditionalManaOfAnyColorEffect(4, new BoommobileManaBuilder()); + ManaEffect entersEffect = new AddConditionalManaOfAnyColorEffect(4, new ActivatedAbilityManaBuilder()); entersEffect.setText("add four mana of any one color. Spend this mana only to activate abilities."); this.addAbility(new EntersBattlefieldTriggeredAbility(entersEffect)); - + // Exhaust -- {X}{2}{R}: This vehicle deals X damage to any target. Put a +1/+1 counter on this Vehicle. Ability exhaustAbility = new ExhaustAbility(new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>("{X}{2}{R}")); exhaustAbility.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); @@ -62,41 +57,3 @@ public final class Boommobile extends CardImpl { return new Boommobile(this); } } - -class BoommobileManaBuilder extends ConditionalManaBuilder { - - @Override - public ConditionalMana build(Object... options) { - return new BoommobileConditionalMana(this.mana); - } - - @Override - public String getRule() { - return "Spend this mana only to activate abilities"; - } -} - -class BoommobileConditionalMana extends ConditionalMana { - - BoommobileConditionalMana(Mana mana) { - super(mana); - staticText = "Spend this mana only to activate abilities"; - addCondition(new BoommobileManaCondition()); - } -} - -class BoommobileManaCondition extends ManaCondition { - - @Override - public boolean apply(Game game, Ability source) { - if (source != null && !source.isActivated()) { - return source.isActivatedAbility(); - } - return false; - } - - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { - return apply(game, source); - } -} diff --git a/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java index 9d8b0275a0e..3fb87094626 100644 --- a/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java +++ b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java @@ -1,13 +1,9 @@ package mage.cards.c; -import mage.ConditionalMana; import mage.MageInt; -import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.condition.Condition; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -15,14 +11,12 @@ import mage.abilities.dynamicvalue.common.CountersSourceCount; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.ConditionalColorlessManaAbility; -import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.counters.CounterType; -import mage.game.Game; import java.util.UUID; @@ -46,7 +40,7 @@ public final class CrypticTrilobite extends CardImpl { // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. this.addAbility(new ConditionalColorlessManaAbility( new RemoveCountersSourceCost(CounterType.P1P1.createInstance()), - 2, new CrypticTrilobiteManaBuilder(), + 2, new ActivatedAbilityManaBuilder(), new CountersSourceCount(CounterType.P1P1) )); @@ -67,40 +61,3 @@ public final class CrypticTrilobite extends CardImpl { return new CrypticTrilobite(this); } } - -class CrypticTrilobiteManaBuilder extends ConditionalManaBuilder { - - @Override - public ConditionalMana build(Object... options) { - return new CrypticTrilobiteConditionalMana(this.mana); - } - - @Override - public String getRule() { - return "Spend this mana only to activate abilities"; - } -} - -class CrypticTrilobiteConditionalMana extends ConditionalMana { - - CrypticTrilobiteConditionalMana(Mana mana) { - super(mana); - staticText = "Spend this mana only to activate abilities"; - addCondition(new CrypticTrilobiteManaCondition()); - } -} - -class CrypticTrilobiteManaCondition extends ManaCondition implements Condition { - - @Override - public boolean apply(Game game, Ability source) { - return source != null - && !source.isActivated() - && source.isActivatedAbility(); - } - - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { - return apply(game, source); - } -} diff --git a/Mage.Sets/src/mage/cards/o/OmenHawker.java b/Mage.Sets/src/mage/cards/o/OmenHawker.java index 41f0a7f71e2..28a67198073 100644 --- a/Mage.Sets/src/mage/cards/o/OmenHawker.java +++ b/Mage.Sets/src/mage/cards/o/OmenHawker.java @@ -1,19 +1,13 @@ package mage.cards.o; -import mage.ConditionalMana; import mage.MageInt; import mage.Mana; -import mage.abilities.Ability; -import mage.abilities.condition.Condition; -import mage.abilities.costs.Cost; import mage.abilities.mana.ConditionalColoredManaAbility; -import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.game.Game; import java.util.UUID; @@ -32,7 +26,7 @@ public final class OmenHawker extends CardImpl { // {T}: Add {C}{U}. Spend this many only to activate abilities. this.addAbility(new ConditionalColoredManaAbility( - new Mana(0, 1, 0, 0, 0, 0, 0, 1), new OmenHawkerManaBuilder() + new Mana(0, 1, 0, 0, 0, 0, 0, 1), new ActivatedAbilityManaBuilder() )); } @@ -45,41 +39,3 @@ public final class OmenHawker extends CardImpl { return new OmenHawker(this); } } - -class OmenHawkerManaBuilder extends ConditionalManaBuilder { - - @Override - public ConditionalMana build(Object... options) { - return new OmenHawkerConditionalMana(this.mana); - } - - @Override - public String getRule() { - return "Spend this mana only to activate abilities"; - } -} - -class OmenHawkerConditionalMana extends ConditionalMana { - - OmenHawkerConditionalMana(Mana mana) { - super(mana); - staticText = "Spend this mana only to activate abilities"; - addCondition(new OmenHawkerManaCondition()); - } -} - -class OmenHawkerManaCondition extends ManaCondition implements Condition { - - @Override - public boolean apply(Game game, Ability source) { - if (source != null && !source.isActivated()) { - return source.isActivatedAbility(); - } - return false; - } - - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { - return apply(game, source); - } -} diff --git a/Mage.Sets/src/mage/cards/r/RedshiftRocketeerChief.java b/Mage.Sets/src/mage/cards/r/RedshiftRocketeerChief.java new file mode 100644 index 00000000000..f85de1ab50b --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RedshiftRocketeerChief.java @@ -0,0 +1,144 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.SourcePermanentPowerValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.mana.ManaEffect; +import mage.abilities.keyword.ExhaustAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.mana.SimpleManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.choices.ChoiceColor; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RedshiftRocketeerChief extends CardImpl { + + public RedshiftRocketeerChief(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.GOBLIN); + this.subtype.add(SubType.PILOT); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // {T}: Add X mana of any one color, where X is Redshift's power. Spend this mana only to activate abilities. + this.addAbility(new SimpleManaAbility(new RedshiftRocketeerChiefManaEffect(), new TapSourceCost())); + + // Exhaust -- {10}{R}{G}: Put any number of permanent cards from your hand onto the battlefield. + this.addAbility(new ExhaustAbility(new RedshiftRocketeerChiefEffect(), new ManaCostsImpl<>("{10}{R}{G}"))); + } + + private RedshiftRocketeerChief(final RedshiftRocketeerChief card) { + super(card); + } + + @Override + public RedshiftRocketeerChief copy() { + return new RedshiftRocketeerChief(this); + } +} + +class RedshiftRocketeerChiefManaEffect extends ManaEffect { + + private final ConditionalManaBuilder manaBuilder = new ActivatedAbilityManaBuilder(); + + RedshiftRocketeerChiefManaEffect() { + this.staticText = "Add X mana of any one color, where X is {this}'s power. " + manaBuilder.getRule(); + } + + private RedshiftRocketeerChiefManaEffect(final RedshiftRocketeerChiefManaEffect effect) { + super(effect); + } + + @Override + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + if (game == null) { + return netMana; + } + int currentPower = SourcePermanentPowerValue.NOT_NEGATIVE.calculate(game, source, null); + netMana.add(manaBuilder.setMana(Mana.BlackMana(currentPower), source, game).build()); + netMana.add(manaBuilder.setMana(Mana.BlueMana(currentPower), source, game).build()); + netMana.add(manaBuilder.setMana(Mana.RedMana(currentPower), source, game).build()); + netMana.add(manaBuilder.setMana(Mana.GreenMana(currentPower), source, game).build()); + netMana.add(manaBuilder.setMana(Mana.WhiteMana(currentPower), source, game).build()); + return netMana; + } + + @Override + public Mana produceMana(Game game, Ability source) { + Mana mana = new Mana(); + if (game == null) { + return mana; + } + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return mana; + } + ChoiceColor choice = new ChoiceColor(); + if (!controller.choose(Outcome.PutManaInPool, choice, game)) { + return mana; + } + Mana chosen = choice.getMana(SourcePermanentPowerValue.NOT_NEGATIVE.calculate(game, source, null)); + return manaBuilder.setMana(chosen, source, game).build(); + } + + @Override + public RedshiftRocketeerChiefManaEffect copy() { + return new RedshiftRocketeerChiefManaEffect(this); + } +} + +class RedshiftRocketeerChiefEffect extends OneShotEffect { + + RedshiftRocketeerChiefEffect() { + super(Outcome.Benefit); + staticText = "put any number of permanent cards from your hand onto the battlefield"; + } + + private RedshiftRocketeerChiefEffect(final RedshiftRocketeerChiefEffect effect) { + super(effect); + } + + @Override + public RedshiftRocketeerChiefEffect copy() { + return new RedshiftRocketeerChiefEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCard target = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_PERMANENTS); + player.choose(outcome, player.getHand(), target, source, game); + Cards cards = new CardsImpl(target.getTargets()); + return !cards.isEmpty() && player.moveCards(cards, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TheEnigmaJewel.java b/Mage.Sets/src/mage/cards/t/TheEnigmaJewel.java index 1b5dfaa5a6d..6a515394202 100644 --- a/Mage.Sets/src/mage/cards/t/TheEnigmaJewel.java +++ b/Mage.Sets/src/mage/cards/t/TheEnigmaJewel.java @@ -1,16 +1,10 @@ package mage.cards.t; -import mage.ConditionalMana; import mage.MageObject; -import mage.Mana; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; -import mage.abilities.condition.Condition; -import mage.abilities.costs.Cost; import mage.abilities.keyword.CraftAbility; import mage.abilities.mana.ConditionalColorlessManaAbility; -import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -36,7 +30,7 @@ public final class TheEnigmaJewel extends CardImpl { this.addAbility(new EntersBattlefieldTappedAbility()); // {T}: Add {C}{C}. Spend this mana only to activate abilities. - this.addAbility(new ConditionalColorlessManaAbility(2, new TheEnigmaJewelManaBuilder())); + this.addAbility(new ConditionalColorlessManaAbility(2, new ActivatedAbilityManaBuilder())); // Craft with four or more nonlands with activated abilities {8}{U} this.addAbility(new CraftAbility( @@ -67,43 +61,4 @@ enum TheEnigmaJewelPredicate implements Predicate { .stream() .anyMatch(a -> (a.isActivatedAbility())); } - -} - -class TheEnigmaJewelManaBuilder extends ConditionalManaBuilder { - - @Override - public ConditionalMana build(Object... options) { - return new TheEnigmaJewelConditionalMana(this.mana); - } - - @Override - public String getRule() { - return "Spend this mana only to activate abilities"; - } -} - -class TheEnigmaJewelConditionalMana extends ConditionalMana { - - TheEnigmaJewelConditionalMana(Mana mana) { - super(mana); - staticText = "Spend this mana only to activate abilities"; - addCondition(new TheEnigmaJewelManaCondition()); - } -} - -class TheEnigmaJewelManaCondition extends ManaCondition implements Condition { - - @Override - public boolean apply(Game game, Ability source) { - if (source != null && !source.isActivated()) { - return source.isActivatedAbility(); - } - return false; - } - - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { - return apply(game, source); - } } diff --git a/Mage.Sets/src/mage/sets/Aetherdrift.java b/Mage.Sets/src/mage/sets/Aetherdrift.java index 0a432b46199..693e7be8621 100644 --- a/Mage.Sets/src/mage/sets/Aetherdrift.java +++ b/Mage.Sets/src/mage/sets/Aetherdrift.java @@ -176,6 +176,7 @@ public final class Aetherdrift extends ExpansionSet { cards.add(new SetCardInfo("Rangers' Aetherhive", 217, Rarity.UNCOMMON, mage.cards.r.RangersAetherhive.class)); cards.add(new SetCardInfo("Rangers' Refueler", 55, Rarity.UNCOMMON, mage.cards.r.RangersRefueler.class)); cards.add(new SetCardInfo("Reckless Velocitaur", 144, Rarity.UNCOMMON, mage.cards.r.RecklessVelocitaur.class)); + cards.add(new SetCardInfo("Redshift, Rocketeer Chief", 218, Rarity.RARE, mage.cards.r.RedshiftRocketeerChief.class)); cards.add(new SetCardInfo("Reef Roads", 259, Rarity.UNCOMMON, mage.cards.r.ReefRoads.class)); cards.add(new SetCardInfo("Regal Imperiosaur", 177, Rarity.RARE, mage.cards.r.RegalImperiosaur.class)); cards.add(new SetCardInfo("Ride's End", 25, Rarity.COMMON, mage.cards.r.RidesEnd.class)); diff --git a/Mage/src/main/java/mage/abilities/mana/builder/common/ActivatedAbilityManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/builder/common/ActivatedAbilityManaBuilder.java new file mode 100644 index 00000000000..9de687331b5 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/mana/builder/common/ActivatedAbilityManaBuilder.java @@ -0,0 +1,52 @@ +package mage.abilities.mana.builder.common; + +import mage.ConditionalMana; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.ManaCondition; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class ActivatedAbilityManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new ActivatedAbilityConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to activate abilities"; + } +} + +class ActivatedAbilityConditionalMana extends ConditionalMana { + + public ActivatedAbilityConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to activate abilities"; + addCondition(new ActivatedAbilityManaCondition()); + } +} + +class ActivatedAbilityManaCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + return source != null + && !source.isActivated() + && source.isActivatedAbility(); + } + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { + return apply(game, source); + } +}