From a75ed26a8acb818e5b5c2b29041a8e97d3add7cf Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Wed, 17 Aug 2022 10:37:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0miaoApi=E5=A4=A9=E8=B5=8B?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Calc.js | 20 +++++++++++++++----- components/profile-data/miao.js | 7 ++++--- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/components/Calc.js b/components/Calc.js index 1e725caf..29a2b978 100644 --- a/components/Calc.js +++ b/components/Calc.js @@ -12,7 +12,12 @@ let Calc = { const _path = process.cwd() const cfgPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/calc.js` - let details; let buffs = []; let defParams = {}; let defDmgIdx = -1; let mainAttr = 'atk,cpct,cdmg'; let enemyName = '小宝' + let details + let buffs = [] + let defParams = {} + let defDmgIdx = -1 + let mainAttr = 'atk,cpct,cdmg' + let enemyName = '小宝' if (fs.existsSync(cfgPath)) { let fileData = await import(`file://${cfgPath}`) details = fileData.details || false @@ -131,14 +136,15 @@ let Calc = { lodash.forEach(['a', 'e', 'q'], (key) => { let td = talentData[key] || {} - let lv = td.level_current * 1 || 1 + let lv = td.level || td.level_current * 1 || 1 let map = {} lodash.forEach(char.talent[key].tables, (tr) => { let val = tr.values[lv - 1] val = val.replace(/[^\x00-\xff]/g, '').trim() - let valArr = []; let valArr2 = [] + let valArr = [] + let valArr2 = [] lodash.forEach(val.split('/'), (v, idx) => { let valNum = 0 lodash.forEach(v.split('+'), (v) => { @@ -378,7 +384,8 @@ let Calc = { } // 反应区 - let eleNum = 1; let eleBase = 0 + let eleNum = 1 + let eleBase = 0 if (ele === 'ks' || ele === 'gd') { eleBase = eleBaseDmg[lv] || 0 @@ -480,7 +487,10 @@ let Calc = { let { msg } = Calc.calcAttr({ originalAttr, buffs, meta, params: defParams || {} }) - let ret = []; let detailMap = []; let dmgRet = []; let dmgDetail = {} + let ret = [] + let detailMap = [] + let dmgRet = [] + let dmgDetail = {} lodash.forEach(details, (detail, detailSysIdx) => { if (lodash.isFunction(detail)) { diff --git a/components/profile-data/miao.js b/components/profile-data/miao.js index 97f5b0b7..0f99d8e1 100644 --- a/components/profile-data/miao.js +++ b/components/profile-data/miao.js @@ -78,7 +78,7 @@ let Miao = { weapon: Miao.getWeapon(ds.weapon), artis: Miao.getArtifact(ds.reliquary), cons: ds.constellationNum || 0, - talent: Miao.getTalent(char.id, ds.skill), + talent: Miao.getTalent(char.id, ds.skill, ds.constellationNum || 0), _priority: 10 } return Miao.dataFix(ret) @@ -176,7 +176,7 @@ let Miao = { }) return ret }, - getTalent (charid, data = {}) { + getTalent (charid, data = {}, cons = 0) { let cm = cmeta[charid] || {} let cn = cm.Skills || {} let idx = 1 @@ -193,7 +193,8 @@ let Miao = { level: ds.level } }) - return ret + let char = Character.get(charid) + return char.getAvatarTalent(ret, cons) }, getName ({ uid, diyCfg, sysCfg }) { return 'MiaoApi'