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

Fix archery_damage_test CI occasional failure #77970

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShnitzelX2
Copy link
Contributor

Summary

Bugfixes "fix archery_damage_test CI occasional failure"

Purpose of change

Fed up with CI failures, this is one of them

Describe the solution

Turns out that attack.missed_by was being slightly incremented in deal_projectile_attack() and not being reset:

for( int i = 0; i < 10; ++i ) {
monster target{ mtype_id( target_type ), tripoint_zero };
target.deal_projectile_attack( nullptr, attack, false );

So if the missed_by rolls (10 d 1000, in this case) were too low, the sum of the 10 iterations' additions to attack.missed_by would set it above the crit threshold and the bolts shot for the test wouldn't do enough damage. It took about 30 runs of archery_damage_test to isolate this.

I made attack.missed_by reset in the loop, so it should be fine now.

Describe alternatives you've considered

Testing

I made sure attack.missed_by wasn't incrementing anymore, and I ran the test successfully a couple times, but keep an eye out for future failures.

Additional context

Thankfully, this was just an issue with the test as far as I can tell.

@github-actions github-actions bot added Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Items: Archery Bows, crossbows, arrows, bolts <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Items: Archery Bows, crossbows, arrows, bolts json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant