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

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.73 by root, Thu Jul 26 00:38:33 2007 UTC vs.
Revision 1.78 by root, Mon Oct 22 03:11:46 2007 UTC

613 if (hitter->owner != NULL) 613 if (hitter->owner != NULL)
614 sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2); 614 sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2);
615 else 615 else
616 { 616 {
617 sprintf (buf, "%s%s you.", &hitter->name, buf2); 617 sprintf (buf, "%s%s you.", &hitter->name, buf2);
618
618 if (dam != 0) 619 if (dam != 0)
619 { 620 {
620 if (dam < 10) 621 if (dam < 10)
621 op->contr->play_sound (sound_find ("player_is_hit1")); 622 op->contr->play_sound (sound_find ("player_is_hit1"));
622 else if (dam < 20) 623 else if (dam < 20)
630 } /* end of player hitting player */ 631 } /* end of player hitting player */
631 632
632 if (hitter->type == PLAYER) 633 if (hitter->type == PLAYER)
633 { 634 {
634 sprintf (buf, "You %s.", buf1); 635 sprintf (buf, "You %s.", buf1);
636
635 if (dam != 0) 637 if (dam != 0)
636 { 638 {
637 if (dam < 10) 639 if (dam < 10)
638 hitter->contr->play_sound (sound_find ("player_hits1")); 640 op->play_sound (sound_find ("player_hits1"));
639 else if (dam < 20) 641 else if (dam < 20)
640 hitter->contr->play_sound (sound_find ("player_hits2")); 642 op->play_sound (sound_find ("player_hits2"));
641 else 643 else
642 hitter->contr->play_sound (sound_find ("player_hits3")); 644 op->play_sound (sound_find ("player_hits3"));
643 } 645 }
644 646
645 new_draw_info (NDI_BLACK, 0, hitter, buf); 647 new_draw_info (NDI_BLACK, 0, hitter, buf);
646 } 648 }
647 else if (hitter->owner != NULL && hitter->owner->type == PLAYER) 649 else if (hitter->owner != NULL && hitter->owner->type == PLAYER)
687 if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) 689 if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED))
688 { 690 {
689 LOG (llevError, "BUG: get_attack_mode(): freed object\n"); 691 LOG (llevError, "BUG: get_attack_mode(): freed object\n");
690 return 1; 692 return 1;
691 } 693 }
694
692 if ((*target)->head) 695 if ((*target)->head)
693 *target = (*target)->head; 696 *target = (*target)->head;
697
694 if ((*hitter)->head) 698 if ((*hitter)->head)
695 *hitter = (*hitter)->head; 699 *hitter = (*hitter)->head;
700
696 if ((*hitter)->env != NULL || (*target)->env != NULL) 701 if ((*hitter)->env != NULL || (*target)->env != NULL)
697 { 702 {
698 *simple_attack = 1; 703 *simple_attack = 1;
699 return 0; 704 return 0;
700 } 705 }
706
701 if (QUERY_FLAG (*target, FLAG_REMOVED) 707 if (QUERY_FLAG (*target, FLAG_REMOVED)
702 || QUERY_FLAG (*hitter, FLAG_REMOVED) || (*hitter)->map == NULL || !on_same_map ((*hitter), (*target))) 708 || QUERY_FLAG (*hitter, FLAG_REMOVED)
709 || !(*hitter)->map
710 || !on_same_map (*hitter, *target))
703 { 711 {
704 LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " "target\n", &(*hitter)->arch->archname, &(*hitter)->name); 712 LOG (llevError | logBacktrace, "BUG: hitter (%s) with no relation to target (%s)\n",
713 (*hitter)->debug_desc (), (*target)->debug_desc ());
705 return 1; 714 return 1;
706 } 715 }
716
707 *simple_attack = 0; 717 *simple_attack = 0;
708 return 0; 718 return 0;
709} 719}
710 720
711static int 721static int
1956 return maxdam; 1966 return maxdam;
1957 } 1967 }
1958 1968
1959 op->remove (); 1969 op->remove ();
1960 1970
1961 for (i = 0; i < NROFNEWOBJS (op); i++) 1971 for (i = 0; i < op->stats.food; i++)
1962 { /* This doesn't handle op->more yet */ 1972 { /* This doesn't handle op->more yet */
1963 object *tmp = arch_to_object (op->other_arch); 1973 object *tmp = arch_to_object (op->other_arch);
1964 int j; 1974 int j;
1965 1975
1966 tmp->stats.hp = op->stats.hp; 1976 tmp->stats.hp = op->stats.hp;
2038 tmp->stats.Dex = MAX (-(dam / 6 + 1), -10); 2048 tmp->stats.Dex = MAX (-(dam / 6 + 1), -10);
2039 tmp->stats.Int = MAX (-dam / 7, -10); 2049 tmp->stats.Int = MAX (-dam / 7, -10);
2040 SET_FLAG (tmp, FLAG_APPLIED); 2050 SET_FLAG (tmp, FLAG_APPLIED);
2041 op->update_stats (); 2051 op->update_stats ();
2042 new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); 2052 new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill.");
2053 op->play_sound (tmp->sound);
2043 } 2054 }
2044 2055
2045 if (hitter->type == PLAYER) 2056 if (hitter->type == PLAYER)
2046 new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); 2057 new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name);
2047 else if (hitter->owner != NULL && hitter->owner->type == PLAYER) 2058 else if (hitter->owner != NULL && hitter->owner->type == PLAYER)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines