◆少前百科是非盈利性、非官方的少女前线维基百科。 ◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科。 ◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科 ◆To foreigners,You can use twitter to contact us. |
“Widget:战术人形属性”的版本间的差异
(未显示同一用户的26个中间版本) | |||
第1行: | 第1行: | ||
− | <includeonly | + | <includeonly><script> |
− | |||
− | |||
− | |||
const basic = [16, 45, 5, 5]; | const basic = [16, 45, 5, 5]; | ||
const basic_life_armor = [ | const basic_life_armor = [ | ||
[[55, .555], | [[55, .555], | ||
− | [2, .161]], | + | [2, .161]],,,,, |
[[96.283, .138], | [[96.283, .138], | ||
− | [13.979, .04]] | + | [13.979, .04]], |
+ | [[5, .05], | ||
+ | [5, .05]] | ||
]; | ]; | ||
const grow = [ | const grow = [ | ||
第20行: | 第19行: | ||
[.075, 22.572]] | [.075, 22.572]] | ||
]; | ]; | ||
+ | |||
+ | function attrMain() {} | ||
(window.RLQ=window.RLQ||[]).push(() => { | (window.RLQ=window.RLQ||[]).push(() => { | ||
const adat = $('#attr-dataset').data(); | const adat = $('#attr-dataset').data(); | ||
− | const | + | const base_attr = [[.6,.6,.8,1.2,1.8,0,1.71],[1.6,.6,1.2,.3,1.6,0,2.38],[.8,2.4,.5,1.6,.8,0,.94],[1,1,1,1,1,0,.8],[1.5,1.8,1.6,.6,.6,0,.82],[2,.7,.4,.3,.3,1,3.91]][adat.type-1]; |
adat.growing = adat.growing.split(','); | adat.growing = adat.growing.split(','); | ||
− | adat.growingMod = adat.growingMod.split(','); | + | adat.growingMod = adat.growingMod?.split(','); |
− | $('#attr-table')[0].insertAdjacentHTML('beforebegin', `<input id="lv-input" type="number" min="1" max="100" value="100"> | + | $('#attr-table')[0].insertAdjacentHTML('beforebegin', `<label>等级<input id="lv-input" type="number" min="1" max="100" value="100"></label>`); |
− | const | + | const hpTable = $('#attr-table>table')[0]; |
− | |||
− | |||
const hpRow = $('#hp-tr')[0]; | const hpRow = $('#hp-tr')[0]; | ||
− | const | + | const lvInput = $('#lv-input')[0]; |
+ | let modToggle; | ||
+ | if (adat.growingMod) { | ||
+ | lvInput.insertAdjacentHTML('afterend', `<input id="mod-toggle" type="checkbox"><label for="mod-toggle">心智升级</label>`); | ||
+ | modToggle = $('#mod-toggle'); | ||
+ | } | ||
+ | let mod = 0; | ||
lvInput.addEventListener('input', updateAttrs); | lvInput.addEventListener('input', updateAttrs); | ||
− | modToggle.on('click', toggleMod); | + | if (adat.growingMod) modToggle.on('click', toggleMod); |
+ | updateAttrs(); | ||
+ | mw.loader.using('jquery.makeCollapsible', function() { | ||
+ | $('#dollind').makeCollapsible({collapsed:true}); | ||
+ | }); | ||
− | function | + | function calcDef(lv, attr) { |
const modsuf = mod ? 'Mod' : ''; | const modsuf = mod ? 'Mod' : ''; | ||
const ratio = adat['growing'+modsuf][attr]; | const ratio = adat['growing'+modsuf][attr]; | ||
return Math.ceil( | return Math.ceil( | ||
− | (basic_life_armor[mod][attr | + | (basic_life_armor[mod][attr][0] + (lv-1)*basic_life_armor[mod][attr][1]) * base_attr[attr] * ratio / 100 |
); | ); | ||
} | } | ||
− | function calcOther(lv | + | function calcOther(lv, attr) { |
const modsuf = mod ? 'Mod' : ''; | const modsuf = mod ? 'Mod' : ''; | ||
const ratio = +adat['growing'+modsuf][attr], growth = adat['growth'+modsuf]; | const ratio = +adat['growing'+modsuf][attr], growth = adat['growth'+modsuf]; | ||
第50行: | 第59行: | ||
} | } | ||
function toggleMod() { | function toggleMod() { | ||
− | const checked = modToggle.checked; | + | const checked = modToggle[0].checked; |
+ | const attrRound = $('#attr-round'); | ||
+ | const attrCrit = $('#crit-td'); | ||
if (checked) { | if (checked) { | ||
+ | mod = 1; | ||
lvInput.max = 120; | lvInput.max = 120; | ||
lvInput.min = 100; | lvInput.min = 100; | ||
+ | attrRound.text(attrRound.data('mod')); | ||
+ | attrCrit.text(attrCrit.data('mod') + '%'); | ||
+ | $('#rate').addClass('mod'); | ||
} else { | } else { | ||
+ | mod = 0; | ||
lvInput.max = 100; | lvInput.max = 100; | ||
lvInput.min = 1; | lvInput.min = 1; | ||
+ | attrRound.text(attrRound.data('attr')); | ||
+ | attrCrit.text(attrCrit.data('attr')); | ||
+ | $('#rate').removeClass('mod'); | ||
} | } | ||
lvInput.value = 100; | lvInput.value = 100; | ||
第62行: | 第81行: | ||
} | } | ||
function updateAttrs() { | function updateAttrs() { | ||
− | const lv = lvInput.value | + | const lv = lvInput.value; |
− | if (lv > 89) | + | if (lv > 89) hpTable.className = ''; |
− | else if (lv > 69) | + | else if (lv > 69) hpTable.className = 'form4'; |
− | else if (lv > 29) | + | else if (lv > 29) hpTable.className = 'form3'; |
− | else if (lv > 9) | + | else if (lv > 9) hpTable.className = 'form2'; |
− | else | + | else hpTable.className = 'form1'; |
− | const hp1 = | + | const hp1 = calcDef(lv, 0); |
− | hpRow.children.forEach(function(e, i) { | + | [...hpRow.children].forEach(function(e, i) { |
e.textContent = hp1*(i+1); | e.textContent = hp1*(i+1); | ||
}); | }); | ||
第75行: | 第94行: | ||
if (i < 4) { | if (i < 4) { | ||
const attr = [1,3,4,2][i]; | const attr = [1,3,4,2][i]; | ||
− | this.textContent = calcOther(lv | + | this.textContent = calcOther(lv, attr); |
− | } else if (adat.type == 6) this.textContent = | + | } else if (adat.type == 6) this.textContent = calcDef(lv, 5); |
}); | }); | ||
} | } | ||
}) | }) | ||
− | </script | + | </script></includeonly><noinclude> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</noinclude> | </noinclude> |
2024年4月9日 (二) 21:24的最新版本