1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
3 | |
3 | * |
|
|
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | |
7 | * |
7 | This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. |
11 | * (at your option) any later version. |
11 | |
12 | * |
12 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
16 | |
17 | * |
17 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * |
20 | |
|
|
21 | The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | */ |
22 | */ |
|
|
23 | |
23 | #include <assert.h> |
24 | #include <assert.h> |
24 | #include <global.h> |
25 | #include <global.h> |
25 | #include <living.h> |
26 | #include <living.h> |
26 | #include <material.h> |
27 | #include <material.h> |
27 | #include <skills.h> |
28 | #include <skills.h> |
28 | |
|
|
29 | #ifndef __CEXTRACT__ |
|
|
30 | # include <sproto.h> |
|
|
31 | #endif |
|
|
32 | |
|
|
33 | #include <sounds.h> |
29 | #include <sounds.h> |
|
|
30 | #include <sproto.h> |
34 | |
31 | |
35 | typedef struct att_msg_str |
32 | typedef struct att_msg_str |
36 | { |
33 | { |
37 | char *msg1; |
34 | char *msg1; |
38 | char *msg2; |
35 | char *msg2; |
… | |
… | |
44 | * its magical benefits. |
41 | * its magical benefits. |
45 | */ |
42 | */ |
46 | void |
43 | void |
47 | cancellation (object *op) |
44 | cancellation (object *op) |
48 | { |
45 | { |
49 | object *tmp; |
|
|
50 | |
|
|
51 | if (op->invisible) |
46 | if (op->invisible) |
52 | return; |
47 | return; |
53 | |
48 | |
54 | if (QUERY_FLAG (op, FLAG_ALIVE) || op->type == CONTAINER || op->type == THROWN_OBJ) |
49 | if (QUERY_FLAG (op, FLAG_ALIVE) || op->type == CONTAINER || op->type == THROWN_OBJ) |
55 | { |
50 | { |
56 | /* Recur through the inventory */ |
51 | /* Recurse through the inventory */ |
57 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
52 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
58 | if (!did_make_save_item (tmp, AT_CANCELLATION, op)) |
53 | if (!did_make_save_item (tmp, AT_CANCELLATION, op)) |
59 | cancellation (tmp); |
54 | cancellation (tmp); |
60 | } |
55 | } |
61 | else if (FABS (op->magic) <= (rndm (0, 5))) |
56 | else if (FABS (op->magic) <= rndm (0, 5)) |
62 | { |
57 | { |
63 | /* Nullify this object. This code could probably be more complete */ |
58 | /* Nullify this object. This code could probably be more complete */ |
64 | /* in what abilities it should cancel */ |
59 | /* in what abilities it should cancel */ |
65 | op->magic = 0; |
60 | op->magic = 0; |
|
|
61 | |
66 | CLEAR_FLAG (op, FLAG_DAMNED); |
62 | CLEAR_FLAG (op, FLAG_DAMNED); |
67 | CLEAR_FLAG (op, FLAG_CURSED); |
63 | CLEAR_FLAG (op, FLAG_CURSED); |
68 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
64 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
69 | CLEAR_FLAG (op, FLAG_KNOWN_CURSED); |
65 | CLEAR_FLAG (op, FLAG_KNOWN_CURSED); |
|
|
66 | |
70 | if (op->env && op->env->type == PLAYER) |
67 | if (op->env && op->env->type == PLAYER) |
71 | { |
|
|
72 | esrv_send_item (op->env, op); |
68 | esrv_send_item (op->env, op); |
73 | } |
|
|
74 | } |
69 | } |
75 | } |
70 | } |
76 | |
71 | |
77 | /* did_make_save_item just checks to make sure the item actually |
72 | /* did_make_save_item just checks to make sure the item actually |
78 | * made its saving throw based on the tables. It does not take |
73 | * made its saving throw based on the tables. It does not take |
… | |
… | |
85 | materialtype_t *mt; |
80 | materialtype_t *mt; |
86 | |
81 | |
87 | if (op->materialname == NULL) |
82 | if (op->materialname == NULL) |
88 | { |
83 | { |
89 | for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) |
84 | for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) |
90 | if (op->material & mt->material) |
85 | if (op->materials & mt->material) |
91 | break; |
86 | break; |
92 | } |
87 | } |
93 | else |
88 | else |
94 | mt = name_to_material (op->materialname); |
89 | mt = name_to_material (op->materialname); |
95 | if (mt == NULL) |
90 | |
|
|
91 | if (!mt) |
96 | return TRUE; |
92 | return TRUE; |
|
|
93 | |
97 | roll = rndm (1, 20); |
94 | roll = rndm (1, 20); |
98 | |
95 | |
99 | /* the attacktypes have no meaning for object saves |
96 | /* the attacktypes have no meaning for object saves |
100 | * If the type is only magic, don't adjust type - basically, if |
97 | * If the type is only magic, don't adjust type - basically, if |
101 | * pure magic is hitting an object, it should save. However, if it |
98 | * pure magic is hitting an object, it should save. However, if it |
… | |
… | |
130 | saves++; |
127 | saves++; |
131 | } |
128 | } |
132 | |
129 | |
133 | if (saves == attacks || attacks == 0) |
130 | if (saves == attacks || attacks == 0) |
134 | return TRUE; |
131 | return TRUE; |
|
|
132 | |
135 | if ((saves == 0) || (rndm (1, attacks) > saves)) |
133 | if (saves == 0 || (rndm (1, attacks) > saves)) |
136 | return FALSE; |
134 | return FALSE; |
|
|
135 | |
137 | return TRUE; |
136 | return TRUE; |
138 | } |
137 | } |
139 | |
138 | |
140 | /* This function calls did_make_save_item. It then performs the |
139 | /* This function calls did_make_save_item. It then performs the |
141 | * appropriate actions to the item (such as burning the item up, |
140 | * appropriate actions to the item (such as burning the item up, |
142 | * calling cancellation, etc.) |
141 | * calling cancellation, etc.) |
143 | */ |
142 | */ |
144 | |
|
|
145 | void |
143 | void |
146 | save_throw_object (object *op, int type, object *originator) |
144 | save_throw_object (object *op, int type, object *originator) |
147 | { |
145 | { |
148 | if (!did_make_save_item (op, type, originator)) |
146 | if (!did_make_save_item (op, type, originator)) |
149 | { |
147 | { |
… | |
… | |
163 | * function if the object doesnt contain a material that can burn. |
161 | * function if the object doesnt contain a material that can burn. |
164 | * So forget lighting magical swords on fire with this!) -b.t. |
162 | * So forget lighting magical swords on fire with this!) -b.t. |
165 | */ |
163 | */ |
166 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
164 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
167 | { |
165 | { |
168 | const char *arch = op->other_arch->name; |
166 | const char *arch = op->other_arch->archname; |
169 | |
167 | |
170 | op = decrease_ob_nr (op, 1); |
168 | op = decrease_ob_nr (op, 1); |
171 | |
169 | |
172 | if (op) |
170 | if (op) |
173 | fix_stopped_item (op, m, originator); |
171 | fix_stopped_item (op, m, originator); |
… | |
… | |
269 | * op is going in direction 'dir' |
267 | * op is going in direction 'dir' |
270 | * type is the attacktype of the object. |
268 | * type is the attacktype of the object. |
271 | * full_hit is set if monster area does not matter. |
269 | * full_hit is set if monster area does not matter. |
272 | * returns 1 if it hits something, 0 otherwise. |
270 | * returns 1 if it hits something, 0 otherwise. |
273 | */ |
271 | */ |
274 | |
|
|
275 | int |
272 | int |
276 | hit_map (object *op, int dir, int type, int full_hit) |
273 | hit_map (object *op, int dir, int type, int full_hit) |
277 | { |
274 | { |
278 | maptile *map; |
275 | maptile *map; |
279 | sint16 x, y; |
276 | sint16 x, y; |
… | |
… | |
285 | return 0; |
282 | return 0; |
286 | } |
283 | } |
287 | |
284 | |
288 | if (QUERY_FLAG (op, FLAG_REMOVED) || op->env != NULL) |
285 | if (QUERY_FLAG (op, FLAG_REMOVED) || op->env != NULL) |
289 | { |
286 | { |
290 | LOG (llevError, "BUG: hit_map(): hitter (arch %s, name %s) not on a map\n", &op->arch->name, &op->name); |
287 | LOG (llevError, "BUG: hit_map(): hitter (arch %s, name %s) not on a map\n", &op->arch->archname, &op->name); |
291 | return 0; |
288 | return 0; |
292 | } |
289 | } |
293 | |
290 | |
294 | if (!op->map) |
291 | if (!op->map) |
295 | { |
292 | { |
… | |
… | |
302 | |
299 | |
303 | map = op->map; |
300 | map = op->map; |
304 | x = op->x + freearr_x[dir]; |
301 | x = op->x + freearr_x[dir]; |
305 | y = op->y + freearr_y[dir]; |
302 | y = op->y + freearr_y[dir]; |
306 | |
303 | |
307 | int mflags = get_map_flags (map, &map, x, y, &x, &y); |
304 | if (!xy_normalise (map, x, y)) |
|
|
305 | return 0; |
308 | |
306 | |
309 | // elmex: a safe map tile can't be hit! |
307 | // elmex: a safe map tile can't be hit! |
310 | // this should prevent most harmful effects on items and players there. |
308 | // this should prevent most harmful effects on items and players there. |
311 | if (mflags & (P_OUT_OF_MAP | P_SAFE)) |
309 | mapspace &ms = map->at (x, y); |
|
|
310 | |
|
|
311 | if (ms.flags () & P_SAFE) |
312 | return 0; |
312 | return 0; |
313 | |
313 | |
314 | /* peterm: a few special cases for special attacktypes --counterspell |
314 | /* peterm: a few special cases for special attacktypes --counterspell |
315 | * must be out here because it strikes things which are not alive |
315 | * must be out here because it strikes things which are not alive |
316 | */ |
316 | */ |
317 | |
317 | if (type & (AT_COUNTERSPELL | AT_CHAOS)) |
|
|
318 | { |
318 | if (type & AT_COUNTERSPELL) |
319 | if (type & AT_COUNTERSPELL) |
319 | { |
320 | { |
320 | counterspell (op, dir); /* see spell_effect.c */ |
321 | counterspell (op, dir); /* see spell_effect.c */ |
321 | |
322 | |
322 | /* If the only attacktype is counterspell or magic, don't need |
323 | /* If the only attacktype is counterspell or magic, don't need |
323 | * to do any further processing. |
324 | * to do any further processing. |
324 | */ |
325 | */ |
325 | if (!(type & ~(AT_COUNTERSPELL | AT_MAGIC))) |
326 | if (!(type & ~(AT_COUNTERSPELL | AT_MAGIC))) |
326 | return 0; |
327 | return 0; |
327 | |
328 | |
328 | type &= ~AT_COUNTERSPELL; |
329 | type &= ~AT_COUNTERSPELL; |
329 | } |
330 | } |
330 | |
331 | |
331 | if (type & AT_CHAOS) |
332 | if (type & AT_CHAOS) |
332 | { |
333 | { |
333 | shuffle_attack (op, 1); /*1 flag tells it to change the face */ |
334 | shuffle_attack (op, 1); /* flag tells it to change the face */ |
334 | update_object (op, UP_OBJ_FACE); |
335 | update_object (op, UP_OBJ_FACE); |
335 | type &= ~AT_CHAOS; |
336 | type &= ~AT_CHAOS; |
|
|
337 | } |
336 | } |
338 | } |
337 | |
339 | |
338 | /* There may still be objects that were above 'next', but there is no |
340 | /* There may still be objects that were above 'next', but there is no |
339 | * simple way to find out short of copying all object references and |
341 | * simple way to find out short of copying all object references and |
340 | * tags into a temporary array before we start processing the first |
342 | * tags into a temporary array before we start processing the first |
341 | * object. That's why we just abort on destroy. |
343 | * object. That's why we just abort on destroy. |
342 | * |
344 | * |
343 | * This happens whenever attack spells (like fire) hit a pile |
345 | * This happens whenever attack spells (like fire) hit a pile |
344 | * of objects. This is not a bug - nor an error. |
346 | * of objects. This is not a bug - nor an error. |
345 | */ |
347 | */ |
346 | for (object *next = map->at (x, y).bot; next && !next->destroyed (); ) |
348 | for (object *next = ms.bot; next && !next->destroyed (); ) |
347 | { |
349 | { |
348 | object *tmp = next; |
350 | object *tmp = next; |
349 | next = tmp->above; |
351 | next = tmp->above; |
350 | |
352 | |
351 | /* Something could have happened to 'tmp' while 'tmp->below' was processed. |
353 | /* Something could have happened to 'tmp' while 'tmp->below' was processed. |
… | |
… | |
357 | |
359 | |
358 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
360 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
359 | { |
361 | { |
360 | hit_player (tmp, op->stats.dam, op, type, full_hit); |
362 | hit_player (tmp, op->stats.dam, op, type, full_hit); |
361 | retflag |= 1; |
363 | retflag |= 1; |
|
|
364 | |
362 | if (op->destroyed ()) |
365 | if (op->destroyed ()) |
363 | break; |
366 | break; |
364 | } |
367 | } |
365 | /* Here we are potentially destroying an object. If the object has |
368 | /* Here we are potentially destroying an object. If the object has |
366 | * NO_PASS set, it is also immune - you can't destroy walls. Note |
369 | * NO_PASS set, it is also immune - you can't destroy walls. Note |
367 | * that weak walls have is_alive set, which prevent objects from |
370 | * that weak walls have is_alive set, which prevent objects from |
368 | * passing over/through them. We don't care what type of movement |
371 | * passing over/through them. We don't care what type of movement |
369 | * the wall blocks - if it blocks any type of movement, can't be |
372 | * the wall blocks - if it blocks any type of movement, can't be |
370 | * destroyed right now. |
373 | * destroyed right now. |
371 | */ |
374 | */ |
372 | else if ((tmp->material || tmp->materialname) && op->stats.dam > 0 && !tmp->move_block) |
375 | else if (tmp->materialname && op->stats.dam > 0 && !tmp->move_block) |
373 | { |
376 | { |
374 | save_throw_object (tmp, type, op); |
377 | save_throw_object (tmp, type, op); |
375 | |
378 | |
376 | if (op->destroyed ()) |
379 | if (op->destroyed ()) |
377 | break; |
380 | break; |
… | |
… | |
610 | if (hitter->owner != NULL) |
613 | if (hitter->owner != NULL) |
611 | sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2); |
614 | sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2); |
612 | else |
615 | else |
613 | { |
616 | { |
614 | sprintf (buf, "%s%s you.", &hitter->name, buf2); |
617 | sprintf (buf, "%s%s you.", &hitter->name, buf2); |
|
|
618 | |
615 | if (dam != 0) |
619 | if (dam != 0) |
616 | { |
620 | { |
617 | if (dam < 10) |
621 | if (dam < 10) |
618 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT1, 0, 0); |
622 | op->contr->play_sound (sound_find ("player_is_hit1")); |
619 | else if (dam < 20) |
623 | else if (dam < 20) |
620 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT2, 0, 0); |
624 | op->contr->play_sound (sound_find ("player_is_hit2")); |
621 | else |
625 | else |
622 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT3, 0, 0); |
626 | op->contr->play_sound (sound_find ("player_is_hit3")); |
623 | } |
627 | } |
624 | } |
628 | } |
|
|
629 | |
625 | new_draw_info (NDI_BLACK, 0, op, buf); |
630 | new_draw_info (NDI_BLACK, 0, op, buf); |
626 | } /* end of player hitting player */ |
631 | } /* end of player hitting player */ |
627 | |
632 | |
628 | if (hitter->type == PLAYER) |
633 | if (hitter->type == PLAYER) |
629 | { |
634 | { |
630 | sprintf (buf, "You %s.", buf1); |
635 | sprintf (buf, "You %s.", buf1); |
|
|
636 | |
631 | if (dam != 0) |
637 | if (dam != 0) |
632 | { |
638 | { |
633 | if (dam < 10) |
639 | if (dam < 10) |
634 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS1, 0, 0); |
640 | op->play_sound (sound_find ("player_hits1")); |
635 | else if (dam < 20) |
641 | else if (dam < 20) |
636 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS2, 0, 0); |
642 | op->play_sound (sound_find ("player_hits2")); |
637 | else |
643 | else |
638 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS3, 0, 0); |
644 | op->play_sound (sound_find ("player_hits3")); |
639 | } |
645 | } |
|
|
646 | |
640 | new_draw_info (NDI_BLACK, 0, hitter, buf); |
647 | new_draw_info (NDI_BLACK, 0, hitter, buf); |
641 | } |
648 | } |
642 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
649 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
643 | { |
650 | { |
644 | /* look for stacked spells and start reducing the message chances */ |
651 | /* look for stacked spells and start reducing the message chances */ |
… | |
… | |
646 | { |
653 | { |
647 | i = 4; |
654 | i = 4; |
648 | map = hitter->map; |
655 | map = hitter->map; |
649 | if (out_of_map (map, hitter->x, hitter->y)) |
656 | if (out_of_map (map, hitter->x, hitter->y)) |
650 | return; |
657 | return; |
|
|
658 | |
651 | next = GET_MAP_OB (map, hitter->x, hitter->y); |
659 | next = GET_MAP_OB (map, hitter->x, hitter->y); |
652 | if (next) |
660 | if (next) |
653 | while (next) |
661 | while (next) |
654 | { |
662 | { |
655 | if (next->type == SPELL_EFFECT && (next->subtype == SP_EXPLOSION || next->subtype == SP_BULLET || next->subtype == SP_CONE)) |
663 | if (next->type == SPELL_EFFECT && (next->subtype == SP_EXPLOSION || next->subtype == SP_BULLET || next->subtype == SP_CONE)) |
656 | i *= 3; |
664 | i *= 3; |
|
|
665 | |
657 | tmp = next; |
666 | tmp = next; |
658 | next = tmp->above; |
667 | next = tmp->above; |
659 | } |
668 | } |
|
|
669 | |
660 | if (i < 0) |
670 | if (i < 0) |
661 | return; |
671 | return; |
|
|
672 | |
662 | if (rndm (0, i) != 0) |
673 | if (rndm (0, i) != 0) |
663 | return; |
674 | return; |
664 | } |
675 | } |
665 | else if (rndm (0, 5) != 0) |
676 | else if (rndm (0, 5) != 0) |
666 | return; |
677 | return; |
|
|
678 | |
667 | sprintf (buf, "Your %s%s %s.", &hitter->name, buf2, &op->name); |
679 | sprintf (buf, "Your %s%s %s.", &hitter->name, buf2, &op->name); |
668 | play_sound_map (op->map, op->x, op->y, SOUND_PLAYER_HITS4); |
680 | op->play_sound (sound_find ("player_hits4")); |
669 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
681 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
670 | } |
682 | } |
671 | } |
683 | } |
672 | |
684 | |
673 | |
685 | |
… | |
… | |
677 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
689 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
678 | { |
690 | { |
679 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
691 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
680 | return 1; |
692 | return 1; |
681 | } |
693 | } |
|
|
694 | |
682 | if ((*target)->head) |
695 | if ((*target)->head) |
683 | *target = (*target)->head; |
696 | *target = (*target)->head; |
|
|
697 | |
684 | if ((*hitter)->head) |
698 | if ((*hitter)->head) |
685 | *hitter = (*hitter)->head; |
699 | *hitter = (*hitter)->head; |
|
|
700 | |
686 | if ((*hitter)->env != NULL || (*target)->env != NULL) |
701 | if ((*hitter)->env != NULL || (*target)->env != NULL) |
687 | { |
702 | { |
688 | *simple_attack = 1; |
703 | *simple_attack = 1; |
689 | return 0; |
704 | return 0; |
690 | } |
705 | } |
|
|
706 | |
691 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
707 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
692 | || QUERY_FLAG (*hitter, FLAG_REMOVED) || (*hitter)->map == NULL || !on_same_map ((*hitter), (*target))) |
708 | || QUERY_FLAG (*hitter, FLAG_REMOVED) |
|
|
709 | || !(*hitter)->map |
|
|
710 | || !on_same_map (*hitter, *target)) |
693 | { |
711 | { |
694 | LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " "target\n", &(*hitter)->arch->name, &(*hitter)->name); |
712 | LOG (llevError | logBacktrace, "BUG: hitter (%s) with no relation to target (%s)\n", |
|
|
713 | (*hitter)->debug_desc (), (*target)->debug_desc ()); |
695 | return 1; |
714 | return 1; |
696 | } |
715 | } |
|
|
716 | |
697 | *simple_attack = 0; |
717 | *simple_attack = 0; |
698 | return 0; |
718 | return 0; |
699 | } |
719 | } |
700 | |
720 | |
701 | static int |
721 | static int |
… | |
… | |
737 | |
757 | |
738 | /* |
758 | /* |
739 | * A little check to make it more difficult to dance forward and back |
759 | * A little check to make it more difficult to dance forward and back |
740 | * to avoid ever being hit by monsters. |
760 | * to avoid ever being hit by monsters. |
741 | */ |
761 | */ |
742 | if (!simple_attack && QUERY_FLAG (op, FLAG_MONSTER) && op->speed_left > -(FABS (op->speed)) * 0.3) |
762 | if (!simple_attack && QUERY_FLAG (op, FLAG_MONSTER) && op->speed_left > abs (op->speed) * -0.3f) |
743 | { |
763 | { |
744 | /* Decrease speed BEFORE calling process_object. Otherwise, an |
764 | /* Decrease speed BEFORE calling process_object. Otherwise, an |
745 | * infinite loop occurs, with process_object calling move_monster, |
765 | * infinite loop occurs, with process_object calling move_monster, |
746 | * which then gets here again. By decreasing the speed before |
766 | * which then gets here again. By decreasing the speed before |
747 | * we call process_object, the 'if' statement above will fail. |
767 | * we call process_object, the 'if' statement above will fail. |
748 | */ |
768 | */ |
749 | op->speed_left--; |
769 | --op->speed_left; |
750 | process_object (op); |
770 | process_object (op); |
751 | |
771 | |
752 | if (op->destroyed () || hitter->destroyed () || abort_attack (op, hitter, simple_attack)) |
772 | if (op->destroyed () || hitter->destroyed () || abort_attack (op, hitter, simple_attack)) |
753 | goto error; |
773 | goto error; |
754 | } |
774 | } |
… | |
… | |
764 | /* See if we hit the creature */ |
784 | /* See if we hit the creature */ |
765 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
785 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
766 | { |
786 | { |
767 | int hitdam = base_dam; |
787 | int hitdam = base_dam; |
768 | |
788 | |
769 | if (settings.casting_time == TRUE) |
|
|
770 | { |
|
|
771 | if ((hitter->type == PLAYER) && (hitter->casting_time > -1)) |
|
|
772 | { |
|
|
773 | hitter->casting_time = -1; |
|
|
774 | new_draw_info (NDI_UNIQUE, 0, hitter, "You attacked and lost " "your spell!"); |
|
|
775 | } |
|
|
776 | if ((op->casting_time > -1) && (hitdam > 0)) |
|
|
777 | { |
|
|
778 | op->casting_time = -1; |
|
|
779 | if (op->type == PLAYER) |
|
|
780 | { |
|
|
781 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit and lost " "your spell!"); |
|
|
782 | new_draw_info_format (NDI_ALL | NDI_UNIQUE, 5, NULL, "%s was hit by %s and lost a spell.", &op_name, &hitter->name); |
|
|
783 | } |
|
|
784 | } |
|
|
785 | } |
|
|
786 | if (!simple_attack) |
789 | if (!simple_attack) |
787 | { |
790 | { |
788 | /* If you hit something, the victim should *always* wake up. |
791 | /* If you hit something, the victim should *always* wake up. |
789 | * Before, invisible hitters could avoid doing this. |
792 | * Before, invisible hitters could avoid doing this. |
790 | * -b.t. */ |
793 | * -b.t. */ |
… | |
… | |
798 | |
801 | |
799 | /* if you were hidden and hit by a creature, you are discovered */ |
802 | /* if you were hidden and hit by a creature, you are discovered */ |
800 | if (op->hide && QUERY_FLAG (hitter, FLAG_ALIVE)) |
803 | if (op->hide && QUERY_FLAG (hitter, FLAG_ALIVE)) |
801 | { |
804 | { |
802 | make_visible (op); |
805 | make_visible (op); |
|
|
806 | |
803 | if (op->type == PLAYER) |
807 | if (op->type == PLAYER) |
804 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!"); |
808 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!"); |
805 | } |
809 | } |
806 | |
810 | |
807 | /* thrown items (hitter) will have various effects |
811 | /* thrown items (hitter) will have various effects |
… | |
… | |
861 | } |
865 | } |
862 | |
866 | |
863 | int |
867 | int |
864 | attack_ob (object *op, object *hitter) |
868 | attack_ob (object *op, object *hitter) |
865 | { |
869 | { |
866 | |
|
|
867 | if (hitter->head) |
|
|
868 | hitter = hitter->head; |
870 | hitter = hitter->head_ (); |
|
|
871 | |
869 | return attack_ob_simple (op, hitter, hitter->stats.dam, hitter->stats.wc); |
872 | return attack_ob_simple (op, hitter, hitter->stats.dam, hitter->stats.wc); |
870 | } |
873 | } |
871 | |
874 | |
872 | /* op is the arrow, tmp is what is stopping the arrow. |
875 | /* op is the arrow, tmp is what is stopping the arrow. |
873 | * |
876 | * |
… | |
… | |
882 | * debate - 5000 is 5 kg, so arrows, knives, and other light weapons |
885 | * debate - 5000 is 5 kg, so arrows, knives, and other light weapons |
883 | * stick around. |
886 | * stick around. |
884 | */ |
887 | */ |
885 | if (op->weight <= 5000 && tmp->stats.hp >= 0) |
888 | if (op->weight <= 5000 && tmp->stats.hp >= 0) |
886 | { |
889 | { |
887 | if (tmp->head != NULL) |
|
|
888 | tmp = tmp->head; |
890 | tmp = tmp->head_ (); |
889 | |
891 | |
890 | op->remove (); |
892 | op->remove (); |
891 | op = insert_ob_in_ob (op, tmp); |
893 | op = insert_ob_in_ob (op, tmp); |
892 | |
894 | |
893 | if (tmp->type == PLAYER) |
895 | if (tmp->type == PLAYER) |
… | |
… | |
1000 | insert_ob_in_ob (hitter, container); |
1002 | insert_ob_in_ob (hitter, container); |
1001 | } |
1003 | } |
1002 | |
1004 | |
1003 | return op; |
1005 | return op; |
1004 | } |
1006 | } |
1005 | |
|
|
1006 | |
1007 | |
1007 | void |
1008 | void |
1008 | tear_down_wall (object *op) |
1009 | tear_down_wall (object *op) |
1009 | { |
1010 | { |
1010 | int perc = 0; |
1011 | int perc = 0; |
… | |
… | |
1059 | SET_FLAG (target, FLAG_SCARED); |
1060 | SET_FLAG (target, FLAG_SCARED); |
1060 | if (!target->enemy) |
1061 | if (!target->enemy) |
1061 | target->enemy = owner; |
1062 | target->enemy = owner; |
1062 | } |
1063 | } |
1063 | |
1064 | |
1064 | |
|
|
1065 | /* This returns the amount of damage hitter does to op with the |
1065 | /* This returns the amount of damage hitter does to op with the |
1066 | * appropriate attacktype. Only 1 attacktype should be set at a time. |
1066 | * appropriate attacktype. Only 1 attacktype should be set at a time. |
1067 | * This doesn't damage the player, but returns how much it should |
1067 | * This doesn't damage the player, but returns how much it should |
1068 | * take. However, it will do other effects (paralyzation, slow, etc.) |
1068 | * take. However, it will do other effects (paralyzation, slow, etc.) |
1069 | * Note - changed for PR code - we now pass the attack number and not |
1069 | * Note - changed for PR code - we now pass the attack number and not |
1070 | * the attacktype. Makes it easier for the PR code. */ |
1070 | * the attacktype. Makes it easier for the PR code. */ |
1071 | |
|
|
1072 | int |
1071 | int |
1073 | hit_player_attacktype (object *op, object *hitter, int dam, uint32 attacknum, int magic) |
1072 | hit_player_attacktype (object *op, object *hitter, int dam, uint32 attacknum, int magic) |
1074 | { |
1073 | { |
1075 | |
|
|
1076 | int doesnt_slay = 1; |
1074 | int doesnt_slay = 1; |
1077 | |
1075 | |
1078 | /* Catch anyone that may be trying to send us a bitmask instead of the number */ |
1076 | /* Catch anyone that may be trying to send us a bitmask instead of the number */ |
1079 | if (attacknum >= NROFATTACKS) |
1077 | if (attacknum >= NROFATTACKS) |
1080 | { |
1078 | { |
… | |
… | |
1082 | return 0; |
1080 | return 0; |
1083 | } |
1081 | } |
1084 | |
1082 | |
1085 | if (dam < 0) |
1083 | if (dam < 0) |
1086 | { |
1084 | { |
1087 | LOG (llevError, "hit_player_attacktype called with negative damage: %d\n", dam); |
1085 | LOG (llevError, "hit_player_attacktype called with negative damage %d (hitter %s, target %s)\n", |
|
|
1086 | dam, hitter->debug_desc (), op->debug_desc ()); |
1088 | return 0; |
1087 | return 0; |
1089 | } |
1088 | } |
1090 | |
1089 | |
1091 | /* AT_INTERNAL is supposed to do exactly dam. Put a case here so |
1090 | /* AT_INTERNAL is supposed to do exactly dam. Put a case here so |
1092 | * people can't mess with that or it otherwise get confused. */ |
1091 | * people can't mess with that or it otherwise get confused. */ |
1093 | if (attacknum == ATNR_INTERNAL) |
1092 | if (attacknum == ATNR_INTERNAL) |
1094 | return dam; |
1093 | return dam; |
1095 | |
1094 | |
1096 | if (hitter->slaying) |
1095 | if (hitter->slaying) |
1097 | { |
1096 | { |
1098 | if (((op->race != NULL) && strstr (hitter->slaying, op->race)) || |
1097 | if ((op->race && strstr (hitter->slaying, op->race)) |
1099 | (op->arch && (op->arch->name != NULL) && strstr (op->arch->name, hitter->slaying))) |
1098 | || (op->arch && op->arch->archname && strstr (op->arch->archname, hitter->slaying))) |
1100 | { |
1099 | { |
1101 | doesnt_slay = 0; |
1100 | doesnt_slay = 0; |
1102 | dam *= 3; |
1101 | dam *= 3; |
1103 | } |
1102 | } |
1104 | } |
1103 | } |
… | |
… | |
1118 | /* Special hack. By default, if immune to something, you |
1117 | /* Special hack. By default, if immune to something, you |
1119 | * shouldn't need to worry. However, acid is an exception, since |
1118 | * shouldn't need to worry. However, acid is an exception, since |
1120 | * it can still damage your items. Only include attacktypes if |
1119 | * it can still damage your items. Only include attacktypes if |
1121 | * special processing is needed */ |
1120 | * special processing is needed */ |
1122 | |
1121 | |
1123 | if ((op->resist[attacknum] >= 100) && doesnt_slay && (attacknum != ATNR_ACID)) |
1122 | if (op->resist[attacknum] >= 100 |
|
|
1123 | && doesnt_slay |
|
|
1124 | && attacknum != ATNR_ACID) |
1124 | return 0; |
1125 | return 0; |
1125 | |
1126 | |
1126 | /* Keep this in order - makes things easier to find */ |
1127 | /* Keep this in order - makes things easier to find */ |
1127 | |
1128 | |
1128 | switch (attacknum) |
1129 | switch (attacknum) |
1129 | { |
1130 | { |
1130 | case ATNR_PHYSICAL: |
1131 | case ATNR_PHYSICAL: |
1131 | /* here also check for diseases */ |
1132 | /* here also check for diseases */ |
1132 | check_physically_infect (op, hitter); |
1133 | check_physically_infect (op, hitter); |
1133 | break; |
1134 | break; |
1134 | |
1135 | |
1135 | /* Don't need to do anything for: |
1136 | /* Don't need to do anything for: |
1136 | magic, |
1137 | magic, |
1137 | fire, |
1138 | fire, |
1138 | electricity, |
1139 | electricity, |
1139 | cold */ |
1140 | cold */ |
1140 | |
1141 | |
1141 | case ATNR_CONFUSION: |
1142 | case ATNR_CONFUSION: |
1142 | case ATNR_POISON: |
1143 | case ATNR_POISON: |
1143 | case ATNR_SLOW: |
1144 | case ATNR_SLOW: |
1144 | case ATNR_PARALYZE: |
1145 | case ATNR_PARALYZE: |
1145 | case ATNR_FEAR: |
1146 | case ATNR_FEAR: |
1146 | case ATNR_CANCELLATION: |
1147 | case ATNR_CANCELLATION: |
1147 | case ATNR_DEPLETE: |
1148 | case ATNR_DEPLETE: |
1148 | case ATNR_BLIND: |
1149 | case ATNR_BLIND: |
1149 | { |
1150 | { |
1150 | /* chance for inflicting a special attack depends on the |
1151 | /* chance for inflicting a special attack depends on the |
1151 | * difference between attacker's and defender's level |
1152 | * difference between attacker's and defender's level |
1152 | */ |
1153 | */ |
1153 | int level_diff = MIN (110, MAX (0, op->level - hitter->level)); |
1154 | int level_diff = MIN (110, MAX (0, op->level - hitter->level)); |
1154 | |
1155 | |
1155 | /* First, only creatures/players with speed can be affected. |
1156 | /* First, only creatures/players with speed can be affected. |
1156 | * Second, just getting hit doesn't mean it always affects |
1157 | * Second, just getting hit doesn't mean it always affects |
1157 | * you. Third, you still get a saving through against the |
1158 | * you. Third, you still get a saving through against the |
1158 | * effect. |
1159 | * effect. |
1159 | */ |
1160 | */ |
1160 | if (op->speed && |
1161 | if (op->speed && |
1161 | (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) && |
1162 | (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) && |
1162 | !(rndm (0, (attacknum == ATNR_SLOW ? 6 : 3) - 1)) && !did_make_save (op, level_diff, op->resist[attacknum] / 10)) |
1163 | !(rndm (0, (attacknum == ATNR_SLOW ? 6 : 3) - 1)) && !did_make_save (op, level_diff, op->resist[attacknum] / 10)) |
1163 | { |
1164 | { |
1164 | |
1165 | |
1165 | /* Player has been hit by something */ |
1166 | /* Player has been hit by something */ |
1166 | if (attacknum == ATNR_CONFUSION) |
1167 | if (attacknum == ATNR_CONFUSION) |
1167 | confuse_player (op, hitter, dam); |
1168 | confuse_player (op, hitter, dam); |
1168 | else if (attacknum == ATNR_POISON) |
1169 | else if (attacknum == ATNR_POISON) |
1169 | poison_player (op, hitter, dam); |
1170 | poison_player (op, hitter, dam); |
1170 | else if (attacknum == ATNR_SLOW) |
1171 | else if (attacknum == ATNR_SLOW) |
1171 | slow_player (op, hitter, dam); |
1172 | slow_player (op, hitter, dam); |
1172 | else if (attacknum == ATNR_PARALYZE) |
1173 | else if (attacknum == ATNR_PARALYZE) |
1173 | paralyze_player (op, hitter, dam); |
1174 | paralyze_player (op, hitter, dam); |
1174 | else if (attacknum == ATNR_FEAR) |
1175 | else if (attacknum == ATNR_FEAR) |
1175 | scare_creature (op, hitter); |
1176 | scare_creature (op, hitter); |
1176 | else if (attacknum == ATNR_CANCELLATION) |
1177 | else if (attacknum == ATNR_CANCELLATION) |
1177 | cancellation (op); |
1178 | cancellation (op); |
1178 | else if (attacknum == ATNR_DEPLETE) |
1179 | else if (attacknum == ATNR_DEPLETE) |
1179 | op->drain_stat (); |
1180 | op->drain_stat (); |
1180 | else if (attacknum == ATNR_BLIND && !QUERY_FLAG (op, FLAG_UNDEAD) && !QUERY_FLAG (op, FLAG_GENERATOR)) |
1181 | else if (attacknum == ATNR_BLIND && !QUERY_FLAG (op, FLAG_UNDEAD) && !QUERY_FLAG (op, FLAG_GENERATOR)) |
1181 | blind_player (op, hitter, dam); |
1182 | blind_player (op, hitter, dam); |
1182 | } |
1183 | } |
|
|
1184 | |
1183 | dam = 0; /* These are all effects and don't do real damage */ |
1185 | dam = 0; /* These are all effects and don't do real damage */ |
1184 | } |
1186 | } |
1185 | break; |
1187 | break; |
|
|
1188 | |
1186 | case ATNR_ACID: |
1189 | case ATNR_ACID: |
1187 | { |
1190 | { |
1188 | int flag = 0; |
1191 | int flag = 0; |
1189 | |
1192 | |
1190 | /* Items only get corroded if you're not on a battleground and |
1193 | /* Items only get corroded if you're not on a battleground and |
1191 | * if your acid resistance is below 50%. */ |
1194 | * if your acid resistance is below 50%. */ |
1192 | if (!op_on_battleground (op, NULL, NULL) && (op->resist[ATNR_ACID] < 50)) |
1195 | if (!op_on_battleground (op, NULL, NULL) && (op->resist[ATNR_ACID] < 50)) |
1193 | { |
1196 | { |
1194 | object *tmp; |
|
|
1195 | |
|
|
1196 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
1197 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1197 | { |
1198 | { |
1198 | if (tmp->invisible) |
1199 | if (tmp->invisible) |
1199 | continue; |
1200 | continue; |
1200 | if (!QUERY_FLAG (tmp, FLAG_APPLIED) || (tmp->resist[ATNR_ACID] >= 10)) |
1201 | if (!QUERY_FLAG (tmp, FLAG_APPLIED) || (tmp->resist[ATNR_ACID] >= 10)) |
1201 | /* >= 10% acid res. on itmes will protect these */ |
1202 | /* >= 10% acid res. on items will protect these */ |
1202 | continue; |
1203 | continue; |
1203 | if (!(tmp->material & M_IRON)) |
1204 | if (!(tmp->materials & M_IRON)) |
1204 | continue; |
1205 | continue; |
1205 | if (tmp->magic < -4) /* Let's stop at -5 */ |
1206 | if (tmp->magic < -4) /* Let's stop at -5 */ |
1206 | continue; |
1207 | continue; |
1207 | if (tmp->type == RING || |
1208 | if (tmp->type == RING |
1208 | /* removed boots and gloves from exclusion list in |
1209 | /* removed boots and gloves from exclusion list in PR */ |
1209 | PR */ |
1210 | || tmp->type == GIRDLE |
1210 | tmp->type == GIRDLE || tmp->type == AMULET || tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) |
1211 | || tmp->type == AMULET |
|
|
1212 | || tmp->type == WAND |
|
|
1213 | || tmp->type == ROD |
|
|
1214 | || tmp->type == HORN) |
1211 | continue; /* To avoid some strange effects */ |
1215 | continue; /* To avoid some strange effects */ |
1212 | |
1216 | |
1213 | /* High damage acid has better chance of corroding |
1217 | /* High damage acid has better chance of corroding |
1214 | objects */ |
1218 | objects */ |
1215 | if (rndm (0, dam + 4) > random_roll (0, 39, op, PREFER_HIGH) + 2 * tmp->magic) |
1219 | if (rndm (0, dam + 4) > random_roll (0, 39, op, PREFER_HIGH) + 2 * tmp->magic) |
1216 | { |
1220 | { |
1217 | if (op->type == PLAYER) |
1221 | if (op->type == PLAYER) |
1218 | /* Make this more visible */ |
1222 | /* Make this more visible */ |
1219 | new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, |
1223 | new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, |
1220 | "The %s's acid corrodes your %s!", query_name (hitter), query_name (tmp)); |
1224 | "The %s's acid corrodes your %s!", query_name (hitter), query_name (tmp)); |
1221 | flag = 1; |
1225 | flag = 1; |
1222 | tmp->magic--; |
1226 | tmp->magic--; |
1223 | if (op->type == PLAYER) |
1227 | if (op->type == PLAYER) |
1224 | esrv_send_item (op, tmp); |
1228 | esrv_send_item (op, tmp); |
1225 | } |
1229 | } |
1226 | } |
1230 | } |
|
|
1231 | |
1227 | if (flag) |
1232 | if (flag) |
1228 | op->update_stats (); /* Something was corroded */ |
1233 | op->update_stats (); /* Something was corroded */ |
1229 | } |
1234 | } |
1230 | } |
1235 | } |
1231 | break; |
1236 | break; |
|
|
1237 | |
1232 | case ATNR_DRAIN: |
1238 | case ATNR_DRAIN: |
1233 | { |
1239 | { |
1234 | /* rate is the proportion of exp drained. High rate means |
1240 | /* rate is the proportion of exp drained. High rate means |
1235 | * not much is drained, low rate means a lot is drained. |
1241 | * not much is drained, low rate means a lot is drained. |
1236 | */ |
1242 | */ |
1237 | int rate; |
1243 | int rate; |
1238 | |
1244 | |
1239 | if (op->resist[ATNR_DRAIN] >= 0) |
1245 | if (op->resist[ATNR_DRAIN] >= 0) |
1240 | rate = 400 + op->resist[ATNR_DRAIN] * 3; |
1246 | rate = 400 + op->resist[ATNR_DRAIN] * 3; |
1241 | else |
1247 | else |
1242 | rate = 400 * 100 / (100 - op->resist[ATNR_DRAIN]); |
1248 | rate = 400 * 100 / (100 - op->resist[ATNR_DRAIN]); |
1243 | |
1249 | |
1244 | if (op->stats.exp <= rate) |
1250 | if (op->stats.exp <= rate) |
1245 | { |
1251 | { |
1246 | if (op->type == GOLEM) |
1252 | if (op->type == GOLEM) |
1247 | dam = 999; /* Its force is "sucked" away. 8) */ |
1253 | dam = 999; /* Its force is "sucked" away. 8) */ |
1248 | else |
1254 | else |
1249 | /* If we can't drain, lets try to do physical damage */ |
1255 | /* If we can't drain, lets try to do physical damage */ |
1250 | dam = hit_player_attacktype (op, hitter, dam, ATNR_PHYSICAL, magic); |
1256 | dam = hit_player_attacktype (op, hitter, dam, ATNR_PHYSICAL, magic); |
1251 | } |
1257 | } |
1252 | else |
1258 | else |
1253 | { |
1259 | { |
1254 | /* Randomly give the hitter some hp */ |
1260 | /* Randomly give the hitter some hp */ |
1255 | if (hitter->stats.hp < hitter->stats.maxhp && |
1261 | if (hitter->stats.hp < hitter->stats.maxhp && |
1256 | (op->level > hitter->level) && random_roll (0, (op->level - hitter->level + 2), hitter, PREFER_HIGH) > 3) |
1262 | (op->level > hitter->level) && random_roll (0, (op->level - hitter->level + 2), hitter, PREFER_HIGH) > 3) |
1257 | hitter->stats.hp++; |
1263 | hitter->stats.hp++; |
1258 | |
1264 | |
1259 | /* Can't do drains on battleground spaces. |
1265 | /* Can't do drains on battleground spaces. |
1260 | * Move the wiz check up here - before, the hitter wouldn't gain exp |
1266 | * Move the wiz check up here - before, the hitter wouldn't gain exp |
1261 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1267 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1262 | * nothing happens. |
1268 | * nothing happens. |
1263 | * Try to credit the owner. We try to display player -> player drain |
1269 | * Try to credit the owner. We try to display player -> player drain |
1264 | * attacks, hence all the != PLAYER checks. |
1270 | * attacks, hence all the != PLAYER checks. |
1265 | */ |
1271 | */ |
1266 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1272 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WIZ)) |
1267 | { |
1273 | { |
1268 | object *owner = hitter->owner; |
1274 | object *owner = hitter->owner; |
1269 | |
1275 | |
1270 | if (owner && owner != hitter) |
1276 | if (owner && owner != hitter) |
1271 | { |
1277 | { |
1272 | if (op->type != PLAYER || owner->type != PLAYER) |
1278 | if (op->type != PLAYER || owner->type != PLAYER) |
1273 | change_exp (owner, op->stats.exp / (rate * 2), |
1279 | change_exp (owner, op->stats.exp / (rate * 2), |
1274 | hitter->chosen_skill ? hitter->chosen_skill->skill : (const char *) 0, SK_EXP_TOTAL); |
1280 | hitter->chosen_skill ? hitter->chosen_skill->skill : (const char *) 0, SK_EXP_TOTAL); |
1275 | } |
1281 | } |
1276 | else if (op->type != PLAYER || hitter->type != PLAYER) |
1282 | else if (op->type != PLAYER || hitter->type != PLAYER) |
1277 | { |
|
|
1278 | change_exp (hitter, op->stats.exp / (rate * 2), |
1283 | change_exp (hitter, op->stats.exp / (rate * 2), |
1279 | hitter->chosen_skill ? hitter->chosen_skill->skill : (const char *) 0, 0); |
1284 | hitter->chosen_skill ? hitter->chosen_skill->skill : (const char *) 0, 0); |
1280 | } |
1285 | |
1281 | change_exp (op, -op->stats.exp / rate, NULL, 0); |
1286 | change_exp (op, -op->stats.exp / rate, NULL, 0); |
1282 | } |
1287 | } |
|
|
1288 | |
1283 | dam = 1; /* Drain is an effect. Still return 1 - otherwise, if you have pure |
1289 | dam = 1; /* Drain is an effect. Still return 1 - otherwise, if you have pure |
1284 | * drain attack, you won't know that you are actually sucking out EXP, |
1290 | * drain attack, you won't know that you are actually sucking out EXP, |
1285 | * as the messages will say you missed |
1291 | * as the messages will say you missed |
1286 | */ |
1292 | */ |
1287 | } |
1293 | } |
1288 | } |
1294 | } |
1289 | break; |
1295 | break; |
|
|
1296 | |
1290 | case ATNR_TURN_UNDEAD: |
1297 | case ATNR_TURN_UNDEAD: |
1291 | { |
1298 | { |
1292 | if (QUERY_FLAG (op, FLAG_UNDEAD)) |
1299 | if (QUERY_FLAG (op, FLAG_UNDEAD)) |
1293 | { |
1300 | { |
1294 | object *owner = hitter->owner ? (object *)hitter->owner : hitter; |
1301 | object *owner = hitter->owner ? (object *)hitter->owner : hitter; |
1295 | object *god = find_god (determine_god (owner)); |
1302 | object *god = find_god (determine_god (owner)); |
1296 | int div = 1; |
1303 | int div = 1; |
1297 | |
1304 | |
1298 | /* if undead are not an enemy of your god, you turn them |
1305 | /* if undead are not an enemy of your god, you turn them |
1299 | * at half strength */ |
1306 | * at half strength */ |
1300 | if (!god || !god->slaying || strstr (god->slaying, undead_name) == NULL) |
1307 | if (!god || !god->slaying || strstr (god->slaying, shstr_undead) == NULL) |
1301 | div = 2; |
1308 | div = 2; |
|
|
1309 | |
1302 | /* Give a bonus if you resist turn undead */ |
1310 | /* Give a bonus if you resist turn undead */ |
1303 | if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100))) |
1311 | if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100))) |
1304 | scare_creature (op, owner); |
1312 | scare_creature (op, owner); |
1305 | } |
1313 | } |
1306 | else |
1314 | else |
1307 | dam = 0; /* don't damage non undead - should we damage |
1315 | dam = 0; /* don't damage non undead - should we damage |
1308 | undead? */ |
1316 | undead? */ |
1309 | } |
1317 | } |
1310 | break; |
1318 | break; |
|
|
1319 | |
1311 | case ATNR_DEATH: |
1320 | case ATNR_DEATH: |
1312 | deathstrike_player (op, hitter, &dam); |
1321 | deathstrike_player (op, hitter, &dam); |
1313 | break; |
1322 | break; |
|
|
1323 | |
1314 | case ATNR_CHAOS: |
1324 | case ATNR_CHAOS: |
1315 | LOG (llevError, "%s was hit by %s with non-specific chaos.\n", query_name (op), query_name (hitter)); |
1325 | LOG (llevError, "%s was hit by %s with non-specific chaos.\n", op->debug_desc (), hitter->debug_desc ()); |
1316 | dam = 0; |
1326 | dam = 0; |
1317 | break; |
1327 | break; |
|
|
1328 | |
1318 | case ATNR_COUNTERSPELL: |
1329 | case ATNR_COUNTERSPELL: |
1319 | LOG (llevError, "%s was hit by %s with counterspell attack.\n", query_name (op), query_name (hitter)); |
1330 | LOG (llevError, "%s was hit by %s with counterspell attack.\n", op->debug_desc (), hitter->debug_desc ()); |
1320 | dam = 0; |
1331 | dam = 0; |
1321 | /* This should never happen. Counterspell is handled |
1332 | /* This should never happen. Counterspell is handled |
1322 | * seperately and filtered out. If this does happen, |
1333 | * seperately and filtered out. If this does happen, |
1323 | * Counterspell has no effect on anything but spells, so it |
1334 | * Counterspell has no effect on anything but spells, so it |
1324 | * does no damage. */ |
1335 | * does no damage. */ |
1325 | break; |
1336 | break; |
|
|
1337 | |
1326 | case ATNR_HOLYWORD: |
1338 | case ATNR_HOLYWORD: |
1327 | { |
1339 | { |
1328 | /* This has already been handled by hit_player, |
1340 | /* This has already been handled by hit_player, |
1329 | * no need to check twice -- DAMN */ |
1341 | * no need to check twice -- DAMN */ |
1330 | object *owner = hitter->owner ? (object *)hitter->owner : hitter; |
1342 | object *owner = hitter->owner ? (object *)hitter->owner : hitter; |
1331 | |
1343 | |
1332 | /* As with turn undead above, give a bonus on the saving throw */ |
1344 | /* As with turn undead above, give a bonus on the saving throw */ |
1333 | if ((op->level + (op->resist[ATNR_HOLYWORD] / 100)) < owner->level + turn_bonus[owner->stats.Wis]) |
1345 | if ((op->level + (op->resist[ATNR_HOLYWORD] / 100)) < owner->level + turn_bonus[owner->stats.Wis]) |
1334 | scare_creature (op, owner); |
1346 | scare_creature (op, owner); |
1335 | } |
1347 | } |
1336 | break; |
1348 | break; |
|
|
1349 | |
1337 | case ATNR_LIFE_STEALING: |
1350 | case ATNR_LIFE_STEALING: |
1338 | { |
1351 | { |
1339 | int new_hp; |
1352 | int new_hp; |
1340 | |
1353 | |
1341 | /* this is replacement to drain for players, instead of taking |
1354 | /* this is replacement to drain for players, instead of taking |
1342 | * exp it takes hp. It is geared for players, probably not |
1355 | * exp it takes hp. It is geared for players, probably not |
1343 | * much use giving it to monsters |
1356 | * much use giving it to monsters |
1344 | * |
1357 | * |
1345 | * life stealing doesn't do a lot of damage, but it gives the |
1358 | * life stealing doesn't do a lot of damage, but it gives the |
1346 | * damage it does do to the player. Given that, |
1359 | * damage it does do to the player. Given that, |
1347 | * it only does 1/10'th normal damage (hence the divide by |
1360 | * it only does 1/10'th normal damage (hence the divide by |
1348 | * 1000). |
1361 | * 1000). |
1349 | */ |
1362 | */ |
1350 | /* You can't steal life from something undead */ |
1363 | /* You can't steal life from something undead */ |
1351 | if ((op->type == GOLEM) || (QUERY_FLAG (op, FLAG_UNDEAD))) |
1364 | if ((op->type == GOLEM) || (QUERY_FLAG (op, FLAG_UNDEAD))) |
1352 | return 0; |
1365 | return 0; |
|
|
1366 | |
1353 | /* If drain protection is higher than life stealing, use that */ |
1367 | /* If drain protection is higher than life stealing, use that */ |
1354 | if (op->resist[ATNR_DRAIN] >= op->resist[ATNR_LIFE_STEALING]) |
1368 | if (op->resist[ATNR_DRAIN] >= op->resist[ATNR_LIFE_STEALING]) |
1355 | dam = (dam * (100 - op->resist[ATNR_DRAIN])) / 3000; |
1369 | dam = (dam * (100 - op->resist[ATNR_DRAIN])) / 3000; |
1356 | else |
1370 | else |
1357 | dam = (dam * (100 - op->resist[ATNR_LIFE_STEALING])) / 3000; |
1371 | dam = (dam * (100 - op->resist[ATNR_LIFE_STEALING])) / 3000; |
|
|
1372 | |
1358 | /* You die at -1 hp, not zero. */ |
1373 | /* You die at -1 hp, not zero. */ |
1359 | if (dam > (op->stats.hp + 1)) |
1374 | if (dam > (op->stats.hp + 1)) |
1360 | dam = op->stats.hp + 1; |
1375 | dam = op->stats.hp + 1; |
|
|
1376 | |
1361 | new_hp = hitter->stats.hp + dam; |
1377 | new_hp = hitter->stats.hp + dam; |
1362 | if (new_hp > hitter->stats.maxhp) |
1378 | if (new_hp > hitter->stats.maxhp) |
1363 | new_hp = hitter->stats.maxhp; |
1379 | new_hp = hitter->stats.maxhp; |
|
|
1380 | |
1364 | if (new_hp > hitter->stats.hp) |
1381 | if (new_hp > hitter->stats.hp) |
1365 | hitter->stats.hp = new_hp; |
1382 | hitter->stats.hp = new_hp; |
1366 | } |
1383 | } |
1367 | } |
1384 | } |
|
|
1385 | |
1368 | return dam; |
1386 | return dam; |
1369 | } |
1387 | } |
1370 | |
|
|
1371 | |
1388 | |
1372 | /* GROS: This code comes from hit_player. It has been made external to |
1389 | /* GROS: This code comes from hit_player. It has been made external to |
1373 | * allow script procedures to "kill" objects in a combat-like fashion. |
1390 | * allow script procedures to "kill" objects in a combat-like fashion. |
1374 | * It was initially used by (kill-object) developed for the Collector's |
1391 | * It was initially used by (kill-object) developed for the Collector's |
1375 | * Sword. Note that nothing has been changed from the original version |
1392 | * Sword. Note that nothing has been changed from the original version |
… | |
… | |
1390 | char buf[MAX_BUF]; |
1407 | char buf[MAX_BUF]; |
1391 | const char *skill; |
1408 | const char *skill; |
1392 | int maxdam = 0; |
1409 | int maxdam = 0; |
1393 | int battleg = 0; /* true if op standing on battleground */ |
1410 | int battleg = 0; /* true if op standing on battleground */ |
1394 | int pk = 0; /* true if op and what controls hitter are both players */ |
1411 | int pk = 0; /* true if op and what controls hitter are both players */ |
1395 | object *owner = NULL; |
1412 | object *owner = 0; |
1396 | object *skop = NULL; |
1413 | object *skop = 0; |
1397 | |
1414 | |
1398 | if (op->stats.hp >= 0) |
1415 | if (op->stats.hp >= 0) |
1399 | return -1; |
1416 | return -1; |
1400 | |
1417 | |
1401 | if (INVOKE_OBJECT (KILL, op, ARG_OBJECT (hitter))) |
1418 | if (INVOKE_OBJECT (KILL, op, ARG_OBJECT (hitter))) |
… | |
… | |
1410 | if (QUERY_FLAG (op, FLAG_BLOCKSVIEW)) |
1427 | if (QUERY_FLAG (op, FLAG_BLOCKSVIEW)) |
1411 | update_all_los (op->map, op->x, op->y); /* makes sure los will be recalculated */ |
1428 | update_all_los (op->map, op->x, op->y); /* makes sure los will be recalculated */ |
1412 | |
1429 | |
1413 | if (op->type == DOOR) |
1430 | if (op->type == DOOR) |
1414 | { |
1431 | { |
1415 | op->set_speed (0.1); |
1432 | op->set_speed (0.1f); |
1416 | op->speed_left = -0.05; |
1433 | op->speed_left = -0.05f; |
1417 | return maxdam; |
1434 | return maxdam; |
1418 | } |
1435 | } |
1419 | |
1436 | |
1420 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1437 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1421 | { |
1438 | { |
1422 | remove_friendly_object (op); |
|
|
1423 | |
|
|
1424 | if (op->owner && op->owner->type == PLAYER && op->owner->contr->ranges[range_golem] == op) |
|
|
1425 | op->owner->contr->ranges[range_golem] = 0; |
|
|
1426 | |
|
|
1427 | op->destroy (); |
1439 | op->destroy (); |
1428 | return maxdam; |
1440 | return maxdam; |
1429 | } |
1441 | } |
1430 | |
1442 | |
1431 | /* Now lets start dealing with experience we get for killing something */ |
1443 | /* Now lets start dealing with experience we get for killing something */ |
… | |
… | |
1475 | else |
1487 | else |
1476 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1488 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1477 | |
1489 | |
1478 | /* Only play sounds for melee kills */ |
1490 | /* Only play sounds for melee kills */ |
1479 | if (hitter->type == PLAYER) |
1491 | if (hitter->type == PLAYER) |
1480 | play_sound_map (owner->map, owner->x, owner->y, SOUND_PLAYER_KILLS); |
1492 | owner->play_sound (sound_find ("player_kills")); |
1481 | } |
1493 | } |
1482 | |
1494 | |
1483 | /* If a player kills another player, not on |
1495 | /* If a player kills another player, not on |
1484 | * battleground, the "killer" looses 1 luck. Since this is |
1496 | * battleground, the "killer" looses 1 luck. Since this is |
1485 | * not reversible, it's actually quite a pain IMHO. -AV |
1497 | * not reversible, it's actually quite a pain IMHO. -AV |
… | |
… | |
1490 | */ |
1502 | */ |
1491 | if (op->type == PLAYER && owner != op && !battleg) |
1503 | if (op->type == PLAYER && owner != op && !battleg) |
1492 | owner->change_luck (-settings.pk_luck_penalty); |
1504 | owner->change_luck (-settings.pk_luck_penalty); |
1493 | |
1505 | |
1494 | /* This code below deals with finding the appropriate skill |
1506 | /* This code below deals with finding the appropriate skill |
1495 | * to credit exp to. This is a bit problematic - we should |
1507 | * to credit exp to. This is a bit problematic - we should |
1496 | * probably never really have to look at current_weapon->skill |
1508 | * probably never really have to look at current_weapon->skill |
1497 | */ |
1509 | */ |
1498 | skill = 0; |
1510 | skill = 0; |
1499 | |
1511 | |
1500 | if (hitter->skill && hitter->type != PLAYER) |
1512 | if (hitter->skill && hitter->type != PLAYER) |
1501 | skill = hitter->skill; |
1513 | skill = hitter->skill; |
1502 | else if (owner->chosen_skill) |
1514 | else if (owner->chosen_skill) |
1503 | { |
1515 | { |
1504 | skill = owner->chosen_skill->skill; |
|
|
1505 | skop = owner->chosen_skill; |
1516 | skop = owner->chosen_skill; |
|
|
1517 | skill = skop->skill; |
1506 | } |
1518 | } |
1507 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) |
1519 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) |
1508 | skill = owner->current_weapon->skill; |
1520 | skill = owner->current_weapon->skill; |
1509 | else |
1521 | else |
1510 | LOG (llevError, "kill_object - unable to find skill that killed monster\n"); |
1522 | LOG (llevError, "kill_object - unable to find skill that killed monster\n"); |
1511 | |
1523 | |
1512 | /* We have the skill we want to credit to - now find the object this goes |
1524 | /* We have the skill we want to credit to - now find the object this goes |
1513 | * to. Make sure skop is an actual skill, and not a skill tool! |
1525 | * to. Make sure skop is an actual skill, and not a skill tool! |
1514 | */ |
1526 | */ |
1515 | if ((!skop || skop->type != SKILL) && skill) |
1527 | if ((!skop || skop->type != SKILL) && skill) |
1516 | { |
1528 | { |
1517 | int i; |
1529 | int i; |
1518 | |
1530 | |
… | |
… | |
1544 | skill = skop->skill; |
1556 | skill = skop->skill; |
1545 | |
1557 | |
1546 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1558 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1547 | |
1559 | |
1548 | /* If you didn't kill yourself, and your not the wizard */ |
1560 | /* If you didn't kill yourself, and your not the wizard */ |
1549 | if (owner != op && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1561 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1550 | { |
1562 | { |
1551 | int exp; |
1563 | int exp; |
1552 | |
1564 | |
1553 | /* Really don't give much experience for killing other players */ |
1565 | /* Really don't give much experience for killing other players */ |
1554 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
1566 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
… | |
… | |
1581 | if (owner->type != PLAYER || owner->contr->party == NULL) |
1593 | if (owner->type != PLAYER || owner->contr->party == NULL) |
1582 | change_exp (owner, exp, skill, 0); |
1594 | change_exp (owner, exp, skill, 0); |
1583 | else |
1595 | else |
1584 | { |
1596 | { |
1585 | int shares = 0, count = 0; |
1597 | int shares = 0, count = 0; |
1586 | player *pl; |
|
|
1587 | partylist *party = owner->contr->party; |
1598 | partylist *party = owner->contr->party; |
1588 | |
1599 | |
1589 | add_kill_to_party (party, query_name (owner), query_name (op), exp); |
1600 | add_kill_to_party (party, query_name (owner), query_name (op), exp); |
1590 | |
1601 | |
1591 | for_all_players (pl) |
1602 | for_all_players (pl) |
… | |
… | |
1622 | { |
1633 | { |
1623 | object *owner1 = op->owner; |
1634 | object *owner1 = op->owner; |
1624 | |
1635 | |
1625 | if (owner1 && owner1->type == PLAYER) |
1636 | if (owner1 && owner1->type == PLAYER) |
1626 | { |
1637 | { |
1627 | play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0); |
1638 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1628 | /* Maybe we should include the owner that killed this, maybe not */ |
1639 | /* Maybe we should include the owner that killed this, maybe not */ |
1629 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1640 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1630 | } |
1641 | } |
1631 | |
1642 | |
1632 | remove_friendly_object (op); |
1643 | remove_friendly_object (op); |
… | |
… | |
1650 | } |
1661 | } |
1651 | |
1662 | |
1652 | /* Find out if this is friendly fire (PVP and attacker is peaceful) or not |
1663 | /* Find out if this is friendly fire (PVP and attacker is peaceful) or not |
1653 | * Returns 0 this is not friendly fire |
1664 | * Returns 0 this is not friendly fire |
1654 | */ |
1665 | */ |
1655 | |
|
|
1656 | int |
1666 | int |
1657 | friendly_fire (object *op, object *hitter) |
1667 | friendly_fire (object *op, object *hitter) |
1658 | { |
1668 | { |
1659 | object *owner; |
1669 | object *owner; |
1660 | int friendlyfire; |
1670 | int friendlyfire; |
… | |
… | |
1679 | } |
1689 | } |
1680 | |
1690 | |
1681 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1691 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1682 | friendlyfire = 0; |
1692 | friendlyfire = 0; |
1683 | } |
1693 | } |
|
|
1694 | |
1684 | return friendlyfire; |
1695 | return friendlyfire; |
1685 | } |
1696 | } |
1686 | |
|
|
1687 | |
1697 | |
1688 | /* This isn't used just for players, but in fact most objects. |
1698 | /* This isn't used just for players, but in fact most objects. |
1689 | * op is the object to be hit, dam is the amount of damage, hitter |
1699 | * op is the object to be hit, dam is the amount of damage, hitter |
1690 | * is what is hitting the object, type is the attacktype, and |
1700 | * is what is hitting the object, type is the attacktype, and |
1691 | * full_hit is set if monster area does not matter. |
1701 | * full_hit is set if monster area does not matter. |
1692 | * dam is base damage - protections/vulnerabilities/slaying matches can |
1702 | * dam is base damage - protections/vulnerabilities/slaying matches can |
1693 | * modify it. |
1703 | * modify it. |
1694 | */ |
1704 | */ |
1695 | |
|
|
1696 | /* Oct 95 - altered the following slightly for MULTIPLE_GODS hack |
1705 | /* Oct 95 - altered the following slightly for MULTIPLE_GODS hack |
1697 | * which needs new attacktype AT_HOLYWORD to work . b.t. */ |
1706 | * which needs new attacktype AT_HOLYWORD to work . b.t. */ |
1698 | |
|
|
1699 | int |
1707 | int |
1700 | hit_player (object *op, int dam, object *hitter, int type, int full_hit) |
1708 | hit_player (object *op, int dam, object *hitter, int type, int full_hit) |
1701 | { |
1709 | { |
1702 | int maxdam = 0, ndam = 0, attacktype = 1, magic = (type & AT_MAGIC); |
1710 | int maxdam = 0, ndam = 0, attacktype = 1, magic = (type & AT_MAGIC); |
1703 | int maxattacktype, attacknum; |
1711 | int maxattacktype, attacknum; |
… | |
… | |
1711 | |
1719 | |
1712 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1720 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1713 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1721 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1714 | return 0; |
1722 | return 0; |
1715 | |
1723 | |
1716 | #ifdef PROHIBIT_PLAYERKILL |
1724 | // only allow pk for hostile players |
1717 | if (op->type == PLAYER) |
1725 | if (op->type == PLAYER) |
1718 | { |
1726 | { |
1719 | object *owner = hitter->owner; |
1727 | object *owner = hitter->owner; |
1720 | |
1728 | |
1721 | if (!owner) |
1729 | if (!owner) |
1722 | owner = hitter; |
1730 | owner = hitter; |
1723 | |
1731 | |
1724 | if (owner->type == PLAYER && (!op_on_battleground (op, 0, 0) && (op->contr->peaceful || owner->contr->peaceful)) && op != owner) |
1732 | if (owner->type == PLAYER |
|
|
1733 | && (!op_on_battleground (op, 0, 0) |
|
|
1734 | && (op->contr->peaceful || owner->contr->peaceful)) |
|
|
1735 | && op != owner) |
1725 | return 0; |
1736 | return 0; |
1726 | } |
1737 | } |
1727 | #endif |
|
|
1728 | |
1738 | |
1729 | if (body_attack) |
1739 | if (body_attack) |
1730 | { |
1740 | { |
1731 | /* slow and paralyze must hit the head. But we don't want to just |
1741 | /* slow and paralyze must hit the head. But we don't want to just |
1732 | * return - we still need to process other attacks the spell still |
1742 | * return - we still need to process other attacks the spell still |
… | |
… | |
1746 | } |
1756 | } |
1747 | } |
1757 | } |
1748 | |
1758 | |
1749 | if (!simple_attack && op->type == DOOR) |
1759 | if (!simple_attack && op->type == DOOR) |
1750 | { |
1760 | { |
1751 | object *tmp; |
|
|
1752 | |
|
|
1753 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
1761 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1754 | if (tmp->type == RUNE || tmp->type == TRAP) |
1762 | if (tmp->type == RUNE || tmp->type == TRAP) |
1755 | { |
1763 | { |
1756 | spring_trap (tmp, hitter); |
1764 | spring_trap (tmp, hitter); |
1757 | |
1765 | |
1758 | if (hitter->destroyed () || op->destroyed () || abort_attack (op, hitter, simple_attack)) |
1766 | if (hitter->destroyed () || op->destroyed () || abort_attack (op, hitter, simple_attack)) |
… | |
… | |
1765 | if (!QUERY_FLAG (op, FLAG_ALIVE) || op->stats.hp < 0) |
1773 | if (!QUERY_FLAG (op, FLAG_ALIVE) || op->stats.hp < 0) |
1766 | { |
1774 | { |
1767 | /* FIXME: If a player is killed by a rune in a door, the |
1775 | /* FIXME: If a player is killed by a rune in a door, the |
1768 | * destroyed() check above doesn't return, and might get here. |
1776 | * destroyed() check above doesn't return, and might get here. |
1769 | */ |
1777 | */ |
|
|
1778 | |
|
|
1779 | /* FIXME: This for example happens when a dead door is on a mover and |
|
|
1780 | gets it's speed_left raised on each mover-tick. |
|
|
1781 | Doors are removed in a kinda funny way by giving them speed and speed_left |
|
|
1782 | and waiting for that to run out. |
|
|
1783 | */ |
1770 | LOG (llevDebug, "victim (arch %s, name %s) already dead in " "hit_player()\n", &op->arch->name, &op->name); |
1784 | LOG (llevDebug, "victim %s (%d) already dead in hit_player()\n", op->debug_desc (), op->stats.hp); |
1771 | return 0; |
1785 | return 0; |
1772 | } |
1786 | } |
1773 | |
1787 | |
1774 | #ifdef ATTACK_DEBUG |
1788 | #ifdef ATTACK_DEBUG |
1775 | LOG (llevDebug, "hit player: attacktype %d, dam %d\n", type, dam); |
1789 | LOG (llevDebug, "hit player: attacktype %d, dam %d\n", type, dam); |
… | |
… | |
1781 | * in case 0>dam>1, we try to "simulate" a float value-effect */ |
1795 | * in case 0>dam>1, we try to "simulate" a float value-effect */ |
1782 | dam = dam * (100 - op->resist[ATNR_MAGIC]); |
1796 | dam = dam * (100 - op->resist[ATNR_MAGIC]); |
1783 | if (dam >= 100) |
1797 | if (dam >= 100) |
1784 | dam /= 100; |
1798 | dam /= 100; |
1785 | else |
1799 | else |
1786 | dam = (dam > (rndm (0, 99))) ? 1 : 0; |
1800 | dam = (dam > rndm (0, 99)) ? 1 : 0; |
1787 | } |
1801 | } |
1788 | |
1802 | |
1789 | /* AT_CHAOS here is a weapon or monster. Spells are handled by hit_map |
1803 | /* AT_CHAOS here is a weapon or monster. Spells are handled by hit_map |
1790 | * If the attacktype still has chaos, shuffle it, then clear the Chaos bit |
1804 | * If the attacktype still has chaos, shuffle it, then clear the Chaos bit |
1791 | */ |
1805 | */ |
… | |
… | |
1807 | if ((!hitter->slaying || |
1821 | if ((!hitter->slaying || |
1808 | (!(op->race && strstr (hitter->slaying, op->race)) && |
1822 | (!(op->race && strstr (hitter->slaying, op->race)) && |
1809 | !(op->name && strstr (hitter->slaying, op->name)))) && |
1823 | !(op->name && strstr (hitter->slaying, op->name)))) && |
1810 | (!QUERY_FLAG (op, FLAG_UNDEAD) || |
1824 | (!QUERY_FLAG (op, FLAG_UNDEAD) || |
1811 | (hitter->title != NULL |
1825 | (hitter->title != NULL |
1812 | && (god = find_god (determine_god (hitter))) != NULL && god->race != NULL && strstr (god->race, undead_name) != NULL))) |
1826 | && (god = find_god (determine_god (hitter))) != NULL && god->race != NULL && strstr (god->race, shstr_undead) != NULL))) |
1813 | return 0; |
1827 | return 0; |
1814 | } |
1828 | } |
1815 | |
1829 | |
1816 | maxattacktype = type; /* initialise this to something */ |
1830 | maxattacktype = type; /* initialise this to something */ |
1817 | for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum) |
1831 | for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum) |
… | |
… | |
1849 | */ |
1863 | */ |
1850 | friendlyfire = friendly_fire (op, hitter); |
1864 | friendlyfire = friendly_fire (op, hitter); |
1851 | if (friendlyfire && maxdam) |
1865 | if (friendlyfire && maxdam) |
1852 | { |
1866 | { |
1853 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1867 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1854 | #ifndef COZY_SERVER |
|
|
1855 | maxdam++; |
|
|
1856 | #endif |
|
|
1857 | |
1868 | |
1858 | #ifdef ATTACK_DEBUG |
1869 | #ifdef ATTACK_DEBUG |
1859 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1870 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1860 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1871 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1861 | #endif |
1872 | #endif |
1862 | } |
1873 | } |
1863 | |
1874 | |
1864 | if (!full_hit) |
1875 | if (!full_hit) |
1865 | { |
1876 | { |
1866 | archetype *at; |
|
|
1867 | int area; |
1877 | int area; |
1868 | int remainder; |
1878 | int remainder; |
1869 | |
1879 | |
1870 | area = 0; |
1880 | area = 0; |
1871 | for (at = op->arch; at != NULL; at = at->more) |
1881 | |
|
|
1882 | for (archetype *at = op->arch; at; at = (archetype *)at->more) |
1872 | area++; |
1883 | area++; |
|
|
1884 | |
1873 | assert (area > 0); |
1885 | assert (area > 0); |
1874 | |
1886 | |
1875 | /* basically: maxdam /= area; we try to "simulate" a float |
1887 | /* basically: maxdam /= area; we try to "simulate" a float |
1876 | value-effect */ |
1888 | value-effect */ |
1877 | remainder = 100 * (maxdam % area) / area; |
1889 | remainder = 100 * (maxdam % area) / area; |
1878 | maxdam /= area; |
1890 | maxdam /= area; |
1879 | if (RANDOM () % 100 < remainder) |
1891 | if (rndm (100) < remainder) |
1880 | maxdam++; |
1892 | maxdam++; |
1881 | } |
1893 | } |
1882 | |
1894 | |
1883 | #ifdef ATTACK_DEBUG |
1895 | #ifdef ATTACK_DEBUG |
1884 | LOG (llevDebug, "Attacktype %d did %d damage\n", type, maxdam); |
1896 | LOG (llevDebug, "Attacktype %d did %d damage\n", type, maxdam); |
1885 | #endif |
1897 | #endif |
1886 | |
1898 | |
|
|
1899 | // for now, only do this for active objects, otherwise they |
|
|
1900 | // keep a refcount for a long time and I see no usefulness |
|
|
1901 | // for an non-active objetc to know its enemy. |
|
|
1902 | if (op->active) |
1887 | if (hitter->owner) |
1903 | if (hitter->owner) |
1888 | op->enemy = hitter->owner; |
1904 | op->enemy = hitter->owner; |
1889 | else if (QUERY_FLAG (hitter, FLAG_ALIVE)) |
1905 | else if (QUERY_FLAG (hitter, FLAG_ALIVE)) |
1890 | op->enemy = hitter; |
1906 | op->enemy = hitter; |
1891 | |
1907 | |
1892 | if (QUERY_FLAG (op, FLAG_UNAGGRESSIVE) && op->type != PLAYER) |
1908 | if (QUERY_FLAG (op, FLAG_UNAGGRESSIVE) && op->type != PLAYER) |
1893 | { |
1909 | { |
1894 | /* The unaggressives look after themselves 8) */ |
1910 | /* The unaggressives look after themselves 8) */ |
1895 | CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); |
1911 | CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); |
… | |
… | |
1932 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1948 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1933 | * that before if the player was immune to ghosthit, the monster |
1949 | * that before if the player was immune to ghosthit, the monster |
1934 | * remained - that is no longer the case. |
1950 | * remained - that is no longer the case. |
1935 | */ |
1951 | */ |
1936 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1952 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1937 | { |
|
|
1938 | if (QUERY_FLAG (hitter, FLAG_FRIENDLY)) |
|
|
1939 | remove_friendly_object (hitter); |
|
|
1940 | |
|
|
1941 | hitter->destroy (); |
1953 | hitter->destroy (); |
1942 | } |
1954 | |
1943 | /* Lets handle creatures that are splitting now */ |
1955 | /* Lets handle creatures that are splitting now */ |
1944 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1956 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1945 | { |
1957 | { |
1946 | int i; |
1958 | int i; |
1947 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
1959 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
… | |
… | |
1954 | return maxdam; |
1966 | return maxdam; |
1955 | } |
1967 | } |
1956 | |
1968 | |
1957 | op->remove (); |
1969 | op->remove (); |
1958 | |
1970 | |
1959 | for (i = 0; i < NROFNEWOBJS (op); i++) |
1971 | for (i = 0; i < op->stats.food; i++) |
1960 | { /* This doesn't handle op->more yet */ |
1972 | { /* This doesn't handle op->more yet */ |
1961 | object *tmp = arch_to_object (op->other_arch); |
1973 | object *tmp = arch_to_object (op->other_arch); |
1962 | int j; |
1974 | int j; |
1963 | |
1975 | |
1964 | tmp->stats.hp = op->stats.hp; |
1976 | tmp->stats.hp = op->stats.hp; |
1965 | |
1977 | |
1966 | if (friendly) |
1978 | if (friendly) |
1967 | { |
1979 | { |
1968 | SET_FLAG (tmp, FLAG_FRIENDLY); |
|
|
1969 | add_friendly_object (tmp); |
1980 | add_friendly_object (tmp); |
1970 | tmp->attack_movement = PETMOVE; |
1981 | tmp->attack_movement = PETMOVE; |
|
|
1982 | |
1971 | if (owner != NULL) |
1983 | if (owner) |
1972 | tmp->set_owner (owner); |
1984 | tmp->set_owner (owner); |
1973 | } |
1985 | } |
1974 | |
1986 | |
1975 | if (unaggressive) |
1987 | if (unaggressive) |
1976 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
1988 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
… | |
… | |
1991 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
2003 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
1992 | hitter->destroy (); |
2004 | hitter->destroy (); |
1993 | |
2005 | |
1994 | return maxdam; |
2006 | return maxdam; |
1995 | } |
2007 | } |
1996 | |
|
|
1997 | |
2008 | |
1998 | void |
2009 | void |
1999 | poison_player (object *op, object *hitter, int dam) |
2010 | poison_player (object *op, object *hitter, int dam) |
2000 | { |
2011 | { |
2001 | archetype *at = archetype::find ("poisoning"); |
2012 | archetype *at = archetype::find ("poisoning"); |
… | |
… | |
2037 | tmp->stats.Dex = MAX (-(dam / 6 + 1), -10); |
2048 | tmp->stats.Dex = MAX (-(dam / 6 + 1), -10); |
2038 | tmp->stats.Int = MAX (-dam / 7, -10); |
2049 | tmp->stats.Int = MAX (-dam / 7, -10); |
2039 | SET_FLAG (tmp, FLAG_APPLIED); |
2050 | SET_FLAG (tmp, FLAG_APPLIED); |
2040 | op->update_stats (); |
2051 | op->update_stats (); |
2041 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
2052 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
|
|
2053 | op->play_sound (tmp->sound); |
2042 | } |
2054 | } |
|
|
2055 | |
2043 | if (hitter->type == PLAYER) |
2056 | if (hitter->type == PLAYER) |
2044 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2057 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2045 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
2058 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
2046 | new_draw_info_format (NDI_UNIQUE, 0, hitter->owner, "Your %s poisons %s.", &hitter->name, &op->name); |
2059 | new_draw_info_format (NDI_UNIQUE, 0, hitter->owner, "Your %s poisons %s.", &hitter->name, &op->name); |
2047 | } |
2060 | } |
|
|
2061 | |
2048 | tmp->speed_left = 0; |
2062 | tmp->speed_left = 0; |
2049 | } |
2063 | } |
2050 | else |
2064 | else |
2051 | tmp->stats.food++; |
2065 | tmp->stats.food++; |
2052 | } |
2066 | } |
… | |
… | |
2056 | { |
2070 | { |
2057 | archetype *at = archetype::find ("slowness"); |
2071 | archetype *at = archetype::find ("slowness"); |
2058 | object *tmp; |
2072 | object *tmp; |
2059 | |
2073 | |
2060 | if (at == NULL) |
2074 | if (at == NULL) |
2061 | { |
|
|
2062 | LOG (llevError, "Can't find slowness archetype.\n"); |
2075 | LOG (llevError, "Can't find slowness archetype.\n"); |
2063 | } |
2076 | |
2064 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2077 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2065 | { |
2078 | { |
2066 | tmp = arch_to_object (at); |
2079 | tmp = arch_to_object (at); |
2067 | tmp = insert_ob_in_ob (tmp, op); |
2080 | tmp = insert_ob_in_ob (tmp, op); |
2068 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2081 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2069 | } |
2082 | } |
2070 | else |
2083 | else |
2071 | tmp->stats.food++; |
2084 | tmp->stats.food++; |
|
|
2085 | |
2072 | SET_FLAG (tmp, FLAG_APPLIED); |
2086 | SET_FLAG (tmp, FLAG_APPLIED); |
2073 | tmp->speed_left = 0; |
2087 | tmp->speed_left = 0; |
2074 | op->update_stats (); |
2088 | op->update_stats (); |
2075 | } |
2089 | } |
2076 | |
2090 | |
… | |
… | |
2093 | tmp->speed = 0.05; |
2107 | tmp->speed = 0.05; |
2094 | tmp->subtype = FORCE_CONFUSION; |
2108 | tmp->subtype = FORCE_CONFUSION; |
2095 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2109 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2096 | tmp->name = "confusion"; |
2110 | tmp->name = "confusion"; |
2097 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2111 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
|
|
2112 | |
2098 | if (tmp->duration > maxduration) |
2113 | if (tmp->duration > maxduration) |
2099 | tmp->duration = maxduration; |
2114 | tmp->duration = maxduration; |
2100 | |
2115 | |
2101 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2116 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2102 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
2117 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
|
|
2118 | |
2103 | SET_FLAG (op, FLAG_CONFUSED); |
2119 | SET_FLAG (op, FLAG_CONFUSED); |
2104 | } |
2120 | } |
2105 | |
2121 | |
2106 | void |
2122 | void |
2107 | blind_player (object *op, object *hitter, int dam) |
2123 | blind_player (object *op, object *hitter, int dam) |
… | |
… | |
2173 | op->speed_left = (float) -(FABS (op->speed) * max); |
2189 | op->speed_left = (float) -(FABS (op->speed) * max); |
2174 | |
2190 | |
2175 | /* tmp->stats.food = (signed short) (max/FABS(op->speed)); */ |
2191 | /* tmp->stats.food = (signed short) (max/FABS(op->speed)); */ |
2176 | } |
2192 | } |
2177 | |
2193 | |
2178 | |
|
|
2179 | /* Attempts to kill 'op'. hitter is the attack object, dam is |
2194 | /* Attempts to kill 'op'. hitter is the attack object, dam is |
2180 | * the computed damaged. |
2195 | * the computed damaged. |
2181 | */ |
2196 | */ |
2182 | void |
2197 | void |
2183 | deathstrike_player (object *op, object *hitter, int *dam) |
2198 | deathstrike_player (object *op, object *hitter, int *dam) |
… | |
… | |
2191 | ** field of the deathstriking object */ |
2206 | ** field of the deathstriking object */ |
2192 | |
2207 | |
2193 | int atk_lev, def_lev, kill_lev; |
2208 | int atk_lev, def_lev, kill_lev; |
2194 | |
2209 | |
2195 | if (hitter->slaying) |
2210 | if (hitter->slaying) |
2196 | if (!((QUERY_FLAG (op, FLAG_UNDEAD) && strstr (hitter->slaying, undead_name)) || (op->race && strstr (hitter->slaying, op->race)))) |
2211 | if (!((QUERY_FLAG (op, FLAG_UNDEAD) && strstr (hitter->slaying, shstr_undead)) || (op->race && strstr (hitter->slaying, op->race)))) |
2197 | return; |
2212 | return; |
2198 | |
2213 | |
2199 | def_lev = op->level; |
2214 | def_lev = op->level; |
2200 | if (def_lev < 1) |
2215 | if (def_lev < 1) |
2201 | { |
2216 | { |
2202 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->name, &op->name); |
2217 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->archname, &op->name); |
2203 | def_lev = 1; |
2218 | def_lev = 1; |
2204 | } |
2219 | } |
|
|
2220 | |
2205 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2221 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2206 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
2222 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
2207 | atk_lev, def_lev); */ |
2223 | atk_lev, def_lev); */ |
2208 | |
2224 | |
2209 | if (atk_lev >= def_lev) |
2225 | if (atk_lev >= def_lev) |
… | |
… | |
2224 | */ |
2240 | */ |
2225 | *dam *= kill_lev / def_lev; |
2241 | *dam *= kill_lev / def_lev; |
2226 | } |
2242 | } |
2227 | } |
2243 | } |
2228 | else |
2244 | else |
2229 | { |
|
|
2230 | *dam = 0; /* no harm done */ |
2245 | *dam = 0; /* no harm done */ |
2231 | } |
|
|
2232 | } |
2246 | } |
2233 | |
2247 | |
2234 | /* thrown_item_effect() - handles any special effects of thrown |
2248 | /* thrown_item_effect() - handles any special effects of thrown |
2235 | * items (like attacking living creatures--a potion thrown at a |
2249 | * items (like attacking living creatures--a potion thrown at a |
2236 | * monster). |
2250 | * monster). |
… | |
… | |
2265 | } |
2279 | } |
2266 | } |
2280 | } |
2267 | } |
2281 | } |
2268 | |
2282 | |
2269 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2283 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2270 | |
|
|
2271 | int |
2284 | int |
2272 | adj_attackroll (object *hitter, object *target) |
2285 | adj_attackroll (object *hitter, object *target) |
2273 | { |
2286 | { |
2274 | object *attacker = hitter; |
2287 | object *attacker = hitter; |
2275 | int adjust = 0; |
2288 | int adjust = 0; |
… | |
… | |
2340 | #endif |
2353 | #endif |
2341 | |
2354 | |
2342 | return adjust; |
2355 | return adjust; |
2343 | } |
2356 | } |
2344 | |
2357 | |
2345 | |
|
|
2346 | /* determine if the object is an 'aimed' missile */ |
2358 | /* determine if the object is an 'aimed' missile */ |
2347 | int |
2359 | int |
2348 | is_aimed_missile (object *op) |
2360 | is_aimed_missile (object *op) |
2349 | { |
2361 | { |
2350 | |
2362 | |
2351 | /* I broke what used to be one big if into a few nested |
2363 | /* I broke what used to be one big if into a few nested |
2352 | * ones so that figuring out the logic is at least possible. |
2364 | * ones so that figuring out the logic is at least possible. |
2353 | */ |
2365 | */ |
2354 | if (op && (op->move_type & MOVE_FLYING)) |
2366 | if (op && (op->move_type & MOVE_FLYING)) |
2355 | { |
|
|
2356 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2367 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2357 | return 1; |
2368 | return 1; |
2358 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2369 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2359 | return 1; |
2370 | return 1; |
2360 | } |
2371 | |
2361 | return 0; |
2372 | return 0; |
2362 | } |
2373 | } |