From ec6cb4919f692f3f11205719992ce9f0ace49cba Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 2 Jul 2021 09:09:30 -0400 Subject: [PATCH] [AFR] Implemented Eccentric Apprentice --- .../src/mage/cards/e/EccentricApprentice.java | 107 ++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + .../src/main/java/mage/constants/SubType.java | 1 + 3 files changed, 109 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EccentricApprentice.java diff --git a/Mage.Sets/src/mage/cards/e/EccentricApprentice.java b/Mage.Sets/src/mage/cards/e/EccentricApprentice.java new file mode 100644 index 00000000000..79bf35ddfeb --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EccentricApprentice.java @@ -0,0 +1,107 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.CompletedDungeonCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.keyword.VentureIntoTheDungeonEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.CompletedDungeonWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EccentricApprentice extends CardImpl { + + public EccentricApprentice(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.subtype.add(SubType.TIEFLING); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Eccentric Apprentice enters the battlefield, venture into the dungeon. + this.addAbility(new EntersBattlefieldTriggeredAbility(new VentureIntoTheDungeonEffect())); + + // At the beginning of combat on your turn, if you've completed a dungeon, up to one target creature becomes a Bird with base power and toughness 1/1 and flying until end of turn. + Ability ability = new ConditionalInterveningIfTriggeredAbility( + new BeginningOfCombatTriggeredAbility( + new EccentricApprenticeEffect(), TargetController.YOU, false + ), CompletedDungeonCondition.instance, "At the beginning of combat on your turn, " + + "if you've completed a dungeon, up to one target creature becomes a Bird " + + "with base power and toughness 1/1 and flying until end of turn." + ).addHint(CompletedDungeonCondition.getHint()); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + this.addAbility(ability, new CompletedDungeonWatcher()); + } + + private EccentricApprentice(final EccentricApprentice card) { + super(card); + } + + @Override + public EccentricApprentice copy() { + return new EccentricApprentice(this); + } +} + +class EccentricApprenticeEffect extends ContinuousEffectImpl { + + EccentricApprenticeEffect() { + super(Duration.EndOfTurn, Outcome.Benefit); + } + + private EccentricApprenticeEffect(final EccentricApprenticeEffect effect) { + super(effect); + } + + @Override + public EccentricApprenticeEffect copy() { + return new EccentricApprenticeEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + discard(); + return false; + } + switch (layer) { + case TypeChangingEffects_4: + permanent.removeAllCreatureTypes(game); + permanent.removeSubType(game, SubType.BIRD); + return true; + case AbilityAddingRemovingEffects_6: + permanent.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game); + return true; + case PTChangingEffects_7: + if (sublayer == SubLayer.ModifyPT_7c) { + permanent.getPower().setValue(1); + permanent.getToughness().setValue(1); + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 2ae782062f5..8d98450ec18 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -59,6 +59,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Dungeon Map", 242, Rarity.UNCOMMON, mage.cards.d.DungeonMap.class)); cards.add(new SetCardInfo("Dwarfhold Champion", 14, Rarity.COMMON, mage.cards.d.DwarfholdChampion.class)); cards.add(new SetCardInfo("Ebondeath, Dracolich", 100, Rarity.MYTHIC, mage.cards.e.EbondeathDracolich.class)); + cards.add(new SetCardInfo("Eccentric Apprentice", 57, Rarity.UNCOMMON, mage.cards.e.EccentricApprentice.class)); cards.add(new SetCardInfo("Ellywick Tumblestrum", 181, Rarity.MYTHIC, mage.cards.e.EllywickTumblestrum.class)); cards.add(new SetCardInfo("Elturgard Ranger", 182, Rarity.COMMON, mage.cards.e.ElturgardRanger.class)); cards.add(new SetCardInfo("Evolving Wilds", 256, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 7f2bcea94e3..dc9b1795586 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -352,6 +352,7 @@ public enum SubType { TETRAVITE("Tetravite", SubTypeSet.CreatureType), THALAKOS("Thalakos", SubTypeSet.CreatureType), THOPTER("Thopter", SubTypeSet.CreatureType), + TIEFLING("Tiefling", SubTypeSet.CreatureType), TRANDOSHAN("Trandoshan", SubTypeSet.CreatureType, true), // Star Wars THRULL("Thrull", SubTypeSet.CreatureType), TREEFOLK("Treefolk", SubTypeSet.CreatureType),