… | |
… | |
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; |
… | |
… | |
158 | if (!strcasecmp (al->item->name, stringarg)) |
158 | if (!strcasecmp (al->item->name, stringarg)) |
159 | break; |
159 | break; |
160 | |
160 | |
161 | if (!al) |
161 | if (!al) |
162 | { |
162 | { |
163 | free_object (missile); |
163 | missile->destroy (0); |
164 | 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); |
165 | return 0; |
165 | return 0; |
166 | } |
166 | } |
167 | |
167 | |
168 | if (al->item->slaying) |
168 | if (al->item->slaying) |
169 | { |
169 | { |
170 | free_object (missile); |
170 | missile->destroy (0); |
171 | 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); |
172 | return 0; |
172 | return 0; |
173 | } |
173 | } |
174 | |
174 | |
175 | give_artifact_abilities (missile, al->item); |
175 | give_artifact_abilities (missile, al->item); |
… | |
… | |
466 | 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))) |
467 | 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."); |
468 | else |
468 | else |
469 | enter_exit (op, wor); |
469 | enter_exit (op, wor); |
470 | |
470 | |
471 | remove_ob (wor); |
471 | wor->remove (); |
472 | free_object (wor); |
472 | wor->destroy (0); |
473 | } |
473 | } |
474 | |
474 | |
475 | /* Word of recall causes the player to return 'home'. |
475 | /* Word of recall causes the player to return 'home'. |
476 | * 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 |
477 | * time delay effect. |
477 | * time delay effect. |
… | |
… | |
680 | EXIT_Y (dummy) = op->y; |
680 | EXIT_Y (dummy) = op->y; |
681 | insert_ob_in_ob (dummy, op); |
681 | insert_ob_in_ob (dummy, op); |
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."); |
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."); |
683 | return 1; |
683 | return 1; |
684 | } |
684 | } |
685 | free_object (dummy); |
685 | dummy->destroy (0); |
686 | |
686 | |
687 | /* Here we know where the town portal should go to |
687 | /* Here we know where the town portal should go to |
688 | * We should kill any existing portal associated with the player. |
688 | * We should kill any existing portal associated with the player. |
689 | * Than we should create the 2 portals. |
689 | * Than we should create the 2 portals. |
690 | * For each of them, we need: |
690 | * For each of them, we need: |
… | |
… | |
733 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
733 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
734 | while (tmp) |
734 | while (tmp) |
735 | { |
735 | { |
736 | if (tmp->name == old_force->name) |
736 | if (tmp->name == old_force->name) |
737 | { |
737 | { |
738 | remove_ob (tmp); |
738 | tmp->remove (); |
739 | free_object (tmp); |
739 | tmp->destroy (0); |
740 | break; |
740 | break; |
741 | } |
741 | } |
742 | else |
742 | else |
743 | { |
743 | { |
744 | tmp = tmp->above; |
744 | tmp = tmp->above; |
745 | } |
745 | } |
746 | } |
746 | } |
747 | } |
747 | } |
748 | remove_ob (old_force); |
748 | old_force->remove (); |
749 | free_object (old_force); |
749 | old_force->destroy (0); |
750 | LOG (llevDebug, "\n"); |
750 | LOG (llevDebug, "\n"); |
751 | } |
751 | } |
752 | free_object (dummy); |
752 | dummy->destroy (0); |
753 | |
753 | |
754 | /* Creating the portals. |
754 | /* Creating the portals. |
755 | * The very first thing to do is to ensure |
755 | * The very first thing to do is to ensure |
756 | * access to the destination map. |
756 | * access to the destination map. |
757 | * If we can't, don't fizzle. Simply warn player. |
757 | * If we can't, don't fizzle. Simply warn player. |
… | |
… | |
769 | |
769 | |
770 | /* 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 */ |
771 | if (exitmap == NULL) |
771 | if (exitmap == NULL) |
772 | { |
772 | { |
773 | 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!?"); |
774 | remove_ob (force); |
774 | force->remove (); |
775 | free_object (force); |
775 | force->destroy (0); |
776 | return 1; |
776 | return 1; |
777 | } |
777 | } |
778 | |
778 | |
779 | op_level = caster_level (caster, spell); |
779 | op_level = caster_level (caster, spell); |
780 | if (op_level < 15) |
780 | if (op_level < 15) |
… | |
… | |
869 | insert_ob_in_ob (tmp, op); |
869 | insert_ob_in_ob (tmp, op); |
870 | |
870 | |
871 | /* Describe the player what happened |
871 | /* Describe the player what happened |
872 | */ |
872 | */ |
873 | 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."); |
874 | remove_ob (force); /* Delete the force inside the player */ |
874 | force->remove (); /* Delete the force inside the player */ |
875 | free_object (force); |
875 | force->destroy (0); |
876 | return 1; |
876 | return 1; |
877 | } |
877 | } |
878 | |
878 | |
879 | |
879 | |
880 | /* This creates magic walls. Really, it can create most any object, |
880 | /* This creates magic walls. Really, it can create most any object, |
… | |
… | |
1145 | return 0; |
1145 | return 0; |
1146 | } |
1146 | } |
1147 | } |
1147 | } |
1148 | |
1148 | |
1149 | /* Actually move the player now */ |
1149 | /* Actually move the player now */ |
1150 | remove_ob (op); |
1150 | op->remove (); |
1151 | op->x += freearr_x[dir] * dist; |
1151 | op->x += freearr_x[dir] * dist; |
1152 | op->y += freearr_y[dir] * dist; |
1152 | op->y += freearr_y[dir] * dist; |
1153 | 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) |
1154 | return 1; |
1154 | return 1; |
1155 | |
1155 | |
… | |
… | |
1621 | *small_nuggets -= large->value / small->value; |
1621 | *small_nuggets -= large->value / small->value; |
1622 | if (*small_nuggets && large->value % small->value) |
1622 | if (*small_nuggets && large->value % small->value) |
1623 | (*small_nuggets)--; |
1623 | (*small_nuggets)--; |
1624 | } |
1624 | } |
1625 | weight += obj->weight; |
1625 | weight += obj->weight; |
1626 | remove_ob (obj); |
1626 | obj->remove (); |
1627 | free_object (obj); |
1627 | obj->destroy (0); |
1628 | } |
1628 | } |
1629 | |
1629 | |
1630 | static void |
1630 | static void |
1631 | update_map (object *op, maptile *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) |
1632 | { |
1632 | { |
… | |
… | |
1724 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1724 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1725 | |
1725 | |
1726 | if (weight > weight_max) |
1726 | if (weight > weight_max) |
1727 | { |
1727 | { |
1728 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1728 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1729 | free_object (large); |
1729 | large->destroy (0); |
1730 | free_object (small); |
1730 | small->destroy (0); |
1731 | return 1; |
1731 | return 1; |
1732 | } |
1732 | } |
1733 | } /* is alchemable object */ |
1733 | } /* is alchemable object */ |
1734 | } /* process all objects on this space */ |
1734 | } /* process all objects on this space */ |
1735 | |
1735 | |
… | |
… | |
1738 | * with this spell. |
1738 | * with this spell. |
1739 | */ |
1739 | */ |
1740 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1740 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1741 | } |
1741 | } |
1742 | } |
1742 | } |
1743 | free_object (large); |
1743 | large->destroy (0); |
1744 | free_object (small); |
1744 | small->destroy (0); |
1745 | /* 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, |
1746 | * it is redrawn properly. |
1746 | * it is redrawn properly. |
1747 | */ |
1747 | */ |
1748 | op->contr->socket.look_position = 0; |
1748 | op->contr->socket.look_position = 0; |
1749 | return 1; |
1749 | return 1; |
… | |
… | |
2211 | */ |
2211 | */ |
2212 | |
2212 | |
2213 | if (head->attacktype & AT_MAGIC && |
2213 | if (head->attacktype & AT_MAGIC && |
2214 | !(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)) |
2215 | { |
2215 | { |
2216 | remove_ob (head); |
2216 | head->remove (); |
2217 | free_object (head); |
2217 | head->destroy (0); |
2218 | } |
2218 | } |
2219 | else |
2219 | else |
2220 | switch (head->type) |
2220 | switch (head->type) |
2221 | { |
2221 | { |
2222 | case SPELL_EFFECT: |
2222 | case SPELL_EFFECT: |
2223 | if (op->level > head->level) |
2223 | if (op->level > head->level) |
2224 | { |
2224 | { |
2225 | remove_ob (head); |
2225 | head->remove (); |
2226 | free_object (head); |
2226 | head->destroy (0); |
2227 | } |
2227 | } |
2228 | break; |
2228 | break; |
2229 | |
2229 | |
2230 | /* I really don't get this rune code that much - that |
2230 | /* I really don't get this rune code that much - that |
2231 | * random chance seems really low. |
2231 | * random chance seems really low. |
… | |
… | |
2234 | if (rndm (0, 149) == 0) |
2234 | if (rndm (0, 149) == 0) |
2235 | { |
2235 | { |
2236 | head->stats.hp--; /* weaken the rune */ |
2236 | head->stats.hp--; /* weaken the rune */ |
2237 | if (!head->stats.hp) |
2237 | if (!head->stats.hp) |
2238 | { |
2238 | { |
2239 | remove_ob (head); |
2239 | head->remove (); |
2240 | free_object (head); |
2240 | head->destroy (0); |
2241 | } |
2241 | } |
2242 | } |
2242 | } |
2243 | break; |
2243 | break; |
2244 | } |
2244 | } |
2245 | } |
2245 | } |
… | |
… | |
2393 | /* 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 |
2394 | * 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 |
2395 | * used above. |
2395 | * used above. |
2396 | */ |
2396 | */ |
2397 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2397 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2398 | remove_ob (weapon); |
2398 | weapon->remove (); |
2399 | insert_ob_in_ob (weapon, tmp); |
2399 | insert_ob_in_ob (weapon, tmp); |
2400 | esrv_send_item (op, weapon); |
2400 | esrv_send_item (op, weapon); |
2401 | /* 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, |
2402 | * 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 |
2403 | * body_info, skills, etc) |
2403 | * body_info, skills, etc) |
… | |
… | |
2586 | env = aura->env; |
2586 | env = aura->env; |
2587 | |
2587 | |
2588 | /* no matter what we've gotta remove the aura... |
2588 | /* no matter what we've gotta remove the aura... |
2589 | * we'll put it back if its time isn't up. |
2589 | * we'll put it back if its time isn't up. |
2590 | */ |
2590 | */ |
2591 | remove_ob (aura); |
2591 | aura->remove (); |
2592 | |
2592 | |
2593 | /* exit if we're out of gas */ |
2593 | /* exit if we're out of gas */ |
2594 | if (aura->duration-- < 0) |
2594 | if (aura->duration-- < 0) |
2595 | { |
2595 | { |
2596 | free_object (aura); |
2596 | aura->destroy (0); |
2597 | return; |
2597 | return; |
2598 | } |
2598 | } |
2599 | |
2599 | |
2600 | /* auras only exist in inventories */ |
2600 | /* auras only exist in inventories */ |
2601 | if (env == NULL || env->map == NULL) |
2601 | if (env == NULL || env->map == NULL) |
2602 | { |
2602 | { |
2603 | free_object (aura); |
2603 | aura->destroy (0); |
2604 | return; |
2604 | return; |
2605 | } |
2605 | } |
2606 | aura->x = env->x; |
2606 | aura->x = env->x; |
2607 | aura->y = env->y; |
2607 | aura->y = env->y; |
2608 | |
2608 | |
… | |
… | |
2637 | insert_ob_in_map (new_ob, m, aura, 0); |
2637 | insert_ob_in_map (new_ob, m, aura, 0); |
2638 | } |
2638 | } |
2639 | } |
2639 | } |
2640 | } |
2640 | } |
2641 | /* put the aura back in the player's inventory */ |
2641 | /* put the aura back in the player's inventory */ |
2642 | remove_ob (aura); |
2642 | aura->remove (); |
2643 | insert_ob_in_ob (aura, env); |
2643 | insert_ob_in_ob (aura, env); |
2644 | } |
2644 | } |
2645 | |
2645 | |
2646 | /* moves the peacemaker spell. |
2646 | /* moves the peacemaker spell. |
2647 | * op is the piece object. |
2647 | * op is the piece object. |