1 | /* |
1 | /* |
2 | * static char *rcsid_attack_c = |
2 | * static char *rcsid_attack_c = |
3 | * "$Id: attack.C,v 1.2 2006/08/25 17:11:53 root Exp $"; |
3 | * "$Id: attack.C,v 1.4 2006/08/29 07:34:00 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) 2002 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
… | |
… | |
336 | * For example, 'tmp' was put in an icecube. |
336 | * For example, 'tmp' was put in an icecube. |
337 | * This is one of the few cases where on_same_map should not be used. |
337 | * This is one of the few cases where on_same_map should not be used. |
338 | */ |
338 | */ |
339 | if (tmp->map != map || tmp->x != x || tmp->y != y) |
339 | if (tmp->map != map || tmp->x != x || tmp->y != y) |
340 | continue; |
340 | continue; |
341 | |
|
|
342 | /* Need to hit everyone in the transport with this spell */ |
|
|
343 | if (tmp->type == TRANSPORT) { |
|
|
344 | object *pl; |
|
|
345 | |
|
|
346 | for (pl=tmp->inv; pl; pl=pl->below) { |
|
|
347 | if (pl->type == PLAYER) |
|
|
348 | hit_player(pl,op->stats.dam,op,type,full_hit); |
|
|
349 | } |
|
|
350 | } |
|
|
351 | |
341 | |
352 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) { |
342 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) { |
353 | hit_player(tmp,op->stats.dam,op,type,full_hit); |
343 | hit_player(tmp,op->stats.dam,op,type,full_hit); |
354 | retflag |=1; |
344 | retflag |=1; |
355 | if (was_destroyed (op, op_tag)) |
345 | if (was_destroyed (op, op_tag)) |
… | |
… | |
683 | tag_t op_tag, hitter_tag; |
673 | tag_t op_tag, hitter_tag; |
684 | |
674 | |
685 | if (get_attack_mode (&op, &hitter, &simple_attack)) |
675 | if (get_attack_mode (&op, &hitter, &simple_attack)) |
686 | goto error; |
676 | goto error; |
687 | |
677 | |
688 | /* Lauwenmark: Handle for plugin attack event */ |
|
|
689 | execute_event(op, EVENT_ATTACK,hitter,hitter,NULL,SCRIPT_FIX_ALL); |
|
|
690 | |
|
|
691 | /* Lauwenmark: This is used to handle script_weapons with weapons. |
|
|
692 | * Only used for players. |
|
|
693 | */ |
|
|
694 | if (hitter->type==PLAYER) |
|
|
695 | { |
|
|
696 | if (hitter->current_weapon != NULL) |
678 | if (hitter->current_weapon) |
697 | { |
679 | if (INVOKE_OBJECT (ATTACKS, hitter->current_weapon, ARG_OBJECT (hitter), ARG_OBJECT (op))) |
698 | /* Lauwenmark: Handle for plugin attack event */ |
680 | return RESULT_INT (0); |
699 | execute_event(hitter, EVENT_ATTACK,hitter->current_weapon, |
681 | |
700 | op,NULL,SCRIPT_FIX_ALL); |
682 | if (INVOKE_OBJECT (ATTACK, op, ARG_OBJECT (hitter))) |
701 | } |
683 | return RESULT_INT (0); |
702 | } |
684 | |
703 | op_tag = op->count; |
685 | op_tag = op->count; |
704 | hitter_tag = hitter->count; |
686 | hitter_tag = hitter->count; |
705 | |
687 | |
706 | /* |
688 | /* |
707 | * A little check to make it more difficult to dance forward and back |
689 | * A little check to make it more difficult to dance forward and back |
… | |
… | |
821 | |
803 | |
822 | goto leave; |
804 | goto leave; |
823 | |
805 | |
824 | error: |
806 | error: |
825 | dam = 1; |
807 | dam = 1; |
826 | goto leave; |
|
|
827 | |
808 | |
828 | leave: |
809 | leave: |
829 | if (op_name) |
810 | if (op_name) |
830 | free_string (op_name); |
811 | free_string (op_name); |
831 | |
812 | |
… | |
… | |
895 | /* Try to hit victim */ |
876 | /* Try to hit victim */ |
896 | victim_x = victim->x; |
877 | victim_x = victim->x; |
897 | victim_y = victim->y; |
878 | victim_y = victim->y; |
898 | victim_tag = victim->count; |
879 | victim_tag = victim->count; |
899 | hitter_tag = hitter->count; |
880 | hitter_tag = hitter->count; |
900 | /* Lauwenmark: Handling plugin attack event for thrown items */ |
881 | |
901 | if (execute_event(op, EVENT_ATTACK,hitter,victim,NULL,SCRIPT_FIX_ALL) == 0) |
|
|
902 | hit_something = attack_ob_simple (victim, hitter, op->stats.dam, |
882 | hit_something = attack_ob_simple (victim, hitter, op->stats.dam, op->stats.wc); |
903 | op->stats.wc); |
|
|
904 | |
883 | |
905 | /* Arrow attacks door, rune of summoning is triggered, demon is put on |
884 | /* Arrow attacks door, rune of summoning is triggered, demon is put on |
906 | * arrow, move_apply() calls this function, arrow sticks in demon, |
885 | * arrow, move_apply() calls this function, arrow sticks in demon, |
907 | * attack_ob_simple() returns, and we've got an arrow that still exists |
886 | * attack_ob_simple() returns, and we've got an arrow that still exists |
908 | * but is no longer on the map. Ugh. (Beware: Such things can happen at |
887 | * but is no longer on the map. Ugh. (Beware: Such things can happen at |