From 860bf2cf8dd709e3be9a962ba610261e8537ff05 Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Mon, 25 Apr 2022 03:22:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=20#=E8=A7=92=E8=89=B2=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E4=BC=A4=E5=AE=B3=E8=AE=A1=E7=AE=97=E5=A2=9E=E5=8A=A0=20?= =?UTF-8?q?=E9=AD=88=E3=80=81=E8=83=A1=E6=A1=83=202.=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20#=E6=95=8C=E4=BA=BA=E7=AD=89=E7=BA=A788=20=E6=9D=A5=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BC=A4=E5=AE=B3=E8=AE=A1=E7=AE=97=E7=9A=84=E6=95=8C?= =?UTF-8?q?=E4=BA=BA=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/character.js | 24 +++++++++++++++++++++++- components/Calc.js | 6 +++--- index.js | 8 ++++++-- resources/character/detail.html | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/apps/character.js b/apps/character.js index 66b8c492..e195d0a9 100644 --- a/apps/character.js +++ b/apps/character.js @@ -634,7 +634,7 @@ 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, enemyLv }); + let dmgCalc = await Calc.calcData({ profile, char, avatar, talentData: talent, enemyLv }); if (dmgCalc && dmgCalc.ret) { lodash.forEach(dmgCalc.ret, (ds) => { ds.dmg = Format.comma(ds.dmg, 0); @@ -671,4 +671,26 @@ export async function renderProfile(e, char, render) { e.reply(segment.image(`base64://${base64}`)); } return true; +} + +export async function enemyLv(e) { + let selfUser = await e.checkAuth({ + auth: "self" + }) + + if (!selfUser || !e.msg) { + return true; + } + let ret = /敌人等级\s*(\d{1,3})\s*$/.exec(e.msg); + if (ret && ret[1]) { + let lv = ret[1] * 1; + + await selfUser.setCfg("char.enemyLv", lv); + + lv = await selfUser.getCfg("char.enemyLv", 91); + e.reply(`敌人等级已经设置为${lv}`); + return true; + } + return true; + } \ No newline at end of file diff --git a/components/Calc.js b/components/Calc.js index aa781215..1b248b76 100644 --- a/components/Calc.js +++ b/components/Calc.js @@ -261,7 +261,7 @@ let Calc = { }) return retBuffs; }, - async calcData({ profile, char, avatar, talentData }) { + async calcData({ profile, char, avatar, talentData, enemyLv = 91 }) { let charCalcData = await Calc.getCharCalcRule(char.name); //avatar.element; @@ -334,7 +334,7 @@ let Calc = { } // 防御区 - let enemyLv = 86, lv = avatar.level; + let lv = avatar.level; let defNum = (lv + 100) / ((lv + 100) + (enemyLv + 100) * (1 - enemyDef) * (1 - enemyIgnore)); // 抗性区 @@ -357,7 +357,7 @@ let Calc = { 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) + // console.log(attr, { atkNum, pctNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum }, ret) } return ret; }; diff --git a/index.js b/index.js index 1bed082a..42a4b7c6 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import { character, getProfile, wife, wifeReg } from "./apps/character.js"; +import { character, getProfile, wife, wifeReg, enemyLv } from "./apps/character.js"; import { consStat, abyssPct } from "./apps/stat.js"; import { wiki } from "./apps/wiki.js"; import { help } from "./apps/help.js"; @@ -6,7 +6,7 @@ import lodash from "lodash"; import { rule as adminRule, updateRes, sysCfg } from "./apps/admin.js"; -export { character, wife, consStat, abyssPct, wiki, updateRes, sysCfg, help, getProfile }; +export { character, wife, consStat, abyssPct, wiki, updateRes, sysCfg, help, getProfile, enemyLv }; let rule = { @@ -38,6 +38,10 @@ let rule = { reg: "^#\s*(获取|更新)(游戏|角色)*(详情|详细|面板|面版)\s*$", describe: "【#角色】 获取游戏橱窗详情数据", }, + enemyLv: { + ret: "^#\s*敌人等级\s*\d{1,3}\s*$", + describe: "【#角色】 设置伤害计算中目标敌人的等级", + }, ...adminRule }; diff --git a/resources/character/detail.html b/resources/character/detail.html index 61ee48ae..30610832 100644 --- a/resources/character/detail.html +++ b/resources/character/detail.html @@ -63,7 +63,7 @@ {{/each}} -
伤害计算功能完善中,结果可能不准确,计算数据仅供参考
+
目标为{{enemyLv}}小宝,如需调整等级请使用 #敌人等级85 来进行设置
{{/if}}