… | |
… | |
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)) |
… | |
… | |
140 | |
140 | |
141 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
141 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
142 | return; |
142 | return; |
143 | |
143 | |
144 | /* OK, we made a fork */ |
144 | /* OK, we made a fork */ |
145 | new_bolt = object::create (); |
145 | new_bolt = tmp->clone (); |
146 | tmp->copy_to (new_bolt); |
|
|
147 | |
146 | |
148 | /* reduce chances of subsequent forking */ |
147 | /* reduce chances of subsequent forking */ |
149 | new_bolt->stats.Dex -= 10; |
148 | new_bolt->stats.Dex -= 10; |
150 | tmp->stats.Dex -= 10; /* less forks from main bolt too */ |
149 | tmp->stats.Dex -= 10; /* less forks from main bolt too */ |
151 | new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ |
150 | new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ |
… | |
… | |
249 | update_turn_face (op); /* A bolt *must* be IS_TURNABLE */ |
248 | update_turn_face (op); /* A bolt *must* be IS_TURNABLE */ |
250 | return; |
249 | return; |
251 | } |
250 | } |
252 | else |
251 | else |
253 | { /* Create a copy of this object and put it ahead */ |
252 | { /* Create a copy of this object and put it ahead */ |
254 | tmp = object::create (); |
253 | tmp = op->clone (); |
255 | op->copy_to (tmp); |
254 | |
256 | tmp->speed_left = -0.1; |
255 | tmp->speed_left = -0.1; |
257 | tmp->x += DIRX (tmp), tmp->y += DIRY (tmp); |
256 | tmp->x += DIRX (tmp), tmp->y += DIRY (tmp); |
258 | tmp = insert_ob_in_map (tmp, op->map, op, 0); |
257 | tmp = insert_ob_in_map (tmp, op->map, op, 0); |
259 | /* To make up for the decrease at the top of the function */ |
258 | /* To make up for the decrease at the top of the function */ |
260 | tmp->duration++; |
259 | tmp->duration++; |
… | |
… | |
309 | |
308 | |
310 | tmp->direction = dir; |
309 | tmp->direction = dir; |
311 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
310 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
312 | SET_ANIMATION (tmp, dir); |
311 | SET_ANIMATION (tmp, dir); |
313 | |
312 | |
314 | set_owner (tmp, op); |
313 | tmp->set_owner (op); |
315 | set_spell_skill (op, caster, spob, tmp); |
314 | set_spell_skill (op, caster, spob, tmp); |
316 | |
315 | |
317 | tmp->x = op->x + DIRX (tmp); |
316 | tmp->x = op->x + DIRX (tmp); |
318 | tmp->y = op->y + DIRY (tmp); |
317 | tmp->y = op->y + DIRY (tmp); |
319 | tmp->map = op->map; |
318 | tmp->map = op->map; |
… | |
… | |
383 | /* ok_to_put_more already does things like checks for walls, |
382 | /* ok_to_put_more already does things like checks for walls, |
384 | * out of map, etc. |
383 | * out of map, etc. |
385 | */ |
384 | */ |
386 | if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) |
385 | if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) |
387 | { |
386 | { |
388 | tmp = object::create (); |
387 | tmp = op->clone (); |
389 | op->copy_to (tmp); |
|
|
390 | tmp->state = 0; |
388 | tmp->state = 0; |
391 | tmp->speed_left = -0.21; |
389 | tmp->speed_left = -0.21; |
392 | tmp->range--; |
390 | tmp->range--; |
393 | tmp->value = 0; |
391 | tmp->value = 0; |
394 | tmp->x = dx; |
392 | tmp->x = dx; |
… | |
… | |
457 | } |
455 | } |
458 | |
456 | |
459 | /* other_arch contains what this explodes into */ |
457 | /* other_arch contains what this explodes into */ |
460 | tmp = arch_to_object (op->other_arch); |
458 | tmp = arch_to_object (op->other_arch); |
461 | |
459 | |
462 | copy_owner (tmp, op); |
460 | tmp->set_owner (op); |
463 | tmp->skill = op->skill; |
461 | tmp->skill = op->skill; |
464 | |
462 | |
465 | owner = get_owner (op); |
463 | owner = op->owner; |
466 | |
464 | |
467 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
465 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
468 | { |
466 | { |
469 | op->destroy (); |
467 | op->destroy (); |
470 | return; |
468 | return; |
… | |
… | |
538 | |
536 | |
539 | /* If nothing alive on this space, no reason to do anything further */ |
537 | /* If nothing alive on this space, no reason to do anything further */ |
540 | if (!(mflags & P_IS_ALIVE)) |
538 | if (!(mflags & P_IS_ALIVE)) |
541 | return; |
539 | return; |
542 | |
540 | |
543 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
541 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
544 | { |
542 | { |
545 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
543 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
546 | { |
544 | { |
547 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
545 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
548 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
546 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
… | |
… | |
673 | |
671 | |
674 | tmp->direction = dir; |
672 | tmp->direction = dir; |
675 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
673 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
676 | SET_ANIMATION (tmp, dir); |
674 | SET_ANIMATION (tmp, dir); |
677 | |
675 | |
678 | set_owner (tmp, op); |
676 | tmp->set_owner (op); |
679 | set_spell_skill (op, caster, spob, tmp); |
677 | set_spell_skill (op, caster, spob, tmp); |
680 | |
678 | |
681 | tmp->x = op->x + freearr_x[dir]; |
679 | tmp->x = op->x + freearr_x[dir]; |
682 | tmp->y = op->y + freearr_y[dir]; |
680 | tmp->y = op->y + freearr_y[dir]; |
683 | tmp->map = op->map; |
681 | tmp->map = op->map; |
… | |
… | |
726 | object *new_ob = arch_to_object (op->other_arch); |
724 | object *new_ob = arch_to_object (op->other_arch); |
727 | |
725 | |
728 | new_ob->x = op->x; |
726 | new_ob->x = op->x; |
729 | new_ob->y = op->y; |
727 | new_ob->y = op->y; |
730 | new_ob->level = op->level; |
728 | new_ob->level = op->level; |
731 | set_owner (new_ob, op->owner); |
729 | new_ob->set_owner (op->owner); |
732 | |
730 | |
733 | /* preserve skill ownership */ |
731 | /* preserve skill ownership */ |
734 | if (op->skill && op->skill != new_ob->skill) |
732 | if (op->skill && op->skill != new_ob->skill) |
735 | { |
733 | { |
736 | new_ob->skill = op->skill; |
734 | new_ob->skill = op->skill; |
… | |
… | |
765 | #if 0 |
763 | #if 0 |
766 | /* Disable this - enabling it makes monsters easier, as |
764 | /* Disable this - enabling it makes monsters easier, as |
767 | * when their cone dies when they die. |
765 | * when their cone dies when they die. |
768 | */ |
766 | */ |
769 | /* If no owner left, the spell dies out. */ |
767 | /* If no owner left, the spell dies out. */ |
770 | if (get_owner (op) == NULL) |
768 | if (op->owner == NULL) |
771 | { |
769 | { |
772 | op->destroy (); |
770 | op->destroy (); |
773 | return; |
771 | return; |
774 | } |
772 | } |
775 | #endif |
773 | #endif |
… | |
… | |
805 | { |
803 | { |
806 | sint16 x = op->x + freearr_x[absdir (op->stats.sp + i)], y = op->y + freearr_y[absdir (op->stats.sp + i)]; |
804 | sint16 x = op->x + freearr_x[absdir (op->stats.sp + i)], y = op->y + freearr_y[absdir (op->stats.sp + i)]; |
807 | |
805 | |
808 | if (ok_to_put_more (op->map, x, y, op, op->attacktype)) |
806 | if (ok_to_put_more (op->map, x, y, op, op->attacktype)) |
809 | { |
807 | { |
810 | object *tmp = object::create (); |
808 | object *tmp = op->clone (); |
811 | |
809 | |
812 | op->copy_to (tmp); |
|
|
813 | tmp->x = x; |
810 | tmp->x = x; |
814 | tmp->y = y; |
811 | tmp->y = y; |
815 | |
812 | |
816 | tmp->duration = op->duration + 1; |
813 | tmp->duration = op->duration + 1; |
817 | |
814 | |
… | |
… | |
901 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
898 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
902 | continue; |
899 | continue; |
903 | |
900 | |
904 | success = 1; |
901 | success = 1; |
905 | tmp = arch_to_object (spell->other_arch); |
902 | tmp = arch_to_object (spell->other_arch); |
906 | set_owner (tmp, op); |
903 | tmp->set_owner (op); |
907 | set_spell_skill (op, caster, spell, tmp); |
904 | set_spell_skill (op, caster, spell, tmp); |
908 | tmp->level = caster_level (caster, spell); |
905 | tmp->level = caster_level (caster, spell); |
909 | tmp->x = sx; |
906 | tmp->x = sx; |
910 | tmp->y = sy; |
907 | tmp->y = sy; |
911 | tmp->attacktype = spell->attacktype; |
908 | tmp->attacktype = spell->attacktype; |
… | |
… | |
1033 | tmp->direction = i; |
1030 | tmp->direction = i; |
1034 | tmp->range = op->range; |
1031 | tmp->range = op->range; |
1035 | tmp->stats.dam = op->stats.dam; |
1032 | tmp->stats.dam = op->stats.dam; |
1036 | tmp->duration = op->duration; |
1033 | tmp->duration = op->duration; |
1037 | tmp->attacktype = op->attacktype; |
1034 | tmp->attacktype = op->attacktype; |
1038 | copy_owner (tmp, op); |
1035 | tmp->set_owner (op); |
1039 | if (op->skill && op->skill != tmp->skill) |
1036 | if (op->skill && op->skill != tmp->skill) |
1040 | { |
1037 | { |
1041 | tmp->skill = op->skill; |
1038 | tmp->skill = op->skill; |
1042 | } |
1039 | } |
1043 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
1040 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
… | |
… | |
1073 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1070 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1074 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1071 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1075 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
1072 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
1076 | tmp->attacktype = spell->attacktype; |
1073 | tmp->attacktype = spell->attacktype; |
1077 | |
1074 | |
1078 | set_owner (tmp, op); |
1075 | tmp->set_owner (op); |
1079 | set_spell_skill (op, caster, spell, tmp); |
1076 | set_spell_skill (op, caster, spell, tmp); |
1080 | tmp->x = dx; |
1077 | tmp->x = dx; |
1081 | tmp->y = dy; |
1078 | tmp->y = dy; |
1082 | insert_ob_in_map (tmp, m, op, 0); |
1079 | insert_ob_in_map (tmp, m, op, 0); |
1083 | return 1; |
1080 | return 1; |
… | |
… | |
1126 | if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW) |
1123 | if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW) |
1127 | return NULL; |
1124 | return NULL; |
1128 | |
1125 | |
1129 | if (mflags & P_IS_ALIVE) |
1126 | if (mflags & P_IS_ALIVE) |
1130 | { |
1127 | { |
1131 | for (target = get_map_ob (mp, x, y); target; target = target->above) |
1128 | for (target = GET_MAP_OB (mp, x, y); target; target = target->above) |
1132 | { |
1129 | { |
1133 | if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) |
1130 | if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) |
1134 | { |
1131 | { |
1135 | return target; |
1132 | return target; |
1136 | } |
1133 | } |
… | |
… | |
1203 | if (effect->attacktype & AT_DEATH) |
1200 | if (effect->attacktype & AT_DEATH) |
1204 | { |
1201 | { |
1205 | effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1202 | effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1206 | |
1203 | |
1207 | /* casting death spells at undead isn't a good thing */ |
1204 | /* casting death spells at undead isn't a good thing */ |
1208 | if QUERY_FLAG |
|
|
1209 | (target, FLAG_UNDEAD) |
1205 | if (QUERY_FLAG (target, FLAG_UNDEAD)) |
1210 | { |
1206 | { |
1211 | if (random_roll (0, 2, op, PREFER_LOW)) |
1207 | if (random_roll (0, 2, op, PREFER_LOW)) |
1212 | { |
1208 | { |
1213 | new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); |
1209 | new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); |
1214 | effect->x = op->x; |
1210 | effect->x = op->x; |
… | |
… | |
1227 | { |
1223 | { |
1228 | /* how much woe to inflict :) */ |
1224 | /* how much woe to inflict :) */ |
1229 | effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1225 | effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1230 | } |
1226 | } |
1231 | |
1227 | |
1232 | set_owner (effect, op); |
1228 | effect->set_owner (op); |
1233 | set_spell_skill (op, caster, spell, effect); |
1229 | set_spell_skill (op, caster, spell, effect); |
1234 | |
1230 | |
1235 | /* ok, tell it where to be, and insert! */ |
1231 | /* ok, tell it where to be, and insert! */ |
1236 | effect->x = target->x; |
1232 | effect->x = target->x; |
1237 | effect->y = target->y; |
1233 | effect->y = target->y; |
… | |
… | |
1261 | { |
1257 | { |
1262 | op->destroy (); |
1258 | op->destroy (); |
1263 | return; |
1259 | return; |
1264 | } |
1260 | } |
1265 | |
1261 | |
1266 | owner = get_owner (op); |
1262 | owner = op->owner; |
1267 | #if 0 |
1263 | #if 0 |
1268 | /* It'd make things nastier if this wasn't here - spells cast by |
1264 | /* It'd make things nastier if this wasn't here - spells cast by |
1269 | * monster that are then killed would continue to survive |
1265 | * monster that are then killed would continue to survive |
1270 | */ |
1266 | */ |
1271 | if (owner == NULL) |
1267 | if (owner == NULL) |
… | |
… | |
1301 | } |
1297 | } |
1302 | |
1298 | |
1303 | op->x = new_x; |
1299 | op->x = new_x; |
1304 | op->y = new_y; |
1300 | op->y = new_y; |
1305 | op->map = m; |
1301 | op->map = m; |
1306 | i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); |
1302 | i = spell_find_dir (op->map, op->x, op->y, op->owner); |
1307 | if (i > 0 && i != op->direction) |
1303 | if (i > 0 && i != op->direction) |
1308 | { |
1304 | { |
1309 | op->direction = i; |
1305 | op->direction = i; |
1310 | SET_ANIMATION (op, op->direction); |
1306 | SET_ANIMATION (op, op->direction); |
1311 | } |
1307 | } |
… | |
… | |
1401 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1397 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1402 | if (mflags & P_OUT_OF_MAP) |
1398 | if (mflags & P_OUT_OF_MAP) |
1403 | continue; |
1399 | continue; |
1404 | if (mflags & P_IS_ALIVE) |
1400 | if (mflags & P_IS_ALIVE) |
1405 | { |
1401 | { |
1406 | for (tmp = get_map_ob (m, sx, sy); tmp; tmp = tmp->above) |
1402 | for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) |
1407 | { |
1403 | { |
1408 | if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) |
1404 | if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) |
1409 | break; |
1405 | break; |
1410 | } |
1406 | } |
1411 | if (tmp) |
1407 | if (tmp) |
… | |
… | |
1595 | |
1591 | |
1596 | /* If there is nothing living on this space, no need to go further */ |
1592 | /* If there is nothing living on this space, no need to go further */ |
1597 | if (!(mflags & P_IS_ALIVE)) |
1593 | if (!(mflags & P_IS_ALIVE)) |
1598 | continue; |
1594 | continue; |
1599 | |
1595 | |
1600 | for (tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) |
1596 | for (tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above) |
1601 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1597 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1602 | break; |
1598 | break; |
1603 | |
1599 | |
1604 | /* There can be living objects that are not monsters */ |
1600 | /* There can be living objects that are not monsters */ |
1605 | if (!tmp || tmp->type == PLAYER) |
1601 | if (!tmp || tmp->type == PLAYER) |
… | |
… | |
1693 | SET_FLAG (head, FLAG_FRIENDLY); |
1689 | SET_FLAG (head, FLAG_FRIENDLY); |
1694 | /* Prevent uncontolled outbreaks of self replicating monsters. |
1690 | /* Prevent uncontolled outbreaks of self replicating monsters. |
1695 | Typical use case is charm, go somwhere, use aggravation to make hostile. |
1691 | Typical use case is charm, go somwhere, use aggravation to make hostile. |
1696 | This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ |
1692 | This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ |
1697 | CLEAR_FLAG (head, FLAG_GENERATOR); |
1693 | CLEAR_FLAG (head, FLAG_GENERATOR); |
1698 | set_owner (head, op); |
1694 | head->set_owner (op); |
1699 | set_spell_skill (op, caster, spell, head); |
1695 | set_spell_skill (op, caster, spell, head); |
1700 | add_friendly_object (head); |
1696 | add_friendly_object (head); |
1701 | head->attack_movement = PETMOVE; |
1697 | head->attack_movement = PETMOVE; |
1702 | done_one = 1; |
1698 | done_one = 1; |
1703 | change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); |
1699 | change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); |
… | |
… | |
1731 | int i, j, dam_save, dir, mflags; |
1727 | int i, j, dam_save, dir, mflags; |
1732 | sint16 nx, ny, hx, hy; |
1728 | sint16 nx, ny, hx, hy; |
1733 | object *owner; |
1729 | object *owner; |
1734 | maptile *m; |
1730 | maptile *m; |
1735 | |
1731 | |
1736 | owner = get_owner (op); |
1732 | owner = op->owner; |
1737 | |
1733 | |
1738 | /* the following logic makes sure that the ball doesn't move into a wall, |
1734 | /* the following logic makes sure that the ball doesn't move into a wall, |
1739 | * and makes sure that it will move along a wall to try and get at it's |
1735 | * and makes sure that it will move along a wall to try and get at it's |
1740 | * victim. The block immediately below more or less chooses a random |
1736 | * victim. The block immediately below more or less chooses a random |
1741 | * offset to move the ball, eg, keep it mostly on course, with some |
1737 | * offset to move the ball, eg, keep it mostly on course, with some |
… | |
… | |
1820 | } |
1816 | } |
1821 | |
1817 | |
1822 | /* restore to the center location and damage */ |
1818 | /* restore to the center location and damage */ |
1823 | op->stats.dam = dam_save; |
1819 | op->stats.dam = dam_save; |
1824 | |
1820 | |
1825 | i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); |
1821 | i = spell_find_dir (op->map, op->x, op->y, op->owner); |
1826 | |
1822 | |
1827 | if (i >= 0) |
1823 | if (i >= 0) |
1828 | { /* we have a preferred direction! */ |
1824 | { /* we have a preferred direction! */ |
1829 | /* pick another direction if the preferred dir is blocked. */ |
1825 | /* pick another direction if the preferred dir is blocked. */ |
1830 | if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || |
1826 | if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || |
… | |
… | |
1856 | maptile *m; |
1852 | maptile *m; |
1857 | #endif |
1853 | #endif |
1858 | int basedir; |
1854 | int basedir; |
1859 | object *owner; |
1855 | object *owner; |
1860 | |
1856 | |
1861 | owner = get_owner (op); |
1857 | owner = op->owner; |
1862 | if (op->duration == 0 || owner == NULL) |
1858 | if (op->duration == 0 || owner == NULL) |
1863 | { |
1859 | { |
1864 | op->destroy (); |
1860 | op->destroy (); |
1865 | return; |
1861 | return; |
1866 | } |
1862 | } |
… | |
… | |
1971 | return 0; |
1967 | return 0; |
1972 | |
1968 | |
1973 | tmp = get_archetype (SWARM_SPELL); |
1969 | tmp = get_archetype (SWARM_SPELL); |
1974 | tmp->x = op->x; |
1970 | tmp->x = op->x; |
1975 | tmp->y = op->y; |
1971 | tmp->y = op->y; |
1976 | set_owner (tmp, op); /* needed so that if swarm elements kill, caster gets xp. */ |
1972 | tmp->set_owner (op); /* needed so that if swarm elements kill, caster gets xp. */ |
1977 | set_spell_skill (op, caster, spell, tmp); |
1973 | set_spell_skill (op, caster, spell, tmp); |
1978 | |
1974 | |
1979 | tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ |
1975 | tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ |
1980 | tmp->spell = arch_to_object (spell->other_arch); |
1976 | tmp->spell = arch_to_object (spell->other_arch); |
1981 | |
1977 | |
… | |
… | |
2028 | return 0; |
2024 | return 0; |
2029 | } |
2025 | } |
2030 | |
2026 | |
2031 | if (mflags & P_IS_ALIVE && spell->attacktype) |
2027 | if (mflags & P_IS_ALIVE && spell->attacktype) |
2032 | { |
2028 | { |
2033 | for (target = get_map_ob (m, x, y); target; target = target->above) |
2029 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
2034 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
2030 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
2035 | { |
2031 | { |
2036 | /* oky doky. got a target monster. Lets make a blinding attack */ |
2032 | /* oky doky. got a target monster. Lets make a blinding attack */ |
2037 | if (target->head) |
2033 | if (target->head) |
2038 | target = target->head; |
2034 | target = target->head; |
… | |
… | |
2120 | |
2116 | |
2121 | /* Only bother looking on this space if there is something living here */ |
2117 | /* Only bother looking on this space if there is something living here */ |
2122 | if (mflags & P_IS_ALIVE) |
2118 | if (mflags & P_IS_ALIVE) |
2123 | { |
2119 | { |
2124 | /* search this square for a victim */ |
2120 | /* search this square for a victim */ |
2125 | for (walk = get_map_ob (m, x, y); walk; walk = walk->above) |
2121 | for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above) |
2126 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
2122 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
2127 | { /* found a victim */ |
2123 | { /* found a victim */ |
2128 | object *disease = arch_to_object (spell->other_arch); |
2124 | object *disease = arch_to_object (spell->other_arch); |
2129 | |
2125 | |
2130 | set_owner (disease, op); |
2126 | disease->set_owner (op); |
2131 | set_spell_skill (op, caster, spell, disease); |
2127 | set_spell_skill (op, caster, spell, disease); |
2132 | disease->stats.exp = 0; |
2128 | disease->stats.exp = 0; |
2133 | disease->level = caster_level (caster, spell); |
2129 | disease->level = caster_level (caster, spell); |
2134 | |
2130 | |
2135 | /* do level adjustments */ |
2131 | /* do level adjustments */ |