This commit is contained in:
jeffwadsworth 2020-01-13 15:58:08 -06:00
parent 0c51e622f3
commit ef64865db0

View file

@ -22,6 +22,10 @@ import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.util.CardUtil;
/** /**
* @author spjspj * @author spjspj
@ -104,16 +108,18 @@ class IdentityThiefEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); Permanent targetPermanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null if (controller != null
&& permanent != null && targetPermanent != null
&& sourcePermanent != null) { && sourcePermanent != null) {
game.copyPermanent(permanent, sourcePermanent.getId(), source, null); ContinuousEffect copyEffect = new CopyEffect(Duration.EndOfTurn, targetPermanent.getMainCard(), source.getSourceId());
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), copyEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
source.getSourceId(), game, Zone.BATTLEFIELD, true)) { game.addEffect(copyEffect, source);
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(); UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (controller.moveCardsToExile(targetPermanent, source, game, true, exileZoneId, sourcePermanent.getName())) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true);
effect.setText("Return the exiled card to the battlefield under its owner's control at the beginning of the next end step"); effect.setText("Return the exiled card to the battlefield under its owner's control at the beginning of the next end step");
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source); game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);