Trying to understand strength weight


Questions, Explanations, Howtos

Temple Termagant

Posts: 5

Joined: Wednesday, 26th September 2012, 22:19

Post Tuesday, 22nd January 2013, 17:02

Trying to understand strength weight

I'm looking at the calc_stat_to_hit_base in melee_attack.cc, lines 4942-4952:
  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?

Temple Termagant

Posts: 5

Joined: Wednesday, 26th September 2012, 22:19

Post Tuesday, 22nd January 2013, 17:27

Re: Trying to understand strength weight

Thanks for the quick reply, that makes sense. Do you say they don't matter because skills matter more? Looking at the code it looks like stats, fighting, and your weapon skill all contribute equally.

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.