… | |
… | |
74 | if (!(random_roll (0, 3, op, PREFER_HIGH))) |
74 | if (!(random_roll (0, 3, op, PREFER_HIGH))) |
75 | { |
75 | { |
76 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand)); |
76 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand)); |
77 | play_sound_map (op->map, op->x, op->y, SOUND_OB_EXPLODE); |
77 | play_sound_map (op->map, op->x, op->y, SOUND_OB_EXPLODE); |
78 | esrv_del_item (op->contr, wand->count); |
78 | esrv_del_item (op->contr, wand->count); |
79 | remove_ob (wand); |
79 | wand->remove (); |
80 | free_object (wand); |
80 | wand->destroy (0); |
81 | tmp = get_archetype ("fireball"); |
81 | tmp = get_archetype ("fireball"); |
82 | tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; |
82 | tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; |
83 | if (!tmp->stats.dam) |
83 | if (!tmp->stats.dam) |
84 | tmp->stats.dam = 1; |
84 | tmp->stats.dam = 1; |
85 | tmp->stats.hp = tmp->stats.dam / 2; |
85 | tmp->stats.hp = tmp->stats.dam / 2; |
… | |
… | |
128 | cast_create_missile (object *op, object *caster, object *spell, int dir, const char *stringarg) |
128 | cast_create_missile (object *op, object *caster, object *spell, int dir, const char *stringarg) |
129 | { |
129 | { |
130 | int missile_plus = 0, bonus_plus = 0; |
130 | int missile_plus = 0, bonus_plus = 0; |
131 | const char *missile_name; |
131 | const char *missile_name; |
132 | object *tmp, *missile; |
132 | object *tmp, *missile; |
133 | tag_t tag; |
|
|
134 | |
133 | |
135 | missile_name = "arrow"; |
134 | missile_name = "arrow"; |
136 | |
135 | |
137 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
136 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
138 | if (tmp->type == BOW && QUERY_FLAG (tmp, FLAG_APPLIED)) |
137 | if (tmp->type == BOW && QUERY_FLAG (tmp, FLAG_APPLIED)) |
139 | { |
|
|
140 | missile_name = tmp->race; |
138 | missile_name = tmp->race; |
141 | } |
|
|
142 | |
139 | |
143 | missile_plus = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
140 | missile_plus = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
144 | |
141 | |
145 | if (archetype::find (missile_name) == NULL) |
142 | if (archetype::find (missile_name) == NULL) |
146 | { |
143 | { |
147 | LOG (llevDebug, "Cast create_missile: could not find archetype %s\n", missile_name); |
144 | LOG (llevDebug, "Cast create_missile: could not find archetype %s\n", missile_name); |
148 | return 0; |
145 | return 0; |
149 | } |
146 | } |
|
|
147 | |
150 | missile = get_archetype (missile_name); |
148 | missile = get_archetype (missile_name); |
151 | |
149 | |
152 | if (stringarg) |
150 | if (stringarg) |
153 | { |
151 | { |
154 | /* If it starts with a letter, presume it is a description */ |
152 | /* If it starts with a letter, presume it is a description */ |
… | |
… | |
160 | if (!strcasecmp (al->item->name, stringarg)) |
158 | if (!strcasecmp (al->item->name, stringarg)) |
161 | break; |
159 | break; |
162 | |
160 | |
163 | if (!al) |
161 | if (!al) |
164 | { |
162 | { |
165 | free_object (missile); |
163 | missile->destroy (0); |
166 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such object %ss of %s", missile_name, stringarg); |
164 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such object %ss of %s", missile_name, stringarg); |
167 | return 0; |
165 | return 0; |
168 | } |
166 | } |
|
|
167 | |
169 | if (al->item->slaying) |
168 | if (al->item->slaying) |
170 | { |
169 | { |
171 | free_object (missile); |
170 | missile->destroy (0); |
172 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are not allowed to create %ss of %s", missile_name, stringarg); |
171 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are not allowed to create %ss of %s", missile_name, stringarg); |
173 | return 0; |
172 | return 0; |
174 | } |
173 | } |
|
|
174 | |
175 | give_artifact_abilities (missile, al->item); |
175 | give_artifact_abilities (missile, al->item); |
176 | /* These special arrows cost something extra. Don't have them also be magical - |
176 | /* These special arrows cost something extra. Don't have them also be magical - |
177 | * otherwise, in most cases, not enough will be created. I don't want to get into |
177 | * otherwise, in most cases, not enough will be created. I don't want to get into |
178 | * the parsing of having to do both plus and type. |
178 | * the parsing of having to do both plus and type. |
179 | */ |
179 | */ |
… | |
… | |
181 | missile_plus = 0; |
181 | missile_plus = 0; |
182 | } |
182 | } |
183 | else if (atoi (stringarg) < missile_plus) |
183 | else if (atoi (stringarg) < missile_plus) |
184 | missile_plus = atoi (stringarg); |
184 | missile_plus = atoi (stringarg); |
185 | } |
185 | } |
|
|
186 | |
186 | if (missile_plus > 4) |
187 | if (missile_plus > 4) |
187 | missile_plus = 4; |
188 | missile_plus = 4; |
188 | else if (missile_plus < -4) |
189 | else if (missile_plus < -4) |
189 | missile_plus = -4; |
190 | missile_plus = -4; |
190 | |
191 | |
191 | missile->nrof = spell->duration + SP_level_duration_adjust (caster, spell); |
192 | missile->nrof = spell->duration + SP_level_duration_adjust (caster, spell); |
192 | missile->nrof -= 3 * (missile_plus + bonus_plus); |
193 | missile->nrof -= 3 * (missile_plus + bonus_plus); |
|
|
194 | |
193 | if (missile->nrof < 1) |
195 | if (missile->nrof < 1) |
194 | missile->nrof = 1; |
196 | missile->nrof = 1; |
195 | |
197 | |
196 | missile->magic = missile_plus; |
198 | missile->magic = missile_plus; |
197 | /* Can't get any money for these objects */ |
199 | /* Can't get any money for these objects */ |
198 | missile->value = 0; |
200 | missile->value = 0; |
199 | |
201 | |
200 | SET_FLAG (missile, FLAG_IDENTIFIED); |
202 | SET_FLAG (missile, FLAG_IDENTIFIED); |
201 | tag = missile->count; |
|
|
202 | |
203 | |
203 | if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !was_destroyed (missile, tag)) |
204 | if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) |
204 | { |
|
|
205 | pick_up (op, missile); |
205 | pick_up (op, missile); |
206 | } |
206 | |
207 | return 1; |
207 | return 1; |
208 | } |
208 | } |
209 | |
209 | |
210 | |
210 | |
211 | /* allows the choice of what sort of food object to make. |
211 | /* allows the choice of what sort of food object to make. |
… | |
… | |
277 | int |
277 | int |
278 | probe (object *op, object *caster, object *spell_ob, int dir) |
278 | probe (object *op, object *caster, object *spell_ob, int dir) |
279 | { |
279 | { |
280 | int r, mflags, maxrange; |
280 | int r, mflags, maxrange; |
281 | object *tmp; |
281 | object *tmp; |
282 | mapstruct *m; |
282 | maptile *m; |
283 | |
283 | |
284 | |
284 | |
285 | if (!dir) |
285 | if (!dir) |
286 | { |
286 | { |
287 | examine_monster (op, op); |
287 | examine_monster (op, op); |
… | |
… | |
422 | cast_earth_to_dust (object *op, object *caster, object *spell_ob) |
422 | cast_earth_to_dust (object *op, object *caster, object *spell_ob) |
423 | { |
423 | { |
424 | object *tmp, *next; |
424 | object *tmp, *next; |
425 | int range, i, j, mflags; |
425 | int range, i, j, mflags; |
426 | sint16 sx, sy; |
426 | sint16 sx, sy; |
427 | mapstruct *m; |
427 | maptile *m; |
428 | |
428 | |
429 | if (op->type != PLAYER) |
429 | if (op->type != PLAYER) |
430 | return 0; |
430 | return 0; |
431 | |
431 | |
432 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
432 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
… | |
… | |
461 | |
461 | |
462 | while (op != NULL && op->type != PLAYER) |
462 | while (op != NULL && op->type != PLAYER) |
463 | op = op->env; |
463 | op = op->env; |
464 | |
464 | |
465 | if (op != NULL && op->map) |
465 | if (op != NULL && op->map) |
466 | { |
|
|
467 | if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) |
466 | if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) |
468 | new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); |
467 | new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); |
469 | else |
468 | else |
470 | enter_exit (op, wor); |
469 | enter_exit (op, wor); |
471 | } |
470 | |
472 | remove_ob (wor); |
471 | wor->remove (); |
473 | free_object (wor); |
472 | wor->destroy (0); |
474 | } |
473 | } |
475 | |
474 | |
476 | /* Word of recall causes the player to return 'home'. |
475 | /* Word of recall causes the player to return 'home'. |
477 | * we put a force into the player object, so that there is a |
476 | * we put a force into the player object, so that there is a |
478 | * time delay effect. |
477 | * time delay effect. |
… | |
… | |
641 | { |
640 | { |
642 | object *dummy, *force, *old_force, *tmp; |
641 | object *dummy, *force, *old_force, *tmp; |
643 | archetype *perm_portal; |
642 | archetype *perm_portal; |
644 | char portal_name[1024], portal_message[1024]; |
643 | char portal_name[1024], portal_message[1024]; |
645 | sint16 exitx, exity; |
644 | sint16 exitx, exity; |
646 | mapstruct *exitmap; |
645 | maptile *exitmap; |
647 | int op_level; |
646 | int op_level; |
648 | |
647 | |
649 | |
648 | |
650 | /* Check to see if the map the player is currently on is a per player unique |
649 | /* Check to see if the map the player is currently on is a per player unique |
651 | * map. This can be determined in that per player unique maps have the |
650 | * map. This can be determined in that per player unique maps have the |
… | |
… | |
681 | EXIT_Y (dummy) = op->y; |
680 | EXIT_Y (dummy) = op->y; |
682 | insert_ob_in_ob (dummy, op); |
681 | insert_ob_in_ob (dummy, op); |
683 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You fix this place in your mind.\nYou feel you are able to come here from anywhere."); |
682 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You fix this place in your mind.\nYou feel you are able to come here from anywhere."); |
684 | return 1; |
683 | return 1; |
685 | } |
684 | } |
686 | free_object (dummy); |
685 | dummy->destroy (0); |
687 | |
686 | |
688 | /* Here we know where the town portal should go to |
687 | /* Here we know where the town portal should go to |
689 | * We should kill any existing portal associated with the player. |
688 | * We should kill any existing portal associated with the player. |
690 | * Than we should create the 2 portals. |
689 | * Than we should create the 2 portals. |
691 | * For each of them, we need: |
690 | * For each of them, we need: |
… | |
… | |
734 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
733 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
735 | while (tmp) |
734 | while (tmp) |
736 | { |
735 | { |
737 | if (tmp->name == old_force->name) |
736 | if (tmp->name == old_force->name) |
738 | { |
737 | { |
739 | remove_ob (tmp); |
738 | tmp->remove (); |
740 | free_object (tmp); |
739 | tmp->destroy (0); |
741 | break; |
740 | break; |
742 | } |
741 | } |
743 | else |
742 | else |
744 | { |
743 | { |
745 | tmp = tmp->above; |
744 | tmp = tmp->above; |
746 | } |
745 | } |
747 | } |
746 | } |
748 | } |
747 | } |
749 | remove_ob (old_force); |
748 | old_force->remove (); |
750 | free_object (old_force); |
749 | old_force->destroy (0); |
751 | LOG (llevDebug, "\n"); |
750 | LOG (llevDebug, "\n"); |
752 | } |
751 | } |
753 | free_object (dummy); |
752 | dummy->destroy (0); |
754 | |
753 | |
755 | /* Creating the portals. |
754 | /* Creating the portals. |
756 | * The very first thing to do is to ensure |
755 | * The very first thing to do is to ensure |
757 | * access to the destination map. |
756 | * access to the destination map. |
758 | * If we can't, don't fizzle. Simply warn player. |
757 | * If we can't, don't fizzle. Simply warn player. |
… | |
… | |
770 | |
769 | |
771 | /* If we were unable to load (ex. random map deleted), warn player */ |
770 | /* If we were unable to load (ex. random map deleted), warn player */ |
772 | if (exitmap == NULL) |
771 | if (exitmap == NULL) |
773 | { |
772 | { |
774 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
773 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
775 | remove_ob (force); |
774 | force->remove (); |
776 | free_object (force); |
775 | force->destroy (0); |
777 | return 1; |
776 | return 1; |
778 | } |
777 | } |
779 | |
778 | |
780 | op_level = caster_level (caster, spell); |
779 | op_level = caster_level (caster, spell); |
781 | if (op_level < 15) |
780 | if (op_level < 15) |
… | |
… | |
870 | insert_ob_in_ob (tmp, op); |
869 | insert_ob_in_ob (tmp, op); |
871 | |
870 | |
872 | /* Describe the player what happened |
871 | /* Describe the player what happened |
873 | */ |
872 | */ |
874 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You see air moving and showing you the way home."); |
873 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You see air moving and showing you the way home."); |
875 | remove_ob (force); /* Delete the force inside the player */ |
874 | force->remove (); /* Delete the force inside the player */ |
876 | free_object (force); |
875 | force->destroy (0); |
877 | return 1; |
876 | return 1; |
878 | } |
877 | } |
879 | |
878 | |
880 | |
879 | |
881 | /* This creates magic walls. Really, it can create most any object, |
880 | /* This creates magic walls. Really, it can create most any object, |
… | |
… | |
886 | magic_wall (object *op, object *caster, int dir, object *spell_ob) |
885 | magic_wall (object *op, object *caster, int dir, object *spell_ob) |
887 | { |
886 | { |
888 | object *tmp, *tmp2; |
887 | object *tmp, *tmp2; |
889 | int i, posblocked, negblocked, maxrange; |
888 | int i, posblocked, negblocked, maxrange; |
890 | sint16 x, y; |
889 | sint16 x, y; |
891 | mapstruct *m; |
890 | maptile *m; |
892 | const char *name; |
891 | const char *name; |
893 | archetype *at; |
892 | archetype *at; |
894 | |
893 | |
895 | if (!dir) |
894 | if (!dir) |
896 | { |
895 | { |
… | |
… | |
1046 | int |
1045 | int |
1047 | dimension_door (object *op, object *caster, object *spob, int dir) |
1046 | dimension_door (object *op, object *caster, object *spob, int dir) |
1048 | { |
1047 | { |
1049 | uint32 dist, maxdist; |
1048 | uint32 dist, maxdist; |
1050 | int mflags; |
1049 | int mflags; |
1051 | mapstruct *m; |
1050 | maptile *m; |
1052 | sint16 sx, sy; |
1051 | sint16 sx, sy; |
1053 | |
1052 | |
1054 | if (op->type != PLAYER) |
1053 | if (op->type != PLAYER) |
1055 | return 0; |
1054 | return 0; |
1056 | |
1055 | |
… | |
… | |
1146 | return 0; |
1145 | return 0; |
1147 | } |
1146 | } |
1148 | } |
1147 | } |
1149 | |
1148 | |
1150 | /* Actually move the player now */ |
1149 | /* Actually move the player now */ |
1151 | remove_ob (op); |
1150 | op->remove (); |
1152 | op->x += freearr_x[dir] * dist; |
1151 | op->x += freearr_x[dir] * dist; |
1153 | op->y += freearr_y[dir] * dist; |
1152 | op->y += freearr_y[dir] * dist; |
1154 | if ((op = insert_ob_in_map (op, op->map, op, 0)) == NULL) |
1153 | if ((op = insert_ob_in_map (op, op->map, op, 0)) == NULL) |
1155 | return 1; |
1154 | return 1; |
1156 | |
1155 | |
… | |
… | |
1622 | *small_nuggets -= large->value / small->value; |
1621 | *small_nuggets -= large->value / small->value; |
1623 | if (*small_nuggets && large->value % small->value) |
1622 | if (*small_nuggets && large->value % small->value) |
1624 | (*small_nuggets)--; |
1623 | (*small_nuggets)--; |
1625 | } |
1624 | } |
1626 | weight += obj->weight; |
1625 | weight += obj->weight; |
1627 | remove_ob (obj); |
1626 | obj->remove (); |
1628 | free_object (obj); |
1627 | obj->destroy (0); |
1629 | } |
1628 | } |
1630 | |
1629 | |
1631 | static void |
1630 | static void |
1632 | update_map (object *op, mapstruct *m, int small_nuggets, int large_nuggets, int x, int y) |
1631 | update_map (object *op, maptile *m, int small_nuggets, int large_nuggets, int x, int y) |
1633 | { |
1632 | { |
1634 | object *tmp; |
1633 | object *tmp; |
1635 | int flag = 0; |
1634 | int flag = 0; |
1636 | |
1635 | |
1637 | /* Put any nuggets below the player, but we can only pass this |
1636 | /* Put any nuggets below the player, but we can only pass this |
… | |
… | |
1664 | alchemy (object *op, object *caster, object *spell_ob) |
1663 | alchemy (object *op, object *caster, object *spell_ob) |
1665 | { |
1664 | { |
1666 | int x, y, weight = 0, weight_max, large_nuggets, small_nuggets, mflags; |
1665 | int x, y, weight = 0, weight_max, large_nuggets, small_nuggets, mflags; |
1667 | sint16 nx, ny; |
1666 | sint16 nx, ny; |
1668 | object *next, *tmp; |
1667 | object *next, *tmp; |
1669 | mapstruct *mp; |
1668 | maptile *mp; |
1670 | |
1669 | |
1671 | if (op->type != PLAYER) |
1670 | if (op->type != PLAYER) |
1672 | return 0; |
1671 | return 0; |
1673 | |
1672 | |
1674 | /* Put a maximum weight of items that can be alchemied. Limits the power |
1673 | /* Put a maximum weight of items that can be alchemied. Limits the power |
… | |
… | |
1725 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1724 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1726 | |
1725 | |
1727 | if (weight > weight_max) |
1726 | if (weight > weight_max) |
1728 | { |
1727 | { |
1729 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1728 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1730 | free_object (large); |
1729 | large->destroy (0); |
1731 | free_object (small); |
1730 | small->destroy (0); |
1732 | return 1; |
1731 | return 1; |
1733 | } |
1732 | } |
1734 | } /* is alchemable object */ |
1733 | } /* is alchemable object */ |
1735 | } /* process all objects on this space */ |
1734 | } /* process all objects on this space */ |
1736 | |
1735 | |
… | |
… | |
1739 | * with this spell. |
1738 | * with this spell. |
1740 | */ |
1739 | */ |
1741 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1740 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1742 | } |
1741 | } |
1743 | } |
1742 | } |
1744 | free_object (large); |
1743 | large->destroy (0); |
1745 | free_object (small); |
1744 | small->destroy (0); |
1746 | /* reset this so that if player standing on a big pile of stuff, |
1745 | /* reset this so that if player standing on a big pile of stuff, |
1747 | * it is redrawn properly. |
1746 | * it is redrawn properly. |
1748 | */ |
1747 | */ |
1749 | op->contr->socket.look_position = 0; |
1748 | op->contr->socket.look_position = 0; |
1750 | return 1; |
1749 | return 1; |
… | |
… | |
1873 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1872 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1874 | { |
1873 | { |
1875 | object *tmp, *last, *god, *detect; |
1874 | object *tmp, *last, *god, *detect; |
1876 | int done_one, range, mflags, floor, level; |
1875 | int done_one, range, mflags, floor, level; |
1877 | sint16 x, y, nx, ny; |
1876 | sint16 x, y, nx, ny; |
1878 | mapstruct *m; |
1877 | maptile *m; |
1879 | |
1878 | |
1880 | /* We precompute some values here so that we don't have to keep |
1879 | /* We precompute some values here so that we don't have to keep |
1881 | * doing it over and over again. |
1880 | * doing it over and over again. |
1882 | */ |
1881 | */ |
1883 | god = find_god (determine_god (op)); |
1882 | god = find_god (determine_god (op)); |
… | |
… | |
2101 | int |
2100 | int |
2102 | cast_transfer (object *op, object *caster, object *spell, int dir) |
2101 | cast_transfer (object *op, object *caster, object *spell, int dir) |
2103 | { |
2102 | { |
2104 | object *plyr = NULL; |
2103 | object *plyr = NULL; |
2105 | sint16 x, y; |
2104 | sint16 x, y; |
2106 | mapstruct *m; |
2105 | maptile *m; |
2107 | int mflags; |
2106 | int mflags; |
2108 | |
2107 | |
2109 | m = op->map; |
2108 | m = op->map; |
2110 | x = op->x + freearr_x[dir]; |
2109 | x = op->x + freearr_x[dir]; |
2111 | y = op->y + freearr_y[dir]; |
2110 | y = op->y + freearr_y[dir]; |
… | |
… | |
2177 | void |
2176 | void |
2178 | counterspell (object *op, int dir) |
2177 | counterspell (object *op, int dir) |
2179 | { |
2178 | { |
2180 | object *tmp, *head, *next; |
2179 | object *tmp, *head, *next; |
2181 | int mflags; |
2180 | int mflags; |
2182 | mapstruct *m; |
2181 | maptile *m; |
2183 | sint16 sx, sy; |
2182 | sint16 sx, sy; |
2184 | |
2183 | |
2185 | sx = op->x + freearr_x[dir]; |
2184 | sx = op->x + freearr_x[dir]; |
2186 | sy = op->y + freearr_y[dir]; |
2185 | sy = op->y + freearr_y[dir]; |
2187 | m = op->map; |
2186 | m = op->map; |
… | |
… | |
2212 | */ |
2211 | */ |
2213 | |
2212 | |
2214 | if (head->attacktype & AT_MAGIC && |
2213 | if (head->attacktype & AT_MAGIC && |
2215 | !(head->attacktype & AT_COUNTERSPELL) && !QUERY_FLAG (head, FLAG_MONSTER) && (op->level > head->level)) |
2214 | !(head->attacktype & AT_COUNTERSPELL) && !QUERY_FLAG (head, FLAG_MONSTER) && (op->level > head->level)) |
2216 | { |
2215 | { |
2217 | remove_ob (head); |
2216 | head->remove (); |
2218 | free_object (head); |
2217 | head->destroy (0); |
2219 | } |
2218 | } |
2220 | else |
2219 | else |
2221 | switch (head->type) |
2220 | switch (head->type) |
2222 | { |
2221 | { |
2223 | case SPELL_EFFECT: |
2222 | case SPELL_EFFECT: |
2224 | if (op->level > head->level) |
2223 | if (op->level > head->level) |
2225 | { |
2224 | { |
2226 | remove_ob (head); |
2225 | head->remove (); |
2227 | free_object (head); |
2226 | head->destroy (0); |
2228 | } |
2227 | } |
2229 | break; |
2228 | break; |
2230 | |
2229 | |
2231 | /* I really don't get this rune code that much - that |
2230 | /* I really don't get this rune code that much - that |
2232 | * random chance seems really low. |
2231 | * random chance seems really low. |
… | |
… | |
2235 | if (rndm (0, 149) == 0) |
2234 | if (rndm (0, 149) == 0) |
2236 | { |
2235 | { |
2237 | head->stats.hp--; /* weaken the rune */ |
2236 | head->stats.hp--; /* weaken the rune */ |
2238 | if (!head->stats.hp) |
2237 | if (!head->stats.hp) |
2239 | { |
2238 | { |
2240 | remove_ob (head); |
2239 | head->remove (); |
2241 | free_object (head); |
2240 | head->destroy (0); |
2242 | } |
2241 | } |
2243 | } |
2242 | } |
2244 | break; |
2243 | break; |
2245 | } |
2244 | } |
2246 | } |
2245 | } |
… | |
… | |
2308 | { |
2307 | { |
2309 | object *weapon, *tmp; |
2308 | object *weapon, *tmp; |
2310 | char buf[MAX_BUF]; |
2309 | char buf[MAX_BUF]; |
2311 | int a, i; |
2310 | int a, i; |
2312 | sint16 x, y; |
2311 | sint16 x, y; |
2313 | mapstruct *m; |
2312 | maptile *m; |
2314 | materialtype_t *mt; |
2313 | materialtype_t *mt; |
2315 | |
2314 | |
2316 | if (!spell->other_arch) |
2315 | if (!spell->other_arch) |
2317 | { |
2316 | { |
2318 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
2317 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
… | |
… | |
2322 | /* exit if it's not a player using this spell. */ |
2321 | /* exit if it's not a player using this spell. */ |
2323 | if (op->type != PLAYER) |
2322 | if (op->type != PLAYER) |
2324 | return 0; |
2323 | return 0; |
2325 | |
2324 | |
2326 | /* if player already has a golem, abort */ |
2325 | /* if player already has a golem, abort */ |
2327 | if (op->contr->ranges[range_golem] != NULL && op->contr->golem_count == op->contr->ranges[range_golem]->count) |
2326 | if (op->contr->ranges[range_golem]) |
2328 | { |
2327 | { |
2329 | control_golem (op->contr->ranges[range_golem], dir); |
2328 | control_golem (op->contr->ranges[range_golem], dir); |
2330 | return 0; |
2329 | return 0; |
2331 | } |
2330 | } |
2332 | |
2331 | |
… | |
… | |
2388 | tmp->type = GOLEM; |
2387 | tmp->type = GOLEM; |
2389 | set_owner (tmp, op); |
2388 | set_owner (tmp, op); |
2390 | set_spell_skill (op, caster, spell, tmp); |
2389 | set_spell_skill (op, caster, spell, tmp); |
2391 | op->contr->ranges[range_golem] = tmp; |
2390 | op->contr->ranges[range_golem] = tmp; |
2392 | op->contr->shoottype = range_golem; |
2391 | op->contr->shoottype = range_golem; |
2393 | op->contr->golem_count = tmp->count; |
|
|
2394 | |
2392 | |
2395 | /* Give the weapon to the golem now. A bit of a hack to check the |
2393 | /* Give the weapon to the golem now. A bit of a hack to check the |
2396 | * removed flag - it should only be set if get_split_object was |
2394 | * removed flag - it should only be set if get_split_object was |
2397 | * used above. |
2395 | * used above. |
2398 | */ |
2396 | */ |
2399 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2397 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2400 | remove_ob (weapon); |
2398 | weapon->remove (); |
2401 | insert_ob_in_ob (weapon, tmp); |
2399 | insert_ob_in_ob (weapon, tmp); |
2402 | esrv_send_item (op, weapon); |
2400 | esrv_send_item (op, weapon); |
2403 | /* To do everything necessary to let a golem use the weapon is a pain, |
2401 | /* To do everything necessary to let a golem use the weapon is a pain, |
2404 | * so instead, just set it as equipped (otherwise, we need to update |
2402 | * so instead, just set it as equipped (otherwise, we need to update |
2405 | * body_info, skills, etc) |
2403 | * body_info, skills, etc) |
… | |
… | |
2580 | void |
2578 | void |
2581 | move_aura (object *aura) |
2579 | move_aura (object *aura) |
2582 | { |
2580 | { |
2583 | int i, mflags; |
2581 | int i, mflags; |
2584 | object *env; |
2582 | object *env; |
2585 | mapstruct *m; |
2583 | maptile *m; |
2586 | |
2584 | |
2587 | /* auras belong in inventories */ |
2585 | /* auras belong in inventories */ |
2588 | env = aura->env; |
2586 | env = aura->env; |
2589 | |
2587 | |
2590 | /* no matter what we've gotta remove the aura... |
2588 | /* no matter what we've gotta remove the aura... |
2591 | * we'll put it back if its time isn't up. |
2589 | * we'll put it back if its time isn't up. |
2592 | */ |
2590 | */ |
2593 | remove_ob (aura); |
2591 | aura->remove (); |
2594 | |
2592 | |
2595 | /* exit if we're out of gas */ |
2593 | /* exit if we're out of gas */ |
2596 | if (aura->duration-- < 0) |
2594 | if (aura->duration-- < 0) |
2597 | { |
2595 | { |
2598 | free_object (aura); |
2596 | aura->destroy (0); |
2599 | return; |
2597 | return; |
2600 | } |
2598 | } |
2601 | |
2599 | |
2602 | /* auras only exist in inventories */ |
2600 | /* auras only exist in inventories */ |
2603 | if (env == NULL || env->map == NULL) |
2601 | if (env == NULL || env->map == NULL) |
2604 | { |
2602 | { |
2605 | free_object (aura); |
2603 | aura->destroy (0); |
2606 | return; |
2604 | return; |
2607 | } |
2605 | } |
2608 | aura->x = env->x; |
2606 | aura->x = env->x; |
2609 | aura->y = env->y; |
2607 | aura->y = env->y; |
2610 | |
2608 | |
… | |
… | |
2639 | insert_ob_in_map (new_ob, m, aura, 0); |
2637 | insert_ob_in_map (new_ob, m, aura, 0); |
2640 | } |
2638 | } |
2641 | } |
2639 | } |
2642 | } |
2640 | } |
2643 | /* put the aura back in the player's inventory */ |
2641 | /* put the aura back in the player's inventory */ |
2644 | remove_ob (aura); |
2642 | aura->remove (); |
2645 | insert_ob_in_ob (aura, env); |
2643 | insert_ob_in_ob (aura, env); |
2646 | } |
2644 | } |
2647 | |
2645 | |
2648 | /* moves the peacemaker spell. |
2646 | /* moves the peacemaker spell. |
2649 | * op is the piece object. |
2647 | * op is the piece object. |