devilutionX icon indicating copy to clipboard operation
devilutionX copied to clipboard

Bugfix/Refactor: Min-Max Damage Range Calculations

Open kphoenix137 opened this issue 1 year ago • 4 comments

Refactors damage calculations from the format: damage = min + rnd(max - min + 1) to: damage = randombetween(min, max)

Also fixes a bug in some damage calculations, where max damage in the range is 63/64th lower than it should be.

kphoenix137 avatar Mar 14 '24 22:03 kphoenix137

Looks like this made the demo run off the rails

AJenbo avatar Mar 14 '24 22:03 AJenbo

This likely addresses all the uses qndel identified in https://github.com/diasurgical/devilutionX/pull/6402 except the item.cpp changes, good to keep it focused for damage rolls.

ephphatha avatar Mar 14 '24 23:03 ephphatha

Looks like this made the demo run off the rails

Should be good now?

kphoenix137 avatar Mar 14 '24 23:03 kphoenix137

I think it would be nice to unify randomizing damage in the future - at the moment sometimes numbers are randomized before getting shifted, sometimes after, it's a mess - which means in some cases it's possible to get 1.5 dmg while in other places you'd get integers only - doesn't make much sense imo ;)

qndel avatar Mar 21 '24 20:03 qndel