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

Comparing deliantra/server/server/skills.C (file contents):
Revision 1.42 by root, Thu Aug 23 16:46:28 2007 UTC vs.
Revision 1.43 by root, Mon Oct 22 03:11:47 2007 UTC

498 object *tmp; 498 object *tmp;
499 int i, exp = 0, dx = freearr_x[dir], dy = freearr_y[dir], mflags; 499 int i, exp = 0, dx = freearr_x[dir], dy = freearr_y[dir], mflags;
500 sint16 x, y; 500 sint16 x, y;
501 maptile *m; 501 maptile *m;
502 502
503 /* Jump loop. Go through spaces opject wants to jump. Halt the 503 /* Jump loop. Go through spaces object wants to jump. Halt the
504 * jump if a wall or creature is in the way. We set FLAG_FLYING 504 * jump if a wall or creature is in the way. We set FLAG_FLYING
505 * temporarily to allow player to aviod exits/archs that are not 505 * temporarily to allow player to aviod exits/archs that are not
506 * fly_on, fly_off. This will also prevent pickup of objects 506 * fly_on, fly_off. This will also prevent pickup of objects
507 * while jumping over them. 507 * while jumping over them.
508 */ 508 */
509
510 pl->remove (); 509 pl->remove ();
511 510
512 /* 511 /*
513 * I don't think this is actually needed - all the movement 512 * I don't think this is actually needed - all the movement
514 * code is handled in this function, and I don't see anyplace 513 * code is handled in this function, and I don't see anyplace
524 523
525 mflags = get_map_flags (m, &m, x, y, &x, &y); 524 mflags = get_map_flags (m, &m, x, y, &x, &y);
526 525
527 if (mflags & P_OUT_OF_MAP) 526 if (mflags & P_OUT_OF_MAP)
528 { 527 {
529 (void) stop_jump (pl, i, spaces); 528 stop_jump (pl, i, spaces);
530 return 0; 529 return 0;
531 } 530 }
531
532 if (OB_TYPE_MOVE_BLOCK (pl, GET_MAP_MOVE_BLOCK (m, x, y))) 532 if (OB_TYPE_MOVE_BLOCK (pl, GET_MAP_MOVE_BLOCK (m, x, y)))
533 { 533 {
534 new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked."); 534 new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked.");
535 stop_jump (pl, i, spaces); 535 stop_jump (pl, i, spaces);
536 return 0; 536 return 0;
540 { 540 {
541 /* Jump into creature */ 541 /* Jump into creature */
542 if (QUERY_FLAG (tmp, FLAG_MONSTER) || (tmp->type == PLAYER && (!QUERY_FLAG (tmp, FLAG_WIZ) || !tmp->contr->hidden))) 542 if (QUERY_FLAG (tmp, FLAG_MONSTER) || (tmp->type == PLAYER && (!QUERY_FLAG (tmp, FLAG_WIZ) || !tmp->contr->hidden)))
543 { 543 {
544 new_draw_info_format (NDI_UNIQUE, 0, pl, "You jump into %s%s.", tmp->type == PLAYER ? "" : "the ", &tmp->name); 544 new_draw_info_format (NDI_UNIQUE, 0, pl, "You jump into %s%s.", tmp->type == PLAYER ? "" : "the ", &tmp->name);
545
546 stop_jump (pl, i, spaces);
547
545 if (tmp->type != PLAYER || 548 if (tmp->type != PLAYER ||
546 (pl->type == PLAYER && pl->contr->party == NULL) || 549 (pl->type == PLAYER && pl->contr->party == NULL) ||
547 (pl->type == PLAYER && tmp->type == PLAYER && pl->contr->party != tmp->contr->party)) 550 (pl->type == PLAYER && tmp->type == PLAYER && pl->contr->party != tmp->contr->party))
548 exp = skill_attack (tmp, pl, pl->facing, "kicked", skill); /* pl makes an attack */ 551 exp = skill_attack (tmp, pl, pl->facing, "kicked", skill); /* pl makes an attack */
549 stop_jump (pl, i, spaces); 552
550 return exp; /* note that calc_skill_exp() is already called by skill_attack() */ 553 return exp; /* note that calc_skill_exp() is already called by skill_attack() */
551 } 554 }
555
552 /* If the space has fly on set (no matter what the space is), 556 /* If the space has fly on set (no matter what the space is),
553 * we should get the effects - after all, the player is 557 * we should get the effects - after all, the player is
554 * effectively flying. 558 * effectively flying.
555 */ 559 */
556 if (tmp->move_on & MOVE_FLY_LOW) 560 if (tmp->move_on & MOVE_FLY_LOW)
573/* jump() - this is both a new type of movement for player/monsters and 577/* jump() - this is both a new type of movement for player/monsters and
574 * an attack as well. 578 * an attack as well.
575 * Perhaps we should allow more spaces based on level, eg, level 50 579 * Perhaps we should allow more spaces based on level, eg, level 50
576 * jumper can jump several spaces? 580 * jumper can jump several spaces?
577 */ 581 */
578
579int 582int
580jump (object *pl, int dir, object *skill) 583jump (object *pl, int dir, object *skill)
581{ 584{
582 int spaces = 0, stats;
583 int str = pl->stats.Str; 585 int str = pl->stats.Str;
584 int dex = pl->stats.Dex; 586 int dex = pl->stats.Dex;
585 587
586 dex = dex ? dex : 15; 588 dex = dex ? dex : 15;
587 str = str ? str : 10; 589 str = str ? str : 10;
588 590
589 stats = str * str * str * dex * skill->level; 591 int stats = str * str * str * dex * skill->level;
590 592
591 if (pl->carrying != 0) /* don't want div by zero !! */ 593 int spaces = min (2, pl->carrying ? stats / pl->carrying : 0);
592 spaces = (int) (stats / pl->carrying);
593 else
594 spaces = 2; /* pl has no objects - gets the far jump */
595 594
596 if (spaces > 2)
597 spaces = 2;
598 else if (spaces == 0) 595 if (spaces == 0)
599 { 596 {
600 new_draw_info (NDI_UNIQUE, 0, pl, "You are carrying too much weight to jump."); 597 new_draw_info (NDI_UNIQUE, 0, pl, "You are carrying too much weight to jump.");
601 return 0; 598 return 0;
602 } 599 }
600
603 return attempt_jump (pl, dir, spaces, skill); 601 return attempt_jump (pl, dir, spaces, skill);
604} 602}
605
606 603
607/* skill_ident() - this code is supposed to allow players to identify 604/* skill_ident() - this code is supposed to allow players to identify
608 * classes of objects with the various "auto-ident" skills. Player must 605 * classes of objects with the various "auto-ident" skills. Player must
609 * have unidentified objects of the right type in order for the skill 606 * have unidentified objects of the right type in order for the skill
610 * to work. While multiple classes of objects may be identified, 607 * to work. While multiple classes of objects may be identified,
611 * this code is kind of yucky -- it would be nice to make it a bit 608 * this code is kind of yucky -- it would be nice to make it a bit
612 * more generalized. Right now, skill indices are embedded in this routine. 609 * more generalized. Right now, skill indices are embedded in this routine.
613 * Returns amount of experience gained (on successful ident). 610 * Returns amount of experience gained (on successful ident).
614 * - b.t. (thomas@astro.psu.edu) 611 * - b.t. (thomas@astro.psu.edu)
615 */ 612 */
616
617static int 613static int
618do_skill_detect_curse (object *pl, object *skill) 614do_skill_detect_curse (object *pl, object *skill)
619{ 615{
620 object *tmp; 616 object *tmp;
621 int success = 0; 617 int success = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines