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.4 by elmex, Wed Feb 22 18:53:56 2006 UTC vs.
Revision 1.12 by pippijn, Wed May 3 05:50:06 2006 UTC

1/* 1/*
2 * static char *rcsid_attack_c = 2 * static char *rcsid_attack_c =
3 * "$Id: attack.c,v 1.4 2006/02/22 18:53:56 elmex Exp $"; 3 * "$Id: attack.c,v 1.12 2006/05/03 05:50:06 pippijn Exp $";
4 */ 4 */
5/* 5/*
6 CrossFire, A Multiplayer game for X-windows 6 CrossFire, A Multiplayer game for X-windows
7 7
8 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 8 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
562 /* scale down magic considerably. */ 562 /* scale down magic considerably. */
563 if (type & AT_MAGIC && rndm(0, 5)) 563 if (type & AT_MAGIC && rndm(0, 5))
564 return; 564 return;
565 565
566 /* Did a player hurt another player? Inform both! */ 566 /* Did a player hurt another player? Inform both! */
567 /* only show half the player->player combat messages */
568 if(op->type==PLAYER && rndm(0, 1) && 567 if(op->type==PLAYER &&
569 (get_owner(hitter)==NULL?hitter->type:hitter->owner->type)==PLAYER) { 568 (get_owner(hitter)==NULL?hitter->type:hitter->owner->type)==PLAYER) {
570 if(get_owner(hitter)!=NULL) 569 if(get_owner(hitter)!=NULL)
571 sprintf(buf,"%s's %s %s you.", 570 sprintf(buf,"%s's %s %s you.",
572 hitter->owner->name, hitter->name, buf2); 571 hitter->owner->name, hitter->name, buf2);
573 else { 572 else {
582 } 581 }
583 } 582 }
584 new_draw_info(NDI_BLACK, 0,op,buf); 583 new_draw_info(NDI_BLACK, 0,op,buf);
585 } /* end of player hitting player */ 584 } /* end of player hitting player */
586 585
587 /* scale down these messages too */
588 if(hitter->type==PLAYER && rndm(0, 2) == 0) { 586 if(hitter->type==PLAYER) {
589 sprintf(buf,"You %s.",buf1); 587 sprintf(buf,"You %s.",buf1);
590 if (dam != 0) { 588 if (dam != 0) {
591 if (dam < 10) 589 if (dam < 10)
592 play_sound_player_only(hitter->contr, SOUND_PLAYER_HITS1,0,0); 590 play_sound_player_only(hitter->contr, SOUND_PLAYER_HITS1,0,0);
593 else if (dam < 20) 591 else if (dam < 20)
873 * isn't available anymore. 871 * isn't available anymore.
874 */ 872 */
875object *hit_with_arrow (object *op, object *victim) 873object *hit_with_arrow (object *op, object *victim)
876{ 874{
877 object *container, *hitter; 875 object *container, *hitter;
878 int hit_something; 876 int hit_something = 0;
879 tag_t victim_tag, hitter_tag; 877 tag_t victim_tag, hitter_tag;
880 sint16 victim_x, victim_y; 878 sint16 victim_x, victim_y;
881 879
882 /* Disassemble missile */ 880 /* Disassemble missile */
883 if (op->inv) { 881 if (op->inv) {
1189 * not much is drained, low rate means a lot is drained. 1187 * not much is drained, low rate means a lot is drained.
1190 */ 1188 */
1191 int rate; 1189 int rate;
1192 1190
1193 if(op->resist[ATNR_DRAIN] >= 0) 1191 if(op->resist[ATNR_DRAIN] >= 0)
1194 rate = 50 + op->resist[ATNR_DRAIN] / 2; 1192 rate = 400 + op->resist[ATNR_DRAIN] * 3;
1195 else if(op->resist[ATNR_DRAIN] < 0) 1193 else
1196 rate = 5000 / (100 - op->resist[ATNR_DRAIN]); 1194 rate = 400 * 100 / (100 - op->resist[ATNR_DRAIN]);
1197 1195
1198 /* full protection has no effect. Nothing else in this
1199 * function needs to get done, so just return. */
1200 if(!rate)
1201 return 0;
1202
1203 if(op->stats.exp <= rate) { 1196 if(op->stats.exp <= rate) {
1204 if(op->type == GOLEM) 1197 if(op->type == GOLEM)
1205 dam = 999; /* Its force is "sucked" away. 8) */ 1198 dam = 999; /* Its force is "sucked" away. 8) */
1206 else 1199 else
1207 /* If we can't drain, lets try to do physical damage */ 1200 /* If we can't drain, lets try to do physical damage */
1653 1646
1654 /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ 1647 /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */
1655 if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) 1648 if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE))
1656 return 0; 1649 return 0;
1657 1650
1651#ifdef PROHIBIT_PLAYERKILL
1652 if (op->type == PLAYER) {
1653 object *owner = get_owner (hitter);
1654 if (!owner) owner = hitter;
1655 if (owner->type == PLAYER
1656 && (!op_on_battleground (op, 0, 0) && (op->contr->peaceful || owner->contr->peaceful))
1657 && op != owner) {
1658 return 0;
1659 }
1660 }
1661#endif
1662
1658 op_tag = op->count; 1663 op_tag = op->count;
1659 hitter_tag = hitter->count; 1664 hitter_tag = hitter->count;
1660 1665
1661 if (body_attack) { 1666 if (body_attack) {
1662 /* slow and paralyze must hit the head. But we don't want to just 1667 /* slow and paralyze must hit the head. But we don't want to just

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines