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.114 by root, Wed Nov 16 23:42:03 2016 UTC vs.
Revision 1.115 by root, Sun Jan 29 02:47:06 2017 UTC

86 if (tmp->move_type & MOVE_FLYING) 86 if (tmp->move_type & MOVE_FLYING)
87 frictionmod = 1; /* flying objects loose the friction modifier */ 87 frictionmod = 1; /* flying objects loose the friction modifier */
88 88
89 if (rndm (0, weight_move - 1) > ((tmp->weight / num_sections) * frictionmod)) 89 if (rndm (0, weight_move - 1) > ((tmp->weight / num_sections) * frictionmod))
90 { /* move it. */ 90 { /* move it. */
91 /* move_object is really for monsters, but looking at 91 /* move_object is really for monsters, but looking at
92 * the move_object function, it appears that it should 92 * the move_object function, it appears that it should
93 * also be safe for objects. 93 * also be safe for objects.
94 * This does return if successful or not, but 94 * This does return if successful or not, but
95 * I don't see us doing anything useful with that information 95 * I don't see us doing anything useful with that information
96 * right now. 96 * right now.
247 tmp->speed_left = -0.1f; 247 tmp->speed_left = -0.1f;
248 /* To make up for the decrease at the top of the function */ 248 /* To make up for the decrease at the top of the function */
249 tmp->duration++; 249 tmp->duration++;
250 250
251 /* New forking code. Possibly create forks of this object 251 /* New forking code. Possibly create forks of this object
252 * going off in other directions. 252 * going off in other directions.
253 */ 253 */
254 if (tmp->stats.Dex && rndm (0, 99) < tmp->stats.Dex) 254 if (tmp->stats.Dex && rndm (0, 99) < tmp->stats.Dex)
255 forklightning (op, tmp); /* stats.Dex % of forking */ 255 forklightning (op, tmp); /* stats.Dex % of forking */
256 256
257 /* In this way, the object left behind sticks on the space, but 257 /* In this way, the object left behind sticks on the space, but
367 sint16 dx, dy; 367 sint16 dx, dy;
368 368
369 dx = op->x + freearr_x[i]; 369 dx = op->x + freearr_x[i];
370 dy = op->y + freearr_y[i]; 370 dy = op->y + freearr_y[i];
371 371
372 /* ok_to_put_more already does things like checks for walls, 372 /* ok_to_put_more already does things like checks for walls,
373 * out of map, etc. 373 * out of map, etc.
374 */ 374 */
375 if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) 375 if (ok_to_put_more (op->map, dx, dy, op, op->attacktype))
376 { 376 {
377 object *tmp = op->clone (); 377 object *tmp = op->clone ();
549move_bullet (object *op) 549move_bullet (object *op)
550{ 550{
551#if 0 551#if 0
552 /* We need a better general purpose way to do this */ 552 /* We need a better general purpose way to do this */
553 553
554 /* peterm: added to make comet leave a trail of burnouts 554 /* peterm: added to make comet leave a trail of burnouts
555 it's an unadulterated hack, but the effect is cool. */ 555 it's an unadulterated hack, but the effect is cool. */
556 if (op->stats.sp == SP_METEOR) 556 if (op->stats.sp == SP_METEOR)
557 { 557 {
558 replace_insert_ob_in_map ("fire_trail", op); 558 replace_insert_ob_in_map ("fire_trail", op);
559 if (op->destroyed ()) 559 if (op->destroyed ())
754 if (!op->is_on_map ()) 754 if (!op->is_on_map ())
755 return; 755 return;
756 756
757 /* Check to see if we should push anything. 757 /* Check to see if we should push anything.
758 * Spell objects with weight push whatever they encounter to some 758 * Spell objects with weight push whatever they encounter to some
759 * degree. 759 * degree.
760 */ 760 */
761 if (op->weight) 761 if (op->weight)
762 { 762 {
763 check_spell_knockback (op); 763 check_spell_knockback (op);
764 764
1097 1097
1098 return NULL; 1098 return NULL;
1099} 1099}
1100 1100
1101/* cast_smite_spell() - the priest points to a creature and causes 1101/* cast_smite_spell() - the priest points to a creature and causes
1102 * a 'godly curse' to decend. 1102 * a 'godly curse' to decend.
1103 * usual params - 1103 * usual params -
1104 * op = player 1104 * op = player
1105 * caster = object casting the spell. 1105 * caster = object casting the spell.
1106 * dir = direction being cast 1106 * dir = direction being cast
1107 * spell = spell object 1107 * spell = spell object
1112 object *effect, *target; 1112 object *effect, *target;
1113 object *god = find_god (determine_god (op)); 1113 object *god = find_god (determine_god (op));
1114 1114
1115 target = get_pointed_target (op, dir, 50, spell->stats.grace ? SPELL_GRACE : SPELL_MANA); 1115 target = get_pointed_target (op, dir, 50, spell->stats.grace ? SPELL_GRACE : SPELL_MANA);
1116 1116
1117 /* Bunch of conditions for casting this spell. Note that only 1117 /* Bunch of conditions for casting this spell. Note that only
1118 * require a god if this is a cleric spell (requires grace). 1118 * require a god if this is a cleric spell (requires grace).
1119 * This makes this spell much more general purpose - it can be used 1119 * This makes this spell much more general purpose - it can be used
1120 * by wizards also, which is good, because I think this is a very 1120 * by wizards also, which is good, because I think this is a very
1121 * interesting spell. 1121 * interesting spell.
1122 * if it is a cleric spell, you need a god, and the creature 1122 * if it is a cleric spell, you need a god, and the creature
1250/**************************************************************************** 1250/****************************************************************************
1251 * Destruction 1251 * Destruction
1252 ****************************************************************************/ 1252 ****************************************************************************/
1253 1253
1254/* make_object_glow() - currently only makes living objects glow. 1254/* make_object_glow() - currently only makes living objects glow.
1255 * we do this by creating a force and inserting it in the 1255 * we do this by creating a force and inserting it in the
1256 * object. if time is 0, the object glows permanently. To truely 1256 * object. if time is 0, the object glows permanently. To truely
1257 * make this work for non-living objects, we would have to 1257 * make this work for non-living objects, we would have to
1258 * give them the capability to have an inventory. b.t. 1258 * give them the capability to have an inventory. b.t.
1259 */ 1259 */
1260static int 1260static int
1261make_object_glow (object *op, int radius, int time) 1261make_object_glow (object *op, int radius, int time)
1262{ 1262{
1639 m = op->map; 1639 m = op->map;
1640 } 1640 }
1641 1641
1642 m->insert (op, nx, ny, op); 1642 m->insert (op, nx, ny, op);
1643 1643
1644 dam_save = op->stats.dam; /* save the original dam: we do halfdam on 1644 dam_save = op->stats.dam; /* save the original dam: we do halfdam on
1645 surrounding squares */ 1645 surrounding squares */
1646 1646
1647 /* loop over current square and neighbors to hit. 1647 /* loop over current square and neighbors to hit.
1648 * if this has an other_arch field, we insert that in 1648 * if this has an other_arch field, we insert that in
1649 * the surround spaces. 1649 * the surround spaces.
1690 1690
1691 op->direction = i; 1691 op->direction = i;
1692 } 1692 }
1693} 1693}
1694 1694
1695/* move_swarm_spell: peterm 1695/* move_swarm_spell: peterm
1696 * This is an implementation of the swarm spell. It was written for 1696 * This is an implementation of the swarm spell. It was written for
1697 * meteor swarm, but it could be used for any swarm. A swarm spell 1697 * meteor swarm, but it could be used for any swarm. A swarm spell
1698 * is a special type of object that casts swarms of other types 1698 * is a special type of object that casts swarms of other types
1699 * of spells. Which spell it casts is flexible. It fires the spells 1699 * of spells. Which spell it casts is flexible. It fires the spells
1700 * from a set of squares surrounding the caster, in a given direction. 1700 * from a set of squares surrounding the caster, in a given direction.
1701 */ 1701 */
1702void 1702void
1703move_swarm_spell (object *op) 1703move_swarm_spell (object *op)
1704{ 1704{
1705#if 0 1705#if 0
1741 // space. 1741 // space.
1742 // should be fixed later, but correctness before features... 1742 // should be fixed later, but correctness before features...
1743 // (schmorp) 1743 // (schmorp)
1744 1744
1745 /* new offset calculation to make swarm element distribution 1745 /* new offset calculation to make swarm element distribution
1746 * more uniform 1746 * more uniform
1747 */ 1747 */
1748 if (op->duration) 1748 if (op->duration)
1749 { 1749 {
1750 if (basedir & 1) 1750 if (basedir & 1)
1751 { 1751 {
1763 1763
1764 target_x = op->x + freearr_x[absdir (basedir + adjustdir)]; 1764 target_x = op->x + freearr_x[absdir (basedir + adjustdir)];
1765 target_y = op->y + freearr_y[absdir (basedir + adjustdir)]; 1765 target_y = op->y + freearr_y[absdir (basedir + adjustdir)];
1766 1766
1767 /* back up one space so we can hit point-blank targets, but this 1767 /* back up one space so we can hit point-blank targets, but this
1768 * necessitates extra out_of_map check below 1768 * necessitates extra out_of_map check below
1769 */ 1769 */
1770 origin_x = target_x - freearr_x[basedir]; 1770 origin_x = target_x - freearr_x[basedir];
1771 origin_y = target_y - freearr_y[basedir]; 1771 origin_y = target_y - freearr_y[basedir];
1772 1772
1773 1773
1807} 1807}
1808 1808
1809/* fire_swarm: 1809/* fire_swarm:
1810 * The following routine creates a swarm of objects. It actually 1810 * The following routine creates a swarm of objects. It actually
1811 * sets up a specific swarm object, which then fires off all 1811 * sets up a specific swarm object, which then fires off all
1812 * the parts of the swarm. 1812 * the parts of the swarm.
1813 * 1813 *
1814 * op: the owner 1814 * op: the owner
1815 * caster: the caster (owner, wand, rod, scroll) 1815 * caster: the caster (owner, wand, rod, scroll)
1816 * dir: the direction everything will be fired in 1816 * dir: the direction everything will be fired in
1817 * spell - the spell that is this spell. 1817 * spell - the spell that is this spell.
1920 1920
1921 return 1; 1921 return 1;
1922} 1922}
1923 1923
1924/* cast_cause_disease: this spell looks along <dir> from the 1924/* cast_cause_disease: this spell looks along <dir> from the
1925 * player and infects someone. 1925 * player and infects someone.
1926 * op is the player/monster, caster is the object, dir is the direction 1926 * op is the player/monster, caster is the object, dir is the direction
1927 * to cast, disease_arch is the specific disease, and type is the spell number 1927 * to cast, disease_arch is the specific disease, and type is the spell number
1928 * perhaps this should actually be in disease.c? 1928 * perhaps this should actually be in disease.c?
1929 */ 1929 */
1930int 1930int
1936 maptile *m; 1936 maptile *m;
1937 1937
1938 x = op->x; 1938 x = op->x;
1939 y = op->y; 1939 y = op->y;
1940 1940
1941 /* If casting from a scroll, no direction will be available, so refer to the 1941 /* If casting from a scroll, no direction will be available, so refer to the
1942 * direction the player is pointing. 1942 * direction the player is pointing.
1943 */ 1943 */
1944 if (!dir) 1944 if (!dir)
1945 dir = op->facing; 1945 dir = op->facing;
1946 1946

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines