1 | /* |
1 | /* |
2 | * static char *rcsid_skills_c = |
2 | * static char *rcsid_skills_c = |
3 | * "$Id: skills.C,v 1.6 2006/08/29 08:01:38 root Exp $"; |
3 | * "$Id: skills.C,v 1.7 2006/09/03 00:18:42 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2003 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2003 Mark Wedel & Crossfire Development Team |
… | |
… | |
485 | for(tmp=get_map_ob(m, x, y); tmp;tmp=tmp->above) { |
485 | for(tmp=get_map_ob(m, x, y); tmp;tmp=tmp->above) { |
486 | /* Jump into creature */ |
486 | /* Jump into creature */ |
487 | if(QUERY_FLAG(tmp, FLAG_MONSTER) |
487 | if(QUERY_FLAG(tmp, FLAG_MONSTER) |
488 | || (tmp->type==PLAYER && (!QUERY_FLAG(tmp, FLAG_WIZ) || !tmp->contr->hidden))) { |
488 | || (tmp->type==PLAYER && (!QUERY_FLAG(tmp, FLAG_WIZ) || !tmp->contr->hidden))) { |
489 | new_draw_info_format(NDI_UNIQUE, 0,pl,"You jump into %s%s.", |
489 | new_draw_info_format(NDI_UNIQUE, 0,pl,"You jump into %s%s.", |
490 | tmp->type == PLAYER ? "" : "the ", tmp->name); |
490 | tmp->type == PLAYER ? "" : "the ", &tmp->name); |
491 | if(tmp->type!=PLAYER || |
491 | if(tmp->type!=PLAYER || |
492 | (pl->type==PLAYER && pl->contr->party==NULL) || |
492 | (pl->type==PLAYER && pl->contr->party==NULL) || |
493 | (pl->type==PLAYER && tmp->type==PLAYER && |
493 | (pl->type==PLAYER && tmp->type==PLAYER && |
494 | pl->contr->party!=tmp->contr->party)) |
494 | pl->contr->party!=tmp->contr->party)) |
495 | exp = skill_attack(tmp,pl,pl->facing,"kicked", skill); /* pl makes an attack */ |
495 | exp = skill_attack(tmp,pl,pl->facing,"kicked", skill); /* pl makes an attack */ |
… | |
… | |
1047 | * than extra checks on object attributes. |
1047 | * than extra checks on object attributes. |
1048 | */ |
1048 | */ |
1049 | for (tmp=pl->below; tmp!=NULL; tmp=tmp->below) { |
1049 | for (tmp=pl->below; tmp!=NULL; tmp=tmp->below) { |
1050 | /* Only if the altar actually belongs to someone do you get special benefits */ |
1050 | /* Only if the altar actually belongs to someone do you get special benefits */ |
1051 | if(tmp && tmp->type==HOLY_ALTAR && tmp->other_arch) { |
1051 | if(tmp && tmp->type==HOLY_ALTAR && tmp->other_arch) { |
1052 | sprintf(buf,"You pray over the %s.",tmp->name); |
1052 | sprintf(buf,"You pray over the %s.", &tmp->name); |
1053 | pray_at_altar(pl,tmp, skill); |
1053 | pray_at_altar(pl,tmp, skill); |
1054 | break; /* Only pray at one altar */ |
1054 | break; /* Only pray at one altar */ |
1055 | } |
1055 | } |
1056 | } |
1056 | } |
1057 | |
1057 | |
… | |
… | |
1125 | /* a pair of sanity checks */ |
1125 | /* a pair of sanity checks */ |
1126 | if(!item||item->type!=BOOK) return 0; |
1126 | if(!item||item->type!=BOOK) return 0; |
1127 | |
1127 | |
1128 | if(!msg) { |
1128 | if(!msg) { |
1129 | new_draw_info(NDI_UNIQUE,0,pl,"No message to write!"); |
1129 | new_draw_info(NDI_UNIQUE,0,pl,"No message to write!"); |
1130 | new_draw_info_format(NDI_UNIQUE,0,pl,"Usage: use_skill %s <message>", |
1130 | new_draw_info_format(NDI_UNIQUE,0,pl,"Usage: use_skill %s <message>", &skill->skill); |
1131 | skill->skill); |
|
|
1132 | return 0; |
1131 | return 0; |
1133 | } |
1132 | } |
1134 | if (strcasestr_local(msg, "endmsg")) { |
1133 | if (strcasestr_local(msg, "endmsg")) { |
1135 | new_draw_info(NDI_UNIQUE,0,pl,"Trying to cheat now are we?"); |
1134 | new_draw_info(NDI_UNIQUE,0,pl,"Trying to cheat now are we?"); |
1136 | return 0; |
1135 | return 0; |
… | |
… | |
1150 | newBook = get_object(); |
1149 | newBook = get_object(); |
1151 | copy_object(item, newBook); |
1150 | copy_object(item, newBook); |
1152 | decrease_ob(item); |
1151 | decrease_ob(item); |
1153 | esrv_send_item(pl, item); |
1152 | esrv_send_item(pl, item); |
1154 | newBook->nrof = 1; |
1153 | newBook->nrof = 1; |
1155 | if (newBook->msg) free_string(newBook->msg); |
|
|
1156 | newBook->msg = add_string(buf); |
1154 | newBook->msg = buf; |
1157 | newBook = insert_ob_in_ob(newBook, pl); |
1155 | newBook = insert_ob_in_ob(newBook, pl); |
1158 | esrv_send_item(pl, newBook); |
1156 | esrv_send_item(pl, newBook); |
1159 | } else { |
1157 | } else { |
1160 | if (item->msg) free_string(item->msg); |
|
|
1161 | item->msg=add_string(buf); |
1158 | item->msg=buf; |
1162 | /* This shouldn't be necessary - the object hasn't changed in any |
1159 | /* This shouldn't be necessary - the object hasn't changed in any |
1163 | * visible way |
1160 | * visible way |
1164 | */ |
1161 | */ |
1165 | /* esrv_send_item(pl, item);*/ |
1162 | /* esrv_send_item(pl, item);*/ |
1166 | } |
1163 | } |
… | |
… | |
1199 | return 0; |
1196 | return 0; |
1200 | } |
1197 | } |
1201 | if(SP_level_spellpoint_cost(pl,chosen_spell,SPELL_GRACE) > pl->stats.grace) { |
1198 | if(SP_level_spellpoint_cost(pl,chosen_spell,SPELL_GRACE) > pl->stats.grace) { |
1202 | new_draw_info_format(NDI_UNIQUE,0,pl, |
1199 | new_draw_info_format(NDI_UNIQUE,0,pl, |
1203 | "You don't have enough grace to write a scroll of %s.", |
1200 | "You don't have enough grace to write a scroll of %s.", |
1204 | chosen_spell->name); |
1201 | &chosen_spell->name); |
1205 | return 0; |
1202 | return 0; |
1206 | } |
1203 | } |
1207 | if(SP_level_spellpoint_cost(pl,chosen_spell,SPELL_MANA) > pl->stats.sp) { |
1204 | if(SP_level_spellpoint_cost(pl,chosen_spell,SPELL_MANA) > pl->stats.sp) { |
1208 | new_draw_info_format(NDI_UNIQUE,0,pl, |
1205 | new_draw_info_format(NDI_UNIQUE,0,pl, |
1209 | "You don't have enough mana to write a scroll of %s.", |
1206 | "You don't have enough mana to write a scroll of %s.", |
1210 | chosen_spell->name); |
1207 | &chosen_spell->name); |
1211 | return 0; |
1208 | return 0; |
1212 | } |
1209 | } |
1213 | |
1210 | |
1214 | /* if there is a spell already on the scroll then player could easily |
1211 | /* if there is a spell already on the scroll then player could easily |
1215 | * accidently read it while trying to write the new one. give player |
1212 | * accidently read it while trying to write the new one. give player |
… | |
… | |
1583 | * If unsuccessfull at making the "thrown_obj", we just reinsert |
1580 | * If unsuccessfull at making the "thrown_obj", we just reinsert |
1584 | * the original object back into inventory and exit |
1581 | * the original object back into inventory and exit |
1585 | */ |
1582 | */ |
1586 | if((toss_item = make_throw_ob(throw_ob))) { |
1583 | if((toss_item = make_throw_ob(throw_ob))) { |
1587 | throw_ob = toss_item; |
1584 | throw_ob = toss_item; |
1588 | if (throw_ob->skill) free_string(throw_ob->skill); |
|
|
1589 | throw_ob->skill = add_string(skill->skill); |
1585 | throw_ob->skill = skill->skill; |
1590 | } |
1586 | } |
1591 | else { |
1587 | else { |
1592 | insert_ob_in_ob(throw_ob,op); |
1588 | insert_ob_in_ob(throw_ob,op); |
1593 | return 0; |
1589 | return 0; |
1594 | } |
1590 | } |