forked from External/mage
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:
parent
46f6593da8
commit
5f55c7c667
45 changed files with 517 additions and 477 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue