[MOM] Implement Elesh Norn

This commit is contained in:
theelk801 2023-04-14 18:23:20 -04:00
parent a8ff9b48ec
commit dd91a58c85
19 changed files with 382 additions and 246 deletions

View file

@ -1,22 +1,16 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PayEnergyCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
@ -37,7 +31,9 @@ public final class AethergeodeMiner extends CardImpl {
this.addAbility(new AttacksTriggeredAbility(new GetEnergyCountersControllerEffect(2), false));
// Pay {E}{E}: Exile Aethergeode Miner, then return it to the battlefield under its owner's control.
this.addAbility(new SimpleActivatedAbility(new AethergeodeMinerEffect(), new PayEnergyCost(2)));
this.addAbility(new SimpleActivatedAbility(
new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD), new PayEnergyCost(2)
));
}
private AethergeodeMiner(final AethergeodeMiner card) {
@ -49,33 +45,3 @@ public final class AethergeodeMiner extends CardImpl {
return new AethergeodeMiner(this);
}
}
class AethergeodeMinerEffect extends OneShotEffect {
AethergeodeMinerEffect() {
super(Outcome.Neutral);
this.staticText = "exile {this}, then return it to the battlefield under its owner's control";
}
private AethergeodeMinerEffect(final AethergeodeMinerEffect effect) {
super(effect);
}
@Override
public AethergeodeMinerEffect copy() {
return new AethergeodeMinerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (player == null || permanent == null) {
return false;
}
Card card = permanent.getMainCard();
player.moveCards(permanent, Zone.EXILED, source, game);
player.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
return true;
}
}

View file

@ -12,15 +12,12 @@ import mage.abilities.condition.common.SourceDealtDamageCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetPlayerOrPlaneswalker;
@ -53,7 +50,7 @@ public final class ChandraFireOfKaladesh extends CardImpl {
// {T}: Chandra, Fire of Kaladesh deals 1 damage to target player. If Chandra has dealt 3 or more damage this turn, exile her, then return her to the battlefield transformed under her owner's control.
this.addAbility(new TransformAbility());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addEffect(new ConditionalOneShotEffect(new ExileAndReturnTransformedSourceEffect(Pronoun.SHE), new SourceDealtDamageCondition(3)));
ability.addEffect(new ConditionalOneShotEffect(new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED,Pronoun.SHE), new SourceDealtDamageCondition(3)));
ability.addTarget(new TargetPlayerOrPlaneswalker());
this.addAbility(ability);

View file

@ -5,12 +5,13 @@ import mage.abilities.Pronoun;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.CrewAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType;
import java.util.UUID;
@ -32,10 +33,13 @@ public final class ConquerorsGalleon extends CardImpl {
// When Conqueror's Galleon attacks, exile it at the end of combat, then return it to the battlefield transformed under your control.
this.addAbility(new TransformAbility());
this.addAbility(new AttacksTriggeredAbility(
new CreateDelayedTriggeredAbilityEffect(
new AtTheEndOfCombatDelayedTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Pronoun.IT, null, true))),
false,
"When {this} attacks, exile it at the end of combat, then return it to the battlefield transformed under your control."));
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(
new ExileAndReturnSourceEffect(
PutCards.BATTLEFIELD_TRANSFORMED, Pronoun.IT, true
)
)), false, "When {this} attacks, exile it at the end of combat, " +
"then return it to the battlefield transformed under your control."
));
// Crew 4
this.addAbility(new CrewAbility(4));

View file

