blob: aa1c1df5a66fbd066ed29ef7ef2d4d2b8d03c885 (
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
|
class ItemEffect {
/**
* @type {string}
*/
type = '';
/**
* @type {('increase')}
*/
application = '';
/**
* @type {number}
*/
amount = 0;
/**
* @param {string} effectCode
*/
constructor (effectCode) {
if (effectCode.startsWith('heal')) {
this.type = 'heal';
this.amount = parseInt(effectCode.split(' ')[1]);
}
else if (effectCode.startsWith('revive')) {
this.type = 'revive';
this.amount = effectCode.split(' ')[1];
}
else if (effectCode.startsWith('learn_')) {
this.type = effectCode.split(' ')[0];
this.what = effectCode.split(' ')[1];
}
else if (Object.values(StatType).includes(effectCode.split(' ')[1] || '')) {
this.type = 'stat';
this.application = effectCode.split(' ')[0];
this.what = effectCode.split(' ')[1].split(',')[0];
this.amount = effectCode.split(' ')[1].split(',')[1];
}
else {
this.type = effectCode;
}
}
}
|