Merge pull request #7255 from weirddan455/absorb-identity

[KHM] Implemented Absorb Identity
This commit is contained in:
Oleg Agafonov 2020-12-19 06:38:38 +01:00 committed by GitHub
commit 9532eb2802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,82 @@
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().addEffect(new ReturnToHandTargetEffect());
// You may have Shapeshifters you control become copies of that creature until end of turn.
this.getSpellAbility().addEffect(new AbsorbIdentityEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
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("Bearded Axe", 388, Rarity.UNCOMMON, mage.cards.b.BeardedAxe.class));
cards.add(new SetCardInfo("Blightstep Pathway", 252, Rarity.RARE, mage.cards.b.BlightstepPathway.class));