1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
12 | * option) any later version. |
12 | * |
13 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * GNU General Public License for more details. |
17 | * |
18 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
21 | * <http://www.gnu.org/licenses/>. |
21 | * |
22 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
24 | */ |
24 | |
25 | |
25 | #include <global.h> |
26 | #include <global.h> |
26 | #include <object.h> |
27 | #include <object.h> |
… | |
… | |
196 | /* Can't get any money for these objects */ |
197 | /* Can't get any money for these objects */ |
197 | missile->value = 0; |
198 | missile->value = 0; |
198 | |
199 | |
199 | missile->set_flag (FLAG_IDENTIFIED); |
200 | missile->set_flag (FLAG_IDENTIFIED); |
200 | |
201 | |
201 | if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) |
202 | cast_create_obj (op, caster, missile, dir); |
|
|
203 | |
|
|
204 | if (!dir |
|
|
205 | && op->type == PLAYER |
|
|
206 | && !missile->destroyed ()) |
202 | pick_up (op, missile); |
207 | pick_up (op, missile); |
203 | |
208 | |
204 | return 1; |
209 | return 1; |
205 | } |
210 | } |
206 | |
|
|
207 | |
211 | |
208 | /* allows the choice of what sort of food object to make. |
212 | /* allows the choice of what sort of food object to make. |
209 | * If spellparam is NULL, it will create food dependent on level --PeterM*/ |
213 | * If spellparam is NULL, it will create food dependent on level --PeterM*/ |
210 | int |
214 | int |
211 | cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *spellparam) |
215 | cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *spellparam) |
… | |
… | |
290 | } |
294 | } |
291 | |
295 | |
292 | maxrange = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
296 | maxrange = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
293 | for (r = 1; r < maxrange; r++) |
297 | for (r = 1; r < maxrange; r++) |
294 | { |
298 | { |
295 | sint16 x = op->x + r * freearr_x[dir], y = op->y + r * freearr_y[dir]; |
299 | sint16 x = op->x + r * DIRX (dir), y = op->y + r * DIRY (dir); |
296 | |
300 | |
297 | m = op->map; |
301 | m = op->map; |
298 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
302 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
299 | |
303 | |
300 | if (mflags & P_OUT_OF_MAP) |
304 | if (mflags & P_OUT_OF_MAP) |
… | |
… | |
401 | |
405 | |
402 | if (spell_ob->flag [FLAG_MAKE_INVIS]) |
406 | if (spell_ob->flag [FLAG_MAKE_INVIS]) |
403 | op->contr->tmp_invis = 0; |
407 | op->contr->tmp_invis = 0; |
404 | else |
408 | else |
405 | op->contr->tmp_invis = 1; |
409 | op->contr->tmp_invis = 1; |
406 | |
|
|
407 | op->contr->hidden = 0; |
|
|
408 | } |
410 | } |
409 | |
411 | |
410 | if (makes_invisible_to (op, op)) |
412 | if (makes_invisible_to (op, op)) |
411 | new_draw_info (NDI_UNIQUE, 0, op, "You can't see your hands!"); |
413 | new_draw_info (NDI_UNIQUE, 0, op, "You can't see your hands!"); |
412 | else |
414 | else |
… | |
… | |
470 | |
472 | |
471 | op->destroy (); |
473 | op->destroy (); |
472 | } |
474 | } |
473 | |
475 | |
474 | /* Word of recall causes the player to return 'home'. |
476 | /* Word of recall causes the player to return 'home'. |
475 | * we put a force into the player object, so that there is a |
477 | * we put a force into the player object, so that there is a |
476 | * time delay effect. |
478 | * time delay effect. |
477 | */ |
479 | */ |
478 | int |
480 | int |
479 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
481 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
480 | { |
482 | { |
… | |
… | |
618 | x = op->x; |
620 | x = op->x; |
619 | y = op->y; |
621 | y = op->y; |
620 | } |
622 | } |
621 | else |
623 | else |
622 | { |
624 | { |
623 | x = op->x + freearr_x[dir]; |
625 | x = op->x + DIRX (dir); |
624 | y = op->y + freearr_y[dir]; |
626 | y = op->y + DIRY (dir); |
625 | } |
627 | } |
626 | |
628 | |
627 | m = op->map; |
629 | m = op->map; |
628 | |
630 | |
629 | if ((spell_ob->move_block || x != op->x || y != op->y) && |
631 | if ((spell_ob->move_block || x != op->x || y != op->y) && |
… | |
… | |
704 | /* If this is a spellcasting wall, need to insert the spell object */ |
706 | /* If this is a spellcasting wall, need to insert the spell object */ |
705 | if (tmp->other_arch && tmp->other_arch->type == SPELL) |
707 | if (tmp->other_arch && tmp->other_arch->type == SPELL) |
706 | insert_ob_in_ob (tmp->other_arch->instance (), tmp); |
708 | insert_ob_in_ob (tmp->other_arch->instance (), tmp); |
707 | |
709 | |
708 | /* This code causes the wall to extend some distance in |
710 | /* This code causes the wall to extend some distance in |
709 | * each direction, or until an obstruction is encountered. |
711 | * each direction, or until an obstruction is encountered. |
710 | * posblocked and negblocked help determine how far the |
712 | * posblocked and negblocked help determine how far the |
711 | * created wall can extend, it won't go extend through |
713 | * created wall can extend, it won't go extend through |
712 | * blocked spaces. |
714 | * blocked spaces. |
713 | */ |
715 | */ |
714 | maxrange = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
716 | maxrange = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
… | |
… | |
719 | { |
721 | { |
720 | int dir2; |
722 | int dir2; |
721 | |
723 | |
722 | dir2 = (dir < 4) ? (dir + 2) : dir - 2; |
724 | dir2 = (dir < 4) ? (dir + 2) : dir - 2; |
723 | |
725 | |
724 | x = tmp->x + i * freearr_x[dir2]; |
726 | x = tmp->x + i * DIRX (dir2); |
725 | y = tmp->y + i * freearr_y[dir2]; |
727 | y = tmp->y + i * DIRY (dir2); |
726 | m = tmp->map; |
728 | m = tmp->map; |
727 | |
729 | |
728 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
730 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
729 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !posblocked) |
731 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !posblocked) |
730 | { |
732 | { |
… | |
… | |
737 | |
739 | |
738 | } |
740 | } |
739 | else |
741 | else |
740 | posblocked = 1; |
742 | posblocked = 1; |
741 | |
743 | |
742 | x = tmp->x - i * freearr_x[dir2]; |
744 | x = tmp->x - i * DIRX (dir2); |
743 | y = tmp->y - i * freearr_y[dir2]; |
745 | y = tmp->y - i * DIRY (dir2); |
744 | m = tmp->map; |
746 | m = tmp->map; |
745 | |
747 | |
746 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
748 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
747 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !negblocked) |
749 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !negblocked) |
748 | { |
750 | { |
… | |
… | |
794 | return 0; |
796 | return 0; |
795 | } |
797 | } |
796 | |
798 | |
797 | for (dist = 0; dist < count; dist++) |
799 | for (dist = 0; dist < count; dist++) |
798 | { |
800 | { |
799 | mflags = get_map_flags (op->map, &m, op->x + freearr_x[dir] * (dist + 1), op->y + freearr_y[dir] * (dist + 1), &sx, &sy); |
801 | mflags = get_map_flags (op->map, &m, op->x + DIRX (dir) * (dist + 1), op->y + DIRY (dir) * (dist + 1), &sx, &sy); |
800 | |
802 | |
801 | if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) |
803 | if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) |
802 | break; |
804 | break; |
803 | |
805 | |
804 | if ((mflags & P_BLOCKSVIEW) && OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
806 | if ((mflags & P_BLOCKSVIEW) && OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
… | |
… | |
817 | * by such squares). Also, there are probably treasure rooms and |
819 | * by such squares). Also, there are probably treasure rooms and |
818 | * lots of other maps that protect areas with no magic, but the |
820 | * lots of other maps that protect areas with no magic, but the |
819 | * areas themselves don't contain no magic spaces. |
821 | * areas themselves don't contain no magic spaces. |
820 | */ |
822 | */ |
821 | /* This call here is really just to normalize the coordinates */ |
823 | /* This call here is really just to normalize the coordinates */ |
822 | mflags = get_map_flags (op->map, &m, op->x + freearr_x[dir] * dist, op->y + freearr_y[dir] * dist, &sx, &sy); |
824 | mflags = get_map_flags (op->map, &m, op->x + DIRX (dir) * dist, op->y + DIRY (dir) * dist, &sx, &sy); |
823 | if (mflags & P_IS_ALIVE || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
825 | if (mflags & P_IS_ALIVE || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
824 | { |
826 | { |
825 | new_draw_info (NDI_UNIQUE, 0, op, "You cast your spell, but nothing happens.\n"); |
827 | new_draw_info (NDI_UNIQUE, 0, op, "You cast your spell, but nothing happens.\n"); |
826 | return 1; /* Maybe the penalty should be more severe... */ |
828 | return 1; /* Maybe the penalty should be more severe... */ |
827 | } |
829 | } |
… | |
… | |
833 | * spaces that blocked the players view. |
835 | * spaces that blocked the players view. |
834 | */ |
836 | */ |
835 | |
837 | |
836 | for (dist = 0; dist < maxdist; dist++) |
838 | for (dist = 0; dist < maxdist; dist++) |
837 | { |
839 | { |
838 | mflags = get_map_flags (op->map, &m, op->x + freearr_x[dir] * (dist + 1), op->y + freearr_y[dir] * (dist + 1), &sx, &sy); |
840 | mflags = get_map_flags (op->map, &m, op->x + DIRX (dir) * (dist + 1), op->y + DIRY (dir) * (dist + 1), &sx, &sy); |
839 | |
841 | |
840 | if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) |
842 | if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) |
841 | break; |
843 | break; |
842 | |
844 | |
843 | if ((mflags & P_BLOCKSVIEW) && OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
845 | if ((mflags & P_BLOCKSVIEW) && OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
… | |
… | |
848 | /* If the destination is blocked, keep backing up until we |
850 | /* If the destination is blocked, keep backing up until we |
849 | * find a place for the player. |
851 | * find a place for the player. |
850 | */ |
852 | */ |
851 | for (; dist > 0; dist--) |
853 | for (; dist > 0; dist--) |
852 | { |
854 | { |
853 | if (get_map_flags (op->map, &m, op->x + freearr_x[dir] * dist, op->y + freearr_y[dir] * dist, |
855 | if (get_map_flags (op->map, &m, op->x + DIRX (dir) * dist, op->y + DIRY (dir) * dist, |
854 | &sx, &sy) & (P_OUT_OF_MAP | P_IS_ALIVE)) |
856 | &sx, &sy) & (P_OUT_OF_MAP | P_IS_ALIVE)) |
855 | continue; |
857 | continue; |
856 | |
858 | |
857 | |
859 | |
858 | if (!OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
860 | if (!OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
… | |
… | |
865 | return 0; |
867 | return 0; |
866 | } |
868 | } |
867 | } |
869 | } |
868 | |
870 | |
869 | /* Actually move the player now */ |
871 | /* Actually move the player now */ |
870 | if (!(op = op->map->insert (op, op->x + freearr_x[dir] * dist, op->y + freearr_y[dir] * dist, op))) |
872 | if (!(op = op->map->insert (op, op->x + DIRX (dir) * dist, op->y + DIRY (dir) * dist, op))) |
871 | return 1; |
873 | return 1; |
872 | |
874 | |
873 | op->speed_left = -5. * op->speed; /* Freeze them for a short while */ |
875 | op->speed_left = -5. * op->speed; /* Freeze them for a short while */ |
874 | |
876 | |
875 | return 1; |
877 | return 1; |
… | |
… | |
1257 | |
1259 | |
1258 | /* Alchemy code by Mark Wedel |
1260 | /* Alchemy code by Mark Wedel |
1259 | * |
1261 | * |
1260 | * This code adds a new spell, called alchemy. Alchemy will turn |
1262 | * This code adds a new spell, called alchemy. Alchemy will turn |
1261 | * objects to pyrite ("false gold"), henceforth called gold nuggets. |
1263 | * objects to pyrite ("false gold"), henceforth called gold nuggets. |
1262 | * |
1264 | * |
1263 | * The value of the gold nuggets being about 90% of that of the item |
1265 | * The value of the gold nuggets being about 90% of that of the item |
1264 | * itself. It uses the value of the object before charisma adjustments, |
1266 | * itself. It uses the value of the object before charisma adjustments, |
1265 | * because the nuggets themselves will be will be adjusted by charisma |
1267 | * because the nuggets themselves will be will be adjusted by charisma |
1266 | * when sold. |
1268 | * when sold. |
1267 | * |
1269 | * |
… | |
… | |
1369 | } |
1371 | } |
1370 | |
1372 | |
1371 | value -= rndm (value >> 4); |
1373 | value -= rndm (value >> 4); |
1372 | value = min (value, value_max); |
1374 | value = min (value, value_max); |
1373 | |
1375 | |
1374 | for (int i = 0; i < array_length (nugget); ++i) |
1376 | for (int i = 0; i < ecb_array_length (nugget); ++i) |
1375 | if (int nrof = value / nugget [i]->value) |
1377 | if (int nrof = value / nugget [i]->value) |
1376 | { |
1378 | { |
1377 | value -= nrof * nugget[i]->value; |
1379 | value -= nrof * nugget[i]->value; |
1378 | |
1380 | |
1379 | object *tmp = nugget[i]->instance (); |
1381 | object *tmp = nugget[i]->instance (); |
… | |
… | |
1767 | sint16 x, y; |
1769 | sint16 x, y; |
1768 | maptile *m; |
1770 | maptile *m; |
1769 | int mflags; |
1771 | int mflags; |
1770 | |
1772 | |
1771 | m = op->map; |
1773 | m = op->map; |
1772 | x = op->x + freearr_x[dir]; |
1774 | x = op->x + DIRX (dir); |
1773 | y = op->y + freearr_y[dir]; |
1775 | y = op->y + DIRY (dir); |
1774 | |
1776 | |
1775 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1777 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1776 | |
1778 | |
1777 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
1779 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
1778 | { |
1780 | { |
… | |
… | |
1842 | object *tmp, *head, *next; |
1844 | object *tmp, *head, *next; |
1843 | int mflags; |
1845 | int mflags; |
1844 | maptile *m; |
1846 | maptile *m; |
1845 | sint16 sx, sy; |
1847 | sint16 sx, sy; |
1846 | |
1848 | |
1847 | sx = op->x + freearr_x[dir]; |
1849 | sx = op->x + DIRX (dir); |
1848 | sy = op->y + freearr_y[dir]; |
1850 | sy = op->y + DIRY (dir); |
1849 | m = op->map; |
1851 | m = op->map; |
1850 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1852 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
1851 | if (mflags & P_OUT_OF_MAP) |
1853 | if (mflags & P_OUT_OF_MAP) |
1852 | return; |
1854 | return; |
1853 | |
1855 | |
… | |
… | |
1866 | |
1868 | |
1867 | /* don't attack our own spells */ |
1869 | /* don't attack our own spells */ |
1868 | if (tmp->owner && tmp->owner == op->owner) |
1870 | if (tmp->owner && tmp->owner == op->owner) |
1869 | continue; |
1871 | continue; |
1870 | |
1872 | |
1871 | /* Basically, if the object is magical and not counterspell, |
1873 | /* Basically, if the object is magical and not counterspell, |
1872 | * we will more or less remove the object. Don't counterspell |
1874 | * we will more or less remove the object. Don't counterspell |
1873 | * monsters either. |
1875 | * monsters either. |
1874 | */ |
1876 | */ |
1875 | |
1877 | |
1876 | if (head->attacktype & AT_MAGIC |
1878 | if (head->attacktype & AT_MAGIC |
1877 | && !(head->attacktype & AT_COUNTERSPELL) |
1879 | && !(head->attacktype & AT_COUNTERSPELL) |
1878 | && !head->flag [FLAG_MONSTER] |
1880 | && !head->flag [FLAG_MONSTER] |
… | |
… | |
1952 | |
1954 | |
1953 | op->failmsg ("You are not standing over an altar!"); |
1955 | op->failmsg ("You are not standing over an altar!"); |
1954 | return 0; |
1956 | return 0; |
1955 | } |
1957 | } |
1956 | |
1958 | |
1957 | /* animate_weapon - |
1959 | /* animate_weapon - |
1958 | * Generalization of staff_to_snake. Makes a golem out of the caster's weapon. |
1960 | * Generalization of staff_to_snake. Makes a golem out of the caster's weapon. |
1959 | * The golem is based on the archetype specified, modified by the caster's level |
1961 | * The golem is based on the archetype specified, modified by the caster's level |
1960 | * and the attributes of the weapon. The weapon is inserted in the golem's |
1962 | * and the attributes of the weapon. The weapon is inserted in the golem's |
1961 | * inventory so that it falls to the ground when the golem dies. |
1963 | * inventory so that it falls to the ground when the golem dies. |
1962 | * This code was very odd - code early on would only let players use the spell, |
1964 | * This code was very odd - code early on would only let players use the spell, |
1963 | * yet the code wass full of player checks. I've presumed that the code |
1965 | * yet the code wass full of player checks. I've presumed that the code |
1964 | * that only let players use it was correct, and removed all the other |
1966 | * that only let players use it was correct, and removed all the other |
1965 | * player checks. MSW 2003-01-06 |
1967 | * player checks. MSW 2003-01-06 |
… | |
… | |
1992 | /* if no direction specified, pick one */ |
1994 | /* if no direction specified, pick one */ |
1993 | if (!dir) |
1995 | if (!dir) |
1994 | dir = find_free_spot (spell->other_arch, op->map, op->x, op->y, 1, 9); |
1996 | dir = find_free_spot (spell->other_arch, op->map, op->x, op->y, 1, 9); |
1995 | |
1997 | |
1996 | m = op->map; |
1998 | m = op->map; |
1997 | x = op->x + freearr_x[dir]; |
1999 | x = op->x + DIRX (dir); |
1998 | y = op->y + freearr_y[dir]; |
2000 | y = op->y + DIRY (dir); |
1999 | |
2001 | |
2000 | /* if there's no place to put the golem, abort */ |
2002 | /* if there's no place to put the golem, abort */ |
2001 | if (dir < 0 || (get_map_flags (m, &m, x, y, &x, &y) & P_OUT_OF_MAP) |
2003 | if (dir < 0 || (get_map_flags (m, &m, x, y, &x, &y) & P_OUT_OF_MAP) |
2002 | || ((spell->other_arch->move_type & GET_MAP_MOVE_BLOCK (m, x, y)) == spell->other_arch->move_type)) |
2004 | || ((spell->other_arch->move_type & GET_MAP_MOVE_BLOCK (m, x, y)) == spell->other_arch->move_type)) |
2003 | { |
2005 | { |
… | |
… | |
2203 | |
2205 | |
2204 | /* move aura function. An aura is a part of someone's inventory, |
2206 | /* move aura function. An aura is a part of someone's inventory, |
2205 | * which he carries with him, but which acts on the map immediately |
2207 | * which he carries with him, but which acts on the map immediately |
2206 | * around him. |
2208 | * around him. |
2207 | * Aura parameters: |
2209 | * Aura parameters: |
2208 | * duration: duration counter. |
2210 | * duration: duration counter. |
2209 | * attacktype: aura's attacktype |
2211 | * attacktype: aura's attacktype |
2210 | * other_arch: archetype to drop where we attack |
2212 | * other_arch: archetype to drop where we attack |
2211 | */ |
2213 | */ |
2212 | void |
2214 | void |
2213 | move_aura (object *aura) |
2215 | move_aura (object *aura) |
2214 | { |
2216 | { |
2215 | /* auras belong in inventories */ |
2217 | /* auras belong in inventories */ |
2216 | object *env = aura->env; |
2218 | object *env = aura->env; |
2217 | object *owner = aura->owner; |
2219 | object *owner = aura->owner; |
2218 | |
2220 | |
2219 | /* no matter what we've gotta remove the aura... |
2221 | /* no matter what we've gotta remove the aura... |
2220 | * we'll put it back if its time isn't up. |
2222 | * we'll put it back if its time isn't up. |
2221 | */ |
2223 | */ |
2222 | aura->remove (); |
2224 | aura->remove (); |
2223 | |
2225 | |
2224 | /* exit if we're out of gas */ |
2226 | /* exit if we're out of gas */ |
2225 | if (aura->duration-- < 0) |
2227 | if (aura->duration-- < 0) |
… | |
… | |
2234 | aura->destroy (); |
2236 | aura->destroy (); |
2235 | return; |
2237 | return; |
2236 | } |
2238 | } |
2237 | |
2239 | |
2238 | /* we need to jump out of the inventory for a bit |
2240 | /* we need to jump out of the inventory for a bit |
2239 | * in order to hit the map conveniently. |
2241 | * in order to hit the map conveniently. |
2240 | */ |
2242 | */ |
2241 | aura->insert_at (env, aura); |
2243 | aura->insert_at (env, aura); |
2242 | |
2244 | |
2243 | for (int i = 1; i < 9; i++) |
2245 | for (int i = 1; i < 9; i++) |
2244 | { |
2246 | { |