薇薇安伤害计算

This commit is contained in:
UCPr 2025-05-30 00:28:39 +08:00
parent 297be2d481
commit 7ace8908ff
9 changed files with 240 additions and 53 deletions

View file

@ -112,7 +112,7 @@ export class Calculator {
const areas = {};
if (skill.before)
skill.before({ avatar: this.avatar, calc: this, usefulBuffs, skill, props, areas });
const isAnomaly = typeof anomalyEnum[skill.type] === 'number';
const isAnomaly = typeof anomalyEnum[skill.type.slice(0, 2)] === 'number';
if (!areas.BasicArea) {
let Multiplier = props.倍率;
if (!Multiplier) {
@ -120,7 +120,7 @@ export class Calculator {
Multiplier = skill.fixedMultiplier;
}
else if (isAnomaly) {
Multiplier = (skill.type === '紊乱' ?
Multiplier = (skill.type.startsWith('紊乱') ?
this.get_DiscoverMultiplier(skill) :
this.get_AnomalyMultiplier(skill, usefulBuffs, skill.name.includes('每') ? 1 : 0)) || 0;
}
@ -146,7 +146,7 @@ export class Calculator {
areas.AnomalyProficiencyArea ??= this.get_AnomalyProficiencyArea(skill, usefulBuffs);
areas.AnomalyBoostArea ??= this.get_AnomalyBoostArea(skill, usefulBuffs);
areas.LevelArea ??= this.get_LevelArea();
if (skill.type !== '紊乱') {
if (!skill.type.startsWith('紊乱')) {
props.异常暴击率 ??= this.get_AnomalyCRITRate(skill, usefulBuffs);
props.异常暴击伤害 ??= this.get_AnomalyCRITDMG(skill, usefulBuffs);
areas.CriticalArea ??= 1 + props.异常暴击率 * (props.异常暴击伤害 - 1);
@ -372,23 +372,28 @@ export class Calculator {
logger.debug(`技能倍率:${Multiplier}`);
return Multiplier;
}
get_AnomalyData(type) {
get_AnomalyData(anomaly) {
if (!anomaly) {
return AnomalyData.find(({ element_type, sub_element_type, multiplier }) => multiplier &&
element_type === this.avatar.element_type &&
sub_element_type === this.avatar.sub_element_type);
}
let a = AnomalyData.filter(({ element_type }) => element_type === this.avatar.element_type);
if (type === '紊乱')
if (anomaly === '紊乱')
a = a.filter(({ discover }) => discover);
else
a = a.filter(({ name, multiplier }) => name === type && multiplier);
a = a.filter(({ name, multiplier }) => name === anomaly && multiplier);
if (a.length === 1)
return a[0];
a = a.filter(({ sub_element_type }) => sub_element_type === this.avatar.sub_element_type);
return a[0];
}
get_AnomalyMultiplier(skill, usefulBuffs, times = 0) {
const anomalyData = this.get_AnomalyData(skill.type);
const anomalyData = this.get_AnomalyData(skill?.type.slice(0, 2));
if (!anomalyData)
return;
let Multiplier = anomalyData.multiplier;
if (anomalyData.duration && anomalyData.interval) {
if (times !== 1 && anomalyData.duration && anomalyData.interval) {
const AnomalyDuration = this.get_AnomalyDuration(skill, usefulBuffs, anomalyData.duration);
times ||= Math.floor((AnomalyDuration * 10) / (anomalyData.interval * 10));
Multiplier = anomalyData.multiplier * times;
@ -397,7 +402,7 @@ export class Calculator {
return Multiplier;
}
get_DiscoverMultiplier(skill) {
const anomalyData = this.get_AnomalyData(skill.type);
const anomalyData = this.get_AnomalyData(skill?.type.slice(0, 2));
if (!anomalyData)
return;
const AnomalyDuration = this.get_AnomalyDuration({