From f831eac6fce4bd90699ca1630f5bd907f6720902 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 30 Mar 2021 19:34:16 -0400 Subject: [PATCH] [STX] Implemented Magma Opus --- Mage.Sets/src/mage/cards/m/MagmaOpus.java | 89 +++++++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + .../game/permanent/token/PrismariToken.java | 30 +++++++ 3 files changed, 120 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MagmaOpus.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/PrismariToken.java diff --git a/Mage.Sets/src/mage/cards/m/MagmaOpus.java b/Mage.Sets/src/mage/cards/m/MagmaOpus.java new file mode 100644 index 0000000000..61a85f3d2c --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MagmaOpus.java @@ -0,0 +1,89 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DamageMultiEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.PrismariToken; +import mage.game.permanent.token.TreasureToken; +import mage.target.TargetPermanent; +import mage.target.common.TargetAnyTargetAmount; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MagmaOpus extends CardImpl { + + public MagmaOpus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{6}{U}{R}"); + + // Magma Opus deals 4 damage divided as you choose among any number of targets. Tap two target permanents. Create a 4/4 blue and red Elemental creature token. Draw two cards. + this.getSpellAbility().addEffect(new DamageMultiEffect(4)); + this.getSpellAbility().addTarget(new TargetAnyTargetAmount(4).withChooseHint("damage")); + this.getSpellAbility().addEffect(new MagmaOpusTapEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(2, StaticFilters.FILTER_PERMANENTS).withChooseHint("tap")); + this.getSpellAbility().addEffect(new CreateTokenEffect(new PrismariToken())); + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2).setText("Draw two cards")); + + // {U/R}{U/R}, Discard Magma Opus: Create a Treasure token. + Ability ability = new SimpleActivatedAbility( + Zone.HAND, new CreateTokenEffect(new TreasureToken()), new ManaCostsImpl("{U/R}{U/R}") + ); + ability.addCost(new DiscardSourceCost()); + this.addAbility(ability); + } + + private MagmaOpus(final MagmaOpus card) { + super(card); + } + + @Override + public MagmaOpus copy() { + return new MagmaOpus(this); + } +} + +class MagmaOpusTapEffect extends OneShotEffect { + + MagmaOpusTapEffect() { + super(Outcome.Benefit); + staticText = "Tap two target permanents."; + } + + private MagmaOpusTapEffect(final MagmaOpusTapEffect effect) { + super(effect); + } + + @Override + public MagmaOpusTapEffect copy() { + return new MagmaOpusTapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + if (!source.getTargets().get(1).getTargets().contains(targetId)) { + continue; + } + Permanent permanent = game.getPermanent(targetId); + if (permanent != null) { + permanent.tap(source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 569d6b6672..da9b4edc77 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -64,6 +64,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Lorehold Campus", 268, Rarity.COMMON, mage.cards.l.LoreholdCampus.class)); cards.add(new SetCardInfo("Lorehold Command", 199, Rarity.RARE, mage.cards.l.LoreholdCommand.class)); cards.add(new SetCardInfo("Lorehold Pledgemage", 201, Rarity.COMMON, mage.cards.l.LoreholdPledgemage.class)); + cards.add(new SetCardInfo("Magma Opus", 203, Rarity.MYTHIC, mage.cards.m.MagmaOpus.class)); cards.add(new SetCardInfo("Mountain", 372, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mountain", 373, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Necroblossom Snarl", 269, Rarity.RARE, mage.cards.n.NecroblossomSnarl.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/PrismariToken.java b/Mage/src/main/java/mage/game/permanent/token/PrismariToken.java new file mode 100644 index 0000000000..90faca6bc2 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/PrismariToken.java @@ -0,0 +1,30 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class PrismariToken extends TokenImpl { + + public PrismariToken() { + super("Elemental", "4/4 blue and red Elemental creature token"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + color.setRed(true); + subtype.add(SubType.ELEMENTAL); + power = new MageInt(4); + toughness = new MageInt(4); + } + + private PrismariToken(final PrismariToken token) { + super(token); + } + + @Override + public PrismariToken copy() { + return new PrismariToken(this); + } +}