#角色详情 伤害计算增加 八重神子

This commit is contained in:
yoimiya-kokomi 2022-04-26 03:59:13 +08:00
parent d52ae8adf8
commit 2e5d999f69
6 changed files with 349 additions and 17 deletions

View File

@ -128,9 +128,13 @@ export async function wife(e, { render, User }) {
cookieType: "all",
actionName: "查询信息"
});
if (!MysApi || !MysApi.selfUser) {
return true;
}
let selfUser = MysApi.selfUser;
let selfMysUser = await MysApi.selfUser.getMysUser();
let selfMysUser = await selfUser.getMysUser();
let isSelf = true;
if (!selfMysUser || selfMysUser.uid !== MysApi.targetUser.uid) {
isSelf = false;

View File

@ -3,7 +3,11 @@ import lodash from "lodash";
import Format from "./Format.js";
const eleMap = {
Anemo: "风",
Cryo: "冰",
Electro: "雷",
Geo: "岩",
Hydro: "水",
Pyro: "火"
}
@ -93,6 +97,8 @@ let Calc = {
ret.zf = 0;
ret.rh = 0;
ret.kx = 0;
return ret;
},
@ -133,6 +139,20 @@ let Calc = {
return ret;
},
getDs(attr, meta, params) {
return {
...meta,
attr,
params,
refine: attr.refine,
weaponType: attr.weaponType,
element: eleMap[attr.element] || attr.element,
calc(ds) {
return (ds.base || 0) + (ds.plus || 0) + ((ds.base || 0) * (ds.pct || 0) / 100)
}
}
},
calcAttr(originalAttr, buffs, meta, params = {}) {
let attr = lodash.merge({}, originalAttr);
@ -140,20 +160,17 @@ let Calc = {
lodash.forEach(buffs, (buff) => {
let ds = {
...meta,
attr,
params,
refine: attr.refine,
calc(ds) {
return (ds.base || 0) + (ds.plus || 0) + ((ds.base || 0) * (ds.pct || 0) / 100)
}
};
let ds = Calc.getDs(attr, meta, params);
// 如果存在rule则进行计算
if (buff.check && !buff.check(ds)) {
return;
}
if (buff.cons) {
if (ds.cons * 1 < buff.cons * 1) {
return;
}
}
let title = buff.title;
@ -189,7 +206,7 @@ let Calc = {
return;
}
if (["zf", "rh"].includes(key)) {
if (["zf", "rh", "kx"].includes(key)) {
attr[key] += val * 1 || 0;
}
});
@ -302,6 +319,10 @@ let Calc = {
let { attr } = Calc.calcAttr(originalAttr, buffs, meta, params);
if (detail.check && !detail.check(Calc.getDs(attr, meta, params))) {
return;
}
let dmg = function (pctNum = 0, talent = false, ele = false) {
let { atk, dmg, cdmg, cpct } = attr;
// 攻击区

View File

@ -371,7 +371,7 @@ body {
.dmg-notice {
font-size: 12px;
text-align: right;
color: #eee;
color: #f5f5f5;
margin-right: 15px;
}
@ -661,3 +661,7 @@ body {
.char-香菱 .main-pic {
margin-left: -195px;
}
.char-迪奥娜 .main-pic {
margin-left: -180px;
}

View File

@ -63,7 +63,7 @@
</div>
{{/each}}
</div>
<div class="dmg-notice">目标为{{enemyLv}}小宝,如需调整等级请使用 #敌人等级85 来进行设置</div>
<div class="dmg-notice">目标为{{enemyLv}}级小宝,如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置</div>
{{/if}}
<div class="artis">

View File

@ -45,7 +45,7 @@ export const buffs = {
}
},
"流浪大地的乐团4": {
check: ({ weaponType }) => ['法器', '弓'].includes(weaponType),
check: ({ weaponType }) => ['法器', '弓'].includes(weaponType),
title: "乐团4角色重击造成的伤害提高35%",
data: {
a2Dmg: 35
@ -71,6 +71,7 @@ export const buffs = {
}
},
"炽烈的炎之魔女4": {
check:({element})=>element === "火",
title: "魔女4蒸发、融化伤害提高15%2层获得15%火元素伤害加成",
data: {
zf: 15,
@ -91,12 +92,14 @@ export const buffs = {
}
},
"冰风迷途的勇士4": {
check:({element})=>element === "冰",
title: "冰套4攻击处于冰元素影响下的敌人时暴击率提高20%",
data: {
cpct: 20
}
},
"沉沦之心4": {
check:({element})=>element === "水",
title: "水套4施放元素战技后普攻与重击伤害提高30%",
data: {
aDmg: 30,
@ -126,12 +129,14 @@ export const buffs = {
}
},
"平息鸣雷的尊者4": {
check:({element})=>element === "雷",
title: "平雷4对处于雷元素影响下的敌人造成的伤害提升35%",
data: {
dmg: 35
}
},
"渡过烈火的贤人4": {
check:({element})=>element === "火",
title: "渡火4对处于火元素影响下的敌人造成的伤害提升35%",
data: {
dmg: 35

View File

@ -106,6 +106,304 @@ let polearm = {
}
}
}]
}
};
export const weapons = { ...polearm };
let catalyst = {
"翡玉法球": {
check: ({ element }) => element === "水",
title: "触发蒸发、感电、冰冻或水元素扩散反应后的12秒内攻击力提高[atkPct]%",
refine: {
atkPct: [20, 25, 30, 35, 40]
}
},
"魔导绪论": {
check: ({ element }) => ["水", "雷"].includes(element),
title: "对处于水元素或雷元素影响下的敌人,造成的伤害提高[dmg]%",
refine: {
dmg: [12, 15, 18, 21, 24]
}
},
"甲级宝珏": {
title: "击败敌人后攻击力提升[atkPct]%",
refine: {
atkPct: [12, 14, 16, 18, 20]
}
},
"黑岩绯玉": {
title: "击败敌人后,满层攻击力提升[atkPct]%",
buffCount: 3,
refine: {
atkPct: [12, 15, 18, 21, 24]
}
},
"万国诸海图谱": {
title: "触发元素反应后,满层提高[dmg]%的元素伤害",
buffCount: 2,
refine: {
dmg: [8, 10, 12, 14, 16]
}
},
"宗室秘法录": {
title: "3层状态下提高暴击率[cpct]%",
buffCount: 3,
refine: {
cpct: [8, 10, 12, 14, 16]
}
},
"匣里日月": {
title: "普攻提高元素战技与爆发伤害[eDmg]%,元素战技与爆发提高普攻伤害[aDmg]%",
refine: {
aDmg: [20, 25, 30, 35, 40],
eDmg: [20, 25, 30, 35, 40],
qDmg: [20, 25, 30, 35, 40]
}
},
"流浪乐章": {
title: "咏叹调下全元素伤害提升[dmg]%",
refine: {
dmg: [48, 60, 72, 84, 96]
}
},
"暗巷的酒与诗": {
title: "冲刺后攻击力提升[atkPct]%",
refine: {
atkPct: [20, 25, 30, 35, 40]
}
},
"嘟嘟可故事集": {
title: "普攻提高重击伤害[a2Dmg]%,重击提高攻击力[atkPct]%",
refine: {
a2Dmg: [16, 20, 24, 28, 32],
atkPct: [8, 10, 12, 14, 16]
}
},
"白辰之环": {
title: "与雷元素反应后提高元素反应加成[dmg]%",
refine: {
dmg: [10, 12.5, 15, 17.5, 20]
}
},
"证誓之明瞳": {
title: "施放元素战技后,元素充能效率提升[recharge]%",
refine: {
recharge: [24, 30, 36, 42, 48]
}
},
"四风原典": {
title: "满层获得[dmg]%的元素伤害加成",
buffCount: 4,
refine: {
dmg: [8, 10, 12, 14, 16]
}
},
"天空之卷": {
title: "元素伤害加成提升[dmg]%",
refine: {
dmg: [12, 15, 18, 21, 24]
}
},
"尘世之锁": {
title: "护盾+满层情况下攻击力提高[atkPct]%",
buffCount: 10,
refine: {
atkPct: [4, 5, 6, 7, 8]
}
},
"不灭月华": {
title: "治疗加成提高[heal]%,普攻伤害增加[aPlus]",
refine: {
heal: [10, 12.5, 15, 17.5, 20]
},
data: {
aPlus: ({ attr, calc }) => calc(attr.hp) / 100
}
},
"神乐之真意": {
title: "满层提高元素战技伤害[eDmg]%,元素伤害提高[dmg]%",
refine: {
eDmg: [12 * 3, 15 * 3, 18 * 3, 21 * 3, 24 * 3],
dmg: [12, 15, 18, 21, 24]
}
}
};
let bow = {
"鸦羽弓": {
check: ({ element }) => ['水', '火'].includes(element),
title: "对处于水或火元素影响下的敌人,造成的伤害提高[dmg]%",
refine: {
dmg: [12, 15, 18, 21, 24]
}
},
"神射手之誓": {
title: "针对要害造成的伤害提升[a2Dmg]%",
refine: {
a2Dmg: [24, 30, 36, 42, 48]
}
},
"弹弓": {
title: "普攻与重击的箭矢0.3秒内击中敌人,伤害增加[a2Dmg]%",
refine: {
aDmg: [36, 42, 48, 54, 60],
a2Dmg: [36, 42, 48, 54, 60]
}
},
"绝弦": {
title: "元素战技与元素爆发的伤害提高[eDmg]%",
refine: {
eDmg: [24, 30, 36, 42, 48],
qDmg: [24, 30, 36, 42, 48]
}
},
"暗巷猎手": {
title: "满层提高[dmg]%伤害",
refine: {
dmg: [20, 25, 30, 35, 40]
}
},
"黑岩战弓": {
title: "击败敌人后,攻击力满层提升[atkPct]%",
buffCount: 3,
refine: {
atkPct: [12, 15, 18, 21, 24]
}
},
"钢轮弓": {
title: "普通攻击与重击命中时,满层提升[atkPct]%",
buffCount: 4,
refine: {
atkPct: [4, 5, 6, 7, 8]
}
},
"试作澹月": {
title: "重击命中要害提高[atkPct]%攻击力",
refine: {
atkPct: [36, 45, 54, 63, 72]
}
},
"宗室长弓": {
title: "3层提高暴击率[cpct]%",
buffCount: 3,
refine: {
cpct: [8, 10, 12, 14, 16]
}
},
"弓藏": {
title: "普攻造成的伤害提升[aDmg]%",
refine: {
aDmg: [40, 50, 60, 70, 80]
}
},
"风花之颂": {
title: "施放元素战技时攻击力提升[atkPct]%",
refine: {
atkPct: [16, 20, 24, 28, 32]
}
},
"幽夜华尔兹": {
title: "Buff下普攻及元素战技造成的伤害提升[aDmg]%",
refine: {
aDmg: [20, 25, 30, 35, 40],
eDmg: [20, 25, 30, 35, 40]
}
},
"破魔之弓": {
title: "满能量下普攻伤害提高[aDmg]%,重击伤害提高[a2Dmg]%",
buffCount: 2,
refine: {
aDmg: [16, 20, 24, 28, 32],
a2Dmg: [12, 15, 18, 21, 24]
}
},
"掠食者": {
check: ({ element }) => element === "冰",
title: "满Buff普攻与重击伤害提高[aDmg]%埃洛伊攻击力提升66",
refine: {
aDmg: [20],
atkPlus: 66
}
},
"曚云之月": {
title: "满层元素爆发伤害提高[qDmg]%",
refine: {
qDmg: [40, 50, 60, 70, 80]
}
},
"冬极白星": [{
title: "元素战技与元素爆发伤害提高[eDmg]%",
refine: {
eDmg: [12, 15, 18, 21, 24],
qDmg: [12, 15, 18, 21, 24],
}
}, {
title: "满Buff下提高攻击力[atkPct]%",
refine: {
atkPct: [48, 60, 72, 84, 96]
}
}],
"飞雷之弦振": [{
title: "攻击力提高[atkPct]%",
refine: {
atkPckt: [20, 25, 30, 35, 40]
}
}, {
title: "满Buff下提高普攻伤害[aDmg]%",
refine: {
aDmg: [40, 50, 60, 70, 80]
}
}],
"终末嗟叹之诗": [{
title: "元素精通提高[mastery]",
refine: {
mastery: [60, 75, 90, 105, 120]
}
}, {
title: "Buff下提高元素精通[mastery],攻击力[atkPct]%",
refine: {
mastery: [100, 125, 150, 175, 200],
atkPct: [20, 25, 30, 35, 40]
}
}],
"阿莫斯之弓": [{
title: "普攻与重击伤害提高[a2Dmg]%",
refine: {
aDmg: [12, 15, 18, 21, 24],
a2Dmg: [12, 15, 18, 21, 24]
}
}, {
title: "5段Buff重击伤害提高[a2Dmg]%",
buffCount: 5,
refine: {
aDmg: [8, 10, 12, 14, 16],
a2Dmg: [8, 10, 12, 14, 16]
}
}],
"天空之翼": {
title: "暴击伤害提高[cdmg]%",
refine: {
cdmg: [20, 25, 30, 35, 40]
}
},
"若水": {
title: "生命值提高[hpPct]%,伤害提高[dmg]%",
refine: {
hpPct: [16, 20, 24, 28, 32],
dmg: [20, 25, 30, 35, 40]
}
},
"陨龙之梦": {
title: "护盾+满Buff提高攻击力[atkPct]%",
buffCount: 10,
refine: {
atkPct: [4, 5, 6, 7, 8]
}
},
"落霞": {
title: "二层状态下提高伤害[dmg]%",
refine: {
dmg: [10, 12.5, 15, 17.5, 20]
}
}
};
export const weapons = { ...polearm, ...catalyst, ...bow };