version 1.2 | | version 1.3 |
---|
| | |
| | |
/* find relevant stats or a skill then return their weighted sum. | | /* find relevant stats or a skill then return their weighted sum. |
* I admit the calculation is done in a retarded way. | | * I admit the calculation is done in a retarded way. |
* If stat1==NO_STAT this isnt an associated stat. Returns | | * If stat1==NO_STAT_VAL this isnt an associated stat. Returns |
* zero then. -b.t. | | * zero then. -b.t. |
*/ | | */ |
| | |
| | |
float sum; | | float sum; |
int number = 1; | | int number = 1; |
| | |
if(skills[sk].stat1==NO_STAT) { | | if(skills[sk].stat1==NO_STAT_VAL) { |
return 0; | | return 0; |
} else | | } else |
sum = get_attr_value(&(who->stats),skills[sk].stat1); | | sum = get_attr_value(&(who->stats),skills[sk].stat1); |
| | |
if(skills[sk].stat2!=NO_STAT) { | | if(skills[sk].stat2!=NO_STAT_VAL) { |
sum += get_attr_value(&(who->stats),skills[sk].stat2); | | sum += get_attr_value(&(who->stats),skills[sk].stat2); |
number++; | | number++; |
} | | } |
| | |
if(skills[sk].stat3!=NO_STAT) { | | if(skills[sk].stat3!=NO_STAT_VAL) { |
sum += get_attr_value(&(who->stats),skills[sk].stat3); | | sum += get_attr_value(&(who->stats),skills[sk].stat3); |
number++; | | number++; |
} | | } |
| | |
skills[i].time, | | skills[i].time, |
skills[i].bexp, | | skills[i].bexp, |
skills[i].lexp, | | skills[i].lexp, |
skills[i].stat1!= NO_STAT ? short_stat_name[skills[i].stat1]: "---", | | skills[i].stat1!= NO_STAT_VAL ? short_stat_name[skills[i].stat1]: "---", |
skills[i].stat2!= NO_STAT ? short_stat_name[skills[i].stat2]: "---", | | skills[i].stat2!= NO_STAT_VAL ? short_stat_name[skills[i].stat2]: "---", |
skills[i].stat3!= NO_STAT ? short_stat_name[skills[i].stat3]: "---"); | | skills[i].stat3!= NO_STAT_VAL ? short_stat_name[skills[i].stat3]: "---"); |
fprintf(stderr, buf); | | fprintf(stderr, buf); |
} | | } |
exit(0); | | exit(0); |
| | |
skills[i].category = j; | | skills[i].category = j; |
continue; | | continue; |
/* failed to link, set to EXP_NONE */ | | /* failed to link, set to EXP_NONE */ |
} else if (j==nrofexpcat || skills[i].stat1 == NO_STAT) { | | } else if (j==nrofexpcat || skills[i].stat1 == NO_STAT_VAL) { |
skills[i].category = EXP_NONE; | | skills[i].category = EXP_NONE; |
continue; | | continue; |
} | | } |
| | |
case CHA: | | case CHA: |
if(exp->stats.Cha) return 1; | | if(exp->stats.Cha) return 1; |
break; | | break; |
case NO_STAT: | | case NO_STAT_VAL: |
return 0; | | return 0; |
default: | | default: |
LOG(llevError, "Aborting! Tried to link skill with unknown stat!\n"); | | LOG(llevError, "Aborting! Tried to link skill with unknown stat!\n"); |
| | |
*/ | | */ |
| | |
int get_skill_stat1(object *op) { | | int get_skill_stat1(object *op) { |
int stat_value = 0, stat=NO_STAT; | | int stat_value = 0, stat=NO_STAT_VAL; |
| | |
if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat1)!=NO_STAT) ) | | if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat1)!=NO_STAT_VAL) ) |
stat_value = get_attr_value(&(op->stats),stat); | | stat_value = get_attr_value(&(op->stats),stat); |
| | |
return stat_value; | | return stat_value; |
| | |
*/ | | */ |
| | |
int get_skill_stat2(object *op) { | | int get_skill_stat2(object *op) { |
int stat_value = 0,stat = NO_STAT; | | int stat_value = 0,stat = NO_STAT_VAL; |
| | |
if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat2)!=NO_STAT) ) | | if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat2)!=NO_STAT_VAL) ) |
stat_value = get_attr_value(&(op->stats),stat); | | stat_value = get_attr_value(&(op->stats),stat); |
| | |
return stat_value; | | return stat_value; |
| | |
*/ | | */ |
| | |
int get_skill_stat3(object *op) { | | int get_skill_stat3(object *op) { |
int stat_value = 0,stat = NO_STAT; | | int stat_value = 0,stat = NO_STAT_VAL; |
| | |
if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat3)!=NO_STAT) ) | | if((op->chosen_skill) && ((stat = skills[op->chosen_skill->stats.sp].stat3)!=NO_STAT_VAL) ) |
stat_value = get_attr_value(&(op->stats),stat); | | stat_value = get_attr_value(&(op->stats),stat); |
| | |
return stat_value; | | return stat_value; |