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

@ -41,6 +41,8 @@ public class Plane implements CommandObject {
private UUID id;
private UUID controllerId;
private MageObject sourceObject;
private boolean copy;
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
private FrameStyle frameStyle;
private Abilities<Ability> abilites = new AbilitiesImpl<>();
private String expansionSetCodeForImage = "";
@ -56,6 +58,8 @@ public class Plane implements CommandObject {
this.frameStyle = plane.frameStyle;
this.controllerId = plane.controllerId;
this.sourceObject = plane.sourceObject;
this.copy = plane.copy;
this.copyFrom = (plane.copyFrom != null ? plane.copyFrom.copy() : null);
this.abilites = plane.abilites.copy();
this.expansionSetCodeForImage = plane.expansionSetCodeForImage;
}
@ -105,6 +109,22 @@ public class Plane implements CommandObject {
this.abilites.setControllerId(controllerId);
}
@Override
public void setCopy(boolean isCopy, MageObject copyFrom) {
this.copy = isCopy;
this.copyFrom = (copyFrom != null ? copyFrom.copy() : null);
}
@Override
public boolean isCopy() {
return this.copy;
}
@Override
public MageObject getCopyFrom() {
return this.copyFrom;
}
@Override
public String getName() {
return name;
@ -208,15 +228,6 @@ public class Plane implements CommandObject {
return this.id;
}
@Override
public void setCopy(boolean isCopy) {
}
@Override
public boolean isCopy() {
return false;
}
@Override
public Plane copy() {
return new Plane(this);