From 305ec27f336f40abb9f082d48ddf1cce00c5da7c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 8 Apr 2021 18:15:55 -0400 Subject: [PATCH] [C21] Implemented Rousing Refrain --- .../src/mage/cards/r/RousingRefrain.java | 83 +++++++++++++++++++ .../src/mage/sets/Commander2021Edition.java | 1 + 2 files changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RousingRefrain.java diff --git a/Mage.Sets/src/mage/cards/r/RousingRefrain.java b/Mage.Sets/src/mage/cards/r/RousingRefrain.java new file mode 100644 index 00000000000..1b8f4f7a01b --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RousingRefrain.java @@ -0,0 +1,83 @@ +package mage.cards.r; + +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.SuspendAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ManaType; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RousingRefrain extends CardImpl { + + public RousingRefrain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{R}"); + + // Add {R} for each card in target opponent's hand. Until end of turn, you don't lose this mana as steps and phases end. Exile Rousing Refrain with three time counters on it. + this.getSpellAbility().addEffect(new RousingRefrainEffect()); + this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + this.getSpellAbility().addEffect(new AddCountersSourceEffect( + CounterType.TIME.createInstance(), StaticValue.get(3), false, true + ).setText("with 3 time counters on it")); + this.getSpellAbility().addTarget(new TargetOpponent()); + + // Suspend 3—{1}{R} + this.addAbility(new SuspendAbility(3, new ManaCostsImpl<>("{1}{R}"), this)); + } + + private RousingRefrain(final RousingRefrain card) { + super(card); + } + + @Override + public RousingRefrain copy() { + return new RousingRefrain(this); + } +} + +class RousingRefrainEffect extends OneShotEffect { + + RousingRefrainEffect() { + super(Outcome.Benefit); + staticText = "Add {R} for each card in target opponent's hand. " + + "Until end of turn, you don't lose this mana as steps and phases end"; + } + + private RousingRefrainEffect(final RousingRefrainEffect effect) { + super(effect); + } + + @Override + public RousingRefrainEffect copy() { + return new RousingRefrainEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player player = game.getPlayer(source.getFirstTarget()); + if (controller == null || player == null || player.getHand().isEmpty()) { + return false; + } + controller.getManaPool().addMana( + new Mana(ManaType.RED, player.getHand().size()), + game, source, false + ); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 881ced8bc13..34f3f6a2b2d 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -74,6 +74,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Reinterpret", 73, Rarity.RARE, mage.cards.r.Reinterpret.class)); cards.add(new SetCardInfo("Replication Technique", 31, Rarity.RARE, mage.cards.r.ReplicationTechnique.class)); cards.add(new SetCardInfo("Return to Dust", 100, Rarity.UNCOMMON, mage.cards.r.ReturnToDust.class)); + cards.add(new SetCardInfo("Rousing Refrain", 56, Rarity.RARE, mage.cards.r.RousingRefrain.class)); cards.add(new SetCardInfo("Rout", 101, Rarity.RARE, mage.cards.r.Rout.class)); cards.add(new SetCardInfo("Sanctum Gargoyle", 102, Rarity.COMMON, mage.cards.s.SanctumGargoyle.class)); cards.add(new SetCardInfo("Scrap Trawler", 260, Rarity.RARE, mage.cards.s.ScrapTrawler.class));