miao-plugin/apps/profile/ProfileWeapon.js
Kokomi a009b9678d * 增加3.6新圣遗物数据及资源
* 增加绮良良的角色信息,可通过`#绮良良天赋`、`#绮良良图鉴`等查看
2023-04-13 03:44:56 +08:00

37 lines
962 B
JavaScript

import { ProfileData, Weapon } from '#miao.models'
import { Data } from '#miao'
export const ProfileWeapon = {
async calc (profile) {
let ret = []
await Weapon.forEach(async (w) => {
let weaponRet = w.getData('name,star,abbr,icon')
weaponRet.dmgs = []
for (let affix of [1, 5]) {
if (affix === 5 && w.maxAffix !== 5) {
continue
}
let tempProfile = new ProfileData({
...profile.getData('uid,id,level,cons,fetter,elem,promote,talent,artis'),
dataSource: 'change'
}, false)
tempProfile.setWeapon({
name: w.name,
star: w.star,
level: w.maxLv,
promote: w.maxPromote,
affix
})
tempProfile.calcAttr()
weaponRet.dmgs.push({
affix,
...await tempProfile.calcDmg({ mode: 'single' })
})
}
ret.push(weaponRet)
}, profile?.weapon?.type)
return ret
}
}