-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirection.java
More file actions
30 lines (25 loc) · 848 Bytes
/
Copy pathDirection.java
File metadata and controls
30 lines (25 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* The four dodge directions. Their order matters: the in-combat dodge menu numbers them 1-4,
* and boss attack data stores the dodgeable directions by the matching 0-based index.
*/
enum Direction {
FORWARD("Forward"),
BACKWARD("Backward"),
RIGHT("Right"),
LEFT("Left");
private final String label;
Direction(String label) {
this.label = label;
}
String label() {
return label;
}
/** The direction for a 1-based menu choice (1=Forward .. 4=Left), or {@code null} if out of range. */
static Direction fromMenuChoice(int choice) {
return (choice >= 1 && choice <= values().length) ? values()[choice - 1] : null;
}
/** The direction a boss attack stores by its 0-based index. */
static Direction fromIndex(int index) {
return values()[index];
}
}