ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_effect.C
(Generate patch)

Comparing deliantra/server/server/spell_effect.C (file contents):
Revision 1.13 by root, Sat Sep 16 22:24:13 2006 UTC vs.
Revision 1.16 by root, Tue Dec 12 20:53:03 2006 UTC

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);
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.
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,
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
1631static void 1630static void
1632update_map (object *op, maptile *m, int small_nuggets, int large_nuggets, int x, int y) 1631update_map (object *op, maptile *m, int small_nuggets, int large_nuggets, int x, int y)
1633{ 1632{
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;
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 }
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)
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.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines