diff --git a/CHANGELOG.md b/CHANGELOG.md index fea6479a..43226207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.3.1 + +* `#角色面板` 伤害计算新增部分角色 + * 目前支持:雷神、胡桃、魈、神子、甘雨、宵宫、公子、绫人、绫华、心海 + # 1.3.0 * 增加 `#雷神伤害` 功能 diff --git a/components/Calc.js b/components/Calc.js index 16cbd370..f1f0d80e 100644 --- a/components/Calc.js +++ b/components/Calc.js @@ -138,13 +138,14 @@ let Calc = { lodash.forEach(char.talent[key].tables, (tr) => { let val = tr.values[lv - 1]; val = val.replace(/[^\x00-\xff]/g, "").trim(); - - let valArr = []; + let valArr = [], valArr2 = []; lodash.forEach(val.split("/"), (v, idx) => { let valNum = 0; lodash.forEach(v.split("+"), (v) => { v = v.split("*") - valNum += v[0].replace("%", "").trim() * (v[1] || 1); + let v1 = v[0].replace("%", "").trim(); + valNum += v1 * (v[1] || 1); + valArr2.push(v1) }) valArr.push(valNum); }); @@ -156,6 +157,7 @@ let Calc = { } else { map[tr.name] = valArr; } + map[tr.name + "2"] = valArr2; }) ret[key] = map; }) @@ -205,7 +207,7 @@ let Calc = { let title = buff.title; if (buff.mastery) { - let mastery = attr.mastery.base + attr.mastery.plus; + let mastery = Math.max(0, attr.mastery.base + attr.mastery.plus); let masteryNum = 2.78 * mastery / (mastery + 1400) * 100; buff.data = buff.data || {}; lodash.forEach(buff.mastery.split(","), (key) => { @@ -312,6 +314,7 @@ let Calc = { }, getDmgFn({ attr, avatar, enemyLv }) { + return function (pctNum = 0, talent = false, ele = false) { let { atk, dmg, cdmg, cpct } = attr; // 攻击区 @@ -335,11 +338,12 @@ let Calc = { let enemyDef = attr.enemy.def / 100; let enemyIgnore = attr.enemy.ignore / 100; - pctNum = pctNum / 100; let plusNum = 0; if (talent && attr[talent]) { + pctNum = pctNum / 100; + let ds = attr[talent]; pctNum += ds.pct / 100; dmgNum += ds.dmg / 100; @@ -379,10 +383,18 @@ let Calc = { cdmgNum = 0; } - // 计算最终伤害 - let ret = { - dmg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum, - avg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum + let ret = {}; + if (talent === "dmgRet") { + ret = { + dmg: pctNum * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum, + avg: pctNum * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum + } + } else { + // 计算最终伤害 + ret = { + dmg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum, + avg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum + } } // console.log(attr, { atkNum, pctNum, multiNum, plusNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum, kNum }, ret) @@ -436,8 +448,15 @@ let Calc = { } let dmg = Calc.getDmgFn({ attr, avatar, enemyLv }), basicDmgRet; - if (detail.dmg) { - basicDmgRet = detail.dmg({ attr, talent }, dmg); + let ds = lodash.merge({ talent }, Calc.getDs(attr, meta, params)); + + if (detail.dmg || detail.heal) { + basicDmgRet = detail.dmg ? detail.dmg(ds, dmg) : detail.heal(ds, function (num) { + let { attr, calc } = ds; + return { + avg: num * (1 + calc(attr.heal) / 100) + } + }); detail.userIdx = detailMap.length; detailMap.push(detail); ret.push({ @@ -478,8 +497,15 @@ let Calc = { } let { attr } = Calc.calcAttr(originalAttr, buffs, meta, params, incAttr, reduceAttr); let dmg = Calc.getDmgFn({ attr, avatar, enemyLv }); - if (detail.dmg) { - let dmgCalcRet = detail.dmg({ attr, talent }, dmg); + let ds = lodash.merge({ talent }, Calc.getDs(attr, meta, params)); + + if (detail.dmg || detail.heal) { + let dmgCalcRet = detail.dmg ? detail.dmg(ds, dmg) : detail.heal(ds, function (num) { + let { attr, calc } = ds; + return { + avg: num * (1 + calc(attr.heal) / 100) + } + }); rowData.push({ type: dmgCalcRet.avg === basicDmg.avg ? "avg" : (dmgCalcRet.avg > basicDmg.avg ? "gt" : "lt"), ...dmgCalcRet diff --git a/resources/character/detail.css b/resources/character/detail.css index c91ecbe2..c5fe6dfe 100644 --- a/resources/character/detail.css +++ b/resources/character/detail.css @@ -372,6 +372,15 @@ body { box-shadow: 0 0 1px 0 #fff; } +.dmg-cont .tr > div.value-full { + display: table; + width: 200%; +} + +.dmg-cont .tr > div.value-none { + box-shadow: none; +} + .dmg-cont .thead { text-align: center; } diff --git a/resources/character/detail.html b/resources/character/detail.html index a488bd91..be50b4b8 100644 --- a/resources/character/detail.html +++ b/resources/character/detail.html @@ -64,8 +64,13 @@
{{idx+1}}
{{dmg.title}}
+ {{if dmg.dmg === "NaN"}} +
{{dmg.avg}}
+
+ {{else}}
{{dmg.dmg}}
{{dmg.avg}}
+ {{/if}}
{{/each}} @@ -123,7 +128,7 @@ {{if dmgCfg && dmgCfg.attr && dmgCfg.attr.length>0}}
- 词条伤害计算#{{name}}伤害{{dmgCfg.userIdx+1}}: 当前计算为[{{dmgCfg.title}}]的 平均伤害 + 词条伤害计算#{{name}}伤害{{dmgCfg.userIdx+1}}: 当前计算为[{{dmgCfg.title}}]
@@ -145,12 +150,13 @@ {{if cell.type === "na"}}
- - {{dmgCfg.basicRet.avg}}/{{dmgCfg.basicRet.dmg}} + {{dmgCfg.basicRet.avg}}{{dmgCfg.basicRet.dmg!="NaN"?`/${dmgCfg.basicRet.dmg}`:''}}
{{else}}
{{cell.val}} - {{cell.avg}}/{{cell.dmg}} + + {{cell.avg}}{{cell.dmg!="NaN"?`/${cell.dmg}`:''}}
{{/if}} {{/each}} @@ -160,7 +166,7 @@