44public class WeaponDefinition {
46 private final int item;
47 private final String name;
48 private final boolean twoHanded;
49 private final String weaponType;
51 private final int stand;
52 private final int walk;
53 private final int run;
55 public WeaponDefinition(
int item, String name,
boolean twoHanded, String weaponType,
RangedWeaponDefinition rangedDefinition,
int stand,
int walk,
int run) {
58 this.twoHanded = twoHanded;
59 this.weaponType = weaponType;
60 this.rangedDefinition = rangedDefinition;
66 public int getItem() {
70 public String getName() {
74 public String getWeaponType() {
78 public Optional<RangedWeaponDefinition> getRangedDefinition() {
79 return Optional.ofNullable(rangedDefinition);
82 public boolean isTwoHanded() {
86 public int getStand() {
90 public int getWalk() {
98 public static boolean isPoisonous(String name) {
99 return name.endsWith(
"p)") || name.endsWith(
"p+)") || name.endsWith(
"p++)");
102 public static int poisonStrength(String name) {
103 return name.endsWith(
"p)") ? 2 : name.endsWith(
"p+)") ? 4 : name.endsWith(
"p++)") ? 6 : 2;
113 public static WeaponDefinition
get(
int id) {
114 if (id < 0 || id >= DEFINITIONS.length) {
118 return DEFINITIONS[id];