forked from celoko/batclient_triggers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharcher_analyze.bcs
68 lines (54 loc) · 1.79 KB
/
archer_analyze.bcs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
SCRIPT_NAME = "archer_analyze";
SCRIPT_DESC = "Reports resists";
SCRIPT_OFF = false;
//global variables
archer_target = "";
void bootup() {
triggerManager.newTrigger("archer_get_name",
"^You fire [a-z ]+ at ([A-Za-z -]+)[.]$",
"$"+SCRIPT_NAME+".set_target_name");
triggerManager.newTrigger("archer_wound_watcher",
"^You see from the wound your shot did (almost no|just a bit of|some|a lot of|full) (acid|asphyxiation|cold|electrical|fire|magical|physical|psionic) damage[.]$",
"$"+SCRIPT_NAME+".check_type");
}
void set_target_name() {
archer_target = vars.get(1);
}
void check_type() {
damage = vars.get(1);
type = vars.get(2);
resist = 0;
// Turn damage message into a number
if (damage.equals("full")) {
resist = 0;
} else if (damage.equals("a lot of")) {
resist = 25;
} else if (damage.equals("some")) {
resist = 50;
} else if (damage.equals("just a bit of")) {
resist = 75;
} else if (damage.equals("almost no")) {
resist = 100;
}
// check that we have proper type and do report
if (type.equals("acid") ||
type.equals("asphyxiation") ||
type.equals("cold") ||
type.equals("electrical") ||
type.equals("fire") ||
type.equals("magical") ||
type.equals("physical") ||
type.equals("psionic")){
report(resist, type);
// Clear name after report
archer_target = "";
}
}
void report(int resist, String type) {
// Report only if we have name
if (archer_target != "") {
// Safe version, doesn't report name.
//clientGUI.doCommand("@@party report Target resists " + resist + "% " + type);
clientGUI.doCommand("@@party report " + archer_target + " resists " + resist + "% " + type);
}
}