修正新格式下原神面板查看的问题

This commit is contained in:
Kokomi 2023-05-21 08:57:31 +08:00
parent af3cb93b25
commit 37e5d6c21a
4 changed files with 25 additions and 76 deletions

View File

@ -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 || ''

View File

@ -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,

View File

@ -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
},
// 获取位置最高分

View File

@ -2,7 +2,7 @@ import lodash from 'lodash'
let alias = {
三月七: '三月,相遇之缘,37,3月7',
丹恒: '冷面,小青龙,冷面小青龙,单恒',
丹恒: '单恒,单桓,冷面,小青龙,冷面小青龙',
佩拉: '佩菈',
停云: '',
克拉拉: '',