@ -0,0 +1,139 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EleshNorn extends CardImpl {
public EleshNorn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.PRAETOR);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
this.secondSideCardClazz = mage.cards.t.TheArgentEtchings.class;
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// Whenever a source an opponent controls deals damage to you or a permanent you control, that source's controller loses 2 life unless they pay {1}.
this.addAbility(new EleshNornTriggeredAbility());
// {2}{W}, Sacrifice three other creatures: Exile Elesh Norn, then return it to the battlefield transformed under its owner's control. Activate only as a sorcery.
this.addAbility(new TransformAbility());
Ability ability = new ActivateAsSorceryActivatedAbility(
new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED),
new ManaCostsImpl<>("{2}{W}")
);
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)));
this.addAbility(ability);
}
private EleshNorn(final EleshNorn card) {
super(card);
}
@Override
public EleshNorn copy() {
return new EleshNorn(this);
}
}
class EleshNornTriggeredAbility extends TriggeredAbilityImpl {
EleshNornTriggeredAbility() {
super(Zone.BATTLEFIELD, new EleshNornEffect());
}
private EleshNornTriggeredAbility(final EleshNornTriggeredAbility ability) {
super(ability);
}
@Override
public EleshNornTriggeredAbility copy() {
return new EleshNornTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGED_PLAYER:
case DAMAGE_PERMANENT:
return true;
}
return false;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!game.getOpponents(getControllerId()).contains(game.getControllerId(event.getSourceId()))) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(game.getControllerId(event.getSourceId())));
switch (event.getType()) {
case DAMAGED_PLAYER:
return isControlledBy(event.getTargetId());
case DAMAGE_PERMANENT:
return isControlledBy(game.getControllerId(event.getTargetId()));
}
return false;
}
@Override
public String getRule() {
return "Whenever a source an opponent controls deals damage to you or a permanent you control, " +
"that source's controller loses 2 life unless they pay {1}.";
}
}
class EleshNornEffect extends OneShotEffect {
EleshNornEffect() {
super(Outcome.Benefit);
}
private EleshNornEffect(final EleshNornEffect effect) {
super(effect);
}
@Override
public EleshNornEffect copy() {
return new EleshNornEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
Cost cost = new GenericManaCost(1);
if (player != null && cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.PreventDamage, "Pay {1}?", source, game) && cost.pay(source, game, source, player.getId(), false)) {
return false;
}
return player.loseLife(2, game, source, false) > 0;
}
}

View file

