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}}