Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/config/CharacterProperties.java

74 lines
2.1 KiB
Java
Raw Normal View History

package uulm.teamname.marvelous.gamelibrary.config;
2021-05-31 15:50:15 +00:00
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
2021-06-05 13:57:33 +00:00
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
2021-05-31 15:50:15 +00:00
import java.util.Objects;
/** Represents properties of a character in the {@link CharacterConfig} */
@JsonPropertyOrder({"characterID", "name", "HP", "MP", "AP", "meleeDamage", "rangeCombatDamage", "rangeCombatReach"})
2021-05-31 15:50:15 +00:00
public class CharacterProperties {
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
public int characterID;
2021-06-05 13:57:33 +00:00
@NotEmpty
2021-05-31 15:50:15 +00:00
public String name;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
public int HP;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
public int MP;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
public int AP;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
public int meleeDamage;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
@JsonProperty("rangeCombatDamage")
public int rangedDamage;
2021-06-05 13:57:33 +00:00
@NotNull
@Positive
2021-05-31 15:50:15 +00:00
@JsonProperty("rangeCombatReach")
public int attackRange;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CharacterProperties that = (CharacterProperties) o;
return characterID == that.characterID && HP == that.HP && MP == that.MP && AP == that.AP && meleeDamage == that.meleeDamage && rangedDamage == that.rangedDamage && attackRange == that.attackRange && Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(characterID, name, HP, MP, AP, meleeDamage, rangedDamage, attackRange);
}
@Override
public String toString() {
return "CharacterProperties{" +
"characterID=" + characterID +
", name='" + name + '\'' +
", HP=" + HP +
", MP=" + MP +
", AP=" + AP +
", meleeDamage=" + meleeDamage +
", rangedDamage=" + rangedDamage +
", attackRange=" + attackRange +
'}';
}
2021-05-31 15:50:15 +00:00
}