[VOW] Implemented Radiant Grace / Radiant Restraints

This commit is contained in:
Evan Kranzler 2021-11-11 07:51:55 -05:00
parent ca16f363c8
commit 8a3baf6779
4 changed files with 163 additions and 3 deletions

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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("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("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("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("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("Reckless Impulse", 174, Rarity.COMMON, mage.cards.r.RecklessImpulse.class));
cards.add(new SetCardInfo("Reclusive Taxidermist", 214, Rarity.UNCOMMON, mage.cards.r.ReclusiveTaxidermist.class)); cards.add(new SetCardInfo("Reclusive Taxidermist", 214, Rarity.UNCOMMON, mage.cards.r.ReclusiveTaxidermist.class));

View file

@ -282,9 +282,7 @@ foreach my $ability (@abilities) {
} }
$vars{'abilities'} .= "\n this.getSpellAbility().addTarget(auraTarget);"; $vars{'abilities'} .= "\n this.getSpellAbility().addTarget(auraTarget);";
$vars{'abilities'} .= "\n this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));"; $vars{'abilities'} .= "\n this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));";
$vars{'abilities'} .= "\n Ability ability = new EnchantAbility(auraTarget.getTargetName());"; $vars{'abilities'} .= "\n this.addAbility(new EnchantAbility(auraTarget.getTargetName()));";
$vars{'abilities'} .= "\n this.addAbility(ability);";
$vars{'abilitiesImports'} .= "\nimport mage.abilities.Ability;";
$vars{'abilitiesImports'} .= "\nimport mage.abilities.effects.common.AttachEffect;"; $vars{'abilitiesImports'} .= "\nimport mage.abilities.effects.common.AttachEffect;";
$vars{'abilitiesImports'} .= "\nimport mage.constants.Outcome;"; $vars{'abilitiesImports'} .= "\nimport mage.constants.Outcome;";
$vars{'abilitiesImports'} .= "\nimport mage.target.TargetPermanent;"; $vars{'abilitiesImports'} .= "\nimport mage.target.TargetPermanent;";