mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
新增「扳机」伤害计算
This commit is contained in:
parent
952961c49a
commit
b256890166
8 changed files with 132 additions and 19 deletions
|
|
@ -44,8 +44,8 @@ let depth = 0, weakMapCheck = new WeakMap();
|
|||
export class BuffManager {
|
||||
avatar;
|
||||
buffs = [];
|
||||
setCount = Object.create(null);
|
||||
defaultBuff = Object.create(null);
|
||||
setCount = {};
|
||||
defaultBuff = {};
|
||||
constructor(avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ export class BuffManager {
|
|||
buff = _.merge({
|
||||
status: true,
|
||||
isForever: false,
|
||||
is: Object.create(null),
|
||||
is: {},
|
||||
...this.defaultBuff
|
||||
}, buff);
|
||||
if (buff.isForever)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export interface buff {
|
|||
forever?: boolean
|
||||
/** 是否团队增益 @default false */
|
||||
team?: boolean
|
||||
/** buff为团队增益时,同类效果是否可叠加 @default false */
|
||||
/** 为团队增益时,同名效果是否可叠加 @default false */
|
||||
stack?: boolean
|
||||
}
|
||||
}
|
||||
|
|
@ -131,8 +131,8 @@ export class BuffManager {
|
|||
readonly avatar: ZZZAvatarInfo
|
||||
readonly buffs: buff[] = []
|
||||
/** 套装计数 */
|
||||
setCount: { [name: string]: number } = Object.create(null)
|
||||
defaultBuff: { [key in keyof buff]?: buff[key] } = Object.create(null)
|
||||
setCount: { [name: string]: number } = {}
|
||||
defaultBuff: { [key in keyof buff]?: buff[key] } = {}
|
||||
|
||||
constructor(avatar: ZZZAvatarInfo) {
|
||||
this.avatar = avatar
|
||||
|
|
@ -154,7 +154,7 @@ export class BuffManager {
|
|||
buff = _.merge({
|
||||
status: true,
|
||||
isForever: false,
|
||||
is: Object.create(null),
|
||||
is: {},
|
||||
...this.defaultBuff
|
||||
}, buff)
|
||||
if (buff.isForever)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ export class Calculator {
|
|||
avatar;
|
||||
skills = [];
|
||||
cache = Object.create(null);
|
||||
props = Object.create(null);
|
||||
props = {};
|
||||
skill;
|
||||
defaultSkill = Object.create(null);
|
||||
defaultSkill = {};
|
||||
enemy;
|
||||
constructor(buffM) {
|
||||
this.buffM = buffM;
|
||||
|
|
@ -71,13 +71,13 @@ export class Calculator {
|
|||
logger.debug('自定义计算最终伤害:', dmg.result);
|
||||
return dmg;
|
||||
}
|
||||
const props = this.props = skill.props || Object.create(null);
|
||||
const props = this.props = skill.props || {};
|
||||
const usefulBuffs = this.buffM.filter({
|
||||
element: skill.element,
|
||||
range: [skill.type],
|
||||
redirect: skill.redirect
|
||||
}, this);
|
||||
const areas = Object.create(null);
|
||||
const areas = {};
|
||||
if (skill.before)
|
||||
skill.before({ avatar: this.avatar, calc: this, usefulBuffs, skill, props, areas });
|
||||
const isAnomaly = typeof anomalyEnum[skill.type] === 'number';
|
||||
|
|
@ -145,7 +145,7 @@ export class Calculator {
|
|||
d = this.calc_skill(d);
|
||||
if (!d)
|
||||
return;
|
||||
logger.debug('追加伤害:' + d.skill.name, d.result);
|
||||
logger.debug('增加伤害:' + d.skill.name, d.result);
|
||||
damage.result.expectDMG += d.result.expectDMG;
|
||||
damage.result.critDMG += d.result.critDMG;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ export class Calculator {
|
|||
readonly avatar: ZZZAvatarInfo
|
||||
readonly skills: skill[] = []
|
||||
private cache: { [type: string]: damage } = Object.create(null)
|
||||
private props: Exclude<damage['props'], undefined> = Object.create(null)
|
||||
private props: Exclude<damage['props'], undefined> = {}
|
||||
/** 当前正在计算的技能 */
|
||||
skill: skill
|
||||
defaultSkill: { [key in keyof skill]?: skill[key] } = Object.create(null)
|
||||
defaultSkill: { [key in keyof skill]?: skill[key] } = {}
|
||||
enemy: enemy
|
||||
|
||||
constructor(buffM: BuffManager) {
|
||||
|
|
@ -209,14 +209,14 @@ export class Calculator {
|
|||
logger.debug('自定义计算最终伤害:', dmg.result)
|
||||
return dmg
|
||||
}
|
||||
const props = this.props = skill.props || Object.create(null)
|
||||
const props = this.props = skill.props || {}
|
||||
/** 缩小筛选范围 */
|
||||
const usefulBuffs = this.buffM.filter({
|
||||
element: skill.element,
|
||||
range: [skill.type],
|
||||
redirect: skill.redirect
|
||||
}, this)
|
||||
const areas = Object.create(null) as damage['areas']
|
||||
const areas = {} as damage['areas']
|
||||
if (skill.before) skill.before({ avatar: this.avatar, calc: this, usefulBuffs, skill, props, areas })
|
||||
const isAnomaly = typeof anomalyEnum[skill.type as anomaly] === 'number'
|
||||
if (!areas.BasicArea) {
|
||||
|
|
@ -279,7 +279,7 @@ export class Calculator {
|
|||
damage.add = (d) => {
|
||||
if (typeof d === 'string') d = this.calc_skill(d)
|
||||
if (!d) return
|
||||
logger.debug('追加伤害:' + d.skill.name, d.result)
|
||||
logger.debug('增加伤害:' + d.skill.name, d.result)
|
||||
damage.result.expectDMG += d.result.expectDMG
|
||||
damage.result.critDMG += d.result.critDMG
|
||||
}
|
||||
|
|
|
|||
57
model/damage/character/「扳机」/calc.js
Normal file
57
model/damage/character/「扳机」/calc.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/** @type {import('../../BuffManager.ts').BuffManager['buffs']} */
|
||||
export const buffs = [
|
||||
{
|
||||
name: '2影',
|
||||
type: '暴击伤害',
|
||||
value: 0.06 * 4
|
||||
},
|
||||
{
|
||||
name: '4影',
|
||||
type: '倍率',
|
||||
value: 2,
|
||||
range: ['AXP', 'AXQ0'] // 只在AXQ0处计算一次
|
||||
}
|
||||
]
|
||||
|
||||
/** @type {import('../../Calculator.ts').Calculator['skills']} */
|
||||
export const skills = [
|
||||
// { name: '感电每次', type: '感电' },
|
||||
{ name: '普攻:冷膛射击四段', type: 'AP4' },
|
||||
{ name: '长按普攻:无音狙杀·射击', type: 'AWS' },
|
||||
{ name: '长按普攻:无音狙杀·反击', type: 'AWF' },
|
||||
{ name: '长按普攻:无音狙杀·终结', type: 'AWZ' },
|
||||
{
|
||||
name: '普攻:协奏狙杀',
|
||||
type: 'AXP',
|
||||
redirect: ['AXP', '追加攻击'],
|
||||
after: ({ damage }) => damage.x(2)
|
||||
},
|
||||
{
|
||||
name: '普攻:协奏狙杀·冥狱·连射',
|
||||
type: 'AXQ0',
|
||||
redirect: ['AXQ0', '追加攻击'],
|
||||
isHide: true,
|
||||
after: ({ damage }) => damage.x(3)
|
||||
},
|
||||
{
|
||||
name: '普攻:协奏狙杀·冥狱',
|
||||
type: 'AXQ',
|
||||
redirect: ['AXQ', '追加攻击'],
|
||||
after: ({ damage }) => damage.add('AXQ0')
|
||||
},
|
||||
{ name: '闪避反击:极魂罚', type: 'CF' },
|
||||
{ name: '强化特殊技:幽闪花葬', type: 'EQ' },
|
||||
{ name: '连携技:冥河之引', type: 'RL' },
|
||||
{ name: '终结技:冥府挽歌', type: 'RZ' },
|
||||
{
|
||||
name: '6影破甲凶弹',
|
||||
type: 'Y6',
|
||||
check: 6,
|
||||
fixedMultiplier: 12,
|
||||
before: ({ usefulBuffs }) => usefulBuffs.push({
|
||||
name: '6影',
|
||||
type: '增伤',
|
||||
value: 0.5
|
||||
})
|
||||
}
|
||||
]
|
||||
37
model/damage/character/「扳机」/data.json
Normal file
37
model/damage/character/「扳机」/data.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"skill": {
|
||||
"AP4": [
|
||||
2.43,2.651,2.872,3.093,3.314,3.535,3.756,3.977,4.198,4.419,4.64,4.861,5.082,5.303,5.524,5.745
|
||||
],
|
||||
"AWS": [
|
||||
0.476,0.52,0.564,0.608,0.652,0.696,0.74,0.784,0.828,0.872,0.916,0.96,1.004,1.048,1.092,1.136
|
||||
],
|
||||
"AWF": [
|
||||
2.339,2.552,2.765,2.978,3.191,3.404,3.617,3.83,4.043,4.256,4.469,4.682,4.895,5.108,5.321,5.534
|
||||
],
|
||||
"AWZ": [
|
||||
1.312,1.432,1.552,1.672,1.792,1.912,2.032,2.152,2.272,2.392,2.512,2.632,2.752,2.872,2.992,3.112
|
||||
],
|
||||
"AXP": [
|
||||
0.479,0.523,0.567,0.611,0.655,0.699,0.743,0.787,0.831,0.875,0.919,0.963,1.007,1.051,1.095,1.139
|
||||
],
|
||||
"AXQ0": [
|
||||
0.226,0.247,0.268,0.289,0.31,0.331,0.352,0.373,0.394,0.415,0.436,0.457,0.478,0.499,0.52,0.541
|
||||
],
|
||||
"AXQ": [
|
||||
0.452,0.494,0.536,0.578,0.62,0.662,0.704,0.746,0.788,0.83,0.872,0.914,0.956,0.998,1.04,1.082
|
||||
],
|
||||
"CF": [
|
||||
2.197,2.397,2.597,2.797,2.997,3.197,3.397,3.597,3.797,3.997,4.197,4.397,4.597,4.797,4.997,5.197
|
||||
],
|
||||
"EQ": [
|
||||
6.344,6.921,7.498,8.075,8.652,9.229,9.806,10.383,10.96,11.537,12.114,12.691,13.268,13.845,14.422,14.999
|
||||
],
|
||||
"RL": [
|
||||
5.747,6.27,6.793,7.316,7.839,8.362,8.885,9.408,9.931,10.454,10.977,11.5,12.023,12.546,13.069,13.592
|
||||
],
|
||||
"RZ": [
|
||||
14.805,16.15,17.497,18.843,20.189,21.535,22.881,24.227,25.573,26.919,28.265,29.611,30.957,32.303,33.649,34.995
|
||||
]
|
||||
}
|
||||
}
|
||||
19
model/damage/weapon/索魂影眸.js
Normal file
19
model/damage/weapon/索魂影眸.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/** @type {import('../BuffManager.ts').BuffManager['buffs']} */
|
||||
export const buffs = [
|
||||
{
|
||||
type: '无视防御',
|
||||
value: [0.25, 0.2875, 0.325, 0.3625, 0.4],
|
||||
is: {
|
||||
team: true,
|
||||
stack: false
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '冲击力',
|
||||
value: [0.04, 0.046, 0.052, 0.058, 0.064].map(v => v * 3)
|
||||
},
|
||||
{
|
||||
type: '冲击力',
|
||||
value: [0.08, 0.092, 0.104, 0.116, 0.128]
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue