mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Refactoring: replace custom creature tokens with basic class
This commit is contained in:
parent
78fdf9a192
commit
578427a601
6 changed files with 37 additions and 61 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue