From 771c291d789aaf2b3868f2ee9fb153e221edc05e Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 12 Apr 2023 08:30:34 -0400 Subject: [PATCH] [MOC] Implement Conjurer's Mantle --- .../src/mage/cards/c/ConjurersMantle.java | 80 +++++++++++++++++++ .../mage/sets/MarchOfTheMachineCommander.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ConjurersMantle.java diff --git a/Mage.Sets/src/mage/cards/c/ConjurersMantle.java b/Mage.Sets/src/mage/cards/c/ConjurersMantle.java new file mode 100644 index 0000000000..3af905208d --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ConjurersMantle.java @@ -0,0 +1,80 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.common.AttacksAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ConjurersMantle extends CardImpl { + + private static final FilterCard filter + = new FilterCard("a card that shares a creature type with that creature"); + + static { + filter.add(ConjurersMantlePredicate.instance); + } + + public ConjurersMantle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{W}"); + + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature gets +1/+1 and has vigilance. + Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(1, 1)); + ability.addEffect(new GainAbilityAttachedEffect( + VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT + ).setText("and has vigilance")); + this.addAbility(ability); + + // Whenever equipped creature attacks, look at the top six cards of your library. You may reveal a card that shares a creature type with that creature from among them and put it into your hand. Put the rest on the bottom of your library in a random order. + this.addAbility(new AttacksAttachedTriggeredAbility(new LookLibraryAndPickControllerEffect( + 6, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM + ), AttachmentType.EQUIPMENT, false, SetTargetPointer.PERMANENT)); + + // Equip {1} + this.addAbility(new EquipAbility(1, false)); + } + + private ConjurersMantle(final ConjurersMantle card) { + super(card); + } + + @Override + public ConjurersMantle copy() { + return new ConjurersMantle(this); + } +} + +enum ConjurersMantlePredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + return input + .getSource() + .getEffects() + .stream() + .map(effect -> effect.getTargetPointer().getFirst(game, input.getSource())) + .map(game::getPermanent) + .filter(Objects::nonNull) + .anyMatch(permanent -> permanent.shareCreatureTypes(game, input.getObject())); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineCommander.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineCommander.java index 0dd316fb1a..1f2e3ce69e 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineCommander.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineCommander.java @@ -72,6 +72,7 @@ public final class MarchOfTheMachineCommander extends ExpansionSet { cards.add(new SetCardInfo("Commander's Sphere", 352, Rarity.COMMON, mage.cards.c.CommandersSphere.class)); cards.add(new SetCardInfo("Conclave Mentor", 320, Rarity.UNCOMMON, mage.cards.c.ConclaveMentor.class)); cards.add(new SetCardInfo("Conclave Tribunal", 178, Rarity.UNCOMMON, mage.cards.c.ConclaveTribunal.class)); + cards.add(new SetCardInfo("Conjurer's Mantle", 12, Rarity.RARE, mage.cards.c.ConjurersMantle.class)); cards.add(new SetCardInfo("Constable of the Realm", 179, Rarity.UNCOMMON, mage.cards.c.ConstableOfTheRealm.class)); cards.add(new SetCardInfo("Corpse Knight", 321, Rarity.UNCOMMON, mage.cards.c.CorpseKnight.class)); cards.add(new SetCardInfo("Coveted Jewel", 353, Rarity.RARE, mage.cards.c.CovetedJewel.class));