updated Arcane Artisan code (#5341)

This commit is contained in:
Evan Kranzler 2018-09-25 08:37:59 -04:00
parent 32fd543824
commit a41324b330

View file

@ -1,9 +1,6 @@
package mage.cards.a; package mage.cards.a;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -15,24 +12,27 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect; import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.TargetCard;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ArcaneArtisan extends CardImpl { public final class ArcaneArtisan extends CardImpl {
@ -46,10 +46,14 @@ public final class ArcaneArtisan extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// {2}{U}, {T}: Target player draws a card, then exiles a card from their hand. If a creature card is exiled this way, that player creates a token that's a copy of that card. // {2}{U}, {T}: Target player draws a card, then exiles a card from their hand. If a creature card is exiled this way, that player creates a token that's a copy of that card.
Ability ability = new SimpleActivatedAbility(new ArcaneArtisanCreateTokenEffect(), new ManaCostsImpl("{2}{U}")); Ability ability = new SimpleActivatedAbility(
new ArcaneArtisanCreateTokenEffect(),
new ManaCostsImpl("{2}{U}")
);
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(ability); this.addAbility(ability);
// When Arcane Artisan leaves the battlefield, exile all tokens created with it at the beginning of the next end step. // When Arcane Artisan leaves the battlefield, exile all tokens created with it at the beginning of the next end step.
this.addAbility(new ArcaneArtisanLeavesBattlefieldTriggeredAbility()); this.addAbility(new ArcaneArtisanLeavesBattlefieldTriggeredAbility());
} }
@ -66,13 +70,13 @@ public final class ArcaneArtisan extends CardImpl {
class ArcaneArtisanCreateTokenEffect extends OneShotEffect { class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
ArcaneArtisanCreateTokenEffect() { public ArcaneArtisanCreateTokenEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "Target player draws a card, then exiles a card from their hand. " this.staticText = "Target player draws a card, then exiles a card from their hand. "
+ "If a creature card is exiled this way, that player creates a token that's a copy of that card."; + "If a creature card is exiled this way, that player creates a token that's a copy of that card.";
} }
ArcaneArtisanCreateTokenEffect(final ArcaneArtisanCreateTokenEffect effect) { public ArcaneArtisanCreateTokenEffect(final ArcaneArtisanCreateTokenEffect effect) {
super(effect); super(effect);
} }
@ -88,8 +92,8 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
return false; return false;
} }
player.drawCards(1, game); player.drawCards(1, game);
Target target = new TargetCardInHand(1, new FilterCard()); TargetCard target = new TargetCardInHand(1, StaticFilters.FILTER_CARD);
if (!player.chooseTarget(Outcome.Exile, target, source, game)) { if (!player.chooseTarget(Outcome.Exile, player.getHand(), target, source, game)) {
return false; return false;
} }
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
@ -119,14 +123,14 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
class ArcaneArtisanLeavesBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility { class ArcaneArtisanLeavesBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility {
ArcaneArtisanLeavesBattlefieldTriggeredAbility() { public ArcaneArtisanLeavesBattlefieldTriggeredAbility() {
super(Zone.BATTLEFIELD, null, super(Zone.BATTLEFIELD, null,
new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ArcaneArtisanExileEffect())), new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ArcaneArtisanExileEffect())),
"", false "", false
); );
} }
ArcaneArtisanLeavesBattlefieldTriggeredAbility(ArcaneArtisanLeavesBattlefieldTriggeredAbility ability) { public ArcaneArtisanLeavesBattlefieldTriggeredAbility(ArcaneArtisanLeavesBattlefieldTriggeredAbility ability) {
super(ability); super(ability);
} }
@ -143,12 +147,12 @@ class ArcaneArtisanLeavesBattlefieldTriggeredAbility extends ZoneChangeTriggered
class ArcaneArtisanExileEffect extends OneShotEffect { class ArcaneArtisanExileEffect extends OneShotEffect {
ArcaneArtisanExileEffect() { public ArcaneArtisanExileEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "exile all tokens created with {this}."; this.staticText = "exile all tokens created with {this}.";
} }
ArcaneArtisanExileEffect(final ArcaneArtisanExileEffect effect) { public ArcaneArtisanExileEffect(final ArcaneArtisanExileEffect effect) {
super(effect); super(effect);
} }