Fix archery_damage_test CI occasional failure #77970
Open
+5
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 indeal_projectile_attack()
and not being reset:Cataclysm-DDA/tests/archery_damage_test.cpp
Lines 60 to 62 in fc8e177
So if the
missed_by
rolls (10 d 1000, in this case) were too low, the sum of the 10 iterations' additions toattack.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 ofarchery_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.