diff --git a/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java b/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java index 7e1851384b1..60912dd97ba 100644 --- a/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java +++ b/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java @@ -33,14 +33,17 @@ import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.PayEnergyCost; -import mage.abilities.effects.common.ExileSourceEffect; -import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect; +import mage.abilities.effects.OneShotEffect; 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.SubType; import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; /** * @@ -60,9 +63,7 @@ public 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. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(true), new PayEnergyCost(2)); - ability.addEffect(new ReturnToBattlefieldUnderOwnerControlSourceEffect()); - this.addAbility(ability); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AethergeodeMinerEffect(), new PayEnergyCost(2))); } public AethergeodeMiner(final AethergeodeMiner card) { @@ -74,3 +75,34 @@ public class AethergeodeMiner extends CardImpl { return new AethergeodeMiner(this); } } + +class AethergeodeMinerEffect extends OneShotEffect { + + public AethergeodeMinerEffect() { + super(Outcome.Neutral); + this.staticText = "Exile {this}, then return it to the battlefield under its owner's control"; + } + + public AethergeodeMinerEffect(final AethergeodeMinerEffect effect) { + super(effect); + } + + @Override + public AethergeodeMinerEffect copy() { + return new AethergeodeMinerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + if (permanent.moveToExile(source.getSourceId(), "Aethergeode Miner", source.getSourceId(), game)) { + Card card = game.getExile().getCard(source.getSourceId(), game); + if (card != null) { + return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java b/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java index 3a9622f0b9b..442e3078444 100644 --- a/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java +++ b/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java @@ -32,14 +32,17 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.ExileSourceEffect; -import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect; +import mage.abilities.effects.OneShotEffect; 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.SubType; import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; /** * @@ -48,19 +51,17 @@ import mage.constants.Zone; public class FlickeringSpirit extends CardImpl { public FlickeringSpirit(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.SPIRIT); this.power = new MageInt(2); this.toughness = new MageInt(2); // Flying this.addAbility(FlyingAbility.getInstance()); - + // {3}{W}: Exile Flickering Spirit, then return it to the battlefield under its owner's control. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(true), new ManaCostsImpl("{3}{W}")); - ability.addEffect(new ReturnToBattlefieldUnderOwnerControlSourceEffect()); - this.addAbility(ability); - + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new FlickeringSpiritEffect(), new ManaCostsImpl("{3}{W}"))); + } public FlickeringSpirit(final FlickeringSpirit card) { @@ -72,3 +73,34 @@ public class FlickeringSpirit extends CardImpl { return new FlickeringSpirit(this); } } + +class FlickeringSpiritEffect extends OneShotEffect { + + public FlickeringSpiritEffect() { + super(Outcome.Neutral); + this.staticText = "Exile {this}, then return it to the battlefield under its owner's control"; + } + + public FlickeringSpiritEffect(final FlickeringSpiritEffect effect) { + super(effect); + } + + @Override + public FlickeringSpiritEffect copy() { + return new FlickeringSpiritEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + if (permanent.moveToExile(source.getSourceId(), "Flickering Spirit", source.getSourceId(), game)) { + Card card = game.getExile().getCard(source.getSourceId(), game); + if (card != null) { + return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + } + } + } + return false; + } +}