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.3 2006/08/26 23:36:33 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 |
… | |
… | |
683 | tag_t op_tag, hitter_tag; |
683 | tag_t op_tag, hitter_tag; |
684 | |
684 | |
685 | if (get_attack_mode (&op, &hitter, &simple_attack)) |
685 | if (get_attack_mode (&op, &hitter, &simple_attack)) |
686 | goto error; |
686 | goto error; |
687 | |
687 | |
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) |
688 | if (hitter->current_weapon) |
697 | { |
689 | if (INVOKE_OBJECT (ATTACKS, hitter->current_weapon, ARG_OBJECT (hitter), ARG_OBJECT (op))) |
698 | /* Lauwenmark: Handle for plugin attack event */ |
690 | return RESULT_INT (0); |
699 | execute_event(hitter, EVENT_ATTACK,hitter->current_weapon, |
691 | |
700 | op,NULL,SCRIPT_FIX_ALL); |
692 | if (INVOKE_OBJECT (ATTACK, op, ARG_OBJECT (hitter))) |
701 | } |
693 | return RESULT_INT (0); |
702 | } |
694 | |
703 | op_tag = op->count; |
695 | op_tag = op->count; |
704 | hitter_tag = hitter->count; |
696 | hitter_tag = hitter->count; |
705 | |
697 | |
706 | /* |
698 | /* |
707 | * A little check to make it more difficult to dance forward and back |
699 | * A little check to make it more difficult to dance forward and back |
… | |
… | |
821 | |
813 | |
822 | goto leave; |
814 | goto leave; |
823 | |
815 | |
824 | error: |
816 | error: |
825 | dam = 1; |
817 | dam = 1; |
826 | goto leave; |
|
|
827 | |
818 | |
828 | leave: |
819 | leave: |
829 | if (op_name) |
820 | if (op_name) |
830 | free_string (op_name); |
821 | free_string (op_name); |
831 | |
822 | |
… | |
… | |
895 | /* Try to hit victim */ |
886 | /* Try to hit victim */ |
896 | victim_x = victim->x; |
887 | victim_x = victim->x; |
897 | victim_y = victim->y; |
888 | victim_y = victim->y; |
898 | victim_tag = victim->count; |
889 | victim_tag = victim->count; |
899 | hitter_tag = hitter->count; |
890 | hitter_tag = hitter->count; |
900 | /* Lauwenmark: Handling plugin attack event for thrown items */ |
891 | |
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, |
892 | hit_something = attack_ob_simple (victim, hitter, op->stats.dam, op->stats.wc); |
903 | op->stats.wc); |
|
|
904 | |
893 | |
905 | /* Arrow attacks door, rune of summoning is triggered, demon is put on |
894 | /* Arrow attacks door, rune of summoning is triggered, demon is put on |
906 | * arrow, move_apply() calls this function, arrow sticks in demon, |
895 | * arrow, move_apply() calls this function, arrow sticks in demon, |
907 | * attack_ob_simple() returns, and we've got an arrow that still exists |
896 | * 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 |
897 | * but is no longer on the map. Ugh. (Beware: Such things can happen at |