diff --git a/CHANGELOG.md b/CHANGELOG.md index 86019518..529df906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,16 @@ -# 1.2.2 +# 1.2.3 * `#角色面板` 增加伤害计算功能 * 目前支持角色:雷神、胡桃、魈、神子、甘雨、宵宫、公子、绫人、绫华 * `#角色面板` 功能升级 - * 优化无角色面板数据时的引导 - * 优化返回的图像格式及分辨率,平衡响应速度及显示效果 + * 优化无角色面板数据时的引导 + * 优化返回的图像格式及分辨率,平衡响应速度及显示效果 +* 增加 `#甘雨伤害` 命令,可以查看伤害计算的具体Buff效果。后续会完善计算逻辑 * 增加 `#圣遗物列表` 命令,对已经获取面板的所有角色圣遗物进行评分,并展示高评分的圣遗物列表 * 增加 `#角色面板列表` 命令,查看已经获取面板的角色列表 * 增加 `#更新胡桃面板` 命令,获取单个角色面板数据,每天可更新5次 * 更改 `#更新全部面板` 命令,获取角色展柜全部8个角色,每天可更新3次 - # 1.2.0 * `#角色面板` 增加伤害计算功能 diff --git a/apps/character.js b/apps/character.js index 010ebb72..5d70b602 100644 --- a/apps/character.js +++ b/apps/character.js @@ -68,6 +68,9 @@ export async function character(e, { render, User }) { if (/(详情|详细|面板|面版)$/.test(msg) && !/更新/.test(msg)) { mode = 'profile'; name = name.replace(/(详情|详细|面板|面版)/, "").trim(); + } else if (/伤害$/.test(msg)) { + mode = 'dmg'; + name = name.replace(/伤害/, "").trim(); } else if (/(详情|详细|面板|面版)更新$/.test(msg) || (/更新/.test(msg) && /(详情|详细|面板|面版)$/.test(msg))) { mode = "refresh"; name = name.replace(/详情|详细|面板|面版|更新/g, "").trim(); @@ -80,8 +83,8 @@ export async function character(e, { render, User }) { } - if (mode === "profile") { - return renderProfile(e, char, render); + if (mode === "profile" || mode === "dmg") { + return renderProfile(e, char, render, mode); } else if (mode === "refresh") { e.avatar = char.id; await getProfile(e); @@ -561,7 +564,7 @@ async function getAvatar(e, char, MysApi) { } -export async function renderProfile(e, char, render) { +export async function renderProfile(e, char, render, mode = "profile") { if (['荧', '空', '主角', '旅行者'].includes(char.name)) { e.reply("暂不支持主角的面板信息查看"); @@ -664,7 +667,10 @@ export async function renderProfile(e, char, render) { ds.avg = Format.comma(ds.avg, 0); dmgData.push(ds); }) - dmgMsg = dmgCalc.msg; + lodash.forEach(dmgCalc.msg, (msg) => { + msg.replace(":", ":"); + dmgMsg.push(msg.split(":")) + }) } let base64 = await render("character", "detail", { @@ -688,6 +694,7 @@ export async function renderProfile(e, char, render) { usefulTitles, usefulMark, talentMap: { a: "普攻", e: "战技", q: "爆发" }, + mode, cfgScale: Cfg.scale(1.8) }); if (base64) { diff --git a/components/Calc.js b/components/Calc.js index 80e4f6d8..ccebc86e 100644 --- a/components/Calc.js +++ b/components/Calc.js @@ -241,7 +241,7 @@ let Calc = { } lodash.forEach(weaponCfg, (ds) => { - ds.title = `${weaponName}:${ds.title}`; + ds.title = `${weaponName}效果:${ds.title}`; if (ds.refine) { ds.data = ds.data || {}; lodash.forEach(ds.refine, (r, key) => { @@ -391,13 +391,18 @@ let Calc = { } } + cpctNum = Math.max(0, Math.min(1, cpctNum)); + if (cpctNum === 0) { + cdmgNum = 0; + } + // 计算最终伤害 let ret = { dmg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cdmgNum) * defNum * kNum * eleNum, avg: (atkNum * pctNum * (1 + multiNum) + plusNum) * dmgNum * (1 + cpctNum * cdmgNum) * defNum * kNum * eleNum } - // console.log(attr, { atkNum, pctNum, multiNum, plusNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum, kNum }, ret) + // console.log(attr, { atkNum, pctNum, multiNum, plusNum, dmgNum, cpctNum, cdmgNum, defNum, eleNum, kNum }, ret) return ret; }; diff --git a/index.js b/index.js index 88a2fe24..504d139c 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ export { let rule = { character: { - reg: "^#(喵喵)?(更新)?(.*)(详情|详细|面板|面版)?(更新)?$", + reg: "^#(喵喵)?(更新)?(.*)(详情|详细|面板|面版|伤害)?(更新)?$", describe: "【#角色】角色详情", }, getArtis: { diff --git a/resources/character/detail.css b/resources/character/detail.css index a1f70131..d5ff9e6f 100644 --- a/resources/character/detail.css +++ b/resources/character/detail.css @@ -303,8 +303,7 @@ body { /*** dmg ***/ - -.dmg-cont { +.cont { border-radius: 10px; background: url("../common/cont/card-bg.png") top left repeat-x; background-size: auto 100%; @@ -312,12 +311,15 @@ body { position: relative; box-shadow: 0 0 1px 0 #ccc, 2px 2px 4px 0 rgba(50, 50, 50, .8); overflow: hidden; - display: table; - width: calc(100% - 25px); color: #fff; font-size: 16px; } +.dmg-cont { + display: table; + width: calc(100% - 25px); +} + .dmg-cont .tr { display: table-row; } @@ -335,11 +337,11 @@ body { box-shadow: 0 0 1px 0 #fff; } -.dmg-cont .th { +.dmg-cont .thead { text-align: center; } -.dmg-cont .th > div { +.dmg-cont .thead > div { font-family: YS; color: #d3bc8e; background: rgba(0, 0, 0, .4); @@ -348,12 +350,14 @@ body { } -.dmg-cont .title { +.dmg-cont .title, +.dmg-cont .th { font-family: YS; color: #d3bc8e; padding-right: 15px; text-align: right; background: rgba(0, 0, 0, .4); + min-width: 100px; } @@ -420,7 +424,7 @@ body { display: block; } -.artis .item .arti-icon img { +.artis .item .arti-icon img { width: 60px; height: 60px; } @@ -643,6 +647,28 @@ body { line-height: 40px; } +.dmg-msg { + font-family: Number, YS; + font-size: 13px; + font-weight: normal; + margin-top: 15px; +} + +.dmg-msg .th { + width: 33%; +} + +.dmg-msg .tr .td { + padding: 8px 10px; +} + +.dmg-msg .info { + font-size: 12px; + text-align: left; + padding-left: 10px; + font-weight: normal; +} + .artis .stat span { font-size: 13px; diff --git a/resources/character/detail.html b/resources/character/detail.html index f335f598..2f5ff01c 100644 --- a/resources/character/detail.html +++ b/resources/character/detail.html @@ -50,7 +50,7 @@ {{if dmgData.length > 0}}
-
+
伤害类型
暴击伤害
平均伤害(计算暴击率)
@@ -66,6 +66,7 @@
目标为{{enemyLv}}级小宝,如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置
{{/if}} + {{if mode === "profile"}}
@@ -106,6 +107,24 @@
{{/each}}
+ {{/if}} + + {{if mode === "dmg"}} +
+
+
+ Buff列表 +
+
部分Buff的触发条件以及层数可能影响实际伤害结果
+
+ {{each dmgMsg msg}} +
+
{{msg[0]}}
+
{{msg[1]}}
+
+ {{/each}} +
+ {{/if}}
diff --git a/resources/meta/character/宵宫/calc.js b/resources/meta/character/宵宫/calc.js index f33c9799..e83d1ca8 100644 --- a/resources/meta/character/宵宫/calc.js +++ b/resources/meta/character/宵宫/calc.js @@ -13,7 +13,7 @@ export const details = [{ }]; export const buffs = [{ - title: "宵宫E:开启后额外提升普通[aMulti]%伤害", + title: "焰硝庭火舞:开启E后额外提升普通[aMulti]%伤害", data: { aMulti: ({ talent }) => talent.e["炽焰箭伤害"] - 100 } @@ -23,7 +23,7 @@ export const buffs = [{ dmg: ({ params }) => params.num ? params.num * 2 : 20 } }, { - title: "命座2:宵宫造成暴击后获得25%火伤加成", + title: "宵宫2命:宵宫造成暴击后获得25%火伤加成", cons: 2, data: { dmg: ({ params }) => params.num > 1 ? 25 : 0 diff --git a/resources/meta/character/甘雨/calc.js b/resources/meta/character/甘雨/calc.js index 252d54e9..bbd7e280 100644 --- a/resources/meta/character/甘雨/calc.js +++ b/resources/meta/character/甘雨/calc.js @@ -17,13 +17,13 @@ export const details = [{ export const buffs = [{ cons: 1, - title: "1命效果:霜华失命中减少敌人15%冰抗", + title: "甘雨1命:霜华失命中减少敌人15%冰抗", data: { kx: ({ params }) => params.q ? 0 : 15 } }, { cons: 4, - title: "4命效果:大招领域内敌人受到的伤害提升25%", + title: "甘雨4命:大招领域内敌人受到的伤害提升25%", data: { dmg: ({ params }) => params.q ? 25 : 0 } diff --git a/resources/meta/character/胡桃/calc.js b/resources/meta/character/胡桃/calc.js index add071b7..07532721 100644 --- a/resources/meta/character/胡桃/calc.js +++ b/resources/meta/character/胡桃/calc.js @@ -10,19 +10,18 @@ export const details = [{ }]; export const buffs = [{ - title: `被动天赋:半血获得33%火伤加成`, - data: { - "dmg": 33 - } - -}, { - title: "元素精通:蒸发融化伤害提高[zf]%", - mastery: "zf,rh" -}, { - title: "胡桃E:获得[atkPlus]点攻击力加成", + title: "蝶引来生:开E获得[atkPlus]点攻击力加成", data: { atkPlus: ({ talent, attr, calc }) => { return talent.e['攻击力提高'] * calc(attr.hp) / 100; } } +}, { + title: `胡桃被动:半血获得33%火伤加成`, + data: { + "dmg": 33 + } +}, { + title: "元素精通:蒸发融化伤害提高[zf]%", + mastery: "zf,rh" }]; \ No newline at end of file diff --git a/resources/meta/character/雷电将军/calc.js b/resources/meta/character/雷电将军/calc.js index 9f023929..a02b69d8 100644 --- a/resources/meta/character/雷电将军/calc.js +++ b/resources/meta/character/雷电将军/calc.js @@ -28,23 +28,23 @@ export const defParams = { export const buffs = [ { - title: `E被动:元素爆发伤害提升[qDmg]%`, + title: `恶曜开眼:开E元素爆发伤害提升[qDmg]%`, data: { "qDmg": ({ talent }) => talent.e["元素爆发伤害提高"] * 90 } }, { - check: ({ cons }) => cons >= 2, - title: "2命效果:大招无视敌人[qDef]%防御力", - data: { - "qIgnore": 60 - } - }, { - title: "Q被动:满愿力获得[qPct]%大招倍率加成", + title: "梦想真说:Q满愿力获得[qPct]%大招倍率加成", data: { "qPct": ({ talent, params }) => talent.q["愿力加成"][params.type || 0] * params.num } }, { - title: "基于元素充能获得[dmg]%雷伤加成", + check: ({ cons }) => cons >= 2, + title: "雷神2命:大招无视敌人[qDef]%防御力", + data: { + "qIgnore": 60 + } + }, { + title: "雷神被动:基于元素充能获得[dmg]%雷伤加成", data: { dmg: ({ attr }) => Math.max(attr.recharge.base + attr.recharge.plus - 100, 0) * 0.4 } diff --git a/resources/meta/character/魈/calc.js b/resources/meta/character/魈/calc.js index 31091c2a..076f7486 100644 --- a/resources/meta/character/魈/calc.js +++ b/resources/meta/character/魈/calc.js @@ -1,18 +1,18 @@ export const details = [{ - title: "裸E", + title: "风轮两立", dmg: ({ talent }, dmg) => dmg(talent.e["技能伤害"], "e") }, { title: "满层被动E", params: { e: 1 }, dmg: ({ talent }, dmg) => dmg(talent.e["技能伤害"], "e") }, { - title: "开Q后首插", + title: "靖妖傩舞·首插", params: { layer: 1 }, dmg: ({ talent }, dmg) => dmg(talent.a["低空/高空坠地冲击伤害"][1], "a3") }, { - title: "开Q后尾插", + title: "靖妖傩舞·尾插", params: { layer: 5 }, @@ -25,15 +25,15 @@ export const defParams = { } export const buffs = [{ + title: "靖妖傩舞:下落攻击伤害提升[a3Dmg]%", + data: { + a3Dmg: ({ talent }) => talent.q['普通攻击/重击/下落攻击伤害提升'] + } +}, { title: `魈天赋:开Q后每3秒伤害提升5%,满层提高25%`, data: { dmg: ({ params }) => params.layer * 5 } -}, { - title: "魈大招:下落攻击伤害提升[a3Dmg]%", - data: { - a3Dmg: ({ talent }) => talent.q['普通攻击/重击/下落攻击伤害提升'] - } }, { title: "魈被动:3层E使E的伤害提高45%", data: {