Refactor: added copyFrom info for all objects (original card used for copy, copy of copy and etc);

This commit is contained in:
Oleg Agafonov 2018-11-29 19:29:39 +04:00
parent 28ac95cb10
commit 59bda7f1d5
25 changed files with 269 additions and 220 deletions

View file

@ -1638,6 +1638,7 @@ public abstract class GameImpl implements Game, Serializable {
if (newBluePrint == null) {
newBluePrint = copyFromPermanent.copy();
newBluePrint.reset(this);
//getState().addCard(permanent);
if (copyFromPermanent.isMorphed() || copyFromPermanent.isManifested()) {
MorphAbility.setPermanentToFaceDownCreature(newBluePrint);
@ -1651,6 +1652,9 @@ public abstract class GameImpl implements Game, Serializable {
applier.apply(this, newBluePrint, source, copyToPermanentId);
}
// save original copy link (handle copy of copies too)
newBluePrint.setCopy(true, (copyFromPermanent.getCopyFrom() != null ? copyFromPermanent.getCopyFrom() : copyFromPermanent));
CopyEffect newEffect = new CopyEffect(duration, newBluePrint, copyToPermanentId);
newEffect.newId();
newEffect.setApplier(applier);