修正enka数据源更新dmg修正的异常

This commit is contained in:
Kokomi 2022-09-09 10:49:31 +08:00
parent 42521f37d4
commit d3d23da1e5

View File

@ -33,7 +33,7 @@ const attrMap = {
}
let EnkaData = {
getProfile (data) {
getProfile(data) {
let char = Character.get(data.avatarId)
let profile = new ProfileData({ id: char.id })
profile.setBasic({
@ -54,7 +54,7 @@ let EnkaData = {
}
return EnkaData.dataFix(profile)
},
getAttr (data) {
getAttr(data) {
let ret = {}
let attrKey = {
// atk: 2001,
@ -105,7 +105,7 @@ let EnkaData = {
return ret
},
getArtifact (data) {
getArtifact(data) {
let ret = {}
let get = function (d) {
@ -144,7 +144,7 @@ let EnkaData = {
})
return ret
},
getWeapon (data) {
getWeapon(data) {
let ds = {}
lodash.forEach(data, (temp) => {
if (temp.flat && temp.flat.itemType === 'ITEM_WEAPON') {
@ -161,7 +161,7 @@ let EnkaData = {
affix: (lodash.values(weapon.affixMap)[0] || 0) + 1
}
},
getTalent (charid, ds = {}) {
getTalent(charid, ds = {}) {
let char = Character.get(charid)
let { talentId = {}, talentElem = {}, talentKey = {} } = char.meta
let elem = ''
@ -185,7 +185,7 @@ let EnkaData = {
talent: ret
}
},
dataFix (ret) {
dataFix(ret) {
if (ret._fix) {
return ret
}
@ -209,7 +209,9 @@ let EnkaData = {
}
let { name, affix } = weapon
// 修正武器的加伤
attr.dmg = Math.max(0, attr.dmg - wDmg[name] - wDmg[name] * (affix - 1) / 4)
if (wDmg[name]) {
attr.dmg = Math.max(0, attr.dmg - wDmg[name] - wDmg[name] * (affix - 1) / 4)
}
ret._fix = true
return ret
}