diff --git a/Mage.Sets/src/mage/cards/t/TawnosUrzasApprentice.java b/Mage.Sets/src/mage/cards/t/TawnosUrzasApprentice.java new file mode 100644 index 00000000000..e4db5140e72 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TawnosUrzasApprentice.java @@ -0,0 +1,101 @@ +package mage.cards.t; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterStackObject; +import mage.filter.predicate.ability.ArtifactSourcePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.stack.StackAbility; +import mage.players.Player; +import mage.target.common.TargetActivatedOrTriggeredAbility; + +/** + * + * @author TheElk801 + */ +public final class TawnosUrzasApprentice extends CardImpl { + + private final static FilterStackObject filter = new FilterStackObject("activated or triggered ability you control from an artifact source"); + + static { + filter.add(new ArtifactSourcePredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public TawnosUrzasApprentice(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // {U}{R}, {T}: Copy target activated or triggered ability you control from an artifact source. You may choose new targets for the copy. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TawnosUrzasApprenticeEffect(), new ManaCostsImpl("{U}{R}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetActivatedOrTriggeredAbility(filter)); + this.addAbility(ability); + } + + public TawnosUrzasApprentice(final TawnosUrzasApprentice card) { + super(card); + } + + @Override + public TawnosUrzasApprentice copy() { + return new TawnosUrzasApprentice(this); + } +} + +class TawnosUrzasApprenticeEffect extends OneShotEffect { + + public TawnosUrzasApprenticeEffect() { + super(Outcome.Copy); + this.staticText = "copy target activated or triggered ability you control from an artifact source. You may choose new targets for the copy"; + } + + public TawnosUrzasApprenticeEffect(final TawnosUrzasApprenticeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(targetPointer.getFirst(game, source)); + if (stackAbility != null) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (controller != null && sourcePermanent != null) { + stackAbility.createCopyOnStack(game, source, source.getControllerId(), true); + game.informPlayers(sourcePermanent.getIdName() + ": " + controller.getLogName() + " copied an ability"); + return true; + } + } + return false; + + } + + @Override + public TawnosUrzasApprenticeEffect copy() { + return new TawnosUrzasApprenticeEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index fa3ff924dab..3c08832562e 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -21,5 +21,6 @@ public final class Commander2018 extends ExpansionSet { this.blockName = "Command Zone"; cards.add(new SetCardInfo("Saheeli's Directive", 26, Rarity.RARE, mage.cards.s.SaheelisDirective.class)); + cards.add(new SetCardInfo("Tawnos, Urza's Apprentice", 45, Rarity.MYTHIC, mage.cards.t.TawnosUrzasApprentice.class)); } }