From 5fb94c65567e6e35c54e3d34ce6b07acfc5e2aa3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 7 Feb 2022 09:41:33 -0500 Subject: [PATCH] [NEO] Implemented Automated Artificer --- .../src/mage/cards/a/AutomatedArtificer.java | 101 ++++++++++++++++++ .../src/mage/sets/KamigawaNeonDynasty.java | 1 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AutomatedArtificer.java diff --git a/Mage.Sets/src/mage/cards/a/AutomatedArtificer.java b/Mage.Sets/src/mage/cards/a/AutomatedArtificer.java new file mode 100644 index 0000000000..e39f0d2b9c --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AutomatedArtificer.java @@ -0,0 +1,101 @@ +package mage.cards.a; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.mana.ConditionalColorlessManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.ManaCondition; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.command.Commander; +import mage.game.stack.StackObject; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AutomatedArtificer extends CardImpl { + + public AutomatedArtificer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // {T}: Add {C}. Spend this mana only to activate an ability or cast an artifact spell. + this.addAbility(new ConditionalColorlessManaAbility( + new TapSourceCost(), 1, new AutomatedArtificerManaBuilder() + )); + } + + private AutomatedArtificer(final AutomatedArtificer card) { + super(card); + } + + @Override + public AutomatedArtificer copy() { + return new AutomatedArtificer(this); + } +} + +class AutomatedArtificerManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new AutomatedArtificerConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to activate an ability or cast an artifact spell"; + } +} + +class AutomatedArtificerConditionalMana extends ConditionalMana { + + AutomatedArtificerConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to activate an ability or cast an artifact spell"; + addCondition(new AutomatedArtificerManaCondition()); + } +} + +class AutomatedArtificerManaCondition extends ManaCondition { + + @Override + public boolean apply(Game game, Ability source) { + if (source == null) { + return false; + } + switch (source.getAbilityType()) { + case MANA: + case ACTIVATED: + return true; + case SPELL: + MageObject object = source.getSourceObject(game); + if (!(object instanceof StackObject) && !game.inCheckPlayableState()) { + return false; + } + if (object instanceof Commander) { + return ((Commander) object).getSourceObject().isArtifact(game); + } + return object.isArtifact(game); + } + return false; + } + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { + return apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 561dac155c..1289663ac4 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -36,6 +36,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Asari Captain", 215, Rarity.UNCOMMON, mage.cards.a.AsariCaptain.class)); cards.add(new SetCardInfo("Assassin's Ink", 87, Rarity.UNCOMMON, mage.cards.a.AssassinsInk.class)); cards.add(new SetCardInfo("Atsushi, the Blazing Sky", 134, Rarity.MYTHIC, mage.cards.a.AtsushiTheBlazingSky.class)); + cards.add(new SetCardInfo("Automated Artificer", 239, Rarity.COMMON, mage.cards.a.AutomatedArtificer.class)); cards.add(new SetCardInfo("Awakened Awareness", 47, Rarity.UNCOMMON, mage.cards.a.AwakenedAwareness.class)); cards.add(new SetCardInfo("Azusa's Many Journeys", 172, Rarity.UNCOMMON, mage.cards.a.AzusasManyJourneys.class)); cards.add(new SetCardInfo("Bamboo Grove Archer", 173, Rarity.COMMON, mage.cards.b.BambooGroveArcher.class));