From 8e767c4942643d4a62bde013bbb5671b944522ad Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 24 Mar 2025 10:19:56 -0400 Subject: [PATCH] [TDM] Implement Cori-Steel Cutter --- .../src/mage/cards/c/CoriSteelCutter.java | 60 +++++++++++++++++++ .../src/mage/sets/TarkirDragonstorm.java | 1 + .../common/CreateTokenAttachSourceEffect.java | 33 ++++++++-- 3 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/c/CoriSteelCutter.java diff --git a/Mage.Sets/src/mage/cards/c/CoriSteelCutter.java b/Mage.Sets/src/mage/cards/c/CoriSteelCutter.java new file mode 100644 index 00000000000..52211d053ac --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CoriSteelCutter.java @@ -0,0 +1,60 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.common.FlurryAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.CreateTokenAttachSourceEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.permanent.token.MonasteryMentorToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CoriSteelCutter extends CardImpl { + + public CoriSteelCutter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{R}"); + + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature gets +1/+1 and has trample and haste. + Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(1, 1)); + ability.addEffect(new GainAbilityAttachedEffect( + TrampleAbility.getInstance(), AttachmentType.EQUIPMENT + ).setText("and has trample")); + ability.addEffect(new GainAbilityAttachedEffect( + HasteAbility.getInstance(), AttachmentType.EQUIPMENT + ).setText("and haste")); + this.addAbility(ability); + + // Flurry -- Whenever you cast your second spell each turn, create a 1/1 white Monk creature token with prowess. You may attach this Equipment to it. + this.addAbility(new FlurryAbility(new CreateTokenAttachSourceEffect( + new MonasteryMentorToken(), "", true + ))); + + // Equip {1}{R} + this.addAbility(new EquipAbility(Outcome.BoostCreature, new ManaCostsImpl<>("{1}{R}"))); + } + + private CoriSteelCutter(final CoriSteelCutter card) { + super(card); + } + + @Override + public CoriSteelCutter copy() { + return new CoriSteelCutter(this); + } +} diff --git a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java index 101acb2351e..ef7af713baf 100644 --- a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java +++ b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java @@ -36,6 +36,7 @@ public final class TarkirDragonstorm extends ExpansionSet { cards.add(new SetCardInfo("Boulderborn Dragon", 239, Rarity.COMMON, mage.cards.b.BoulderbornDragon.class)); cards.add(new SetCardInfo("Caustic Exhale", 74, Rarity.COMMON, mage.cards.c.CausticExhale.class)); cards.add(new SetCardInfo("Cori Mountain Stalwart", 175, Rarity.UNCOMMON, mage.cards.c.CoriMountainStalwart.class)); + cards.add(new SetCardInfo("Cori-Steel Cutter", 103, Rarity.RARE, mage.cards.c.CoriSteelCutter.class)); cards.add(new SetCardInfo("Craterhoof Behemoth", 138, Rarity.MYTHIC, mage.cards.c.CraterhoofBehemoth.class)); cards.add(new SetCardInfo("Cruel Truths", 76, Rarity.COMMON, mage.cards.c.CruelTruths.class)); cards.add(new SetCardInfo("Dalkovan Packbeasts", 7, Rarity.UNCOMMON, mage.cards.d.DalkovanPackbeasts.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenAttachSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenAttachSourceEffect.java index 618419c52ee..0d9c34e9c5b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenAttachSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenAttachSourceEffect.java @@ -1,27 +1,37 @@ package mage.abilities.effects.common; import mage.abilities.Ability; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; +import java.util.Optional; + /** * @author weirddan455 */ public class CreateTokenAttachSourceEffect extends CreateTokenEffect { + private final boolean optional; public CreateTokenAttachSourceEffect(Token token) { this(token, ", then"); } public CreateTokenAttachSourceEffect(Token token, String innerConcat) { + this(token, innerConcat, false); + } + + public CreateTokenAttachSourceEffect(Token token, String innerConcat, boolean optional) { super(token); - staticText = staticText.concat(innerConcat + " attach {this} to it"); + this.optional = optional; + staticText = staticText.concat(innerConcat + (optional ? " you may" : "") + " attach {this} to it"); } private CreateTokenAttachSourceEffect(final CreateTokenAttachSourceEffect effect) { super(effect); + this.optional = effect.optional; } @Override @@ -32,11 +42,22 @@ public class CreateTokenAttachSourceEffect extends CreateTokenEffect { @Override public boolean apply(Game game, Ability source) { super.apply(game, source); - Permanent token = game.getPermanent(this.getLastAddedTokenIds().stream().findFirst().orElse(null)); - if (token != null) { - token.addAttachment(source.getSourceId(), source, game); - return true; + Permanent token = this + .getLastAddedTokenIds() + .stream() + .findFirst() + .map(game::getPermanent) + .orElse(null); + if (token == null || optional + && !Optional + .ofNullable(game.getPlayer(source.getControllerId())) + .map(player -> player.chooseUse( + Outcome.BoostCreature, "Attach the equipment to the token?", source, game + )) + .orElse(false)) { + return false; } - return false; + token.addAttachment(source.getSourceId(), source, game); + return true; } }