1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * under the terms of the GNU General Public License as published by the Free |
9 | * it under the terms of the GNU General Public License as published by |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, but |
13 | * This program is distributed in the hope that it will be useful, |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License along |
18 | * You should have received a copy of the GNU General Public License |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
26 | #include <object.h> |
25 | #include <object.h> |
27 | #include <sproto.h> |
26 | #include <sproto.h> |
… | |
… | |
499 | object *tmp; |
498 | object *tmp; |
500 | 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; |
501 | sint16 x, y; |
500 | sint16 x, y; |
502 | maptile *m; |
501 | maptile *m; |
503 | |
502 | |
504 | /* Jump loop. Go through spaces opject wants to jump. Halt the |
503 | /* Jump loop. Go through spaces object wants to jump. Halt the |
505 | * 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 |
506 | * temporarily to allow player to aviod exits/archs that are not |
505 | * temporarily to allow player to aviod exits/archs that are not |
507 | * fly_on, fly_off. This will also prevent pickup of objects |
506 | * fly_on, fly_off. This will also prevent pickup of objects |
508 | * while jumping over them. |
507 | * while jumping over them. |
509 | */ |
508 | */ |
510 | |
|
|
511 | pl->remove (); |
509 | pl->remove (); |
512 | |
510 | |
513 | /* |
511 | /* |
514 | * I don't think this is actually needed - all the movement |
512 | * I don't think this is actually needed - all the movement |
515 | * 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 |
… | |
… | |
525 | |
523 | |
526 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
524 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
527 | |
525 | |
528 | if (mflags & P_OUT_OF_MAP) |
526 | if (mflags & P_OUT_OF_MAP) |
529 | { |
527 | { |
530 | (void) stop_jump (pl, i, spaces); |
528 | stop_jump (pl, i, spaces); |
531 | return 0; |
529 | return 0; |
532 | } |
530 | } |
|
|
531 | |
533 | 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))) |
534 | { |
533 | { |
535 | new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked."); |
534 | new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked."); |
536 | stop_jump (pl, i, spaces); |
535 | stop_jump (pl, i, spaces); |
537 | return 0; |
536 | return 0; |
… | |
… | |
541 | { |
540 | { |
542 | /* Jump into creature */ |
541 | /* Jump into creature */ |
543 | 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))) |
544 | { |
543 | { |
545 | 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 | |
546 | if (tmp->type != PLAYER || |
548 | if (tmp->type != PLAYER || |
547 | (pl->type == PLAYER && pl->contr->party == NULL) || |
549 | (pl->type == PLAYER && pl->contr->party == NULL) || |
548 | (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)) |
549 | 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 */ |
550 | stop_jump (pl, i, spaces); |
552 | |
551 | 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() */ |
552 | } |
554 | } |
|
|
555 | |
553 | /* 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), |
554 | * we should get the effects - after all, the player is |
557 | * we should get the effects - after all, the player is |
555 | * effectively flying. |
558 | * effectively flying. |
556 | */ |
559 | */ |
557 | if (tmp->move_on & MOVE_FLY_LOW) |
560 | if (tmp->move_on & MOVE_FLY_LOW) |
… | |
… | |
561 | pl->map = m; |
564 | pl->map = m; |
562 | stop_jump (pl, i, spaces); |
565 | stop_jump (pl, i, spaces); |
563 | return calc_skill_exp (pl, NULL, skill); |
566 | return calc_skill_exp (pl, NULL, skill); |
564 | } |
567 | } |
565 | } |
568 | } |
|
|
569 | |
566 | pl->x = x; |
570 | pl->x = x; |
567 | pl->y = y; |
571 | pl->y = y; |
568 | pl->map = m; |
572 | pl->map = m; |
569 | } |
573 | } |
|
|
574 | |
570 | stop_jump (pl, i, spaces); |
575 | stop_jump (pl, i, spaces); |
|
|
576 | |
571 | return calc_skill_exp (pl, NULL, skill); |
577 | return calc_skill_exp (pl, NULL, skill); |
572 | } |
578 | } |
573 | |
579 | |
574 | /* jump() - this is both a new type of movement for player/monsters and |
580 | /* jump() - this is both a new type of movement for player/monsters and |
575 | * an attack as well. |
581 | * an attack as well. |
576 | * Perhaps we should allow more spaces based on level, eg, level 50 |
582 | * Perhaps we should allow more spaces based on level, eg, level 50 |
577 | * jumper can jump several spaces? |
583 | * jumper can jump several spaces? |
578 | */ |
584 | */ |
579 | |
|
|
580 | int |
585 | int |
581 | jump (object *pl, int dir, object *skill) |
586 | jump (object *pl, int dir, object *skill) |
582 | { |
587 | { |
583 | int spaces = 0, stats; |
|
|
584 | int str = pl->stats.Str; |
588 | int str = pl->stats.Str; |
585 | int dex = pl->stats.Dex; |
589 | int dex = pl->stats.Dex; |
586 | |
590 | |
587 | dex = dex ? dex : 15; |
591 | dex = dex ? dex : 15; |
588 | str = str ? str : 10; |
592 | str = str ? str : 10; |
589 | |
593 | |
590 | stats = str * str * str * dex * skill->level; |
594 | int stats = str * str * str * dex * skill->level; |
|
|
595 | int spaces = min (3, skill->level, stats / (pl->carrying + 1)); |
591 | |
596 | |
592 | if (pl->carrying != 0) /* don't want div by zero !! */ |
|
|
593 | spaces = (int) (stats / pl->carrying); |
|
|
594 | else |
|
|
595 | spaces = 2; /* pl has no objects - gets the far jump */ |
|
|
596 | |
|
|
597 | if (spaces > 2) |
|
|
598 | spaces = 2; |
|
|
599 | else if (spaces == 0) |
597 | if (spaces == 0) |
600 | { |
598 | { |
601 | new_draw_info (NDI_UNIQUE, 0, pl, "You are carrying too much weight to jump."); |
599 | new_draw_info (NDI_UNIQUE, 0, pl, "You are carrying too much weight to jump."); |
602 | return 0; |
600 | return 0; |
603 | } |
601 | } |
|
|
602 | |
604 | return attempt_jump (pl, dir, spaces, skill); |
603 | return attempt_jump (pl, dir, spaces, skill); |
605 | } |
604 | } |
606 | |
|
|
607 | |
605 | |
608 | /* skill_ident() - this code is supposed to allow players to identify |
606 | /* skill_ident() - this code is supposed to allow players to identify |
609 | * classes of objects with the various "auto-ident" skills. Player must |
607 | * classes of objects with the various "auto-ident" skills. Player must |
610 | * have unidentified objects of the right type in order for the skill |
608 | * have unidentified objects of the right type in order for the skill |
611 | * to work. While multiple classes of objects may be identified, |
609 | * to work. While multiple classes of objects may be identified, |
612 | * this code is kind of yucky -- it would be nice to make it a bit |
610 | * this code is kind of yucky -- it would be nice to make it a bit |
613 | * more generalized. Right now, skill indices are embedded in this routine. |
611 | * more generalized. Right now, skill indices are embedded in this routine. |
614 | * Returns amount of experience gained (on successful ident). |
612 | * Returns amount of experience gained (on successful ident). |
615 | * - b.t. (thomas@astro.psu.edu) |
613 | * - b.t. (thomas@astro.psu.edu) |
616 | */ |
614 | */ |
617 | |
|
|
618 | static int |
615 | static int |
619 | do_skill_detect_curse (object *pl, object *skill) |
616 | do_skill_detect_curse (object *pl, object *skill) |
620 | { |
617 | { |
621 | object *tmp; |
618 | object *tmp; |
622 | int success = 0; |
619 | int success = 0; |
… | |
… | |
719 | /* do_skill_ident() - workhorse for skill_ident() -b.t. |
716 | /* do_skill_ident() - workhorse for skill_ident() -b.t. |
720 | */ |
717 | */ |
721 | static int |
718 | static int |
722 | do_skill_ident (object *pl, int obj_class, object *skill) |
719 | do_skill_ident (object *pl, int obj_class, object *skill) |
723 | { |
720 | { |
724 | object *tmp; |
|
|
725 | int success = 0; |
721 | int success = 0; |
726 | |
722 | |
727 | for (tmp = pl->inv; tmp; tmp = tmp->below) |
723 | for (object *tmp = pl->inv; tmp; tmp = tmp->below) |
728 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
724 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
729 | /* check the ground */ |
725 | /* check the ground */ |
730 | |
726 | |
731 | for (tmp = GET_MAP_OB (pl->map, pl->x, pl->y); tmp; tmp = tmp->above) |
727 | for (object *tmp = pl->ms ().bot; tmp; tmp = tmp->above) |
732 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
728 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
733 | |
729 | |
734 | return success; |
730 | return success; |
735 | } |
731 | } |
736 | |
732 | |
… | |
… | |
744 | |
740 | |
745 | new_draw_info (NDI_UNIQUE, 0, pl, "You look at the objects nearby..."); |
741 | new_draw_info (NDI_UNIQUE, 0, pl, "You look at the objects nearby..."); |
746 | |
742 | |
747 | switch (skill->subtype) |
743 | switch (skill->subtype) |
748 | { |
744 | { |
749 | case SK_SMITHERY: |
745 | case SK_SMITHERY: |
750 | success += do_skill_ident (pl, WEAPON, skill) + do_skill_ident (pl, ARMOUR, skill) |
746 | success += do_skill_ident (pl, WEAPON, skill) + do_skill_ident (pl, ARMOUR, skill) |
751 | + do_skill_ident (pl, BRACERS, skill) + do_skill_ident (pl, CLOAK, skill) |
747 | + do_skill_ident (pl, BRACERS, skill) + do_skill_ident (pl, CLOAK, skill) |
752 | + do_skill_ident (pl, BOOTS, skill) + do_skill_ident (pl, SHIELD, skill) |
748 | + do_skill_ident (pl, BOOTS, skill) + do_skill_ident (pl, SHIELD, skill) |
753 | + do_skill_ident (pl, GIRDLE, skill) + do_skill_ident (pl, HELMET, skill) + do_skill_ident (pl, GLOVES, skill); |
749 | + do_skill_ident (pl, GIRDLE, skill) + do_skill_ident (pl, HELMET, skill) + do_skill_ident (pl, GLOVES, skill); |
754 | break; |
750 | break; |
755 | |
751 | |
756 | case SK_BOWYER: |
752 | case SK_BOWYER: |
757 | success += do_skill_ident (pl, BOW, skill) + do_skill_ident (pl, ARROW, skill); |
753 | success += do_skill_ident (pl, BOW, skill) + do_skill_ident (pl, ARROW, skill); |
758 | break; |
754 | break; |
759 | |
755 | |
760 | case SK_ALCHEMY: |
756 | case SK_ALCHEMY: |
761 | success += do_skill_ident (pl, POTION, skill) + do_skill_ident (pl, POISON, skill) |
757 | success += do_skill_ident (pl, POTION, skill) + do_skill_ident (pl, POISON, skill) |
762 | + do_skill_ident (pl, CONTAINER, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, INORGANIC, skill); |
758 | + do_skill_ident (pl, CONTAINER, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, INORGANIC, skill); |
763 | break; |
759 | break; |
764 | |
760 | |
765 | case SK_WOODSMAN: |
761 | case SK_WOODSMAN: |
766 | success += do_skill_ident (pl, FOOD, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, FLESH, skill); |
762 | success += do_skill_ident (pl, FOOD, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, FLESH, skill); |
767 | break; |
763 | break; |
768 | |
764 | |
769 | case SK_JEWELER: |
765 | case SK_JEWELER: |
770 | success += do_skill_ident (pl, GEM, skill) + do_skill_ident (pl, RING, skill) + do_skill_ident (pl, AMULET, skill); |
766 | success += do_skill_ident (pl, GEM, skill) + do_skill_ident (pl, RING, skill) + do_skill_ident (pl, AMULET, skill); |
771 | break; |
767 | break; |
772 | |
768 | |
773 | case SK_LITERACY: |
769 | case SK_LITERACY: |
774 | success += do_skill_ident (pl, SPELLBOOK, skill) + do_skill_ident (pl, SCROLL, skill) + do_skill_ident (pl, BOOK, skill); |
770 | success += do_skill_ident (pl, SPELLBOOK, skill) + do_skill_ident (pl, SCROLL, skill) + do_skill_ident (pl, BOOK, skill); |
775 | break; |
771 | break; |
776 | |
772 | |
777 | case SK_THAUMATURGY: |
773 | case SK_THAUMATURGY: |
778 | success += do_skill_ident (pl, WAND, skill) + do_skill_ident (pl, ROD, skill) + do_skill_ident (pl, HORN, skill); |
774 | success += do_skill_ident (pl, WAND, skill) + do_skill_ident (pl, ROD, skill) + do_skill_ident (pl, HORN, skill); |
779 | break; |
775 | break; |
780 | |
776 | |
781 | case SK_DET_CURSE: |
777 | case SK_DET_CURSE: |
782 | success = do_skill_detect_curse (pl, skill); |
778 | success = do_skill_detect_curse (pl, skill); |
783 | if (success) |
779 | if (success) |
784 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover cursed items!"); |
780 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover cursed items!"); |
785 | break; |
781 | break; |
786 | |
782 | |
787 | case SK_DET_MAGIC: |
783 | case SK_DET_MAGIC: |
788 | success = do_skill_detect_magic (pl, skill); |
784 | success = do_skill_detect_magic (pl, skill); |
789 | if (success) |
785 | if (success) |
790 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover items imbued with mystic forces!"); |
786 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover items imbued with mystic forces!"); |
791 | break; |
787 | break; |
792 | |
788 | |
793 | default: |
789 | default: |
794 | LOG (llevError, "Error: bad call to skill_ident()\n"); |
790 | LOG (llevError, "Error: bad call to skill_ident()\n"); |
795 | return 0; |
791 | return 0; |
796 | break; |
792 | break; |
797 | } |
793 | } |
|
|
794 | |
798 | if (!success) |
795 | if (!success) |
799 | { |
|
|
800 | new_draw_info (NDI_UNIQUE, 0, pl, "...and learn nothing more."); |
796 | new_draw_info (NDI_UNIQUE, 0, pl, "...and learn nothing more."); |
801 | } |
797 | |
802 | return success; |
798 | return success; |
803 | } |
799 | } |
804 | |
800 | |
805 | /* players using this skill can 'charm' a monster -- |
801 | /* players using this skill can 'charm' a monster -- |
806 | * into working for them. It can only be used on |
802 | * into working for them. It can only be used on |
… | |
… | |
901 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp)); |
897 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp)); |
902 | |
898 | |
903 | tmp->set_owner (pl); |
899 | tmp->set_owner (pl); |
904 | tmp->skill = skill->skill; |
900 | tmp->skill = skill->skill; |
905 | tmp->stats.exp = 0; |
901 | tmp->stats.exp = 0; |
906 | add_friendly_object (tmp); |
|
|
907 | tmp->attack_movement = PETMOVE; |
902 | tmp->attack_movement = PETMOVE; |
|
|
903 | |
|
|
904 | if (!QUERY_FLAG (tmp, FLAG_FRIENDLY)) |
|
|
905 | add_friendly_object (tmp); |
|
|
906 | |
908 | return calc_skill_exp (pl, tmp, skill); |
907 | return calc_skill_exp (pl, tmp, skill); |
909 | } |
908 | } |
910 | /* Charm failed. Creature may be angry now */ |
909 | /* Charm failed. Creature may be angry now */ |
911 | else if ((skill->level + ((pl->stats.Cha - 10) / 2)) < random_roll (1, 2 * tmp->level, pl, PREFER_LOW)) |
910 | else if ((skill->level + ((pl->stats.Cha - 10) / 2)) < random_roll (1, 2 * tmp->level, pl, PREFER_LOW)) |
912 | { |
911 | { |
913 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Your speech angers the %s!\n", query_name (tmp)); |
912 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Your speech angers the %s!\n", query_name (tmp)); |
914 | if (QUERY_FLAG (tmp, FLAG_FRIENDLY)) |
913 | if (QUERY_FLAG (tmp, FLAG_FRIENDLY)) |
915 | { |
914 | { |
916 | CLEAR_FLAG (tmp, FLAG_FRIENDLY); |
|
|
917 | remove_friendly_object (tmp); |
915 | remove_friendly_object (tmp); |
918 | tmp->attack_movement = 0; /* needed? */ |
916 | tmp->attack_movement = 0; /* needed? */ |
919 | } |
917 | } |
920 | |
918 | |
921 | CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE); |
919 | CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE); |
… | |
… | |
1122 | success += calc_skill_exp (op, tmp, skill); |
1120 | success += calc_skill_exp (op, tmp, skill); |
1123 | } |
1121 | } |
1124 | } |
1122 | } |
1125 | } |
1123 | } |
1126 | } |
1124 | } |
|
|
1125 | |
1127 | return success; |
1126 | return success; |
1128 | } |
1127 | } |
1129 | |
|
|
1130 | |
1128 | |
1131 | /* pray() - when this skill is called from do_skill(), it allows |
1129 | /* pray() - when this skill is called from do_skill(), it allows |
1132 | * the player to regain lost grace points at a faster rate. -b.t. |
1130 | * the player to regain lost grace points at a faster rate. -b.t. |
1133 | * This always returns 0 - return value is used by calling function |
1131 | * This always returns 0 - return value is used by calling function |
1134 | * such that if it returns true, player gets exp in that skill. This |
1132 | * such that if it returns true, player gets exp in that skill. This |
1135 | * the effect here can be done on demand, we probably don't want to |
1133 | * the effect here can be done on demand, we probably don't want to |
1136 | * give infinite exp by returning true in any cases. |
1134 | * give infinite exp by returning true in any cases. |
1137 | */ |
1135 | */ |
1138 | |
|
|
1139 | int |
1136 | int |
1140 | pray (object *pl, object *skill) |
1137 | pray (object *pl, object *skill) |
1141 | { |
1138 | { |
1142 | char buf[MAX_BUF]; |
1139 | char buf[MAX_BUF]; |
1143 | object *tmp; |
1140 | object *tmp; |
… | |
… | |
1168 | if (pl->stats.grace < pl->stats.maxgrace) |
1165 | if (pl->stats.grace < pl->stats.maxgrace) |
1169 | { |
1166 | { |
1170 | pl->stats.grace++; |
1167 | pl->stats.grace++; |
1171 | pl->last_grace = -1; |
1168 | pl->last_grace = -1; |
1172 | } |
1169 | } |
|
|
1170 | |
1173 | return 0; |
1171 | return 0; |
1174 | } |
1172 | } |
1175 | |
1173 | |
1176 | /* This skill allows the player to regain a few sp or hp for a |
1174 | /* This skill allows the player to regain a few sp or hp for a |
1177 | * brief period of concentration. No armour or weapons may be |
1175 | * brief period of concentration. No armour or weapons may be |
1178 | * wielded/applied for this to work. The amount of time needed |
1176 | * wielded/applied for this to work. The amount of time needed |
1179 | * to concentrate and the # of points regained is dependant on |
1177 | * to concentrate and the # of points regained is dependant on |
1180 | * the level of the user. - b.t. thomas@astro.psu.edu |
1178 | * the level of the user. - b.t. thomas@astro.psu.edu |
1181 | */ |
1179 | */ |
1182 | |
|
|
1183 | void |
1180 | void |
1184 | meditate (object *pl, object *skill) |
1181 | meditate (object *pl, object *skill) |
1185 | { |
1182 | { |
1186 | object *tmp; |
1183 | object *tmp; |
1187 | |
1184 | |
… | |
… | |
1230 | pl->last_heal = -1; |
1227 | pl->last_heal = -1; |
1231 | } |
1228 | } |
1232 | } |
1229 | } |
1233 | |
1230 | |
1234 | /* write_note() - this routine allows players to inscribe messages in |
1231 | /* write_note() - this routine allows players to inscribe messages in |
1235 | * ordinary 'books' (anything that is type BOOK). b.t. |
1232 | * ordinary inscribable 'books' (anything that is not a SPELL). b.t. |
1236 | */ |
1233 | */ |
1237 | static int |
1234 | static int |
1238 | write_note (object *pl, object *item, const char *msg, object *skill) |
1235 | write_note (object *pl, object *item, const char *msg, object *skill) |
1239 | { |
1236 | { |
|
|
1237 | |
|
|
1238 | if (strstr (msg, "\nendmsg")) |
|
|
1239 | { |
|
|
1240 | new_draw_info (NDI_UNIQUE, 0, pl, "Trying to cheat now are we?"); |
|
|
1241 | return 0; |
|
|
1242 | } |
|
|
1243 | |
|
|
1244 | int len = strlen (msg); |
|
|
1245 | |
|
|
1246 | if (!is_utf8_string ((U8 *)msg, len)) |
|
|
1247 | { |
|
|
1248 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Your message is garbled (text must be UTF-8, client-bug)!"); |
|
|
1249 | return 0; |
|
|
1250 | } |
|
|
1251 | |
|
|
1252 | if (INVOKE_OBJECT (INSCRIBE_NOTE, item, ARG_PLAYER (pl->contr), ARG_STRING (msg), ARG_OBJECT (skill))) |
|
|
1253 | return RESULT_INT (0); |
|
|
1254 | |
1240 | char buf[1024]; |
1255 | char buf[1024]; |
1241 | object *newBook = NULL; |
|
|
1242 | |
1256 | |
1243 | /* a pair of sanity checks */ |
1257 | if (len < sizeof (buf) - 2) |
1244 | if (!item || item->type != BOOK) |
|
|
1245 | return 0; |
|
|
1246 | |
|
|
1247 | if (!msg) |
|
|
1248 | { |
|
|
1249 | new_draw_info (NDI_UNIQUE, 0, pl, "No message to write!"); |
|
|
1250 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Usage: use_skill %s <message>", &skill->skill); |
|
|
1251 | return 0; |
|
|
1252 | } |
1258 | { |
|
|
1259 | snprintf (buf, sizeof (buf), "%s\n", msg); |
1253 | |
1260 | |
1254 | if (strcasestr_local (msg, "endmsg")) |
1261 | object *newbook = arch_to_object (item->other_arch); |
1255 | { |
1262 | item->decrease (); |
1256 | new_draw_info (NDI_UNIQUE, 0, pl, "Trying to cheat now are we?"); |
|
|
1257 | return 0; |
|
|
1258 | } |
|
|
1259 | |
|
|
1260 | if (INVOKE_OBJECT (INSCRIBE_NOTE, item, ARG_PLAYER (pl->contr), ARG_STRING (msg), ARG_OBJECT (skill))) |
|
|
1261 | return strlen (msg); |
|
|
1262 | |
|
|
1263 | buf[0] = 0; |
|
|
1264 | if (!book_overflow (item->msg, msg, sizeof (buf))) |
|
|
1265 | { /* add msg string to book */ |
|
|
1266 | if (item->msg) |
|
|
1267 | strcpy (buf, item->msg); |
|
|
1268 | |
|
|
1269 | strcat (buf, msg); |
|
|
1270 | strcat (buf, "\n"); /* new msg needs a LF */ |
|
|
1271 | if (item->nrof > 1) |
|
|
1272 | { |
|
|
1273 | newBook = item->clone (); |
|
|
1274 | decrease_ob (item); |
|
|
1275 | esrv_send_item (pl, item); |
1263 | esrv_send_item (pl, item); |
1276 | newBook->nrof = 1; |
1264 | newbook->nrof = 1; |
1277 | newBook->msg = buf; |
1265 | newbook->msg = buf; |
|
|
1266 | newbook->flag [FLAG_IDENTIFIED] = true; |
|
|
1267 | |
|
|
1268 | if (item->subtype == 1) // mailscrolls |
|
|
1269 | { |
|
|
1270 | newbook->name = item->name; |
|
|
1271 | newbook->name_pl = item->name_pl; |
|
|
1272 | } |
|
|
1273 | |
1278 | newBook = insert_ob_in_ob (newBook, pl); |
1274 | newbook = insert_ob_in_ob (newbook, pl); |
1279 | esrv_send_item (pl, newBook); |
1275 | esrv_send_item (pl, newbook); |
1280 | } |
|
|
1281 | else |
|
|
1282 | { |
|
|
1283 | item->msg = buf; |
|
|
1284 | /* This shouldn't be necessary - the object hasn't changed in any |
|
|
1285 | * visible way |
|
|
1286 | */ |
|
|
1287 | /* esrv_send_item(pl, item); */ |
|
|
1288 | } |
|
|
1289 | |
1276 | |
|
|
1277 | pl->contr->play_sound (sound_find ("inscribe_success")); |
1290 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You write in the %s.", query_short_name (item)); |
1278 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You write in the %s.", &item->name); |
1291 | return strlen (msg); |
1279 | return strlen (msg); |
1292 | } |
1280 | } |
1293 | else |
1281 | else |
1294 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Your message won't fit in the %s!", query_short_name (item)); |
1282 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Your message won't fit in the %s!", &item->name); |
1295 | |
1283 | |
1296 | return 0; |
1284 | return 0; |
1297 | } |
1285 | } |
1298 | |
1286 | |
1299 | /* write_scroll() - this routine allows players to inscribe spell scrolls |
1287 | /* write_scroll() - this routine allows players to inscribe spell scrolls |
1300 | * of spells which they know. Backfire effects are possible with the |
1288 | * of spells which they know. Backfire effects are possible with the |
1301 | * severity of the backlash correlated with the difficulty of the scroll |
1289 | * severity of the backlash correlated with the difficulty of the scroll |
1302 | * that is attempted. -b.t. thomas@astro.psu.edu |
1290 | * that is attempted. -b.t. thomas@astro.psu.edu |
1303 | */ |
1291 | */ |
1304 | |
|
|
1305 | static int |
1292 | static int |
1306 | write_scroll (object *pl, object *scroll, object *skill) |
1293 | write_scroll (object *pl, object *scroll, object *skill) |
1307 | { |
1294 | { |
1308 | int success = 0, confused = 0; |
1295 | int success = 0, confused = 0; |
1309 | object *newscroll, *chosen_spell, *tmp; |
|
|
1310 | |
|
|
1311 | /* this is a sanity check */ |
|
|
1312 | if (scroll->type != SCROLL) |
|
|
1313 | { |
|
|
1314 | new_draw_info (NDI_UNIQUE, 0, pl, "A spell can only be inscribed into a scroll!"); |
|
|
1315 | return 0; |
|
|
1316 | } |
|
|
1317 | |
1296 | |
1318 | /* Check if we are ready to attempt inscription */ |
1297 | /* Check if we are ready to attempt inscription */ |
1319 | chosen_spell = pl->contr->ranged_ob; |
1298 | object *chosen_spell = pl->contr->ranged_ob; |
|
|
1299 | |
1320 | if (!chosen_spell || chosen_spell->type != SPELL) |
1300 | if (!chosen_spell || chosen_spell->type != SPELL) |
1321 | { |
1301 | { |
1322 | new_draw_info (NDI_UNIQUE, 0, pl, "You need a spell readied in order to inscribe!"); |
1302 | new_draw_info (NDI_UNIQUE, 0, pl, "You need a spell readied in order to inscribe!"); |
1323 | return 0; |
1303 | return 0; |
1324 | } |
1304 | } |
… | |
… | |
1330 | } |
1310 | } |
1331 | |
1311 | |
1332 | if (SP_level_spellpoint_cost (pl, chosen_spell, SPELL_MANA) > pl->stats.sp) |
1312 | if (SP_level_spellpoint_cost (pl, chosen_spell, SPELL_MANA) > pl->stats.sp) |
1333 | { |
1313 | { |
1334 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You don't have enough mana to write a scroll of %s.", &chosen_spell->name); |
1314 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You don't have enough mana to write a scroll of %s.", &chosen_spell->name); |
1335 | return 0; |
|
|
1336 | } |
|
|
1337 | |
|
|
1338 | /* if there is a spell already on the scroll then player could easily |
|
|
1339 | * accidently read it while trying to write the new one. give player |
|
|
1340 | * a 50% chance to overwrite spell at their own level |
|
|
1341 | */ |
|
|
1342 | if ((scroll->stats.sp || scroll->inv) && random_roll (0, scroll->level * 2, pl, PREFER_LOW) > skill->level) |
|
|
1343 | { |
|
|
1344 | new_draw_info_format (NDI_UNIQUE, 0, pl, "Oops! You accidently read it while trying to write on it."); |
|
|
1345 | manual_apply (pl, scroll, 0); |
|
|
1346 | return 0; |
1315 | return 0; |
1347 | } |
1316 | } |
1348 | |
1317 | |
1349 | /* ok, we are ready to try inscription */ |
1318 | /* ok, we are ready to try inscription */ |
1350 | if (QUERY_FLAG (pl, FLAG_CONFUSED)) |
1319 | if (QUERY_FLAG (pl, FLAG_CONFUSED)) |
… | |
… | |
1354 | pl->stats.grace -= SP_level_spellpoint_cost (pl, chosen_spell, SPELL_GRACE); |
1323 | pl->stats.grace -= SP_level_spellpoint_cost (pl, chosen_spell, SPELL_GRACE); |
1355 | pl->stats.sp -= SP_level_spellpoint_cost (pl, chosen_spell, SPELL_MANA); |
1324 | pl->stats.sp -= SP_level_spellpoint_cost (pl, chosen_spell, SPELL_MANA); |
1356 | |
1325 | |
1357 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1326 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1358 | { |
1327 | { |
1359 | if (scroll->nrof > 1) |
1328 | object *newscroll = arch_to_object (scroll->other_arch); |
1360 | { |
1329 | scroll->decrease (); |
1361 | newscroll = scroll->clone (); |
|
|
1362 | decrease_ob (scroll); |
|
|
1363 | newscroll->nrof = 1; |
1330 | newscroll->nrof = 1; |
1364 | } |
1331 | |
1365 | else |
1332 | pl->contr->play_sound (sound_find ("inscribe_success")); |
1366 | newscroll = scroll; |
|
|
1367 | |
1333 | |
1368 | if (!confused) |
1334 | if (!confused) |
1369 | { |
1335 | { |
1370 | newscroll->level = MAX (skill->level, chosen_spell->level); |
1336 | newscroll->level = MAX (skill->level, chosen_spell->level); |
|
|
1337 | newscroll->flag [FLAG_IDENTIFIED] = true; |
1371 | new_draw_info (NDI_UNIQUE, 0, pl, "You succeed in writing a new scroll."); |
1338 | new_draw_info (NDI_UNIQUE, 0, pl, "You succeed in writing the spell."); |
1372 | } |
1339 | } |
1373 | else |
1340 | else |
1374 | { |
1341 | { |
1375 | chosen_spell = find_random_spell_in_ob (pl, NULL); |
1342 | chosen_spell = find_random_spell_in_ob (pl, NULL); |
1376 | if (!chosen_spell) |
1343 | if (!chosen_spell) |
… | |
… | |
1378 | |
1345 | |
1379 | newscroll->level = MAX (skill->level, chosen_spell->level); |
1346 | newscroll->level = MAX (skill->level, chosen_spell->level); |
1380 | new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell."); |
1347 | new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell."); |
1381 | } |
1348 | } |
1382 | |
1349 | |
1383 | if (newscroll->inv) |
|
|
1384 | newscroll->inv->destroy (); |
|
|
1385 | |
|
|
1386 | tmp = chosen_spell->clone (); |
1350 | object *tmp = chosen_spell->clone (); |
1387 | insert_ob_in_ob (tmp, newscroll); |
1351 | insert_ob_in_ob (tmp, newscroll); |
1388 | |
1352 | |
1389 | /* Same code as from treasure.c - so they can better merge. |
1353 | /* Same code as from treasure.C - so they can better merge. |
1390 | * if players want to sell them, so be it. |
1354 | * if players want to sell them, so be it. |
1391 | */ |
1355 | */ |
1392 | newscroll->value = newscroll->arch->value * newscroll->inv->value * (newscroll->level + 50) / (newscroll->inv->level + 50); |
1356 | newscroll->value = newscroll->arch->value * newscroll->inv->value * (newscroll->level + 50) / (newscroll->inv->level + 50); |
1393 | newscroll->stats.exp = newscroll->value / 5; |
1357 | newscroll->stats.exp = newscroll->value / 5; |
1394 | |
1358 | |
1395 | /* wait until finished manipulating the scroll before inserting it */ |
|
|
1396 | if (newscroll == scroll) |
|
|
1397 | { |
|
|
1398 | /* Remove to correctly merge with other items which may exist in inventory */ |
|
|
1399 | newscroll->remove (); |
|
|
1400 | esrv_del_item (pl->contr, newscroll->count); |
|
|
1401 | } |
|
|
1402 | |
|
|
1403 | newscroll = insert_ob_in_ob (newscroll, pl); |
1359 | newscroll = insert_ob_in_ob (newscroll, pl); |
1404 | esrv_send_item (pl, newscroll); |
1360 | esrv_send_item (pl, newscroll); |
|
|
1361 | |
1405 | success = calc_skill_exp (pl, newscroll, skill); |
1362 | success = calc_skill_exp (pl, newscroll, skill); |
1406 | if (!confused) |
1363 | if (!confused) |
1407 | success *= 2; |
1364 | success *= 2; |
|
|
1365 | |
1408 | success = success * skill->level; |
1366 | success = success * skill->level; |
1409 | return success; |
1367 | return success; |
1410 | |
|
|
1411 | } |
1368 | } |
1412 | else |
1369 | else |
1413 | { /* Inscription has failed */ |
1370 | { /* Inscription has failed */ |
|
|
1371 | pl->contr->play_sound (sound_find ("inscribe_fail")); |
1414 | |
1372 | |
1415 | if (chosen_spell->level > skill->level || confused) |
1373 | if (chosen_spell->level > skill->level || confused) |
1416 | { /*backfire! */ |
1374 | { /*backfire! */ |
1417 | new_draw_info (NDI_UNIQUE, 0, pl, "Ouch! Your attempt to write a new scroll strains your mind!"); |
1375 | new_draw_info (NDI_UNIQUE, 0, pl, "Ouch! Your attempt to write a new scroll strains your mind!"); |
|
|
1376 | |
1418 | if (random_roll (0, 1, pl, PREFER_LOW) == 1) |
1377 | if (random_roll (0, 1, pl, PREFER_LOW) == 1) |
1419 | pl->drain_specific_stat (4); |
1378 | pl->drain_specific_stat (4); |
1420 | else |
1379 | else |
1421 | { |
1380 | { |
1422 | confuse_player (pl, pl, 99); |
1381 | confuse_player (pl, pl, 99); |
1423 | return (-30 * chosen_spell->level); |
1382 | return -30 * chosen_spell->level; |
1424 | } |
1383 | } |
1425 | } |
1384 | } |
1426 | else if (random_roll (0, pl->stats.Int - 1, pl, PREFER_HIGH) < 15) |
1385 | else if (random_roll (0, pl->stats.Int - 1, pl, PREFER_HIGH) < 15) |
1427 | { |
1386 | { |
1428 | new_draw_info (NDI_UNIQUE, 0, pl, "Your attempt to write a new scroll rattles your mind!"); |
1387 | new_draw_info (NDI_UNIQUE, 0, pl, "Your attempt to write a new scroll rattles your mind! H<Frankly spoken, you were too dumb and unlucky.>"); |
1429 | confuse_player (pl, pl, 99); |
1388 | confuse_player (pl, pl, 99); |
1430 | } |
1389 | } |
1431 | else |
1390 | else |
1432 | new_draw_info (NDI_UNIQUE, 0, pl, "You fail to write a new scroll."); |
1391 | new_draw_info (NDI_UNIQUE, 0, pl, "You fail to write a new scroll. H<Try a lower-level spell, if possible at all.>"); |
1433 | } |
1392 | } |
1434 | |
1393 | |
1435 | return 0; |
1394 | return 0; |
1436 | } |
1395 | } |
1437 | |
1396 | |
1438 | /* write_on_item() - wrapper for write_note and write_scroll */ |
1397 | /* write_on_item() - wrapper for write_note and write_scroll */ |
1439 | int |
1398 | int |
1440 | write_on_item (object *pl, const char *params, object *skill) |
1399 | write_on_item (object *pl, const char *params, object *skill) |
1441 | { |
1400 | { |
1442 | object *item; |
|
|
1443 | const char *string = params; |
|
|
1444 | int msgtype; |
|
|
1445 | archetype *skat; |
1401 | archetype *skat; |
1446 | |
1402 | |
1447 | if (pl->type != PLAYER) |
1403 | if (pl->type != PLAYER) |
1448 | return 0; |
1404 | return 0; |
1449 | |
1405 | |
1450 | if (!params) |
1406 | if (!params) |
1451 | { |
|
|
1452 | params = ""; |
1407 | params = ""; |
1453 | string = params; |
|
|
1454 | } |
|
|
1455 | |
1408 | |
1456 | skat = get_archetype_by_type_subtype (SKILL, SK_LITERACY); |
1409 | skat = get_archetype_by_type_subtype (SKILL, SK_LITERACY); |
1457 | |
1410 | |
1458 | /* Need to be able to read before we can write! */ |
1411 | /* Need to be able to read before we can write! */ |
1459 | if (!find_skill_by_name (pl, skat->skill)) |
1412 | if (!find_skill_by_name (pl, skat->skill)) |
1460 | { |
1413 | { |
1461 | new_draw_info (NDI_UNIQUE, 0, pl, "You must learn to read before you can write!"); |
1414 | new_draw_info (NDI_UNIQUE, 0, pl, "You must learn to read before you can write! H<You lack the literacy skill.>"); |
1462 | return 0; |
1415 | return 0; |
1463 | } |
1416 | } |
1464 | |
1417 | |
1465 | /* if there is a message then it goes in a book and no message means |
1418 | object *item = find_marked_object (pl); |
1466 | * write active spell into the scroll |
|
|
1467 | */ |
|
|
1468 | msgtype = (string[0] != '\0') ? BOOK : SCROLL; |
|
|
1469 | |
1419 | |
1470 | /* find an item of correct type to write on */ |
1420 | /* find an item of correct type to write on */ |
1471 | if (!(item = find_marked_object (pl))) |
1421 | if (!item) |
|
|
1422 | { |
|
|
1423 | new_draw_info (NDI_UNIQUE, 0, pl, "You don't have any marked item to write on. H<Use the mark command or the popup menu to makr an item.>"); |
|
|
1424 | return 0; |
1472 | { |
1425 | } |
1473 | new_draw_info (NDI_UNIQUE, 0, pl, "You don't have any marked item to write on."); |
1426 | |
|
|
1427 | if (item->type != INSCRIBABLE) |
|
|
1428 | { |
|
|
1429 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You cannot inscribe this! H<You can only inscribe empty scrolls and books.>"); |
1474 | return 0; |
1430 | return 0; |
1475 | } |
1431 | } |
1476 | |
1432 | |
1477 | if (QUERY_FLAG (item, FLAG_UNPAID)) |
1433 | if (QUERY_FLAG (item, FLAG_UNPAID)) |
1478 | { |
1434 | { |
1479 | new_draw_info (NDI_UNIQUE, 0, pl, "You had better pay for that before you write on it."); |
1435 | new_draw_info (NDI_UNIQUE, 0, pl, "You had better pay for that before you write on it."); |
1480 | return 0; |
1436 | return 0; |
1481 | } |
1437 | } |
1482 | if (msgtype != item->type) |
1438 | |
|
|
1439 | if (item->other_arch->type == SCROLL) |
1483 | { |
1440 | { |
1484 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You have no %s to write on", msgtype == BOOK ? "book" : "scroll"); |
1441 | if (*params) |
|
|
1442 | { |
|
|
1443 | // check readied scroll |
|
|
1444 | new_draw_info_format (NDI_UNIQUE, 0, pl, |
|
|
1445 | "When inscribing spells you need to ready a spell and do not specify a string argument.\n" |
|
|
1446 | "Usage: cast [spell name]; use_skill %s", &skill->skill); |
1485 | return 0; |
1447 | return 0; |
1486 | } |
1448 | } |
1487 | |
1449 | |
1488 | if (msgtype == SCROLL) |
|
|
1489 | return write_scroll (pl, item, skill); |
1450 | return write_scroll (pl, item, skill); |
1490 | else if (msgtype == BOOK) |
1451 | } |
|
|
1452 | else |
|
|
1453 | { |
|
|
1454 | if (!*params) |
|
|
1455 | { |
|
|
1456 | new_draw_info_format (NDI_UNIQUE, 0, pl, |
|
|
1457 | "When inscribing books you need to specify the words you want to inscribe as command argument.\n" |
|
|
1458 | "Usage: use_skill %s <message>", &skill->skill); |
|
|
1459 | return 0; |
|
|
1460 | } |
|
|
1461 | |
1491 | return write_note (pl, item, string, skill); |
1462 | return write_note (pl, item, params, skill); |
|
|
1463 | } |
1492 | |
1464 | |
1493 | return 0; |
1465 | return 0; |
1494 | } |
1466 | } |
1495 | |
1467 | |
1496 | /* find_throw_ob() - if we request an object, then |
1468 | /* find_throw_ob() - if we request an object, then |
… | |
… | |
1598 | object *toss_item = orig->clone (); |
1570 | object *toss_item = orig->clone (); |
1599 | |
1571 | |
1600 | toss_item->type = THROWN_OBJ; |
1572 | toss_item->type = THROWN_OBJ; |
1601 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1573 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1602 | toss_item->stats.dam = 0; /* default damage */ |
1574 | toss_item->stats.dam = 0; /* default damage */ |
1603 | insert_ob_in_ob (orig, toss_item); |
1575 | toss_item->insert (orig); |
|
|
1576 | |
1604 | return toss_item; |
1577 | return toss_item; |
1605 | } |
1578 | } |
1606 | |
1579 | |
1607 | /* do_throw() - op throws any object toss_item. This code |
1580 | /* do_throw() - op throws any object toss_item. This code |
1608 | * was borrowed from fire_bow. |
1581 | * was borrowed from fire_bow. |
… | |
… | |
1701 | left = throw_ob; /* these are throwing objects left to the player */ |
1674 | left = throw_ob; /* these are throwing objects left to the player */ |
1702 | |
1675 | |
1703 | /* sometimes get_split_ob can't split an object (because op->nrof==0?) |
1676 | /* sometimes get_split_ob can't split an object (because op->nrof==0?) |
1704 | * and returns NULL. We must use 'left' then |
1677 | * and returns NULL. We must use 'left' then |
1705 | */ |
1678 | */ |
1706 | |
1679 | if (!(throw_ob = throw_ob->split ())) |
1707 | if ((throw_ob = get_split_ob (throw_ob, 1)) == NULL) |
|
|
1708 | { |
1680 | { |
1709 | throw_ob = left; |
1681 | throw_ob = left; |
1710 | left->remove (); |
1682 | left->remove (); |
1711 | if (op->type == PLAYER) |
1683 | if (op->type == PLAYER) |
1712 | esrv_del_item (op->contr, left->count); |
1684 | esrv_del_item (op->contr, left->count); |
… | |
… | |
1748 | */ |
1720 | */ |
1749 | throw_ob->inv->set_owner (op); |
1721 | throw_ob->inv->set_owner (op); |
1750 | throw_ob->direction = dir; |
1722 | throw_ob->direction = dir; |
1751 | |
1723 | |
1752 | /* the damage bonus from the force of the throw */ |
1724 | /* the damage bonus from the force of the throw */ |
1753 | dam = (int) (str_factor * dam_bonus[eff_str]); |
1725 | dam = int (str_factor * dam_bonus[eff_str]); |
1754 | |
1726 | |
1755 | /* Now, lets adjust the properties of the thrown_ob. */ |
1727 | /* Now, lets adjust the properties of the thrown_ob. */ |
1756 | |
1728 | |
1757 | /* how far to fly */ |
1729 | /* how far to fly */ |
1758 | throw_ob->last_sp = (eff_str * 3) / 5; |
1730 | throw_ob->last_sp = (eff_str * 3) / 5; |