… | |
… | |
57 | { |
57 | { |
58 | weight_move = op->weight + (op->weight * op->level) / 3; |
58 | weight_move = op->weight + (op->weight * op->level) / 3; |
59 | /*LOG (llevDebug, "DEBUG: arch weighs %d and masses %d (%s,level %d)\n", op->weight,weight_move,op->name,op->level); */ |
59 | /*LOG (llevDebug, "DEBUG: arch weighs %d and masses %d (%s,level %d)\n", op->weight,weight_move,op->name,op->level); */ |
60 | } |
60 | } |
61 | |
61 | |
62 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
62 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
63 | { |
63 | { |
64 | int num_sections = 1; |
64 | int num_sections = 1; |
65 | |
65 | |
66 | /* don't move DM */ |
66 | /* don't move DM */ |
67 | if (QUERY_FLAG (tmp, FLAG_WIZ)) |
67 | if (QUERY_FLAG (tmp, FLAG_WIZ)) |
… | |
… | |
280 | * we remove the magic flag - that can be derived from |
280 | * we remove the magic flag - that can be derived from |
281 | * spob->attacktype. |
281 | * spob->attacktype. |
282 | * This function sets up the appropriate owner and skill |
282 | * This function sets up the appropriate owner and skill |
283 | * pointers. |
283 | * pointers. |
284 | */ |
284 | */ |
285 | |
|
|
286 | int |
285 | int |
287 | fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) |
286 | fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) |
288 | { |
287 | { |
289 | object *tmp = NULL; |
288 | object *tmp = NULL; |
290 | int mflags; |
289 | int mflags; |
… | |
… | |
308 | |
307 | |
309 | tmp->direction = dir; |
308 | tmp->direction = dir; |
310 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
309 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
311 | SET_ANIMATION (tmp, dir); |
310 | SET_ANIMATION (tmp, dir); |
312 | |
311 | |
313 | set_owner (tmp, op); |
312 | tmp->set_owner (op); |
314 | set_spell_skill (op, caster, spob, tmp); |
313 | set_spell_skill (op, caster, spob, tmp); |
315 | |
314 | |
316 | tmp->x = op->x + DIRX (tmp); |
315 | tmp->x = op->x + DIRX (tmp); |
317 | tmp->y = op->y + DIRY (tmp); |
316 | tmp->y = op->y + DIRY (tmp); |
318 | tmp->map = op->map; |
317 | tmp->map = op->map; |
319 | |
318 | |
|
|
319 | maptile *newmap; |
320 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
320 | mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); |
321 | if (mflags & P_OUT_OF_MAP) |
321 | if (mflags & P_OUT_OF_MAP) |
322 | { |
322 | { |
323 | tmp->destroy (); |
323 | tmp->destroy (); |
324 | return 0; |
324 | return 0; |
325 | } |
325 | } |
|
|
326 | |
|
|
327 | tmp->map = newmap; |
326 | |
328 | |
327 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
329 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
328 | { |
330 | { |
329 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
331 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
330 | { |
332 | { |
… | |
… | |
455 | } |
457 | } |
456 | |
458 | |
457 | /* other_arch contains what this explodes into */ |
459 | /* other_arch contains what this explodes into */ |
458 | tmp = arch_to_object (op->other_arch); |
460 | tmp = arch_to_object (op->other_arch); |
459 | |
461 | |
460 | copy_owner (tmp, op); |
462 | tmp->set_owner (op); |
461 | tmp->skill = op->skill; |
463 | tmp->skill = op->skill; |
462 | |
464 | |
463 | owner = get_owner (op); |
465 | owner = op->owner; |
464 | |
466 | |
465 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
467 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
466 | { |
468 | { |
467 | op->destroy (); |
469 | op->destroy (); |
468 | return; |
470 | return; |
… | |
… | |
536 | |
538 | |
537 | /* If nothing alive on this space, no reason to do anything further */ |
539 | /* If nothing alive on this space, no reason to do anything further */ |
538 | if (!(mflags & P_IS_ALIVE)) |
540 | if (!(mflags & P_IS_ALIVE)) |
539 | return; |
541 | return; |
540 | |
542 | |
541 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
543 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
542 | { |
544 | { |
543 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
545 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
544 | { |
546 | { |
545 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
547 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
546 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
548 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
… | |
… | |
553 | } |
555 | } |
554 | } |
556 | } |
555 | } |
557 | } |
556 | } |
558 | } |
557 | |
559 | |
558 | |
|
|
559 | /* Basically, we move 'op' one square, and if it hits something, |
560 | /* Basically, we move 'op' one square, and if it hits something, |
560 | * call check_bullet. |
561 | * call check_bullet. |
561 | * This function is only applicable to bullets, but not to all |
562 | * This function is only applicable to bullets, but not to all |
562 | * fired arches (eg, bolts). |
563 | * fired arches (eg, bolts). |
563 | */ |
564 | */ |
564 | |
|
|
565 | void |
565 | void |
566 | move_bullet (object *op) |
566 | move_bullet (object *op) |
567 | { |
567 | { |
568 | sint16 new_x, new_y; |
568 | sint16 new_x, new_y; |
569 | int mflags; |
569 | int mflags; |
… | |
… | |
624 | { |
624 | { |
625 | op->direction = absdir (op->direction + 4); |
625 | op->direction = absdir (op->direction + 4); |
626 | update_turn_face (op); |
626 | update_turn_face (op); |
627 | } |
627 | } |
628 | else |
628 | else |
629 | { |
|
|
630 | check_bullet (op); |
629 | check_bullet (op); |
631 | } |
|
|
632 | } |
630 | } |
633 | |
631 | |
634 | |
632 | |
635 | |
633 | |
636 | |
634 | |
… | |
… | |
671 | |
669 | |
672 | tmp->direction = dir; |
670 | tmp->direction = dir; |
673 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
671 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
674 | SET_ANIMATION (tmp, dir); |
672 | SET_ANIMATION (tmp, dir); |
675 | |
673 | |
676 | set_owner (tmp, op); |
674 | tmp->set_owner (op); |
677 | set_spell_skill (op, caster, spob, tmp); |
675 | set_spell_skill (op, caster, spob, tmp); |
678 | |
676 | |
679 | tmp->x = op->x + freearr_x[dir]; |
677 | tmp->x = op->x + freearr_x[dir]; |
680 | tmp->y = op->y + freearr_y[dir]; |
678 | tmp->y = op->y + freearr_y[dir]; |
681 | tmp->map = op->map; |
679 | tmp->map = op->map; |
682 | |
680 | |
|
|
681 | maptile *newmap; |
683 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
682 | mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); |
684 | if (mflags & P_OUT_OF_MAP) |
683 | if (mflags & P_OUT_OF_MAP) |
685 | { |
684 | { |
686 | tmp->destroy (); |
685 | tmp->destroy (); |
687 | return 0; |
686 | return 0; |
688 | } |
687 | } |
|
|
688 | |
|
|
689 | tmp->map = newmap; |
689 | |
690 | |
690 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
691 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
691 | { |
692 | { |
692 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
693 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
693 | { |
694 | { |
… | |
… | |
699 | tmp->y = op->y; |
700 | tmp->y = op->y; |
700 | tmp->direction = absdir (tmp->direction + 4); |
701 | tmp->direction = absdir (tmp->direction + 4); |
701 | tmp->map = op->map; |
702 | tmp->map = op->map; |
702 | } |
703 | } |
703 | |
704 | |
704 | if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) |
705 | if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0))) |
705 | check_bullet (tmp); |
706 | check_bullet (tmp); |
706 | |
707 | |
707 | return 1; |
708 | return 1; |
708 | } |
709 | } |
709 | |
710 | |
… | |
… | |
724 | object *new_ob = arch_to_object (op->other_arch); |
725 | object *new_ob = arch_to_object (op->other_arch); |
725 | |
726 | |
726 | new_ob->x = op->x; |
727 | new_ob->x = op->x; |
727 | new_ob->y = op->y; |
728 | new_ob->y = op->y; |
728 | new_ob->level = op->level; |
729 | new_ob->level = op->level; |
729 | set_owner (new_ob, op->owner); |
730 | new_ob->set_owner (op->owner); |
730 | |
731 | |
731 | /* preserve skill ownership */ |
732 | /* preserve skill ownership */ |
732 | if (op->skill && op->skill != new_ob->skill) |
733 | if (op->skill && op->skill != new_ob->skill) |
733 | { |
734 | { |
734 | new_ob->skill = op->skill; |
735 | new_ob->skill = op->skill; |
… | |
… | |
763 | #if 0 |
764 | #if 0 |
764 | /* Disable this - enabling it makes monsters easier, as |
765 | /* Disable this - enabling it makes monsters easier, as |
765 | * when their cone dies when they die. |
766 | * when their cone dies when they die. |
766 | */ |
767 | */ |
767 | /* If no owner left, the spell dies out. */ |
768 | /* If no owner left, the spell dies out. */ |
768 | if (get_owner (op) == NULL) |
769 | if (op->owner == NULL) |
769 | { |
770 | { |
770 | op->destroy (); |
771 | op->destroy (); |
771 | return; |
772 | return; |
772 | } |
773 | } |
773 | #endif |
774 | #endif |
… | |
… | |
898 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
899 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
899 | continue; |
900 | continue; |
900 | |
901 | |
901 | success = 1; |
902 | success = 1; |
902 | tmp = arch_to_object (spell->other_arch); |
903 | tmp = arch_to_object (spell->other_arch); |
903 | set_owner (tmp, op); |
904 | tmp->set_owner (op); |
904 | set_spell_skill (op, caster, spell, tmp); |
905 | set_spell_skill (op, caster, spell, tmp); |
905 | tmp->level = caster_level (caster, spell); |
906 | tmp->level = caster_level (caster, spell); |
906 | tmp->x = sx; |
907 | tmp->x = sx; |
907 | tmp->y = sy; |
908 | tmp->y = sy; |
908 | tmp->attacktype = spell->attacktype; |
909 | tmp->attacktype = spell->attacktype; |
… | |
… | |
1030 | tmp->direction = i; |
1031 | tmp->direction = i; |
1031 | tmp->range = op->range; |
1032 | tmp->range = op->range; |
1032 | tmp->stats.dam = op->stats.dam; |
1033 | tmp->stats.dam = op->stats.dam; |
1033 | tmp->duration = op->duration; |
1034 | tmp->duration = op->duration; |
1034 | tmp->attacktype = op->attacktype; |
1035 | tmp->attacktype = op->attacktype; |
1035 | copy_owner (tmp, op); |
1036 | tmp->set_owner (op); |
1036 | if (op->skill && op->skill != tmp->skill) |
1037 | if (op->skill && op->skill != tmp->skill) |
1037 | { |
1038 | { |
1038 | tmp->skill = op->skill; |
1039 | tmp->skill = op->skill; |
1039 | } |
1040 | } |
1040 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
1041 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
… | |
… | |
1070 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1071 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1071 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1072 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1072 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
1073 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
1073 | tmp->attacktype = spell->attacktype; |
1074 | tmp->attacktype = spell->attacktype; |
1074 | |
1075 | |
1075 | set_owner (tmp, op); |
1076 | tmp->set_owner (op); |
1076 | set_spell_skill (op, caster, spell, tmp); |
1077 | set_spell_skill (op, caster, spell, tmp); |
1077 | tmp->x = dx; |
1078 | tmp->x = dx; |
1078 | tmp->y = dy; |
1079 | tmp->y = dy; |
1079 | insert_ob_in_map (tmp, m, op, 0); |
1080 | insert_ob_in_map (tmp, m, op, 0); |
1080 | return 1; |
1081 | return 1; |
… | |
… | |
1123 | if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW) |
1124 | if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW) |
1124 | return NULL; |
1125 | return NULL; |
1125 | |
1126 | |
1126 | if (mflags & P_IS_ALIVE) |
1127 | if (mflags & P_IS_ALIVE) |
1127 | { |
1128 | { |
1128 | for (target = get_map_ob (mp, x, y); target; target = target->above) |
1129 | for (target = GET_MAP_OB (mp, x, y); target; target = target->above) |
1129 | { |
1130 | { |
1130 | if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) |
1131 | if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) |
1131 | { |
1132 | { |
1132 | return target; |
1133 | return target; |
1133 | } |
1134 | } |
… | |
… | |
1200 | if (effect->attacktype & AT_DEATH) |
1201 | if (effect->attacktype & AT_DEATH) |
1201 | { |
1202 | { |
1202 | effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1203 | effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1203 | |
1204 | |
1204 | /* casting death spells at undead isn't a good thing */ |
1205 | /* casting death spells at undead isn't a good thing */ |
1205 | if QUERY_FLAG |
|
|
1206 | (target, FLAG_UNDEAD) |
1206 | if (QUERY_FLAG (target, FLAG_UNDEAD)) |
1207 | { |
1207 | { |
1208 | if (random_roll (0, 2, op, PREFER_LOW)) |
1208 | if (random_roll (0, 2, op, PREFER_LOW)) |
1209 | { |
1209 | { |
1210 | new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); |
1210 | new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); |
1211 | effect->x = op->x; |
1211 | effect->x = op->x; |
… | |
… | |
1224 | { |
1224 | { |
1225 | /* how much woe to inflict :) */ |
1225 | /* how much woe to inflict :) */ |
1226 | effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1226 | effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1227 | } |
1227 | } |
1228 | |
1228 | |
1229 | set_owner (effect, op); |
1229 | effect->set_owner (op); |
1230 | set_spell_skill (op, caster, spell, effect); |
1230 | set_spell_skill (op, caster, spell, effect); |
1231 | |
1231 | |
1232 | /* ok, tell it where to be, and insert! */ |
1232 | /* ok, tell it where to be, and insert! */ |
1233 | effect->x = target->x; |
1233 | effect->x = target->x; |
1234 | effect->y = target->y; |
1234 | effect->y = target->y; |
… | |
… | |
1258 | { |
1258 | { |
1259 | op->destroy (); |
1259 | op->destroy (); |
1260 | return; |
1260 | return; |
1261 | } |
1261 | } |
1262 | |
1262 | |
1263 | owner = get_owner (op); |
1263 | owner = op->owner; |
1264 | #if 0 |
1264 | #if 0 |
1265 | /* It'd make things nastier if this wasn't here - spells cast by |
1265 | /* It'd make things nastier if this wasn't here - spells cast by |
1266 | * monster that are then killed would continue to survive |
1266 | * monster that are then killed would continue to survive |
1267 | */ |
1267 | */ |
1268 | if (owner == NULL) |
1268 | if (owner == NULL) |
… | |
… | |
1298 | } |
1298 | } |
1299 | |
1299 | |
1300 | op->x = new_x; |
1300 | op->x = new_x; |
1301 | op->y = new_y; |
1301 | op->y = new_y; |
1302 | op->map = m; |
1302 | op->map = m; |
1303 | i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); |
1303 | i = spell_find_dir (op->map, op->x, op->y, op->owner); |
1304 | if (i > 0 && i != op->direction) |
1304 | if (i > 0 && i != op->direction) |
1305 | { |
1305 | { |
1306 | op->direction = i; |
1306 | op->direction = i; |
1307 | SET_ANIMATION (op, op->direction); |
1307 | SET_ANIMATION (op, op->direction); |
1308 | } |
1308 | } |
… | |
… | |
1398 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1398 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1399 | if (mflags & P_OUT_OF_MAP) |
1399 | if (mflags & P_OUT_OF_MAP) |
1400 | continue; |
1400 | continue; |
1401 | if (mflags & P_IS_ALIVE) |
1401 | if (mflags & P_IS_ALIVE) |
1402 | { |
1402 | { |
1403 | for (tmp = get_map_ob (m, sx, sy); tmp; tmp = tmp->above) |
1403 | for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) |
1404 | { |
1404 | { |
1405 | if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) |
1405 | if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) |
1406 | break; |
1406 | break; |
1407 | } |
1407 | } |
1408 | if (tmp) |
1408 | if (tmp) |
… | |
… | |
1531 | force->stats.ac = spell_ob->stats.ac; |
1531 | force->stats.ac = spell_ob->stats.ac; |
1532 | force->stats.wc = spell_ob->stats.wc; |
1532 | force->stats.wc = spell_ob->stats.wc; |
1533 | |
1533 | |
1534 | change_abil (tmp, force); /* Mostly to display any messages */ |
1534 | change_abil (tmp, force); /* Mostly to display any messages */ |
1535 | insert_ob_in_ob (force, tmp); |
1535 | insert_ob_in_ob (force, tmp); |
1536 | fix_player (tmp); |
1536 | tmp->update_stats (); |
1537 | return 1; |
1537 | return 1; |
1538 | |
1538 | |
1539 | } |
1539 | } |
1540 | |
1540 | |
1541 | |
1541 | |
… | |
… | |
1592 | |
1592 | |
1593 | /* If there is nothing living on this space, no need to go further */ |
1593 | /* If there is nothing living on this space, no need to go further */ |
1594 | if (!(mflags & P_IS_ALIVE)) |
1594 | if (!(mflags & P_IS_ALIVE)) |
1595 | continue; |
1595 | continue; |
1596 | |
1596 | |
1597 | for (tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) |
1597 | for (tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above) |
1598 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1598 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1599 | break; |
1599 | break; |
1600 | |
1600 | |
1601 | /* There can be living objects that are not monsters */ |
1601 | /* There can be living objects that are not monsters */ |
1602 | if (!tmp || tmp->type == PLAYER) |
1602 | if (!tmp || tmp->type == PLAYER) |
… | |
… | |
1690 | SET_FLAG (head, FLAG_FRIENDLY); |
1690 | SET_FLAG (head, FLAG_FRIENDLY); |
1691 | /* Prevent uncontolled outbreaks of self replicating monsters. |
1691 | /* Prevent uncontolled outbreaks of self replicating monsters. |
1692 | Typical use case is charm, go somwhere, use aggravation to make hostile. |
1692 | Typical use case is charm, go somwhere, use aggravation to make hostile. |
1693 | This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ |
1693 | This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ |
1694 | CLEAR_FLAG (head, FLAG_GENERATOR); |
1694 | CLEAR_FLAG (head, FLAG_GENERATOR); |
1695 | set_owner (head, op); |
1695 | head->set_owner (op); |
1696 | set_spell_skill (op, caster, spell, head); |
1696 | set_spell_skill (op, caster, spell, head); |
1697 | add_friendly_object (head); |
1697 | add_friendly_object (head); |
1698 | head->attack_movement = PETMOVE; |
1698 | head->attack_movement = PETMOVE; |
1699 | done_one = 1; |
1699 | done_one = 1; |
1700 | change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); |
1700 | change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); |
… | |
… | |
1728 | int i, j, dam_save, dir, mflags; |
1728 | int i, j, dam_save, dir, mflags; |
1729 | sint16 nx, ny, hx, hy; |
1729 | sint16 nx, ny, hx, hy; |
1730 | object *owner; |
1730 | object *owner; |
1731 | maptile *m; |
1731 | maptile *m; |
1732 | |
1732 | |
1733 | owner = get_owner (op); |
1733 | owner = op->owner; |
1734 | |
1734 | |
1735 | /* the following logic makes sure that the ball doesn't move into a wall, |
1735 | /* the following logic makes sure that the ball doesn't move into a wall, |
1736 | * and makes sure that it will move along a wall to try and get at it's |
1736 | * and makes sure that it will move along a wall to try and get at it's |
1737 | * victim. The block immediately below more or less chooses a random |
1737 | * victim. The block immediately below more or less chooses a random |
1738 | * offset to move the ball, eg, keep it mostly on course, with some |
1738 | * offset to move the ball, eg, keep it mostly on course, with some |
… | |
… | |
1817 | } |
1817 | } |
1818 | |
1818 | |
1819 | /* restore to the center location and damage */ |
1819 | /* restore to the center location and damage */ |
1820 | op->stats.dam = dam_save; |
1820 | op->stats.dam = dam_save; |
1821 | |
1821 | |
1822 | i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); |
1822 | i = spell_find_dir (op->map, op->x, op->y, op->owner); |
1823 | |
1823 | |
1824 | if (i >= 0) |
1824 | if (i >= 0) |
1825 | { /* we have a preferred direction! */ |
1825 | { /* we have a preferred direction! */ |
1826 | /* pick another direction if the preferred dir is blocked. */ |
1826 | /* pick another direction if the preferred dir is blocked. */ |
1827 | if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || |
1827 | if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || |
… | |
… | |
1853 | maptile *m; |
1853 | maptile *m; |
1854 | #endif |
1854 | #endif |
1855 | int basedir; |
1855 | int basedir; |
1856 | object *owner; |
1856 | object *owner; |
1857 | |
1857 | |
1858 | owner = get_owner (op); |
1858 | owner = op->owner; |
1859 | if (op->duration == 0 || owner == NULL) |
1859 | if (op->duration == 0 || owner == NULL) |
1860 | { |
1860 | { |
1861 | op->destroy (); |
1861 | op->destroy (); |
1862 | return; |
1862 | return; |
1863 | } |
1863 | } |
… | |
… | |
1968 | return 0; |
1968 | return 0; |
1969 | |
1969 | |
1970 | tmp = get_archetype (SWARM_SPELL); |
1970 | tmp = get_archetype (SWARM_SPELL); |
1971 | tmp->x = op->x; |
1971 | tmp->x = op->x; |
1972 | tmp->y = op->y; |
1972 | tmp->y = op->y; |
1973 | set_owner (tmp, op); /* needed so that if swarm elements kill, caster gets xp. */ |
1973 | tmp->set_owner (op); /* needed so that if swarm elements kill, caster gets xp. */ |
1974 | set_spell_skill (op, caster, spell, tmp); |
1974 | set_spell_skill (op, caster, spell, tmp); |
1975 | |
1975 | |
1976 | tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ |
1976 | tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ |
1977 | tmp->spell = arch_to_object (spell->other_arch); |
1977 | tmp->spell = arch_to_object (spell->other_arch); |
1978 | |
1978 | |
… | |
… | |
2025 | return 0; |
2025 | return 0; |
2026 | } |
2026 | } |
2027 | |
2027 | |
2028 | if (mflags & P_IS_ALIVE && spell->attacktype) |
2028 | if (mflags & P_IS_ALIVE && spell->attacktype) |
2029 | { |
2029 | { |
2030 | for (target = get_map_ob (m, x, y); target; target = target->above) |
2030 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
2031 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
2031 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
2032 | { |
2032 | { |
2033 | /* oky doky. got a target monster. Lets make a blinding attack */ |
2033 | /* oky doky. got a target monster. Lets make a blinding attack */ |
2034 | if (target->head) |
2034 | if (target->head) |
2035 | target = target->head; |
2035 | target = target->head; |
… | |
… | |
2117 | |
2117 | |
2118 | /* Only bother looking on this space if there is something living here */ |
2118 | /* Only bother looking on this space if there is something living here */ |
2119 | if (mflags & P_IS_ALIVE) |
2119 | if (mflags & P_IS_ALIVE) |
2120 | { |
2120 | { |
2121 | /* search this square for a victim */ |
2121 | /* search this square for a victim */ |
2122 | for (walk = get_map_ob (m, x, y); walk; walk = walk->above) |
2122 | for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above) |
2123 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
2123 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
2124 | { /* found a victim */ |
2124 | { /* found a victim */ |
2125 | object *disease = arch_to_object (spell->other_arch); |
2125 | object *disease = arch_to_object (spell->other_arch); |
2126 | |
2126 | |
2127 | set_owner (disease, op); |
2127 | disease->set_owner (op); |
2128 | set_spell_skill (op, caster, spell, disease); |
2128 | set_spell_skill (op, caster, spell, disease); |
2129 | disease->stats.exp = 0; |
2129 | disease->stats.exp = 0; |
2130 | disease->level = caster_level (caster, spell); |
2130 | disease->level = caster_level (caster, spell); |
2131 | |
2131 | |
2132 | /* do level adjustments */ |
2132 | /* do level adjustments */ |