@ -1,21 +1,15 @@
package mage.cards.f;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
@ -34,7 +28,9 @@ public final class FlickeringSpirit extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// {3}{W}: Exile Flickering Spirit, then return it to the battlefield under its owner's control.
this.addAbility(new SimpleActivatedAbility(new FlickeringSpiritEffect(), new ManaCostsImpl<>("{3}{W}")));
this.addAbility(new SimpleActivatedAbility(
new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD), new ManaCostsImpl<>("{3}{W}")
));
}
private FlickeringSpirit(final FlickeringSpirit card) {
@ -46,37 +42,3 @@ public final class FlickeringSpirit extends CardImpl {
return new FlickeringSpirit(this);
}
}
class FlickeringSpiritEffect extends OneShotEffect {
FlickeringSpiritEffect() {
super(Outcome.Neutral);
this.staticText = "Exile {this}, then return it to the battlefield under its owner's control";
}
private FlickeringSpiritEffect(final FlickeringSpiritEffect effect) {
super(effect);
}
@Override
public FlickeringSpiritEffect copy() {
return new FlickeringSpiritEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null
|| player == null) {
return false;
}
if (player.moveCards(permanent, Zone.EXILED, source, game)) {
Card card = game.getExile().getCard(source.getSourceId(), game);
if (card != null) {
return player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
return false;
}
}

View file

@ -11,14 +11,11 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
/**
*
@ -39,7 +36,7 @@ public final class JaceVrynsProdigy extends CardImpl {
// {T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn's Prodigy, then return him to the battefield transformed under his owner's control.
this.addAbility(new TransformAbility());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(1, 1), new TapSourceCost());
Effect effect = new ConditionalOneShotEffect(new ExileAndReturnTransformedSourceEffect(Pronoun.HE), new CardsInControllerGraveyardCondition(5));
Effect effect = new ConditionalOneShotEffect(new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED,Pronoun.HE), new CardsInControllerGraveyardCondition(5));
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -1,13 +1,12 @@
package mage.cards.j;
import mage.MageInt;
import mage.abilities.Pronoun;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.keyword.WardAbility;
import mage.cards.CardImpl;
@ -50,7 +49,7 @@ public class JinGitaxias extends CardImpl {
//only as a sorcery and only if you have seven or more cards in hand.
this.addAbility(new TransformAbility());
ConditionalActivatedAbility conditionalActivatedAbility =
new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ExileAndReturnTransformedSourceEffect(Pronoun.IT),
new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED),
new ManaCostsImpl<>("{3}{U}"), new CardsInHandCondition(ComparisonType.MORE_THAN, 6));
conditionalActivatedAbility.setTiming(TimingRule.SORCERY);
this.addAbility(conditionalActivatedAbility);

View file

@ -12,17 +12,13 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedOrBlockedThisCombatWatcher;
@ -45,7 +41,7 @@ public final class KytheonHeroOfAkros extends CardImpl {
// At end of combat, if Kytheon, Hero of Akros and at least two other creatures attacked this combat, exile Kytheon,
// then return him to the battlefield transformed under his owner's control.
this.addAbility(new TransformAbility());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EndOfCombatTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Pronoun.HE), false),
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EndOfCombatTriggeredAbility(new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED,Pronoun.HE), false),
new KytheonHeroOfAkrosCondition(), "At end of combat, if {this} and at least two other creatures attacked this combat, exile {this}, "
+ "then return him to the battlefield transformed under his owner's control."), new AttackedOrBlockedThisCombatWatcher());

View file

@ -1,27 +1,23 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Pronoun;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.permanent.token.ZombieToken;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class LilianaHereticalHealer extends CardImpl {
@ -35,7 +31,7 @@ public final class LilianaHereticalHealer extends CardImpl {
}
public LilianaHereticalHealer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC);
@ -49,8 +45,9 @@ public final class LilianaHereticalHealer extends CardImpl {
this.addAbility(LifelinkAbility.getInstance());
// Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, create a 2/2 black Zombie creature token.
this.addAbility(new DiesCreatureTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Pronoun.SHE,
new CreateTokenEffect(new ZombieToken())), false, filter));
this.addAbility(new DiesCreatureTriggeredAbility(new ExileAndReturnSourceEffect(
PutCards.BATTLEFIELD_TRANSFORMED, Pronoun.SHE, false, new CreateTokenEffect(new ZombieToken())
), false, filter));
}
private LilianaHereticalHealer(final LilianaHereticalHealer card) {

View file

@ -7,17 +7,13 @@ import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.*;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
/**
*
@ -46,7 +42,7 @@ public final class NicolBolasTheRavager extends CardImpl {
this.addAbility(new TransformAbility());
this.addAbility(new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD,
new ExileAndReturnTransformedSourceEffect(Pronoun.HE),
new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED,Pronoun.HE),
new ManaCostsImpl<>("{4}{U}{B}{R}")
));
}

View file

@ -8,15 +8,12 @@ import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterLandPermanent;
import mage.target.common.TargetCardInLibrary;
@ -49,7 +46,7 @@ public final class NissaVastwoodSeer extends CardImpl {
// Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control.
this.addAbility(new TransformAbility());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldControlledTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Pronoun.SHE), new FilterLandPermanent()),
new EntersBattlefieldControlledTriggeredAbility(new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TRANSFORMED,Pronoun.SHE), new FilterLandPermanent()),
new PermanentsOnTheBattlefieldCondition(new FilterLandPermanent(), ComparisonType.MORE_THAN, 6, true),
"Whenever a land enters the battlefield under your control, if you control seven or more lands, exile {this}, then return her to the battlefield transformed under her owner's control."));
}

View file

@ -4,19 +4,18 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileAndReturnSourceEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.PutCards;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
@ -49,7 +48,7 @@ public final class OjutaiExemplars extends CardImpl {
ability.addMode(mode);
// or Exile Ojutai Exemplars, then return it to the battlefield tapped under its owner's control.
ability.addMode(new Mode(new OjutaiExemplarsEffect()));
ability.addMode(new Mode(new ExileAndReturnSourceEffect(PutCards.BATTLEFIELD_TAPPED)));
this.addAbility(ability);
}
@ -63,33 +62,3 @@ public final class OjutaiExemplars extends CardImpl {
return new OjutaiExemplars(this);
}
}
class OjutaiExemplarsEffect extends OneShotEffect {
OjutaiExemplarsEffect() {
super(Outcome.Neutral);
this.staticText = "Exile {this}, then return it to the battlefield tapped under its owner's control";
}
private OjutaiExemplarsEffect(final OjutaiExemplarsEffect effect) {
super(effect);
}
@Override
public OjutaiExemplarsEffect copy() {
return new OjutaiExemplarsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (player == null || permanent == null) {
return false;
}
Card card = permanent.getMainCard();
player.moveCards(permanent, Zone.EXILED, source, game);
player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, true, null);
return true;
}
}

View file

@ -0,0 +1,118 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.ExileSourceAndReturnFaceUpEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.keyword.IncubateEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TheArgentEtchings extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("other permanents except for artifacts, lands, and Phyrexians");
static {
filter.add(Predicates.not(CardType.ARTIFACT.getPredicate()));
filter.add(Predicates.not(CardType.LAND.getPredicate()));
filter.add(Predicates.not(SubType.PHYREXIAN.getPredicate()));
filter.add(AnotherPredicate.instance);
}
public TheArgentEtchings(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "");
this.subtype.add(SubType.SAGA);
this.color.setWhite(true);
this.nightCard = true;
// (As this Saga enters and after your draw step, add a lore counter.)
SagaAbility sagaAbility = new SagaAbility(this, false);
// I -- Incubate 2 five times, then transform all Incubator tokens you control.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new TheArgentEtchingsEffect());
// II -- Creatures you control get +1/+1 and gain double strike until end of turn.
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_II,
new BoostControlledEffect(1, 1, Duration.EndOfTurn)
.setText("creatures you control get +1/+1"),
new GainAbilityControlledEffect(
DoubleStrikeAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURE
).setText("and gain double strike until end of turn")
);
// III -- Destroy all other permanents except for artifacts, lands, and Phyrexians. Exile The Argent Etchings, then return it to the battlefield.
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_III,
new DestroyAllEffect(filter),
new ExileSourceAndReturnFaceUpEffect()
);
this.addAbility(sagaAbility);
}
private TheArgentEtchings(final TheArgentEtchings card) {
super(card);
}
@Override
public TheArgentEtchings copy() {
return new TheArgentEtchings(this);
}
}
class TheArgentEtchingsEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.INCUBATOR);
static {
filter.add(TokenPredicate.TRUE);
}
TheArgentEtchingsEffect() {
super(Outcome.Benefit);
staticText = "incubate 2 five times, then transform all Incubator tokens you control";
}
private TheArgentEtchingsEffect(final TheArgentEtchingsEffect effect) {
super(effect);
}
@Override
public TheArgentEtchingsEffect copy() {
return new TheArgentEtchingsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (int i = 0; i < 5; i++) {
IncubateEffect.doIncubate(2, game, source);
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source, game
)) {
permanent.transform(source, game);
}
return true;
}
}

View file

@ -4,16 +4,16 @@ import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ExileSagaAndReturnTransformedEffect;
import mage.abilities.effects.common.ExileSourceAndReturnFaceUpEffect;
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
@ -52,8 +52,11 @@ public class TheGreatSynthesis extends CardImpl {
//III You may cast any number of spells from your hand without paying their mana cost. Exile The Great
//Synthesis, then return it to the battlefield <i>(front face up)</i>.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new TheGreatSynthesisCastEffect(),
new TheGreatSynthesisExileReturnEffect());
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_III,
new TheGreatSynthesisCastEffect(),
new ExileSourceAndReturnFaceUpEffect()
);
this.addAbility(sagaAbility);
}
@ -94,41 +97,3 @@ class TheGreatSynthesisCastEffect extends OneShotEffect {
return true;
}
}
class TheGreatSynthesisExileReturnEffect extends OneShotEffect {
public TheGreatSynthesisExileReturnEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "exile {this}, then return it to the battlefield <i>(front face up)</i>";
}
private TheGreatSynthesisExileReturnEffect(final TheGreatSynthesisExileReturnEffect effect) {
super(effect);
}
@Override
public TheGreatSynthesisExileReturnEffect copy() {
return new TheGreatSynthesisExileReturnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getState().getZone(source.getSourceId()) != Zone.BATTLEFIELD) {
return false;
}
Card card = game.getCard(source.getSourceId());
if (card == null) {
return false;
}
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (!player.moveCards(card, Zone.EXILED, source, game)) {
return false;
}
return player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -88,6 +88,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Doomskar Warrior", 185, Rarity.RARE, mage.cards.d.DoomskarWarrior.class));
cards.add(new SetCardInfo("Dreg Recycler", 100, Rarity.COMMON, mage.cards.d.DregRecycler.class));
cards.add(new SetCardInfo("Dusk Legion Duelist", 11, Rarity.RARE, mage.cards.d.DuskLegionDuelist.class));
cards.add(new SetCardInfo("Elesh Norn", 12, Rarity.MYTHIC, mage.cards.e.EleshNorn.class));
cards.add(new SetCardInfo("Elspeth's Smite", 13, Rarity.UNCOMMON, mage.cards.e.ElspethsSmite.class));
cards.add(new SetCardInfo("Elvish Vatkeeper", 223, Rarity.UNCOMMON, mage.cards.e.ElvishVatkeeper.class));
cards.add(new SetCardInfo("Enduring Bondwarden", 14, Rarity.COMMON, mage.cards.e.EnduringBondwarden.class));
@ -292,6 +293,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Tarkir Duneshaper", 43, Rarity.COMMON, mage.cards.t.TarkirDuneshaper.class));
cards.add(new SetCardInfo("Temporal Cleansing", 80, Rarity.COMMON, mage.cards.t.TemporalCleansing.class));
cards.add(new SetCardInfo("Tenured Oilcaster", 126, Rarity.COMMON, mage.cards.t.TenuredOilcaster.class));
cards.add(new SetCardInfo("The Argent Etchings", 12, Rarity.MYTHIC, mage.cards.t.TheArgentEtchings.class));
cards.add(new SetCardInfo("The Broken Sky", 241, Rarity.RARE, mage.cards.t.TheBrokenSky.class));
cards.add(new SetCardInfo("The Great Synthesis", 65, Rarity.MYTHIC, mage.cards.t.TheGreatSynthesis.class));
cards.add(new SetCardInfo("Thornwood Falls", 274, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class));

View file

@ -6,9 +6,8 @@ import mage.abilities.Pronoun;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -17,18 +16,23 @@ import mage.players.Player;
/**
* @author LevelX2
*/
public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
public class ExileAndReturnSourceEffect extends OneShotEffect {
protected final Pronoun pronoun;
protected final Effect additionalEffect;
protected final boolean returnUnderYourControl;
private final Pronoun pronoun;
private final Effect additionalEffect;
private final boolean returnUnderYourControl;
private final PutCards putCards;
public ExileAndReturnTransformedSourceEffect(Pronoun pronoun) {
this(pronoun, null);
public ExileAndReturnSourceEffect(PutCards putCards) {
this(putCards, Pronoun.IT);
}
public ExileAndReturnTransformedSourceEffect(Pronoun pronoun, Effect additionalEffect) {
this(pronoun, additionalEffect, false);
public ExileAndReturnSourceEffect(PutCards putCards, Pronoun pronoun) {
this(putCards, pronoun, false);
}
public ExileAndReturnSourceEffect(PutCards putCards, Pronoun pronoun, boolean returnUnderYourControl) {
this(putCards, pronoun, returnUnderYourControl, null);
}
/**
@ -36,43 +40,41 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
* @param additionalEffect that effect is applies as source is exiled
* @param returnUnderYourControl return under your or owner control
*/
public ExileAndReturnTransformedSourceEffect(Pronoun pronoun, Effect additionalEffect, boolean returnUnderYourControl) {
public ExileAndReturnSourceEffect(PutCards putCards, Pronoun pronoun, boolean returnUnderYourControl, Effect additionalEffect) {
super(Outcome.Benefit);
this.pronoun = pronoun;
this.putCards = putCards;
this.additionalEffect = additionalEffect;
this.returnUnderYourControl = returnUnderYourControl;
}
protected ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
protected ExileAndReturnSourceEffect(final ExileAndReturnSourceEffect effect) {
super(effect);
this.putCards = effect.putCards;
this.pronoun = effect.pronoun;
this.additionalEffect = effect.additionalEffect;
this.returnUnderYourControl = effect.returnUnderYourControl;
}
@Override
public ExileAndReturnTransformedSourceEffect copy() {
return new ExileAndReturnTransformedSourceEffect(this);
public ExileAndReturnSourceEffect copy() {
return new ExileAndReturnSourceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// Creature has to be on the battlefield to get exiled and be able to return transformed
Permanent sourceObject = source.getSourcePermanentIfItStillExists(game);
Player controller = game.getPlayer(source.getControllerId());
if (sourceObject == null || controller == null) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || controller == null) {
return true;
}
if (!controller.moveCards(sourceObject, Zone.EXILED, source, game)) {
return true;
}
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
Card cardFromExile = game.getCard(source.getSourceId());
if (cardFromExile == null) {
return true;
}
controller.moveCards(cardFromExile, Zone.BATTLEFIELD, source, game, false, false, !this.returnUnderYourControl, null);
if (additionalEffect == null) {
controller.moveCards(permanent, Zone.EXILED, source, game);
putCards.moveCard(
returnUnderYourControl ? controller : game.getPlayer(permanent.getOwnerId()),
permanent.getMainCard(), source, game, "card"
);
if (additionalEffect == null || game.getPermanent(permanent.getId()) == null) {
return true;
}
if (additionalEffect instanceof ContinuousEffect) {
@ -88,8 +90,8 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return "exile {this}, then return " + pronoun.getObjective()
+ " to the battlefield transformed under " + pronoun.getPossessive()
+ ' ' + (this.returnUnderYourControl ? "your" : "owner's") + " control";
return "exile {this}, then return " + pronoun.getObjective() + ' ' +
putCards.getMessage(false, false).replace("onto", "to") + " under " +
(this.returnUnderYourControl ? "your" : pronoun.getPossessive() + ' ' + "owner's") + " control";
}
}

View file

@ -1,14 +1,15 @@
package mage.abilities.effects.common;
import mage.abilities.Pronoun;
import mage.constants.PutCards;
/**
* @author TheElk801
*/
public class ExileSagaAndReturnTransformedEffect extends ExileAndReturnTransformedSourceEffect {
public class ExileSagaAndReturnTransformedEffect extends ExileAndReturnSourceEffect {
public ExileSagaAndReturnTransformedEffect() {
super(Pronoun.IT, null, true);
super(PutCards.BATTLEFIELD_TRANSFORMED, Pronoun.IT, true, null);
staticText = "exile this Saga, then return it to the battlefield transformed under your control";
}

View file

@ -0,0 +1,24 @@
package mage.abilities.effects.common;
import mage.abilities.Pronoun;
import mage.constants.PutCards;
/**
* @author TheElk801
*/
public class ExileSourceAndReturnFaceUpEffect extends ExileAndReturnSourceEffect {
public ExileSourceAndReturnFaceUpEffect() {
super(PutCards.BATTLEFIELD, Pronoun.IT, true, null);
staticText = "exile {this}, then return it to the battlefield. <i>(front face up)</i>";
}
private ExileSourceAndReturnFaceUpEffect(final ExileSourceAndReturnFaceUpEffect effect) {
super(effect);
}
@Override
public ExileSourceAndReturnFaceUpEffect copy() {
return new ExileSourceAndReturnFaceUpEffect(this);
}
}

View file

@ -1,6 +1,7 @@
package mage.constants;
import mage.abilities.Ability;
import mage.abilities.keyword.TransformAbility;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
@ -8,7 +9,6 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author awjackson
*/
@ -17,6 +17,7 @@ public enum PutCards {
GRAVEYARD(Outcome.Discard, Zone.GRAVEYARD, "into your graveyard"),
BATTLEFIELD(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield"),
BATTLEFIELD_TAPPED(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield tapped"),
BATTLEFIELD_TRANSFORMED(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield transformed"),
EXILED(Outcome.Exile, Zone.EXILED, "into exile"), // may need special case code to generate correct text
TOP_OR_BOTTOM(Outcome.Benefit, Zone.LIBRARY, "on the top or bottom of your library"),
TOP_ANY(Outcome.Benefit, Zone.LIBRARY, "on top of your library", " in any order"),
@ -73,6 +74,8 @@ public enum PutCards {
return player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, false);
case BATTLEFIELD_TAPPED:
return player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
case BATTLEFIELD_TRANSFORMED:
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE);
case BATTLEFIELD:
case EXILED:
case HAND:
@ -95,6 +98,8 @@ public enum PutCards {
return player.putCardsOnBottomOfLibrary(cards, game, source, false);
case BATTLEFIELD_TAPPED:
return player.moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
case BATTLEFIELD_TRANSFORMED:
cards.stream().forEach(uuid -> game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + uuid, Boolean.TRUE));
case BATTLEFIELD:
case EXILED:
case HAND: