mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
* #角色面板 新增 钟离 的伤害计算
* #角色面板支持对治疗量、护盾量的计算与展示 * #角色面板修复冰融化、少女4等buff等buff遗漏或错误导致的伤害计算偏差
This commit is contained in:
parent
177563a442
commit
48e1588af8
@ -1,9 +1,11 @@
|
||||
# 1.3.1
|
||||
# 1.3.2
|
||||
|
||||
* `#角色面板` 伤害计算新增部分角色
|
||||
* 目前支持:雷神、胡桃、魈、神子、甘雨、宵宫、公子、绫人、绫华、心海
|
||||
* 目前支持:雷神、胡桃、魈、神子、甘雨、宵宫、公子、绫人、绫华、心海、钟离
|
||||
* `#角色面板` 一些功能升级与调整
|
||||
* 支持对治疗量、护盾量的计算与展示
|
||||
* 修复冰融化、少女4等buff等buff遗漏或错误导致的伤害计算偏差
|
||||
* `#老婆` 功能支持对jpeg格式的图片格式识别
|
||||
* 修复冰融化、少女4等buff等buff遗漏或错误导致的数据计算问题
|
||||
|
||||
# 1.3.0
|
||||
|
||||
|
@ -77,7 +77,7 @@ let Calc = {
|
||||
base: attr[key] * 1 || 0,
|
||||
plus: 0,
|
||||
pct: 0,
|
||||
inc: 0
|
||||
inc: 100
|
||||
}
|
||||
})
|
||||
|
||||
@ -89,7 +89,7 @@ let Calc = {
|
||||
}
|
||||
})
|
||||
|
||||
// a
|
||||
// 技能属性记录
|
||||
lodash.forEach("a,a2,a3,e,q".split(","), (key) => {
|
||||
ret[key] = {
|
||||
pct: 0, // 倍率加成
|
||||
@ -111,6 +111,12 @@ let Calc = {
|
||||
phy: 0 // 物理防御
|
||||
}
|
||||
|
||||
ret.shield = {
|
||||
base: 100, // 基础
|
||||
plus: 0, // 护盾强效
|
||||
inc: 100, // 吸收倍率
|
||||
}
|
||||
|
||||
ret.weaponType = avatar.weapon.type_name;
|
||||
ret.element = eleMap[avatar.element];
|
||||
ret.refine = (avatar.weapon.affix_level * 1 - 1) || 0;
|
||||
@ -179,7 +185,7 @@ let Calc = {
|
||||
}
|
||||
},
|
||||
|
||||
calcAttr(originalAttr, buffs, meta, params = {}, incAttr = '', reduceAttr = '') {
|
||||
calcAttr({ originalAttr, buffs, meta, params = {}, incAttr = '', reduceAttr = '', talent = '' }) {
|
||||
let attr = lodash.merge({}, originalAttr);
|
||||
let msg = [];
|
||||
|
||||
@ -195,6 +201,8 @@ let Calc = {
|
||||
lodash.forEach(buffs, (buff) => {
|
||||
let ds = Calc.getDs(attr, meta, params);
|
||||
|
||||
ds.currentTalent = talent;
|
||||
|
||||
// 如果存在rule,则进行计算
|
||||
if (buff.check && !buff.check(ds)) {
|
||||
return;
|
||||
@ -229,7 +237,7 @@ let Calc = {
|
||||
attr[tRet[1]][tRet[2].toLowerCase()] += val * 1 || 0;
|
||||
return;
|
||||
}
|
||||
let aRet = /^(hp|def|atk|mastery|cpct|cdmg|heal|recharge|dmg|phy)(Plus|Pct|Inc)?$/.exec(key);
|
||||
let aRet = /^(hp|def|atk|mastery|cpct|cdmg|heal|recharge|dmg|phy|shield)(Plus|Pct|Inc)?$/.exec(key);
|
||||
if (aRet) {
|
||||
attr[aRet[1]][aRet[2] ? aRet[2].toLowerCase() : "plus"] += val * 1 || 0;
|
||||
return;
|
||||
@ -269,7 +277,7 @@ let Calc = {
|
||||
|
||||
lodash.forEach(weaponCfg, (ds) => {
|
||||
if (!/:/.test(ds.title)) {
|
||||
ds.title = `${weaponName}效果:${ds.title}`;
|
||||
ds.title = `${weaponName}:${ds.title}`;
|
||||
}
|
||||
if (ds.refine) {
|
||||
ds.data = ds.data || {};
|
||||
@ -314,12 +322,14 @@ let Calc = {
|
||||
return retBuffs;
|
||||
},
|
||||
|
||||
getDmgFn({ attr, avatar, enemyLv }) {
|
||||
getDmgFn({ ds, attr, avatar, enemyLv, showDetail = false }) {
|
||||
|
||||
return function (pctNum = 0, talent = false, ele = false) {
|
||||
let { calc } = ds;
|
||||
|
||||
let dmgFn = function (pctNum = 0, talent = false, ele = false, mode = "talent") {
|
||||
let { atk, dmg, cdmg, cpct } = attr;
|
||||
// 攻击区
|
||||
let atkNum = (atk.base + atk.plus + atk.base * atk.pct / 100);
|
||||
let atkNum = calc(atk);
|
||||
|
||||
|
||||
// 倍率独立乘区
|
||||
@ -391,7 +401,7 @@ let Calc = {
|
||||
}
|
||||
|
||||
let ret = {};
|
||||
if (talent === "dmgRet") {
|
||||
if (mode === "basic") {
|
||||
ret = {
|
||||
dmg: pctNum * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum,
|
||||
avg: pctNum * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum
|
||||
@ -404,10 +414,30 @@ let Calc = {
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(attr, { atkNum, pctNum, multiNum, plusNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum, kNum }, ret)
|
||||
if (showDetail) {
|
||||
console.log(attr, { atkNum, pctNum, multiNum, plusNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum, kNum }, ret)
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
dmgFn.basic = function (pctNum = 0, talent = false, ele = false) {
|
||||
return dmgFn(pctNum, talent, ele, "basic");
|
||||
}
|
||||
|
||||
dmgFn.heal = function (num) {
|
||||
return {
|
||||
avg: num * (1 + calc(attr.heal) / 100) * (attr.heal.inc / 100)
|
||||
}
|
||||
}
|
||||
|
||||
dmgFn.shield = function (num) {
|
||||
return {
|
||||
avg: num * (calc(attr.shield) / 100) * (attr.shield.inc / 100)
|
||||
};
|
||||
}
|
||||
|
||||
return dmgFn;
|
||||
},
|
||||
|
||||
|
||||
@ -442,31 +472,27 @@ let Calc = {
|
||||
|
||||
buffs = lodash.sortBy(buffs, ["sort"]);
|
||||
|
||||
let { msg } = Calc.calcAttr(originalAttr, buffs, meta, defParams || {});
|
||||
let { msg } = Calc.calcAttr({ originalAttr, buffs, meta, params: defParams || {} });
|
||||
|
||||
let ret = [], detailMap = [], dmgRet = [], dmgDetail = {};
|
||||
|
||||
|
||||
lodash.forEach(details, (detail, detailSysIdx) => {
|
||||
let params = lodash.merge({}, defParams, detail.params || {});
|
||||
let { attr } = Calc.calcAttr(originalAttr, buffs, meta, params);
|
||||
let { attr } = Calc.calcAttr({ originalAttr, buffs, meta, params, talent: detail.talent || "" });
|
||||
if (detail.check && !detail.check(Calc.getDs(attr, meta, params))) {
|
||||
return;
|
||||
}
|
||||
if (detail.cons && meta.cons * 1 < detail.cons * 1) {
|
||||
return;
|
||||
}
|
||||
let dmg = Calc.getDmgFn({ attr, avatar, enemyLv }),
|
||||
basicDmgRet;
|
||||
let ds = lodash.merge({ talent }, Calc.getDs(attr, meta, params));
|
||||
|
||||
if (detail.dmg || detail.heal) {
|
||||
basicDmgRet = detail.dmg ? detail.dmg(ds, dmg) : detail.heal(ds, function (num) {
|
||||
let { attr, calc } = ds;
|
||||
return {
|
||||
avg: num * (1 + calc(attr.heal) / 100) * (1 + attr.heal.inc / 100)
|
||||
}
|
||||
});
|
||||
let dmg = Calc.getDmgFn({ ds, attr, avatar, enemyLv, showDetail: detail.showDetail }),
|
||||
basicDmgRet;
|
||||
|
||||
if (detail.dmg) {
|
||||
basicDmgRet = detail.dmg(ds, dmg);
|
||||
detail.userIdx = detailMap.length;
|
||||
detailMap.push(detail);
|
||||
ret.push({
|
||||
@ -505,17 +531,19 @@ let Calc = {
|
||||
rowData.push({ type: 'na' });
|
||||
return;
|
||||
}
|
||||
let { attr } = Calc.calcAttr(originalAttr, buffs, meta, params, incAttr, reduceAttr);
|
||||
let dmg = Calc.getDmgFn({ attr, avatar, enemyLv });
|
||||
let { attr } = Calc.calcAttr({
|
||||
originalAttr,
|
||||
buffs,
|
||||
meta,
|
||||
params,
|
||||
incAttr,
|
||||
reduceAttr,
|
||||
talent: detail.talent || ""
|
||||
});
|
||||
let ds = lodash.merge({ talent }, Calc.getDs(attr, meta, params));
|
||||
|
||||
if (detail.dmg || detail.heal) {
|
||||
let dmgCalcRet = detail.dmg ? detail.dmg(ds, dmg) : detail.heal(ds, function (num) {
|
||||
let { attr, calc } = ds;
|
||||
return {
|
||||
avg: num * (1 + calc(attr.heal) / 100) * (1 + attr.heal.inc / 100)
|
||||
}
|
||||
});
|
||||
let dmg = Calc.getDmgFn({ ds, attr, avatar, enemyLv });
|
||||
if (detail.dmg) {
|
||||
let dmgCalcRet = detail.dmg(ds, dmg);
|
||||
rowData.push({
|
||||
type: dmgCalcRet.avg === basicDmg.avg ? "avg" : (dmgCalcRet.avg > basicDmg.avg ? "gt" : "lt"),
|
||||
...dmgCalcRet
|
||||
|
@ -3,14 +3,14 @@ import lodash from "lodash";
|
||||
export const details = [{
|
||||
check: ({ cons }) => cons < 2,
|
||||
title: "水母每跳治疗",
|
||||
heal: ({ attr, talent, calc }, heal) => {
|
||||
dmg: ({ attr, talent, calc }, { heal }) => {
|
||||
let t = talent.e['治疗量2'], hp = calc(attr.hp);
|
||||
return heal(hp * t[0] / 100 + t[1] * 1);
|
||||
}
|
||||
}, {
|
||||
cons: 2,
|
||||
title: "半血水母每跳治疗",
|
||||
heal: ({ attr, talent, calc }, heal) => {
|
||||
dmg: ({ attr, talent, calc }, { heal }) => {
|
||||
let t = talent.e['治疗量2'], hp = calc(attr.hp);
|
||||
return heal(hp * t[0] / 100 + t[1] * 1 + hp * 0.045);
|
||||
}
|
||||
@ -25,12 +25,12 @@ export const details = [{
|
||||
dmg: ({ attr, talent, cons, calc }, dmg) => {
|
||||
let ret = { dmg: 0, avg: 0 };
|
||||
lodash.forEach('一二三'.split(""), (num) => {
|
||||
let dmgRet = dmg(talent.a['三段伤害'], 'a');
|
||||
let dmgRet = dmg(talent.a[`${num}段伤害`], 'a');
|
||||
ret.dmg += dmgRet.dmg;
|
||||
ret.avg += dmgRet.avg;
|
||||
});
|
||||
if (cons > 0) {
|
||||
let dmgRet = dmg(calc(attr.hp) * 0.3, 'dmgRet');
|
||||
let dmgRet = dmg.basic(calc(attr.hp) * 0.3);
|
||||
ret.dmg += dmgRet.dmg;
|
||||
ret.avg += dmgRet.avg;
|
||||
}
|
||||
|
@ -19,6 +19,12 @@ export const defDmgIdx = 2;
|
||||
export const mainAttr = "atk,cpct,cdmg,mastery";
|
||||
|
||||
export const buffs = [{
|
||||
cons: 1,
|
||||
title: "甘雨被动:霜华矢发射后的5秒内霜华矢暴击率提高20%",
|
||||
data: {
|
||||
a2Cpct: 20
|
||||
}
|
||||
}, {
|
||||
cons: 1,
|
||||
title: "甘雨1命:霜华失命中减少敌人15%冰抗",
|
||||
data: {
|
||||
|
39
resources/meta/character/钟离/calc.js
Normal file
39
resources/meta/character/钟离/calc.js
Normal file
@ -0,0 +1,39 @@
|
||||
export const details = [{
|
||||
title: "玉璋护盾量",
|
||||
talent: "e",
|
||||
dmg: ({ attr, calc, talent }, { shield }) => shield(talent.e['护盾基础吸收量'] + calc(attr.hp) * talent.e['护盾附加吸收量'] / 100)
|
||||
}, {
|
||||
title: "共鸣伤害",
|
||||
talent: "e",
|
||||
dmg: ({ talent }, dmg) => dmg(talent.e['岩脊伤害/共鸣伤害'][1], 'e') // 6856
|
||||
}, {
|
||||
title: "天星伤害",
|
||||
talent: "q",
|
||||
dmg: ({ talent }, dmg) => dmg(talent.q['技能伤害'], 'q')
|
||||
}];
|
||||
|
||||
export const defDmgIdx = 2;
|
||||
export const mainAttr = "hp,atk,cpct,cdmg";
|
||||
|
||||
export const buffs = [{
|
||||
title: "钟离被动:满层Buff下护盾强效提高25%",
|
||||
data: {
|
||||
shield: 25
|
||||
}
|
||||
}, {
|
||||
title: "岩系护盾:岩系护盾吸收效率150%",
|
||||
data: {
|
||||
shieldInc: 50
|
||||
}
|
||||
}, {
|
||||
title: "钟离被动:基于生命值上限,共鸣伤害提高[ePlus],天星伤害提高[qPlus]",
|
||||
data: {
|
||||
ePlus: ({ attr, calc }) => calc(attr.hp) * 0.019,
|
||||
qPlus: ({ attr, calc }) => calc(attr.hp) * 0.33
|
||||
}
|
||||
}, {
|
||||
title: "玉璋护盾:降低敌人全抗性20%",
|
||||
data: {
|
||||
kx: 20
|
||||
}
|
||||
}];
|
@ -87,6 +87,7 @@ export const buffs = {
|
||||
},
|
||||
"昔日宗室之仪4": {
|
||||
title: "宗室4:施放元素爆发后,攻击力提升20%",
|
||||
check: ({ currentTalent }) => !currentTalent || currentTalent === "q",
|
||||
data: {
|
||||
atkPct: 20
|
||||
}
|
||||
|
@ -73,13 +73,18 @@ let polearm = {
|
||||
title: "满层元素爆发伤害提高[qDmg]%",
|
||||
refine: { qDmg: step(40) }
|
||||
},
|
||||
"贯虹之槊": {
|
||||
"贯虹之槊": [{
|
||||
title: "护盾满层状态提高攻击力[atkPct]%",
|
||||
buffCount: 10,
|
||||
refine: {
|
||||
atkPct: step(4)
|
||||
}
|
||||
},
|
||||
}, {
|
||||
title: "护盾强效提高[shield]%",
|
||||
refine: {
|
||||
shield: step(20)
|
||||
}
|
||||
}],
|
||||
"和璞鸢": {
|
||||
title: "满层攻击力提高[atkPct]%,伤害提升[dmg]%",
|
||||
refine: {
|
||||
@ -88,9 +93,9 @@ let polearm = {
|
||||
}
|
||||
},
|
||||
"天空之脊": {
|
||||
title: "暴击率提升[cpct]%",
|
||||
title: "暴击率提升[_cpct]%",
|
||||
refine: {
|
||||
cpct: step(8)
|
||||
_cpct: step(8)
|
||||
}
|
||||
},
|
||||
"护摩之杖": {
|
||||
@ -214,13 +219,19 @@ let catalyst = {
|
||||
dmg: step(12)
|
||||
}
|
||||
},
|
||||
"尘世之锁": {
|
||||
"尘世之锁": [{
|
||||
title: "护盾强效提升[shield]%",
|
||||
refine: {
|
||||
shield: step(20)
|
||||
}
|
||||
}, {
|
||||
title: "护盾+满层情况下攻击力提高[atkPct]%",
|
||||
buffCount: 10,
|
||||
refine: {
|
||||
atkPct: step(4)
|
||||
atkPct: step(4),
|
||||
shield: step(20)
|
||||
}
|
||||
},
|
||||
}],
|
||||
"不灭月华": {
|
||||
title: "治疗加成提高[_heal]%,普攻伤害增加[aPlus]",
|
||||
refine: {
|
||||
@ -386,9 +397,9 @@ let bow = {
|
||||
}
|
||||
}],
|
||||
"天空之翼": {
|
||||
title: "暴击伤害提高[cdmg]%",
|
||||
title: "暴击伤害提高20%",
|
||||
refine: {
|
||||
cdmg: step(20)
|
||||
//cdmg: step(20)
|
||||
}
|
||||
},
|
||||
"若水": {
|
||||
@ -547,9 +558,9 @@ let sword = {
|
||||
}
|
||||
}],
|
||||
"斫峰之刃": [{
|
||||
title: "护盾强效提升[shild]%",
|
||||
title: "护盾强效提升[shield]%",
|
||||
refine: {
|
||||
shild: step(20)
|
||||
shield: step(20)
|
||||
}
|
||||
}, {
|
||||
title: "满Buff提高攻击力[atkPct]%",
|
||||
@ -559,9 +570,9 @@ let sword = {
|
||||
}
|
||||
}],
|
||||
"天空之刃": [{
|
||||
title: "暴击率提高[cpct]%",
|
||||
title: "暴击率提高[_cpct]%",
|
||||
refine: {
|
||||
cpct: step(4)
|
||||
_cpct: step(4)
|
||||
}
|
||||
}, {
|
||||
title: "普攻与重击的伤害值提高[aPlus]",
|
||||
|
Loading…
Reference in New Issue
Block a user