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.20 by root, Mon Dec 18 02:35:01 2006 UTC

308 308
309 tmp->direction = dir; 309 tmp->direction = dir;
310 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 310 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
311 SET_ANIMATION (tmp, dir); 311 SET_ANIMATION (tmp, dir);
312 312
313 set_owner (tmp, op); 313 tmp->set_owner (op);
314 set_spell_skill (op, caster, spob, tmp); 314 set_spell_skill (op, caster, spob, tmp);
315 315
316 tmp->x = op->x + DIRX (tmp); 316 tmp->x = op->x + DIRX (tmp);
317 tmp->y = op->y + DIRY (tmp); 317 tmp->y = op->y + DIRY (tmp);
318 tmp->map = op->map; 318 tmp->map = op->map;
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;
671 671
672 tmp->direction = dir; 672 tmp->direction = dir;
673 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 673 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
674 SET_ANIMATION (tmp, dir); 674 SET_ANIMATION (tmp, dir);
675 675
676 set_owner (tmp, op); 676 tmp->set_owner (op);
677 set_spell_skill (op, caster, spob, tmp); 677 set_spell_skill (op, caster, spob, tmp);
678 678
679 tmp->x = op->x + freearr_x[dir]; 679 tmp->x = op->x + freearr_x[dir];
680 tmp->y = op->y + freearr_y[dir]; 680 tmp->y = op->y + freearr_y[dir];
681 tmp->map = op->map; 681 tmp->map = op->map;
724 object *new_ob = arch_to_object (op->other_arch); 724 object *new_ob = arch_to_object (op->other_arch);
725 725
726 new_ob->x = op->x; 726 new_ob->x = op->x;
727 new_ob->y = op->y; 727 new_ob->y = op->y;
728 new_ob->level = op->level; 728 new_ob->level = op->level;
729 set_owner (new_ob, op->owner); 729 new_ob->set_owner (op->owner);
730 730
731 /* preserve skill ownership */ 731 /* preserve skill ownership */
732 if (op->skill && op->skill != new_ob->skill) 732 if (op->skill && op->skill != new_ob->skill)
733 { 733 {
734 new_ob->skill = op->skill; 734 new_ob->skill = op->skill;
763#if 0 763#if 0
764 /* Disable this - enabling it makes monsters easier, as 764 /* Disable this - enabling it makes monsters easier, as
765 * when their cone dies when they die. 765 * when their cone dies when they die.
766 */ 766 */
767 /* If no owner left, the spell dies out. */ 767 /* If no owner left, the spell dies out. */
768 if (get_owner (op) == NULL) 768 if (op->owner == NULL)
769 { 769 {
770 op->destroy (); 770 op->destroy ();
771 return; 771 return;
772 } 772 }
773#endif 773#endif
898 if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) 898 if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype)
899 continue; 899 continue;
900 900
901 success = 1; 901 success = 1;
902 tmp = arch_to_object (spell->other_arch); 902 tmp = arch_to_object (spell->other_arch);
903 set_owner (tmp, op); 903 tmp->set_owner (op);
904 set_spell_skill (op, caster, spell, tmp); 904 set_spell_skill (op, caster, spell, tmp);
905 tmp->level = caster_level (caster, spell); 905 tmp->level = caster_level (caster, spell);
906 tmp->x = sx; 906 tmp->x = sx;
907 tmp->y = sy; 907 tmp->y = sy;
908 tmp->attacktype = spell->attacktype; 908 tmp->attacktype = spell->attacktype;
1030 tmp->direction = i; 1030 tmp->direction = i;
1031 tmp->range = op->range; 1031 tmp->range = op->range;
1032 tmp->stats.dam = op->stats.dam; 1032 tmp->stats.dam = op->stats.dam;
1033 tmp->duration = op->duration; 1033 tmp->duration = op->duration;
1034 tmp->attacktype = op->attacktype; 1034 tmp->attacktype = op->attacktype;
1035 copy_owner (tmp, op); 1035 tmp->set_owner (op);
1036 if (op->skill && op->skill != tmp->skill) 1036 if (op->skill && op->skill != tmp->skill)
1037 { 1037 {
1038 tmp->skill = op->skill; 1038 tmp->skill = op->skill;
1039 } 1039 }
1040 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 1040 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
1070 tmp->range = spell->range + SP_level_range_adjust (caster, spell); 1070 tmp->range = spell->range + SP_level_range_adjust (caster, spell);
1071 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);
1072 tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); 1072 tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell);
1073 tmp->attacktype = spell->attacktype; 1073 tmp->attacktype = spell->attacktype;
1074 1074
1075 set_owner (tmp, op); 1075 tmp->set_owner (op);
1076 set_spell_skill (op, caster, spell, tmp); 1076 set_spell_skill (op, caster, spell, tmp);
1077 tmp->x = dx; 1077 tmp->x = dx;
1078 tmp->y = dy; 1078 tmp->y = dy;
1079 insert_ob_in_map (tmp, m, op, 0); 1079 insert_ob_in_map (tmp, m, op, 0);
1080 return 1; 1080 return 1;
1200 if (effect->attacktype & AT_DEATH) 1200 if (effect->attacktype & AT_DEATH)
1201 { 1201 {
1202 effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1202 effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1203 1203
1204 /* casting death spells at undead isn't a good thing */ 1204 /* casting death spells at undead isn't a good thing */
1205 if QUERY_FLAG
1206 (target, FLAG_UNDEAD) 1205 if (QUERY_FLAG (target, FLAG_UNDEAD))
1207 { 1206 {
1208 if (random_roll (0, 2, op, PREFER_LOW)) 1207 if (random_roll (0, 2, op, PREFER_LOW))
1209 { 1208 {
1210 new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); 1209 new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!");
1211 effect->x = op->x; 1210 effect->x = op->x;
1224 { 1223 {
1225 /* how much woe to inflict :) */ 1224 /* how much woe to inflict :) */
1226 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);
1227 } 1226 }
1228 1227
1229 set_owner (effect, op); 1228 effect->set_owner (op);
1230 set_spell_skill (op, caster, spell, effect); 1229 set_spell_skill (op, caster, spell, effect);
1231 1230
1232 /* ok, tell it where to be, and insert! */ 1231 /* ok, tell it where to be, and insert! */
1233 effect->x = target->x; 1232 effect->x = target->x;
1234 effect->y = target->y; 1233 effect->y = target->y;
1258 { 1257 {
1259 op->destroy (); 1258 op->destroy ();
1260 return; 1259 return;
1261 } 1260 }
1262 1261
1263 owner = get_owner (op); 1262 owner = op->owner;
1264#if 0 1263#if 0
1265 /* 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
1266 * monster that are then killed would continue to survive 1265 * monster that are then killed would continue to survive
1267 */ 1266 */
1268 if (owner == NULL) 1267 if (owner == NULL)
1298 } 1297 }
1299 1298
1300 op->x = new_x; 1299 op->x = new_x;
1301 op->y = new_y; 1300 op->y = new_y;
1302 op->map = m; 1301 op->map = m;
1303 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);
1304 if (i > 0 && i != op->direction) 1303 if (i > 0 && i != op->direction)
1305 { 1304 {
1306 op->direction = i; 1305 op->direction = i;
1307 SET_ANIMATION (op, op->direction); 1306 SET_ANIMATION (op, op->direction);
1308 } 1307 }
1690 SET_FLAG (head, FLAG_FRIENDLY); 1689 SET_FLAG (head, FLAG_FRIENDLY);
1691 /* Prevent uncontolled outbreaks of self replicating monsters. 1690 /* Prevent uncontolled outbreaks of self replicating monsters.
1692 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.
1693 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. */
1694 CLEAR_FLAG (head, FLAG_GENERATOR); 1693 CLEAR_FLAG (head, FLAG_GENERATOR);
1695 set_owner (head, op); 1694 head->set_owner (op);
1696 set_spell_skill (op, caster, spell, head); 1695 set_spell_skill (op, caster, spell, head);
1697 add_friendly_object (head); 1696 add_friendly_object (head);
1698 head->attack_movement = PETMOVE; 1697 head->attack_movement = PETMOVE;
1699 done_one = 1; 1698 done_one = 1;
1700 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);
1728 int i, j, dam_save, dir, mflags; 1727 int i, j, dam_save, dir, mflags;
1729 sint16 nx, ny, hx, hy; 1728 sint16 nx, ny, hx, hy;
1730 object *owner; 1729 object *owner;
1731 maptile *m; 1730 maptile *m;
1732 1731
1733 owner = get_owner (op); 1732 owner = op->owner;
1734 1733
1735 /* 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,
1736 * 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
1737 * victim. The block immediately below more or less chooses a random 1736 * 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 1737 * offset to move the ball, eg, keep it mostly on course, with some
1817 } 1816 }
1818 1817
1819 /* restore to the center location and damage */ 1818 /* restore to the center location and damage */
1820 op->stats.dam = dam_save; 1819 op->stats.dam = dam_save;
1821 1820
1822 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);
1823 1822
1824 if (i >= 0) 1823 if (i >= 0)
1825 { /* we have a preferred direction! */ 1824 { /* we have a preferred direction! */
1826 /* pick another direction if the preferred dir is blocked. */ 1825 /* 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 || 1826 if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP ||
1853 maptile *m; 1852 maptile *m;
1854#endif 1853#endif
1855 int basedir; 1854 int basedir;
1856 object *owner; 1855 object *owner;
1857 1856
1858 owner = get_owner (op); 1857 owner = op->owner;
1859 if (op->duration == 0 || owner == NULL) 1858 if (op->duration == 0 || owner == NULL)
1860 { 1859 {
1861 op->destroy (); 1860 op->destroy ();
1862 return; 1861 return;
1863 } 1862 }
1968 return 0; 1967 return 0;
1969 1968
1970 tmp = get_archetype (SWARM_SPELL); 1969 tmp = get_archetype (SWARM_SPELL);
1971 tmp->x = op->x; 1970 tmp->x = op->x;
1972 tmp->y = op->y; 1971 tmp->y = op->y;
1973 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. */
1974 set_spell_skill (op, caster, spell, tmp); 1973 set_spell_skill (op, caster, spell, tmp);
1975 1974
1976 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. */
1977 tmp->spell = arch_to_object (spell->other_arch); 1976 tmp->spell = arch_to_object (spell->other_arch);
1978 1977
2122 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)
2123 if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) 2122 if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER))
2124 { /* found a victim */ 2123 { /* found a victim */
2125 object *disease = arch_to_object (spell->other_arch); 2124 object *disease = arch_to_object (spell->other_arch);
2126 2125
2127 set_owner (disease, op); 2126 disease->set_owner (op);
2128 set_spell_skill (op, caster, spell, disease); 2127 set_spell_skill (op, caster, spell, disease);
2129 disease->stats.exp = 0; 2128 disease->stats.exp = 0;
2130 disease->level = caster_level (caster, spell); 2129 disease->level = caster_level (caster, spell);
2131 2130
2132 /* do level adjustments */ 2131 /* do level adjustments */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines