* #角色面板 伤害计算增加双手剑计算逻辑,增加物伤计算逻辑

* `#角色面板` 伤害计算新增支持一斗、优菈
This commit is contained in:
yoimiya-kokomi 2022-05-19 10:34:21 +08:00
parent 61a3269336
commit a97ab9a919
8 changed files with 282 additions and 19 deletions

View File

@ -1,13 +1,15 @@
# 1.5.3
# 1.5.4
* `#喵喵日历` 增加 `#喵喵日历列表`命令,以列表形式展示活动信息
* `#深渊出场率`、`#角色持有率` 等功能样式及字体微调
* 增加鹿野院平藏的角色信息,可通过`#平藏天赋`、`#平藏命座`查看信息
* `#角色面板` 伤害计算增加双手剑计算逻辑,增加物伤计算逻辑
* `#角色面板` 伤害计算增加部分角色,目前支持
* 长柄武器:雷神、胡桃、魈、钟离、香菱
* 法器:神子、心海、可莉ⁿᵉʷ、凝光ⁿᵉʷ
* 弓:甘雨、宵宫、公子
* 单手剑:绫人、绫华、刻晴、阿贝多、行秋、班尼特、七七ⁿᵉʷ
* `#深渊出场率`、`#角色持有率` 等功能样式及字体微调
* 添加鹿野苑平藏的meta信息
* 双手剑:一斗ⁿᵉʷ、优菈ⁿᵉʷ
# 1.5.0

View File

