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.58 by root, Sat May 17 14:57:23 2008 UTC vs.
Revision 1.64 by root, Mon Sep 29 06:32:09 2008 UTC

148 new_bolt->duration++; 148 new_bolt->duration++;
149 new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */ 149 new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */
150 new_bolt->stats.dam++; 150 new_bolt->stats.dam++;
151 tmp->stats.dam /= 2; /* reduce father bolt damage */ 151 tmp->stats.dam /= 2; /* reduce father bolt damage */
152 tmp->stats.dam++; 152 tmp->stats.dam++;
153
153 if ((new_bolt = m->insert (new_bolt, sx, sy, op))) 154 if ((new_bolt = m->insert (new_bolt, sx, sy, op)))
154 update_turn_face (new_bolt); 155 update_turn_face (new_bolt);
155} 156}
156 157
157/* move_bolt: moves bolt 'op'. Basically, it just advances a space, 158/* move_bolt: moves bolt 'op'. Basically, it just advances a space,
392void 393void
393explode_bullet (object *op) 394explode_bullet (object *op)
394{ 395{
395 object *tmp, *owner; 396 object *tmp, *owner;
396 397
397 if (op->other_arch == NULL) 398 if (!op->other_arch)
398 { 399 {
399 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); 400 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n");
400 op->destroy (); 401 op->destroy ();
401 return; 402 return;
402 } 403 }
742 check_spell_knockback (op); 743 check_spell_knockback (op);
743 744
744 if (op->destroyed ()) 745 if (op->destroyed ())
745 return; 746 return;
746 747
747 if ((op->duration--) < 0) 748 if (op->duration-- < 0)
748 { 749 {
749 op->destroy (); 750 op->destroy ();
750 return; 751 return;
751 } 752 }
752 /* Object has hit maximum range, so don't have it move 753 /* Object has hit maximum range, so don't have it move
859 860
860 success = 1; 861 success = 1;
861 tmp = arch_to_object (spell->other_arch); 862 tmp = arch_to_object (spell->other_arch);
862 tmp->set_owner (op); 863 tmp->set_owner (op);
863 set_spell_skill (op, caster, spell, tmp); 864 set_spell_skill (op, caster, spell, tmp);
864 tmp->level = caster_level (caster, spell); 865 tmp->level = casting_level (caster, spell);
865 tmp->attacktype = spell->attacktype; 866 tmp->attacktype = spell->attacktype;
866 867
867 /* holy word stuff */ 868 /* holy word stuff */
868 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER)) 869 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER))
869 if (!tailor_god_spell (tmp, op)) 870 if (!tailor_god_spell (tmp, op))
1111 effect = arch_to_object (spell->other_arch); 1112 effect = arch_to_object (spell->other_arch);
1112 else 1113 else
1113 return 0; 1114 return 0;
1114 1115
1115 /* tailor the effect by priest level and worshipped God */ 1116 /* tailor the effect by priest level and worshipped God */
1116 effect->level = caster_level (caster, spell); 1117 effect->level = casting_level (caster, spell);
1117 effect->attacktype = spell->attacktype; 1118 effect->attacktype = spell->attacktype;
1118 if (effect->attacktype & (AT_HOLYWORD | AT_GODPOWER)) 1119 if (effect->attacktype & (AT_HOLYWORD | AT_GODPOWER))
1119 { 1120 {
1120 if (tailor_god_spell (effect, op)) 1121 if (tailor_god_spell (effect, op))
1121 new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", determine_god (op)); 1122 new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", determine_god (op));
1450 1451
1451 /* We precompute some values here so that we don't have to keep 1452 /* We precompute some values here so that we don't have to keep
1452 * doing it over and over again. 1453 * doing it over and over again.
1453 */ 1454 */
1454 god = find_god (determine_god (op)); 1455 god = find_god (determine_god (op));
1455 level = caster_level (caster, spell); 1456 level = casting_level (caster, spell);
1456 range = spell->range + SP_level_range_adjust (caster, spell); 1457 range = spell->range + SP_level_range_adjust (caster, spell);
1457 1458
1458 /* On the bright side, no monster should ever have a race of GOD_... 1459 /* On the bright side, no monster should ever have a race of GOD_...
1459 * so even if the player doesn't worship a god, if race=GOD_.., it 1460 * so even if the player doesn't worship a god, if race=GOD_.., it
1460 * won't ever match anything. 1461 * won't ever match anything.
1610 * about. was called move_ball_lightning, but since more than the ball 1611 * about. was called move_ball_lightning, but since more than the ball
1611 * lightning spell used it, that seemed misnamed. 1612 * lightning spell used it, that seemed misnamed.
1612 * op is the spell effect. 1613 * op is the spell effect.
1613 * note that duration is handled by process_object() in time.c 1614 * note that duration is handled by process_object() in time.c
1614 */ 1615 */
1615
1616void 1616void
1617move_ball_spell (object *op) 1617move_ball_spell (object *op)
1618{ 1618{
1619 int i, j, dam_save, dir, mflags; 1619 int i, j, dam_save, dir, mflags;
1620 sint16 nx, ny, hx, hy; 1620 sint16 nx, ny, hx, hy;
1730 int adjustdir; 1730 int adjustdir;
1731 maptile *m; 1731 maptile *m;
1732#endif 1732#endif
1733 object *owner = op->env; 1733 object *owner = op->env;
1734 1734
1735 if (!owner) // MUST not happen, remove when true TODO
1736 {
1737 LOG (llevError, "swarm spell found outside inventory: %s\n", op->debug_desc ());
1738 op->destroy ();
1739 return;
1740 }
1741
1735 if (!op->duration || !owner->is_on_map ()) 1742 if (!op->duration || !owner->is_on_map ())
1736 { 1743 {
1737 op->destroy (); 1744 op->destroy ();
1738 return; 1745 return;
1739 } 1746 }
1740 1747
1741 op->duration--; 1748 op->duration--;
1742 1749
1743 int basedir = op->direction; 1750 int basedir = op->direction;
1744 if (!basedir) 1751 if (!basedir)
1752 {
1745 /* spray in all directions! 8) */ 1753 /* spray in all directions! 8) */
1746 basedir = (op->facing += op->state) % 8 + 1; 1754 op->facing = (op->facing + op->state) & 7;
1755 basedir = op->facing + 1;
1756 }
1747 1757
1748#if 0 1758#if 0
1749 // this is bogus: it causes wrong places to be checked below 1759 // this is bogus: it causes wrong places to be checked below
1750 // (a wall 2 cells away will block the effect...) and 1760 // (a wall 2 cells away will block the effect...) and
1751 // doesn't work for SP_BULLET anyhow, so again tests the wrong 1761 // doesn't work for SP_BULLET anyhow, so again tests the wrong
1833{ 1843{
1834 if (!spell->other_arch) 1844 if (!spell->other_arch)
1835 return 0; 1845 return 0;
1836 1846
1837 object *tmp = archetype::get (SWARM_SPELL); 1847 object *tmp = archetype::get (SWARM_SPELL);
1848
1838 set_spell_skill (op, caster, spell, tmp); 1849 set_spell_skill (op, caster, spell, tmp);
1839 tmp->level = caster_level (caster, spell); /* needed later, to get level dep. right. */ 1850 tmp->level = casting_level (caster, spell); /* needed later, to get level dep. right. */
1840 tmp->spell = spell->other_arch->instance (); 1851 tmp->spell = spell->other_arch->instance ();
1841 tmp->attacktype = tmp->spell->attacktype; 1852 tmp->attacktype = tmp->spell->attacktype;
1842 1853
1843 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) 1854 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER)
1844 if (!tailor_god_spell (tmp, op)) 1855 if (!tailor_god_spell (tmp, op))
1846 1857
1847 tmp->duration = SP_level_duration_adjust (caster, spell); 1858 tmp->duration = SP_level_duration_adjust (caster, spell);
1848 for (int i = 0; i < spell->duration; i++) 1859 for (int i = 0; i < spell->duration; i++)
1849 tmp->duration += die_roll (1, 3, op, PREFER_HIGH); 1860 tmp->duration += die_roll (1, 3, op, PREFER_HIGH);
1850 1861
1862 tmp->invisible = 1;
1863 tmp->flag [FLAG_NO_DROP] = 1; // make sure it stays in inv, or else
1851 tmp->direction = dir; 1864 tmp->direction = dir;
1852 tmp->invisible = 1;
1853 tmp->facing = rndm (1, 8); // initial firing direction 1865 tmp->facing = rndm (1, 8); // initial firing direction
1854 tmp->state = rndm (4) * 2 + 1; // direction increment 1866 tmp->state = rndm (4) * 2 + 1; // direction increment
1855 1867
1856 op->insert (tmp); 1868 op->insert (tmp);
1857 1869
1986 object *disease = arch_to_object (spell->other_arch); 1998 object *disease = arch_to_object (spell->other_arch);
1987 1999
1988 disease->set_owner (op); 2000 disease->set_owner (op);
1989 set_spell_skill (op, caster, spell, disease); 2001 set_spell_skill (op, caster, spell, disease);
1990 disease->stats.exp = 0; 2002 disease->stats.exp = 0;
1991 disease->level = caster_level (caster, spell); 2003 disease->level = casting_level (caster, spell);
1992 2004
1993 /* do level adjustments */ 2005 /* do level adjustments */
1994 if (disease->stats.wc) 2006 if (disease->stats.wc)
1995 disease->stats.wc += dur_mod / 2; 2007 disease->stats.wc += dur_mod / 2;
1996 2008

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines