-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
430 lines (410 loc) · 12.8 KB
/
index.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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<html>
<head>
<title>ダンメモ ダメージ計算ツール</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<link rel="icon" href="icon.png" type="image/ico"/>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor=36393F>
<!--
ref:<a href=https://forum.gamer.com.tw/Co.php?bsn=31981&sn=21899 target=_blank>【心得】傷害計算方式 - 3/11 </a>
-->
<script>
var skill_rate = {
target_counter:{
type_p:2,
type_m:1.5
},
target_single:{
power_1:3,
power_2:3.4,
power_3:3.8,
power_4:4.2,
power_5:8
},
target_multi:{
power_1:2.2,
power_2:2.3,
power_3:2.4,
power_4:2.8,
power_5:7.2
}
}
var powerup_rate = {
powerup_1:{
target_single:{
power_1:1,
power_2:1,
power_3:1,
power_4:1,
power_5:1
},
target_multi:{
power_1:1,
power_2:1,
power_3:1,
power_4:1,
power_5:1
}
},
powerup_2:{
target_single:{
power_1:1,
power_2:1.2,
power_3:1.3,
power_4:1.3,
power_5:1.4
},
target_multi:{
power_1:1,
power_2:1.4,
power_3:1.4,
power_4:1.4,
power_5:1.4
}
},
powerup_3:{
target_single:{
power_1:1,
power_2:1,
power_3:1.6,
power_4:1.6,
power_5:1.7
},
target_multi:{
power_1:1,
power_2:1,
power_3:1,
power_4:1,
power_5:1.7
}
}
}
var combo_rate ={
combo_0:1,
combo_1:1,
combo_2:1.2,
combo_3:1.4,
combo_4:1.6
}
function changeTarget(){
var target = document.getElementById("target").value === 'target_counter';
document.getElementById('power').disabled = target;
document.getElementById('powerup').disabled = target;
document.getElementById('affect').disabled = target;
document.getElementById('affect_count').disabled = target;
};
var debuff = 0;
var debuff_tar = 0;
function damageCalculator() {
var atk,buff_rate;
var guard_rate,crit_rate;
var base_atk,atk_rate_base,atk_rate_adv,killer_rate,base_dmg;
var affect_rate,element_rate,debuff_rate,debuff_tar_rate;
var skill_typel = document.getElementById("skill_type").value;
if(skill_typel === 'type_p'){
atk = document.getElementById("atk_p").value || 0;
buff_rate = (document.getElementById("buff_p").value || 0)/100 + 1;
debuff = document.getElementById("debuff_p").value || 0;
}
else {
atk = document.getElementById("atk_m").value || 0;
buff_rate = (document.getElementById("buff_m").value || 0)/100 + 1;
debuff = document.getElementById("debuff_m").value || 0;
}
// base attack
killer_rate = (document.getElementById("killer").value || 0)/100 + 1;
base_atk = Math.floor(Math.floor(atk * buff_rate) * killer_rate);
var target = document.getElementById("target").value;
var skill_power = document.getElementById("power").value;
var skill_powerup = document.getElementById("powerup").value;
if(target === 'target_counter'){
atk_rate_base = skill_rate[target][skill_typel];
atk_rate_adv = 1;
}
else{
if(target === 'target_single') {
debuff_tar = document.getElementById("debuff_st").value;
}
else {
debuff_tar = document.getElementById("debuff_sm").value;
}
atk_rate_base = skill_rate[target][skill_power] +
(document.getElementById("specila_event-0").checked ? 0.1 : 0);
atk_rate_adv = powerup_rate[skill_powerup][target][skill_power];
}
base_atk = Math.floor(base_atk * atk_rate_adv);
// base damage
base_dmg = (base_atk - enemyDefence(false)) * atk_rate_base;
base_dmg_pene = (base_atk - enemyDefence(true)) * atk_rate_base;
// scale damage
var final_damage;
if(document.getElementById("atk_event-1").checked){
final_damage = scaleDamage(base_dmg_pene,document.getElementById("atk_event-0").checked,true);
}
else{
final_damage = scaleDamage(base_dmg,document.getElementById("atk_event-0").checked,false);
}
// random damage
console.log(Math.floor(final_damage * document.getElementById("random").value))
// random damage table
var damage_scale = [
scaleDamage(base_dmg,false,false),
scaleDamage(base_dmg,true,false),
scaleDamage(base_dmg_pene,false,true),
scaleDamage(base_dmg_pene,true,true)
];
var randomDamage = [];
for(var i = 96; i < 105; i++)
{
damage = [
Math.floor(damage_scale[0] * i / 100),
Math.floor(damage_scale[1] * i / 100),
Math.floor(damage_scale[2] * i / 100),
Math.floor(damage_scale[3] * i / 100)
]
randomDamage.push(damage);
}
drawTable(randomDamage);
};
function enemyDefence(is_pene){
var pene_rate = is_pene ? 0.5 : 1;
var enemy_def_debuff = (document.getElementById("enemy_def_debuff").value || 0)/100*-1 + 1;
return Math.floor(Math.floor((document.getElementById("enemy_def").value || 0) * enemy_def_debuff) * pene_rate) / 2;
};
function scaleDamage(base_dmg,is_crit, is_pene){
//guard_scale
var affect_rate = (document.getElementById("affect").value * document.getElementById("affect_count").value)/100 + 1;
var element_rate = (document.getElementById("buff_e").value/100 + document.getElementById("buff_fe").value/100) + 1;
var debuff_rate = (document.getElementById("debuff_e").value/100 + debuff/100)*-1 + 1;
var debuff_tar_rate = (debuff_tar/100)*-1 + 1;
var other_rate=0;
var crit_rate = is_crit ? 1.5 : 1;
if(is_crit) {
other_rate += document.getElementById("ability_crit").value/100;
other_rate += document.getElementById("reform_crit").value/100;
}
if(is_pene) {
other_rate += document.getElementById("ability_pene").value/100;
other_rate += document.getElementById("reform_pene").value/100;
}
other_rate = other_rate + 1;
var guard_rate = document.getElementById("atk_event-2").checked ? 0.5 : 1;
return base_dmg * affect_rate * element_rate * debuff_rate * debuff_tar_rate * other_rate * guard_rate * combo_rate[document.getElementById("combo").value] * crit_rate;
};
function drawTable(tableData) {
var table = document.getElementById('result_table');
var tableBody = document.createElement('tbody');
var random = -4;
old_tbody = document.getElementById('result_tbody');
table.style.display = "table";
tableBody.id = 'result_tbody';
tableData.forEach(function(rowData) {
var row = document.createElement('tr');
var cell = document.createElement('td');
cell.appendChild(document.createTextNode(random++ + '%'));
row.appendChild(cell);
rowData.forEach(function(cellData) {
var cell = document.createElement('td');
cell.appendChild(document.createTextNode(cellData));
row.appendChild(cell);
});
tableBody.appendChild(row);
});
old_tbody.parentNode.replaceChild(tableBody, old_tbody)
};
</script>
<form name=calcutor>
<ul class="form-style-1">
<li><label class="field-header">ステータス</label></li>
<li>
<ul>
<label for="atk_p">物攻</label>
<input type="number" name="atk_p" id="atk_p">
</ul>
<ul>
<label for="atk_m">魔攻</label>
<input type="number" name="atk_m" id="atk_m">
</ul>
<ul>
<label for="killer">キラー</label>
<input type="number" name="killer" id="killer">
</ul>
</li>
<li><label class="field-header">スキル</label></li>
<li>
<ul>
<label for="skill_type">タイプ</label>
<select class="field-select" name="skill_type" id="skill_type">
<option value="type_p" selected="true" id="skill_type-0">物理</option>
<option value="type_m" id="skill_type-1">魔法</option>
</select>
</ul>
<ul>
<label for="target">対象</label>
<select class="field-select" name="target" id="target" onchange=changeTarget()>
<option value="target_single" selected="true" id="target-0">単体</option>
<option value="target_multi" id="target-1">全体</option>
<option value="target_counter" id="target-2">カウンター</option>
</select>
</ul>
<ul>
<label for="power">威力</label>
<select class="field-select" name="power" id="power">
<option value="power_1" selected="true" id="power-0">弱</option>
<option value="power_2" id="power-1">中</option>
<option value="power_3" id="power-2">強</option>
<option value="power_4" id="power-3">超</option>
<option value="power_5" id="power-4">超強</option>
</select>
</ul>
<ul>
<label for="powerup">発動上昇</label>
<select class="field-select" name="powerup" id="powerup">
<option value="powerup_1" selected="true" id="powerup-0">無し</option>
<option value="powerup_2" id="powerup-1">上昇</option>
<option value="powerup_3" id="powerup-2">大上昇</option>
</select>
</ul>
<ul>
<label for="affect">効果1つ威力上昇</label>
<input type="number" style="width:70px;" name="affect" id="affect">
✕
<input type="number" style="width:70px;" name="affect_count" id="affect_count">
</ul>
</li>
<li><label class="field-header">攻撃イベント</label></li>
<li>
<ul>
<label for="combo">必殺Combo</label>
<select class="field-select" name="combo" id="combo">
<option value="combo_0" selected="true" id="combo-0">無し</option>
<option value="combo_1" id="combo-1">1</option>
<option value="combo_2" id="combo-2">2</option>
<option value="combo_3" id="combo-3">3</option>
<option value="combo_4" id="combo-4">4</option>
</select>
</ul>
<input name="atk_event[]" id="atk_event-0" value="atk_event_crit" type="checkbox">
<label for="atk_event-0">クリティカル</label>
<input name="atk_event[]" id="atk_event-1" value="atk_event_pene" type="checkbox">
<label for="atk_event-1">ペネトレーション</label>
<input name="atk_event[]" id="atk_event-2" value="atk_event_guard" type="checkbox">
<label for="atk_event-2">ガード</label>
</li>
<li><label class="field-header">バフ</label></li>
<li>
<ul>
<label for="buff_p">力バフ</label>
<input type="number" name="buff_p" id="buff_p">
</ul>
<ul>
<label for="buff_m">魔バフ</label>
<input type="number" name="buff_m" id="buff_m">
</ul>
<ul>
<label for="buff_e">属性ダメ</label>
<input type="number" name="buff_e" id="buff_e">
</ul>
<ul>
<label for="buff_fe">ファミリア属性ダメ</label>
<input type="number" name="buff_fe" id="buff_fe">
</ul>
</li>
<li><label class="field-header">デバフ</label></li>
<li>
<ul>
<label for="debuff_p">物理耐性</label>
<input type="number" name="debuff_p" id="debuff_p">
</ul>
<ul>
<label for="debuff_m">魔法耐性</label>
<input type="number" name="debuff_m" id="debuff_m">
</ul>
<ul>
<label for="debuff_e">属性耐性</label>
<input type="number" name="debuff_e" id="debuff_e">
</ul>
<ul>
<label for="debuff_st">単体被ダメ</label>
<input type="number" name="debuff_st" id="debuff_st">
</ul>
<ul>
<label for="debuff_sm">全体被ダメ</label>
<input type="number" name="debuff_sm" id="debuff_sm">
</ul>
</li>
<li><label class="field-header">発展アビリティ</label></li>
<li>
<ul>
<label for="ability_pene">ペネX%ダメ上昇</label>
<input type="number" name="ability_pene" id="ability_pene">
</ul>
<ul>
<label for="ability_crit">クリX%ダメ上昇</label>
<input type="number" name="ability_crit" id="ability_crit">
</ul>
</li>
<li><label class="field-header">装備革新</label></li>
<li>
<ul>
<label for="reform_pene">ペネX%ダメ上昇</label>
<input type="number" name="reform_pene" id="reform_pene">
</ul>
<ul>
<label for="reform_crit">クリX%ダメ上昇</label>
<input type="number" name="reform_crit" id="reform_crit">
</ul>
</li>
<li><label class="field-header">敵ステータス</label></li>
<li>
<ul>
<label for="enemy_def">防御</label>
<input type="number" name="enemy_def" id="enemy_def" value="100">
</ul>
<ul>
<label for="enemy_def_debuff">耐久デバフ</label>
<input type="number" name="enemy_def_debuff" id="enemy_def_debuff">
</ul>
</li>
<li><label class="field-header">その他</label></li>
<li>
<ul>
<label for="random">ランダム</label>
<select class="field-select" name="combo" id="random">
<option value="0.96" id="random-0">-4%</option>
<option value="0.97" id="combo-1">-3%</option>
<option value="0.98" id="combo-2">-2%</option>
<option value="0.99" id="combo-3">-1%</option>
<option value="1" selected="true" id="combo-4">0%</option>
<option value="1.01" id="combo-5">1%</option>
<option value="1.02" id="combo-6">2%</option>
<option value="1.03" id="combo-7">3%</option>
<option value="1.04" id="combo-8">4%</option>
</select>
</ul>
<ul>
<input name="specila_event[]" id="specila_event-0" value="specila_event_0" type="checkbox">
<label for="specila_event-0">三年目バレンタインデー以降キャラ</label>
</ul>
</li>
<li class="field-submit">
<input type="button" value="計算" onclick=damageCalculator() />
</li>
</ul>
</form>
<table id="result_table" style="display:none">
<thead>
<tr>
<th >ランダム</th>
<th >-</th>
<th >クリ</th>
<th >ペネ</th>
<th >クリペネ</th>
</tr>
</thead>
<tbody id="result_tbody">
</tbody>
</table>
</body>
</html>