diff --git a/Mage.Sets/src/mage/cards/d/DeepfathomEcho.java b/Mage.Sets/src/mage/cards/d/DeepfathomEcho.java new file mode 100644 index 00000000000..de7b910d583 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DeepfathomEcho.java @@ -0,0 +1,87 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.keyword.ExploreSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.util.functions.EmptyCopyApplier; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class DeepfathomEcho extends CardImpl { + + public DeepfathomEcho(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); + + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.SPIRIT); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // At the beginning of combat on your turn, Deepfathom Echo explores. Then you may have it become a copy of another creature you control until end of turn. + Ability ability = new BeginningOfCombatTriggeredAbility( + new ExploreSourceEffect(false, "{this}"), TargetController.YOU, false + ); + ability.addEffect(new DeepfathomEchoEffect()); + this.addAbility(ability); + } + + private DeepfathomEcho(final DeepfathomEcho card) { + super(card); + } + + @Override + public DeepfathomEcho copy() { + return new DeepfathomEcho(this); + } +} + +class DeepfathomEchoEffect extends OneShotEffect { + + public DeepfathomEchoEffect() { + super(Outcome.Copy); + this.staticText = "Then you may have it become a copy of another creature you control until end of turn"; + } + + private DeepfathomEchoEffect(final DeepfathomEchoEffect effect) { + super(effect); + } + + @Override + public DeepfathomEchoEffect copy() { + return new DeepfathomEchoEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent deepfathom = source.getSourcePermanentIfItStillExists(game); + Player controller = game.getPlayer(source.getControllerId()); + if (deepfathom == null || controller == null) { + return false; + } + + TargetPermanent target = new TargetPermanent( + 0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL, true + ); + controller.chooseTarget(outcome, target, source, game); + Permanent chosenCreature = game.getPermanent(target.getFirstTarget()); + if (chosenCreature == null) { + return false; + } + + game.copyPermanent(Duration.EndOfTurn, chosenCreature, deepfathom.getId(), source, new EmptyCopyApplier()); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java index c69b25750b6..1d33360c39f 100644 --- a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java @@ -57,6 +57,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Council of Echoes", 51, Rarity.UNCOMMON, mage.cards.c.CouncilOfEchoes.class)); cards.add(new SetCardInfo("Dauntless Dismantler", 8, Rarity.UNCOMMON, mage.cards.d.DauntlessDismantler.class)); cards.add(new SetCardInfo("Deep-Cavern Bat", 102, Rarity.UNCOMMON, mage.cards.d.DeepCavernBat.class)); + cards.add(new SetCardInfo("Deepfathom Echo", 228, Rarity.RARE, mage.cards.d.DeepfathomEcho.class)); cards.add(new SetCardInfo("Deeproot Pilgrimage", 52, Rarity.RARE, mage.cards.d.DeeprootPilgrimage.class)); cards.add(new SetCardInfo("Defossilize", 103, Rarity.UNCOMMON, mage.cards.d.Defossilize.class)); cards.add(new SetCardInfo("Diamond Pick-Axe", 143, Rarity.UNCOMMON, mage.cards.d.DiamondPickAxe.class));