Balance mixed damage lifesteal optimizer
This commit is contained in:
@@ -698,20 +698,20 @@ function calculateOptimizationMetric(candidateTotals, combatStyle, optimizationT
|
|||||||
const dps = calculateDps(candidateTotals, combatStyle);
|
const dps = calculateDps(candidateTotals, combatStyle);
|
||||||
const lifestealRegen = calculateRegenDetails(candidateTotals, dps).lifesteal;
|
const lifestealRegen = calculateRegenDetails(candidateTotals, dps).lifesteal;
|
||||||
if (optimizationTarget === OPTIMIZATION_TARGETS.LIFESTEAL_REGEN) return lifestealRegen;
|
if (optimizationTarget === OPTIMIZATION_TARGETS.LIFESTEAL_REGEN) return lifestealRegen;
|
||||||
if (optimizationTarget === OPTIMIZATION_TARGETS.DAMAGE_LIFESTEAL_MIX) return (2 * dps) + lifestealRegen;
|
|
||||||
return dps;
|
return dps;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOptimizationMetricLabel(optimizationTarget) {
|
function getOptimizationMetricLabel(optimizationTarget) {
|
||||||
if (optimizationTarget === OPTIMIZATION_TARGETS.DAMAGE_LIFESTEAL_MIX) return "Optimal weighted score";
|
if (optimizationTarget === OPTIMIZATION_TARGETS.DAMAGE_LIFESTEAL_MIX) return "Optimal DPS with 2:1 mix";
|
||||||
return optimizationTarget === OPTIMIZATION_TARGETS.LIFESTEAL_REGEN ? "Optimal lifesteal regen" : "Optimal DPS";
|
return optimizationTarget === OPTIMIZATION_TARGETS.LIFESTEAL_REGEN ? "Optimal lifesteal regen" : "Optimal DPS";
|
||||||
}
|
}
|
||||||
|
|
||||||
function findOptimalDamageSetup(totals, effectCount, combatStyle, optimizationTarget) {
|
function findOptimalDamageSetup(totals, effectCount, combatStyle, optimizationTarget) {
|
||||||
const effectIds = getDamageOptimizationEffectIds(combatStyle, optimizationTarget);
|
const effectIds = getDamageOptimizationEffectIds(combatStyle, optimizationTarget);
|
||||||
const emptyTotals = { ...totals, effects: createEmptyEffectTotals() };
|
const emptyTotals = { ...totals, effects: createEmptyEffectTotals() };
|
||||||
|
const requiredLifestealCount = optimizationTarget === OPTIMIZATION_TARGETS.DAMAGE_LIFESTEAL_MIX ? Math.round(effectCount / 3) : null;
|
||||||
let best = {
|
let best = {
|
||||||
metric: calculateOptimizationMetric(emptyTotals, combatStyle, optimizationTarget),
|
metric: requiredLifestealCount ? -Infinity : calculateOptimizationMetric(emptyTotals, combatStyle, optimizationTarget),
|
||||||
counts: Object.fromEntries(effectIds.map((id) => [id, 0])),
|
counts: Object.fromEntries(effectIds.map((id) => [id, 0])),
|
||||||
};
|
};
|
||||||
const counts = Object.fromEntries(effectIds.map((id) => [id, 0]));
|
const counts = Object.fromEntries(effectIds.map((id) => [id, 0]));
|
||||||
@@ -720,6 +720,10 @@ function findOptimalDamageSetup(totals, effectCount, combatStyle, optimizationTa
|
|||||||
const effectId = effectIds[effectIndex];
|
const effectId = effectIds[effectIndex];
|
||||||
if (effectIndex === effectIds.length - 1) {
|
if (effectIndex === effectIds.length - 1) {
|
||||||
counts[effectId] = remaining;
|
counts[effectId] = remaining;
|
||||||
|
if (requiredLifestealCount !== null && counts.lifesteal !== requiredLifestealCount) {
|
||||||
|
counts[effectId] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const effects = createEmptyEffectTotals();
|
const effects = createEmptyEffectTotals();
|
||||||
for (const id of effectIds) effects[id] = counts[id] * effectById(id).cap;
|
for (const id of effectIds) effects[id] = counts[id] * effectById(id).cap;
|
||||||
const candidateTotals = { baseDamage: totals.baseDamage, baseHealth: totals.baseHealth, effects };
|
const candidateTotals = { baseDamage: totals.baseDamage, baseHealth: totals.baseHealth, effects };
|
||||||
|
|||||||
Reference in New Issue
Block a user