-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverload.html
381 lines (350 loc) · 13.6 KB
/
overload.html
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html>
<html>
<head>
<title>Nikke Overload Gear Simulator</title>
<script type="text/javascript">
const LOCK_POS = 0;
const ASSIGN_POS = 1;
const EFFECT_POS = 2;
const PARAM_POS = 3;
const NAME_POS = 0;
const ASSIGN = [100, 50, 30];
const PARAM_U = [60, 35, 5];
const PARAM_L = [0, 20, 20, 20, 20, 20];
const INIT = -1;
const ON = 1;
const OFF = 2;
const EMPTY_NO = 0;
const DEFAULT_PARAM_NO = 11;
const NAMES_T = [
["Option not obtained.", 0],
["Increase Element Damage Dealt", 10, 9.541, 1.4015],
["Increase Hit Rate", 12, 4.77, 0.7043],
["Increase Max Ammunition Capacity", 12, 27.841, 4.109],
["Increase ATK", 10, 4.77, 0.7043],
["Increase Charge Damage", 12, 4.77, 0.7043],
["Increase Charge Speed", 12, 1.983, 0.2937],
["Increase Critical Rate", 12, 2.299, 0.341],
["Increase Critical Damage", 10, 6.64, 0.98],
["Increase DEF", 12, 4.77, 0.7043],
];
let trial = 0;
let used = 0;
let data = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
let store = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
let smode = OFF;
let disp = INIT;
function getValue(effectNo, parameterNo) {
let value = NAMES_T[effectNo][2];
let add = NAMES_T[effectNo][3];
return value + add * (parameterNo - 1);
}
function modification(fast,effect) {
if (effect) {
calcAssign();
calcEffect();
}
if (fast) {
calcParameter(INIT);
lottery(ON);
} else {
calcParameter(ON);
lottery(smode);
}
}
function lottery(mode) {
used += getCost(1);
trial++;
if (mode == ON)
exeApply(true, OFF);
else
view(ON);
}
function exeApply(enable,ctrl) {
if (enable)
arrayCopy(data, store);
else
arrayCopy(store, data);
view(ctrl);
}
function isLock(pos) {
return data[pos][LOCK_POS] == ON;
}
function isAssign(pos) {
return data[pos][ASSIGN_POS] == ON;
}
function calcAssign() {
for (let pos = 0; pos < data.length; pos++) {
if (!isLock(pos)) assign(pos, ASSIGN[pos] > random() ? ON : OFF);
}
}
function calcEffect() {
for (let pos = 0; pos < data.length; pos++) {
if (!isLock(pos)) effect(pos, isAssign(pos) ? newEffectNo() : EMPTY_NO);
}
}
function reset() {
trial = used = 0;
data = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
store = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
view(INIT);
}
function isRetry(effectNo) {
for (let pos = 0; pos < data.length; pos++) {
if (data[pos][EFFECT_POS] == effectNo) return true;
}
return false;
}
function calcParameter(mode) {
for (let pos = 0; pos < data.length; pos++) {
if (!isLock(pos)) {
parameter(pos, isAssign(pos) ? newParameterNo(mode) : EMPTY_NO);
}
}
}
function newParameterNo(mode) {
if (mode == INIT) {
return DEFAULT_PARAM_NO;
} else {
return newPosition(PARAM_U) * 5 + newPosition(PARAM_L);
}
}
function newPosition(ary) {
let rnd = random();
let value = 0;
for (let i = 0; i < ary.length; i++) {
value += ary[i];
if (value > rnd) return i;
}
return -1;
}
function newEffectNo() {
let effectNo;
do {
let rnd = random();
let value = 0;
for (let pos = 0; pos < NAMES_T.length; pos++) {
value += NAMES_T[pos][1];
if (value > rnd) {
effectNo = pos;
break;
}
}
} while (isRetry(effectNo));
return effectNo;
}
function random() {
return Math.floor(Math.random() * 100);
}
function parameter(pos, value) {
data[pos][PARAM_POS] = value;
}
function effect(pos, value) {
data[pos][EFFECT_POS] = value;
}
function assign(pos, value) {
data[pos][ASSIGN_POS] = value;
}
function getCost(add) {
let cost = 0;
cost += isLock(0) ? 1 : 0;
cost += isLock(1) ? 1 : 0;
cost += isLock(2) ? 1 : 0;
return cost + add;
}
function lock(pos) {
if (isLock(pos)) {
data[pos][LOCK_POS] = store[pos][LOCK_POS] = OFF;
} else if (isAssign(pos)) {
data[pos][LOCK_POS] = store[pos][LOCK_POS] = ON;
used += getCost(1);
}
view(disp);
}
function simple() {
smode = (smode == ON) ? OFF : ON;
}
function visibleControl(id, value) {
document.getElementById(id).style.display = (value) ? "inline" : "none";
}
function arrayCopy(from, to) {
for (let i = 0; i < from.length; i++) {
for (let j = 0; j < from[i].length; j++) {
to[i][j] = from[i][j];
}
}
}
function view(ctrl) {
visibleControl("btnRemodel", ctrl == INIT);
visibleControl("btnEffects", ctrl == OFF);
visibleControl("btnParameters", ctrl == OFF);
visibleControl("btnLoad", ctrl == ON);
visibleControl("btnSave", ctrl == ON);
visibleControl("viewStore", ctrl == ON);
for (let pos = 0; pos < data.length; pos++) {
let effectNo = data[pos][EFFECT_POS];
let result = NAMES_T[effectNo][NAME_POS];
let parameterNo = "";
if (effectNo != EMPTY_NO) {
parameterNo = data[pos][PARAM_POS];
result += " " + getValue(effectNo, parameterNo).toFixed(2) + "%";
}
document.getElementById("DE" + pos).value = result;
document.getElementById("DP" + pos).value = parameterNo;
document.getElementById("DL" + pos).checked = isLock(pos);
}
for (let pos = 0; pos < store.length; pos++) {
let effectNo = store[pos][EFFECT_POS];
let result = NAMES_T[effectNo][NAME_POS];
let parameterNo = "";
if (effectNo != EMPTY_NO) {
parameterNo = store[pos][PARAM_POS];
result += " " + getValue(effectNo, parameterNo).toFixed(2) + "%";
}
document.getElementById("SE" + pos).value = result;
document.getElementById("SP" + pos).value = parameterNo;
}
document.getElementById("result").innerHTML = "Retry count: " + trial + ", Use custom modules: " + used;
disp = ctrl;
}
</script>
<style type="text/css">
.effect {
text-align: center;
width: 280px;
height: 16px;
}
.parameter {
text-align: center;
width: 20px;
height: 16px;
}
table {
font-size: 12px;
border-collapse: collapse;
}
th {
background-color: aliceblue;
}
th.rowtitle {
text-align: left;
}
td {
text-align: right;
}
td.initial {
background-color: gold;
}
</style>
</head>
<body onload="view(INIT);">
<h1>Overload Gear Simulator</h1>
<div id="viewStore">
<div>
<input id="SE0" type="text" readonly="readonly" class="effect" />
<input id="SP0" type="text" readonly="readonly" class="parameter" />
</div>
<div>
<input id="SE1" type="text" readonly="readonly" class="effect" />
<input id="SP1" type="text" readonly="readonly" class="parameter" />
</div>
<div>
<input id="SE2" type="text" readonly="readonly" class="effect" />
<input id="SP2" type="text" readonly="readonly" class="parameter" />
</div>
<div> ↓ </div>
</div>
<div id="viewData">
<div>
<input id="DE0" type="text" readonly="readonly" class="effect" />
<input id="DP0" type="text" readonly="readonly" class="parameter" />
<input id="DL0" type="checkbox" onclick="lock(0)" title="Locked" />
</div>
<div>
<input id="DE1" type="text" readonly="readonly" class="effect" />
<input id="DP1" type="text" readonly="readonly" class="parameter" />
<input id="DL1" type="checkbox" onclick="lock(1)" title="Locked" />
</div>
<div>
<input id="DE2" type="text" readonly="readonly" class="effect" />
<input id="DP2" type="text" readonly="readonly" class="parameter" />
<input id="DL2" type="checkbox" onclick="lock(2)" title="Locked" />
</div>
</div>
<div>
<input id="btnRemodel" type="button" onclick="modification(true,true)" value="Equipment Modification" />
<input id="btnEffects" type="button" onclick="modification(false,true)" value="Change Effects" />
<input id="btnParameters" type="button" onclick="modification(false,false)" value="Reset Attributes" />
<input id="btnLoad" type="button" onclick="exeApply(false,OFF)" value="Keep Effects" />
<input id="btnSave" type="button" onclick="exeApply(true,OFF)" value="Change Effects" />
</div>
<hr />
<div>
<input id="btnClear" type="button" onclick="reset()" value="Initialize" />
<input id="cobSimple" type="checkbox" onclick="simple()" /><label for="cobSimple">Simple mode</label><br />
<span id="result"></span>
</div>
<hr />
<h2>Attributes (Sub-Stats)</h2>
<p>the chance for the first line is 100%<br />the chance for the second line is 50%<br />the chance for the third line is 30%</p>
<table border="1">
<tr><th rowspan="3">Attribute</th><th>Level</th>
<th>1</th><th>2</th><th>3</th><th>4</th><th>5</th>
<th>6</th><th>7</th><th>8</th><th>9</th><th>10</th>
<th>11</th><th>12</th><th>13</th><th>14</th><th>15</th>
</tr>
<tr><th rowspan="2">Probability</th><th colspan="5">60%</th>
<th colspan="5">35%</th><th colspan="5">5%</th>
</tr>
<tr><th>12%</th><th>12%</th><th>12%</th><th>12%</th><th>12%</th>
<th>7%</th><th>7%</th><th>7%</th><th>7%</th><th>7%</th>
<th>1%</th><th>1%</th><th>1%</th><th>1%</th><th>1%</th>
</tr>
<tr><th class="rowtitle">Increase Element Damage Dealt</th><th>10%</th>
<td>9.54%</td><td>10.94%</td><td>12.34%</td><td>13.75%</td><td>15.15%</td>
<td>16.55%</td><td>17.95%</td><td>19.35%</td><td>20.75%</td><td>22.15%</td>
<td class="initial">23.56%</td><td>24.96%</td><td>26.36%</td><td>27.76%</td><td>29.16%</td>
</tr>
<tr><th class="rowtitle">Increase Hit Rate</th><th>12%</th>
<td>4.77%</td><td>5.47%</td><td>6.18%</td><td>6.88%</td><td>7.59%</td>
<td>8.29%</td><td>9.00%</td><td>9.70%</td><td>10.40%</td><td>11.11%</td>
<td class="initial">11.81%</td><td>12.52%</td><td>13.22%</td><td>13.93%</td><td>14.63%</td>
</tr>
<tr><th class="rowtitle">Increase Max Ammunition Capacity</th><th>12%</th>
<td>27.84%</td><td>31.95%</td><td>36.06%</td><td>40.17%</td><td>44.28%</td>
<td>48.39%</td><td>52.50%</td><td>56.60%</td><td>60.71%</td><td>64.82%</td>
<td class="initial">68.93%</td><td>73.04%</td><td>77.15%</td><td>81.26%</td><td>85.37%</td>
</tr>
<tr><th class="rowtitle">Increase ATK</th><th>10%</th>
<td>4.77%</td><td>5.47%</td><td>6.18%</td><td>6.88%</td><td>7.59%</td>
<td>8.29%</td><td>9.00%</td><td>9.70%</td><td>10.40%</td><td>11.11%</td>
<td class="initial">11.81%</td><td>12.52%</td><td>13.22%</td><td>13.93%</td><td>14.63%</td>
</tr>
<tr><th class="rowtitle">Increase Charge Damage</th><th>12%</th>
<td>4.77%</td><td>5.47%</td><td>6.18%</td><td>6.88%</td><td>7.59%</td>
<td>8.29%</td><td>9.00%</td><td>9.70%</td><td>10.40%</td><td>11.11%</td>
<td class="initial">11.81%</td><td>12.52%</td><td>13.22%</td><td>13.93%</td><td>14.63%</td>
</tr>
<tr><th class="rowtitle">Increase Charge Speed</th><th>12%</th>
<td>1.98%</td><td>2.28%</td><td>2.57%</td><td>2.86%</td><td>3.16%</td>
<td>3.45%</td><td>3.75%</td><td>4.04%</td><td>4.33%</td><td>4.63%</td>
<td class="initial">4.92%</td><td>5.21%</td><td>5.51%</td><td>5.80%</td><td>6.09%</td>
</tr>
<tr><th class="rowtitle">Increase Critical Rate</th><th>12%</th>
<td>2.30%</td><td>2.64%</td><td>2.98%</td><td>3.32%</td><td>3.66%</td>
<td>4.00%</td><td>4.35%</td><td>4.69%</td><td>5.03%</td><td>5.37%</td>
<td class="initial">5.71%</td><td>6.05%</td><td>6.39%</td><td>6.73%</td><td>7.07%</td>
</tr>
<tr><th class="rowtitle">Increase Critical Damage</th><th>10%</th>
<td>6.64%</td><td>7.62%</td><td>8.60%</td><td>9.58%</td><td>10.56%</td>
<td>11.54%</td><td>12.52%</td><td>13.50%</td><td>14.48%</td><td>15.46%</td>
<td class="initial">16.44%</td><td>17.42%</td><td>18.40%</td><td>19.38%</td><td>20.36%</td>
</tr>
<tr><th class="rowtitle">Increase DEF</th><th>10%</th>
<td>4.77%</td><td>5.47%</td><td>6.18%</td><td>6.88%</td><td>7.59%</td>
<td>8.29%</td><td>9.00%</td><td>9.70%</td><td>10.40%</td><td>11.11%</td>
<td class="initial">11.81%</td><td>12.52%</td><td>13.22%</td><td>13.93%</td><td>14.63%</td>
</tr>
</table>
</body>
</html>