mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
#角色详情 伤害计算增加魈、胡桃
This commit is contained in:
parent
b43b59dd47
commit
bc8fb2360a
@ -585,26 +585,23 @@ export async function renderProfile(e, char, render) {
|
||||
let avatar = await getAvatar(e, char, MysApi);
|
||||
let talent = await getTalent(e, avatar);
|
||||
|
||||
|
||||
if (global.debugView === "web-debug") {
|
||||
let file = process.cwd() + "/tools/avatar.json";
|
||||
avatar._talent = talent;
|
||||
fs.writeFileSync(file, JSON.stringify(avatar));
|
||||
}
|
||||
|
||||
if (!talent.id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let posIdx = {
|
||||
"生之花": {
|
||||
idx: 1
|
||||
},
|
||||
"死之羽": {
|
||||
idx: 2
|
||||
},
|
||||
"时之沙": {
|
||||
idx: 3
|
||||
},
|
||||
"空之杯": {
|
||||
idx: 4
|
||||
},
|
||||
"理之冠": {
|
||||
idx: 5
|
||||
}
|
||||
"生之花": { idx: 1 },
|
||||
"死之羽": { idx: 2 },
|
||||
"时之沙": { idx: 3 },
|
||||
"空之杯": { idx: 4 },
|
||||
"理之冠": { idx: 5 }
|
||||
};
|
||||
|
||||
let reliquaries = [], totalMark = 0, totalMaxMark = 0;
|
||||
@ -635,8 +632,9 @@ export async function renderProfile(e, char, render) {
|
||||
}
|
||||
});
|
||||
|
||||
let enemyLv = await selfUser.getCfg(`char.enemyLv`, 91);
|
||||
let dmgMsg = [], dmgData = [];
|
||||
let dmgCalc = await Calc.calcData(profile, char, avatar, talent);
|
||||
let dmgCalc = await Calc.calcData({ profile, char, avatar, talent, enemyLv });
|
||||
if (dmgCalc && dmgCalc.ret) {
|
||||
lodash.forEach(dmgCalc.ret, (ds) => {
|
||||
ds.dmg = Format.comma(ds.dmg, 0);
|
||||
@ -659,6 +657,7 @@ export async function renderProfile(e, char, render) {
|
||||
dmgData,
|
||||
dmgMsg,
|
||||
reliquaries,
|
||||
enemyLv,
|
||||
totalMark: c(totalMark, 1),
|
||||
totalMaxMark,
|
||||
markScore: Reliquaries.getMarkScore(totalMark, totalMaxMark),
|
||||
|
@ -1,7 +1,11 @@
|
||||
import fs from "fs";
|
||||
import lodash from "lodash";
|
||||
import Format from "./Format.js";
|
||||
import {buffs} from "../resources/meta/reliquaries/calc.js";
|
||||
|
||||
const eleMap = {
|
||||
Electro: "雷",
|
||||
Pyro: "火"
|
||||
}
|
||||
|
||||
let Calc = {
|
||||
|
||||
@ -83,9 +87,12 @@ let Calc = {
|
||||
}
|
||||
|
||||
ret.weaponType = avatar.weapon.type_name;
|
||||
ret.element = avatar.element;
|
||||
ret.element = eleMap[avatar.element];
|
||||
ret.refine = (avatar.weapon.affix_level * 1 - 1) || 0;
|
||||
|
||||
ret.zf = 0;
|
||||
ret.rh = 0;
|
||||
|
||||
return ret;
|
||||
|
||||
},
|
||||
@ -137,15 +144,28 @@ let Calc = {
|
||||
...meta,
|
||||
attr,
|
||||
params,
|
||||
refine: attr.refine
|
||||
refine: attr.refine,
|
||||
calc(ds) {
|
||||
return (ds.base || 0) + (ds.plus || 0) + ((ds.base || 0) * (ds.pct || 0) / 100)
|
||||
}
|
||||
};
|
||||
|
||||
// 如果存在rule,则进行计算
|
||||
if (buff.rule && !buff.rule(ds)) {
|
||||
if (buff.check && !buff.check(ds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let title = buff.title;
|
||||
|
||||
if (buff.mastery) {
|
||||
let mastery = attr.mastery.base + attr.mastery.plus;
|
||||
let masteryNum = 2.78 * mastery / (mastery + 1400) * 100;
|
||||
buff.data = buff.data || {};
|
||||
lodash.forEach(buff.mastery.split(","), (key) => {
|
||||
buff.data[key] = masteryNum;
|
||||
})
|
||||
}
|
||||
|
||||
lodash.forEach(buff.data, (val, key) => {
|
||||
|
||||
if (lodash.isFunction(val)) {
|
||||
@ -166,6 +186,11 @@ let Calc = {
|
||||
}
|
||||
if (key === "enemyDef") {
|
||||
attr.enemy.def += val * 1 || 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (["zf", "rh"].includes(key)) {
|
||||
attr[key] += val * 1 || 0;
|
||||
}
|
||||
});
|
||||
msg.push(title);
|
||||
@ -236,7 +261,7 @@ let Calc = {
|
||||
})
|
||||
return retBuffs;
|
||||
},
|
||||
async calcData(profile, char, avatar, talentData) {
|
||||
async calcData({ profile, char, avatar, talentData }) {
|
||||
let charCalcData = await Calc.getCharCalcRule(char.name);
|
||||
|
||||
//avatar.element;
|
||||
@ -277,7 +302,7 @@ let Calc = {
|
||||
|
||||
let { attr } = Calc.calcAttr(originalAttr, buffs, meta, params);
|
||||
|
||||
let dmg = function (pctNum = 0, talent = false) {
|
||||
let dmg = function (pctNum = 0, talent = false, ele = false) {
|
||||
let { atk, dmg, cdmg, cpct } = attr;
|
||||
// 攻击区
|
||||
let atkNum = (atk.base + atk.plus + atk.base * atk.pct / 100);
|
||||
@ -309,20 +334,31 @@ let Calc = {
|
||||
}
|
||||
|
||||
// 防御区
|
||||
let enemyLv = 91, lv = 90;
|
||||
let enemyLv = 86, lv = avatar.level;
|
||||
let defNum = (lv + 100) / ((lv + 100) + (enemyLv + 100) * (1 - enemyDef) * (1 - enemyIgnore));
|
||||
|
||||
// 抗性区
|
||||
let kNum = 0.9;
|
||||
|
||||
// 计算最终伤害
|
||||
let ret = {
|
||||
dmg: atkNum * pctNum * dmgNum * (1 + cdmgNum) * defNum * kNum,
|
||||
avg: atkNum * pctNum * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum
|
||||
// 反应区
|
||||
let eleNum = 1;
|
||||
if (ele) {
|
||||
eleNum = { zf: 1.5, rh: 2 }[ele] || 1;
|
||||
|
||||
|
||||
if (attr[ele]) {
|
||||
eleNum = eleNum * (1 + attr[ele] / 100);
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(attr, {atkNum, pctNum, dmgNum, cpctNum, cdmgNum, defNum}, ret)
|
||||
|
||||
// 计算最终伤害
|
||||
let ret = {
|
||||
dmg: atkNum * pctNum * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum,
|
||||
avg: atkNum * pctNum * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum
|
||||
}
|
||||
if (global.debugView === "web-debug") {
|
||||
console.log(attr, { atkNum, pctNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum }, ret)
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
@ -334,7 +370,6 @@ let Calc = {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
ret,
|
||||
msg
|
||||
|
28
resources/meta/character/胡桃/calc.js
Normal file
28
resources/meta/character/胡桃/calc.js
Normal file
@ -0,0 +1,28 @@
|
||||
export const details = [{
|
||||
title: "半血开E重击",
|
||||
dmg: ({ talent, attr }, dmg) => dmg(talent.a["重击伤害"], "a2")
|
||||
}, {
|
||||
title: "半血开E重击蒸发",
|
||||
dmg: ({ talent, attr }, dmg) => dmg(talent.a["重击伤害"], "a2", "zf")
|
||||
}, {
|
||||
title: "半血开E后Q",
|
||||
dmg: ({ talent, attr }, dmg) => dmg(talent.q["低血量时技能伤害"], "q")
|
||||
}];
|
||||
|
||||
export const buffs = [{
|
||||
title: `被动天赋:半血获得33%火伤加成`,
|
||||
data: {
|
||||
"dmg": 33
|
||||
}
|
||||
|
||||
}, {
|
||||
title: "元素精通:蒸发融化伤害提高[zf]%",
|
||||
mastery: "zf,rh"
|
||||
}, {
|
||||
title: "胡桃E:获得[atkPlus]点攻击力加成",
|
||||
data: {
|
||||
atkPlus: ({ talent, attr, calc }) => {
|
||||
return talent.e['攻击力提高'] * calc(attr.hp) / 100;
|
||||
}
|
||||
}
|
||||
}];
|
42
resources/meta/character/魈/calc.js
Normal file
42
resources/meta/character/魈/calc.js
Normal file
@ -0,0 +1,42 @@
|
||||
export const details = [{
|
||||
title: "裸E",
|
||||
dmg: ({ talent }, dmg) => dmg(talent.e["技能伤害"], "e")
|
||||
}, {
|
||||
title: "满层被动E",
|
||||
params: { e: 1 },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.e["技能伤害"], "e")
|
||||
}, {
|
||||
title: "开Q后首插",
|
||||
params: {
|
||||
layer: 1
|
||||
},
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a["低空/高空坠地冲击伤害"][1], "a3")
|
||||
}, {
|
||||
title: "开Q后尾插",
|
||||
params: {
|
||||
layer: 5
|
||||
},
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a["低空/高空坠地冲击伤害"][1], "a3")
|
||||
}];
|
||||
|
||||
|
||||
export const defParams = {
|
||||
layer: 0
|
||||
}
|
||||
|
||||
export const buffs = [{
|
||||
title: `魈天赋:开Q后每3秒伤害提升5%,满层提高25%`,
|
||||
data: {
|
||||
dmg: ({ params }) => params.layer * 5
|
||||
}
|
||||
}, {
|
||||
title: "魈大招:下落攻击伤害提升[a3Dmg]%",
|
||||
data: {
|
||||
a3Dmg: ({ talent }) => talent.q['普通攻击/重击/下落攻击伤害提升']
|
||||
}
|
||||
}, {
|
||||
title: "魈被动:3层E使E的伤害提高45%",
|
||||
data: {
|
||||
eDmg: ({ params }) => params.e ? 45 : 0
|
||||
}
|
||||
}];
|
@ -16,9 +16,9 @@ let polearm = {
|
||||
}
|
||||
},
|
||||
"匣里灭辰": {
|
||||
title: "对于水或或元素影响的敌人造成伤害提高[dmgPct]%",
|
||||
title: "对于水或或元素影响的敌人造成伤害提高[dmg]%",
|
||||
refine: {
|
||||
dmgPct: [20, 24, 28, 32, 36]
|
||||
dmg: [20, 24, 28, 32, 36]
|
||||
}
|
||||
},
|
||||
"千岩长枪": {
|
||||
@ -68,10 +68,10 @@ let polearm = {
|
||||
}
|
||||
},
|
||||
"和璞鸢": {
|
||||
title: "满层攻击力提高[atkPct]%,伤害提升[dmgPct]%",
|
||||
title: "满层攻击力提高[atkPct]%,伤害提升[dmg]%",
|
||||
refine: {
|
||||
atkPct: [3.2 * 7, 3.9 * 7, 4.6 * 7, 5.3 * 7, 6 * 7],
|
||||
dmgPct: [12, 15, 18, 21, 24]
|
||||
dmg: [12, 15, 18, 21, 24]
|
||||
}
|
||||
},
|
||||
"天空之脊": {
|
||||
@ -81,12 +81,12 @@ let polearm = {
|
||||
}
|
||||
},
|
||||
"护摩之杖": {
|
||||
title: "角色生命低于50%时获得攻击力提升[atkPlus]",
|
||||
title: "角色生命低于50%时额外获得[atkPlus]攻击力",
|
||||
data: {
|
||||
atkPlus: ({ attr, refine }) => {
|
||||
let { hp } = attr,
|
||||
totalHp = hp.base + hp.plus + hp.pct * hp.base / 100;
|
||||
return totalHp * [1, 1.2, 1.4, 1.6, 1.8][refine] / 100
|
||||
return totalHp * ([0.8, 1, 1.2, 1.4, 1.6][refine] + [1, 1.2, 1.4, 1.6, 1.8][refine]) / 100
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user