Allow to have attack with damage=0...
(rounding of other attacks continue to be >0) This also fix round_damage() which was supposed to round towards base_damage, but was incorrect for 2 cases: when dividing by 1 (D/1 give D-1, but currently not used) and when base_damage was 0.
This commit is contained in:
parent
2defaf7211
commit
125f186aaa
1 changed files with 2 additions and 1 deletions
|
@ -45,7 +45,8 @@ inline int div100rounded(int num) {
|
|||
* but up or down towards base_damage
|
||||
*/
|
||||
inline int round_damage(int base_damage, int bonus, int divisor) {
|
||||
const int rounding = divisor / 2 - (bonus < divisor ? 0 : 1);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue