2022-11-23 20:26:07 +00:00
|
|
|
/**
|
2022-12-17 04:37:55 +00:00
|
|
|
* 角色天赋相关处理
|
|
|
|
* */
|
2022-09-04 21:03:23 +00:00
|
|
|
import lodash from 'lodash'
|
2022-09-03 21:08:57 +00:00
|
|
|
|
|
|
|
const CharTalent = {
|
2022-09-04 21:03:23 +00:00
|
|
|
// 处理获取天赋数据
|
2023-05-16 05:04:43 +00:00
|
|
|
getAvatarTalent (char, talent, cons, mode) {
|
2023-05-21 18:13:38 +00:00
|
|
|
let { id, talentCons, game, isGs } = char
|
2022-09-03 21:08:57 +00:00
|
|
|
let ret = {}
|
2023-05-21 18:13:38 +00:00
|
|
|
let addTalent = {
|
2023-08-15 19:51:08 +00:00
|
|
|
gs: { a: 3, e: 3, q: 3 },
|
2023-05-21 18:13:38 +00:00
|
|
|
sr: { a: 1, e: 2, q: 2, t: 2 }
|
|
|
|
}
|
|
|
|
lodash.forEach(addTalent[game], (addNum, key) => {
|
2022-09-03 21:08:57 +00:00
|
|
|
let ds = talent[key]
|
|
|
|
if (!ds) {
|
2022-10-06 19:36:24 +00:00
|
|
|
return false
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
2022-09-04 21:03:23 +00:00
|
|
|
let value
|
2022-09-03 21:08:57 +00:00
|
|
|
let level
|
2022-09-04 21:03:23 +00:00
|
|
|
let original
|
|
|
|
let aPlus = id === 10000033
|
2022-09-03 21:08:57 +00:00
|
|
|
if (lodash.isNumber(ds)) {
|
2022-09-04 21:03:23 +00:00
|
|
|
value = ds
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
2022-12-17 04:37:55 +00:00
|
|
|
if (mode !== 'level') {
|
|
|
|
// 基于original计算level
|
|
|
|
value = value || ds.original || ds.level_original || ds.level || ds.level_current
|
2023-05-21 18:13:38 +00:00
|
|
|
if (value > 10 && isGs) {
|
2022-12-17 04:37:55 +00:00
|
|
|
mode = 'level'
|
|
|
|
} else {
|
|
|
|
original = value
|
2023-05-21 18:13:38 +00:00
|
|
|
if (key === 'a' && isGs) {
|
2022-12-17 04:37:55 +00:00
|
|
|
level = aPlus ? value + 1 : value
|
|
|
|
}
|
2023-08-15 19:51:08 +00:00
|
|
|
level = (talentCons[key] > 0 && cons >= talentCons[key]) ? (value + addNum) : value
|
2022-12-17 04:37:55 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-03 21:08:57 +00:00
|
|
|
if (mode === 'level') {
|
|
|
|
// 基于level计算original
|
2022-09-04 21:03:23 +00:00
|
|
|
value = value || ds.level || ds.level_current || ds.original || ds.level_original
|
|
|
|
level = value
|
2023-05-21 18:13:38 +00:00
|
|
|
if (key === 'a' && isGs) {
|
2022-09-04 21:03:23 +00:00
|
|
|
original = aPlus ? value - 1 : value
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
2023-08-15 19:51:08 +00:00
|
|
|
original = (talentCons[key] > 0 && cons >= talentCons[key]) ? (value - addNum) : value
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
2022-09-04 21:03:23 +00:00
|
|
|
ret[key] = { level, original }
|
2022-09-03 21:08:57 +00:00
|
|
|
})
|
2022-10-07 13:13:46 +00:00
|
|
|
if (lodash.isEmpty(ret)) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return ret
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
export default CharTalent
|