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

Readd missing RNG tiebreakers for speed and priority ties #4772

Closed
wants to merge 2 commits into from

Conversation

Sneed69
Copy link

@Sneed69 Sneed69 commented Jun 12, 2024

Discord contact info

duke5614

@mrgriffin
Copy link
Collaborator

mrgriffin commented Jun 12, 2024

There's a Random() & 1 on this line: https://github.com/rh-hideout/pokeemerald-expansion/blob/master/src/battle_main.c#L5100. I think that line was probably intended to deal with speed ties, but actually what it does is 50% of the time say that nobody strikes first, and 50% of the time it says that battler1 strikes first? I think it should be removed to make your changes work?

EDIT: Now I think about it, maybe that explains why the test says that the algorithm is significantly biased?

@Sneed69 Sneed69 marked this pull request as draft June 12, 2024 09:59
@Sneed69
Copy link
Author

Sneed69 commented Jun 12, 2024

Good catch. I'll see what I can do.

@Sneed69 Sneed69 closed this Jun 12, 2024
@Sneed69 Sneed69 reopened this Jun 12, 2024
@Sneed69 Sneed69 force-pushed the speed-tiebreaker branch from 9c64348 to 16a11ef Compare June 12, 2024 16:12
@Sneed69
Copy link
Author

Sneed69 commented Jun 12, 2024

The current testing system does not allow for this be tested but it works in game.
WhichBattlerFaster is called 4 times per turn which when combined with the tests' fixed RNG it makes the turn order swap 0 or 4 times both which have the same results.
Perhaps it would be worth adding an RNG tag as an parameter for the function but I'm not so sure about it.

@mrgriffin mrgriffin mentioned this pull request Jun 12, 2024
@Sneed69 Sneed69 closed this Jul 24, 2024
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.

2 participants