fixed issue with dmg calculation

This commit is contained in:
Frederik Palmø 2022-04-20 18:57:33 +02:00
parent a61c33f23e
commit 4bc062c464
2 changed files with 14 additions and 13 deletions

View File

@ -130,32 +130,32 @@ function changeSort(newSort) {
function damage(weapon, infusion, upgraded, stats) {
let weaponInfusion = weapon.infusions[infusion.id];
let upgradeLevel = upgraded ? (weapon.unique ? 10 : 25) : 0;
let upgLevel = upgraded ? (weapon.unique ? 10 : 25) : 0;
let base = infusion.damage.map(
(amount, ty) => weaponInfusion.damage[ty] * (amount + infusion.upgrade[ty] * upgradeLevel),
let baseDmg = infusion.damage.map(
(dmg, ty) => weaponInfusion.damage[ty] * (dmg + infusion.upgrade[ty] * upgLevel * (weapon.unique ? 2.5 : 1.0)),
);
let scaling = stats.some((stat, i) => stat < weapon.requirements[i])
? base.map(dmg => dmg * -0.4)
: base.map((baseAmount, i) => {
let scalingDmg = stats.some((stat, i) => stat < weapon.requirements[i])
? baseDmg.map(dmg => dmg * -0.4)
: baseDmg.map((dmg, ty) => {
let statCorrection = corrections(
CORRECTIONS[weaponInfusion.corrections[i]],
CORRECTIONS[weaponInfusion.corrections[ty]],
stats,
weaponInfusion.masks[i],
weaponInfusion.masks[ty],
);
let statScaling = weaponInfusion.scaling.map(itemScaling => {
let statScaling = weaponInfusion.scaling.map(scaling => {
return (
itemScaling * infusion.scaling[i] +
itemScaling * infusion.scaling[i] * infusion.growth[i] * upgradeLevel
infusion.scaling[ty] *
(scaling + scaling * infusion.growth[ty] * upgLevel * (weapon.unique ? 4.0 : 1.0))
);
});
return statScaling
.map((scaling, statIndex) => (baseAmount * scaling * statCorrection[statIndex]) / 100.0)
.map((scaling, statIndex) => (dmg * scaling * statCorrection[statIndex]) / 100.0)
.reduce((sum, n) => sum + n);
});
return Math.floor(base.reduce((sum, n) => sum + n) + scaling.reduce((sum, n) => sum + n));
return Math.floor(baseDmg.reduce((sum, n) => sum + n) + scalingDmg.reduce((sum, n) => sum + n));
}
function corrections(calc, stats, masks) {

View File

@ -161,6 +161,7 @@ a:hover {
color: var(--link-color);
}
a.current {
color: var(--link-color);
text-decoration: underline wavy var(--link-color) 0.08rem;
text-underline-offset: 0.2rem;
}