components及models重构

This commit is contained in:
yoimiya-kokomi 2022-08-19 05:04:31 +08:00
parent 8c826c81e7
commit 1fbeb8f290
13 changed files with 185 additions and 13 deletions

View File

@ -1,9 +1,9 @@
# 1.9.8
# 1.9.9
* `#上传深渊`、`#面板练度统计`已知问题修复,功能优化
* 对MiaoApi新版profile服务增加适配
* 伤害计算增加丽莎、云堇、五郎、北斗、托马、早柚
* 重构部分components、models逻辑
# 1.9.1 ~ 1.9.7
# 1.9.1 ~ 1.9.8
* 新增`#面板练度统计`功能
* 可展示当前角色天赋及圣遗物练度信息
@ -23,6 +23,7 @@
* 更新面板增加单用户更新间隔控制默认5分钟
* `#深渊出场率`、`#角色持有率` 增加样本数量展示,增加数据使用授权提示
* 修正部分V3Yunzai下的适配问题
* 对MiaoApi新版profile服务增加适配
* 部分角色的圣遗物评分增加充能的词条评分权重
# 1.9.0

View File

@ -150,7 +150,7 @@ function getCharacterData (avatars) {
affix: w.affix || w.affix_level || 0
}
let artis = avatars.artis || avatars.reliquaries
let artis = avatars?.artis?.artis || avatars.reliquaries
if (artis) {
lodash.forEach(artis, (val) => {

View File

@ -26,7 +26,7 @@ export async function profileArtis (e, { render }) {
return true
}
let charCfg = profile.getCharCfg()
let charCfg = profile.artis.getCharCfg()
let { artis, mark: totalMark, markClass: totalMarkClass, usefulMark } = profile.getArtisMark()
let { attrMap } = Artifact.getMeta()

View File

@ -15,11 +15,11 @@ export default class ProfileReq extends Base {
async setCd (seconds = 60) {
let ext = new Date() * 1 + seconds * 1000
await redis.set(`miao:profile-req:${this.uid}`, ext + '', { EX: seconds })
await redis.set(`miao:profile-cd:${this.uid}`, ext + '', { EX: seconds })
}
async inCd () {
let ext = await redis.get(`miao:role-all:${this.uid}`)
let ext = await redis.get(`miao:profile-cd:${this.uid}`)
if (!ext || isNaN(ext)) {
return false
}
@ -62,12 +62,9 @@ export default class ProfileReq extends Base {
this.msg('开始获取数据,可能会需要一定时间~')
await sleep(100)
// 发起请求
console.log('reqParam', reqParam)
let req = await fetch(reqParam.url, reqParam.params || {})
let data = await req.json()
data = await Serv.response(data, this)
console.log(data)
// 设置CD
cdTime = Serv.getCdTime(data)
if (cdTime) {

View File

@ -73,6 +73,5 @@ export default class ProfileServ extends Base {
}
ProfileServ.getServ = function ({ uid, serv }) {
console.log(diyCfg)
return (diyCfg.getProfileServ || sysCfg.getProfileServ)({ uid, serv, diyCfg })
}

View File

@ -0,0 +1,20 @@
export const details = [{
title: 'E短按伤害',
dmg: ({ talent }, dmg) => dmg(talent.e['点按伤害'], 'e')
}, {
title: '3层引雷长按E伤害',
dmg: ({ talent }, dmg) => dmg(talent.e['三层引雷长按伤害'], 'e')
}, {
title: 'Q每段伤害',
params: { q: true },
dmg: ({ talent }, dmg) => dmg(talent.q['放电伤害'], 'q')
}]
export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{
title: '丽莎被动敌人受到蔷薇的雷光攻击后降低15%防御力',
data: {
enemyDef: ({ params }) => params.q ? 15 : 0
}
}]

View File

@ -0,0 +1,25 @@
export const details = [{
title: 'Q提供普攻基础伤害',
dmg: ({ talent, attr, calc }) => {
return {
avg: (talent.q['伤害值提升'] / 100 + 0.115) * calc(attr.def)
}
}
}, {
title: '二段蓄力E伤害',
dmg: ({ talent, attr, calc }, { basic }) => {
let ret = talent.e['二段蓄力伤害'] * calc(attr.def) / 100 + (attr.e.plus || 0)
return basic(ret, 'e')
}
}]
export const mainAttr = 'atk,def,cpct,cdmg'
export const buffs = [{
title: '云堇被动队伍存在4元素类型角色时Q提供的普攻伤害提高[_q]',
data: {
_q: ({ attr, calc }) => {
return calc(attr.def) * 0.115
}
}
}]

View File

@ -0,0 +1,44 @@
export const details = [{
title: '三岩E伤害',
dmg: ({ talent }, dmg) => dmg(talent.e['技能伤害'], 'e')
}, {
title: '三岩Q伤害',
dmg: ({ talent, attr, calc }, { basic }) => {
let ret = talent.q['技能伤害'] * calc(attr.def) / 100 + attr.q.plus * 1
return basic(ret, 'q')
}
}, {
title: '三岩Q每跳伤害',
dmg: ({ talent, attr, calc }, { basic }) => {
let ret = talent.q['岩晶崩破伤害'] * calc(attr.def) / 100 + attr.q.plus * 1
return basic(ret, 'q')
}
}, {
title: 'Q每跳治疗',
cons: 4,
dmg: ({ attr, calc }, { heal }) => heal(0.5 * calc(attr.def))
}]
export const mainAttr = 'atk,def,cpct,cdmg'
export const buffs = [{
title: '五郎天赋释放E或Q后防御力提高[defPlus]岩伤提高15%',
data: {
defPlus: ({ talent }) => talent.e['防御力提升'] * 1,
dmg: 15
}
}, {
title: '五郎被动释放E后防御力提高25%',
data: {
defPct: 25
}
}, {
title: '五郎4命Q每跳回复防御力50%',
cons: 4
}, {
title: '五郎6命三岩队伍提高40%岩伤',
cons: 6,
data: {
dmg: 40
}
}]

View File

@ -13,6 +13,17 @@ export const details = [{
export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{
title: '刻晴被动释放Q获得15%暴击率',
data: {
qCpct: 15
}
}, {
title: '刻晴4命触发雷元素相关反应提升攻击力25%',
cons: 4,
data: {
atkPct: 25
}
}, {
title: '刻晴6命4层获得24%雷伤加成',
cons: 6,
data: {

View File

@ -0,0 +1,21 @@
export const details = [{
title: 'E伤害',
dmg: ({ talent }, dmg) => dmg(talent.e['基础伤害'], 'e')
}, {
title: '2层E伤害',
dmg: ({ talent }, dmg) => dmg(talent.e['基础伤害'] + talent.e['受击时伤害提升'] * 2, 'e')
}, {
title: 'Q每跳伤害',
params: { q: true },
dmg: ({ talent }, dmg) => dmg(talent.q['闪雷伤害'], 'q')
}]
export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{
title: '北斗6命Q持续期间周围敌人的雷元素抗性降低15%',
cons: 6,
data: {
kx: ({ params }) => params.q ? 15 : 0
}
}]

View File

@ -0,0 +1,27 @@
export const details = [{
title: 'E基础护盾量',
dmg: ({ attr, calc, talent }, { shield }) =>
shield(talent.e['护盾吸收量2'][0] * calc(attr.hp) / 100 + talent.e['护盾吸收量2'][1] * 1)
}, {
title: 'E最大护盾量',
params: { e: true },
dmg: ({ attr, calc, talent }, { shield }) =>
shield(talent.e['护盾吸收量上限2'][0] * calc(attr.hp) / 100 + talent.e['护盾吸收量上限2'][1] * 1)
}, {
title: 'Q每段伤害',
dmg: ({ talent }, dmg) => dmg(talent.q['炽火崩破伤害'], 'q')
}]
export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{
title: '托马被动5层Buff提高护盾强效25%',
data: {
shieldPlus: ({ params }) => params.e ? 25 : 0
}
}, {
title: '托马被动Q每段伤害提高[ePlus]',
data: {
qPlus: ({ calc, attr }) => calc(attr.hp) * 0.022
}
}]

View File

@ -0,0 +1,27 @@
export const details = [{
title: 'Q每跳治疗量',
dmg: ({ attr, calc, talent, cons }, { heal }) => {
let num = talent.q['不倒貉貉治疗量2'][0] * calc(attr.atk) / 100 + talent.q['不倒貉貉治疗量2'][1] * 1
if (cons * 1 === 6) {
num += Math.min(calc(attr.mastery) * 3, 6000)
}
return heal(num)
}
}, {
title: '扩散反应伤害',
dmg: ({}, { ks }) => ks()
}]
export const mainAttr = 'atk,cpct,cdmg,mastery'
export const buffs = [{
title: '早柚6命基于精通提升Q [qPct]伤害,[_heal]治疗量',
cons: 6,
data: {
qPct: ({ attr, calc }) => Math.min(calc(attr.mastery) * 0.002, 400),
_heal: ({ attr, calc }) => Math.min(calc(attr.mastery) * 3, 6000)
}
}, {
title: '元素精通:扩散伤害提高[ks]%',
mastery: 'ks'
}]

View File

@ -14,7 +14,7 @@ export const details = [{
dmg: ({ talent }, dmg) => dmg(talent.q['泡影破裂伤害'], 'q', 'zf')
}]
export const mainAttr = 'atk,hp,cpct,recharge'
export const mainAttr = 'atk,cpct,cdmg,recharge'
export const buffs = [{
title: '莫娜被动:基于元素充能效率获得水元素伤害[dmg]%',