diff --git a/Mage.Sets/src/mage/cards/p/PitAutomaton.java b/Mage.Sets/src/mage/cards/p/PitAutomaton.java new file mode 100644 index 00000000000..9a4174f9c56 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PitAutomaton.java @@ -0,0 +1,100 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.CopyTargetStackObjectEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.ExhaustAbility; +import mage.abilities.mana.ConditionalColorlessManaAbility; +import mage.abilities.mana.builder.common.ActivatedAbilityManaBuilder; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.StackObject; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PitAutomaton extends CardImpl { + + public PitAutomaton(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + + this.subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + + // {T}: Add {C}{C}. Spend this mana only to activate abilities. + this.addAbility(new ConditionalColorlessManaAbility(2, new ActivatedAbilityManaBuilder())); + + // {2}, {T}: When you next activate an exhaust ability this turn, copy it. You may choose new targets for the copy. + Ability ability = new SimpleActivatedAbility( + new CreateDelayedTriggeredAbilityEffect(new PitAutomatonTriggeredAbility()), new GenericManaCost(2) + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private PitAutomaton(final PitAutomaton card) { + super(card); + } + + @Override + public PitAutomaton copy() { + return new PitAutomaton(this); + } +} + +class PitAutomatonTriggeredAbility extends DelayedTriggeredAbility { + + PitAutomatonTriggeredAbility() { + super(new CopyTargetStackObjectEffect(true), Duration.EndOfTurn, true, false); + } + + private PitAutomatonTriggeredAbility(final PitAutomatonTriggeredAbility ability) { + super(ability); + } + + @Override + public PitAutomatonTriggeredAbility copy() { + return new PitAutomatonTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!isControlledBy(event.getPlayerId())) { + return false; + } + StackObject stackObject = game.getStack().getStackObject(event.getTargetId()); + if (stackObject == null || !(stackObject.getStackAbility() instanceof ExhaustAbility)) { + return false; + } + this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId())); + return true; + } + + @Override + public String getRule() { + return "When you next activate an exhaust ability this turn, copy it. You may choose new targets for the copy."; + } +} diff --git a/Mage.Sets/src/mage/sets/Aetherdrift.java b/Mage.Sets/src/mage/sets/Aetherdrift.java index 693e7be8621..5ac3311964d 100644 --- a/Mage.Sets/src/mage/sets/Aetherdrift.java +++ b/Mage.Sets/src/mage/sets/Aetherdrift.java @@ -164,6 +164,7 @@ public final class Aetherdrift extends ExpansionSet { cards.add(new SetCardInfo("Pactdoll Terror", 99, Rarity.COMMON, mage.cards.p.PactdollTerror.class)); cards.add(new SetCardInfo("Pedal to the Metal", 141, Rarity.COMMON, mage.cards.p.PedalToTheMetal.class)); cards.add(new SetCardInfo("Perilous Snare", 23, Rarity.RARE, mage.cards.p.PerilousSnare.class)); + cards.add(new SetCardInfo("Pit Automaton", 238, Rarity.UNCOMMON, mage.cards.p.PitAutomaton.class)); cards.add(new SetCardInfo("Plains", 272, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plow Through", 174, Rarity.UNCOMMON, mage.cards.p.PlowThrough.class)); cards.add(new SetCardInfo("Point the Way", 175, Rarity.UNCOMMON, mage.cards.p.PointTheWay.class));