@Override public PermanentCard copy() { return new PermanentCard(this); }
@Override public void init(Ability source, Game game) { super.init(source, game); if (!(copyFromObject instanceof Permanent) && (copyFromObject instanceof Card)) { this.copyFromObject = new PermanentCard((Card) copyFromObject, source.getControllerId(), game); } Permanent permanent = game.getPermanent(copyToObjectId); if (permanent != null) { affectedObjectList.add(new MageObjectReference(permanent, game)); } else if (source.getAbilityType() == AbilityType.STATIC) { // for replacement effects that let a permanent enter the battlefield as a copy of another permanent we need to apply that copy // before the permanent is added to the battlefield permanent = game.getPermanentEntering(copyToObjectId); if (permanent != null) { copyToPermanent(permanent, game, source); // set reference to the permanent later on the battlefield so we have to add already one (if no token) to the zone change counter int ZCCDiff = 1; if (permanent instanceof PermanentToken) { ZCCDiff = 0; } affectedObjectList.add(new MageObjectReference(permanent.getId(), game.getState().getZoneChangeCounter(copyToObjectId) + ZCCDiff, game)); } } }
permanent = new PermanentCard(card, event.getPlayerId(), game);
permanentCard.setZone(Zone.BATTLEFIELD, this); permanentCard.setOwnerId(ownerId); PermanentCard newPermanent = new PermanentCard(permanentCard.getCard(), ownerId, this); getPermanentsEntering().put(newPermanent.getId(), newPermanent); newPermanent.entersBattlefield(newPermanent.getId(), this, Zone.OUTSIDE, false);
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent lazavTheMultifarious = game.getPermanent(source.getSourceId()); Permanent newBluePrint = null; if (controller != null && lazavTheMultifarious != null) { Card copyFromCard = game.getCard(source.getFirstTarget()); if (copyFromCard != null) { newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); ApplyToPermanent applier = new LazavTheMultifariousApplier(); applier.apply(game, newBluePrint, source, lazavTheMultifarious.getId()); CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavTheMultifarious.getId()); copyEffect.newId(); copyEffect.setApplier(applier); Ability newAbility = source.copy(); copyEffect.init(newAbility, game); game.addEffect(copyEffect, newAbility); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent lazavDimirMastermind = game.getPermanent(source.getSourceId()); Permanent newBluePrint = null; if (controller != null && lazavDimirMastermind != null) { Card copyFromCard = game.getCard(((FixedTarget) getTargetPointer()).getTarget()); if (copyFromCard != null) { newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); ApplyToPermanent applier = new LazavDimirMastermindApplier(); applier.apply(game, newBluePrint, source, lazavDimirMastermind.getId()); CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavDimirMastermind.getId()); copyEffect.newId(); copyEffect.setApplier(applier); Ability newAbility = source.copy(); copyEffect.init(newAbility, game); game.addEffect(copyEffect, newAbility); } return true; } return false; } }
if (!permanent.getId().equals(sourceObject.getId())) { Permanent newBluePrint = null; newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, newBluePrint, permanent.getId());
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent dimirDoppelganger = game.getPermanent(source.getSourceId()); Permanent newBluePrint = null; if (controller != null && dimirDoppelganger != null) { Card copyFromCard = game.getCard(source.getFirstTarget()); if (copyFromCard != null) { Cards cardsToExile = new CardsImpl(); cardsToExile.add(copyFromCard); controller.moveCards(cardsToExile, Zone.EXILED, source, game); newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); ApplyToPermanent applier = new DimirDoppelgangerApplier(); applier.apply(game, newBluePrint, source, dimirDoppelganger.getId()); CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, dimirDoppelganger.getId()); copyEffect.newId(); copyEffect.setApplier(applier); Ability newAbility = source.copy(); copyEffect.init(newAbility, game); game.addEffect(copyEffect, newAbility); } return true; } return false; } }
if (targetCard != null || targetPermanent != null || targetPlayer != null) { card.removeFromZone(game, fromZone, sourceId); PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game); ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD); permanent.updateZoneChangeCounter(game, zoneChangeEvent);