Oh Drawde, I figured out whats happening to low end damage... Turns out its a casting problem (surprise surprise)
Heres the offender..
int max_hit = weapon_damage * ((GetSTR() + GetSkill(skillinuse)+ mylevel) / 100);
All these fields are integers.. What happens is that if STR+SKILL+LEVEL < 100, then the total is a 0, and you get 0 * weapon_damage, so your max_hit will always be 0.
What I've done to fix this is to cast the 3 variables to floats, then when they get jammed back into max_hit, it drops the remainder, but you dont lose the <1 case.
The new field is
int max_hit = weapon_damage * (( (float)GetSTR() + (float)GetSkill(skillinuse)+ (float)mylevel) / 100);
A wrote a little driver stub to test this, heres the before and after with a Str of 75, skill of 0, level 1 and weapon_damage of 8.
BEFORE
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
Damage is : 2
AFTER
Damage is : 6
Damage is : 6
Damage is : 2
Damage is : 3
Damage is : 3
Damage is : 6
Damage is : 2
Damage is : 4
Damage is : 4
Damage is : 4
Damage is : 3
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
|