From f4b5dadaf9cdbafb0a09603cd7ee4df59993cf3f Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 6 Nov 2021 10:58:27 -0500 Subject: [PATCH] [VOW] Implemented Gift of Fangs --- Mage.Sets/src/mage/cards/g/GiftOfFangs.java | 106 ++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 107 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GiftOfFangs.java diff --git a/Mage.Sets/src/mage/cards/g/GiftOfFangs.java b/Mage.Sets/src/mage/cards/g/GiftOfFangs.java new file mode 100644 index 0000000000..c3b9bdad60 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GiftOfFangs.java @@ -0,0 +1,106 @@ +package mage.cards.g; + +import java.util.UUID; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author weirddan455 + */ +public final class GiftOfFangs extends CardImpl { + + public GiftOfFangs(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Neutral)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +2/+2 as long as it's a Vampire. Otherwise, it gets -2/-2. + this.addAbility(new SimpleStaticAbility(new GiftOfFangsEffect())); + } + + private GiftOfFangs(final GiftOfFangs card) { + super(card); + } + + @Override + public GiftOfFangs copy() { + return new GiftOfFangs(this); + } +} + +class GiftOfFangsEffect extends ContinuousEffectImpl { + + public GiftOfFangsEffect() { + super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.Neutral); + staticText = "Enchanted creature gets +2/+2 as long as it's a Vampire. Otherwise, it gets -2/-2"; + } + + private GiftOfFangsEffect(final GiftOfFangsEffect effect) { + super(effect); + } + + @Override + public GiftOfFangsEffect copy() { + return new GiftOfFangsEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + if (affectedObjectsSet) { + // Added boosts of activated or triggered abilities exist independent from the source they are created by + // so a continuous effect for the permanent itself with the attachment is created + Permanent equipment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game.getState().getZoneChangeCounter(equipment.getAttachedTo()))); + } + } + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = null; + if (affectedObjectsSet) { + permanent = game.getPermanent(targetPointer.getFirst(game, source)); + if (permanent == null) { + discard(); + return true; + } + } else { + Permanent equipment = game.getPermanent(source.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + permanent = game.getPermanent(equipment.getAttachedTo()); + } + } + if (permanent != null) { + if (permanent.hasSubtype(SubType.VAMPIRE, game)) { + permanent.addPower(2); + permanent.addToughness(2); + } else { + permanent.addPower(-2); + permanent.addToughness(-2); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 70126f2ba0..849a4cdad1 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -124,6 +124,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Frenzied Devils", 159, Rarity.UNCOMMON, mage.cards.f.FrenziedDevils.class)); cards.add(new SetCardInfo("Geistlight Snare", 60, Rarity.UNCOMMON, mage.cards.g.GeistlightSnare.class)); cards.add(new SetCardInfo("Geralf, Visionary Stitcher", 61, Rarity.RARE, mage.cards.g.GeralfVisionaryStitcher.class)); + cards.add(new SetCardInfo("Gift of Fangs", 113, Rarity.COMMON, mage.cards.g.GiftOfFangs.class)); cards.add(new SetCardInfo("Glorious Sunrise", 200, Rarity.RARE, mage.cards.g.GloriousSunrise.class)); cards.add(new SetCardInfo("Gluttonous Guest", 114, Rarity.COMMON, mage.cards.g.GluttonousGuest.class)); cards.add(new SetCardInfo("Gnarled Grovestrider", 198, Rarity.UNCOMMON, mage.cards.g.GnarledGrovestrider.class));