From 1fc6abc08ea73a6430846ffa798bdc684a9cff59 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 5 Sep 2025 14:43:11 -0400 Subject: [PATCH] [SPM] Implement Wisecrack --- Mage.Sets/src/mage/cards/w/Wisecrack.java | 72 +++++++++++++++++++ Mage.Sets/src/mage/sets/MarvelsSpiderMan.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/Wisecrack.java diff --git a/Mage.Sets/src/mage/cards/w/Wisecrack.java b/Mage.Sets/src/mage/cards/w/Wisecrack.java new file mode 100644 index 00000000000..5b133dcfa0b --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/Wisecrack.java @@ -0,0 +1,72 @@ +package mage.cards.w; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Controllable; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Wisecrack extends CardImpl { + + public Wisecrack(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); + + // Target creature deals damage equal to its power to itself. If that creature is attacking, Wisecrack deals 2 damage to that creature's controller. + this.getSpellAbility().addEffect(new WisecrackEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private Wisecrack(final Wisecrack card) { + super(card); + } + + @Override + public Wisecrack copy() { + return new Wisecrack(this); + } +} + +class WisecrackEffect extends OneShotEffect { + + WisecrackEffect() { + super(Outcome.Benefit); + staticText = "target creature deals damage equal to its power to itself. " + + "If that creature is attacking, {this} deals 2 damage to that creature's controller"; + } + + private WisecrackEffect(final WisecrackEffect effect) { + super(effect); + } + + @Override + public WisecrackEffect copy() { + return new WisecrackEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game); + if (permanent.isAttacking()) { + Optional.ofNullable(permanent) + .map(Controllable::getControllerId) + .map(game::getPlayer) + .map(player -> player.damage(2, source, game)); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java index ed5c1ff768c..39f8f98654f 100644 --- a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java +++ b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java @@ -287,6 +287,7 @@ public final class MarvelsSpiderMan extends ExpansionSet { cards.add(new SetCardInfo("Web-Warriors", 203, Rarity.UNCOMMON, mage.cards.w.WebWarriors.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Whoosh!", 48, Rarity.COMMON, mage.cards.w.Whoosh.class)); cards.add(new SetCardInfo("Wild Pack Squad", 23, Rarity.COMMON, mage.cards.w.WildPackSquad.class)); + cards.add(new SetCardInfo("Wisecrack", 98, Rarity.UNCOMMON, mage.cards.w.Wisecrack.class)); cards.add(new SetCardInfo("With Great Power...", 24, Rarity.RARE, mage.cards.w.WithGreatPower.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("With Great Power...", 248, Rarity.RARE, mage.cards.w.WithGreatPower.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Wraith, Vicious Vigilante", 160, Rarity.UNCOMMON, mage.cards.w.WraithViciousVigilante.class));