[AFR] Implemented Eccentric Apprentice

This commit is contained in:
Evan Kranzler 2021-07-02 09:09:30 -04:00
parent 4b8a419d28
commit ec6cb4919f
3 changed files with 109 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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),