… | |
… | |
20 | |
20 | |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #ifndef __CEXTRACT__ |
|
|
26 | # include <sproto.h> |
25 | #include <sproto.h> |
27 | #endif |
|
|
28 | |
26 | |
29 | /* given that 'pet' is a friendly object, this function returns a |
27 | /* given that 'pet' is a friendly object, this function returns a |
30 | * monster the pet should attack, NULL if nothing appropriate is |
28 | * monster the pet should attack, NULL if nothing appropriate is |
31 | * found. it basically looks for nasty things around the owner |
29 | * found. it basically looks for nasty things around the owner |
32 | * of the pet to attack. |
30 | * of the pet to attack. |
33 | * this is now tilemap aware. |
31 | * this is now tilemap aware. |
34 | */ |
32 | */ |
35 | |
|
|
36 | object * |
33 | object * |
37 | get_pet_enemy (object *pet, rv_vector * rv) |
34 | get_pet_enemy (object *pet, rv_vector * rv) |
38 | { |
35 | { |
39 | object *owner, *tmp, *attacker, *tmp3; |
36 | object *owner, *tmp, *attacker, *tmp3; |
40 | int i; |
37 | int i; |
41 | sint16 x, y; |
38 | sint16 x, y; |
42 | mapstruct *nm; |
39 | maptile *nm; |
43 | int search_arr[SIZEOFFREE]; |
40 | int search_arr[SIZEOFFREE]; |
44 | int mflags; |
41 | int mflags; |
45 | |
42 | |
46 | attacker = pet->attacked_by; /*pointer to attacking enemy */ |
43 | attacker = pet->attacked_by; /*pointer to attacking enemy */ |
47 | pet->attacked_by = NULL; /*clear this, since we are dealing with it */ |
44 | pet->attacked_by = NULL; /*clear this, since we are dealing with it */ |
48 | |
45 | |
49 | if ((owner = get_owner (pet)) != NULL) |
46 | if ((owner = pet->owner) != NULL) |
50 | { |
47 | { |
51 | /* If the owner has turned on the pet, make the pet |
48 | /* If the owner has turned on the pet, make the pet |
52 | * unfriendly. |
49 | * unfriendly. |
53 | */ |
50 | */ |
54 | if ((check_enemy (owner, rv)) == pet) |
51 | if ((check_enemy (owner, rv)) == pet) |
… | |
… | |
117 | nm = owner->map; |
114 | nm = owner->map; |
118 | /* Only look on the space if there is something alive there. */ |
115 | /* Only look on the space if there is something alive there. */ |
119 | mflags = get_map_flags (nm, &nm, x, y, &x, &y); |
116 | mflags = get_map_flags (nm, &nm, x, y, &x, &y); |
120 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
117 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
121 | { |
118 | { |
122 | for (tmp = get_map_ob (nm, x, y); tmp != NULL; tmp = tmp->above) |
119 | for (tmp = GET_MAP_OB (nm, x, y); tmp != NULL; tmp = tmp->above) |
123 | { |
120 | { |
124 | object *tmp2 = tmp->head == NULL ? tmp : tmp->head; |
121 | object *tmp2 = tmp->head == NULL ? tmp : tmp->head; |
125 | |
122 | |
126 | if (QUERY_FLAG (tmp2, FLAG_ALIVE) && ((!QUERY_FLAG (tmp2, FLAG_FRIENDLY) && |
123 | if (QUERY_FLAG (tmp2, FLAG_ALIVE) && ((!QUERY_FLAG (tmp2, FLAG_FRIENDLY) && |
127 | (tmp2->type != PLAYER)) || |
124 | (tmp2->type != PLAYER)) || |
… | |
… | |
189 | nm = pet->map; |
186 | nm = pet->map; |
190 | /* Only look on the space if there is something alive there. */ |
187 | /* Only look on the space if there is something alive there. */ |
191 | mflags = get_map_flags (nm, &nm, x, y, &x, &y); |
188 | mflags = get_map_flags (nm, &nm, x, y, &x, &y); |
192 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
189 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
193 | { |
190 | { |
194 | for (tmp = get_map_ob (nm, x, y); tmp != NULL; tmp = tmp->above) |
191 | for (tmp = GET_MAP_OB (nm, x, y); tmp != NULL; tmp = tmp->above) |
195 | { |
192 | { |
196 | object *tmp2 = tmp->head == NULL ? tmp : tmp->head; |
193 | object *tmp2 = tmp->head == NULL ? tmp : tmp->head; |
197 | |
194 | |
198 | if (QUERY_FLAG (tmp2, FLAG_ALIVE) && ((!QUERY_FLAG (tmp2, FLAG_FRIENDLY) && |
195 | if (QUERY_FLAG (tmp2, FLAG_ALIVE) && ((!QUERY_FLAG (tmp2, FLAG_FRIENDLY) && |
199 | (tmp2->type != PLAYER)) || |
196 | (tmp2->type != PLAYER)) || |
… | |
… | |
243 | for (obl = first_friendly_object; obl != NULL; obl = next) |
240 | for (obl = first_friendly_object; obl != NULL; obl = next) |
244 | { |
241 | { |
245 | object *ob = obl->ob; |
242 | object *ob = obl->ob; |
246 | |
243 | |
247 | next = obl->next; |
244 | next = obl->next; |
248 | if (get_owner (ob) == owner) |
245 | if (ob->owner == owner) |
249 | { |
246 | { |
250 | if (!QUERY_FLAG (ob, FLAG_REMOVED)) |
247 | if (!QUERY_FLAG (ob, FLAG_REMOVED)) |
251 | remove_ob (ob); |
248 | ob->remove (); |
252 | remove_friendly_object (ob); |
249 | remove_friendly_object (ob); |
253 | free_object (ob); |
250 | ob->destroy (); |
254 | } |
251 | } |
255 | } |
252 | } |
256 | } |
253 | } |
257 | |
254 | |
258 | /* |
255 | /* |
… | |
… | |
263 | * Interesting enough, we don't use the passed map structure in |
260 | * Interesting enough, we don't use the passed map structure in |
264 | * this function. |
261 | * this function. |
265 | */ |
262 | */ |
266 | |
263 | |
267 | void |
264 | void |
268 | remove_all_pets (mapstruct *map) |
265 | remove_all_pets (maptile *map) |
269 | { |
266 | { |
270 | objectlink *obl, *next; |
267 | objectlink *obl, *next; |
271 | object *owner; |
268 | object *owner; |
272 | |
269 | |
273 | for (obl = first_friendly_object; obl != NULL; obl = next) |
270 | for (obl = first_friendly_object; obl != NULL; obl = next) |
274 | { |
271 | { |
275 | next = obl->next; |
272 | next = obl->next; |
276 | if (obl->ob->type != PLAYER && QUERY_FLAG (obl->ob, FLAG_FRIENDLY) && |
273 | if (obl->ob->type != PLAYER && QUERY_FLAG (obl->ob, FLAG_FRIENDLY) && |
277 | (owner = get_owner (obl->ob)) != NULL && !on_same_map (owner, obl->ob)) |
274 | (owner = obl->ob->owner) != NULL && !on_same_map (owner, obl->ob)) |
278 | { |
275 | { |
279 | /* follow owner checks map status for us */ |
276 | /* follow owner checks map status for us */ |
280 | follow_owner (obl->ob, owner); |
277 | follow_owner (obl->ob, owner); |
281 | } |
278 | } |
282 | } |
279 | } |
… | |
… | |
287 | { |
284 | { |
288 | object *tmp; |
285 | object *tmp; |
289 | int dir; |
286 | int dir; |
290 | |
287 | |
291 | if (!QUERY_FLAG (ob, FLAG_REMOVED)) |
288 | if (!QUERY_FLAG (ob, FLAG_REMOVED)) |
292 | remove_ob (ob); |
289 | ob->remove (); |
293 | |
290 | |
294 | if (owner->map == NULL) |
291 | if (owner->map == NULL) |
295 | { |
292 | { |
296 | LOG (llevError, "Can't follow owner (%d): no map.\n", &owner->name); |
293 | LOG (llevError, "Can't follow owner (%d): no map.\n", &owner->name); |
297 | goto fail; |
294 | goto fail; |
… | |
… | |
325 | |
322 | |
326 | return 0; |
323 | return 0; |
327 | |
324 | |
328 | fail: |
325 | fail: |
329 | remove_friendly_object (ob); |
326 | remove_friendly_object (ob); |
330 | free_object (ob); |
327 | ob->destroy (); |
331 | |
328 | |
332 | return 1; |
329 | return 1; |
333 | } |
330 | } |
334 | |
331 | |
335 | void |
332 | void |
336 | pet_move (object *ob) |
333 | pet_move (object *ob) |
337 | { |
334 | { |
338 | int dir, tag, i; |
335 | int dir, i; |
339 | sint16 dx, dy; |
336 | sint16 dx, dy; |
340 | object *ob2, *owner; |
337 | object *ob2, *owner; |
341 | mapstruct *m; |
338 | maptile *m; |
342 | |
339 | |
343 | /* Check to see if player pulled out */ |
340 | /* Check to see if player pulled out */ |
344 | if ((owner = get_owner (ob)) == NULL) |
341 | if ((owner = ob->owner) == NULL) |
345 | { |
342 | { |
346 | remove_ob (ob); /* Will be freed when returning */ |
343 | ob->remove (); /* Will be freed when returning */ |
347 | remove_friendly_object (ob); |
344 | remove_friendly_object (ob); |
348 | free_object (ob); |
345 | ob->destroy (); |
349 | LOG (llevMonster, "Pet: no owner, leaving.\n"); |
346 | LOG (llevMonster, "Pet: no owner, leaving.\n"); |
350 | return; |
347 | return; |
351 | } |
348 | } |
352 | |
349 | |
353 | /* move monster into the owners map if not in the same map */ |
350 | /* move monster into the owners map if not in the same map */ |
… | |
… | |
381 | get_rangevector (ob, ob->owner, &rv, 0); |
378 | get_rangevector (ob, ob->owner, &rv, 0); |
382 | dir = rv.direction; |
379 | dir = rv.direction; |
383 | } |
380 | } |
384 | ob->direction = dir; |
381 | ob->direction = dir; |
385 | |
382 | |
386 | tag = ob->count; |
|
|
387 | /* move_ob returns 0 if the object couldn't move. If that is the |
383 | /* move_ob returns 0 if the object couldn't move. If that is the |
388 | * case, lets do some other work. |
384 | * case, lets do some other work. |
389 | */ |
385 | */ |
390 | if (!(move_ob (ob, dir, ob))) |
386 | if (!(move_ob (ob, dir, ob))) |
391 | { |
387 | { |
392 | object *part; |
388 | object *part; |
393 | |
389 | |
394 | /* the failed move_ob above may destroy the pet, so check here */ |
390 | /* the failed move_ob above may destroy the pet, so check here */ |
395 | if (was_destroyed (ob, tag)) |
391 | if (ob->destroyed ()) |
396 | return; |
392 | return; |
397 | |
393 | |
398 | for (part = ob; part != NULL; part = part->more) |
394 | for (part = ob; part != NULL; part = part->more) |
399 | { |
395 | { |
400 | dx = part->x + freearr_x[dir]; |
396 | dx = part->x + freearr_x[dir]; |
401 | dy = part->y + freearr_y[dir]; |
397 | dy = part->y + freearr_y[dir]; |
402 | m = get_map_from_coord (part->map, &dx, &dy); |
398 | m = get_map_from_coord (part->map, &dx, &dy); |
403 | if (!m) |
399 | if (!m) |
404 | continue; |
400 | continue; |
405 | |
401 | |
406 | for (ob2 = get_map_ob (m, dx, dy); ob2 != NULL; ob2 = ob2->above) |
402 | for (ob2 = GET_MAP_OB (m, dx, dy); ob2 != NULL; ob2 = ob2->above) |
407 | { |
403 | { |
408 | object *new_ob; |
404 | object *new_ob; |
409 | |
405 | |
410 | new_ob = ob2->head ? ob2->head : ob2; |
406 | new_ob = ob2->head ? ob2->head : ob2; |
411 | if (new_ob == ob) |
407 | if (new_ob == ob) |
412 | break; |
408 | break; |
413 | if (new_ob == ob->owner) |
409 | if (new_ob == ob->owner) |
414 | return; |
410 | return; |
415 | if (get_owner (new_ob) == ob->owner) |
411 | if (new_ob->owner == ob->owner) |
416 | break; |
412 | break; |
417 | |
413 | |
418 | /* Hmm. Did we try to move into an enemy monster? If so, |
414 | /* Hmm. Did we try to move into an enemy monster? If so, |
419 | * make it our enemy. |
415 | * make it our enemy. |
420 | */ |
416 | */ |
… | |
… | |
464 | tmp = arch_to_object (atmp); |
460 | tmp = arch_to_object (atmp); |
465 | if (atmp == at) |
461 | if (atmp == at) |
466 | { |
462 | { |
467 | if (!is_golem) |
463 | if (!is_golem) |
468 | SET_FLAG (tmp, FLAG_MONSTER); |
464 | SET_FLAG (tmp, FLAG_MONSTER); |
469 | set_owner (tmp, op); |
465 | tmp->set_owner (op); |
470 | if (op->type == PLAYER) |
466 | if (op->type == PLAYER) |
471 | { |
467 | { |
472 | tmp->stats.exp = 0; |
468 | tmp->stats.exp = 0; |
473 | add_friendly_object (tmp); |
469 | add_friendly_object (tmp); |
474 | SET_FLAG (tmp, FLAG_FRIENDLY); |
470 | SET_FLAG (tmp, FLAG_FRIENDLY); |
… | |
… | |
477 | } |
473 | } |
478 | else |
474 | else |
479 | { |
475 | { |
480 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
476 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
481 | { |
477 | { |
482 | object *owner = get_owner (op); |
478 | object *owner = op->owner; |
483 | |
479 | |
484 | if (owner != NULL) |
480 | if (owner != NULL) |
485 | { /* For now, we transfer ownership */ |
481 | { /* For now, we transfer ownership */ |
486 | set_owner (tmp, owner); |
482 | tmp->set_owner (owner); |
487 | tmp->attack_movement = PETMOVE; |
483 | tmp->attack_movement = PETMOVE; |
488 | add_friendly_object (tmp); |
484 | add_friendly_object (tmp); |
489 | SET_FLAG (tmp, FLAG_FRIENDLY); |
485 | SET_FLAG (tmp, FLAG_FRIENDLY); |
490 | } |
486 | } |
491 | } |
487 | } |
… | |
… | |
538 | void |
534 | void |
539 | move_golem (object *op) |
535 | move_golem (object *op) |
540 | { |
536 | { |
541 | int made_attack = 0; |
537 | int made_attack = 0; |
542 | object *tmp; |
538 | object *tmp; |
543 | tag_t tag; |
|
|
544 | |
539 | |
545 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
540 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
546 | return; /* Has already been moved */ |
541 | return; /* Has already been moved */ |
547 | |
542 | |
548 | if (get_owner (op) == NULL) |
543 | if (op->owner == NULL) |
549 | { |
544 | { |
550 | LOG (llevDebug, "Golem without owner destructed.\n"); |
545 | LOG (llevDebug, "Golem without owner destructed.\n"); |
551 | remove_ob (op); |
546 | op->remove (); |
552 | free_object (op); |
547 | op->destroy (); |
553 | return; |
548 | return; |
554 | } |
549 | } |
|
|
550 | |
555 | /* It would be nice to have a cleaner way of what message to print |
551 | /* It would be nice to have a cleaner way of what message to print |
556 | * when the golem expires than these hard coded entries. |
552 | * when the golem expires than these hard coded entries. |
557 | * Note it is intentional that a golems duration is based on its |
553 | * Note it is intentional that a golems duration is based on its |
558 | * hp, and not duration |
554 | * hp, and not duration |
559 | */ |
555 | */ |
560 | if (--op->stats.hp < 0) |
556 | if (--op->stats.hp < 0) |
561 | { |
557 | { |
562 | if (op->msg) |
558 | if (op->msg) |
563 | new_draw_info (NDI_UNIQUE, 0, op->owner, op->msg); |
559 | new_draw_info (NDI_UNIQUE, 0, op->owner, op->msg); |
|
|
560 | |
564 | op->owner->contr->ranges[range_golem] = NULL; |
561 | op->owner->contr->ranges[range_golem] = 0; |
565 | op->owner->contr->golem_count = 0; |
|
|
566 | remove_friendly_object (op); |
562 | remove_friendly_object (op); |
567 | remove_ob (op); |
563 | op->remove (); |
568 | free_object (op); |
564 | op->destroy (); |
569 | return; |
565 | return; |
570 | } |
566 | } |
571 | |
567 | |
572 | /* Do golem attacks/movement for single & multisq golems. |
568 | /* Do golem attacks/movement for single & multisq golems. |
573 | * Assuming here that op is the 'head' object. Pass only op to |
569 | * Assuming here that op is the 'head' object. Pass only op to |
574 | * move_ob (makes recursive calls to other parts) |
570 | * move_ob (makes recursive calls to other parts) |
575 | * move_ob returns 0 if the creature was not able to move. |
571 | * move_ob returns 0 if the creature was not able to move. |
576 | */ |
572 | */ |
577 | tag = op->count; |
|
|
578 | if (move_ob (op, op->direction, op)) |
573 | if (move_ob (op, op->direction, op)) |
579 | return; |
574 | return; |
580 | if (was_destroyed (op, tag)) |
575 | |
|
|
576 | if (op->destroyed ()) |
581 | return; |
577 | return; |
582 | |
578 | |
583 | for (tmp = op; tmp; tmp = tmp->more) |
579 | for (tmp = op; tmp; tmp = tmp->more) |
584 | { |
580 | { |
585 | sint16 x = tmp->x + freearr_x[op->direction], y = tmp->y + freearr_y[op->direction]; |
581 | sint16 x = tmp->x + freearr_x[op->direction], y = tmp->y + freearr_y[op->direction]; |
586 | object *victim; |
582 | object *victim; |
587 | mapstruct *m; |
583 | maptile *m; |
588 | int mflags; |
584 | int mflags; |
589 | |
585 | |
590 | m = op->map; |
586 | m = op->map; |
591 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
587 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
592 | |
588 | |
593 | if (mflags & P_OUT_OF_MAP) |
589 | if (mflags & P_OUT_OF_MAP) |
594 | continue; |
590 | continue; |
595 | |
591 | |
596 | for (victim = get_map_ob (op->map, x, y); victim; victim = victim->above) |
592 | for (victim = GET_MAP_OB (op->map, x, y); victim; victim = victim->above) |
597 | if (QUERY_FLAG (victim, FLAG_ALIVE)) |
593 | if (QUERY_FLAG (victim, FLAG_ALIVE)) |
598 | break; |
594 | break; |
599 | |
595 | |
600 | /* We used to call will_hit_self to make sure we don't |
596 | /* We used to call will_hit_self to make sure we don't |
601 | * hit ourselves, but that didn't work, and I don't really |
597 | * hit ourselves, but that didn't work, and I don't really |
… | |
… | |
657 | char buf[MAX_BUF]; |
653 | char buf[MAX_BUF]; |
658 | |
654 | |
659 | /* Because there can be different golem spells, player may want to |
655 | /* Because there can be different golem spells, player may want to |
660 | * 'lose' their old golem. |
656 | * 'lose' their old golem. |
661 | */ |
657 | */ |
662 | if (op->type == PLAYER && op->contr->ranges[range_golem] != NULL && op->contr->golem_count == op->contr->ranges[range_golem]->count) |
658 | if (op->type == PLAYER && op->contr->ranges[range_golem]) |
663 | { |
659 | { |
664 | new_draw_info (NDI_UNIQUE, 0, op, "You dismiss your existing golem."); |
660 | new_draw_info (NDI_UNIQUE, 0, op, "You dismiss your existing golem."); |
665 | remove_ob (op->contr->ranges[range_golem]); |
661 | op->contr->ranges[range_golem]->remove (); |
666 | free_object (op->contr->ranges[range_golem]); |
662 | op->contr->ranges[range_golem]->destroy (); |
667 | op->contr->ranges[range_golem] = NULL; |
663 | op->contr->ranges[range_golem] = 0; |
668 | op->contr->golem_count = (uint32) - 1; |
|
|
669 | } |
664 | } |
670 | |
665 | |
671 | if (spob->other_arch) |
666 | if (spob->other_arch) |
672 | at = spob->other_arch; |
667 | at = spob->other_arch; |
673 | else if (spob->race) |
668 | else if (spob->race) |
… | |
… | |
711 | } |
706 | } |
712 | |
707 | |
713 | if (op->type == PLAYER) |
708 | if (op->type == PLAYER) |
714 | { |
709 | { |
715 | tmp->type = GOLEM; |
710 | tmp->type = GOLEM; |
716 | set_owner (tmp, op); |
711 | tmp->set_owner (op); |
717 | set_spell_skill (op, caster, spob, tmp); |
712 | set_spell_skill (op, caster, spob, tmp); |
718 | op->contr->ranges[range_golem] = tmp; |
713 | op->contr->ranges[range_golem] = tmp; |
719 | op->contr->golem_count = tmp->count; |
|
|
720 | /* give the player control of the golem */ |
714 | /* give the player control of the golem */ |
721 | op->contr->shoottype = range_golem; |
715 | op->contr->shoottype = range_golem; |
722 | } |
716 | } |
723 | else |
717 | else |
724 | { |
718 | { |
725 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
719 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
726 | { |
720 | { |
727 | object *owner = get_owner (op); |
721 | object *owner = op->owner; |
728 | |
722 | |
729 | if (owner != NULL) |
723 | if (owner != NULL) |
730 | { /* For now, we transfer ownership */ |
724 | { /* For now, we transfer ownership */ |
731 | set_owner (tmp, owner); |
725 | tmp->set_owner (owner); |
732 | tmp->attack_movement = PETMOVE; |
726 | tmp->attack_movement = PETMOVE; |
733 | add_friendly_object (tmp); |
727 | add_friendly_object (tmp); |
734 | SET_FLAG (tmp, FLAG_FRIENDLY); |
728 | SET_FLAG (tmp, FLAG_FRIENDLY); |
735 | } |
729 | } |
736 | } |
730 | } |
… | |
… | |
935 | else if (spell_ob->race && !strcmp (spell_ob->race, "GODCULTMON")) |
929 | else if (spell_ob->race && !strcmp (spell_ob->race, "GODCULTMON")) |
936 | { |
930 | { |
937 | object *god = find_god (determine_god (op)), *mon, *owner; |
931 | object *god = find_god (determine_god (op)), *mon, *owner; |
938 | int summon_level, tries; |
932 | int summon_level, tries; |
939 | |
933 | |
940 | if (!god && ((owner = get_owner (op)) != NULL)) |
934 | if (!god && ((owner = op->owner) != NULL)) |
941 | god = find_god (determine_god (owner)); |
935 | god = find_god (determine_god (owner)); |
942 | |
936 | |
943 | /* If we can't find a god, can't get what monster to summon */ |
937 | /* If we can't find a god, can't get what monster to summon */ |
944 | if (!god) |
938 | if (!god) |
945 | return 0; |
939 | return 0; |
… | |
… | |
1034 | tmp = arch_to_object (atmp); |
1028 | tmp = arch_to_object (atmp); |
1035 | if (atmp == summon_arch) |
1029 | if (atmp == summon_arch) |
1036 | { |
1030 | { |
1037 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1031 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1038 | { |
1032 | { |
1039 | set_owner (tmp, op); |
1033 | tmp->set_owner (op); |
1040 | set_spell_skill (op, caster, spell_ob, tmp); |
1034 | set_spell_skill (op, caster, spell_ob, tmp); |
1041 | tmp->enemy = op->enemy; |
1035 | tmp->enemy = op->enemy; |
1042 | tmp->type = 0; |
1036 | tmp->type = 0; |
1043 | CLEAR_FLAG (tmp, FLAG_SLEEP); |
1037 | CLEAR_FLAG (tmp, FLAG_SLEEP); |
1044 | |
1038 | |
… | |
… | |
1052 | tmp->stats.exp = 0; |
1046 | tmp->stats.exp = 0; |
1053 | |
1047 | |
1054 | if (spell_ob->attack_movement) |
1048 | if (spell_ob->attack_movement) |
1055 | tmp->attack_movement = spell_ob->attack_movement; |
1049 | tmp->attack_movement = spell_ob->attack_movement; |
1056 | |
1050 | |
1057 | if (get_owner (op)) |
1051 | if (op->owner) |
1058 | set_owner (tmp, get_owner (op)); |
1052 | tmp->set_owner (op->owner); |
1059 | } |
1053 | } |
1060 | } |
1054 | } |
1061 | } |
1055 | } |
1062 | |
1056 | |
1063 | if (tmp->speed > MIN_ACTIVE_SPEED) |
1057 | if (tmp->speed > MIN_ACTIVE_SPEED) |
… | |
… | |
1104 | object *realowner = ob; |
1098 | object *realowner = ob; |
1105 | |
1099 | |
1106 | if (realowner == NULL) |
1100 | if (realowner == NULL) |
1107 | return NULL; |
1101 | return NULL; |
1108 | |
1102 | |
1109 | while (get_owner (realowner) != NULL) |
1103 | while (realowner->owner != NULL) |
1110 | { |
1104 | { |
1111 | realowner = get_owner (realowner); |
1105 | realowner = realowner->owner; |
1112 | } |
1106 | } |
1113 | return realowner; |
1107 | return realowner; |
1114 | } |
1108 | } |
1115 | |
1109 | |
1116 | /* determines if checks so pets don't attack players or other pets should be |
1110 | /* determines if checks so pets don't attack players or other pets should be |