From 25dc141caa44c74abd6548f6427d9cbed7035d43 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 16 Jul 2021 08:18:25 -0400 Subject: [PATCH] [AFR] Implemented Trickster's Talisman --- .../src/mage/cards/t/TrickstersTalisman.java | 77 +++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + 2 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TrickstersTalisman.java diff --git a/Mage.Sets/src/mage/cards/t/TrickstersTalisman.java b/Mage.Sets/src/mage/cards/t/TrickstersTalisman.java new file mode 100644 index 00000000000..8213c858f8a --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TrickstersTalisman.java @@ -0,0 +1,77 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeAttachmentCost; +import mage.abilities.effects.CreateTokenCopySourceEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.effects.common.continuous.GainAbilityWithAttachmentEffect; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TrickstersTalisman extends CardImpl { + + public TrickstersTalisman(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{U}"); + + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature gets +1/+1 and has "Whenever this creature deals combat damage to a player, you may sacrifice Trickster's Talisman. If you do, create a token that's a copy of this creature." + Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(1, 1)); + ability.addEffect(new TrickstersTalismanEffect()); + + // Equip {2} + this.addAbility(new EquipAbility(2)); + } + + private TrickstersTalisman(final TrickstersTalisman card) { + super(card); + } + + @Override + public TrickstersTalisman copy() { + return new TrickstersTalisman(this); + } +} + +class TrickstersTalismanEffect extends GainAbilityWithAttachmentEffect { + + TrickstersTalismanEffect() { + super("and has \"Whenever this creature deals combat damage to a player, " + + "you may sacrifice {this}. If you do, create a token that's a copy of this creature.\"", + (Effect) null, null, new SacrificeAttachmentCost(), null); + } + + private TrickstersTalismanEffect(final TrickstersTalismanEffect effect) { + super(effect); + } + + @Override + public TrickstersTalismanEffect copy() { + return new TrickstersTalismanEffect(this); + } + + @Override + protected Ability makeAbility(Game game, Ability source) { + if (game == null || source == null) { + return null; + } + return new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid( + new CreateTokenCopySourceEffect(), useAttachedCost.setMageObjectReference(source, game) + ), false, "Whenever this creature deals combat damage to a player, you may sacrifice " + + source.getSourcePermanentIfItStillExists(game).getName() + + ". If you do, create a token that's a copy of this creature.", false); + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 8ec70595294..2e7cd119904 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -239,6 +239,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Treasure Chest", 252, Rarity.RARE, mage.cards.t.TreasureChest.class)); cards.add(new SetCardInfo("Treasure Vault", 261, Rarity.RARE, mage.cards.t.TreasureVault.class)); cards.add(new SetCardInfo("Trelasarra, Moon Dancer", 236, Rarity.UNCOMMON, mage.cards.t.TrelasarraMoonDancer.class)); + cards.add(new SetCardInfo("Trickster's Talisman", 79, Rarity.UNCOMMON, mage.cards.t.TrickstersTalisman.class)); cards.add(new SetCardInfo("Triumphant Adventurer", 237, Rarity.RARE, mage.cards.t.TriumphantAdventurer.class)); cards.add(new SetCardInfo("True Polymorph", 80, Rarity.RARE, mage.cards.t.TruePolymorph.class)); cards.add(new SetCardInfo("Underdark Basilisk", 208, Rarity.COMMON, mage.cards.u.UnderdarkBasilisk.class));