forked from quisquous/cactbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditions.ts
49 lines (44 loc) · 1.45 KB
/
conditions.ts
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
// For consistency with Responses, Conditions
// are also functions.
import { Data } from '../types/data';
import { Matches } from '../types/trigger';
import {
StartsUsingParams,
AbilityParams,
AbilityFullParams,
HeadMarkerParams,
GainsEffectParams,
StatusEffectExplicitParams,
LosesEffectParams,
TetherParams,
WasDefeatedParams,
Regex,
} from '../resources/regexes';
type TargetableMatches = Matches<Regex<
StartsUsingParams |
AbilityParams |
AbilityFullParams |
HeadMarkerParams |
GainsEffectParams |
StatusEffectExplicitParams |
LosesEffectParams |
TetherParams |
WasDefeatedParams
>>;
export default {
targetIsYou(): (data: Data, matches: TargetableMatches) => boolean {
return (data: Data, matches: TargetableMatches) => data.me === matches?.target;
},
targetIsNotYou(): (data: Data, matches: TargetableMatches) => boolean {
return (data: Data, matches: TargetableMatches) => data.me !== matches?.target;
},
caresAboutAOE(): (data: Data) => boolean {
return (data: Data) => data.role === 'tank' || data.role === 'healer' || data.CanAddle() || data.job === 'BLU';
},
caresAboutMagical(): (data: Data) => boolean {
return (data: Data) => data.role === 'tank' || data.role === 'healer' || data.CanAddle() || data.job === 'BLU';
},
caresAboutPhysical(): (data: Data) => boolean {
return (data: Data) => data.role === 'tank' || data.role === 'healer' || data.CanFeint() || data.job === 'BLU';
},
};