forked from SmallBookworm/gf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
char.js
140 lines (123 loc) · 5.69 KB
/
char.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
function getCharSkillDetail(charT) {
var detailText = null;
if (charT.skillLevel in charT.skill.detailText) {
detailText = charT.skill.detailText[charT.skillLevel];
} else if ("val" in charT.skill.detailText) {
detailText = charT.skill.detailText["val"];
} else {
detailText = charT.skill.detailText["0"];
}
var detailText2 = null;
if (charT.c.modLevel >= 2) {
if (charT.c.mod2SkillLevel in charT.mod2Skill.detailText) {
detailText2 = charT.mod2Skill.detailText[charT.c.mod2SkillLevel];
} else if ("val" in charT.mod2Skill.detailText) {
detailText2 = charT.mod2Skill.detailText["val"];
} else {
detailText2 = charT.mod2Skill.detailText["0"];
}
}
var text = [];
var skillEffect = getSkillByLevel(charT.skill.effect, charT.c.skillLevel);
var pSkillEffect = null;
if ('passive' in charT.skill) {
pSkillEffect = getSkillByLevel(charT.skill.passive.effect, charT.c.skillLevel);
}
if (charT.id == "183") text.push(getCharSkillDetailId183(skillEffect, detailText));
if (charT.id == "188") text.push(getCharSkillDetailId188(skillEffect, detailText));
if (charT.id == "189") text.push(getCharSkillDetailId189(charT, detailText));
if (charT.id == "196") text.push(getCharSkillDetailId196(charT, detailText));
if (charT.id == "197") text.push(getCharSkillDetailId197(skillEffect, pSkillEffect, detailText));
if (charT.id == "203") text.push(getCharSkillDetailId203(charT, detailText));
if (charT.id == "207") text.push(getCharSkillDetailId207(charT, detailText));
if (charT.id == "1001") text.push(getCharSkillDetailId1001(skillEffect, detailText));
if (charT.id == "1002") text.push(getCharSkillDetailId1002(skillEffect, detailText));
if (charT.id == "1004") text.push(getCharSkillDetailId1004(skillEffect, detailText));
if (charT.id == "20055") text.push(getCharSkillDetailId20055(charT, detailText, detailText2));
if (charT.id == "20057") text.push(getCharSkillDetailId20057(charT, detailText, detailText2));
if ("format" in charT.skill.detailText) text.push(getCharSkillDetailFormat(charT, detailText, 0, charT.skill.detailText.format));
if (detailText2 != null && "format" in charT.mod2Skill.detailText) text.push(getCharSkillDetailFormat(charT, detailText2, 1, charT.mod2Skill.detailText.format));
return text;
}
function getCharSkillDetailId183(skillEffect, detailText) {
return detailText.format(skillEffect.attack.val, skillEffect.reducedDamage.val, skillEffect.time.val);
}
function getCharSkillDetailId188(skillEffect, detailText) {
return detailText.format(skillEffect.shield.val, skillEffect.time.val);
}
function getCharSkillDetailId189(charT, detailText) {
var v0 = charT.c.skills[0].effects[0].time;
var v1 = charT.c.skills[0].effects[0].value;
var v2 = charT.c.skills[0].effects[1].value;
return detailText.format(v0, v1, v2);
}
function getCharSkillDetailId196(charT, detailText) {
var v0 = charT.c.skills[0].effects[0].value * 100;
var v1 = charT.c.skills[0].effects[1].value;
var v2 = charT.c.skills[0].effects[1].time;
var v3 = charT.c.skills[0].effects[2].value;
var v4 = charT.c.skills[0].effects[2].time;
return detailText.format(v0, v1, v2, v3, v4);
}
function getCharSkillDetailId197(skillEffect, pSkillEffect, detailText) {
return detailText.format(skillEffect.criRate.val, skillEffect.time.val, pSkillEffect.criRate.val);
}
function getCharSkillDetailId203(charT, detailText) {
var v0 = charT.c.skills[0].effects[0].value;
var v1 = charT.c.skills[0].effects[1].value;
var v2 = charT.c.skills[0].effects[1].time;
return detailText.format(v0, v1, v2);
}
function getCharSkillDetailId207(charT, detailText) {
var v0 = charT.c.skills[0].effects[0].value;
var v1 = charT.c.skills[0].effects[1].value;
var v2 = charT.c.skills[0].effects[2].value;
var v3 = charT.c.skills[0].effects[3].value;
var v4 = charT.c.skills[0].effects[0].time;
return detailText.format(v0, v1, v2, v3, v4);
}
function getCharSkillDetailId1001(skillEffect, detailText) {
return detailText.format(skillEffect.attack.val);
}
function getCharSkillDetailId1002(skillEffect, detailText) {
return detailText.format(skillEffect.attack.val, skillEffect.attack2.val);
}
function getCharSkillDetailId1004(skillEffect, detailText) {
return detailText.format(skillEffect.attack.val, skillEffect.time.val);
}
function getCharSkillDetailId20055(charT, detailText, detailText2) {
var result = [];
var v0 = charT.c.skills[0].effects[0].value;
var v1 = charT.c.skills[0].effects[0].time;
result.push(detailText.format(v0, v1));
if (detailText2 != null) {
var v2 = charT.c.skills[1].effects[1].value * 100;
result.push(detailText2.format(v2));
}
return result.join("<br>");
}
function getCharSkillDetailId20057(charT, detailText, detailText2) {
var result = [];
var v0 = charT.c.skills[0].effects[0].value;
var v1 = charT.c.skills[0].effects[0].time;
result.push(detailText.format(v0, v1));
if (detailText2 != null) {
var v2 = charT.c.skills[1].effects[0].value * 100;
var v3 = charT.c.skills[1].effects[1].value * 100;
result.push(detailText2.format(v2, v3));
}
return result.join("<br>");
}
function getCharSkillDetailFormat(charT, detailText, skillIndex, format) {
var result = detailText;
var i = 0;
format.forEach(v => {
if ("textIndex" in v) i = v.textIndex;
var value = charT.c.skills[skillIndex].effects[v.effectIndex][v.attr];
if (v.percent) value *= 100;
result = result.replace("{" + i + "}", value);
i++;
});
return result;
}
//alert(JSON.stringify(charObj));