Tokens and command objects reworked (part 1 of 2):

- fixed that copy effect doesn't restore original image after effect's end;
 - removed outdated availableImageSetCodes (all images auto-selected from tokens database now, related to #10139);
 - refactor command objects to use CommandObjectImpl;
 - refactor planes/emblems/etc objects to use MageObjectImpl, added copyable support;
 - refactor another game objects to remove some duplicated fields;
This commit is contained in:
Oleg Agafonov 2023-05-08 02:15:07 +04:00
parent 46f6593da8
commit 5f55c7c667
45 changed files with 517 additions and 477 deletions

View file

@ -398,7 +398,7 @@ public interface Game extends MageItem, Serializable, Copyable<Game> {
void addEmblem(Emblem emblem, MageObject sourceObject, UUID toPlayerId);
boolean addPlane(Plane plane, MageObject sourceObject, UUID toPlayerId);
boolean addPlane(Plane plane, UUID toPlayerId);
void addCommander(Commander commander);

View file

@ -1307,7 +1307,7 @@ public abstract class GameImpl implements Game {
if (gameOptions.planeChase) {
Plane plane = Plane.createRandomPlane();
plane.setControllerId(startingPlayerId);
addPlane(plane, null, startingPlayerId);
addPlane(plane, startingPlayerId);
state.setPlaneChase(this, gameOptions.planeChase);
}
}
@ -1850,18 +1850,18 @@ public abstract class GameImpl implements Game {
for (Ability ability : newEmblem.getAbilities()) {
ability.setSourceId(newEmblem.getId());
}
state.addCommandObject(newEmblem);
state.addCommandObject(newEmblem); // TODO: generate image for emblem here?
}
/**
* @param plane
* @param sourceObject
* @param toPlayerId controller and owner of the plane (may only be one
* per game..)
* @return boolean - whether the plane was added successfully or not
*/
@Override
public boolean addPlane(Plane plane, MageObject sourceObject, UUID toPlayerId) {
public boolean addPlane(Plane plane, UUID toPlayerId) {
// Implementing planechase as if it were 901.15. Single Planar Deck Option
// Here, can enforce the world plane restriction (the Grand Melee format may have some impact on this implementation)
@ -1872,7 +1872,7 @@ public abstract class GameImpl implements Game {
}
}
Plane newPlane = plane.copy();
newPlane.setSourceObject(sourceObject);
newPlane.setSourceObject();
newPlane.setControllerId(toPlayerId);
newPlane.assignNewId();
newPlane.getAbilities().newId();
@ -3160,7 +3160,7 @@ public abstract class GameImpl implements Game {
addedAgain = true;
Plane plane = Plane.createRandomPlane();
plane.setControllerId(aplayer.getId());
addPlane(plane, null, aplayer.getId());
addPlane(plane, aplayer.getId());
}
}
}

View file

@ -18,8 +18,4 @@ public interface CommandObject extends MageObject, Controllable {
@Override
CommandObject copy();
String getExpansionSetCodeForImage();
void setExpansionSetCodeForImage(String expansionSetCodeForImage);
}

View file

@ -0,0 +1,92 @@
package mage.game.command;
import mage.game.permanent.token.TokenImpl;
import mage.util.GameLog;
import java.util.UUID;
/**
* @author JayDi85
*/
public abstract class CommandObjectImpl implements CommandObject {
private UUID id;
private String name = "";
private String expansionSetCode;
private String cardNumber;
private int imageNumber;
public CommandObjectImpl(String name) {
this.id = UUID.randomUUID();
this.name = name;
}
protected CommandObjectImpl(final CommandObjectImpl object) {
this.id = object.id;
this.name = object.name;
this.expansionSetCode = object.expansionSetCode;
this.cardNumber = object.cardNumber;
this.imageNumber = object.imageNumber;
}
@Override
public UUID getId() {
return this.id;
}
@Override
public String getExpansionSetCode() {
return expansionSetCode;
}
@Override
public void setExpansionSetCode(String expansionSetCode) {
this.expansionSetCode = expansionSetCode;
}
@Override
public String getCardNumber() {
return cardNumber;
}
@Override
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
@Override
public Integer getImageNumber() {
return imageNumber;
}
@Override
public void setImageNumber(Integer imageNumber) {
this.imageNumber = imageNumber;
}
@Override
public void assignNewId() {
this.id = UUID.randomUUID();
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getIdName() {
return getName() + " [" + getId().toString().substring(0, 3) + ']';
}
@Override
public String getLogName() {
return GameLog.getColoredObjectIdName(this);
}
}

View file

@ -23,7 +23,7 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
public class Commander implements CommandObject {
public class Commander extends CommandObjectImpl {
private final Card sourceObject;
private boolean copy;
@ -31,6 +31,7 @@ public class Commander implements CommandObject {
private final Abilities<Ability> abilities = new AbilitiesImpl<>();
public Commander(Card card) {
super(card.getName());
this.sourceObject = card;
// All abilities must be added to the game before usage. It adding by addCard and addCommandObject calls
@ -106,6 +107,7 @@ public class Commander implements CommandObject {
}
private Commander(final Commander commander) {
super(commander);
this.sourceObject = commander.sourceObject.copy();
this.copy = commander.copy;
this.copyFrom = (commander.copyFrom != null ? commander.copyFrom.copy() : null);
@ -127,10 +129,6 @@ public class Commander implements CommandObject {
return sourceObject.getOwnerId();
}
@Override
public void assignNewId() {
}
@Override
public CommandObject copy() {
return new Commander(this);
@ -162,15 +160,6 @@ public class Commander implements CommandObject {
return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + ']';
}
@Override
public String getLogName() {
return GameLog.getColoredObjectIdName(this);
}
@Override
public void setName(String name) {
}
@Override
public List<CardType> getCardType(Game game) {
return sourceObject.getCardType(game);
@ -289,21 +278,6 @@ public class Commander implements CommandObject {
return sourceObject.getId();
}
@Override
public String getImageName() {
return sourceObject.getImageName();
}
@Override
public String getExpansionSetCodeForImage() {
return sourceObject.getExpansionSetCode();
}
@Override
public void setExpansionSetCodeForImage(String expansionSetCodeForImage) {
throw new IllegalStateException("Can't change a set code of the commander, source card already has it");
}
@Override
public int getZoneChangeCounter(Game game) {
return sourceObject.getZoneChangeCounter(game);

View file

@ -35,7 +35,7 @@ import java.util.*;
/**
* @author TheElk801
*/
public class Dungeon implements CommandObject {
public class Dungeon extends CommandObjectImpl {
private static final Set<String> dungeonNames = new HashSet<>();
@ -49,31 +49,24 @@ public class Dungeon implements CommandObject {
private static final ObjectColor emptyColor = new ObjectColor();
private static final ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
private final String name;
private UUID id;
private UUID controllerId;
private boolean copy;
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
private FrameStyle frameStyle;
private final Abilities<Ability> abilites = new AbilitiesImpl<>();
private String expansionSetCodeForImage;
private final List<DungeonRoom> dungeonRooms = new ArrayList<>();
private DungeonRoom currentRoom = null;
public Dungeon(String name, String expansionSetCodeForImage) {
this.id = UUID.randomUUID();
this.name = name;
this.expansionSetCodeForImage = expansionSetCodeForImage;
public Dungeon(String name) {
super(name);
}
public Dungeon(final Dungeon dungeon) {
this.id = dungeon.id;
this.name = dungeon.name;
super(dungeon);
this.frameStyle = dungeon.frameStyle;
this.controllerId = dungeon.controllerId;
this.copy = dungeon.copy;
this.copyFrom = (dungeon.copyFrom != null ? dungeon.copyFrom : null);
this.expansionSetCodeForImage = dungeon.expansionSetCodeForImage;
this.copyRooms(dungeon);
}
@ -91,7 +84,7 @@ public class Dungeon implements CommandObject {
public void addRoom(DungeonRoom room) {
this.dungeonRooms.add(room);
room.getRoomTriggeredAbility().setSourceId(id);
room.getRoomTriggeredAbility().setSourceId(this.getId());
this.abilites.add(room.getRoomTriggeredAbility());
}
@ -173,11 +166,6 @@ public class Dungeon implements CommandObject {
return frameStyle;
}
@Override
public void assignNewId() {
this.id = UUID.randomUUID();
}
@Override
public MageObject getSourceObject() {
return null;
@ -214,30 +202,6 @@ public class Dungeon implements CommandObject {
return this.copyFrom;
}
@Override
public String getName() {
return name;
}
@Override
public String getIdName() {
return getName() + " [" + getId().toString().substring(0, 3) + ']';
}
@Override
public String getLogName() {
return GameLog.getColoredObjectIdName(this);
}
@Override
public String getImageName() {
return this.name;
}
@Override
public void setName(String name) {
}
@Override
public List<CardType> getCardType(Game game) {
return emptyList;
@ -326,26 +290,11 @@ public class Dungeon implements CommandObject {
public void setStartingDefense(int startingDefense) {
}
@Override
public UUID getId() {
return this.id;
}
@Override
public Dungeon copy() {
return new Dungeon(this);
}
@Override
public String getExpansionSetCodeForImage() {
return expansionSetCodeForImage;
}
@Override
public void setExpansionSetCodeForImage(String expansionSetCodeForImage) {
this.expansionSetCodeForImage = expansionSetCodeForImage;
}
@Override
public int getZoneChangeCounter(Game game) {
return 1;

View file

@ -13,11 +13,14 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.cards.repository.TokenInfo;
import mage.cards.repository.TokenRepository;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.TokenImpl;
import mage.util.GameLog;
import mage.util.RandomUtil;
import mage.util.SubTypes;
@ -27,40 +30,31 @@ import java.util.*;
/**
* @author nantuko
*/
public class Emblem implements CommandObject {
public abstract class Emblem extends CommandObjectImpl {
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
private static final ObjectColor emptyColor = new ObjectColor();
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
private String name = "";
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 = "";
// list of set codes emblem images are available for
protected List<String> availableImageSetCodes = new ArrayList<>();
public Emblem() {
this.id = UUID.randomUUID();
public Emblem(String name) {
super(name);
}
public Emblem(final Emblem emblem) {
this.id = emblem.id;
this.name = emblem.name;
super(emblem);
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;
this.availableImageSetCodes = emblem.availableImageSetCodes;
}
@Override
@ -68,25 +62,18 @@ public class Emblem implements CommandObject {
return frameStyle;
}
@Override
public void assignNewId() {
this.id = UUID.randomUUID();
}
public void setSourceObject(MageObject sourceObject) {
this.sourceObject = sourceObject;
if (sourceObject instanceof Card) {
if (name.isEmpty()) {
name = sourceObject.getSubtype().toString();
}
if (expansionSetCodeForImage.isEmpty()) {
expansionSetCodeForImage = ((Card) sourceObject).getExpansionSetCode();
}
if (!availableImageSetCodes.isEmpty()) {
if (expansionSetCodeForImage.equals("") || !availableImageSetCodes.contains(expansionSetCodeForImage)) {
expansionSetCodeForImage = availableImageSetCodes.get(RandomUtil.nextInt(availableImageSetCodes.size()));
}
}
// choose set code due source
TokenInfo foundInfo = TokenRepository.instance.generateTokenInfoBySetCode(this.getClass().getName(), sourceObject.getExpansionSetCode());
if (foundInfo != null) {
this.setExpansionSetCode(foundInfo.getSetCode());
this.setCardNumber("");
this.setImageNumber(foundInfo.getImageNumber());
} else {
// how-to fix: add emblem to the tokens-database
throw new IllegalArgumentException("Wrong code usage: can't find token info for the emblem: " + this.getClass().getName());
}
}
@ -113,6 +100,9 @@ public class Emblem implements CommandObject {
this.abilites.setControllerId(controllerId);
}
@Override
abstract public Emblem copy();
@Override
public void setCopy(boolean isCopy, MageObject copyFrom) {
this.copy = isCopy;
@ -129,31 +119,6 @@ public class Emblem implements CommandObject {
return this.copyFrom;
}
@Override
public String getName() {
return name;
}
@Override
public String getIdName() {
return getName() + " [" + getId().toString().substring(0, 3) + ']';
}
@Override
public String getLogName() {
return GameLog.getColoredObjectIdName(this);
}
@Override
public String getImageName() {
return this.name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public List<CardType> getCardType(Game game) {
return emptyList;
@ -242,26 +207,6 @@ public class Emblem implements CommandObject {
public void setStartingDefense(int startingDefense) {
}
@Override
public UUID getId() {
return this.id;
}
@Override
public Emblem copy() {
return new Emblem(this);
}
@Override
public String getExpansionSetCodeForImage() {
return expansionSetCodeForImage;
}
@Override
public void setExpansionSetCodeForImage(String expansionSetCodeForImage) {
this.expansionSetCodeForImage = expansionSetCodeForImage;
}
@Override
public int getZoneChangeCounter(Game game) {
return 1; // Emblems can't move zones until now so return always 1

View file

@ -13,6 +13,8 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.cards.repository.TokenInfo;
import mage.cards.repository.TokenRepository;
import mage.constants.CardType;
import mage.constants.Planes;
import mage.constants.SubType;
@ -29,29 +31,28 @@ import java.util.*;
/**
* @author spjspj
*/
public class Plane implements CommandObject {
public abstract class Plane extends CommandObjectImpl {
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
private static final ObjectColor emptyColor = new ObjectColor();
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
private Planes planeType = null;
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 = "";
public Plane() {
this.id = UUID.randomUUID();
super("");
this.frameStyle = FrameStyle.M15_NORMAL;
}
public Plane(final Plane plane) {
this.id = plane.id;
super(plane);
this.planeType = plane.planeType;
this.frameStyle = plane.frameStyle;
this.controllerId = plane.controllerId;
@ -59,7 +60,6 @@ public class Plane implements CommandObject {
this.copy = plane.copy;
this.copyFrom = (plane.copyFrom != null ? plane.copyFrom.copy() : null);
this.abilites = plane.abilites.copy();
this.expansionSetCodeForImage = plane.expansionSetCodeForImage;
}
@Override
@ -67,17 +67,18 @@ public class Plane implements CommandObject {
return frameStyle;
}
@Override
public void assignNewId() {
this.id = UUID.randomUUID();
}
public void setSourceObject() {
this.sourceObject = null;
public void setSourceObject(MageObject sourceObject) {
this.sourceObject = sourceObject;
if (sourceObject instanceof Card) {
if (expansionSetCodeForImage.isEmpty()) {
expansionSetCodeForImage = ((Card) sourceObject).getExpansionSetCode();
}
// choose set code due source
TokenInfo foundInfo = TokenRepository.instance.generateTokenInfoBySetCode(this.getClass().getName(), null);
if (foundInfo != null) {
this.setExpansionSetCode(foundInfo.getSetCode());
this.setCardNumber("");
this.setImageNumber(foundInfo.getImageNumber());
} else {
// how-to fix: add plane to the tokens-database
throw new IllegalArgumentException("Wrong code usage: can't find token info for the plane: " + this.getClass().getName());
}
}
@ -104,6 +105,9 @@ public class Plane implements CommandObject {
this.abilites.setControllerId(controllerId);
}
@Override
abstract public Plane copy();
@Override
public void setCopy(boolean isCopy, MageObject copyFrom) {
this.copy = isCopy;
@ -125,21 +129,6 @@ public class Plane implements CommandObject {
return planeType != null ? planeType.getFullName() : "";
}
@Override
public String getIdName() {
return getName() + " [" + getId().toString().substring(0, 3) + ']';
}
@Override
public String getLogName() {
return GameLog.getColoredObjectIdName(this);
}
@Override
public String getImageName() {
return planeType != null ? planeType.getFullName() : "";
}
@Override
public void setName(String name) {
throw new UnsupportedOperationException("Planes don't use setName, use setPlaneType instead");
@ -241,29 +230,9 @@ public class Plane implements CommandObject {
public void setStartingDefense(int startingDefense) {
}
@Override
public UUID getId() {
return this.id;
}
@Override
public Plane copy() {
return new Plane(this);
}
@Override
public String getExpansionSetCodeForImage() {
return expansionSetCodeForImage;
}
@Override
public void setExpansionSetCodeForImage(String expansionSetCodeForImage) {
this.expansionSetCodeForImage = expansionSetCodeForImage;
}
@Override
public int getZoneChangeCounter(Game game) {
return 1; // Emblems can't move zones until now so return always 1
return 1; // Planes can't move zones until now so return always 1
}
@Override
@ -311,6 +280,7 @@ public class Plane implements CommandObject {
Constructor<?> cons = c.getConstructor();
Object plane = cons.newInstance();
if (plane instanceof Plane) {
// TODO: generate image for plane here?
return (Plane) plane;
}
} catch (Exception ex) {

View file

@ -126,9 +126,10 @@ public class PermanentCard extends PermanentImpl {
this.subtype.copyFrom(card.getSubtype());
this.supertype.clear();
this.supertype.addAll(card.getSuperType());
this.expansionSetCode = card.getExpansionSetCode();
this.setExpansionSetCode(card.getExpansionSetCode());
this.setCardNumber(card.getCardNumber());
this.rarity = card.getRarity();
this.cardNumber = card.getCardNumber();
this.usesVariousArt = card.getUsesVariousArt();
if (card.getSecondCardFace() != null) {

View file

@ -186,7 +186,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public String toString() {
StringBuilder sb = threadLocalBuilder.get();
sb.append(this.getName()).append('-').append(this.expansionSetCode);
sb.append(this.getName()).append('-').append(this.getExpansionSetCode());
if (copy) {
sb.append(" [Copy]");
}
@ -1184,7 +1184,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean entersBattlefield(Ability source, Game game, Zone fromZone, boolean fireEvent) {
controlledFromStartOfControllerTurn = false;
if (this.isFaceDown(game)) { // ?? add morphed/manifested here ??
if (this.isFaceDown(game)) { // ?? add morphed/manifested here ???
// remove some attributes here, because first apply effects comes later otherwise abilities (e.g. color related) will unintended trigger
MorphAbility.setPermanentToFaceDownCreature(this, this, game);
}
@ -1782,16 +1782,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
morphed = value;
}
@Override
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
@Override
public void setExpansionSetCode(String expansionSetCode) {
this.expansionSetCode = expansionSetCode;
}
@Override
public void setRarity(Rarity rarity) {
this.rarity = rarity;

View file

@ -11,6 +11,7 @@ import mage.constants.EmptyNames;
import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.Token;
import mage.util.CardUtil;
import java.util.UUID;
@ -73,6 +74,11 @@ public class PermanentToken extends PermanentImpl {
}
}
@Override
public String toString() {
return String.format("%s - %s", getExpansionSetCode(), getName());
}
private void copyFromToken(Token token, Game game, boolean reset) {
// modify all attributes permanently (without game usage)
this.name = token.getName();
@ -105,6 +111,8 @@ public class PermanentToken extends PermanentImpl {
if (this.abilities.containsClass(ChangelingAbility.class)) {
this.subtype.setIsAllCreatureTypes(true);
}
CardUtil.copySetAndCardNumber(this, token);
}
@Override
@ -144,24 +152,4 @@ public class PermanentToken extends PermanentImpl {
public MageObject getOtherFace() {
return this.transformed ? token : this.token.getBackFace();
}
@Override
public String getCardNumber() {
return token.getOriginalCardNumber();
}
@Override
public void setCardNumber(String cardNumber) {
throw new IllegalArgumentException("Wrong code usage: you can't change a token's card number");
}
@Override
public String getExpansionSetCode() {
return token.getOriginalExpansionSetCode();
}
@Override
public void setExpansionSetCode(String expansionSetCode) {
throw new IllegalArgumentException("Wrong code usage: you can't change a token's set code, use CardUtils.copySetAndCardNumber instead");
}
}

View file

@ -202,6 +202,36 @@ public class Spell extends StackObjectImpl implements Card {
return GameLog.replaceNameByColoredName(card, getSpellAbility().toString());
}
@Override
public String getExpansionSetCode() {
return card.getExpansionSetCode();
}
@Override
public void setExpansionSetCode(String expansionSetCode) {
throw new IllegalStateException("Wrong code usage: you can't change set code for the spell");
}
@Override
public String getCardNumber() {
return card.getCardNumber();
}
@Override
public void setCardNumber(String cardNumber) {
throw new IllegalStateException("Wrong code usage: you can't change card number for the spell");
}
@Override
public Integer getImageNumber() {
return card.getImageNumber();
}
@Override
public void setImageNumber(Integer imageNumber) {
throw new IllegalStateException("Wrong code usage: you can't change image number for the spell");
}
@Override
public boolean resolve(Game game) {
boolean result;
@ -481,11 +511,6 @@ public class Spell extends StackObjectImpl implements Card {
return GameLog.getColoredObjectIdName(card);
}
@Override
public String getImageName() {
return card.getImageName();
}
@Override
public void setName(String name) {
}
@ -704,11 +729,6 @@ public class Spell extends StackObjectImpl implements Card {
return card.getRules(game);
}
@Override
public String getExpansionSetCode() {
return card.getExpansionSetCode();
}
@Override
public void setFaceDown(boolean value, Game game) {
faceDown = value;
@ -875,11 +895,6 @@ public class Spell extends StackObjectImpl implements Card {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getCardNumber() {
return card.getCardNumber();
}
@Override
public boolean getUsesVariousArt() {
return card.getUsesVariousArt();

View file

@ -52,23 +52,23 @@ public class StackAbility extends StackObjectImpl implements Ability {
private boolean copy;
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
private String name;
private String expansionSetCode;
private TargetAdjuster targetAdjuster = null;
private CostAdjuster costAdjuster = null;
public StackAbility(Ability ability, UUID controllerId) {
super();
this.ability = ability;
this.controllerId = controllerId;
this.name = "stack ability (" + ability.getRule() + ')';
}
public StackAbility(final StackAbility stackAbility) {
super();
this.ability = stackAbility.ability.copy();
this.controllerId = stackAbility.controllerId;
this.copy = stackAbility.copy;
this.copyFrom = (stackAbility.copyFrom != null ? stackAbility.copyFrom.copy() : null);
this.name = stackAbility.name;
this.expansionSetCode = stackAbility.expansionSetCode;
this.targetAdjuster = stackAbility.targetAdjuster;
this.targetChanged = stackAbility.targetChanged;
this.costAdjuster = stackAbility.costAdjuster;
@ -128,6 +128,36 @@ public class StackAbility extends StackObjectImpl implements Ability {
return this.copyFrom;
}
@Override
public String getExpansionSetCode() {
return "";
}
@Override
public void setExpansionSetCode(String expansionSetCode) {
throw new IllegalStateException("Wrong code usage: you can't change set code for the stack ability");
}
@Override
public String getCardNumber() {
return "";
}
@Override
public void setCardNumber(String cardNumber) {
throw new IllegalStateException("Wrong code usage: you can't change card number for the stack ability");
}
@Override
public Integer getImageNumber() {
return 0;
}
@Override
public void setImageNumber(Integer imageNumber) {
throw new IllegalStateException("Wrong code usage: you can't change image number for the stack ability");
}
@Override
public String getName() {
return name;
@ -144,12 +174,8 @@ public class StackAbility extends StackObjectImpl implements Ability {
}
@Override
public String getImageName() {
return name;
}
public String getExpansionSetCode() {
return expansionSetCode;
public void setName(String name) {
this.name = name;
}
@Override
@ -384,15 +410,6 @@ public class StackAbility extends StackObjectImpl implements Ability {
return new StackAbility(this);
}
@Override
public void setName(String name) {
this.name = name;
}
public void setExpansionSetCode(String expansionSetCode) {
this.expansionSetCode = expansionSetCode;
}
@Override
public boolean checkIfClause(Game game) {
return true;