From 8a3baf6779ead3a5c08caae58f47d69291772f5a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 11 Nov 2021 07:51:55 -0500 Subject: [PATCH] [VOW] Implemented Radiant Grace / Radiant Restraints --- Mage.Sets/src/mage/cards/r/RadiantGrace.java | 106 ++++++++++++++++++ .../src/mage/cards/r/RadiantRestraints.java | 54 +++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 2 + Utils/gen-card.pl | 4 +- 4 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/r/RadiantGrace.java create mode 100644 Mage.Sets/src/mage/cards/r/RadiantRestraints.java diff --git a/Mage.Sets/src/mage/cards/r/RadiantGrace.java b/Mage.Sets/src/mage/cards/r/RadiantGrace.java new file mode 100644 index 0000000000..0ab4e8ac2d --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RadiantGrace.java @@ -0,0 +1,106 @@ +package mage.cards.r; + +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.TransformAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RadiantGrace extends CardImpl { + + public RadiantGrace(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}"); + + this.subtype.add(SubType.AURA); + this.secondSideCardClazz = mage.cards.r.RadiantRestraints.class; + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted creature gets +1/+0 and has vigilance. + Ability ability = new SimpleStaticAbility(new BoostEnchantedEffect(1, 0)); + ability.addEffect(new GainAbilityAttachedEffect( + VigilanceAbility.getInstance(), AttachmentType.AURA + ).setText("and has vigilance")); + this.addAbility(ability); + + // When enchanted creature dies, return Radiant Grace to the battlefield transformed under your control attached to target opponent. + this.addAbility(new TransformAbility()); + ability = new DiesAttachedTriggeredAbility( + new RadiantGraceEffect(), "enchanted creature", false + ); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + private RadiantGrace(final RadiantGrace card) { + super(card); + } + + @Override + public RadiantGrace copy() { + return new RadiantGrace(this); + } +} + +class RadiantGraceEffect extends OneShotEffect { + + RadiantGraceEffect() { + super(Outcome.Benefit); + staticText = "return {this} to the battlefield transformed under your control attached to target opponent"; + } + + private RadiantGraceEffect(final RadiantGraceEffect effect) { + super(effect); + } + + @Override + public RadiantGraceEffect copy() { + return new RadiantGraceEffect(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 + || game.getState().getZone(source.getSourceId()) != Zone.GRAVEYARD) { + return false; + } + + Card card = game.getCard(source.getSourceId()); + if (card == null) { + return false; + } + + game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); + UUID secondFaceId = game.getCard(source.getSourceId()).getSecondCardFace().getId(); + game.getState().setValue("attachTo:" + secondFaceId, player.getId()); + if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { + player.addAttachment(card.getId(), source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/r/RadiantRestraints.java b/Mage.Sets/src/mage/cards/r/RadiantRestraints.java new file mode 100644 index 0000000000..27e9b742b7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RadiantRestraints.java @@ -0,0 +1,54 @@ +package mage.cards.r; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RadiantRestraints extends CardImpl { + + private static final FilterCreaturePermanent filter + = new FilterCreaturePermanent("creatures enchanted player controls"); + + static { + filter.add(TargetController.ENCHANTED.getControllerPredicate()); + } + + public RadiantRestraints(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, ""); + + this.subtype.add(SubType.AURA); + this.subtype.add(SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Creatures enchanted player controls enter the battlefield tapped. + this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter))); + } + + private RadiantRestraints(final RadiantRestraints card) { + super(card); + } + + @Override + public RadiantRestraints copy() { + return new RadiantRestraints(this); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 5884ae5a25..aba253a20a 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -240,6 +240,8 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Plains", 398, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Pointed Discussion", 126, Rarity.COMMON, mage.cards.p.PointedDiscussion.class)); cards.add(new SetCardInfo("Pyre Spawn", 173, Rarity.COMMON, mage.cards.p.PyreSpawn.class)); + cards.add(new SetCardInfo("Radiant Grace", 31, Rarity.UNCOMMON, mage.cards.r.RadiantGrace.class)); + cards.add(new SetCardInfo("Radiant Restraints", 31, Rarity.UNCOMMON, mage.cards.r.RadiantRestraints.class)); cards.add(new SetCardInfo("Ragged Recluse", 127, Rarity.COMMON, mage.cards.r.RaggedRecluse.class)); cards.add(new SetCardInfo("Reckless Impulse", 174, Rarity.COMMON, mage.cards.r.RecklessImpulse.class)); cards.add(new SetCardInfo("Reclusive Taxidermist", 214, Rarity.UNCOMMON, mage.cards.r.ReclusiveTaxidermist.class)); diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index 739b0b0fe9..582ce38203 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -282,9 +282,7 @@ foreach my $ability (@abilities) { } $vars{'abilities'} .= "\n this.getSpellAbility().addTarget(auraTarget);"; $vars{'abilities'} .= "\n this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));"; - $vars{'abilities'} .= "\n Ability ability = new EnchantAbility(auraTarget.getTargetName());"; - $vars{'abilities'} .= "\n this.addAbility(ability);"; - $vars{'abilitiesImports'} .= "\nimport mage.abilities.Ability;"; + $vars{'abilities'} .= "\n this.addAbility(new EnchantAbility(auraTarget.getTargetName()));"; $vars{'abilitiesImports'} .= "\nimport mage.abilities.effects.common.AttachEffect;"; $vars{'abilitiesImports'} .= "\nimport mage.constants.Outcome;"; $vars{'abilitiesImports'} .= "\nimport mage.target.TargetPermanent;";