From d3eca2271747b751c67ad5efb7c40a8e90b7adb7 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 29 Oct 2021 08:42:51 -0400 Subject: [PATCH] [VOW] Implemented Wedding Invitation --- .../src/mage/cards/w/WeddingInvitation.java | 80 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WeddingInvitation.java diff --git a/Mage.Sets/src/mage/cards/w/WeddingInvitation.java b/Mage.Sets/src/mage/cards/w/WeddingInvitation.java new file mode 100644 index 0000000000..a05d10eaa6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WeddingInvitation.java @@ -0,0 +1,80 @@ +package mage.cards.w; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WeddingInvitation extends CardImpl { + + public WeddingInvitation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); + + // When Wedding Invitation enters the battlefield, draw a card. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); + + // {T}, Sacrifice Wedding Invitation: Target creature can't be blocked this turn. If it's a Vampire, it also gains lifelink until end of turn. + Ability ability = new SimpleActivatedAbility( + new CantBeBlockedTargetEffect(Duration.EndOfTurn), new TapSourceCost() + ); + ability.addCost(new SacrificeSourceCost()); + ability.addEffect(new WeddingInvitationEffect()); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + private WeddingInvitation(final WeddingInvitation card) { + super(card); + } + + @Override + public WeddingInvitation copy() { + return new WeddingInvitation(this); + } +} + +class WeddingInvitationEffect extends OneShotEffect { + + WeddingInvitationEffect() { + super(Outcome.Benefit); + staticText = "If it's a Vampire, it also gains lifelink until end of turn"; + } + + private WeddingInvitationEffect(final WeddingInvitationEffect effect) { + super(effect); + } + + @Override + public WeddingInvitationEffect copy() { + return new WeddingInvitationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + game.addEffect(new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 3a1fdb2e03..ebeefe8dcd 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -53,6 +53,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Thalia, Guardian of Thraben", 38, Rarity.RARE, mage.cards.t.ThaliaGuardianOfThraben.class)); cards.add(new SetCardInfo("Vampires' Vengeance", 180, Rarity.UNCOMMON, mage.cards.v.VampiresVengeance.class)); cards.add(new SetCardInfo("Weary Prisoner", 184, Rarity.COMMON, mage.cards.w.WearyPrisoner.class)); + cards.add(new SetCardInfo("Wedding Invitation", 260, Rarity.COMMON, mage.cards.w.WeddingInvitation.class)); cards.add(new SetCardInfo("Wrathful Jailbreaker", 184, Rarity.COMMON, mage.cards.w.WrathfulJailbreaker.class)); cards.removeIf(setCardInfo -> unfinished.contains(setCardInfo.getName())); // remove when mechanic is fully implemented