@ -715,6 +715,7 @@ export async function renderProfile(e, char, render, mode = "profile", params =
dmgCfg: dmgCalc.dmgCfg,
reliquaries,
enemyLv,
enemyName: dmgCalc.enemyName || "小宝",
totalMark: c(totalMark, 1),
totalMaxMark,
markScore: Reliquaries.getMarkScore(totalMark, totalMaxMark),

View File

@ -30,7 +30,7 @@ let Calc = {
const cfgPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/calc.js`;
let details, buffs = [], defParams = {}, defDmgIdx = -1, mainAttr = "atk,cpct,cdmg";
let details, buffs = [], defParams = {}, defDmgIdx = -1, mainAttr = "atk,cpct,cdmg", enemyName = "小宝";
if (fs.existsSync(cfgPath)) {
let fileData = await import (`file://${cfgPath}`);
details = fileData.details || false;
@ -42,10 +42,13 @@ let Calc = {
if (fileData.mainAttr) {
mainAttr = fileData.mainAttr;
}
if (fileData.enemyName) {
enemyName = fileData.enemyName;
}
}
if (details) {
return { details, buffs, defParams, defDmgIdx, mainAttr }
return { details, buffs, defParams, defDmgIdx, mainAttr, enemyName }
}
return false;
},
@ -118,6 +121,7 @@ let Calc = {
}
ret.weaponType = avatar.weapon.type_name;
ret.weapon = avatar.weapon;
ret.element = eleMap[avatar.element];
ret.refine = (avatar.weapon.affix_level * 1 - 1) || 0;
@ -178,6 +182,7 @@ let Calc = {
params,
refine: attr.refine,
weaponType: attr.weaponType,
weapon: attr.weapon,
element: eleMap[attr.element] || attr.element,
calc(ds) {
return (ds.base || 0) + (ds.plus || 0) + ((ds.base || 0) * (ds.pct || 0) / 100)
@ -327,7 +332,7 @@ let Calc = {
let { calc } = ds;
let dmgFn = function (pctNum = 0, talent = false, ele = false, basicNum = 0, mode = "talent") {
let { atk, dmg, cdmg, cpct } = attr;
let { atk, dmg, phy, cdmg, cpct } = attr;
// 攻击区
let atkNum = calc(atk);
@ -338,6 +343,10 @@ let Calc = {
// 增伤区
let dmgNum = (1 + dmg.base / 100 + dmg.plus / 100);
if (ele === "phy") {
dmgNum = (1 + phy.base / 100 + phy.plus / 100);
}
//console.log({ base: Format.comma(dmg.base, 2), plus: Format.comma(dmg.plus, 2) })
let cpctNum = cpct.base / 100 + cpct.plus / 100;
@ -381,7 +390,9 @@ let Calc = {
// 反应区
let eleNum = 1;
if (ele) {
if (ele === "phy") {
//do nothing
} else if (ele) {
// todo 更详细
let eleMap = {
'水': { zf: 2 },
@ -459,7 +470,7 @@ let Calc = {
talent
}
let { buffs, details, defParams, mainAttr, defDmgIdx } = charCalcData;
let { buffs, details, defParams, mainAttr, defDmgIdx, enemyName } = charCalcData;
defParams = defParams || {};
@ -481,6 +492,11 @@ let Calc = {
lodash.forEach(details, (detail, detailSysIdx) => {
if (lodash.isFunction(detail)) {
let { attr } = Calc.calcAttr({ originalAttr, buffs, meta });
let ds = lodash.merge({ talent }, Calc.getDs(attr, meta));
detail = detail({ ...ds, attr, avatar });
}
let params = lodash.merge({}, defParams, detail.params || {});
let { attr } = Calc.calcAttr({ originalAttr, buffs, meta, params, talent: detail.talent || "" });
if (detail.check && !detail.check(Calc.getDs(attr, meta, params))) {
@ -561,6 +577,7 @@ let Calc = {
ret,
msg,
dmgRet,
enemyName,
dmgCfg: dmgDetail
}
}

View File

@ -51,7 +51,7 @@
{{if dmgData.length > 0}}
<div class="dmg-cont dmg-list cont">
<div class="cont-title">
伤害计算<span>目标为{{enemyLv}}级小宝,如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置</span>
伤害计算<span>目标为{{enemyLv}}级{{enemyName}},如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置</span>
</div>
<div class="cont-table">
<div class="tr thead">

View File

@ -0,0 +1,69 @@
let tmpDmg = false;
export const details = [{
title: "普攻尾段2次伤害",
params: { e: false },
dmg: ({ talent }, dmg) => dmg(talent.a['五段伤害'], 'a', 'phy')
}, {
title: "E0层长按伤害",
params: { gj: false },
dmg: ({ talent }, dmg) => {
tmpDmg = dmg(talent.e['长按伤害'], 'e')
return tmpDmg;
}
}, {
title: "E2层长按伤害",
params: { gj: true },
dmg: ({ talent }, dmg) => {
let e = tmpDmg;
let g = dmg(talent.e['冰涡之剑伤害'], 'e')
let j = dmg(talent.q['光降之剑基础伤害'], 'e', 'phy')
return {
dmg: e.dmg * 1 + g.dmg * 2 + j.dmg * 0.5,
avg: e.avg * 1 + g.avg * 2 + j.avg * 0.5
}
}
}, ({ cons, weapon }) => {
let buffCount = 12;
if (weapon.name === "松籁响起之时") {
buffCount = 13;
if (weapon.affix_level >= 4) {
buffCount = 14;
}
}
if (cons === 6) {
buffCount = buffCount + 11;
}
return {
title: `光降之剑${buffCount}层伤害`,
params: { gj: true },
dmg: ({ talent }, dmg) => dmg(talent.q['光降之剑基础伤害'] + talent.q['每层能量伤害'] * buffCount, 'q', 'phy')
}
}];
export const mainAttr = "atk,cpct,cdmg";
export const enemyName = "魔偶/女士/雷神";
export const buffs = [{
title: "优菈天赋E消耗冰涡之剑后降低抗性[kx]%",
check: ({ params }) => params.gj !== false,
data: {
kx: ({ talent }) => talent.e['冰元素抗性降低']
}
}, {
title: "优菈一命消耗冷酷之心后物理伤害提高30%",
cons: 1,
data: {
phy: ({ params }) => params.gj ? 30 : 0
}
}, {
title: "优菈四命对生命值低于50%的敌人光降之剑造成的伤害提高25%",
cons: 4,
data: {
qDmg: 25
}
}, {
title: "优菈6命光降之剑额外获得5层Buff普攻/E有50%概率额外获得1层",
cons: 6
}]

View File

@ -0,0 +1,31 @@
export const details = [{
title: "开大后每段重击",
dmg: ({ talent }, dmg) => dmg(talent.a['荒泷逆袈裟连斩伤害'], 'a2')
}, {
title: "开大后重击尾段",
dmg: ({ talent }, dmg) => dmg(talent.a['荒泷逆袈裟终结伤害'], 'a2')
}, {
title: "开大后牛牛伤害",
dmg: ({ talent }, dmg) => dmg(talent.e['技能伤害'], 'e')
}];
export const mainAttr = "atk,cpct,cdmg";
export const enemyName = "魔偶/女士/雷神";
export const buffs = [{
title: "一斗被动:荒泷逆袈裟造成的伤害基于防御值提高[a2Plus]",
data: {
a2Plus: ({ attr, calc }) => calc(attr.def) * 0.35
}
}, {
title: "一斗6命重击的暴击伤害提高70%",
data: {
a2Cdmg: 70
}
}, {
title: "一斗大招:怒目鬼王状态提高攻击力[atkPlus]",
data: {
atkPlus: ({ attr, calc, talent }) => talent.q['攻击力提高'] * calc(attr.def) / 100
}
}]

View File

@ -169,6 +169,7 @@ export const buffs = {
},
"华馆梦醒形骸记4": {
title: "华馆4满层获得24%防御及24%岩伤加成",
sort: 0,
data: {
defPct: 24,
dmg: 24
@ -176,6 +177,7 @@ export const buffs = {
},
"辰砂往生录4": {
title: "辰砂4满层提高48%攻击力",
data: {
atkPct: 48
}

View File

@ -31,7 +31,8 @@ let polearm = {
check: ({ element }) => ['水', '火'].includes(element),
title: "对于水或或元素影响的敌人造成伤害提高[dmg]%",
refine: {
dmg: step(20, 4)
dmg: step(20, 4),
phy:step(20, 4),
}
},
"千岩长枪": {
@ -89,7 +90,8 @@ let polearm = {
title: "满层攻击力提高[atkPct]%,伤害提升[dmg]%",
refine: {
atkPct: [3.2 * 7, 3.9 * 7, 4.6 * 7, 5.3 * 7, 6 * 7],
dmg: step(12)
dmg: step(12),
phy:step(12)
}
},
"护摩之杖": {
@ -116,7 +118,14 @@ let polearm = {
return Math.min(recharge * step(28)[refine] / 100, [80, 90, 100, 110, 120][refine])
}
}
}]
}],
"息灾": {
title: "获得[dmg]%元素伤害加成满Buff前台提供[atkPct]%攻击力加成",
refine: {
dmg: step(12),
atkPct: step(3.2 * 6)
}
}
};
let catalyst = {
@ -443,7 +452,8 @@ let sword = {
"暗巷闪光": {
title: "角色造成的伤害提升[dmg]%",
refine: {
dmg: step(12)
dmg: step(12),
phy:step(12)
}
},
"宗室长剑": {
@ -465,14 +475,16 @@ let sword = {
check: ({ element }) => ['火', '雷'].includes(element),
title: "对处于火元素或雷元素影响下的敌人,造成的伤害提高[dmg]%",
refine: {
dmg: step(20, 4)
dmg: step(20, 4),
phy:step(20,4)
}
},
"铁蜂刺": {
title: "满Buff伤害提高[dmg]%",
buffCount: 2,
refine: {
dmg: step(6)
dmg: step(6),
phy:step(6)
}
},
"黑岩长剑": {
@ -505,7 +517,8 @@ let sword = {
check: ({ element }) => ['水', '冰'].includes(element),
title: "对处于水或冰元素影响的敌人伤害提高[dmg]%",
refine: {
dmg: step(12)
dmg: step(12),
phy:step(12)
}
},
"波乱月白经津": [{
@ -573,6 +586,134 @@ let sword = {
}
},
}
};
export const weapons = { ...polearm, ...catalyst, ...bow, ...sword };
let claymore = {
"沐浴龙血的剑": {
check: ({ element }) => ['火', '雷'].includes(element),
title: "对处于火元素或雷元素影响下的敌人,造成的伤害提高[dmg]%",
refine: {
dmg: step(12),
phy: step(12)
}
},
"铁影阔剑": {
title: "生命值低于70%时,提高[a2Dmg]%重击伤害",
refine: {
a2Dmg: step(30, 5)
}
},
"飞天大御剑": {
title: "满层提高攻击力[atkPct]%",
buffCount: 4,
refine: {
atkPct: step(6, 1)
}
},
"黑岩斩刀": {
title: "击败敌人满Buff下攻击力提升[atkPct]%",
buffCount: 3,
refine: {
atkPct: step(12)
}
},
"千岩古剑": {
title: "四璃月角色提升攻击力[atkPct]%及暴击率[cpct]%",
buffCount: 4,
refine: {
atkPct: step(3, 1),
cpct: step(3, 1)
}
},
"雨裁": {
check: ({ element }) => ['水', '雷'].includes(element),
title: "对处于水元素或雷元素影响下的敌人,造成的伤害提高[dmg]%",
refine: {
dmg: step(20, 4),
phy: step(20, 4)
}
},
"宗室大剑": {
title: "3层Buff提高暴击率[cpct]%",
buffCount: 3,
refine: {
cpct: step(8)
}
},
"螭骨剑": {
title: "满Buff提高伤害[dmg]%",
refine: {
dmg: step(6, 1),
phy: step(6, 1)
}
},
"钟剑": {
title: "角色处于护盾庇护下时,造成的伤害提升[dmg]%",
refine: {
dmg: step(12),
phy: step(12)
}
},
"白影剑": {
title: "满Buff提升攻击力及防御力[atkPct]%",
buffCount: 4,
refine: {
atkPct: step(6),
defPct: step(6)
}
},
"桂木斩长正": {
title: "元素战技造成的伤害提升[eDmg]%",
refine: {
eDmg: step(6)
}
},
"衔珠海皇": {
title: "元素爆发造成的伤害提升[qDmg]%",
refine: {
qDmg: step(12)
}
},
"恶王丸": {
title: "满层元素爆发造成的伤害提升[qDmg]%",
refine: {
qDmg: step(40)
}
},
"天空之傲": {
title: "造成伤害提高[dmg]%",
refine: {
dmg: step(8),
phy: step(8)
}
},
"狼的末路": {
title: "攻击命中生命值低于30%的敌人时,攻击力提升[atkPct]%",
refine: {
atkPct: step(40)
}
},
"无工之剑": {
title: "满Buff护盾下攻击力提高[atkPct]%",
buffCount: 10,
refine: {
atkPct: step(4)
}
},
"松籁响起之时": {
title: "Buff状态下提高攻击力[atkPct]%",
refine: {
atkPct: step(20)
}
},
"赤角石溃杵": {
title: "普通攻击与重击造成的伤害值提高[aPlus]%",
data: {
aPlus: ({ attr, calc, refine }) => calc(attr.def) * step(40)[refine] / 100,
a2Plus: ({ attr, calc, refine }) => calc(attr.def) * step(40)[refine] / 100
},
}
};
export const weapons = { ...polearm, ...catalyst, ...bow, ...sword, ...claymore };