[KHM] Implemented Absorb Identity

This commit is contained in:
Daniel Bomar 2020-12-18 17:10:06 -06:00
parent 384ff2e7ac
commit 34c359a4e8
2 changed files with 81 additions and 0 deletions

View file

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

View file

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