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

New random algorithm always return max number if negative #4554

Closed
maattch opened this issue Oct 11, 2023 · 3 comments · Fixed by #4555
Closed

New random algorithm always return max number if negative #4554

maattch opened this issue Oct 11, 2023 · 3 comments · Fixed by #4555
Assignees

Comments

@maattch
Copy link
Contributor

maattch commented Oct 11, 2023

The new random algorithm introduced in #4539 is making monsters always hit the max damage, this is due to it always returning the max number if it is a negative value.

Example: https://godbolt.org/z/q4Eanx4z1

@Tarliton
Copy link

It seems it can be fixed by adding:

	if (minNumber > maxNumber) {
		std::swap(minNumber, maxNumber);
	}

https://godbolt.org/z/onj6Kh589

@EPuncker
Copy link
Contributor

@maattch can you test #4555 please

@maattch
Copy link
Contributor Author

maattch commented Oct 15, 2023

Tested and now is working fine

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 a pull request may close this issue.

4 participants