blob: fe3888858a5713c8132fbea790a2ae971ec6c9bd (
plain)
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
|
class TechniqueEffect {
/**
* @type {string}
*/
type = '';
/**
* @type {('user' | 'target')}
*/
recipient = null;
/**
* @type {Monster[]}
*/
recipients = [];
/**
* @type {('give' | 'remove')}
*/
application = '';
/**
* @type {StatusEffectType}
*/
statusEffect = null;
/**
* @type {ElementType}
*/
switchType = '';
/**
* @type {Monster}
*/
user = null;
/**
* @type {Monster}
*/
target = null;
/**
* @param {string} effectCode
*/
constructor (effectCode) {
if (effectCode.includes('status_')) {
this.type = 'status';
this.recipient = effectCode.split(',')[1];
this.application = effectCode.split(' ')[0];
this.statusEffect = effectCode.split(',')[0].split(' ')[1].split('_')[1];
}
else if (effectCode.includes('healing')) {
this.type = 'healing';
this.recipient = effectCode.split(' ')[1];
}
else if (effectCode.startsWith('switch')) {
this.type = 'switch';
this.recipient = effectCode.split(' ')[1].split(',')[0];
this.switchType = effectCode.split(' ')[1].split(',')[1];
}
else {
this.type = effectCode;
}
}
/**
* @type {Monster}
*/
setUser (user) {
if (['user', 'both'].includes(this.recipient)) {
this.recipients.push(user);
}
}
/**
* @type {Monster}
*/
setTarget (target) {
if (['target', 'both'].includes(this.recipient)) {
this.recipients.push(target);
}
}
}
|