Refactoring: replace custom creature tokens with basic class

This commit is contained in:
Oleg Agafonov 2018-05-05 17:25:33 +04:00
parent 78fdf9a192
commit 578427a601
6 changed files with 37 additions and 61 deletions

View file

@ -2,7 +2,9 @@ package mage.game.permanent.token.custom;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.TokenImpl;
import mage.util.SubTypeList;
/**
*
@ -15,8 +17,21 @@ public class CreatureToken extends TokenImpl {
}
public CreatureToken(int power, int toughness) {
super("", String.format("%d/%d creature", power, toughness));
this(power, toughness, String.format("%d/%d creature", power, toughness));
}
public CreatureToken(int power, int toughness, String description) {
this(power, toughness, description, (SubTypeList) null);
}
public CreatureToken(int power, int toughness, String description, SubType extraSubType) {
this(power, toughness, description, new SubTypeList(extraSubType));
}
public CreatureToken(int power, int toughness, String description, SubTypeList extraSubTypes) {
super("", description);
this.cardType.add(CardType.CREATURE);
this.subtype.addAll(extraSubTypes);
this.power = new MageInt(power);
this.toughness = new MageInt(toughness);
}

View file

@ -10,7 +10,15 @@ import java.util.stream.Collectors;
public class SubTypeList extends ArrayList<SubType> {
public SubTypeList(SubType firstSubType) {
super();
this.add(firstSubType);
}
public SubTypeList(SubType... subTypesList) {
super();
Collections.addAll(this, subTypesList);
}
@Deprecated
public boolean addAll(List<String> subtypes) {