1 | /* |
1 | /* |
2 | * static char *rcsid_skill_util_c = |
2 | * static char *rcsid_skill_util_c = |
3 | * "$Id: skill_util.C,v 1.1 2006/08/13 17:16:04 elmex Exp $"; |
3 | * "$Id: skill_util.C,v 1.2 2006/08/25 17:11:53 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 | 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 | |
290 | int do_skill (object *op, object *part, object *skill, int dir, const char *string) { |
290 | int do_skill (object *op, object *part, object *skill, int dir, const char *string) { |
291 | int success=0, exp=0, ev=0; |
291 | int success=0, exp=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 | |
… | |
… | |
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 | |
309 | |
310 | // elmex: do a special case here. most times we only want to capture player skills? |
310 | // skill, by_whom, on_which_object, which direction, skill_argument |
311 | if (op->type==PLAYER) |
311 | if (INVOKE_OBJECT (USE_SKILL, skill, ARG_OBJECT (op), ARG_OBJECT (part), ARG_INT (dir), ARG_STRING (string))) |
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; |
312 | return 0; |
318 | |
313 | |
319 | switch(skill->subtype) { |
314 | switch(skill->subtype) { |
320 | case SK_LEVITATION: |
315 | case SK_LEVITATION: |
321 | /* Not 100% sure if this will work with new movement code - |
316 | /* Not 100% sure if this will work with new movement code - |
322 | * the levitation skill has move_type for flying, so when |
317 | * the levitation skill has move_type for flying, so when |