ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skill_util.c
(Generate patch)

Comparing deliantra/server/server/skill_util.c (file contents):
Revision 1.4 by pippijn, Mon May 1 12:33:06 2006 UTC vs.
Revision 1.6 by elmex, Sat Jul 15 11:57:02 2006 UTC

1/* 1/*
2 * static char *rcsid_skill_util_c = 2 * static char *rcsid_skill_util_c =
3 * "$Id: skill_util.c,v 1.4 2006/05/01 12:33:06 pippijn Exp $"; 3 * "$Id: skill_util.c,v 1.6 2006/07/15 11:57:02 elmex Exp $";
4 */ 4 */
5/* 5/*
6 CrossFire, A Multiplayer game for X-windows 6 CrossFire, A Multiplayer game for X-windows
7 7
8 Copryight (C) 2002 Mark Wedel & Crossfire Development Team 8 Copryight (C) 2002 Mark Wedel & Crossfire Development Team
286 * give any exp for their direct use (eg, throwing). 286 * give any exp for their direct use (eg, throwing).
287 * It returns 0 if no skill was used. 287 * It returns 0 if no skill was used.
288 */ 288 */
289 289
290int do_skill (object *op, object *part, object *skill, int dir, const char *string) { 290int do_skill (object *op, object *part, object *skill, int dir, const char *string) {
291 int success=0, exp=0; 291 int success=0, exp=0, ev=0;
292 int did_alc = 0; 292 int did_alc = 0;
293 object *tmp, *next; 293 object *tmp, *next;
294 294
295 if (!skill) return 0; 295 if (!skill) return 0;
296 296
304 if (tmp->type == SKILL && tmp->skill == skill->skill) break; 304 if (tmp->type == SKILL && tmp->skill == skill->skill) break;
305 } 305 }
306 if (!tmp) tmp=give_skill_by_name(op, skill->skill); 306 if (!tmp) tmp=give_skill_by_name(op, skill->skill);
307 skill = tmp; 307 skill = tmp;
308 } 308 }
309
310 // elmex: do a special case here. most times we only want to capture player skills?
311 if (op->type==PLAYER)
312 ev = execute_global_event(EVENT_PLAYER_USE_SKILL, op, part, skill, dir, string);
313 else
314 ev = execute_global_event(EVENT_MONSTER_USE_SKILL, op, part, skill, dir, string);
315
316 if (ev)
317 return 0;
309 318
310 switch(skill->subtype) { 319 switch(skill->subtype) {
311 case SK_LEVITATION: 320 case SK_LEVITATION:
312 /* Not 100% sure if this will work with new movement code - 321 /* Not 100% sure if this will work with new movement code -
313 * the levitation skill has move_type for flying, so when 322 * the levitation skill has move_type for flying, so when
362 371
363 case SK_FLAME_TOUCH: 372 case SK_FLAME_TOUCH:
364 (void) attack_hth(op,dir,"flamed", skill); 373 (void) attack_hth(op,dir,"flamed", skill);
365 break; 374 break;
366 375
367 case SK_SPARK: 376 case SK_SPARK_TOUCH:
368 (void) attack_hth(op,dir,"zapped", skill); 377 (void) attack_hth(op,dir,"zapped", skill);
369 break; 378 break;
370 379
371 case SK_SHIVER: 380 case SK_SHIVER:
372 (void) attack_hth(op,dir,"froze", skill); 381 (void) attack_hth(op,dir,"froze", skill);
874 } 883 }
875 } 884 }
876 /* If we didn't find a skill above, look harder for a good skill */ 885 /* If we didn't find a skill above, look harder for a good skill */
877 if (!skill) { 886 if (!skill) {
878 skill = find_best_player_hth_skill(op); 887 skill = find_best_player_hth_skill(op);
888 if ((skill = execute_global_event(EVENT_FIND_UNARMED_SKILL, op)) < 0) {
889 skill = find_best_player_hth_skill(op);
890 }
879 891
880 if (!skill) { 892 if (!skill) {
881 new_draw_info(NDI_BLACK, 0, op, "You have no unarmed combat skills!"); 893 new_draw_info(NDI_BLACK, 0, op, "You have no unarmed combat skills!");
882 return 0; 894 return 0;
883 } 895 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines