link to automatically set char stats from levels

This commit is contained in:
tmont 2021-03-18 21:59:34 -07:00
parent f8355450a4
commit 2ef0919097
2 changed files with 29 additions and 1 deletions

View File

@ -346,6 +346,21 @@
});
});
$('.apply-level-stats').on('click', (e) => {
e.preventDefault();
const data = $(e.target).data();
Object.keys(data).forEach((stat) => {
switch (stat) {
case 'power':
case 'guard':
case 'magic':
case 'speed':
$(`#char-${stat}`).val(data[stat]);
break;
}
});
});
const $enemyInfoModal = $('#enemy-info-modal');
if ($enemyInfoModal.length) {
let rowData;

View File

@ -26,7 +26,20 @@ block tab-content
while level < 80
mixin calcCharStats(char)
code= char.initial.map((x, i) => Math.min(i < 4 ? 999 : 255, x + (char.level[i] * (level - 1)))).join('/')
- const values = char.initial.map((x, i) => Math.min(i < 4 ? 999 : 255, x + (char.level[i] * (level - 1))))
code: a.apply-level-stats(
href="#"
data-hp=values[0]
data-mp=values[1]
data-power=values[2]
data-guard=values[3]
data-magic=values[4]
data-speed=values[5]
)
= values.slice(0, 2).join('/')
= ' '
= values.slice(2).join('/')
tr
td= ++level
td: +calcCharStats(esuna)