Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/Refactor: Min-Max Damage Range Calculations #7022

Merged

Conversation

kphoenix137
Copy link
Collaborator

@kphoenix137 kphoenix137 commented Mar 14, 2024

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.

@AJenbo
Copy link
Member

AJenbo commented Mar 14, 2024

Looks like this made the demo run off the rails

@ephphatha
Copy link
Contributor

This likely addresses all the uses qndel identified in #6402 except the item.cpp changes, good to keep it focused for damage rolls.

@kphoenix137
Copy link
Collaborator Author

Looks like this made the demo run off the rails

Should be good now?

ephphatha
ephphatha previously approved these changes Mar 21, 2024
@qndel
Copy link
Member

qndel commented Mar 21, 2024

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 ;)

ephphatha
ephphatha previously approved these changes Mar 23, 2024
Copy link
Contributor

@ephphatha ephphatha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to leave it to a future PR to sort out the inconsistent fixed point/integer rolls

Copy link
Contributor

@ephphatha ephphatha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still good to go imo, the only behaviour change introduced is called out in missiles.cpp:1066

@AJenbo AJenbo merged commit 109c3b1 into diasurgical:master Sep 22, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants