forked from External/mage
Tokens and command objects reworked (part 2 of 2, tokens/emblems)
This commit is contained in:
parent
5f55c7c667
commit
f2d93f224f
591 changed files with 1368 additions and 4425 deletions
|
|
@ -2,6 +2,7 @@ package mage.designations;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectImpl;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
|
|
@ -23,59 +24,44 @@ import java.util.*;
|
|||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public abstract class Designation implements MageObject {
|
||||
public abstract class Designation extends MageObjectImpl {
|
||||
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCostsImpl emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private String name;
|
||||
private final DesignationType designationType;
|
||||
private UUID id;
|
||||
private final FrameStyle frameStyle;
|
||||
private final boolean unique; // can a designation be added multiple times (false) or only once to an object (true)
|
||||
|
||||
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)
|
||||
|
||||
public Designation(DesignationType designationType, String expansionSetCode) {
|
||||
this(designationType, expansionSetCode, true);
|
||||
public Designation(DesignationType designationType) {
|
||||
this(designationType, true);
|
||||
}
|
||||
|
||||
public Designation(DesignationType designationType, String expansionSetCode, boolean unique) {
|
||||
this.name = designationType.toString();
|
||||
public Designation(DesignationType designationType, boolean unique) {
|
||||
super(UUID.randomUUID());
|
||||
this.designationType = designationType;
|
||||
this.id = UUID.randomUUID();
|
||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||
this.expansionSetCodeForImage = expansionSetCode;
|
||||
this.unique = unique;
|
||||
this.name = designationType.toString();
|
||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||
}
|
||||
|
||||
public Designation(final Designation designation) {
|
||||
this.name = designation.name;
|
||||
super(designation);
|
||||
this.designationType = designation.designationType;
|
||||
this.id = designation.id;
|
||||
this.unique = designation.unique;
|
||||
this.frameStyle = designation.frameStyle;
|
||||
this.copy = designation.copy;
|
||||
this.copyFrom = (designation.copyFrom != null ? designation.copyFrom.copy() : null);
|
||||
this.abilites = designation.abilites.copy();
|
||||
this.expansionSetCodeForImage = designation.expansionSetCodeForImage;
|
||||
this.unique = designation.unique;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract Designation copy();
|
||||
|
||||
@Override
|
||||
public FrameStyle getFrameStyle() {
|
||||
return frameStyle;
|
||||
}
|
||||
|
||||
public void assignNewId() {
|
||||
this.id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy, MageObject copyFrom) {
|
||||
this.copy = isCopy;
|
||||
|
|
@ -92,64 +78,21 @@ public abstract class Designation implements MageObject {
|
|||
return this.copyFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdName() {
|
||||
return getName() + " [" + getId().toString().substring(0, 3) + ']';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void addAbility(Ability ability) {
|
||||
ability.setSourceId(id);
|
||||
ability.setSourceId(this.objectId);
|
||||
abilites.add(ability);
|
||||
abilites.addAll(ability.getSubAbilities());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities() {
|
||||
return abilites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectColor getFrameColor(Game game) {
|
||||
return emptyColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public DesignationType getDesignationType() {
|
||||
return designationType;
|
||||
}
|
||||
|
||||
public void setExpansionSetCodeForImage(String expansionSetCodeForImage) {
|
||||
this.expansionSetCodeForImage = expansionSetCodeForImage;
|
||||
}
|
||||
|
||||
public String getExpansionSetCodeForImage() {
|
||||
return expansionSetCodeForImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return GameLog.getColoredObjectIdName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptyList;
|
||||
|
|
@ -210,24 +153,6 @@ public abstract class Designation implements MageObject {
|
|||
return MageInt.EmptyMageInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingLoyalty() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartingLoyalty(int startingLoyalty) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingDefense() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartingDefense(int startingDefense) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZoneChangeCounter(Game game) {
|
||||
return 1; // Emblems can't move zones until now so return always 1
|
||||
|
|
@ -247,14 +172,6 @@ public abstract class Designation implements MageObject {
|
|||
public void removePTCDA() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param game
|
||||
* @param controllerId
|
||||
*/
|
||||
public void start(Game game, UUID controllerId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllCreatureTypes(Game game) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue