From 34c359a4e8d05d8b8a50d5a7393a6a2d0e2d2bcb Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 18 Dec 2020 17:10:06 -0600 Subject: [PATCH] [KHM] Implemented Absorb Identity --- .../src/mage/cards/a/AbsorbIdentity.java | 80 +++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AbsorbIdentity.java diff --git a/Mage.Sets/src/mage/cards/a/AbsorbIdentity.java b/Mage.Sets/src/mage/cards/a/AbsorbIdentity.java new file mode 100644 index 0000000000..29d7d9c6e0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AbsorbIdentity.java @@ -0,0 +1,80 @@ +package mage.cards.a; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.util.functions.EmptyApplyToPermanent; + +/** + * + * @author weirddan455 + */ +public final class AbsorbIdentity extends CardImpl { + + public AbsorbIdentity(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); + + // Return target creature to its owner's hand. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + // You may have Shapeshifters you control become copies of that creature until end of turn. + this.getSpellAbility().addEffect(new AbsorbIdentityEffect()); + } + + private AbsorbIdentity(final AbsorbIdentity card) { + super(card); + } + + @Override + public AbsorbIdentity copy() { + return new AbsorbIdentity(this); + } +} + +class AbsorbIdentityEffect extends OneShotEffect { + + public AbsorbIdentityEffect() { + super(Outcome.Copy); + this.staticText = "You may have Shapeshifters you control become copies of that creature until end of turn."; + } + + public AbsorbIdentityEffect(final AbsorbIdentityEffect effect) { + super(effect); + } + + @Override + public AbsorbIdentityEffect copy() { + return new AbsorbIdentityEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent copyFrom = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); + if (controller == null || copyFrom == null) { + return false; + } + if (controller.chooseUse(outcome, "Have Shapeshifters you control become copies of " + + copyFrom.getLogName() + " until end of turn?", source, game)) { + FilterCreaturePermanent filter = new FilterCreaturePermanent("shapeshifter"); + filter.add(SubType.SHAPESHIFTER.getPredicate()); + for (Permanent copyTo : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) { + game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyApplyToPermanent()); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 29f41c59f8..50ef4e974d 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -28,6 +28,7 @@ public final class Kaldheim extends ExpansionSet { this.numBoosterDoubleFaced = 1; this.maxCardNumberInBooster = 285; + cards.add(new SetCardInfo("Absorb Identity", 383, Rarity.UNCOMMON, mage.cards.a.AbsorbIdentity.class)); cards.add(new SetCardInfo("Barkchannel Pathway", 251, Rarity.RARE, mage.cards.b.BarkchannelPathway.class)); cards.add(new SetCardInfo("Blightstep Pathway", 252, Rarity.RARE, mage.cards.b.BlightstepPathway.class)); cards.add(new SetCardInfo("Canopy Tactician", 378, Rarity.RARE, mage.cards.c.CanopyTactician.class));