2022-08-22 20:53:31 +00:00
|
|
|
|
/*
|
|
|
|
|
* 伤害计算 - Buff计算
|
|
|
|
|
* */
|
|
|
|
|
import lodash from 'lodash'
|
2023-05-21 18:13:38 +00:00
|
|
|
|
import { ProfileArtis, ArtifactSet, Weapon } from '../index.js'
|
2022-09-24 22:42:48 +00:00
|
|
|
|
|
2022-08-22 20:53:31 +00:00
|
|
|
|
let DmgBuffs = {
|
2023-05-21 18:13:38 +00:00
|
|
|
|
getBuffs (profile, buffs = [], game = 'gs') {
|
|
|
|
|
let weaponBuffs = DmgBuffs.getWeaponBuffs(profile.weapon, game)
|
|
|
|
|
let artisBuffs = DmgBuffs.getArtisBuffs(profile.artis, game)
|
2022-08-22 20:53:31 +00:00
|
|
|
|
buffs = lodash.concat(buffs, weaponBuffs, artisBuffs)
|
|
|
|
|
let mKey = {
|
2022-11-05 11:31:07 +00:00
|
|
|
|
vaporize: '蒸发',
|
|
|
|
|
melt: '融化',
|
|
|
|
|
swirl: '扩散'
|
2022-08-22 20:53:31 +00:00
|
|
|
|
}
|
2022-11-22 20:25:36 +00:00
|
|
|
|
let mKey2 = {
|
|
|
|
|
aggravate: '超激化'
|
|
|
|
|
}
|
2023-05-29 19:42:13 +00:00
|
|
|
|
buffs = lodash.filter(buffs, (b) => !!b)
|
2022-08-22 20:53:31 +00:00
|
|
|
|
lodash.forEach(buffs, (buff, idx) => {
|
2022-11-22 20:25:36 +00:00
|
|
|
|
if (lodash.isString(buff)) {
|
|
|
|
|
if (mKey[buff]) {
|
|
|
|
|
buff = {
|
2022-11-26 08:12:32 +00:00
|
|
|
|
title: `元素精通:${mKey[buff]}伤害提高[_${buff}]%`,
|
2022-11-22 20:25:36 +00:00
|
|
|
|
mastery: buff
|
|
|
|
|
}
|
|
|
|
|
buffs[idx] = buff
|
|
|
|
|
} else if (mKey2[buff]) {
|
|
|
|
|
buff = {
|
|
|
|
|
title: `元素精通:触发${mKey2[buff]}伤害值提高[${buff}]`,
|
|
|
|
|
mastery: buff
|
|
|
|
|
}
|
|
|
|
|
buffs[idx] = buff
|
2022-08-22 20:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
buff.sort = lodash.isUndefined(buff.sort) ? 1 : buff.sort
|
|
|
|
|
})
|
|
|
|
|
buffs = lodash.sortBy(buffs, ['sort'])
|
|
|
|
|
return buffs
|
2023-05-21 18:13:38 +00:00
|
|
|
|
},
|
|
|
|
|
// 圣遗物Buff
|
|
|
|
|
getArtisBuffs (artis = {}, game = 'gs') {
|
|
|
|
|
let retBuffs = []
|
|
|
|
|
ProfileArtis._eachArtisSet(artis, (sets, num) => {
|
|
|
|
|
let buffs = ArtifactSet.getArtisSetBuff(sets.name, num, game)
|
|
|
|
|
if (lodash.isPlainObject(buffs)) {
|
|
|
|
|
buffs = [buffs]
|
|
|
|
|
}
|
|
|
|
|
lodash.forEach(buffs, (buff) => {
|
|
|
|
|
if (buff && !buff.isStatic) {
|
|
|
|
|
retBuffs.push({
|
|
|
|
|
...buff,
|
|
|
|
|
title: `${sets.name}${num}:` + buff.title
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return retBuffs
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 武器Buff
|
|
|
|
|
getWeaponBuffs (wData, game = 'gs') {
|
|
|
|
|
let weapon = Weapon.get(wData.name, game)
|
|
|
|
|
if (!weapon) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
let affix = wData.refine || wData.affix
|
|
|
|
|
let weaponCfg = weapon.getWeaponAffixBuffs(affix, false)
|
|
|
|
|
|
|
|
|
|
let ret = []
|
|
|
|
|
lodash.forEach(weaponCfg, (ds) => {
|
|
|
|
|
if (ds.isStatic) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
ret.push(ds)
|
|
|
|
|
})
|
|
|
|
|
return ret
|
2022-08-22 20:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
export default DmgBuffs
|