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.5 by root, Fri Mar 24 10:51:18 2006 UTC vs.
Revision 1.13 by root, Thu May 11 18:42:29 2006 UTC

1/* 1/*
2 * static char *rcsid_attack_c = 2 * static char *rcsid_attack_c =
3 * "$Id: attack.c,v 1.5 2006/03/24 10:51:18 root Exp $"; 3 * "$Id: attack.c,v 1.13 2006/05/11 18:42:29 root 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 */
1378 if (get_owner (op) != NULL && op->owner->type == PLAYER && 1371 if (get_owner (op) != NULL && op->owner->type == PLAYER &&
1379 op->owner->contr->ranges[range_golem] == op) { 1372 op->owner->contr->ranges[range_golem] == op) {
1380 op->owner->contr->ranges[range_golem]=NULL; 1373 op->owner->contr->ranges[range_golem]=NULL;
1381 op->owner->contr->golem_count=0; 1374 op->owner->contr->golem_count=0;
1382 } 1375 }
1383 else
1384 LOG (llevError, "BUG: hit_player(): Encountered golem without owner.\n");
1385 1376
1386 remove_ob(op); 1377 remove_ob(op);
1387 free_object(op); 1378 free_object(op);
1388 return maxdam; 1379 return maxdam;
1389 } 1380 }
1657 1648
1658#ifdef PROHIBIT_PLAYERKILL 1649#ifdef PROHIBIT_PLAYERKILL
1659 if (op->type == PLAYER) { 1650 if (op->type == PLAYER) {
1660 object *owner = get_owner (hitter); 1651 object *owner = get_owner (hitter);
1661 if (!owner) owner = hitter; 1652 if (!owner) owner = hitter;
1662 if (owner->type == PLAYER && !op_on_battleground (op, 0, 0)) { 1653 if (owner->type == PLAYER
1654 && (!op_on_battleground (op, 0, 0) && (op->contr->peaceful || owner->contr->peaceful))
1655 && op != owner) {
1663 return 0; 1656 return 0;
1664 } 1657 }
1665 } 1658 }
1666#endif 1659#endif
1667 1660

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines