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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.69 by root, Tue Dec 26 17:39:30 2006 UTC vs.
Revision 1.70 by root, Tue Dec 26 20:04:09 2006 UTC

1668 return 0; 1668 return 0;
1669 } 1669 }
1670 1670
1671 arrow->set_owner (op); 1671 arrow->set_owner (op);
1672 arrow->skill = bow->skill; 1672 arrow->skill = bow->skill;
1673
1674 arrow->direction = dir; 1673 arrow->direction = dir;
1675 arrow->x = sx;
1676 arrow->y = sy;
1677 1674
1678 if (op->type == PLAYER) 1675 if (op->type == PLAYER)
1679 { 1676 {
1680 op->speed_left = 0.01 - (float) FABS (op->speed) * 100 / bowspeed; 1677 op->speed_left = 0.01 - (float) FABS (op->speed) * 100 / bowspeed;
1681 op->update_stats (); 1678 op->update_stats ();
1719 arrow->attacktype |= bow->attacktype; 1716 arrow->attacktype |= bow->attacktype;
1720 1717
1721 if (bow->slaying) 1718 if (bow->slaying)
1722 arrow->slaying = bow->slaying; 1719 arrow->slaying = bow->slaying;
1723 1720
1724 arrow->map = m;
1725 arrow->move_type = MOVE_FLY_LOW; 1721 arrow->move_type = MOVE_FLY_LOW;
1726 arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; 1722 arrow->move_on = MOVE_FLY_LOW | MOVE_WALK;
1727 1723
1728 play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW); 1724 play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW);
1729 insert_ob_in_map (arrow, m, op, 0); 1725 m->insert (arrow, sx, sy, op);
1730 1726
1731 if (!arrow->destroyed ()) 1727 if (!arrow->destroyed ())
1732 move_arrow (arrow); 1728 move_arrow (arrow);
1733 1729
1734 if (op->type == PLAYER) 1730 if (op->type == PLAYER)
2413{ 2409{
2414 object *next; 2410 object *next;
2415 2411
2416 while (op) 2412 while (op)
2417 { 2413 {
2418 next = op->below; /* Make sure we have a good value, in case 2414 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */
2419 * we remove object 'op' 2415
2420 */
2421 if (QUERY_FLAG (op, FLAG_UNPAID)) 2416 if (QUERY_FLAG (op, FLAG_UNPAID))
2422 { 2417 {
2423 op->remove ();
2424 op->x = env->x;
2425 op->y = env->y;
2426 if (env->type == PLAYER) 2418 if (env->type == PLAYER)
2427 esrv_del_item (env->contr, op->count); 2419 esrv_del_item (env->contr, op->count);
2428 insert_ob_in_map (op, env->map, NULL, 0); 2420
2421 op->insert_at (env);
2429 } 2422 }
2430 else if (op->inv) 2423 else if (op->inv)
2431 remove_unpaid_objects (op->inv, env); 2424 remove_unpaid_objects (op->inv, env);
2432 2425
2433 op = next; 2426 op = next;
2726 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You have been defeated in combat!"); 2719 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You have been defeated in combat!");
2727 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Local medics have saved your life..."); 2720 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Local medics have saved your life...");
2728 2721
2729 /* restore player */ 2722 /* restore player */
2730 at = archetype::find ("poisoning"); 2723 at = archetype::find ("poisoning");
2731 tmp = present_arch_in_ob (at, op); 2724 if (object *tmp = present_arch_in_ob (at, op))
2732 if (tmp)
2733 { 2725 {
2734 tmp->destroy (); 2726 tmp->destroy ();
2735 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 2727 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
2736 } 2728 }
2737 2729
2738 at = archetype::find ("confusion"); 2730 at = archetype::find ("confusion");
2739 tmp = present_arch_in_ob (at, op); 2731 if (object *tmp = present_arch_in_ob (at, op))
2740 if (tmp)
2741 { 2732 {
2742 tmp->destroy (); 2733 tmp->destroy ();
2743 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2734 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2744 } 2735 }
2745 2736
2747 op->stats.hp = op->stats.maxhp; 2738 op->stats.hp = op->stats.maxhp;
2748 if (op->stats.food <= 0) 2739 if (op->stats.food <= 0)
2749 op->stats.food = 999; 2740 op->stats.food = 999;
2750 2741
2751 /* create a bodypart-trophy to make the winner happy */ 2742 /* create a bodypart-trophy to make the winner happy */
2752 tmp = arch_to_object (archetype::find ("finger")); 2743 if (object *tmp = arch_to_object (archetype::find ("finger")))
2753 if (tmp != NULL)
2754 { 2744 {
2755 sprintf (buf, "%s's finger", &op->name); 2745 sprintf (buf, "%s's finger", &op->name);
2756 tmp->name = buf; 2746 tmp->name = buf;
2757 sprintf (buf, " This finger has been cut off %s\n" 2747 sprintf (buf, " This finger has been cut off %s\n"
2758 " the %s, when he was defeated at\n level %d by %s.\n", 2748 " the %s, when he was defeated at\n level %d by %s.\n",
2759 &op->name, op->contr->title, (int) (op->level), op->contr->killer); 2749 &op->name, op->contr->title, (int) (op->level), op->contr->killer);
2760 tmp->msg = buf; 2750 tmp->msg = buf;
2761 tmp->value = 0, tmp->material = 0, tmp->type = 0; 2751 tmp->value = 0, tmp->material = 0, tmp->type = 0;
2762 tmp->materialname = NULL; 2752 tmp->materialname = NULL;
2763 tmp->x = op->x, tmp->y = op->y; 2753 op->insert_at (tmp, op);
2764 insert_ob_in_map (tmp, op->map, op, 0);
2765 } 2754 }
2766 2755
2767 /* teleport defeated player to new destination */ 2756 /* teleport defeated player to new destination */
2768 transfer_ob (op, x, y, 0, NULL); 2757 transfer_ob (op, x, y, 0, NULL);
2769 op->contr->braced = 0; 2758 op->contr->braced = 0;
2795 op->stats.hp = op->stats.maxhp; 2784 op->stats.hp = op->stats.maxhp;
2796 return; 2785 return;
2797 } 2786 }
2798 sprintf (buf, "%s died.", &op->name); 2787 sprintf (buf, "%s died.", &op->name);
2799 } 2788 }
2789
2800 play_sound_player_only (op->contr, SOUND_PLAYER_DIES, 0, 0); 2790 play_sound_player_only (op->contr, SOUND_PLAYER_DIES, 0, 0);
2801 2791
2802 /* save the map location for corpse, gravestone */ 2792 /* save the map location for corpse, gravestone */
2803 x = op->x; 2793 x = op->x;
2804 y = op->y; 2794 y = op->y;
2805 map = op->map; 2795 map = op->map;
2806
2807 2796
2808 /* NOT_PERMADEATH code. This basically brings the character back to 2797 /* NOT_PERMADEATH code. This basically brings the character back to
2809 * life if they are dead - it takes some exp and a random stat. 2798 * life if they are dead - it takes some exp and a random stat.
2810 * See the config.h file for a little more in depth detail about this. 2799 * See the config.h file for a little more in depth detail about this.
2811 */ 2800 */
2828 num_stats_lose = 1; 2817 num_stats_lose = 1;
2829 else 2818 else
2830 num_stats_lose = 1 + op->level / BALSL_NUMBER_LOSSES_RATIO; 2819 num_stats_lose = 1 + op->level / BALSL_NUMBER_LOSSES_RATIO;
2831 } 2820 }
2832 else 2821 else
2833 {
2834 num_stats_lose = 1; 2822 num_stats_lose = 1;
2835 } 2823
2836 lost_a_stat = 0; 2824 lost_a_stat = 0;
2837 2825
2838 for (z = 0; z < num_stats_lose; z++) 2826 for (z = 0; z < num_stats_lose; z++)
2839 { 2827 {
2840 i = RANDOM () % NUM_STATS; 2828 i = RANDOM () % NUM_STATS;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines