From 37e5d6c21a2260e8a2a456fdb1f7240864418195 Mon Sep 17 00:00:00 2001 From: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com> Date: Sun, 21 May 2023 08:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=B0=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E5=8E=9F=E7=A5=9E=E9=9D=A2=E6=9D=BF=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/AvatarArtis.js | 11 ++--- models/ProfileArtis.js | 17 ++++--- models/profile/ArtisMark.js | 71 +++++------------------------ resources/meta-sr/character/meta.js | 2 +- 4 files changed, 25 insertions(+), 76 deletions(-) diff --git a/models/AvatarArtis.js b/models/AvatarArtis.js index 4c02f6a0..ae2fd76c 100644 --- a/models/AvatarArtis.js +++ b/models/AvatarArtis.js @@ -95,13 +95,12 @@ export default class AvatarArtis extends Base { arti.star = ds._star || ds.star || 5 arti.main = ds.main arti.attrs = ds.attrs - return true + } else { + arti.name = ds.name || arti.name || '' + arti.set = ds.set || Artifact.getSetNameByArti(arti.name) || '' + arti.level = ds.level || 1 + arti.star = ds.star || 5 } - arti.name = ds.name || arti.name || '' - arti.set = ds.set || Artifact.getSetNameByArti(arti.name) || '' - arti.level = ds.level || 1 - arti.star = ds.star || 5 - if (ds.mainId || ds.main) { arti._name = ds._name || ds.name || arti._name || arti.name arti._set = ds._set || Artifact.getSetNameByArti(arti._name) || arti._set || '' diff --git a/models/ProfileArtis.js b/models/ProfileArtis.js index a02bbf4f..439caec6 100644 --- a/models/ProfileArtis.js +++ b/models/ProfileArtis.js @@ -67,15 +67,16 @@ export default class ProfileArtis extends AvatarArtis { let artis = {} let setCount = {} let totalMark = 0 - let totalCrit = 0 - let totalVaild = 0 + let self = this this.forEach((arti, idx) => { - let mark = ArtisMark.getMark(charCfg, idx, arti.main, arti.attrs, this.elem) - // let crit = ArtisMark.getCritMark(charCfg, idx, arti.main, arti.attrs, this.elem) - // let vaild = ArtisMark.getValidMark(charCfg, idx, arti.main, arti.attrs, this.elem) + let mark = ArtisMark.getMark({ + charCfg, + idx, + arti, + elem: this.elem, + game: self.game + }) totalMark += mark - // totalCrit += crit - // totalVaild += vaild setCount[arti.set] = (setCount[arti.set] || 0) + 1 if (!withDetail) { artis[idx] = { @@ -85,8 +86,6 @@ export default class ProfileArtis extends AvatarArtis { } } else { let artifact = Artifact.get(arti.name, this.game) - // console.log('artifact', artifact, arti) - // console.log(`arti idx ${idx} ${artifact.name}\n\n\n`) artis[idx] = { name: artifact.name, set: artifact.setName, diff --git a/models/profile/ArtisMark.js b/models/profile/ArtisMark.js index af4d2033..d0ff9f33 100644 --- a/models/profile/ArtisMark.js +++ b/models/profile/ArtisMark.js @@ -111,22 +111,27 @@ let ArtisMark = { }, // 获取位置分数 - getMark (charCfg, posIdx, mainAttr, subAttr, elem = '') { + getMark ({ charCfg, idx, arti, elem = '', game = 'gs' }) { + if (game === 'sr') { + return 0 + } let ret = 0 + let mainAttr = arti.main + let subAttr = arti.attrs let { attrs, posMaxMark } = charCfg let key = mainAttr?.key if (!key) { return 0 } let fixPct = 1 - posIdx = posIdx * 1 - if (posIdx >= 3) { + idx = idx * 1 + if (idx >= 3) { let mainKey = key if (key !== 'recharge') { - if (posIdx === 4 && Format.isElem(key) && key === elem) { + if (idx === 4 && Format.isElem(key) && key === elem) { mainKey = 'dmg' } - fixPct = Math.max(0, Math.min(1, (attrs[mainKey]?.weight || 0) / (posMaxMark['m' + posIdx]))) + fixPct = Math.max(0, Math.min(1, (attrs[mainKey]?.weight || 0) / (posMaxMark['m' + idx]))) } ret += (attrs[mainKey]?.mark || 0) * (mainAttr.value || 0) / 4 } @@ -134,61 +139,7 @@ let ArtisMark = { lodash.forEach(subAttr, (ds) => { ret += (attrs[ds.key]?.mark || 0) * (ds.value || 0) }) - return ret * (1 + fixPct) / 2 / posMaxMark[posIdx] * 66 - }, - - getCritMark (charCfg, posIdx, mainAttr, subAttr, elem = '') { - let ret = 0 - let { attrs, posMaxMark } = charCfg - let key = mainAttr?.key - if (!key) { - return 0 - } - let fixPct = 1 - posIdx = posIdx * 1 - if (posIdx >= 4) { - let mainKey = key - if (posIdx === 4 && Format.isElem(key) && key === elem) { - mainKey = 'dmg' - } - fixPct = Math.max(0, Math.min(1, (attrs[mainKey]?.weight || 0) / (posMaxMark['m' + posIdx]))) - } - if (key === 'cpct' || key === 'cdmg') { - ret += 9.41 - } - - lodash.forEach(subAttr, (ds) => { - if (ds.key === 'cpct' || ds.key === 'cdmg') { - let temp_s = (attrs[ds.key]?.mark || 0) * (ds.value || 0) / 85 - ret += temp_s - } - }) - return ret - }, - - getValidMark (charCfg, posIdx, mainAttr, subAttr, elem = '') { - let ret = 0 - let { attrs, posMaxMark } = charCfg - let key = mainAttr?.key - if (!key) { - return 0 - } - let fixPct = 1 - posIdx = posIdx * 1 - if (posIdx >= 4) { - let mainKey = key - if (posIdx === 4 && Format.isElem(key) && key === elem) { - mainKey = 'dmg' - } - - - fixPct = Math.max(0, Math.min(1, (attrs[mainKey]?.weight || 0) / (posMaxMark['m' + posIdx]))) - } - lodash.forEach(subAttr, (ds) => { - let temp_s = (attrs[ds.key]?.mark || 0) * (ds.value || 0) / 85 - ret += temp_s - }) - return ret + return ret * (1 + fixPct) / 2 / posMaxMark[idx] * 66 }, // 获取位置最高分 diff --git a/resources/meta-sr/character/meta.js b/resources/meta-sr/character/meta.js index 87ab486d..1bf9b9cd 100644 --- a/resources/meta-sr/character/meta.js +++ b/resources/meta-sr/character/meta.js @@ -2,7 +2,7 @@ import lodash from 'lodash' let alias = { 三月七: '三月,相遇之缘,37,3月7', - 丹恒: '冷面,小青龙,冷面小青龙,单恒', + 丹恒: '单恒,单桓,冷面,小青龙,冷面小青龙', 佩拉: '佩菈', 停云: '', 克拉拉: '',