From 69c619151fd6594f6275d6cc97ef27ce1b006e24 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Fri, 9 Sep 2022 04:29:47 +0100 Subject: [PATCH] [DMC] Implement Mana Cannons (#9494) --- Mage.Sets/src/mage/cards/m/ManaCannons.java | 64 +++++++++++++++++++ .../mage/sets/DominariaUnitedCommander.java | 2 + 2 files changed, 66 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/ManaCannons.java diff --git a/Mage.Sets/src/mage/cards/m/ManaCannons.java b/Mage.Sets/src/mage/cards/m/ManaCannons.java new file mode 100644 index 0000000000..d17f7cb998 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/ManaCannons.java @@ -0,0 +1,64 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.target.common.TargetAnyTarget; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class ManaCannons extends CardImpl { + + public ManaCannons(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + // Whenever you cast a multicolored spell, Mana Cannons deals X damage to any target, where X is the number of colors that spell is. + Ability ability = new SpellCastControllerTriggeredAbility( + new DamageTargetEffect(ManaCannonsSpellValue.instance) + .setText("{this} deals X damage to any target, where X is the number of colors that spell is"), + StaticFilters.FILTER_SPELL_A_MULTICOLORED, false + ); + ability.addTarget(new TargetAnyTarget()); + this.addAbility(ability); + } + + private ManaCannons(final ManaCannons card) { + super(card); + } + + @Override + public ManaCannons copy() { + return new ManaCannons(this); + } +} + +enum ManaCannonsSpellValue implements DynamicValue { + instance(); + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Spell spell = (Spell) effect.getValue("spellCast"); + return spell != null ? spell.getColor(game).getColorCount() : 0; + } + + @Override + public ManaCannonsSpellValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java index 5eae92b38e..b94ab5f2e2 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java +++ b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java @@ -107,6 +107,8 @@ public final class DominariaUnitedCommander extends ExpansionSet { cards.add(new SetCardInfo("Lavalanche", 157, Rarity.RARE, mage.cards.l.Lavalanche.class)); cards.add(new SetCardInfo("Maelstrom Archangel", 158, Rarity.MYTHIC, mage.cards.m.MaelstromArchangel.class)); cards.add(new SetCardInfo("Maelstrom Nexus", 159, Rarity.MYTHIC, mage.cards.m.MaelstromNexus.class)); + cards.add(new SetCardInfo("Mana Cannons", 7, Rarity.RARE, mage.cards.m.ManaCannons.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mana Cannons", 83, Rarity.RARE, mage.cards.m.ManaCannons.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Merciless Eviction", 160, Rarity.RARE, mage.cards.m.MercilessEviction.class)); cards.add(new SetCardInfo("Migration Path", 135, Rarity.UNCOMMON, mage.cards.m.MigrationPath.class)); cards.add(new SetCardInfo("Mikokoro, Center of the Sea", 217, Rarity.RARE, mage.cards.m.MikokoroCenterOfTheSea.class));