… | |
… | |
36 | /* 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 |
37 | * 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) |
38 | * but moved here so it could be applied to bolts too |
38 | * but moved here so it could be applied to bolts too |
39 | * op is the spell object. |
39 | * op is the spell object. |
40 | */ |
40 | */ |
41 | |
|
|
42 | void |
41 | void |
43 | check_spell_knockback (object *op) |
42 | check_spell_knockback (object *op) |
44 | { |
43 | { |
45 | object *tmp, *tmp2; /* object on the map */ |
44 | object *tmp, *tmp2; /* object on the map */ |
46 | int weight_move; |
45 | int weight_move; |
… | |
… | |
106 | * |
105 | * |
107 | * BOLT CODE |
106 | * BOLT CODE |
108 | * |
107 | * |
109 | ***************************************************************************/ |
108 | ***************************************************************************/ |
110 | |
109 | |
111 | /* Causes op to fork. op is the original bolt, tmp |
110 | /* Causes op to fork. op is the original bolt, tmp |
112 | * is the first piece of the fork. |
111 | * is the first piece of the fork. |
113 | */ |
112 | */ |
114 | |
|
|
115 | void |
113 | void |
116 | forklightning (object *op, object *tmp) |
114 | forklightning (object *op, object *tmp) |
117 | { |
115 | { |
118 | int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */ |
116 | int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */ |
119 | int t_dir; /* stores temporary dir calculation */ |
117 | int t_dir; /* stores temporary dir calculation */ |
… | |
… | |
1759 | op->duration--; |
1757 | op->duration--; |
1760 | |
1758 | |
1761 | int basedir = op->direction; |
1759 | int basedir = op->direction; |
1762 | if (!basedir) |
1760 | if (!basedir) |
1763 | /* spray in all directions! 8) */ |
1761 | /* spray in all directions! 8) */ |
1764 | basedir = rndm (1, 8); |
1762 | basedir = (op->facing += op->state) % 8 + 1; |
1765 | |
1763 | |
1766 | #if 0 |
1764 | #if 0 |
1767 | // this is bogus: it causes wrong places to be checked below |
1765 | // this is bogus: it causes wrong places to be checked below |
1768 | // (a wall 2 cells away will block the effect...) and |
1766 | // (a wall 2 cells away will block the effect...) and |
1769 | // doesn't work for SP_BULLET anyhow, so again tests the wrong |
1767 | // doesn't work for SP_BULLET anyhow, so again tests the wrong |
… | |
… | |
1829 | { |
1827 | { |
1830 | /* Bullet spells have a bunch more customization that needs to be done */ |
1828 | /* Bullet spells have a bunch more customization that needs to be done */ |
1831 | if (op->spell->subtype == SP_BULLET) |
1829 | if (op->spell->subtype == SP_BULLET) |
1832 | fire_bullet (owner, op, basedir, op->spell); |
1830 | fire_bullet (owner, op, basedir, op->spell); |
1833 | else if (op->spell->subtype == SP_MAGIC_MISSILE) |
1831 | else if (op->spell->subtype == SP_MAGIC_MISSILE) |
1834 | fire_arch_from_position (owner, op, op->x, op->y, basedir, op->spell); |
1832 | fire_arch_from_position (owner, op, owner->x, owner->y, basedir, op->spell); |
1835 | } |
1833 | } |
1836 | } |
1834 | } |
1837 | |
1835 | |
1838 | /* fire_swarm: |
1836 | /* fire_swarm: |
1839 | * The following routine creates a swarm of objects. It actually |
1837 | * The following routine creates a swarm of objects. It actually |
… | |
… | |
1866 | for (int i = 0; i < spell->duration; i++) |
1864 | for (int i = 0; i < spell->duration; i++) |
1867 | tmp->duration += die_roll (1, 3, op, PREFER_HIGH); |
1865 | tmp->duration += die_roll (1, 3, op, PREFER_HIGH); |
1868 | |
1866 | |
1869 | tmp->direction = dir; |
1867 | tmp->direction = dir; |
1870 | tmp->invisible = 1; |
1868 | tmp->invisible = 1; |
|
|
1869 | tmp->facing = rndm (1, 8); // initial firing direction |
|
|
1870 | tmp->state = rndm (4) * 2 + 1; // direction increment |
1871 | |
1871 | |
1872 | op->insert (tmp); |
1872 | op->insert (tmp); |
1873 | |
1873 | |
1874 | return 1; |
1874 | return 1; |
1875 | } |
1875 | } |