forked from quisquous/cactbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
117 lines (115 loc) · 2.88 KB
/
test.js
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
'use strict';
// Test mistake triggers.
[{
zoneRegex: /^Middle La Noscea$/,
triggers: [
{
id: 'Test Bow',
regex: /:You bow courteously to the striking dummy/,
mistake: function(e, data) {
return {
type: 'pull',
blame: data.me,
fullText: {
en: 'Bow',
de: 'Bogen',
},
};
},
},
{
id: 'Test Wipe',
regex: /:You bid farewell to the striking dummy/,
mistake: function(e, data) {
return {
type: 'wipe',
blame: data.me,
fullText: {
en: 'Party Wipe',
de: 'Gruppenwipe',
},
};
},
},
{
id: 'Test Bootshine',
damageRegex: gLang.kAbility.Bootshine,
condition: function(e, data) {
if (e.attackerName != data.me)
return false;
let strikingDummyNames = [
'Striking Dummy',
// FIXME: add other languages here
];
return strikingDummyNames.indexOf(e.targetName) >= 0;
},
mistake: function(e, data) {
data.bootCount = data.bootCount || 0;
data.bootCount++;
let text = e.abilityName + ' (' + data.bootCount + '): ' + e.damageStr;
return { type: 'warn', blame: data.me, text: text };
},
},
{
id: 'Test Oops',
regex: /:(oops.*)/,
mistake: function(e, data, matches) {
return { type: 'fail', blame: data.me, text: matches[1] };
},
},
{
id: 'Test Poke',
regex: /:You poke the striking dummy/,
collectSeconds: 5,
mistake: function(events, data) {
// When runOnce is specified, events are passed as an array.
let pokes = events.length;
// 1 poke at a time is fine, but more than one inside of
// collectSeconds is (OBVIOUSLY) a mistake.
if (pokes <= 1)
return;
let text = {
en: 'Too many pokes (' + pokes + ')',
de: 'Zu viele Piekser (' + pokes + ')',
};
return { type: 'fail', blame: data.me, text: text };
},
},
{
id: 'Test One Ilm Punch',
damageRegex: gLang.kAbility.OneIlmPunch,
condition: function(e) {
return e.targetName == 'Striking Dummy';
},
mistake: function(e, data) {
// Demonstrate returning multiple mistakes.
return [
{
type: 'warn',
blame: data.me,
text: {
en: 'ONE!',
de: 'EIN!',
},
},
{
type: 'fail',
blame: data.me,
text: {
en: 'ILM!',
de: 'ILM!',
},
},
{
type: 'potion',
blame: data.me,
text: {
en: 'PUNCH!',
de: 'SCHLAG!',
},
},
];
},
},
],
}];