Skip to content

Commit

Permalink
change round_damage function for what base_damage variable was double…
Browse files Browse the repository at this point in the history
… instead of int
  • Loading branch information
newfrenchy83 committed Dec 22, 2024
1 parent 3e36bb4 commit 153e10c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ constexpr T modulo(T num, int mod, T min = 0)
* round (base_damage * bonus / divisor) to the closest integer,
* but up or down towards base_damage
*/
constexpr int round_damage(int base_damage, int bonus, int divisor) {
constexpr int round_damage(double base_damage, int bonus, int divisor) {
if (base_damage==0) return 0;
const int rounding = divisor / 2 - (bonus < divisor || divisor==1 ? 0 : 1);
return std::max<int>(1, (base_damage * bonus + rounding) / divisor);
return std::max<int>(1, static_cast<int>((base_damage * bonus + rounding) / divisor));
}

template<typename Cmp>
Expand Down

0 comments on commit 153e10c

Please sign in to comment.