ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_attack.C
(Generate patch)

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.18 by root, Wed Dec 13 00:42:04 2006 UTC vs.
Revision 1.24 by root, Tue Dec 26 08:55:00 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines