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

@ -1,14 +1,5 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.designations;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
@ -28,8 +19,12 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public abstract class Designation implements MageObject {
@ -43,6 +38,8 @@ public abstract class Designation implements MageObject {
private DesignationType designationType;
private UUID id;
private FrameStyle frameStyle;
private boolean copy;
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
private Abilities<Ability> abilites = new AbilitiesImpl<>();
private String expansionSetCodeForImage;
private final boolean unique; // can a designation be added multiple times (false) or only once to an object (true)
@ -65,6 +62,8 @@ public abstract class Designation implements MageObject {
this.name = designation.name;
this.designationType = designation.designationType;
this.frameStyle = designation.frameStyle;
this.copy = designation.copy;
this.copyFrom = (designation.copyFrom != null ? designation.copyFrom.copy() : null);
this.abilites = designation.abilites.copy();
this.unique = designation.unique;
}
@ -78,6 +77,22 @@ public abstract class Designation implements MageObject {
this.id = UUID.randomUUID();
}
@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;
@ -198,20 +213,6 @@ public abstract class Designation implements MageObject {
public void adjustTargets(Ability ability, Game game) {
}
@Override
public void setCopy(boolean isCopy) {
}
@Override
public boolean isCopy() {
return false;
}
@Override
public Designation copy() {
return this;
}
@Override
public int getZoneChangeCounter(Game game) {
return 1; // Emblems can't move zones until now so return always 1
@ -232,7 +233,6 @@ public abstract class Designation implements MageObject {
}
/**
*
* @param game
* @param controllerId
*/