[NEO] Implemented Automated Artificer

This commit is contained in:
Evan Kranzler 2022-02-07 09:41:33 -05:00
parent a64741ff49
commit 5fb94c6556
2 changed files with 102 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));