Temple Termagant
Posts: 5
Joined: Wednesday, 26th September 2012, 22:19
Trying to understand strength weight
I'm looking at the calc_stat_to_hit_base in melee_attack.cc, lines 4942-4952:
Looking at this code, to_hit_base ranges between DEX and (STR+DEX)/2 , but never any closer to strength than that, unless str_weight() goes above 10 somewhere. Is this correct? If str_weight() is 10, we get DEX + (STR-DEX)/2 * 10/10 = (STR+DEX)/2 . I thought 100% strength weight would make it 100% strength, and 50% strength weight would use the average of the two numbers. Do I just not understand what strength weight is supposed to be?
- Code:
int melee_attack::calc_stat_to_hit_base()
{
// towards_str_avg is a variable, whose sign points towards strength,
// and the magnitude is half the difference (thus, when added directly
// to you.dex() it gives the average of the two.
const signed int towards_str_avg = (you.strength() - you.dex()) / 2;
// dex is modified by strength towards the average, by the
// weighted amount weapon_str_weight() / 10.
return (you.dex() + towards_str_avg * player_weapon_str_weight() / 10);
}
Looking at this code, to_hit_base ranges between DEX and (STR+DEX)/2 , but never any closer to strength than that, unless str_weight() goes above 10 somewhere. Is this correct? If str_weight() is 10, we get DEX + (STR-DEX)/2 * 10/10 = (STR+DEX)/2 . I thought 100% strength weight would make it 100% strength, and 50% strength weight would use the average of the two numbers. Do I just not understand what strength weight is supposed to be?