weirdgloop / osrs-dps-calc

Web-based DPS calculator for Old School RuneScape
GNU General Public License v3.0
29 stars 37 forks source link

Obsidian armor and salve amulet damage bonuses not stacking #127

Closed jmyaeger closed 9 months ago

jmyaeger commented 9 months ago

What went wrong?

When equipping full obsidian armor + an obsidian weapon against an undead monster, I don't get an increase in max hit when adding a salve amulet (ei). The salve boost does get applied correctly without the armor.

What did you expect to happen?

The two damage bonuses should stack—specifically, the 20% salve bonus should be applied first (multiplicatively) to the base max hit, and then the 10% obsidian armor bonus should be calculated from the base max hit and added. So: max_hit = int(1.2 base_dmg) + int(0.1 base_dmg).

What browsers are you seeing the problem on?

Chrome

What device(s) are you seeing the problem on?

Windows

Any other information

What appears to be happening in the code now is that the max hit is being boosted by the salve bonus, but is then overwritten as maxHit = Math.trunc(baseDmg * 11 / 10); when the obsidian bonus is applied. I think changing this to maxHit += Math.trunc(baseDmg / 10); would fix it.

As far as this specific order of operations, I am pretty confident that this is correct after a lot of in-game testing and messing around with combat formulas. I tried just about every permutation of applying these bonuses at different part of the damage calculation, and this is the only one that was consistent with all of my in-game max hits (which I tested with multiple different obsidian weapons, with and without obby armor and salve, and with and without piety).

jmyaeger commented 9 months ago

FYI, implementing it like that (multiplying maxHit by 11/10 after the salve bonus has been applied) did result in some incorrect max hits when I was testing it. The only way I got it to be fully consistent with the combat dummy max hits was to make the two boosts additive and independent of each other—in other words, basing both on the original max hit, implementing the salve bonus as maxHit = trunc(1.2 * baseDmg) and then adding trunc(0.1 * baseDmg) to that.