From b0853fae8b35116a0af6ad24a3955f268149e64e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 11 Jan 2020 15:20:32 -0500 Subject: [PATCH] Implemented Protean Thaumaturge --- .../src/mage/cards/a/ArtisanOfForms.java | 32 ++++---- .../src/mage/cards/p/ProteanThaumaturge.java | 78 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 3 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/p/ProteanThaumaturge.java diff --git a/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java b/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java index ac415c84391..1d8a35af4a3 100644 --- a/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java +++ b/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java @@ -1,11 +1,8 @@ - package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.keyword.HeroicAbility; import mage.cards.CardImpl; @@ -18,8 +15,9 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class ArtisanOfForms extends CardImpl { @@ -33,14 +31,10 @@ public final class ArtisanOfForms extends CardImpl { this.toughness = new MageInt(1); // Heroic — Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature, except it has this ability. - Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new ArtisanOfFormsApplyToPermanent(), true); - effect.setText("have {this} become a copy of target creature, except it has this ability"); - Ability ability = new HeroicAbility(effect, true); - ability.addTarget(new TargetCreaturePermanent()); - this.addAbility(ability); + this.addAbility(createAbility()); } - public ArtisanOfForms(final ArtisanOfForms card) { + private ArtisanOfForms(final ArtisanOfForms card) { super(card); } @@ -48,24 +42,28 @@ public final class ArtisanOfForms extends CardImpl { public ArtisanOfForms copy() { return new ArtisanOfForms(this); } + + static Ability createAbility() { + Ability ability = new HeroicAbility(new CopyPermanentEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, + new ArtisanOfFormsApplyToPermanent(), true + ).setText("have {this} become a copy of target creature, except it has this ability"), true); + ability.addTarget(new TargetCreaturePermanent()); + return ability; + } } class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent { @Override public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { - Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent()); - effect.setText("have {this} become a copy of target creature, except it has this ability"); - mageObject.getAbilities().add(new HeroicAbility(effect, true)); + mageObject.getAbilities().add(ArtisanOfForms.createAbility()); return true; } @Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { - Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent()); - effect.setText("have {this} become a copy of target creature, except it has this ability"); - permanent.addAbility(new HeroicAbility(effect, true), game); + permanent.addAbility(ArtisanOfForms.createAbility(), game); return true; } - } diff --git a/Mage.Sets/src/mage/cards/p/ProteanThaumaturge.java b/Mage.Sets/src/mage/cards/p/ProteanThaumaturge.java new file mode 100644 index 00000000000..d8ecd23dac0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/ProteanThaumaturge.java @@ -0,0 +1,78 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.abilityword.ConstellationAbility; +import mage.abilities.effects.common.CopyPermanentEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.util.functions.ApplyToPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ProteanThaumaturge extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("another target creature"); + + static { + filter.add(AnotherPredicate.instance); + } + + public ProteanThaumaturge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Constellation — Whenever an enchantment enters the battlefield under your control, you may have Protean Thaumaturge become a copy of another target creature, except it has this ability. + this.addAbility(createAbility()); + } + + private ProteanThaumaturge(final ProteanThaumaturge card) { + super(card); + } + + @Override + public ProteanThaumaturge copy() { + return new ProteanThaumaturge(this); + } + + static Ability createAbility() { + Ability ability = new ConstellationAbility(new CopyPermanentEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, + new ProteanThaumaturgeApplyToPermanent(), true + ).setText("have {this} become a copy of another target creature, except it has this ability"), true, false); + ability.addTarget(new TargetPermanent(filter)); + return ability; + } +} + +class ProteanThaumaturgeApplyToPermanent extends ApplyToPermanent { + + @Override + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { + mageObject.getAbilities().add(ProteanThaumaturge.createAbility()); + return true; + } + + @Override + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { + permanent.addAbility(ProteanThaumaturge.createAbility(), game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 76806798a26..e3de1f0faca 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -184,6 +184,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Plummet", 194, Rarity.COMMON, mage.cards.p.Plummet.class)); cards.add(new SetCardInfo("Polukranos, Unchained", 224, Rarity.MYTHIC, mage.cards.p.PolukranosUnchained.class)); cards.add(new SetCardInfo("Portent of Betrayal", 149, Rarity.COMMON, mage.cards.p.PortentOfBetrayal.class)); + cards.add(new SetCardInfo("Protean Thaumaturge", 60, Rarity.RARE, mage.cards.p.ProteanThaumaturge.class)); cards.add(new SetCardInfo("Purphoros's Intervention", 151, Rarity.RARE, mage.cards.p.PurphorossIntervention.class)); cards.add(new SetCardInfo("Purphoros, Bronze-Blooded", 150, Rarity.MYTHIC, mage.cards.p.PurphorosBronzeBlooded.class)); cards.add(new SetCardInfo("Rage-Scarred Berserker", 113, Rarity.COMMON, mage.cards.r.RageScarredBerserker.class));