version 1.45 | | version 1.46 |
---|
| | |
/* | | /* |
* static char *rcsid_skill_util_c = | | * static char *rcsid_skill_util_c = |
* "$Id: skill_util.c,v 1.45 2004/02/13 07:42:09 mwedel Exp $"; | | * "$Id: skill_util.c,v 1.46 2004/02/23 01:21:28 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
for (tmp=pl->inv; tmp!=NULL; tmp=tmp->below) | | for (tmp=pl->inv; tmp!=NULL; tmp=tmp->below) |
if (tmp->type == SKILL && !strncasecmp(scroll->skill, tmp->skill, strlen(scroll->skill))) break; | | if (tmp->type == SKILL && !strncasecmp(scroll->skill, tmp->skill, strlen(scroll->skill))) break; |
| | |
if (!tmp) | | /* player already knows it */ |
tmp = give_skill_by_name(pl, scroll->skill); | | if (tmp && QUERY_FLAG(tmp, FLAG_CAN_USE_SKILL)) return 0; |
| | |
if (!tmp) { | | |
LOG(llevError,"skill scroll %s does not have valid skill name (%s).\n", scroll->name, scroll->skill); | | |
return 2; | | |
} | | |
| | |
/* player already knows it */ | | |
if (QUERY_FLAG(tmp, FLAG_CAN_USE_SKILL)) return 0; | | |
| | |
/* now a random change to learn, based on player Int. | | /* now a random change to learn, based on player Int. |
* give bonus based on level - otherwise stupid characters | | * give bonus based on level - otherwise stupid characters |
| | |
if(random_roll(0, 99, pl, PREFER_LOW)>(learn_spell[pl->stats.Int] + (pl->level/5))) | | if(random_roll(0, 99, pl, PREFER_LOW)>(learn_spell[pl->stats.Int] + (pl->level/5))) |
return 2; /* failure :< */ | | return 2; /* failure :< */ |
| | |
| | if (!tmp) |
| | tmp = give_skill_by_name(pl, scroll->skill); |
| | |
| | if (!tmp) { |
| | LOG(llevError,"skill scroll %s does not have valid skill name (%s).\n", scroll->name, scroll->skill); |
| | return 2; |
| | } |
| | |
SET_FLAG(tmp, FLAG_CAN_USE_SKILL); | | SET_FLAG(tmp, FLAG_CAN_USE_SKILL); |
link_player_skills(pl); | | link_player_skills(pl); |
return 1; | | return 1; |
| | |
* right away - can't get any better than that. | | * right away - can't get any better than that. |
*/ | | */ |
for (i=0; i<last_skill; i++) { | | for (i=0; i<last_skill; i++) { |
if (tmp->subtype == unarmed_skills[i]) { | | if (tmp->subtype == unarmed_skills[i] && QUERY_FLAG(tmp, FLAG_CAN_USE_SKILL)) { |
best_skill = tmp; | | best_skill = tmp; |
last_skill = i; | | last_skill = i; |
if (i==0) return best_skill; | | if (i==0) return best_skill; |
| | |
skill = find_best_player_hth_skill(op); | | skill = find_best_player_hth_skill(op); |
| | |
if (!skill) { | | if (!skill) { |
new_draw_info(NDI_UNIQUE, 0, op, "You have no unarmed combat skills!"); | | new_draw_info(NDI_BLACK, 0, op, "You have no unarmed combat skills!"); |
return 0; | | return 0; |
} | | } |
} | | } |