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.62 by root, Mon Jul 14 00:04:57 2008 UTC vs.
Revision 1.67 by root, Mon Sep 29 10:32:50 2008 UTC

165 sint16 x, y; 165 sint16 x, y;
166 maptile *m; 166 maptile *m;
167 167
168 if (--op->duration < 0) 168 if (--op->duration < 0)
169 { 169 {
170 op->destroy (); 170 op->drop_and_destroy ();
171 return; 171 return;
172 } 172 }
173 173
174 hit_map (op, 0, op->attacktype, 1); 174 hit_map (op, 0, op->attacktype, 1);
175 175
307 307
308 maptile *newmap; 308 maptile *newmap;
309 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); 309 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y);
310 if (mflags & P_OUT_OF_MAP) 310 if (mflags & P_OUT_OF_MAP)
311 { 311 {
312 tmp->destroy (); 312 tmp->drop_and_destroy ();
313 return 0; 313 return 0;
314 } 314 }
315 315
316 tmp->map = newmap; 316 tmp->map = newmap;
317 317
318 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 318 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
319 { 319 {
320 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 320 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
321 { 321 {
322 tmp->destroy (); 322 tmp->drop_and_destroy ();
323 return 0; 323 return 0;
324 } 324 }
325 325
326 tmp->x = op->x; 326 tmp->x = op->x;
327 tmp->y = op->y; 327 tmp->y = op->y;
393void 393void
394explode_bullet (object *op) 394explode_bullet (object *op)
395{ 395{
396 object *tmp, *owner; 396 object *tmp, *owner;
397 397
398 if (op->other_arch == NULL) 398 if (!op->other_arch)
399 { 399 {
400 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); 400 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n");
401 op->destroy (); 401 op->destroy ();
402 return; 402 return;
403 } 403 }
445 tmp->set_owner (op); 445 tmp->set_owner (op);
446 tmp->skill = op->skill; 446 tmp->skill = op->skill;
447 447
448 owner = op->owner; 448 owner = op->owner;
449 449
450 if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) 450 if ((tmp->attacktype & AT_HOLYWORD
451 || tmp->attacktype & AT_GODPOWER)
452 && owner
453 && !tailor_god_spell (tmp, owner))
451 { 454 {
452 op->destroy (); 455 op->destroy ();
453 return; 456 return;
454 } 457 }
455 458
521 { 524 {
522 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 525 if (QUERY_FLAG (tmp, FLAG_ALIVE))
523 { 526 {
524 dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); 527 dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1);
525 528
529 // TODO: can't understand the following if's
526 if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) 530 if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0)
527 { 531 {
528 if (!QUERY_FLAG (op, FLAG_REMOVED)) 532 if (!QUERY_FLAG (op, FLAG_REMOVED))
529 { 533 {
530 op->destroy (); 534 op->destroy ();
860 864
861 success = 1; 865 success = 1;
862 tmp = arch_to_object (spell->other_arch); 866 tmp = arch_to_object (spell->other_arch);
863 tmp->set_owner (op); 867 tmp->set_owner (op);
864 set_spell_skill (op, caster, spell, tmp); 868 set_spell_skill (op, caster, spell, tmp);
865 tmp->level = caster_level (caster, spell); 869 tmp->level = casting_level (caster, spell);
866 tmp->attacktype = spell->attacktype; 870 tmp->attacktype = spell->attacktype;
867 871
868 /* holy word stuff */ 872 /* holy word stuff */
869 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER)) 873 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER))
870 if (!tailor_god_spell (tmp, op)) 874 if (!tailor_god_spell (tmp, op))
1112 effect = arch_to_object (spell->other_arch); 1116 effect = arch_to_object (spell->other_arch);
1113 else 1117 else
1114 return 0; 1118 return 0;
1115 1119
1116 /* tailor the effect by priest level and worshipped God */ 1120 /* tailor the effect by priest level and worshipped God */
1117 effect->level = caster_level (caster, spell); 1121 effect->level = casting_level (caster, spell);
1118 effect->attacktype = spell->attacktype; 1122 effect->attacktype = spell->attacktype;
1119 if (effect->attacktype & (AT_HOLYWORD | AT_GODPOWER)) 1123 if (effect->attacktype & (AT_HOLYWORD | AT_GODPOWER))
1120 { 1124 {
1121 if (tailor_god_spell (effect, op)) 1125 if (tailor_god_spell (effect, op))
1122 new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", determine_god (op)); 1126 new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", determine_god (op));
1179void 1183void
1180move_missile (object *op) 1184move_missile (object *op)
1181{ 1185{
1182 if (op->range-- <= 0) 1186 if (op->range-- <= 0)
1183 { 1187 {
1184 op->destroy (); 1188 op->drop_and_destroy ();
1185 return; 1189 return;
1186 } 1190 }
1187 1191
1188 mapxy pos (op); 1192 mapxy pos (op);
1189 pos.move (op->direction); 1193 pos.move (op->direction);
1451 1455
1452 /* We precompute some values here so that we don't have to keep 1456 /* We precompute some values here so that we don't have to keep
1453 * doing it over and over again. 1457 * doing it over and over again.
1454 */ 1458 */
1455 god = find_god (determine_god (op)); 1459 god = find_god (determine_god (op));
1456 level = caster_level (caster, spell); 1460 level = casting_level (caster, spell);
1457 range = spell->range + SP_level_range_adjust (caster, spell); 1461 range = spell->range + SP_level_range_adjust (caster, spell);
1458 1462
1459 /* On the bright side, no monster should ever have a race of GOD_... 1463 /* On the bright side, no monster should ever have a race of GOD_...
1460 * so even if the player doesn't worship a god, if race=GOD_.., it 1464 * so even if the player doesn't worship a god, if race=GOD_.., it
1461 * won't ever match anything. 1465 * won't ever match anything.
1739 return; 1743 return;
1740 } 1744 }
1741 1745
1742 if (!op->duration || !owner->is_on_map ()) 1746 if (!op->duration || !owner->is_on_map ())
1743 { 1747 {
1744 op->destroy (); 1748 op->drop_and_destroy ();
1745 return; 1749 return;
1746 } 1750 }
1747 1751
1748 op->duration--; 1752 op->duration--;
1749 1753
1845 return 0; 1849 return 0;
1846 1850
1847 object *tmp = archetype::get (SWARM_SPELL); 1851 object *tmp = archetype::get (SWARM_SPELL);
1848 1852
1849 set_spell_skill (op, caster, spell, tmp); 1853 set_spell_skill (op, caster, spell, tmp);
1850 tmp->level = caster_level (caster, spell); /* needed later, to get level dep. right. */ 1854 tmp->level = casting_level (caster, spell); /* needed later, to get level dep. right. */
1851 tmp->spell = spell->other_arch->instance (); 1855 tmp->spell = spell->other_arch->instance ();
1852 tmp->attacktype = tmp->spell->attacktype; 1856 tmp->attacktype = tmp->spell->attacktype;
1853 1857
1854 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) 1858 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER)
1855 if (!tailor_god_spell (tmp, op)) 1859 if (!tailor_god_spell (tmp, op))
1998 object *disease = arch_to_object (spell->other_arch); 2002 object *disease = arch_to_object (spell->other_arch);
1999 2003
2000 disease->set_owner (op); 2004 disease->set_owner (op);
2001 set_spell_skill (op, caster, spell, disease); 2005 set_spell_skill (op, caster, spell, disease);
2002 disease->stats.exp = 0; 2006 disease->stats.exp = 0;
2003 disease->level = caster_level (caster, spell); 2007 disease->level = casting_level (caster, spell);
2004 2008
2005 /* do level adjustments */ 2009 /* do level adjustments */
2006 if (disease->stats.wc) 2010 if (disease->stats.wc)
2007 disease->stats.wc += dur_mod / 2; 2011 disease->stats.wc += dur_mod / 2;
2008 2012

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines