Enum Class CharacterType
- All Implemented Interfaces:
Serializable,Comparable<CharacterType>,Constable
Enum of selectable characters that also acts as a factory for the correct Player subclass.
To add a new character, simply add an entry here.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PlayerCreates the Player subclass corresponding to this CharacterType.static CharacterTypeReturns the enum constant of this class with the specified name.static CharacterType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
KNIGHT
Swordsman with high HP and good defense. Skill attacks twice. -
ARCHER
Archer with the highest ATK. Skill pierces defense. -
REBORN
Cleric with a 5-slot inventory. Skill restores HP. -
ALIEN
Alien with magic attacks that bypass defense; can move diagonally.
-
-
Constructor Details
-
CharacterType
private CharacterType()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
createPlayer
Creates the Player subclass corresponding to this CharacterType.- Returns:
- A new Player instance
-