2022-10-06 19:36:24 +00:00
|
|
|
|
import lodash from 'lodash'
|
2023-10-19 07:46:08 +00:00
|
|
|
|
import ArtisMark from './ArtisMark.js'
|
2023-10-21 18:54:45 +00:00
|
|
|
|
import { Meta } from '#miao'
|
2022-11-23 20:26:07 +00:00
|
|
|
|
|
2023-10-18 19:53:48 +00:00
|
|
|
|
const weaponCfg = {
|
|
|
|
|
磐岩结绿: {
|
|
|
|
|
attr: 'hp',
|
2024-10-10 09:52:47 +00:00
|
|
|
|
abbr: '绿剑',
|
|
|
|
|
max: 30,
|
|
|
|
|
min: 15
|
2023-10-18 19:53:48 +00:00
|
|
|
|
},
|
|
|
|
|
猎人之径: {
|
|
|
|
|
attr: 'mastery'
|
|
|
|
|
},
|
|
|
|
|
薙草之稻光: {
|
|
|
|
|
attr: 'recharge',
|
|
|
|
|
abbr: '薙刀'
|
|
|
|
|
},
|
|
|
|
|
护摩之杖: {
|
|
|
|
|
attr: 'hp',
|
2024-10-10 09:52:47 +00:00
|
|
|
|
abbr: '护摩',
|
|
|
|
|
max: 18,
|
|
|
|
|
min: 10
|
2023-10-18 19:53:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-18 13:19:12 +00:00
|
|
|
|
const ArtisMarkCfg = {
|
2023-10-19 07:46:08 +00:00
|
|
|
|
getCharArtisCfg (profile) {
|
2023-10-21 18:54:45 +00:00
|
|
|
|
let { attr, weapon, elem, char, artis, game } = profile
|
2023-05-29 19:42:13 +00:00
|
|
|
|
let { isGs } = char
|
2023-10-21 18:54:45 +00:00
|
|
|
|
let { usefulAttr } = Meta.getMeta(game, 'arti')
|
2023-05-29 19:42:13 +00:00
|
|
|
|
|
2022-09-10 19:59:45 +00:00
|
|
|
|
let rule = function (title, attrWeight) {
|
|
|
|
|
return {
|
|
|
|
|
title,
|
|
|
|
|
attrWeight
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let def = function (attrWeight) {
|
2022-09-14 19:31:10 +00:00
|
|
|
|
let title = []
|
2023-05-29 19:42:13 +00:00
|
|
|
|
|
2023-10-14 11:09:45 +00:00
|
|
|
|
let weight = lodash.extend({}, attrWeight || usefulAttr[char.name] || {})
|
2022-09-14 19:31:10 +00:00
|
|
|
|
let check = (key, max = 75, maxPlus = 75, isWeapon = true) => {
|
|
|
|
|
let original = weight[key] || 0
|
|
|
|
|
if (original < max) {
|
|
|
|
|
let plus = isWeapon ? maxPlus * (1 + weapon.affix / 5) / 2 : maxPlus
|
|
|
|
|
weight[key] = Math.min(Math.round(original + plus), max)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
2023-05-29 19:42:13 +00:00
|
|
|
|
|
2024-10-10 09:52:47 +00:00
|
|
|
|
/* maxAffix_attr 精5武器权重
|
|
|
|
|
minAffix_attr 精1武器权重 */
|
|
|
|
|
let weaponCheck = (key, maxAffix_attr = 20, minAffix_attr = 10, max = 100) => {
|
|
|
|
|
let original = weight[key] || 0
|
|
|
|
|
if (original == max) {
|
|
|
|
|
return false
|
|
|
|
|
} else {
|
|
|
|
|
let plus = minAffix_attr + (maxAffix_attr - minAffix_attr) * (weapon.affix - 1) / 4
|
|
|
|
|
weight[key] = Math.min(Math.round(original + plus), max)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-28 18:49:36 +00:00
|
|
|
|
let wn = weapon?.name || ''
|
2022-09-14 19:31:10 +00:00
|
|
|
|
|
2023-05-29 19:42:13 +00:00
|
|
|
|
if (isGs) {
|
|
|
|
|
// 对原神一些特殊情况做适配与判定
|
|
|
|
|
|
|
|
|
|
// 增加攻击力或直接伤害类武器判定
|
|
|
|
|
if (weight.atk > 0 && weaponCfg[wn]) {
|
|
|
|
|
let wCfg = weaponCfg[wn]
|
2024-10-10 09:52:47 +00:00
|
|
|
|
if (weaponCheck(wCfg.attr, wCfg.max || 20, wCfg.min || 10)) {
|
2023-05-29 19:42:13 +00:00
|
|
|
|
title.push(wCfg.abbr || wn)
|
|
|
|
|
}
|
2022-09-14 19:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-29 19:42:13 +00:00
|
|
|
|
// 圣遗物判定,如果是绝缘4,将充能权重拉高至沙漏圣遗物当前最高权重齐平
|
|
|
|
|
let maxWeight = Math.max(weight.atk || 0, weight.hp || 0, weight.def || 0, weight.mastery || 0)
|
|
|
|
|
if (artis.is('绝缘4') && check('recharge', maxWeight, 75, false)) {
|
|
|
|
|
title.push('绝缘4')
|
|
|
|
|
}
|
2022-09-14 19:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
title = title.length > 0 ? title.join('') : '通用'
|
2022-09-10 19:59:45 +00:00
|
|
|
|
return {
|
|
|
|
|
title: `${char.abbr}-${title}`,
|
|
|
|
|
attrWeight: weight
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 16:31:36 +00:00
|
|
|
|
let charRule = char.getArtisCfg() || function ({ def }) {
|
2024-01-27 18:15:22 +00:00
|
|
|
|
let defaultAttrWeight = isGs ? { atk: 75, cpct: 100, cdmg: 100, dmg: 100, phy: 100 } : { atk: 75, cpct: 100, cdmg: 100, dmg: 100, speed: 100 }
|
|
|
|
|
return def(usefulAttr[char.name] || defaultAttrWeight)
|
2022-09-10 19:59:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (charRule) {
|
2023-09-21 20:03:01 +00:00
|
|
|
|
return charRule({ attr, elem, artis, rule, def, weapon, cons: profile.cons })
|
2022-09-10 19:59:45 +00:00
|
|
|
|
}
|
2023-10-19 07:46:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getCfg (profile) {
|
|
|
|
|
let { char } = profile
|
2023-10-21 18:54:45 +00:00
|
|
|
|
let { game } = char
|
2023-10-19 07:46:08 +00:00
|
|
|
|
let { attrWeight, title } = ArtisMarkCfg.getCharArtisCfg(profile)
|
|
|
|
|
let attrs = {}
|
|
|
|
|
let baseAttr = char.baseAttr || { hp: 14000, atk: 230, def: 700 }
|
2023-10-21 18:54:45 +00:00
|
|
|
|
let { attrMap } = Meta.getMeta(game, 'arti')
|
2023-10-19 07:46:08 +00:00
|
|
|
|
lodash.forEach(attrMap, (attr, key) => {
|
|
|
|
|
let k = attr.base || ''
|
|
|
|
|
let weight = attrWeight[k || key]
|
|
|
|
|
if (!weight || weight * 1 === 0) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
let ret = {
|
|
|
|
|
...attr, weight, fixWeight: weight, mark: weight / attr.value
|
|
|
|
|
}
|
|
|
|
|
if (!k) {
|
|
|
|
|
ret.mark = weight / attr.value
|
|
|
|
|
} else {
|
|
|
|
|
let plus = k === 'atk' ? 520 : 0
|
|
|
|
|
ret.mark = weight / attrMap[k].value / (baseAttr[k] + plus) * 100
|
|
|
|
|
ret.fixWeight = weight * attr.value / attrMap[k].value / (baseAttr[k] + plus) * 100
|
|
|
|
|
}
|
|
|
|
|
attrs[key] = ret
|
|
|
|
|
})
|
|
|
|
|
let posMaxMark = ArtisMark.getMaxMark(attrs, game)
|
|
|
|
|
// 返回内容待梳理简化
|
|
|
|
|
return {
|
|
|
|
|
attrs,
|
|
|
|
|
classTitle: title,
|
|
|
|
|
posMaxMark
|
|
|
|
|
}
|
2022-09-10 19:59:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-18 13:19:12 +00:00
|
|
|
|
export default ArtisMarkCfg
|