forked from External/mage
Refactor: added copyFrom info for all objects (original card used for copy, copy of copy and etc);
This commit is contained in:
parent
28ac95cb10
commit
59bda7f1d5
25 changed files with 269 additions and 220 deletions
|
|
@ -1,10 +1,7 @@
|
|||
|
||||
package mage.game.command;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
|
|
@ -24,9 +21,15 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Commander implements CommandObject {
|
||||
|
||||
private final Card sourceObject;
|
||||
private boolean copy;
|
||||
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
|
||||
private final Abilities<Ability> abilities = new AbilitiesImpl<>();
|
||||
|
||||
public Commander(Card card) {
|
||||
|
|
@ -40,8 +43,10 @@ public class Commander implements CommandObject {
|
|||
}
|
||||
}
|
||||
|
||||
private Commander(Commander copy) {
|
||||
this.sourceObject = copy.sourceObject;
|
||||
private Commander(final Commander commander) {
|
||||
this.sourceObject = commander.sourceObject;
|
||||
this.copy = commander.copy;
|
||||
this.copyFrom = (commander.copyFrom != null ? commander.copyFrom.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,6 +73,22 @@ public class Commander implements CommandObject {
|
|||
return new Commander(this);
|
||||
}
|
||||
|
||||
@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 sourceObject.getName();
|
||||
|
|
@ -170,15 +191,6 @@ public class Commander implements CommandObject {
|
|||
public void adjustTargets(Ability ability, Game game) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return sourceObject.getId();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package mage.game.command;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -25,6 +22,10 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
|
@ -38,6 +39,8 @@ public class Emblem 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 = "";
|
||||
|
|
@ -52,6 +55,8 @@ public class Emblem implements CommandObject {
|
|||
this.frameStyle = emblem.frameStyle;
|
||||
this.controllerId = emblem.controllerId;
|
||||
this.sourceObject = emblem.sourceObject;
|
||||
this.copy = emblem.copy;
|
||||
this.copyFrom = (emblem.copyFrom != null ? emblem.copyFrom : null);
|
||||
this.abilites = emblem.abilites.copy();
|
||||
this.expansionSetCodeForImage = emblem.expansionSetCodeForImage;
|
||||
}
|
||||
|
|
@ -101,6 +106,22 @@ public class Emblem 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;
|
||||
|
|
@ -204,15 +225,6 @@ public class Emblem implements CommandObject {
|
|||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Emblem copy() {
|
||||
return new Emblem(this);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue