mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
- Fixed #6177
This commit is contained in:
parent
0c51e622f3
commit
ef64865db0
1 changed files with 12 additions and 6 deletions
|
@ -22,6 +22,10 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.CopyEffect;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
@ -104,16 +108,18 @@ class IdentityThiefEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
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());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null
|
||||
&& permanent != null
|
||||
&& targetPermanent != null
|
||||
&& sourcePermanent != null) {
|
||||
game.copyPermanent(permanent, sourcePermanent.getId(), source, null);
|
||||
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(),
|
||||
source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
|
||||
ContinuousEffect copyEffect = new CopyEffect(Duration.EndOfTurn, targetPermanent.getMainCard(), source.getSourceId());
|
||||
copyEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
|
||||
game.addEffect(copyEffect, source);
|
||||
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.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
|
||||
|
|
Loading…
Reference in a new issue