From 21f5f93dd69d0c5f14c11fc882cbccff7ce455bf Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:25:51 +0100 Subject: [PATCH] [BLB] Implement Wick, the Whorled Mind --- .../src/mage/cards/w/WickTheWhorledMind.java | 108 ++++++++++++++++++ Mage.Sets/src/mage/sets/Bloomburrow.java | 2 + .../mage/game/permanent/token/SnailToken.java | 29 +++++ 3 files changed, 139 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WickTheWhorledMind.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/SnailToken.java diff --git a/Mage.Sets/src/mage/cards/w/WickTheWhorledMind.java b/Mage.Sets/src/mage/cards/w/WickTheWhorledMind.java new file mode 100644 index 00000000000..d5a585d7055 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WickTheWhorledMind.java @@ -0,0 +1,108 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SnailToken; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class WickTheWhorledMind extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.RAT, "Rat"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.SNAIL, "Snail"); + + public WickTheWhorledMind(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.RAT, SubType.WARLOCK); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Whenever Wick or another Rat you control enters, create a 1/1 black Snail creature token if you don't control a Snail. Otherwise, put a +1/+1 counter on a Snail you control. + this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility( + new WickTheWhorledMindEffect(), filter, false, true + )); + + // {U}{B}{R}, Sacrifice a Snail: Wick deals damage equal to the sacrificed creature's power to each opponent. Then draw cards equal to the sacrificed creature's power. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamagePlayersEffect(SacrificeCostCreaturesPower.instance, TargetController.OPPONENT) + .setText("{this} deals damage equal to the sacrificed creature's power to each opponent"), new ManaCostsImpl<>("{U}{B}{R}") + ); + ability.addEffect(new DrawCardSourceControllerEffect(SacrificeCostCreaturesPower.instance) + .setText("Then draw cards equal to the sacrificed creature's power") + ); + ability.addCost(new SacrificeTargetCost(filter2)); + this.addAbility(ability); + } + + private WickTheWhorledMind(final WickTheWhorledMind card) { + super(card); + } + + @Override + public WickTheWhorledMind copy() { + return new WickTheWhorledMind(this); + } +} + +class WickTheWhorledMindEffect extends OneShotEffect { + + WickTheWhorledMindEffect() { + super(Outcome.Benefit); + staticText = "create a 1/1 black Snail creature token if you don't control a Snail. Otherwise, put a +1/+1 counter on a Snail you control"; + } + + private WickTheWhorledMindEffect(final WickTheWhorledMindEffect effect) { + super(effect); + } + + @Override + public WickTheWhorledMindEffect copy() { + return new WickTheWhorledMindEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.SNAIL, "Snail"); + + if (game.getBattlefield().contains(filter, source.getControllerId(), source, game, 1)) { + TargetPermanent target = new TargetPermanent(filter); + target.withNotTarget(true); + if (!target.canChoose(source.getControllerId(), source, game)) { + return false; + } + controller.choose(Outcome.BoostCreature, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game); + return true; + } + return false; + } + return new SnailToken().putOntoBattlefield(1, game, source, source.getControllerId()); + } +} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index 21bc83a64ff..66701a382b2 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -258,6 +258,8 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Whiskerquill Scribe", 161, Rarity.COMMON, mage.cards.w.WhiskerquillScribe.class)); cards.add(new SetCardInfo("Whiskervale Forerunner", 40, Rarity.RARE, mage.cards.w.WhiskervaleForerunner.class)); cards.add(new SetCardInfo("Wick's Patrol", 121, Rarity.UNCOMMON, mage.cards.w.WicksPatrol.class)); + cards.add(new SetCardInfo("Wick, the Whorled Mind", 120, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Wick, the Whorled Mind", 314, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Wildfire Howl", 162, Rarity.UNCOMMON, mage.cards.w.WildfireHowl.class)); cards.add(new SetCardInfo("Zoraline, Cosmos Caller", 242, Rarity.RARE, mage.cards.z.ZoralineCosmosCaller.class)); } diff --git a/Mage/src/main/java/mage/game/permanent/token/SnailToken.java b/Mage/src/main/java/mage/game/permanent/token/SnailToken.java new file mode 100644 index 00000000000..a1c0974b40c --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/SnailToken.java @@ -0,0 +1,29 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author PurpleCrowbar + */ +public final class SnailToken extends TokenImpl { + + public SnailToken() { + super("Snail Token", "1/1 black Snail creature token"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add(SubType.SNAIL); + power = new MageInt(1); + toughness = new MageInt(1); + } + + private SnailToken(final SnailToken token) { + super(token); + } + + @Override + public SnailToken copy() { + return new SnailToken(this); + } +}