StevensSEC / pokemonbattlelib

A portable library for accurately simulating Pokemon battles.
GNU General Public License v3.0
12 stars 2 forks source link

refactor damage calc, remove all float64 #308

Closed dyc3 closed 3 years ago

dyc3 commented 3 years ago

closes #78

This removes all usage of float64 when calculating move damage to fix rounding errors. All divisions in pokemon are floor divides anyway. It also adjusts all the related tests so that they are no longer off by 1.

This also makes calcMoveDamage public so that it can be used in agents externally.

codecov[bot] commented 3 years ago

Codecov Report

Merging #308 (a2eb9b2) into main (4516764) will decrease coverage by 0.0060%. The diff coverage is 96.1538%.

:exclamation: Current head a2eb9b2 differs from pull request most recent head 3c0186e. Consider uploading reports for the commit 3c0186e to get more accurate results Impacted file tree graph

@@               Coverage Diff                @@
##               main       #308        +/-   ##
================================================
- Coverage   95.5254%   95.5193%   -0.0061%     
================================================
  Files            14         14                
  Lines          1475       1473         -2     
================================================
- Hits           1409       1407         -2     
  Misses           54         54                
  Partials         12         12                
Impacted Files Coverage Δ
calc.go 95.4545% <96.0000%> (-0.1977%) :arrow_down:
battle.go 91.0025% <100.0000%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4516764...3c0186e. Read the comment docs.