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.85 by root, Tue May 6 16:44:54 2008 UTC vs.
Revision 1.86 by root, Sat May 17 14:57:23 2008 UTC

279 } 279 }
280 280
281 if (op->head) 281 if (op->head)
282 op = op->head; 282 op = op->head;
283 283
284 map = op->map; 284 mapxy pos (op);
285 x = op->x + freearr_x[dir]; 285 pos.move (dir);
286 y = op->y + freearr_y[dir];
287 286
288 if (!xy_normalise (map, x, y)) 287 if (!pos.normalise ())
289 return 0; 288 return 0;
290 289
291 // elmex: a safe map tile can't be hit! 290 // elmex: a safe map tile can't be hit!
292 // this should prevent most harmful effects on items and players there. 291 // this should prevent most harmful effects on items and players there.
293 mapspace &ms = map->at (x, y); 292 mapspace &ms = pos.ms ();
294 293
295 if (ms.flags () & P_SAFE) 294 if (ms.flags () & P_SAFE)
296 return 0; 295 return 0;
297 296
298 /* peterm: a few special cases for special attacktypes --counterspell 297 /* peterm: a few special cases for special attacktypes --counterspell
336 335
337 /* Something could have happened to 'tmp' while 'tmp->below' was processed. 336 /* Something could have happened to 'tmp' while 'tmp->below' was processed.
338 * For example, 'tmp' was put in an icecube. 337 * For example, 'tmp' was put in an icecube.
339 * This is one of the few cases where on_same_map should not be used. 338 * This is one of the few cases where on_same_map should not be used.
340 */ 339 */
341 if (tmp->map != map || tmp->x != x || tmp->y != y) 340 if (tmp->map != pos.m || tmp->x != pos.x || tmp->y != pos.y)
342 continue; 341 continue;
343 342
344 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 343 if (QUERY_FLAG (tmp, FLAG_ALIVE))
345 { 344 {
346 hit_player (tmp, op->stats.dam, op, type, full_hit); 345 hit_player (tmp, op->stats.dam, op, type, full_hit);
523 { 522 {
524 int mtype; 523 int mtype;
525 524
526 switch (hitter->current_weapon->weapontype) 525 switch (hitter->current_weapon->weapontype)
527 { 526 {
528 case WEAP_HIT: 527 case WEAP_HIT:
529 mtype = ATM_BASIC; 528 mtype = ATM_BASIC;
530 break; 529 break;
531 case WEAP_SLASH: 530 case WEAP_SLASH:
532 mtype = ATM_SLASH; 531 mtype = ATM_SLASH;
533 break; 532 break;
534 case WEAP_PIERCE: 533 case WEAP_PIERCE:
535 mtype = ATM_PIERCE; 534 mtype = ATM_PIERCE;
536 break; 535 break;
537 case WEAP_CLEAVE: 536 case WEAP_CLEAVE:
538 mtype = ATM_CLEAVE; 537 mtype = ATM_CLEAVE;
539 break; 538 break;
540 case WEAP_SLICE: 539 case WEAP_SLICE:
541 mtype = ATM_SLICE; 540 mtype = ATM_SLICE;
542 break; 541 break;
543 case WEAP_STAB: 542 case WEAP_STAB:
544 mtype = ATM_STAB; 543 mtype = ATM_STAB;
545 break; 544 break;
546 case WEAP_WHIP: 545 case WEAP_WHIP:
547 mtype = ATM_WHIP; 546 mtype = ATM_WHIP;
548 break; 547 break;
549 case WEAP_CRUSH: 548 case WEAP_CRUSH:
550 mtype = ATM_CRUSH; 549 mtype = ATM_CRUSH;
551 break; 550 break;
552 case WEAP_BLUD: 551 case WEAP_BLUD:
553 mtype = ATM_BLUD; 552 mtype = ATM_BLUD;
554 break; 553 break;
555 default: 554 default:
556 mtype = ATM_BASIC; 555 mtype = ATM_BASIC;
557 break; 556 break;
558 } 557 }
558
559 for (i = 0; i < MAXATTACKMESS && attack_mess[mtype][i].level != -1; i++) 559 for (i = 0; i < MAXATTACKMESS && attack_mess[mtype][i].level != -1; i++)
560 if (dam < attack_mess[mtype][i].level || attack_mess[mtype][i + 1].level == -1) 560 if (dam < attack_mess[mtype][i].level || attack_mess[mtype][i + 1].level == -1)
561 { 561 {
562 sprintf (buf1, "%s %s%s", attack_mess[mtype][i].buf1, &op->name, attack_mess[mtype][i].buf2); 562 sprintf (buf1, "%s %s%s", attack_mess[mtype][i].buf1, &op->name, attack_mess[mtype][i].buf2);
563 strcpy (buf2, attack_mess[mtype][i].buf3); 563 strcpy (buf2, attack_mess[mtype][i].buf3);
680 *target = (*target)->head; 680 *target = (*target)->head;
681 681
682 if ((*hitter)->head) 682 if ((*hitter)->head)
683 *hitter = (*hitter)->head; 683 *hitter = (*hitter)->head;
684 684
685 if ((*target)->type == LOCKED_DOOR)
686 return 1; // locked doors cannot be hit
687
685 if ((*hitter)->env != NULL || (*target)->env != NULL) 688 if ((*hitter)->env || (*target)->env)
686 { 689 {
687 *simple_attack = 1; 690 *simple_attack = 1;
688 return 0; 691 return 0;
689 } 692 }
690 693

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines