From 3cdc5c578dc41bbad1561a664c42714d17bab329 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 24 Mar 2025 15:25:37 -0400 Subject: [PATCH] [TDM] Implement Call of the Spirit Dragons --- .../mage/cards/c/CallTheSpiritDragons.java | 108 ++++++++++++++++++ .../src/mage/sets/TarkirDragonstorm.java | 1 + Mage/src/main/java/mage/ObjectColor.java | 4 +- Utils/mtg-cards-data.txt | 1 + 4 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/c/CallTheSpiritDragons.java diff --git a/Mage.Sets/src/mage/cards/c/CallTheSpiritDragons.java b/Mage.Sets/src/mage/cards/c/CallTheSpiritDragons.java new file mode 100644 index 00000000000..6860194ee64 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CallTheSpiritDragons.java @@ -0,0 +1,108 @@ +package mage.cards.c; + +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.*; + +/** + * @author TheElk801 + */ +public final class CallTheSpiritDragons extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent(SubType.DRAGON, "Dragons"); + + public CallTheSpiritDragons(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}{U}{B}{R}{G}"); + + // Dragons you control have indestructible. + this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, filter + ))); + + // At the beginning of your upkeep, for each color, put a +1/+1 counter on a Dragon you control of that color. If you put +1/+1 counters on five Dragons this way, you win the game. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CallTheSpiritDragonsEffect())); + } + + private CallTheSpiritDragons(final CallTheSpiritDragons card) { + super(card); + } + + @Override + public CallTheSpiritDragons copy() { + return new CallTheSpiritDragons(this); + } +} + +class CallTheSpiritDragonsEffect extends OneShotEffect { + + private static final List filters = new ArrayList<>(); + + static { + for (ObjectColor color : ObjectColor.getAllColors()) { + FilterPermanent filter = new FilterControlledPermanent( + SubType.DRAGON, color.getDescription() + " Dragon you control" + ); + filter.add(new ColorPredicate(color)); + } + } + + CallTheSpiritDragonsEffect() { + super(Outcome.Benefit); + staticText = "for each color, put a +1/+1 counter on a Dragon you control of that color. " + + "If you put +1/+1 counters on five Dragons this way, you win the game"; + } + + private CallTheSpiritDragonsEffect(final CallTheSpiritDragonsEffect effect) { + super(effect); + } + + @Override + public CallTheSpiritDragonsEffect copy() { + return new CallTheSpiritDragonsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Set dragons = new HashSet<>(); + for (FilterPermanent filter : filters) { + if (!game.getBattlefield().contains(filter, source, game, 1)) { + continue; + } + TargetPermanent target = new TargetPermanent(filter); + target.withNotTarget(true); + player.choose(Outcome.BoostCreature, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null && permanent.addCounters(CounterType.P1P1.createInstance(), source, game)) { + dragons.add(permanent.getId()); + } + } + if (dragons.size() >= 5) { + player.won(game); + } + return !dragons.isEmpty(); + } +} diff --git a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java index ceac0254e22..d5f9edbb2a7 100644 --- a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java +++ b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java @@ -40,6 +40,7 @@ public final class TarkirDragonstorm extends ExpansionSet { cards.add(new SetCardInfo("Bone-Cairn Butcher", 173, Rarity.UNCOMMON, mage.cards.b.BoneCairnButcher.class)); cards.add(new SetCardInfo("Boulderborn Dragon", 239, Rarity.COMMON, mage.cards.b.BoulderbornDragon.class)); cards.add(new SetCardInfo("Breaching Dragonstorm", 101, Rarity.UNCOMMON, mage.cards.b.BreachingDragonstorm.class)); + cards.add(new SetCardInfo("Call the Spirit Dragons", 174, Rarity.MYTHIC, mage.cards.c.CallTheSpiritDragons.class)); cards.add(new SetCardInfo("Caustic Exhale", 74, Rarity.COMMON, mage.cards.c.CausticExhale.class)); cards.add(new SetCardInfo("Channeled Dragonfire", 423, Rarity.UNCOMMON, mage.cards.c.ChanneledDragonfire.class)); cards.add(new SetCardInfo("Coordinated Maneuver", 6, Rarity.COMMON, mage.cards.c.CoordinatedManeuver.class)); diff --git a/Mage/src/main/java/mage/ObjectColor.java b/Mage/src/main/java/mage/ObjectColor.java index 4bc3f7b587f..e85e739ca24 100644 --- a/Mage/src/main/java/mage/ObjectColor.java +++ b/Mage/src/main/java/mage/ObjectColor.java @@ -20,7 +20,7 @@ public class ObjectColor implements Serializable, Copyable, Compara public static final ObjectColor COLORLESS = new ObjectColor(); - public static final ObjectColor GOLD = new ObjectColor("O"); // Not multicolored - Sword of Dungeons & Dragons + public static final ObjectColor GOLD = new ObjectColor("O"); // Not multicolored - Sword of Dungeons & Dragons TODO: remove this, it shouldn't have been added private boolean white; private boolean blue; @@ -516,8 +516,6 @@ public class ObjectColor implements Serializable, Copyable, Compara colors.add(ObjectColor.BLACK); colors.add(ObjectColor.RED); colors.add(ObjectColor.GREEN); - - colors.add(ObjectColor.GOLD); return colors; } } diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 0588db8b9a2..813849d7704 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -57298,6 +57298,7 @@ Awaken the Honored Dead|Tarkir: Dragonstorm|170|R|{B}{G}{U}|Enchantment - Saga|| Barrensteppe Siege|Tarkir: Dragonstorm|171|R|{2}{W}{B}|Enchantment|||As this enchantment enters, choose Abzan or Mardu.$* Abzan -- At the beginning of your end step, put a +1/+1 counter on each creature you control.$* Mardu -- At the beginning of your end step, if a creature died under your control this turn, each opponent sacrifices a creature of their choice.| Betor, Kin to All|Tarkir: Dragonstorm|172|M|{2}{W}{B}{G}|Legendary Creature - Spirit Dragon|5|7|Flying$At the beginning of your end step, if creatures you control have total toughness 10 or greater, draw a card. Then if creatures you control have total toughness 20 or greater, untap each creature you control. Then if creatures you control have total toughness 40 or greater, each opponent loses half their life, rounded up.| Bone-Cairn Butcher|Tarkir: Dragonstorm|173|U|{1}{R}{W}{B}|Creature - Demon|4|4|Mobilize 2$Attacking tokens you control have deathtouch.| +Call the Spirit Dragons|Tarkir: Dragonstorm|174|M|{W}{U}{B}{R}{G}|Enchantment|||Dragons you control have indestructible.$At the beginning of your upkeep, for each color, put a +1/+1 counter on a Dragon you control of that color. If you put +1/+1 counters on five Dragons this way, you win the game.| Cori Mountain Stalwart|Tarkir: Dragonstorm|175|U|{1}{R}{W}|Creature - Human Monk|3|3|Flurry -- Whenever you cast your second spell each turn, this creature deals 2 damage to each opponent and you gain 2 life.| Death Begets Life|Tarkir: Dragonstorm|176|M|{5}{B}{G}{U}|Sorcery|||Destroy all creatures and enchantments. Draw a card for each permanent destroyed this way.| Disruptive Stormbrood|Tarkir: Dragonstorm|178|U|{4}{G}|Creature - Dragon|3|3|Flying$When this creature enters, destroy up to one target artifact or enchantment.|