5 #include "market/building.h"
7 #include "player-move.h"
8 #include "player-status.h"
9 #include "player-effects.h"
10 #include "player-skill.h"
11 #include "player/race-info-table.h"
12 #include "player/mimic-info-table.h"
13 #include "player-class.h"
14 #include "player-personality.h"
15 #include "player-damage.h"
17 #include "floor-events.h"
22 #include "spells-status.h"
24 #include "object-hook.h"
25 #include "object-ego.h"
27 #include "monster-status.h"
28 #include "monsterrace-hook.h"
31 #include "realm-hex.h"
32 #include "realm-song.h"
33 #include "cmd/cmd-pet.h"
34 #include "cmd/cmd-spell.h"
36 #include "objectkind.h"
37 #include "monsterrace.h"
39 #include "io/write-diary.h"
40 #include "cmd/cmd-dump.h"
43 #include "view-mainwindow.h"
45 #include "cmd-magiceat.h"
47 #include "horror-descriptions.h"
48 #include "market/arena-info-table.h"
51 * @brief 能力値テーブル / Abbreviations of healthy stats
53 const concptr stat_names[6] =
56 "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :"
58 "STR : ", "INT : ", "WIS : ", "DEX : ", "CON : ", "CHR : "
63 * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats
65 const concptr stat_names_reduced[6] =
68 "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:"
70 "Str : ", "Int : ", "Wis : ", "Dex : ", "Con : ", "Chr : "
75 * @brief 基本必要経験値テーブル /
76 * Base experience levels, may be adjusted up for race and/or class
78 const s32b player_exp[PY_MAX_LEVEL] =
133 * @brief 基本必要強化値テーブル(アンドロイド専用)
135 const s32b player_exp_a[PY_MAX_LEVEL] =
190 * 知力/賢さによるレベル毎の習得可能魔法数テーブル
191 * Stat Table (INT/WIS) -- Number of half-spells per level
193 const byte adj_mag_study[] =
220 4 /* 18/100-18/109 */,
221 4 /* 18/110-18/119 */,
222 5 /* 18/120-18/129 */,
223 5 /* 18/130-18/139 */,
224 5 /* 18/140-18/149 */,
225 5 /* 18/150-18/159 */,
226 5 /* 18/160-18/169 */,
227 5 /* 18/170-18/179 */,
228 5 /* 18/180-18/189 */,
229 5 /* 18/190-18/199 */,
230 5 /* 18/200-18/209 */,
231 6 /* 18/210-18/219 */,
237 * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
239 const byte adj_mag_mana[] =
256 10 /* 18/00-18/09 */,
257 11 /* 18/10-18/19 */,
258 11 /* 18/20-18/29 */,
259 12 /* 18/30-18/39 */,
260 12 /* 18/40-18/49 */,
261 13 /* 18/50-18/59 */,
262 14 /* 18/60-18/69 */,
263 15 /* 18/70-18/79 */,
264 16 /* 18/80-18/89 */,
265 17 /* 18/90-18/99 */,
266 18 /* 18/100-18/109 */,
267 19 /* 18/110-18/119 */,
268 20 /* 18/120-18/129 */,
269 21 /* 18/130-18/139 */,
270 22 /* 18/140-18/149 */,
271 23 /* 18/150-18/159 */,
272 24 /* 18/160-18/169 */,
273 25 /* 18/170-18/179 */,
274 26 /* 18/180-18/189 */,
275 27 /* 18/190-18/199 */,
276 28 /* 18/200-18/209 */,
277 29 /* 18/210-18/219 */,
282 * 知力/賢さによる最低魔法失敗率テーブル
283 * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
285 const byte adj_mag_fail[] =
312 3 /* 18/100-18/109 */,
313 2 /* 18/110-18/119 */,
314 2 /* 18/120-18/129 */,
315 2 /* 18/130-18/139 */,
316 2 /* 18/140-18/149 */,
317 1 /* 18/150-18/159 */,
318 1 /* 18/160-18/169 */,
319 1 /* 18/170-18/179 */,
320 1 /* 18/180-18/189 */,
321 1 /* 18/190-18/199 */,
322 0 /* 18/200-18/209 */,
323 0 /* 18/210-18/219 */,
328 * 知力/賢さによる魔法失敗率修正テーブル
329 * Stat Table (INT/WIS) -- Various things
331 const byte adj_mag_stat[] =
358 8 /* 18/100-18/109 */,
359 9 /* 18/110-18/119 */,
360 10 /* 18/120-18/129 */,
361 11 /* 18/130-18/139 */,
362 12 /* 18/140-18/149 */,
363 13 /* 18/150-18/159 */,
364 14 /* 18/160-18/169 */,
365 15 /* 18/170-18/179 */,
366 16 /* 18/180-18/189 */,
367 17 /* 18/190-18/199 */,
368 18 /* 18/200-18/209 */,
369 19 /* 18/210-18/219 */,
375 * Stat Table (CHR) -- payment percentages
377 const byte adj_chr_gold[] =
394 100 /* 18/00-18/09 */,
395 99 /* 18/10-18/19 */,
396 98 /* 18/20-18/29 */,
397 97 /* 18/30-18/39 */,
398 96 /* 18/40-18/49 */,
399 95 /* 18/50-18/59 */,
400 94 /* 18/60-18/69 */,
401 93 /* 18/70-18/79 */,
402 92 /* 18/80-18/89 */,
403 91 /* 18/90-18/99 */,
404 90 /* 18/100-18/109 */,
405 89 /* 18/110-18/119 */,
406 88 /* 18/120-18/129 */,
407 87 /* 18/130-18/139 */,
408 86 /* 18/140-18/149 */,
409 85 /* 18/150-18/159 */,
410 84 /* 18/160-18/169 */,
411 83 /* 18/170-18/179 */,
412 82 /* 18/180-18/189 */,
413 81 /* 18/190-18/199 */,
414 80 /* 18/200-18/209 */,
415 79 /* 18/210-18/219 */,
421 * Stat Table (INT) -- Magic devices
423 const byte adj_int_dev[] =
450 8 /* 18/100-18/109 */,
451 9 /* 18/110-18/119 */,
452 10 /* 18/120-18/129 */,
453 11 /* 18/130-18/139 */,
454 12 /* 18/140-18/149 */,
455 13 /* 18/150-18/159 */,
456 14 /* 18/160-18/169 */,
457 15 /* 18/170-18/179 */,
458 16 /* 18/180-18/189 */,
459 17 /* 18/190-18/199 */,
460 18 /* 18/200-18/209 */,
461 19 /* 18/210-18/219 */,
467 * Stat Table (WIS) -- Saving throw
469 const byte adj_wis_sav[] =
496 7 /* 18/100-18/109 */,
497 8 /* 18/110-18/119 */,
498 9 /* 18/120-18/129 */,
499 10 /* 18/130-18/139 */,
500 11 /* 18/140-18/149 */,
501 12 /* 18/150-18/159 */,
502 13 /* 18/160-18/169 */,
503 14 /* 18/170-18/179 */,
504 15 /* 18/180-18/189 */,
505 16 /* 18/190-18/199 */,
506 17 /* 18/200-18/209 */,
507 18 /* 18/210-18/219 */,
513 * Stat Table (DEX) -- disarming
515 const byte adj_dex_dis[] =
542 8 /* 18/100-18/109 */,
543 8 /* 18/110-18/119 */,
544 8 /* 18/120-18/129 */,
545 8 /* 18/130-18/139 */,
546 8 /* 18/140-18/149 */,
547 9 /* 18/150-18/159 */,
548 9 /* 18/160-18/169 */,
549 9 /* 18/170-18/179 */,
550 9 /* 18/180-18/189 */,
551 9 /* 18/190-18/199 */,
552 10 /* 18/200-18/209 */,
553 10 /* 18/210-18/219 */,
559 * Stat Table (INT) -- disarming
561 const byte adj_int_dis[] =
588 10 /* 18/100-18/109 */,
589 10 /* 18/110-18/119 */,
590 11 /* 18/120-18/129 */,
591 12 /* 18/130-18/139 */,
592 13 /* 18/140-18/149 */,
593 14 /* 18/150-18/159 */,
594 15 /* 18/160-18/169 */,
595 16 /* 18/170-18/179 */,
596 17 /* 18/180-18/189 */,
597 18 /* 18/190-18/199 */,
598 19 /* 18/200-18/209 */,
599 19 /* 18/210-18/219 */,
605 * Stat Table (DEX) -- bonus to ac (plus 128)
607 const byte adj_dex_ta[] =
624 128 + 2 /* 18/00-18/09 */,
625 128 + 2 /* 18/10-18/19 */,
626 128 + 2 /* 18/20-18/29 */,
627 128 + 2 /* 18/30-18/39 */,
628 128 + 2 /* 18/40-18/49 */,
629 128 + 3 /* 18/50-18/59 */,
630 128 + 3 /* 18/60-18/69 */,
631 128 + 3 /* 18/70-18/79 */,
632 128 + 4 /* 18/80-18/89 */,
633 128 + 5 /* 18/90-18/99 */,
634 128 + 6 /* 18/100-18/109 */,
635 128 + 7 /* 18/110-18/119 */,
636 128 + 8 /* 18/120-18/129 */,
637 128 + 9 /* 18/130-18/139 */,
638 128 + 9 /* 18/140-18/149 */,
639 128 + 10 /* 18/150-18/159 */,
640 128 + 11 /* 18/160-18/169 */,
641 128 + 12 /* 18/170-18/179 */,
642 128 + 13 /* 18/180-18/189 */,
643 128 + 14 /* 18/190-18/199 */,
644 128 + 15 /* 18/200-18/209 */,
645 128 + 15 /* 18/210-18/219 */,
646 128 + 16 /* 18/220+ */
651 * Stat Table (STR) -- bonus to dam (plus 128)
653 const byte adj_str_td[] =
670 128 + 2 /* 18/00-18/09 */,
671 128 + 2 /* 18/10-18/19 */,
672 128 + 3 /* 18/20-18/29 */,
673 128 + 3 /* 18/30-18/39 */,
674 128 + 3 /* 18/40-18/49 */,
675 128 + 3 /* 18/50-18/59 */,
676 128 + 3 /* 18/60-18/69 */,
677 128 + 4 /* 18/70-18/79 */,
678 128 + 5 /* 18/80-18/89 */,
679 128 + 5 /* 18/90-18/99 */,
680 128 + 6 /* 18/100-18/109 */,
681 128 + 7 /* 18/110-18/119 */,
682 128 + 8 /* 18/120-18/129 */,
683 128 + 9 /* 18/130-18/139 */,
684 128 + 10 /* 18/140-18/149 */,
685 128 + 11 /* 18/150-18/159 */,
686 128 + 12 /* 18/160-18/169 */,
687 128 + 13 /* 18/170-18/179 */,
688 128 + 14 /* 18/180-18/189 */,
689 128 + 15 /* 18/190-18/199 */,
690 128 + 16 /* 18/200-18/209 */,
691 128 + 18 /* 18/210-18/219 */,
692 128 + 20 /* 18/220+ */
697 * Stat Table (DEX) -- bonus to hit (plus 128)
699 const byte adj_dex_th[] =
716 128 + 3 /* 18/00-18/09 */,
717 128 + 3 /* 18/10-18/19 */,
718 128 + 3 /* 18/20-18/29 */,
719 128 + 3 /* 18/30-18/39 */,
720 128 + 3 /* 18/40-18/49 */,
721 128 + 4 /* 18/50-18/59 */,
722 128 + 4 /* 18/60-18/69 */,
723 128 + 4 /* 18/70-18/79 */,
724 128 + 4 /* 18/80-18/89 */,
725 128 + 5 /* 18/90-18/99 */,
726 128 + 6 /* 18/100-18/109 */,
727 128 + 7 /* 18/110-18/119 */,
728 128 + 8 /* 18/120-18/129 */,
729 128 + 9 /* 18/130-18/139 */,
730 128 + 9 /* 18/140-18/149 */,
731 128 + 10 /* 18/150-18/159 */,
732 128 + 11 /* 18/160-18/169 */,
733 128 + 12 /* 18/170-18/179 */,
734 128 + 13 /* 18/180-18/189 */,
735 128 + 14 /* 18/190-18/199 */,
736 128 + 15 /* 18/200-18/209 */,
737 128 + 15 /* 18/210-18/219 */,
738 128 + 16 /* 18/220+ */
743 * Stat Table (STR) -- bonus to hit (plus 128)
745 const byte adj_str_th[] =
762 128 + 1 /* 18/00-18/09 */,
763 128 + 1 /* 18/10-18/19 */,
764 128 + 1 /* 18/20-18/29 */,
765 128 + 1 /* 18/30-18/39 */,
766 128 + 1 /* 18/40-18/49 */,
767 128 + 1 /* 18/50-18/59 */,
768 128 + 1 /* 18/60-18/69 */,
769 128 + 2 /* 18/70-18/79 */,
770 128 + 3 /* 18/80-18/89 */,
771 128 + 4 /* 18/90-18/99 */,
772 128 + 5 /* 18/100-18/109 */,
773 128 + 6 /* 18/110-18/119 */,
774 128 + 7 /* 18/120-18/129 */,
775 128 + 8 /* 18/130-18/139 */,
776 128 + 9 /* 18/140-18/149 */,
777 128 + 10 /* 18/150-18/159 */,
778 128 + 11 /* 18/160-18/169 */,
779 128 + 12 /* 18/170-18/179 */,
780 128 + 13 /* 18/180-18/189 */,
781 128 + 14 /* 18/190-18/199 */,
782 128 + 15 /* 18/200-18/209 */,
783 128 + 15 /* 18/210-18/219 */,
784 128 + 16 /* 18/220+ */
789 * Stat Table (STR) -- weight limit in deca-pounds
791 const byte adj_str_wgt[] =
808 25 /* 18/00-18/09 */,
809 26 /* 18/10-18/19 */,
810 27 /* 18/20-18/29 */,
811 28 /* 18/30-18/39 */,
812 29 /* 18/40-18/49 */,
813 30 /* 18/50-18/59 */,
814 31 /* 18/60-18/69 */,
815 31 /* 18/70-18/79 */,
816 32 /* 18/80-18/89 */,
817 32 /* 18/90-18/99 */,
818 33 /* 18/100-18/109 */,
819 33 /* 18/110-18/119 */,
820 34 /* 18/120-18/129 */,
821 34 /* 18/130-18/139 */,
822 35 /* 18/140-18/149 */,
823 35 /* 18/150-18/159 */,
824 36 /* 18/160-18/169 */,
825 36 /* 18/170-18/179 */,
826 37 /* 18/180-18/189 */,
827 37 /* 18/190-18/199 */,
828 38 /* 18/200-18/209 */,
829 38 /* 18/210-18/219 */,
835 * Stat Table (STR) -- weapon weight limit in pounds
837 const byte adj_str_hold[] =
854 19 /* 18/00-18/09 */,
855 20 /* 18/10-18/19 */,
856 21 /* 18/20-18/29 */,
857 22 /* 18/30-18/39 */,
858 23 /* 18/40-18/49 */,
859 24 /* 18/50-18/59 */,
860 25 /* 18/60-18/69 */,
861 26 /* 18/70-18/79 */,
862 27 /* 18/80-18/89 */,
863 28 /* 18/90-18/99 */,
864 30 /* 18/100-18/109 */,
865 31 /* 18/110-18/119 */,
866 32 /* 18/120-18/129 */,
867 33 /* 18/130-18/139 */,
868 34 /* 18/140-18/149 */,
869 35 /* 18/150-18/159 */,
870 37 /* 18/160-18/169 */,
871 40 /* 18/170-18/179 */,
872 44 /* 18/180-18/189 */,
873 48 /* 18/190-18/199 */,
874 50 /* 18/200-18/209 */,
875 50 /* 18/210-18/219 */,
881 * Stat Table (STR) -- digging value
883 const byte adj_str_dig[] =
901 10 /* 18/10-18/19 */,
902 12 /* 18/20-18/29 */,
903 15 /* 18/30-18/39 */,
904 20 /* 18/40-18/49 */,
905 25 /* 18/50-18/59 */,
906 30 /* 18/60-18/69 */,
907 35 /* 18/70-18/79 */,
908 40 /* 18/80-18/89 */,
909 45 /* 18/90-18/99 */,
910 50 /* 18/100-18/109 */,
911 55 /* 18/110-18/119 */,
912 60 /* 18/120-18/129 */,
913 65 /* 18/130-18/139 */,
914 70 /* 18/140-18/149 */,
915 75 /* 18/150-18/159 */,
916 80 /* 18/160-18/169 */,
917 85 /* 18/170-18/179 */,
918 90 /* 18/180-18/189 */,
919 95 /* 18/190-18/199 */,
920 100 /* 18/200-18/209 */,
921 100 /* 18/210-18/219 */,
926 * 器用さによる盗難防止&体当たり成功判定修正テーブル
927 * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
929 const byte adj_dex_safe[] =
946 10 /* 18/00-18/09 */,
947 10 /* 18/10-18/19 */,
948 15 /* 18/20-18/29 */,
949 15 /* 18/30-18/39 */,
950 20 /* 18/40-18/49 */,
951 25 /* 18/50-18/59 */,
952 30 /* 18/60-18/69 */,
953 35 /* 18/70-18/79 */,
954 40 /* 18/80-18/89 */,
955 45 /* 18/90-18/99 */,
956 50 /* 18/100-18/109 */,
957 60 /* 18/110-18/119 */,
958 70 /* 18/120-18/129 */,
959 80 /* 18/130-18/139 */,
960 90 /* 18/140-18/149 */,
961 100 /* 18/150-18/159 */,
962 100 /* 18/160-18/169 */,
963 100 /* 18/170-18/179 */,
964 100 /* 18/180-18/189 */,
965 100 /* 18/190-18/199 */,
966 100 /* 18/200-18/209 */,
967 100 /* 18/210-18/219 */,
972 * 耐久による基本HP自然治癒値テーブル /
973 * Stat Table (CON) -- base regeneration rate
975 const byte adj_con_fix[] =
1000 3 /* 18/80-18/89 */,
1001 3 /* 18/90-18/99 */,
1002 4 /* 18/100-18/109 */,
1003 4 /* 18/110-18/119 */,
1004 5 /* 18/120-18/129 */,
1005 6 /* 18/130-18/139 */,
1006 6 /* 18/140-18/149 */,
1007 7 /* 18/150-18/159 */,
1008 7 /* 18/160-18/169 */,
1009 8 /* 18/170-18/179 */,
1010 8 /* 18/180-18/189 */,
1011 8 /* 18/190-18/199 */,
1012 9 /* 18/200-18/209 */,
1013 9 /* 18/210-18/219 */,
1018 * 耐久による基本HP自然治癒値テーブル /
1019 * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
1021 const byte adj_con_mhp[] =
1038 128 + 4 /* 18/00-18/09 */,
1039 128 + 5 /* 18/10-18/19 */,
1040 128 + 6 /* 18/20-18/29 */,
1041 128 + 7 /* 18/30-18/39 */,
1042 128 + 8 /* 18/40-18/49 */,
1043 128 + 9 /* 18/50-18/59 */,
1044 128 + 10 /* 18/60-18/69 */,
1045 128 + 11 /* 18/70-18/79 */,
1046 128 + 12 /* 18/80-18/89 */,
1047 128 + 14 /* 18/90-18/99 */,
1048 128 + 17 /* 18/100-18/109 */,
1049 128 + 20 /* 18/110-18/119 */,
1050 128 + 23 /* 18/120-18/129 */,
1051 128 + 26 /* 18/130-18/139 */,
1052 128 + 29 /* 18/140-18/149 */,
1053 128 + 32 /* 18/150-18/159 */,
1054 128 + 35 /* 18/160-18/169 */,
1055 128 + 38 /* 18/170-18/179 */,
1056 128 + 40 /* 18/180-18/189 */,
1057 128 + 42 /* 18/190-18/199 */,
1058 128 + 44 /* 18/200-18/209 */,
1059 128 + 46 /* 18/210-18/219 */,
1060 128 + 48 /* 18/220+ */
1065 * Stat Table (CHR) -- charm
1067 const byte adj_chr_chm[] =
1084 9 /* 18/00-18/09 */,
1085 10 /* 18/10-18/19 */,
1086 12 /* 18/20-18/29 */,
1087 15 /* 18/30-18/39 */,
1088 18 /* 18/40-18/49 */,
1089 21 /* 18/50-18/59 */,
1090 24 /* 18/60-18/69 */,
1091 28 /* 18/70-18/79 */,
1092 32 /* 18/80-18/89 */,
1093 36 /* 18/90-18/99 */,
1094 39 /* 18/100-18/109 */,
1095 42 /* 18/110-18/119 */,
1096 45 /* 18/120-18/129 */,
1097 49 /* 18/130-18/139 */,
1098 53 /* 18/140-18/149 */,
1099 57 /* 18/150-18/159 */,
1100 61 /* 18/160-18/169 */,
1101 65 /* 18/170-18/179 */,
1102 69 /* 18/180-18/189 */,
1103 73 /* 18/190-18/199 */,
1104 77 /* 18/200-18/209 */,
1105 81 /* 18/210-18/219 */,
1109 /*** Player information ***/
1112 * Static player info record
1117 * Pointer to the player info
1119 player_type *p_ptr = &p_body;
1122 * Return alignment title
1124 concptr your_alignment(player_type *creature_ptr)
1126 if (creature_ptr->align > 150) return _("大善", "Lawful");
1127 else if (creature_ptr->align > 50) return _("中善", "Good");
1128 else if (creature_ptr->align > 10) return _("小善", "Neutral Good");
1129 else if (creature_ptr->align > -11) return _("中立", "Neutral");
1130 else if (creature_ptr->align > -51) return _("小悪", "Neutral Evil");
1131 else if (creature_ptr->align > -151) return _("中悪", "Evil");
1132 else return _("大悪", "Chaotic");
1137 * Return proficiency level of weapons and misc. skills (except riding)
1139 int weapon_exp_level(int weapon_exp)
1141 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1142 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1143 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1144 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
1145 else return EXP_LEVEL_MASTER;
1150 * Return proficiency level of riding
1152 int riding_exp_level(int riding_exp)
1154 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1155 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1156 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1157 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
1158 else return EXP_LEVEL_MASTER;
1163 * Return proficiency level of spells
1165 int spell_exp_level(int spell_exp)
1167 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1168 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1169 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1170 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
1171 else return EXP_LEVEL_MASTER;
1176 * @brief プレイヤーの全ステータスを更新する /
1177 * Calculate the players current "state", taking into account
1178 * not only race/class intrinsics, but also objects being worn
1179 * and temporary spell effects.
1183 * See also calc_mana() and calc_hitpoints().
1185 * Take note of the new "speed code", in particular, a very strong
1186 * player will start slowing down as soon as he reaches 150 pounds,
1187 * but not until he reaches 450 pounds will he be half as fast as
1188 * a normal kobold. This both hurts and helps the player, hurts
1189 * because in the old days a player could just avoid 300 pounds,
1190 * and helps because now carrying 300 pounds is not very painful.
1192 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
1193 * damage, since that would affect non-combat things. These values
1194 * are actually added in later, at the appropriate place.
1196 * This function induces various "status" messages.
1199 void calc_bonuses(player_type *creature_ptr)
1203 int default_hand = 0;
1204 int empty_hands_status = empty_hands(creature_ptr, TRUE);
1207 BIT_FLAGS flgs[TR_FLAG_SIZE];
1209 bool yoiyami = FALSE;
1210 bool down_saving = FALSE;
1212 bool have_sw = FALSE, have_kabe = FALSE;
1213 bool easy_2weapon = FALSE;
1214 bool riding_levitation = FALSE;
1215 OBJECT_IDX this_o_idx, next_o_idx = 0;
1216 const player_race *tmp_rp_ptr;
1218 /* Save the old vision stuff */
1219 bool old_telepathy = creature_ptr->telepathy;
1220 bool old_esp_animal = creature_ptr->esp_animal;
1221 bool old_esp_undead = creature_ptr->esp_undead;
1222 bool old_esp_demon = creature_ptr->esp_demon;
1223 bool old_esp_orc = creature_ptr->esp_orc;
1224 bool old_esp_troll = creature_ptr->esp_troll;
1225 bool old_esp_giant = creature_ptr->esp_giant;
1226 bool old_esp_dragon = creature_ptr->esp_dragon;
1227 bool old_esp_human = creature_ptr->esp_human;
1228 bool old_esp_evil = creature_ptr->esp_evil;
1229 bool old_esp_good = creature_ptr->esp_good;
1230 bool old_esp_nonliving = creature_ptr->esp_nonliving;
1231 bool old_esp_unique = creature_ptr->esp_unique;
1232 bool old_see_inv = creature_ptr->see_inv;
1233 bool old_mighty_throw = creature_ptr->mighty_throw;
1235 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1236 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1238 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
1239 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
1241 extra_blows[0] = extra_blows[1] = 0;
1243 for (int i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
1245 creature_ptr->dis_ac = creature_ptr->ac = 0;
1246 creature_ptr->dis_to_h[0] = creature_ptr->to_h[0] = 0;
1247 creature_ptr->dis_to_h[1] = creature_ptr->to_h[1] = 0;
1248 creature_ptr->dis_to_d[0] = creature_ptr->to_d[0] = 0;
1249 creature_ptr->dis_to_d[1] = creature_ptr->to_d[1] = 0;
1250 creature_ptr->dis_to_h_b = creature_ptr->to_h_b = 0;
1251 creature_ptr->dis_to_a = creature_ptr->to_a = 0;
1252 creature_ptr->to_h_m = 0;
1253 creature_ptr->to_d_m = 0;
1254 creature_ptr->to_m_chance = 0;
1255 creature_ptr->to_dd[0] = creature_ptr->to_ds[0] = 0;
1256 creature_ptr->to_dd[1] = creature_ptr->to_ds[1] = 0;
1259 creature_ptr->num_blow[0] = 1;
1260 creature_ptr->num_blow[1] = 1;
1261 creature_ptr->num_fire = 100;
1262 creature_ptr->tval_xtra = 0;
1263 creature_ptr->tval_ammo = 0;
1264 creature_ptr->cursed = 0L;
1265 creature_ptr->bless_blade = FALSE;
1266 creature_ptr->xtra_might = FALSE;
1267 creature_ptr->impact[0] = FALSE;
1268 creature_ptr->impact[1] = FALSE;
1269 creature_ptr->pass_wall = FALSE;
1270 creature_ptr->kill_wall = FALSE;
1271 creature_ptr->dec_mana = FALSE;
1272 creature_ptr->easy_spell = FALSE;
1273 creature_ptr->heavy_spell = FALSE;
1274 creature_ptr->see_inv = FALSE;
1275 creature_ptr->free_act = FALSE;
1276 creature_ptr->slow_digest = FALSE;
1277 creature_ptr->regenerate = FALSE;
1278 creature_ptr->can_swim = FALSE;
1279 creature_ptr->levitation = FALSE;
1280 creature_ptr->hold_exp = FALSE;
1281 creature_ptr->telepathy = FALSE;
1282 creature_ptr->esp_animal = FALSE;
1283 creature_ptr->esp_undead = FALSE;
1284 creature_ptr->esp_demon = FALSE;
1285 creature_ptr->esp_orc = FALSE;
1286 creature_ptr->esp_troll = FALSE;
1287 creature_ptr->esp_giant = FALSE;
1288 creature_ptr->esp_dragon = FALSE;
1289 creature_ptr->esp_human = FALSE;
1290 creature_ptr->esp_evil = FALSE;
1291 creature_ptr->esp_good = FALSE;
1292 creature_ptr->esp_nonliving = FALSE;
1293 creature_ptr->esp_unique = FALSE;
1294 creature_ptr->lite = FALSE;
1295 creature_ptr->sustain_str = FALSE;
1296 creature_ptr->sustain_int = FALSE;
1297 creature_ptr->sustain_wis = FALSE;
1298 creature_ptr->sustain_con = FALSE;
1299 creature_ptr->sustain_dex = FALSE;
1300 creature_ptr->sustain_chr = FALSE;
1301 creature_ptr->resist_acid = FALSE;
1302 creature_ptr->resist_elec = FALSE;
1303 creature_ptr->resist_fire = FALSE;
1304 creature_ptr->resist_cold = FALSE;
1305 creature_ptr->resist_pois = FALSE;
1306 creature_ptr->resist_conf = FALSE;
1307 creature_ptr->resist_sound = FALSE;
1308 creature_ptr->resist_lite = FALSE;
1309 creature_ptr->resist_dark = FALSE;
1310 creature_ptr->resist_chaos = FALSE;
1311 creature_ptr->resist_disen = FALSE;
1312 creature_ptr->resist_shard = FALSE;
1313 creature_ptr->resist_nexus = FALSE;
1314 creature_ptr->resist_blind = FALSE;
1315 creature_ptr->resist_neth = FALSE;
1316 creature_ptr->resist_time = FALSE;
1317 creature_ptr->resist_water = FALSE;
1318 creature_ptr->resist_fear = FALSE;
1319 creature_ptr->reflect = FALSE;
1320 creature_ptr->sh_fire = FALSE;
1321 creature_ptr->sh_elec = FALSE;
1322 creature_ptr->sh_cold = FALSE;
1323 creature_ptr->anti_magic = FALSE;
1324 creature_ptr->anti_tele = FALSE;
1325 creature_ptr->warning = FALSE;
1326 creature_ptr->mighty_throw = FALSE;
1327 creature_ptr->see_nocto = FALSE;
1328 creature_ptr->immune_acid = FALSE;
1329 creature_ptr->immune_elec = FALSE;
1330 creature_ptr->immune_fire = FALSE;
1331 creature_ptr->immune_cold = FALSE;
1332 creature_ptr->ryoute = FALSE;
1333 creature_ptr->migite = FALSE;
1334 creature_ptr->hidarite = FALSE;
1335 creature_ptr->no_flowed = FALSE;
1337 if (creature_ptr->mimic_form) tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1338 else tmp_rp_ptr = &race_info[creature_ptr->prace];
1340 creature_ptr->see_infra = tmp_rp_ptr->infra;
1341 creature_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
1342 creature_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
1343 creature_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
1344 creature_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
1345 creature_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
1346 creature_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
1347 creature_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
1348 creature_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1349 creature_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1350 creature_ptr->skill_dig = 0;
1352 if (has_melee_weapon(creature_ptr, INVEN_RARM)) creature_ptr->migite = TRUE;
1353 if (has_melee_weapon(creature_ptr, INVEN_LARM))
1355 creature_ptr->hidarite = TRUE;
1356 if (!creature_ptr->migite) default_hand = 1;
1359 if (can_two_hands_wielding(creature_ptr))
1361 if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
1362 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
1364 creature_ptr->ryoute = TRUE;
1366 else if (creature_ptr->hidarite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) &&
1367 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM]))
1369 creature_ptr->ryoute = TRUE;
1373 switch (creature_ptr->pclass)
1376 case CLASS_FORCETRAINER:
1377 case CLASS_BERSERKER:
1378 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
1380 creature_ptr->migite = TRUE;
1381 creature_ptr->ryoute = TRUE;
1388 if (!creature_ptr->migite && !creature_ptr->hidarite)
1390 if (empty_hands_status & EMPTY_HAND_RARM) creature_ptr->migite = TRUE;
1391 else if (empty_hands_status == EMPTY_HAND_LARM)
1393 creature_ptr->hidarite = TRUE;
1398 if (creature_ptr->special_defense & KAMAE_MASK)
1400 if (!(empty_hands_status & EMPTY_HAND_RARM))
1402 set_action(creature_ptr, ACTION_NONE);
1406 switch (creature_ptr->pclass)
1409 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1410 if (creature_ptr->lev > 44) creature_ptr->regenerate = TRUE;
1413 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1415 case CLASS_CHAOS_WARRIOR:
1416 if (creature_ptr->lev > 29) creature_ptr->resist_chaos = TRUE;
1417 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1419 case CLASS_MINDCRAFTER:
1420 if (creature_ptr->lev > 9) creature_ptr->resist_fear = TRUE;
1421 if (creature_ptr->lev > 19) creature_ptr->sustain_wis = TRUE;
1422 if (creature_ptr->lev > 29) creature_ptr->resist_conf = TRUE;
1423 if (creature_ptr->lev > 39) creature_ptr->telepathy = TRUE;
1426 case CLASS_FORCETRAINER:
1427 if (!(heavy_armor(creature_ptr)))
1429 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1430 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1431 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1432 new_speed += (creature_ptr->lev) / 10;
1434 if (creature_ptr->lev > 24)
1435 creature_ptr->free_act = TRUE;
1439 case CLASS_SORCERER:
1440 creature_ptr->to_a -= 50;
1441 creature_ptr->dis_to_a -= 50;
1444 creature_ptr->resist_sound = TRUE;
1447 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1449 case CLASS_BERSERKER:
1450 creature_ptr->shero = 1;
1451 creature_ptr->sustain_str = TRUE;
1452 creature_ptr->sustain_dex = TRUE;
1453 creature_ptr->sustain_con = TRUE;
1454 creature_ptr->regenerate = TRUE;
1455 creature_ptr->free_act = TRUE;
1457 if (creature_ptr->lev > 29) new_speed++;
1458 if (creature_ptr->lev > 39) new_speed++;
1459 if (creature_ptr->lev > 44) new_speed++;
1460 if (creature_ptr->lev > 49) new_speed++;
1461 creature_ptr->to_a += 10 + creature_ptr->lev / 2;
1462 creature_ptr->dis_to_a += 10 + creature_ptr->lev / 2;
1463 creature_ptr->skill_dig += (100 + creature_ptr->lev * 8);
1464 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1465 creature_ptr->redraw |= PR_STATUS;
1467 case CLASS_MIRROR_MASTER:
1468 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1471 if (heavy_armor(creature_ptr))
1473 new_speed -= (creature_ptr->lev) / 10;
1474 creature_ptr->skill_stl -= (creature_ptr->lev) / 10;
1476 else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1477 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1480 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1481 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1482 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1483 new_speed += (creature_ptr->lev) / 10;
1484 creature_ptr->skill_stl += (creature_ptr->lev) / 10;
1485 if (creature_ptr->lev > 24)
1486 creature_ptr->free_act = TRUE;
1489 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1490 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1492 creature_ptr->to_a += creature_ptr->lev / 2 + 5;
1493 creature_ptr->dis_to_a += creature_ptr->lev / 2 + 5;
1496 creature_ptr->slow_digest = TRUE;
1497 creature_ptr->resist_fear = TRUE;
1498 if (creature_ptr->lev > 19) creature_ptr->resist_pois = TRUE;
1499 if (creature_ptr->lev > 24) creature_ptr->sustain_dex = TRUE;
1500 if (creature_ptr->lev > 29) creature_ptr->see_inv = TRUE;
1501 if (creature_ptr->lev > 44)
1503 creature_ptr->oppose_pois = 1;
1504 creature_ptr->redraw |= PR_STATUS;
1507 creature_ptr->see_nocto = TRUE;
1511 if (creature_ptr->mimic_form)
1513 switch (creature_ptr->mimic_form)
1516 creature_ptr->hold_exp = TRUE;
1517 creature_ptr->resist_chaos = TRUE;
1518 creature_ptr->resist_neth = TRUE;
1519 creature_ptr->resist_fire = TRUE;
1520 creature_ptr->oppose_fire = 1;
1521 creature_ptr->see_inv = TRUE;
1523 creature_ptr->redraw |= PR_STATUS;
1524 creature_ptr->to_a += 10;
1525 creature_ptr->dis_to_a += 10;
1527 case MIMIC_DEMON_LORD:
1528 creature_ptr->hold_exp = TRUE;
1529 creature_ptr->resist_chaos = TRUE;
1530 creature_ptr->resist_neth = TRUE;
1531 creature_ptr->immune_fire = TRUE;
1532 creature_ptr->resist_acid = TRUE;
1533 creature_ptr->resist_fire = TRUE;
1534 creature_ptr->resist_cold = TRUE;
1535 creature_ptr->resist_elec = TRUE;
1536 creature_ptr->resist_pois = TRUE;
1537 creature_ptr->resist_conf = TRUE;
1538 creature_ptr->resist_disen = TRUE;
1539 creature_ptr->resist_nexus = TRUE;
1540 creature_ptr->resist_fear = TRUE;
1541 creature_ptr->sh_fire = TRUE;
1542 creature_ptr->see_inv = TRUE;
1543 creature_ptr->telepathy = TRUE;
1544 creature_ptr->levitation = TRUE;
1545 creature_ptr->kill_wall = TRUE;
1547 creature_ptr->to_a += 20;
1548 creature_ptr->dis_to_a += 20;
1551 creature_ptr->resist_dark = TRUE;
1552 creature_ptr->hold_exp = TRUE;
1553 creature_ptr->resist_neth = TRUE;
1554 creature_ptr->resist_cold = TRUE;
1555 creature_ptr->resist_pois = TRUE;
1556 creature_ptr->see_inv = TRUE;
1558 creature_ptr->to_a += 10;
1559 creature_ptr->dis_to_a += 10;
1560 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1566 switch (creature_ptr->prace)
1569 creature_ptr->resist_lite = TRUE;
1572 creature_ptr->hold_exp = TRUE;
1575 creature_ptr->free_act = TRUE;
1578 creature_ptr->resist_blind = TRUE;
1581 creature_ptr->resist_dark = TRUE;
1583 case RACE_HALF_TROLL:
1584 creature_ptr->sustain_str = TRUE;
1586 if (creature_ptr->lev > 14)
1588 creature_ptr->regenerate = TRUE;
1589 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER)
1591 creature_ptr->slow_digest = TRUE;
1592 /* Let's not make Regeneration
1593 * a disadvantage for the poor warriors who can
1594 * never learn a spell that satisfies hunger (actually
1595 * neither can rogues, but half-trolls are not
1596 * supposed to play rogues) */
1601 creature_ptr->sustain_con = TRUE;
1602 creature_ptr->regenerate = TRUE;
1605 creature_ptr->resist_lite = TRUE;
1606 creature_ptr->see_inv = TRUE;
1608 case RACE_BARBARIAN:
1609 creature_ptr->resist_fear = TRUE;
1611 case RACE_HALF_OGRE:
1612 creature_ptr->resist_dark = TRUE;
1613 creature_ptr->sustain_str = TRUE;
1615 case RACE_HALF_GIANT:
1616 creature_ptr->sustain_str = TRUE;
1617 creature_ptr->resist_shard = TRUE;
1619 case RACE_HALF_TITAN:
1620 creature_ptr->resist_chaos = TRUE;
1623 creature_ptr->resist_sound = TRUE;
1626 creature_ptr->resist_acid = TRUE;
1627 if (creature_ptr->lev > 19) creature_ptr->immune_acid = TRUE;
1630 creature_ptr->resist_conf = TRUE;
1631 creature_ptr->resist_acid = TRUE;
1632 new_speed += (creature_ptr->lev) / 10;
1635 creature_ptr->resist_pois = TRUE;
1638 creature_ptr->resist_disen = TRUE;
1639 creature_ptr->resist_dark = TRUE;
1642 creature_ptr->resist_dark = TRUE;
1643 if (creature_ptr->lev > 19) creature_ptr->see_inv = TRUE;
1645 case RACE_DRACONIAN:
1646 creature_ptr->levitation = TRUE;
1647 if (creature_ptr->lev > 4) creature_ptr->resist_fire = TRUE;
1648 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1649 if (creature_ptr->lev > 14) creature_ptr->resist_acid = TRUE;
1650 if (creature_ptr->lev > 19) creature_ptr->resist_elec = TRUE;
1651 if (creature_ptr->lev > 34) creature_ptr->resist_pois = TRUE;
1653 case RACE_MIND_FLAYER:
1654 creature_ptr->sustain_int = TRUE;
1655 creature_ptr->sustain_wis = TRUE;
1656 if (creature_ptr->lev > 14) creature_ptr->see_inv = TRUE;
1657 if (creature_ptr->lev > 29) creature_ptr->telepathy = TRUE;
1660 creature_ptr->resist_fire = TRUE;
1661 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1664 creature_ptr->slow_digest = TRUE;
1665 creature_ptr->free_act = TRUE;
1666 creature_ptr->see_inv = TRUE;
1667 creature_ptr->resist_pois = TRUE;
1668 if (creature_ptr->lev > 34) creature_ptr->hold_exp = TRUE;
1671 creature_ptr->resist_shard = TRUE;
1672 creature_ptr->hold_exp = TRUE;
1673 creature_ptr->see_inv = TRUE;
1674 creature_ptr->resist_pois = TRUE;
1675 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1678 creature_ptr->resist_neth = TRUE;
1679 creature_ptr->hold_exp = TRUE;
1680 creature_ptr->see_inv = TRUE;
1681 creature_ptr->resist_pois = TRUE;
1682 creature_ptr->slow_digest = TRUE;
1683 if (creature_ptr->lev > 4) creature_ptr->resist_cold = TRUE;
1686 creature_ptr->resist_dark = TRUE;
1687 creature_ptr->hold_exp = TRUE;
1688 creature_ptr->resist_neth = TRUE;
1689 creature_ptr->resist_cold = TRUE;
1690 creature_ptr->resist_pois = TRUE;
1691 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1694 creature_ptr->levitation = TRUE;
1695 creature_ptr->free_act = TRUE;
1696 creature_ptr->resist_neth = TRUE;
1697 creature_ptr->hold_exp = TRUE;
1698 creature_ptr->see_inv = TRUE;
1699 creature_ptr->resist_pois = TRUE;
1700 creature_ptr->slow_digest = TRUE;
1701 creature_ptr->resist_cold = TRUE;
1702 creature_ptr->pass_wall = TRUE;
1703 if (creature_ptr->lev > 34) creature_ptr->telepathy = TRUE;
1706 creature_ptr->levitation = TRUE;
1707 creature_ptr->resist_lite = TRUE;
1709 new_speed += (creature_ptr->lev) / 10;
1712 creature_ptr->resist_conf = TRUE;
1713 creature_ptr->resist_sound = TRUE;
1716 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
1717 creature_ptr->skill_dig += creature_ptr->lev * 10;
1719 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_STR]++;
1720 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_STR]++;
1721 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_STR]++;
1723 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_DEX]--;
1724 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_DEX]--;
1725 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_DEX]--;
1727 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_CON]++;
1728 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_CON]++;
1729 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_CON]++;
1732 creature_ptr->levitation = TRUE;
1733 creature_ptr->see_inv = TRUE;
1736 creature_ptr->resist_fire = TRUE;
1737 creature_ptr->resist_neth = TRUE;
1738 creature_ptr->hold_exp = TRUE;
1739 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1740 if (creature_ptr->lev > 44)
1742 creature_ptr->oppose_fire = 1;
1743 creature_ptr->redraw |= PR_STATUS;
1748 creature_ptr->sustain_con = TRUE;
1751 creature_ptr->levitation = TRUE;
1754 creature_ptr->resist_conf = TRUE;
1757 creature_ptr->slow_digest = TRUE;
1758 creature_ptr->free_act = TRUE;
1759 creature_ptr->resist_pois = TRUE;
1760 creature_ptr->hold_exp = TRUE;
1763 creature_ptr->resist_water = TRUE;
1770 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU))
1772 creature_ptr->see_inv = TRUE;
1773 creature_ptr->free_act = TRUE;
1774 creature_ptr->slow_digest = TRUE;
1775 creature_ptr->regenerate = TRUE;
1776 creature_ptr->levitation = TRUE;
1777 creature_ptr->hold_exp = TRUE;
1778 creature_ptr->telepathy = TRUE;
1779 creature_ptr->lite = TRUE;
1780 creature_ptr->sustain_str = TRUE;
1781 creature_ptr->sustain_int = TRUE;
1782 creature_ptr->sustain_wis = TRUE;
1783 creature_ptr->sustain_con = TRUE;
1784 creature_ptr->sustain_dex = TRUE;
1785 creature_ptr->sustain_chr = TRUE;
1786 creature_ptr->resist_acid = TRUE;
1787 creature_ptr->resist_elec = TRUE;
1788 creature_ptr->resist_fire = TRUE;
1789 creature_ptr->resist_cold = TRUE;
1790 creature_ptr->resist_pois = TRUE;
1791 creature_ptr->resist_conf = TRUE;
1792 creature_ptr->resist_sound = TRUE;
1793 creature_ptr->resist_lite = TRUE;
1794 creature_ptr->resist_dark = TRUE;
1795 creature_ptr->resist_chaos = TRUE;
1796 creature_ptr->resist_disen = TRUE;
1797 creature_ptr->resist_shard = TRUE;
1798 creature_ptr->resist_nexus = TRUE;
1799 creature_ptr->resist_blind = TRUE;
1800 creature_ptr->resist_neth = TRUE;
1801 creature_ptr->resist_fear = TRUE;
1802 creature_ptr->reflect = TRUE;
1803 creature_ptr->sh_fire = TRUE;
1804 creature_ptr->sh_elec = TRUE;
1805 creature_ptr->sh_cold = TRUE;
1806 creature_ptr->to_a += 100;
1807 creature_ptr->dis_to_a += 100;
1809 else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef)
1811 creature_ptr->to_a += 50;
1812 creature_ptr->dis_to_a += 50;
1815 if (creature_ptr->tim_res_nether)
1817 creature_ptr->resist_neth = TRUE;
1820 if (creature_ptr->tim_sh_fire)
1822 creature_ptr->sh_fire = TRUE;
1825 if (creature_ptr->tim_res_time)
1827 creature_ptr->resist_time = TRUE;
1830 if (creature_ptr->pseikaku == SEIKAKU_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE);
1831 if (creature_ptr->pseikaku == SEIKAKU_NAMAKE) creature_ptr->to_m_chance += 10;
1832 if (creature_ptr->pseikaku == SEIKAKU_KIREMONO) creature_ptr->to_m_chance -= 3;
1833 if ((creature_ptr->pseikaku == SEIKAKU_GAMAN) || (creature_ptr->pseikaku == SEIKAKU_CHIKARA)) creature_ptr->to_m_chance++;
1834 if (creature_ptr->pseikaku == SEIKAKU_CHARGEMAN)
1836 creature_ptr->to_m_chance += 5;
1837 creature_ptr->resist_conf = TRUE;
1840 if (creature_ptr->pseikaku == SEIKAKU_LUCKY) creature_ptr->muta3 |= MUT3_GOOD_LUCK;
1841 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
1843 creature_ptr->resist_blind = TRUE;
1844 creature_ptr->resist_conf = TRUE;
1845 creature_ptr->hold_exp = TRUE;
1846 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1848 if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
1849 new_speed += (creature_ptr->lev) / 10 + 5;
1852 if (music_singing(creature_ptr, MUSIC_WALL))
1854 creature_ptr->kill_wall = TRUE;
1857 for (int i = 0; i < A_MAX; i++)
1859 creature_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
1862 if (creature_ptr->muta3)
1864 if (creature_ptr->muta3 & MUT3_HYPER_STR)
1866 creature_ptr->stat_add[A_STR] += 4;
1869 if (creature_ptr->muta3 & MUT3_PUNY)
1871 creature_ptr->stat_add[A_STR] -= 4;
1874 if (creature_ptr->muta3 & MUT3_HYPER_INT)
1876 creature_ptr->stat_add[A_INT] += 4;
1877 creature_ptr->stat_add[A_WIS] += 4;
1880 if (creature_ptr->muta3 & MUT3_MORONIC)
1882 creature_ptr->stat_add[A_INT] -= 4;
1883 creature_ptr->stat_add[A_WIS] -= 4;
1886 if (creature_ptr->muta3 & MUT3_RESILIENT)
1888 creature_ptr->stat_add[A_CON] += 4;
1891 if (creature_ptr->muta3 & MUT3_XTRA_FAT)
1893 creature_ptr->stat_add[A_CON] += 2;
1897 if (creature_ptr->muta3 & MUT3_ALBINO)
1899 creature_ptr->stat_add[A_CON] -= 4;
1902 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1904 creature_ptr->stat_add[A_CON] -= 2;
1905 creature_ptr->stat_add[A_CHR] -= 1;
1906 creature_ptr->regenerate = FALSE;
1909 if (creature_ptr->muta3 & MUT3_SILLY_VOI)
1911 creature_ptr->stat_add[A_CHR] -= 4;
1914 if (creature_ptr->muta3 & MUT3_BLANK_FAC)
1916 creature_ptr->stat_add[A_CHR] -= 1;
1919 if (creature_ptr->muta3 & MUT3_XTRA_EYES)
1921 creature_ptr->skill_fos += 15;
1922 creature_ptr->skill_srh += 15;
1925 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1927 creature_ptr->skill_sav += (15 + (creature_ptr->lev / 5));
1930 if (creature_ptr->muta3 & MUT3_XTRA_NOIS)
1932 creature_ptr->skill_stl -= 3;
1935 if (creature_ptr->muta3 & MUT3_INFRAVIS)
1937 creature_ptr->see_infra += 3;
1940 if (creature_ptr->muta3 & MUT3_XTRA_LEGS)
1945 if (creature_ptr->muta3 & MUT3_SHORT_LEG)
1950 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
1952 creature_ptr->sh_elec = TRUE;
1955 if (creature_ptr->muta3 & MUT3_FIRE_BODY)
1957 creature_ptr->sh_fire = TRUE;
1958 creature_ptr->lite = TRUE;
1961 if (creature_ptr->muta3 & MUT3_WART_SKIN)
1963 creature_ptr->stat_add[A_CHR] -= 2;
1964 creature_ptr->to_a += 5;
1965 creature_ptr->dis_to_a += 5;
1968 if (creature_ptr->muta3 & MUT3_SCALES)
1970 creature_ptr->stat_add[A_CHR] -= 1;
1971 creature_ptr->to_a += 10;
1972 creature_ptr->dis_to_a += 10;
1975 if (creature_ptr->muta3 & MUT3_IRON_SKIN)
1977 creature_ptr->stat_add[A_DEX] -= 1;
1978 creature_ptr->to_a += 25;
1979 creature_ptr->dis_to_a += 25;
1982 if (creature_ptr->muta3 & MUT3_WINGS)
1984 creature_ptr->levitation = TRUE;
1987 if (creature_ptr->muta3 & MUT3_FEARLESS)
1989 creature_ptr->resist_fear = TRUE;
1992 if (creature_ptr->muta3 & MUT3_REGEN)
1994 creature_ptr->regenerate = TRUE;
1997 if (creature_ptr->muta3 & MUT3_ESP)
1999 creature_ptr->telepathy = TRUE;
2002 if (creature_ptr->muta3 & MUT3_LIMBER)
2004 creature_ptr->stat_add[A_DEX] += 3;
2007 if (creature_ptr->muta3 & MUT3_ARTHRITIS)
2009 creature_ptr->stat_add[A_DEX] -= 3;
2012 if (creature_ptr->muta3 & MUT3_MOTION)
2014 creature_ptr->free_act = TRUE;
2015 creature_ptr->skill_stl += 1;
2018 if (creature_ptr->muta3 & MUT3_ILL_NORM)
2020 creature_ptr->stat_add[A_CHR] = 0;
2024 if (creature_ptr->tsuyoshi)
2026 creature_ptr->stat_add[A_STR] += 4;
2027 creature_ptr->stat_add[A_CON] += 4;
2030 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
2032 int bonus_to_h, bonus_to_d;
2033 o_ptr = &creature_ptr->inventory_list[i];
2034 if (!o_ptr->k_idx) continue;
2036 object_flags(o_ptr, flgs);
2038 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
2039 if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD;
2041 if (have_flag(flgs, TR_STR)) creature_ptr->stat_add[A_STR] += o_ptr->pval;
2042 if (have_flag(flgs, TR_INT)) creature_ptr->stat_add[A_INT] += o_ptr->pval;
2043 if (have_flag(flgs, TR_WIS)) creature_ptr->stat_add[A_WIS] += o_ptr->pval;
2044 if (have_flag(flgs, TR_DEX)) creature_ptr->stat_add[A_DEX] += o_ptr->pval;
2045 if (have_flag(flgs, TR_CON)) creature_ptr->stat_add[A_CON] += o_ptr->pval;
2046 if (have_flag(flgs, TR_CHR)) creature_ptr->stat_add[A_CHR] += o_ptr->pval;
2047 if (have_flag(flgs, TR_MAGIC_MASTERY)) creature_ptr->skill_dev += 8 * o_ptr->pval;
2048 if (have_flag(flgs, TR_STEALTH)) creature_ptr->skill_stl += o_ptr->pval;
2049 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_srh += (o_ptr->pval * 5);
2050 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_fos += (o_ptr->pval * 5);
2051 if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval;
2052 if (have_flag(flgs, TR_TUNNEL)) creature_ptr->skill_dig += (o_ptr->pval * 20);
2053 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
2054 if (have_flag(flgs, TR_BLOWS))
2056 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->ryoute) extra_blows[0] += o_ptr->pval;
2057 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->ryoute) extra_blows[1] += o_ptr->pval;
2058 else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; }
2061 if (have_flag(flgs, TR_IMPACT)) creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
2062 if (have_flag(flgs, TR_AGGRAVATE)) creature_ptr->cursed |= TRC_AGGRAVATE;
2063 if (have_flag(flgs, TR_DRAIN_EXP)) creature_ptr->cursed |= TRC_DRAIN_EXP;
2064 if (have_flag(flgs, TR_TY_CURSE)) creature_ptr->cursed |= TRC_TY_CURSE;
2065 if (have_flag(flgs, TR_ADD_L_CURSE)) creature_ptr->cursed |= TRC_ADD_L_CURSE;
2066 if (have_flag(flgs, TR_ADD_H_CURSE)) creature_ptr->cursed |= TRC_ADD_H_CURSE;
2067 if (have_flag(flgs, TR_DRAIN_HP)) creature_ptr->cursed |= TRC_DRAIN_HP;
2068 if (have_flag(flgs, TR_DRAIN_MANA)) creature_ptr->cursed |= TRC_DRAIN_MANA;
2069 if (have_flag(flgs, TR_CALL_ANIMAL)) creature_ptr->cursed |= TRC_CALL_ANIMAL;
2070 if (have_flag(flgs, TR_CALL_DEMON)) creature_ptr->cursed |= TRC_CALL_DEMON;
2071 if (have_flag(flgs, TR_CALL_DRAGON)) creature_ptr->cursed |= TRC_CALL_DRAGON;
2072 if (have_flag(flgs, TR_CALL_UNDEAD)) creature_ptr->cursed |= TRC_CALL_UNDEAD;
2073 if (have_flag(flgs, TR_COWARDICE)) creature_ptr->cursed |= TRC_COWARDICE;
2074 if (have_flag(flgs, TR_LOW_MELEE)) creature_ptr->cursed |= TRC_LOW_MELEE;
2075 if (have_flag(flgs, TR_LOW_AC)) creature_ptr->cursed |= TRC_LOW_AC;
2076 if (have_flag(flgs, TR_LOW_MAGIC)) creature_ptr->cursed |= TRC_LOW_MAGIC;
2077 if (have_flag(flgs, TR_FAST_DIGEST)) creature_ptr->cursed |= TRC_FAST_DIGEST;
2078 if (have_flag(flgs, TR_SLOW_REGEN)) creature_ptr->cursed |= TRC_SLOW_REGEN;
2079 if (have_flag(flgs, TR_DEC_MANA)) creature_ptr->dec_mana = TRUE;
2080 if (have_flag(flgs, TR_BLESSED)) creature_ptr->bless_blade = TRUE;
2081 if (have_flag(flgs, TR_XTRA_MIGHT)) creature_ptr->xtra_might = TRUE;
2082 if (have_flag(flgs, TR_SLOW_DIGEST)) creature_ptr->slow_digest = TRUE;
2083 if (have_flag(flgs, TR_REGEN)) creature_ptr->regenerate = TRUE;
2084 if (have_flag(flgs, TR_TELEPATHY)) creature_ptr->telepathy = TRUE;
2085 if (have_flag(flgs, TR_ESP_ANIMAL)) creature_ptr->esp_animal = TRUE;
2086 if (have_flag(flgs, TR_ESP_UNDEAD)) creature_ptr->esp_undead = TRUE;
2087 if (have_flag(flgs, TR_ESP_DEMON)) creature_ptr->esp_demon = TRUE;
2088 if (have_flag(flgs, TR_ESP_ORC)) creature_ptr->esp_orc = TRUE;
2089 if (have_flag(flgs, TR_ESP_TROLL)) creature_ptr->esp_troll = TRUE;
2090 if (have_flag(flgs, TR_ESP_GIANT)) creature_ptr->esp_giant = TRUE;
2091 if (have_flag(flgs, TR_ESP_DRAGON)) creature_ptr->esp_dragon = TRUE;
2092 if (have_flag(flgs, TR_ESP_HUMAN)) creature_ptr->esp_human = TRUE;
2093 if (have_flag(flgs, TR_ESP_EVIL)) creature_ptr->esp_evil = TRUE;
2094 if (have_flag(flgs, TR_ESP_GOOD)) creature_ptr->esp_good = TRUE;
2095 if (have_flag(flgs, TR_ESP_NONLIVING)) creature_ptr->esp_nonliving = TRUE;
2096 if (have_flag(flgs, TR_ESP_UNIQUE)) creature_ptr->esp_unique = TRUE;
2098 if (have_flag(flgs, TR_SEE_INVIS)) creature_ptr->see_inv = TRUE;
2099 if (have_flag(flgs, TR_LEVITATION)) creature_ptr->levitation = TRUE;
2100 if (have_flag(flgs, TR_FREE_ACT)) creature_ptr->free_act = TRUE;
2101 if (have_flag(flgs, TR_HOLD_EXP)) creature_ptr->hold_exp = TRUE;
2102 if (have_flag(flgs, TR_WARNING)) {
2103 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription), '$')))
2104 creature_ptr->warning = TRUE;
2107 if (have_flag(flgs, TR_TELEPORT))
2109 if (object_is_cursed(o_ptr)) creature_ptr->cursed |= TRC_TELEPORT;
2112 concptr insc = quark_str(o_ptr->inscription);
2114 /* {.} will stop random teleportation. */
2115 if (o_ptr->inscription && my_strchr(insc, '.'))
2120 creature_ptr->cursed |= TRC_TELEPORT_SELF;
2125 if (have_flag(flgs, TR_IM_FIRE)) creature_ptr->immune_fire = TRUE;
2126 if (have_flag(flgs, TR_IM_ACID)) creature_ptr->immune_acid = TRUE;
2127 if (have_flag(flgs, TR_IM_COLD)) creature_ptr->immune_cold = TRUE;
2128 if (have_flag(flgs, TR_IM_ELEC)) creature_ptr->immune_elec = TRUE;
2130 if (have_flag(flgs, TR_RES_ACID)) creature_ptr->resist_acid = TRUE;
2131 if (have_flag(flgs, TR_RES_ELEC)) creature_ptr->resist_elec = TRUE;
2132 if (have_flag(flgs, TR_RES_FIRE)) creature_ptr->resist_fire = TRUE;
2133 if (have_flag(flgs, TR_RES_COLD)) creature_ptr->resist_cold = TRUE;
2134 if (have_flag(flgs, TR_RES_POIS)) creature_ptr->resist_pois = TRUE;
2135 if (have_flag(flgs, TR_RES_FEAR)) creature_ptr->resist_fear = TRUE;
2136 if (have_flag(flgs, TR_RES_CONF)) creature_ptr->resist_conf = TRUE;
2137 if (have_flag(flgs, TR_RES_SOUND)) creature_ptr->resist_sound = TRUE;
2138 if (have_flag(flgs, TR_RES_LITE)) creature_ptr->resist_lite = TRUE;
2139 if (have_flag(flgs, TR_RES_DARK)) creature_ptr->resist_dark = TRUE;
2140 if (have_flag(flgs, TR_RES_CHAOS)) creature_ptr->resist_chaos = TRUE;
2141 if (have_flag(flgs, TR_RES_DISEN)) creature_ptr->resist_disen = TRUE;
2142 if (have_flag(flgs, TR_RES_SHARDS)) creature_ptr->resist_shard = TRUE;
2143 if (have_flag(flgs, TR_RES_NEXUS)) creature_ptr->resist_nexus = TRUE;
2144 if (have_flag(flgs, TR_RES_BLIND)) creature_ptr->resist_blind = TRUE;
2145 if (have_flag(flgs, TR_RES_NETHER)) creature_ptr->resist_neth = TRUE;
2147 if (have_flag(flgs, TR_REFLECT)) creature_ptr->reflect = TRUE;
2148 if (have_flag(flgs, TR_SH_FIRE)) creature_ptr->sh_fire = TRUE;
2149 if (have_flag(flgs, TR_SH_ELEC)) creature_ptr->sh_elec = TRUE;
2150 if (have_flag(flgs, TR_SH_COLD)) creature_ptr->sh_cold = TRUE;
2151 if (have_flag(flgs, TR_NO_MAGIC)) creature_ptr->anti_magic = TRUE;
2152 if (have_flag(flgs, TR_NO_TELE)) creature_ptr->anti_tele = TRUE;
2154 if (have_flag(flgs, TR_SUST_STR)) creature_ptr->sustain_str = TRUE;
2155 if (have_flag(flgs, TR_SUST_INT)) creature_ptr->sustain_int = TRUE;
2156 if (have_flag(flgs, TR_SUST_WIS)) creature_ptr->sustain_wis = TRUE;
2157 if (have_flag(flgs, TR_SUST_DEX)) creature_ptr->sustain_dex = TRUE;
2158 if (have_flag(flgs, TR_SUST_CON)) creature_ptr->sustain_con = TRUE;
2159 if (have_flag(flgs, TR_SUST_CHR)) creature_ptr->sustain_chr = TRUE;
2161 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
2162 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
2163 if (o_ptr->name2 == EGO_RING_RES_TIME) creature_ptr->resist_time = TRUE;
2164 if (o_ptr->name2 == EGO_RING_THROW) creature_ptr->mighty_throw = TRUE;
2165 if (have_flag(flgs, TR_EASY_SPELL)) creature_ptr->easy_spell = TRUE;
2166 if (o_ptr->name2 == EGO_AMU_FOOL) creature_ptr->heavy_spell = TRUE;
2167 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
2169 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
2171 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2173 creature_ptr->to_m_chance += 10;
2177 creature_ptr->to_m_chance += 3;
2181 if (o_ptr->tval == TV_CAPTURE) continue;
2183 creature_ptr->ac += o_ptr->ac;
2184 creature_ptr->dis_ac += o_ptr->ac;
2185 creature_ptr->to_a += o_ptr->to_a;
2186 if (object_is_known(o_ptr)) creature_ptr->dis_to_a += o_ptr->to_a;
2188 if (o_ptr->curse_flags & TRC_LOW_MELEE)
2190 int slot = i - INVEN_RARM;
2193 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2195 creature_ptr->to_h[slot] -= 15;
2196 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_h[slot] -= 15;
2200 creature_ptr->to_h[slot] -= 5;
2201 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_h[slot] -= 5;
2206 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2208 creature_ptr->to_h_b -= 15;
2209 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_h_b -= 15;
2213 creature_ptr->to_h_b -= 5;
2214 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_h_b -= 5;
2219 if (o_ptr->curse_flags & TRC_LOW_AC)
2221 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2223 creature_ptr->to_a -= 30;
2224 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_a -= 30;
2228 creature_ptr->to_a -= 10;
2229 if (OBJECT_IS_FULL_KNOWN(o_ptr)) creature_ptr->dis_to_a -= 10;
2233 if (i == INVEN_RARM && has_melee_weapon(creature_ptr, i)) continue;
2234 if (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) continue;
2235 if (i == INVEN_BOW) continue;
2237 bonus_to_h = o_ptr->to_h;
2238 bonus_to_d = o_ptr->to_d;
2240 if (creature_ptr->pclass == CLASS_NINJA)
2242 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2;
2243 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2;
2246 creature_ptr->to_h_b += (s16b)bonus_to_h;
2247 creature_ptr->to_h_m += (s16b)bonus_to_h;
2248 creature_ptr->to_d_m += (s16b)bonus_to_d;
2250 if (object_is_known(o_ptr)) creature_ptr->dis_to_h_b += (s16b)bonus_to_h;
2252 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !creature_ptr->ryoute)
2254 creature_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2255 creature_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2256 if (object_is_known(o_ptr))
2258 creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2259 creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2265 if (creature_ptr->migite && creature_ptr->hidarite)
2267 creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2268 creature_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2269 creature_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2270 creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2271 if (!object_is_known(o_ptr)) continue;
2273 creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2274 creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2275 creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2276 creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2280 creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
2281 creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
2283 if (!object_is_known(o_ptr)) continue;
2285 creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
2286 creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
2289 if (object_is_armour(&creature_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&creature_ptr->inventory_list[INVEN_LARM]))
2291 creature_ptr->ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2292 creature_ptr->dis_ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2295 if (old_mighty_throw != creature_ptr->mighty_throw)
2297 creature_ptr->window |= PW_INVEN;
2300 if (creature_ptr->cursed & TRC_TELEPORT) creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
2302 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr))
2304 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx))
2306 creature_ptr->to_a += (creature_ptr->lev * 3) / 2;
2307 creature_ptr->dis_to_a += (creature_ptr->lev * 3) / 2;
2309 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15))
2311 creature_ptr->to_a += ((creature_ptr->lev - 13) / 3);
2312 creature_ptr->dis_to_a += ((creature_ptr->lev - 13) / 3);
2314 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10))
2316 creature_ptr->to_a += ((creature_ptr->lev - 8) / 3);
2317 creature_ptr->dis_to_a += ((creature_ptr->lev - 8) / 3);
2319 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4))
2321 creature_ptr->to_a += (creature_ptr->lev - 2) / 3;
2322 creature_ptr->dis_to_a += (creature_ptr->lev - 2) / 3;
2324 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx))
2326 creature_ptr->to_a += (creature_ptr->lev / 2);
2327 creature_ptr->dis_to_a += (creature_ptr->lev / 2);
2329 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx))
2331 creature_ptr->to_a += (creature_ptr->lev / 3);
2332 creature_ptr->dis_to_a += (creature_ptr->lev / 3);
2334 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2336 creature_ptr->stat_add[A_STR] += 2;
2337 creature_ptr->stat_add[A_DEX] += 2;
2338 creature_ptr->stat_add[A_CON] -= 3;
2340 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2343 else if (creature_ptr->special_defense & KAMAE_GENBU)
2345 creature_ptr->stat_add[A_INT] -= 1;
2346 creature_ptr->stat_add[A_WIS] -= 1;
2347 creature_ptr->stat_add[A_DEX] -= 2;
2348 creature_ptr->stat_add[A_CON] += 3;
2350 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2352 creature_ptr->stat_add[A_STR] -= 2;
2353 creature_ptr->stat_add[A_INT] += 1;
2354 creature_ptr->stat_add[A_WIS] += 1;
2355 creature_ptr->stat_add[A_DEX] += 2;
2356 creature_ptr->stat_add[A_CON] -= 2;
2360 if (creature_ptr->special_defense & KATA_KOUKIJIN)
2362 for (int i = 0; i < A_MAX; i++)
2363 creature_ptr->stat_add[i] += 5;
2364 creature_ptr->to_a -= 50;
2365 creature_ptr->dis_to_a -= 50;
2368 if (creature_ptr->sh_fire) creature_ptr->lite = TRUE;
2370 if (PRACE_IS_(creature_ptr, RACE_GOLEM) || PRACE_IS_(creature_ptr, RACE_ANDROID))
2372 creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
2373 creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
2376 if (creature_ptr->realm1 == REALM_HEX)
2378 if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + CASTING_HEX_NUM(creature_ptr));
2379 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
2380 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
2381 if (hex_spelling(creature_ptr, HEX_BUILDING))
2383 creature_ptr->stat_add[A_STR] += 4;
2384 creature_ptr->stat_add[A_DEX] += 4;
2385 creature_ptr->stat_add[A_CON] += 4;
2388 if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
2390 creature_ptr->sh_fire = TRUE;
2391 creature_ptr->regenerate = TRUE;
2394 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
2396 creature_ptr->sh_cold = TRUE;
2397 creature_ptr->to_a += 30;
2398 creature_ptr->dis_to_a += 30;
2401 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
2403 creature_ptr->sh_elec = TRUE;
2407 for (int i = INVEN_RARM; i <= INVEN_FEET; i++)
2409 ARMOUR_CLASS ac = 0;
2410 o_ptr = &creature_ptr->inventory_list[i];
2411 if (!o_ptr->k_idx) continue;
2412 if (!object_is_armour(o_ptr)) continue;
2413 if (!object_is_cursed(o_ptr)) continue;
2415 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
2416 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
2417 creature_ptr->to_a += (s16b)ac;
2418 creature_ptr->dis_to_a += (s16b)ac;
2423 for (int i = 0; i < A_MAX; i++)
2426 int top = modify_stat_value(creature_ptr->stat_max[i], creature_ptr->stat_add[i]);
2428 if (creature_ptr->stat_top[i] != top)
2430 creature_ptr->stat_top[i] = (s16b)top;
2431 creature_ptr->redraw |= (PR_STATS);
2432 creature_ptr->window |= (PW_PLAYER);
2435 int use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
2437 if ((i == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM))
2439 /* 10 to 18/90 charisma, guaranteed, based on level */
2440 if (use < 8 + 2 * creature_ptr->lev)
2442 use = 8 + 2 * creature_ptr->lev;
2446 if (creature_ptr->stat_use[i] != use)
2448 creature_ptr->stat_use[i] = (s16b)use;
2449 creature_ptr->redraw |= (PR_STATS);
2450 creature_ptr->window |= (PW_PLAYER);
2453 if (use <= 18) ind = (use - 3);
2454 else if (use <= 18 + 219) ind = (15 + (use - 18) / 10);
2457 if (creature_ptr->stat_ind[i] == ind) continue;
2458 creature_ptr->stat_ind[i] = (s16b)ind;
2461 creature_ptr->update |= (PU_HP);
2463 else if (i == A_INT)
2465 if (mp_ptr->spell_stat == A_INT)
2467 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2470 else if (i == A_WIS)
2472 if (mp_ptr->spell_stat == A_WIS)
2474 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2477 else if (i == A_CHR)
2479 if (mp_ptr->spell_stat == A_CHR)
2481 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2485 creature_ptr->window |= (PW_PLAYER);
2489 if (creature_ptr->stun > 50)
2491 creature_ptr->to_h[0] -= 20;
2492 creature_ptr->to_h[1] -= 20;
2493 creature_ptr->to_h_b -= 20;
2494 creature_ptr->to_h_m -= 20;
2495 creature_ptr->dis_to_h[0] -= 20;
2496 creature_ptr->dis_to_h[1] -= 20;
2497 creature_ptr->dis_to_h_b -= 20;
2498 creature_ptr->to_d[0] -= 20;
2499 creature_ptr->to_d[1] -= 20;
2500 creature_ptr->to_d_m -= 20;
2501 creature_ptr->dis_to_d[0] -= 20;
2502 creature_ptr->dis_to_d[1] -= 20;
2504 else if (creature_ptr->stun)
2506 creature_ptr->to_h[0] -= 5;
2507 creature_ptr->to_h[1] -= 5;
2508 creature_ptr->to_h_b -= 5;
2509 creature_ptr->to_h_m -= 5;
2510 creature_ptr->dis_to_h[0] -= 5;
2511 creature_ptr->dis_to_h[1] -= 5;
2512 creature_ptr->dis_to_h_b -= 5;
2513 creature_ptr->to_d[0] -= 5;
2514 creature_ptr->to_d[1] -= 5;
2515 creature_ptr->to_d_m -= 5;
2516 creature_ptr->dis_to_d[0] -= 5;
2517 creature_ptr->dis_to_d[1] -= 5;
2520 if (creature_ptr->wraith_form)
2522 creature_ptr->reflect = TRUE;
2523 creature_ptr->pass_wall = TRUE;
2526 if (creature_ptr->kabenuke)
2528 creature_ptr->pass_wall = TRUE;
2531 if (is_blessed(creature_ptr))
2533 creature_ptr->to_a += 5;
2534 creature_ptr->dis_to_a += 5;
2535 creature_ptr->to_h[0] += 10;
2536 creature_ptr->to_h[1] += 10;
2537 creature_ptr->to_h_b += 10;
2538 creature_ptr->to_h_m += 10;
2539 creature_ptr->dis_to_h[0] += 10;
2540 creature_ptr->dis_to_h[1] += 10;
2541 creature_ptr->dis_to_h_b += 10;
2544 if (creature_ptr->magicdef)
2546 creature_ptr->resist_blind = TRUE;
2547 creature_ptr->resist_conf = TRUE;
2548 creature_ptr->reflect = TRUE;
2549 creature_ptr->free_act = TRUE;
2550 creature_ptr->levitation = TRUE;
2553 if (IS_HERO(creature_ptr))
2555 creature_ptr->to_h[0] += 12;
2556 creature_ptr->to_h[1] += 12;
2557 creature_ptr->to_h_b += 12;
2558 creature_ptr->to_h_m += 12;
2559 creature_ptr->dis_to_h[0] += 12;
2560 creature_ptr->dis_to_h[1] += 12;
2561 creature_ptr->dis_to_h_b += 12;
2564 if (creature_ptr->shero)
2566 creature_ptr->to_h[0] += 12;
2567 creature_ptr->to_h[1] += 12;
2568 creature_ptr->to_h_b -= 12;
2569 creature_ptr->to_h_m += 12;
2570 creature_ptr->to_d[0] += 3 + (creature_ptr->lev / 5);
2571 creature_ptr->to_d[1] += 3 + (creature_ptr->lev / 5);
2572 creature_ptr->to_d_m += 3 + (creature_ptr->lev / 5);
2573 creature_ptr->dis_to_h[0] += 12;
2574 creature_ptr->dis_to_h[1] += 12;
2575 creature_ptr->dis_to_h_b -= 12;
2576 creature_ptr->dis_to_d[0] += 3 + (creature_ptr->lev / 5);
2577 creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
2578 creature_ptr->to_a -= 10;
2579 creature_ptr->dis_to_a -= 10;
2580 creature_ptr->skill_stl -= 7;
2581 creature_ptr->skill_dev -= 20;
2582 creature_ptr->skill_sav -= 30;
2583 creature_ptr->skill_srh -= 15;
2584 creature_ptr->skill_fos -= 15;
2585 creature_ptr->skill_tht -= 20;
2586 creature_ptr->skill_dig += 30;
2589 if (IS_FAST(creature_ptr))
2594 if (creature_ptr->slow)
2599 if (is_time_limit_esp(creature_ptr))
2601 creature_ptr->telepathy = TRUE;
2604 if (creature_ptr->ele_immune)
2606 if (creature_ptr->special_defense & DEFENSE_ACID)
2607 creature_ptr->immune_acid = TRUE;
2608 else if (creature_ptr->special_defense & DEFENSE_ELEC)
2609 creature_ptr->immune_elec = TRUE;
2610 else if (creature_ptr->special_defense & DEFENSE_FIRE)
2611 creature_ptr->immune_fire = TRUE;
2612 else if (creature_ptr->special_defense & DEFENSE_COLD)
2613 creature_ptr->immune_cold = TRUE;
2616 if (creature_ptr->tim_invis)
2618 creature_ptr->see_inv = TRUE;
2621 if (creature_ptr->tim_infra)
2623 creature_ptr->see_infra += 3;
2626 if (creature_ptr->tim_regen)
2628 creature_ptr->regenerate = TRUE;
2631 if (creature_ptr->tim_levitation)
2633 creature_ptr->levitation = TRUE;
2636 if (creature_ptr->tim_reflect)
2638 creature_ptr->reflect = TRUE;
2641 if (IS_HERO(creature_ptr) || creature_ptr->shero)
2643 creature_ptr->resist_fear = TRUE;
2646 if (creature_ptr->telepathy != old_telepathy)
2648 creature_ptr->update |= (PU_MONSTERS);
2651 if ((creature_ptr->esp_animal != old_esp_animal) ||
2652 (creature_ptr->esp_undead != old_esp_undead) ||
2653 (creature_ptr->esp_demon != old_esp_demon) ||
2654 (creature_ptr->esp_orc != old_esp_orc) ||
2655 (creature_ptr->esp_troll != old_esp_troll) ||
2656 (creature_ptr->esp_giant != old_esp_giant) ||
2657 (creature_ptr->esp_dragon != old_esp_dragon) ||
2658 (creature_ptr->esp_human != old_esp_human) ||
2659 (creature_ptr->esp_evil != old_esp_evil) ||
2660 (creature_ptr->esp_good != old_esp_good) ||
2661 (creature_ptr->esp_nonliving != old_esp_nonliving) ||
2662 (creature_ptr->esp_unique != old_esp_unique))
2664 creature_ptr->update |= (PU_MONSTERS);
2667 if (creature_ptr->see_inv != old_see_inv)
2669 creature_ptr->update |= (PU_MONSTERS);
2672 if (creature_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
2674 if (creature_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
2676 if ((creature_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
2677 (creature_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
2679 creature_ptr->to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2680 creature_ptr->dis_to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2683 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2685 int penalty1, penalty2;
2686 penalty1 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_RARM].weight) / 8);
2687 penalty2 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_LARM].weight) / 8);
2688 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
2690 penalty1 = penalty1 / 2 - 5;
2691 penalty2 = penalty2 / 2 - 5;
2693 creature_ptr->to_a += 10;
2694 creature_ptr->dis_to_a += 10;
2698 if (penalty1 > 0) penalty1 /= 2;
2699 if (penalty2 > 0) penalty2 /= 2;
2701 else if ((creature_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD) && ((creature_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI)))
2703 penalty1 = MAX(0, penalty1 - 10);
2704 penalty2 = MAX(0, penalty2 - 10);
2706 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
2708 penalty1 = MIN(0, penalty1);
2709 penalty2 = MIN(0, penalty2);
2710 creature_ptr->to_a += 10;
2711 creature_ptr->dis_to_a += 10;
2715 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
2717 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
2721 if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
2722 if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
2723 creature_ptr->to_h[0] -= (s16b)penalty1;
2724 creature_ptr->to_h[1] -= (s16b)penalty2;
2725 creature_ptr->dis_to_h[0] -= (s16b)penalty1;
2726 creature_ptr->dis_to_h[1] -= (s16b)penalty2;
2729 int j = creature_ptr->total_weight;
2730 if (!creature_ptr->riding)
2732 count = (int)weight_limit(creature_ptr);
2736 monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
2737 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2738 SPEED speed = riding_m_ptr->mspeed;
2740 if (riding_m_ptr->mspeed > 110)
2742 new_speed = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2743 if (new_speed < 110) new_speed = 110;
2750 new_speed += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2751 if (MON_FAST(riding_m_ptr)) new_speed += 10;
2752 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
2753 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
2754 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) creature_ptr->can_swim = TRUE;
2756 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) creature_ptr->pass_wall = FALSE;
2757 if (riding_r_ptr->flags2 & RF2_KILL_WALL) creature_ptr->kill_wall = TRUE;
2759 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2760 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2762 count = 1500 + riding_r_ptr->level * 25;
2765 if (j > count) new_speed -= ((j - count) / (count / 5));
2766 if (creature_ptr->action == ACTION_SEARCH) new_speed -= 10;
2767 if (creature_ptr->prace == RACE_MERFOLK)
2769 if (have_flag(f_ptr->flags, FF_WATER))
2771 new_speed += (2 + creature_ptr->lev / 10);
2773 else if (!creature_ptr->levitation)
2779 creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2780 creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2781 creature_ptr->to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2782 creature_ptr->to_d_m += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2783 creature_ptr->to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2784 creature_ptr->to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2785 creature_ptr->to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2786 creature_ptr->to_h_m += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2787 creature_ptr->to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2788 creature_ptr->to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2789 creature_ptr->to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2790 creature_ptr->to_h_m += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2791 creature_ptr->dis_to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2792 creature_ptr->dis_to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2793 creature_ptr->dis_to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2794 creature_ptr->dis_to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2795 creature_ptr->dis_to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2796 creature_ptr->dis_to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2797 creature_ptr->dis_to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2798 creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2799 creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2801 hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
2802 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2803 creature_ptr->heavy_shoot = is_heavy_shoot(creature_ptr, o_ptr);
2804 if (creature_ptr->heavy_shoot)
2806 creature_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
2807 creature_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
2812 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
2813 if (o_ptr->k_idx && !creature_ptr->heavy_shoot)
2815 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
2816 if ((creature_ptr->pclass == CLASS_SNIPER) &&
2817 (creature_ptr->tval_ammo == TV_BOLT))
2819 creature_ptr->to_h_b += (10 + (creature_ptr->lev / 5));
2820 creature_ptr->dis_to_h_b += (10 + (creature_ptr->lev / 5));
2825 if (creature_ptr->ryoute) hold *= 2;
2826 for (int i = 0; i < 2; i++)
2828 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2829 object_flags(o_ptr, flgs);
2830 creature_ptr->heavy_wield[i] = FALSE;
2831 creature_ptr->icky_wield[i] = FALSE;
2832 creature_ptr->riding_wield[i] = FALSE;
2833 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
2835 creature_ptr->num_blow[i] = 1;
2839 if (hold < o_ptr->weight / 10)
2841 creature_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
2842 creature_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
2843 creature_ptr->heavy_wield[i] = TRUE;
2845 else if (creature_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE;
2847 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
2849 creature_ptr->to_a += 5;
2850 creature_ptr->dis_to_a += 5;
2853 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i])
2855 int str_index, dex_index;
2856 int num = 0, wgt = 0, mul = 0, div = 0;
2857 switch (creature_ptr->pclass)
2860 num = 6; wgt = 70; mul = 5; break;
2862 case CLASS_BERSERKER:
2863 num = 6; wgt = 70; mul = 7; break;
2866 case CLASS_HIGH_MAGE:
2867 case CLASS_BLUE_MAGE:
2868 num = 3; wgt = 100; mul = 2; break;
2871 case CLASS_MAGIC_EATER:
2872 case CLASS_MINDCRAFTER:
2873 num = 5; wgt = 100; mul = 3; break;
2876 num = 5; wgt = 40; mul = 3; break;
2879 num = 5; wgt = 70; mul = 4; break;
2883 num = 5; wgt = 70; mul = 4; break;
2886 num = 5; wgt = 150; mul = 5; break;
2888 case CLASS_WARRIOR_MAGE:
2889 case CLASS_RED_MAGE:
2890 num = 5; wgt = 70; mul = 3; break;
2892 case CLASS_CHAOS_WARRIOR:
2893 num = 5; wgt = 70; mul = 4; break;
2896 num = 5; wgt = 60; mul = 3; break;
2899 num = 4; wgt = 100; mul = 3; break;
2901 case CLASS_IMITATOR:
2902 num = 5; wgt = 70; mul = 4; break;
2904 case CLASS_BEASTMASTER:
2905 num = 5; wgt = 70; mul = 3; break;
2908 if ((creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
2909 else { num = 5; wgt = 100; mul = 3; }
2912 case CLASS_SORCERER:
2913 num = 1; wgt = 1; mul = 1; break;
2918 num = 4; wgt = 70; mul = 2; break;
2920 case CLASS_FORCETRAINER:
2921 num = 4; wgt = 60; mul = 2; break;
2923 case CLASS_MIRROR_MASTER:
2924 num = 3; wgt = 100; mul = 3; break;
2927 num = 4; wgt = 20; mul = 1; break;
2930 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING))
2937 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
2938 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
2940 if (creature_ptr->ryoute && !omoi) str_index++;
2941 if (creature_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1);
2942 if (str_index > 11) str_index = 11;
2944 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
2945 if (dex_index > 11) dex_index = 11;
2947 creature_ptr->num_blow[i] = blows_table[str_index][dex_index];
2948 if (creature_ptr->num_blow[i] > num) creature_ptr->num_blow[i] = (s16b)num;
2950 creature_ptr->num_blow[i] += (s16b)extra_blows[i];
2951 if (creature_ptr->pclass == CLASS_WARRIOR) creature_ptr->num_blow[i] += (creature_ptr->lev / 40);
2952 else if (creature_ptr->pclass == CLASS_BERSERKER)
2953 creature_ptr->num_blow[i] += (creature_ptr->lev / 23);
2954 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
2955 creature_ptr->num_blow[i] ++;
2957 if (creature_ptr->special_defense & KATA_FUUJIN)
2958 creature_ptr->num_blow[i] -= 1;
2960 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
2961 creature_ptr->num_blow[i] = 1;
2963 if (creature_ptr->num_blow[i] < 1)
2964 creature_ptr->num_blow[i] = 1;
2966 creature_ptr->skill_dig += (o_ptr->weight / 10);
2969 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
2970 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
2972 creature_ptr->to_h[i] -= 2;
2973 creature_ptr->to_d[i] -= 2;
2974 creature_ptr->dis_to_h[i] -= 2;
2975 creature_ptr->dis_to_d[i] -= 2;
2976 creature_ptr->icky_wield[i] = TRUE;
2978 else if (creature_ptr->pclass == CLASS_BERSERKER)
2980 creature_ptr->to_h[i] += creature_ptr->lev / 5;
2981 creature_ptr->to_d[i] += creature_ptr->lev / 6;
2982 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
2983 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
2984 if (((i == 0) && !creature_ptr->hidarite) || creature_ptr->ryoute)
2986 creature_ptr->to_h[i] += creature_ptr->lev / 5;
2987 creature_ptr->to_d[i] += creature_ptr->lev / 6;
2988 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
2989 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
2992 else if (creature_ptr->pclass == CLASS_SORCERER)
2994 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
2996 creature_ptr->to_h[i] -= 200;
2997 creature_ptr->to_d[i] -= 200;
2998 creature_ptr->dis_to_h[i] -= 200;
2999 creature_ptr->dis_to_d[i] -= 200;
3000 creature_ptr->icky_wield[i] = TRUE;
3004 creature_ptr->to_h[i] -= 30;
3005 creature_ptr->to_d[i] -= 10;
3006 creature_ptr->dis_to_h[i] -= 30;
3007 creature_ptr->dis_to_d[i] -= 10;
3011 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr))
3013 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3014 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
3015 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
3016 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3017 if (hex_spelling(creature_ptr, HEX_RUNESWORD))
3019 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
3020 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
3021 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
3025 if (creature_ptr->riding == 0) continue;
3027 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3029 creature_ptr->to_h[i] += 15;
3030 creature_ptr->dis_to_h[i] += 15;
3031 creature_ptr->to_dd[i] += 2;
3035 if (have_flag(flgs, TR_RIDING)) continue;
3038 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3044 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3046 if (penalty < 30) penalty = 30;
3049 creature_ptr->to_h[i] -= (s16b)penalty;
3050 creature_ptr->dis_to_h[i] -= (s16b)penalty;
3051 creature_ptr->riding_wield[i] = TRUE;
3054 if (creature_ptr->riding)
3058 creature_ptr->riding_ryoute = FALSE;
3060 if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
3061 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
3063 switch (creature_ptr->pclass)
3066 case CLASS_FORCETRAINER:
3067 case CLASS_BERSERKER:
3068 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
3069 creature_ptr->riding_ryoute = TRUE;
3074 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3076 if (creature_ptr->tval_ammo != TV_ARROW) penalty = 5;
3080 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3082 if (penalty < 30) penalty = 30;
3085 if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
3086 creature_ptr->to_h_b -= (s16b)penalty;
3087 creature_ptr->dis_to_h_b -= (s16b)penalty;
3090 /* Different calculation for monks with empty hands */
3091 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) &&
3092 (empty_hands_status & EMPTY_HAND_RARM) && !creature_ptr->hidarite)
3094 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
3095 creature_ptr->num_blow[0] = 0;
3097 if (creature_ptr->pclass == CLASS_FORCETRAINER)
3099 if (blow_base > 18) creature_ptr->num_blow[0]++;
3100 if (blow_base > 31) creature_ptr->num_blow[0]++;
3101 if (blow_base > 44) creature_ptr->num_blow[0]++;
3102 if (blow_base > 58) creature_ptr->num_blow[0]++;
3105 creature_ptr->to_d[0] += P_PTR_KI / 5;
3106 creature_ptr->dis_to_d[0] += P_PTR_KI / 5;
3111 if (blow_base > 12) creature_ptr->num_blow[0]++;
3112 if (blow_base > 22) creature_ptr->num_blow[0]++;
3113 if (blow_base > 31) creature_ptr->num_blow[0]++;
3114 if (blow_base > 39) creature_ptr->num_blow[0]++;
3115 if (blow_base > 46) creature_ptr->num_blow[0]++;
3116 if (blow_base > 53) creature_ptr->num_blow[0]++;
3117 if (blow_base > 59) creature_ptr->num_blow[0]++;
3120 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
3121 creature_ptr->num_blow[0] /= 2;
3124 creature_ptr->to_h[0] += (creature_ptr->lev / 3);
3125 creature_ptr->dis_to_h[0] += (creature_ptr->lev / 3);
3127 creature_ptr->to_d[0] += (creature_ptr->lev / 6);
3128 creature_ptr->dis_to_d[0] += (creature_ptr->lev / 6);
3131 if (creature_ptr->special_defense & KAMAE_BYAKKO)
3133 creature_ptr->to_a -= 40;
3134 creature_ptr->dis_to_a -= 40;
3137 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
3139 creature_ptr->to_a -= 50;
3140 creature_ptr->dis_to_a -= 50;
3141 creature_ptr->resist_acid = TRUE;
3142 creature_ptr->resist_fire = TRUE;
3143 creature_ptr->resist_elec = TRUE;
3144 creature_ptr->resist_cold = TRUE;
3145 creature_ptr->resist_pois = TRUE;
3146 creature_ptr->sh_fire = TRUE;
3147 creature_ptr->sh_elec = TRUE;
3148 creature_ptr->sh_cold = TRUE;
3149 creature_ptr->levitation = TRUE;
3151 else if (creature_ptr->special_defense & KAMAE_GENBU)
3153 creature_ptr->to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3154 creature_ptr->dis_to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3155 creature_ptr->reflect = TRUE;
3156 creature_ptr->num_blow[0] -= 2;
3157 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42)) creature_ptr->num_blow[0]--;
3158 if (creature_ptr->num_blow[0] < 0) creature_ptr->num_blow[0] = 0;
3160 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
3162 creature_ptr->to_h[0] -= (creature_ptr->lev / 3);
3163 creature_ptr->to_d[0] -= (creature_ptr->lev / 6);
3165 creature_ptr->dis_to_h[0] -= (creature_ptr->lev / 3);
3166 creature_ptr->dis_to_d[0] -= (creature_ptr->lev / 6);
3167 creature_ptr->num_blow[0] /= 2;
3168 creature_ptr->levitation = TRUE;
3171 creature_ptr->num_blow[0] += 1 + extra_blows[0];
3174 if (creature_ptr->riding) creature_ptr->levitation = riding_levitation;
3176 creature_ptr->monk_armour_aux = FALSE;
3178 if (heavy_armor(creature_ptr))
3180 creature_ptr->monk_armour_aux = TRUE;
3183 for (int i = 0; i < 2; i++)
3185 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3187 OBJECT_TYPE_VALUE tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
3188 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
3190 creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3191 creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3192 if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
3194 if (!s_info[creature_ptr->pclass].w_max[tval][sval])
3196 creature_ptr->to_h[i] -= 40;
3197 creature_ptr->dis_to_h[i] -= 40;
3198 creature_ptr->icky_wield[i] = TRUE;
3204 if (creature_ptr->pclass != CLASS_NINJA) continue;
3206 if ((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD))
3209 creature_ptr->to_h[i] -= 40;
3210 creature_ptr->dis_to_h[i] -= 40;
3211 creature_ptr->icky_wield[i] = TRUE;
3212 creature_ptr->num_blow[i] /= 2;
3213 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3216 /* Maximum speed is (+99). (internally it's 110 + 99) */
3217 /* Temporary lightspeed forces to be maximum speed */
3218 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (new_speed > 209))
3223 /* Minimum speed is (-99). (internally it's 110 - 99) */
3224 if (new_speed < 11) new_speed = 11;
3226 if (creature_ptr->pspeed != (byte)new_speed)
3228 creature_ptr->pspeed = (byte)new_speed;
3229 creature_ptr->redraw |= (PR_SPEED);
3234 if (creature_ptr->to_a > (0 - creature_ptr->ac))
3235 creature_ptr->to_a = 0 - creature_ptr->ac;
3236 if (creature_ptr->dis_to_a > (0 - creature_ptr->dis_ac))
3237 creature_ptr->dis_to_a = 0 - creature_ptr->dis_ac;
3240 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a))
3242 creature_ptr->redraw |= (PR_ARMOR);
3243 creature_ptr->window |= (PW_PLAYER);
3246 if (creature_ptr->ryoute && !omoi)
3248 int bonus_to_h = 0, bonus_to_d = 0;
3249 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3250 bonus_to_h = ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3252 creature_ptr->to_h[default_hand] += MAX(bonus_to_h, 1);
3253 creature_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1);
3254 creature_ptr->to_d[default_hand] += MAX(bonus_to_d, 1);
3255 creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
3258 bool is_special_class = creature_ptr->pclass == CLASS_MONK;
3259 is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
3260 is_special_class |= creature_ptr->pclass == CLASS_BERSERKER;
3261 if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
3262 creature_ptr->ryoute = FALSE;
3264 creature_ptr->skill_stl += 1;
3266 if (is_time_limit_stealth(creature_ptr))
3267 creature_ptr->skill_stl += 99;
3269 creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
3270 creature_ptr->skill_dis += adj_int_dis[creature_ptr->stat_ind[A_INT]];
3271 creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
3272 creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
3273 creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
3274 creature_ptr->skill_dis += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
3275 creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
3276 creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
3277 creature_ptr->skill_stl += (cp_ptr->x_stl * creature_ptr->lev / 10);
3278 creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
3279 creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
3280 creature_ptr->skill_thn += ((cp_ptr->x_thn * creature_ptr->lev / 10) + (ap_ptr->a_thn * creature_ptr->lev / 50));
3281 creature_ptr->skill_thb += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3282 creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3284 if ((PRACE_IS_(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != SEIKAKU_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
3286 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
3287 creature_ptr->skill_stl = MIN(creature_ptr->skill_stl - 3, (creature_ptr->skill_stl + 2) / 2);
3290 if (creature_ptr->skill_stl > 30) creature_ptr->skill_stl = 30;
3291 if (creature_ptr->skill_stl < 0) creature_ptr->skill_stl = 0;
3292 if (creature_ptr->skill_dig < 1) creature_ptr->skill_dig = 1;
3293 if (creature_ptr->anti_magic && (creature_ptr->skill_sav < (90 + creature_ptr->lev)))
3294 creature_ptr->skill_sav = 90 + creature_ptr->lev;
3295 if (creature_ptr->tsubureru) creature_ptr->skill_sav = 10;
3296 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (creature_ptr->skill_sav < (95 + creature_ptr->lev)))
3297 creature_ptr->skill_sav = 95 + creature_ptr->lev;
3299 if (down_saving) creature_ptr->skill_sav /= 2;
3301 if (creature_ptr->immune_acid) creature_ptr->resist_acid = TRUE;
3302 if (creature_ptr->immune_elec) creature_ptr->resist_elec = TRUE;
3303 if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
3304 if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
3306 if (current_world_ptr->character_xtra) return;
3308 if (creature_ptr->old_heavy_shoot != creature_ptr->heavy_shoot)
3310 if (creature_ptr->heavy_shoot)
3312 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
3314 else if (creature_ptr->inventory_list[INVEN_BOW].k_idx)
3316 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
3320 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
3323 creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
3326 for (int i = 0; i < 2; i++)
3328 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
3330 if (creature_ptr->heavy_wield[i])
3332 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
3334 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3336 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
3338 else if (creature_ptr->heavy_wield[1 - i])
3340 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
3344 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
3347 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
3350 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i])
3352 if (creature_ptr->riding_wield[i])
3354 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
3356 else if (!creature_ptr->riding)
3358 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
3360 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3362 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
3365 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
3368 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
3371 if (creature_ptr->icky_wield[i])
3373 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
3374 if (current_world_ptr->is_loading_now)
3376 chg_virtue(creature_ptr, V_FAITH, -1);
3379 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3381 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
3385 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
3388 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
3391 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
3393 if (creature_ptr->riding_ryoute)
3396 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
3398 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
3404 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
3406 msg_print("You began to control the pet you're riding with one hand.");
3410 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
3413 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA)) && (creature_ptr->monk_armour_aux != creature_ptr->monk_notify_aux))
3415 if (heavy_armor(creature_ptr))
3417 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
3418 if (current_world_ptr->is_loading_now)
3420 chg_virtue(creature_ptr, V_HARMONY, -1);
3425 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
3428 creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
3431 for (int i = 0; i < INVEN_PACK; i++)
3433 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
3434 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
3437 for (this_o_idx = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3439 o_ptr = &floor_ptr->o_list[this_o_idx];
3440 next_o_idx = o_ptr->next_o_idx;
3442 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
3443 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
3446 if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
3448 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
3450 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
3451 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3454 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER)))
3456 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE];
3457 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3462 static void calc_alignment(player_type *creature_ptr)
3464 creature_ptr->align = 0;
3465 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3466 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
3468 monster_type *m_ptr;
3469 monster_race *r_ptr;
3470 m_ptr = &floor_ptr->m_list[m_idx];
3471 if (!monster_is_valid(m_ptr)) continue;
3472 r_ptr = &r_info[m_ptr->r_idx];
3474 if (!is_pet(m_ptr)) continue;
3476 if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3477 if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
3480 if (creature_ptr->mimic_form)
3482 switch (creature_ptr->mimic_form)
3485 creature_ptr->align -= 200;
3487 case MIMIC_DEMON_LORD:
3488 creature_ptr->align -= 200;
3494 switch (creature_ptr->prace)
3497 creature_ptr->align += 200;
3500 creature_ptr->align -= 200;
3505 for (int i = 0; i < 2; i++)
3507 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3508 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL) continue;
3509 creature_ptr->align -= 1000;
3514 for (int i = 0; i < 8; i++)
3516 switch (creature_ptr->vir_types[i])
3519 creature_ptr->align += creature_ptr->virtues[i] * 2;
3528 creature_ptr->align -= creature_ptr->virtues[i];
3531 creature_ptr->align += creature_ptr->virtues[i];
3536 for (int i = 0; i < j; i++)
3538 if (creature_ptr->align > 0)
3540 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
3541 if (creature_ptr->align < 0) creature_ptr->align = 0;
3543 else if (creature_ptr->align < 0)
3545 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
3546 if (creature_ptr->align > 0) creature_ptr->align = 0;
3553 * @brief プレイヤーの最大HPを計算する /
3554 * Calculate the players (maximal) hit points
3555 * Adjust current hitpoints if necessary
3559 static void calc_hitpoints(player_type *creature_ptr)
3561 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
3562 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
3565 if (creature_ptr->mimic_form)
3567 if (creature_ptr->pclass == CLASS_SORCERER)
3568 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3570 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3571 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
3574 if (creature_ptr->pclass == CLASS_SORCERER)
3576 if (creature_ptr->lev < 30)
3577 mhp = (mhp * (45 + creature_ptr->lev) / 100);
3579 mhp = (mhp * 75 / 100);
3580 bonus = (bonus * 65 / 100);
3585 if (creature_ptr->pclass == CLASS_BERSERKER)
3587 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
3590 if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
3591 if (IS_HERO(creature_ptr)) mhp += 10;
3592 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
3593 if (creature_ptr->tsuyoshi) mhp += 50;
3594 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) mhp += 15;
3595 if (hex_spelling(creature_ptr, HEX_BUILDING)) mhp += 60;
3596 if (creature_ptr->mhp == mhp) return;
3598 if (creature_ptr->chp >= mhp)
3600 creature_ptr->chp = mhp;
3601 creature_ptr->chp_frac = 0;
3605 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
3607 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
3610 creature_ptr->mhp = mhp;
3612 creature_ptr->redraw |= PR_HP;
3613 creature_ptr->window |= PW_PLAYER;
3618 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
3621 * SWD: Experimental modification: multiple light sources have additive effect.
3623 static void calc_torch(player_type *creature_ptr)
3625 creature_ptr->cur_lite = 0;
3626 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
3629 o_ptr = &creature_ptr->inventory_list[i];
3630 if (!o_ptr->k_idx) continue;
3632 if (o_ptr->name2 == EGO_LITE_SHINE) creature_ptr->cur_lite++;
3633 if (o_ptr->name2 != EGO_LITE_DARKNESS)
3635 if (o_ptr->tval == TV_LITE)
3637 if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
3638 if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
3642 BIT_FLAGS flgs[TR_FLAG_SIZE];
3643 object_flags(o_ptr, flgs);
3646 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
3647 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
3648 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
3649 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
3650 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
3651 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
3652 creature_ptr->cur_lite += rad;
3655 if (d_info[creature_ptr->dungeon_idx].flags1 & DF1_DARKNESS && creature_ptr->cur_lite > 1)
3656 creature_ptr->cur_lite = 1;
3658 if (creature_ptr->cur_lite <= 0 && creature_ptr->lite)
3659 creature_ptr->cur_lite++;
3661 if (creature_ptr->cur_lite > 14)
3662 creature_ptr->cur_lite = 14;
3664 if (creature_ptr->cur_lite < 0)
3665 creature_ptr->cur_lite = 0;
3667 if (creature_ptr->old_lite == creature_ptr->cur_lite)
3670 creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
3671 creature_ptr->old_lite = creature_ptr->cur_lite;
3673 if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
3674 set_superstealth(creature_ptr, FALSE);
3679 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
3680 * Calculate number of spells player should have, and forget,
3681 * or remember, spells until that number is properly reflected.
3684 * Note that this function induces various "status" messages,
3685 * which must be bypasses until the character is created.
3687 static void calc_spells(player_type *creature_ptr)
3689 if (!mp_ptr->spell_book) return;
3690 if (!current_world_ptr->character_generated) return;
3691 if (current_world_ptr->character_xtra) return;
3692 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3694 creature_ptr->new_spells = 0;
3698 concptr p = spell_category_name(mp_ptr->spell_book);
3699 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
3700 if (levels < 0) levels = 0;
3702 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
3704 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
3709 if (creature_ptr->pclass == CLASS_SAMURAI)
3713 else if (creature_ptr->realm2 == REALM_NONE)
3715 num_allowed = (num_allowed + 1) / 2;
3716 if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus;
3718 else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST))
3720 if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus;
3724 if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus;
3727 int num_boukyaku = 0;
3728 for (int j = 0; j < 64; j++)
3731 (creature_ptr->spell_forgotten1 & (1L << j)) :
3732 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
3738 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
3739 for (int i = 63; i >= 0; i--)
3741 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3743 int j = creature_ptr->spell_order[i];
3744 if (j >= 99) continue;
3746 const magic_type *s_ptr;
3747 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3750 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3752 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3755 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3757 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3759 if (s_ptr->slevel <= creature_ptr->lev) continue;
3761 bool is_spell_learned = (j < 32) ?
3762 (creature_ptr->spell_learned1 & (1L << j)) :
3763 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3764 if (!is_spell_learned) continue;
3769 creature_ptr->spell_forgotten1 |= (1L << j);
3770 which = creature_ptr->realm1;
3774 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3775 which = creature_ptr->realm2;
3780 creature_ptr->spell_learned1 &= ~(1L << j);
3781 which = creature_ptr->realm1;
3785 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3786 which = creature_ptr->realm2;
3790 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3792 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3794 creature_ptr->new_spells++;
3797 /* Forget spells if we know too many spells */
3798 for (int i = 63; i >= 0; i--)
3800 if (creature_ptr->new_spells >= 0) break;
3801 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3803 int j = creature_ptr->spell_order[i];
3804 if (j >= 99) continue;
3806 bool is_spell_learned = (j < 32) ?
3807 (creature_ptr->spell_learned1 & (1L << j)) :
3808 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3809 if (!is_spell_learned) continue;
3814 creature_ptr->spell_forgotten1 |= (1L << j);
3815 which = creature_ptr->realm1;
3819 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3820 which = creature_ptr->realm2;
3825 creature_ptr->spell_learned1 &= ~(1L << j);
3826 which = creature_ptr->realm1;
3830 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3831 which = creature_ptr->realm2;
3835 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3837 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3839 creature_ptr->new_spells++;
3842 /* Check for spells to remember */
3843 for (int i = 0; i < 64; i++)
3845 if (creature_ptr->new_spells <= 0) break;
3846 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
3847 int j = creature_ptr->spell_order[i];
3850 const magic_type *s_ptr;
3851 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3854 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3856 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3859 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3861 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3863 if (s_ptr->slevel > creature_ptr->lev) continue;
3865 bool is_spell_learned = (j < 32) ?
3866 (creature_ptr->spell_forgotten1 & (1L << j)) :
3867 (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
3868 if (!is_spell_learned) continue;
3873 creature_ptr->spell_forgotten1 &= ~(1L << j);
3874 which = creature_ptr->realm1;
3878 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
3879 which = creature_ptr->realm2;
3884 creature_ptr->spell_learned1 |= (1L << j);
3885 which = creature_ptr->realm1;
3889 creature_ptr->spell_learned2 |= (1L << (j - 32));
3890 which = creature_ptr->realm2;
3894 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3896 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3898 creature_ptr->new_spells--;
3901 if (creature_ptr->realm2 == REALM_NONE)
3904 for (int j = 0; j < 32; j++)
3906 const magic_type *s_ptr;
3907 if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3908 else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3910 if (s_ptr->slevel > creature_ptr->lev) continue;
3912 if (creature_ptr->spell_learned1 & (1L << j))
3921 if ((creature_ptr->new_spells > k) &&
3922 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
3924 creature_ptr->new_spells = (s16b)k;
3928 if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
3930 if (creature_ptr->old_spells == creature_ptr->new_spells) return;
3932 if (creature_ptr->new_spells)
3935 if (creature_ptr->new_spells < 10) {
3936 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
3939 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
3942 msg_format("You can learn %d more %s%s.",
3943 creature_ptr->new_spells, p,
3944 (creature_ptr->new_spells != 1) ? "s" : "");
3948 creature_ptr->old_spells = creature_ptr->new_spells;
3949 creature_ptr->redraw |= PR_STUDY;
3950 creature_ptr->window |= PW_OBJECT;
3955 * @brief プレイヤーの最大MPを計算する /
3956 * Calculate maximum mana. You do not need to know any spells.
3957 * Note that mana is lowered by heavy (or inappropriate) armor.
3960 * This function induces status messages.
3962 static void calc_mana(player_type *creature_ptr)
3964 if (!mp_ptr->spell_book) return;
3967 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3968 (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
3969 (creature_ptr->pclass == CLASS_BLUE_MAGE))
3971 levels = creature_ptr->lev;
3975 if (mp_ptr->spell_first > creature_ptr->lev)
3977 creature_ptr->msp = 0;
3978 creature_ptr->redraw |= (PR_MANA);
3982 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
3986 if (creature_ptr->pclass == CLASS_SAMURAI)
3988 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
3989 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
3993 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
3995 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
3996 if (msp && (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2;
3997 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
3998 if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
4001 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
4003 BIT_FLAGS flgs[TR_FLAG_SIZE];
4004 creature_ptr->cumber_glove = FALSE;
4006 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
4007 object_flags(o_ptr, flgs);
4009 !(have_flag(flgs, TR_FREE_ACT)) &&
4010 !(have_flag(flgs, TR_DEC_MANA)) &&
4011 !(have_flag(flgs, TR_EASY_SPELL)) &&
4012 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
4013 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
4015 creature_ptr->cumber_glove = TRUE;
4016 msp = (3 * msp) / 4;
4020 creature_ptr->cumber_armor = FALSE;
4023 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4024 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4025 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4026 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4027 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4028 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4029 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4031 switch (creature_ptr->pclass)
4034 case CLASS_HIGH_MAGE:
4035 case CLASS_BLUE_MAGE:
4037 case CLASS_FORCETRAINER:
4038 case CLASS_SORCERER:
4040 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4041 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4048 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4049 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
4052 case CLASS_MINDCRAFTER:
4053 case CLASS_BEASTMASTER:
4054 case CLASS_MIRROR_MASTER:
4056 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
4057 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
4062 case CLASS_RED_MAGE:
4063 case CLASS_WARRIOR_MAGE:
4065 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
4066 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
4070 case CLASS_CHAOS_WARRIOR:
4072 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
4073 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
4082 int max_wgt = mp_ptr->spell_weight;
4083 if ((cur_wgt - max_wgt) > 0)
4085 creature_ptr->cumber_armor = TRUE;
4086 switch (creature_ptr->pclass)
4089 case CLASS_HIGH_MAGE:
4090 case CLASS_BLUE_MAGE:
4092 msp -= msp * (cur_wgt - max_wgt) / 600;
4096 case CLASS_MINDCRAFTER:
4097 case CLASS_BEASTMASTER:
4099 case CLASS_FORCETRAINER:
4101 case CLASS_MIRROR_MASTER:
4103 msp -= msp * (cur_wgt - max_wgt) / 800;
4106 case CLASS_SORCERER:
4108 msp -= msp * (cur_wgt - max_wgt) / 900;
4114 case CLASS_RED_MAGE:
4116 msp -= msp * (cur_wgt - max_wgt) / 1000;
4120 case CLASS_CHAOS_WARRIOR:
4121 case CLASS_WARRIOR_MAGE:
4123 msp -= msp * (cur_wgt - max_wgt) / 1200;
4128 creature_ptr->cumber_armor = FALSE;
4133 msp -= msp * (cur_wgt - max_wgt) / 800;
4139 if (msp < 0) msp = 0;
4141 if (creature_ptr->msp != msp)
4143 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
4145 creature_ptr->csp = msp;
4146 creature_ptr->csp_frac = 0;
4150 if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
4152 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
4155 creature_ptr->msp = msp;
4156 creature_ptr->redraw |= (PR_MANA);
4157 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4160 if (current_world_ptr->character_xtra) return;
4162 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
4164 if (creature_ptr->cumber_glove)
4165 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
4167 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
4169 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
4172 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor) return;
4174 if (creature_ptr->cumber_armor)
4175 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
4177 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
4179 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
4184 * @brief 装備中の射撃武器の威力倍率を返す /
4185 * calcurate the fire rate of target object
4186 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
4187 * @return 射撃倍率の値(100で1.00倍)
4189 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
4191 int extra_shots = 0;
4192 BIT_FLAGS flgs[TR_FLAG_SIZE];
4193 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
4196 q_ptr = &creature_ptr->inventory_list[i];
4197 if (!q_ptr->k_idx) continue;
4199 if (i == INVEN_BOW) continue;
4201 object_flags(q_ptr, flgs);
4202 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4205 object_flags(o_ptr, flgs);
4206 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4209 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
4213 num += (extra_shots * 100);
4215 OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
4216 if ((creature_ptr->pclass == CLASS_RANGER) &&
4217 (tval_ammo == TV_ARROW))
4219 num += (creature_ptr->lev * 4);
4222 if ((creature_ptr->pclass == CLASS_CAVALRY) &&
4223 (tval_ammo == TV_ARROW))
4225 num += (creature_ptr->lev * 3);
4228 if (creature_ptr->pclass == CLASS_ARCHER)
4230 if (tval_ammo == TV_ARROW)
4231 num += ((creature_ptr->lev * 5) + 50);
4232 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
4233 num += (creature_ptr->lev * 4);
4236 if (creature_ptr->pclass == CLASS_WARRIOR &&
4237 (tval_ammo <= TV_BOLT) &&
4238 (tval_ammo >= TV_SHOT))
4240 num += (creature_ptr->lev * 2);
4243 if ((creature_ptr->pclass == CLASS_ROGUE) &&
4244 (tval_ammo == TV_SHOT))
4246 num += (creature_ptr->lev * 4);
4254 * @brief プレイヤーの所持重量制限を計算する /
4255 * Computes current weight limit.
4258 WEIGHT weight_limit(player_type *creature_ptr)
4260 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
4261 if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
4267 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
4268 * @param i 判定する手のID(右手:0 左手:1)
4269 * @return 持っているならばTRUE
4271 bool has_melee_weapon(player_type *creature_ptr, int i)
4273 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
4278 * @brief プレイヤーの現在開いている手の状態を返す
4279 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
4280 * @return 開いている手のビットフラグ
4282 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
4284 BIT_FLAGS16 status = EMPTY_HAND_NONE;
4285 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
4286 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
4288 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
4290 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
4291 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
4299 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
4300 * @return ペナルティが適用されるならばTRUE。
4302 bool heavy_armor(player_type *creature_ptr)
4304 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
4307 WEIGHT monk_arm_wgt = 0;
4308 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4309 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4310 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4311 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4312 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4313 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4314 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4316 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
4321 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
4323 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
4325 void update_creature(player_type *creature_ptr)
4327 if (!creature_ptr->update) return;
4329 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4330 if (creature_ptr->update & (PU_AUTODESTROY))
4332 creature_ptr->update &= ~(PU_AUTODESTROY);
4333 autopick_delayed_alter(creature_ptr);
4336 if (creature_ptr->update & (PU_COMBINE))
4338 creature_ptr->update &= ~(PU_COMBINE);
4339 combine_pack(creature_ptr);
4342 if (creature_ptr->update & (PU_REORDER))
4344 creature_ptr->update &= ~(PU_REORDER);
4345 reorder_pack(creature_ptr);
4348 if (creature_ptr->update & (PU_BONUS))
4350 creature_ptr->update &= ~(PU_BONUS);
4351 calc_alignment(creature_ptr);
4352 calc_bonuses(creature_ptr);
4355 if (creature_ptr->update & (PU_TORCH))
4357 creature_ptr->update &= ~(PU_TORCH);
4358 calc_torch(creature_ptr);
4361 if (creature_ptr->update & (PU_HP))
4363 creature_ptr->update &= ~(PU_HP);
4364 calc_hitpoints(creature_ptr);
4367 if (creature_ptr->update & (PU_MANA))
4369 creature_ptr->update &= ~(PU_MANA);
4370 calc_mana(creature_ptr);
4373 if (creature_ptr->update & (PU_SPELLS))
4375 creature_ptr->update &= ~(PU_SPELLS);
4376 calc_spells(creature_ptr);
4379 if (!current_world_ptr->character_generated) return;
4380 if (current_world_ptr->character_icky) return;
4381 if (creature_ptr->update & (PU_UN_LITE))
4383 creature_ptr->update &= ~(PU_UN_LITE);
4384 forget_lite(floor_ptr);
4387 if (creature_ptr->update & (PU_UN_VIEW))
4389 creature_ptr->update &= ~(PU_UN_VIEW);
4390 forget_view(floor_ptr);
4393 if (creature_ptr->update & (PU_VIEW))
4395 creature_ptr->update &= ~(PU_VIEW);
4396 update_view(creature_ptr);
4399 if (creature_ptr->update & (PU_LITE))
4401 creature_ptr->update &= ~(PU_LITE);
4402 update_lite(creature_ptr);
4405 if (creature_ptr->update & (PU_FLOW))
4407 creature_ptr->update &= ~(PU_FLOW);
4408 update_flow(creature_ptr);
4411 if (creature_ptr->update & (PU_DISTANCE))
4413 creature_ptr->update &= ~(PU_DISTANCE);
4415 update_monsters(creature_ptr, TRUE);
4418 if (creature_ptr->update & (PU_MON_LITE))
4420 creature_ptr->update &= ~(PU_MON_LITE);
4421 update_mon_lite(creature_ptr);
4424 if (creature_ptr->update & (PU_DELAY_VIS))
4426 creature_ptr->update &= ~(PU_DELAY_VIS);
4427 delayed_visual_update(creature_ptr);
4430 if (creature_ptr->update & (PU_MONSTERS))
4432 creature_ptr->update &= ~(PU_MONSTERS);
4433 update_monsters(creature_ptr, FALSE);
4439 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
4440 * @return 魔道書を一冊も持っていないならTRUEを返す
4442 bool player_has_no_spellbooks(player_type *creature_ptr)
4445 for (int i = 0; i < INVEN_PACK; i++)
4447 o_ptr = &creature_ptr->inventory_list[i];
4448 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4451 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4452 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
4454 o_ptr = &floor_ptr->o_list[i];
4455 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4462 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
4464 creature_ptr->energy_use = (ENERGY)need_cost;
4468 void free_turn(player_type *creature_ptr)
4470 creature_ptr->energy_use = 0;
4475 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
4478 * @return 配置に成功したらTRUE
4480 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
4482 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
4484 /* Save player location */
4485 creature_ptr->y = y;
4486 creature_ptr->x = x;
4492 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
4495 void wreck_the_pattern(player_type *creature_ptr)
4497 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4498 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
4499 if (pattern_type == PATTERN_TILE_WRECKED) return;
4501 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
4502 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
4504 if (!IS_INVULN(creature_ptr))
4505 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
4507 int to_ruin = randint1(45) + 35;
4511 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
4513 if (pattern_tile(floor_ptr, r_y, r_x) &&
4514 (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
4516 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
4520 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
4525 * @brief エルドリッチホラーの形容詞種別を決める
4526 * @param r_ptr モンスター情報への参照ポインタ
4529 concptr decide_horror_message(monster_race *r_ptr)
4531 int horror_num = randint0(MAX_SAN_HORROR_SUM);
4532 if (horror_num < MAX_SAN_HORROR_COMMON)
4534 return horror_desc_common[horror_num];
4537 if ((r_ptr->flags3 & RF3_EVIL) != 0)
4539 return horror_desc_evil[horror_num - MAX_SAN_HORROR_COMMON];
4542 return horror_desc_neutral[horror_num - MAX_SAN_HORROR_COMMON];
4547 * todo m_nameとdescで何が違うのかは良く分からない
4548 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
4549 * @param m_name モンスター名
4550 * @param r_ptr モンスター情報への参照ポインタ
4553 void see_eldritch_horror(GAME_TEXT *m_name, monster_race *r_ptr)
4555 concptr horror_message = decide_horror_message(r_ptr);
4556 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, m_name);
4557 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
4562 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
4563 * @param desc モンスター名 (エルドリッチホラー持ちの全モンスターからランダム…のはず)
4564 * @param r_ptr モンスターへの参照ポインタ
4567 void feel_eldritch_horror(concptr desc, monster_race *r_ptr)
4569 concptr horror_message = decide_horror_message(r_ptr);
4570 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, desc);
4571 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
4576 * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
4577 * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ。薬・罠・魔法の影響ならNULL
4578 * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
4581 void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
4583 if (creature_ptr->phase_out || !current_world_ptr->character_dungeon) return;
4586 if (!necro && m_ptr)
4588 GAME_TEXT m_name[MAX_NLEN];
4589 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
4590 power = r_ptr->level / 2;
4591 monster_desc(creature_ptr, m_name, m_ptr, 0);
4592 if (!(r_ptr->flags1 & RF1_UNIQUE))
4594 if (r_ptr->flags1 & RF1_FRIENDS)
4599 if (!current_world_ptr->is_loading_now)
4605 if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
4611 if (randint1(100) > power) return;
4613 if (saving_throw(creature_ptr->skill_sav - power))
4616 if (creature_ptr->image)
4618 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
4619 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
4623 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
4624 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
4630 see_eldritch_horror(m_name, r_ptr);
4631 if (PRACE_IS_(creature_ptr, RACE_IMP) ||
4632 PRACE_IS_(creature_ptr, RACE_DEMON) ||
4633 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON) ||
4634 current_world_ptr->wizard)
4637 if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE)
4638 || PRACE_IS_(creature_ptr, RACE_VAMPIRE) || PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
4639 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD))
4641 if (saving_throw(25 + creature_ptr->lev)) return;
4646 monster_race *r_ptr;
4647 GAME_TEXT m_name[MAX_NLEN];
4649 get_mon_num_prep(creature_ptr, get_nightmare, NULL);
4650 r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH, 0)];
4651 power = r_ptr->level + 10;
4652 desc = r_name + r_ptr->name;
4653 get_mon_num_prep(creature_ptr, NULL, NULL);
4657 if (!(r_ptr->flags1 & RF1_UNIQUE))
4658 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
4661 sprintf(m_name, "%s", desc);
4663 if (!(r_ptr->flags1 & RF1_UNIQUE))
4665 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
4669 if (saving_throw(creature_ptr->skill_sav * 100 / power))
4671 msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
4675 if (creature_ptr->image)
4677 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
4678 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
4682 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
4683 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
4689 feel_eldritch_horror(desc, r_ptr);
4690 if (!creature_ptr->mimic_form)
4692 switch (creature_ptr->prace)
4696 if (saving_throw(20 + creature_ptr->lev)) return;
4702 if (saving_throw(10 + creature_ptr->lev)) return;
4708 if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
4710 if (saving_throw(20 + creature_ptr->lev)) return;
4712 else if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
4714 if (saving_throw(10 + creature_ptr->lev)) return;
4720 msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
4723 /* 過去の効果無効率再現のため5回saving_throw 実行 */
4724 if (saving_throw(creature_ptr->skill_sav - power)
4725 && saving_throw(creature_ptr->skill_sav - power)
4726 && saving_throw(creature_ptr->skill_sav - power)
4727 && saving_throw(creature_ptr->skill_sav - power)
4728 && saving_throw(creature_ptr->skill_sav - power))
4733 switch (randint1(22))
4737 if (!(creature_ptr->muta3 & MUT3_MORONIC))
4739 if ((creature_ptr->stat_use[A_INT] < 4) && (creature_ptr->stat_use[A_WIS] < 4))
4741 msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
4745 msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
4748 if (creature_ptr->muta3 & MUT3_HYPER_INT)
4750 msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
4751 creature_ptr->muta3 &= ~(MUT3_HYPER_INT);
4754 creature_ptr->muta3 |= MUT3_MORONIC;
4761 if (!(creature_ptr->muta2 & MUT2_COWARDICE) && !creature_ptr->resist_fear)
4763 msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
4764 if (creature_ptr->muta3 & MUT3_FEARLESS)
4766 msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
4767 creature_ptr->muta3 &= ~(MUT3_FEARLESS);
4770 creature_ptr->muta2 |= MUT2_COWARDICE;
4777 if (!(creature_ptr->muta2 & MUT2_HALLU) && !creature_ptr->resist_chaos)
4779 msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
4780 creature_ptr->muta2 |= MUT2_HALLU;
4787 if (!(creature_ptr->muta2 & MUT2_BERS_RAGE) && !creature_ptr->resist_conf)
4789 msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
4790 creature_ptr->muta2 |= MUT2_BERS_RAGE;
4804 if (!creature_ptr->resist_conf)
4806 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
4809 if (!creature_ptr->resist_chaos && one_in_(3))
4811 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
4814 /* todo いつからかは不明だがreturnとbreakが同時に存在している。どちらがデッドコードか不明瞭なので保留 */
4822 if (!creature_ptr->resist_conf)
4824 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
4826 if (!creature_ptr->free_act)
4828 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4);
4830 if (!creature_ptr->resist_chaos)
4832 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
4837 (void)do_dec_stat(creature_ptr, A_INT);
4838 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
4842 (void)do_dec_stat(creature_ptr, A_WIS);
4843 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
4850 if (lose_all_info(creature_ptr))
4851 msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
4860 do_dec_stat(creature_ptr, A_INT);
4861 do_dec_stat(creature_ptr, A_WIS);
4868 creature_ptr->update |= PU_BONUS;
4869 handle_stuff(creature_ptr);
4874 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
4875 * Advance experience levels and print experience
4878 void check_experience(player_type *creature_ptr)
4880 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
4881 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
4882 if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
4884 if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
4885 if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
4886 if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
4888 if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
4889 if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
4891 creature_ptr->redraw |= (PR_EXP);
4892 handle_stuff(creature_ptr);
4894 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4895 PLAYER_LEVEL old_lev = creature_ptr->lev;
4896 while ((creature_ptr->lev > 1) &&
4897 (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
4899 creature_ptr->lev--;
4900 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4901 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
4902 creature_ptr->window |= (PW_PLAYER);
4903 handle_stuff(creature_ptr);
4906 bool level_reward = FALSE;
4907 bool level_mutation = FALSE;
4908 bool level_inc_stat = FALSE;
4909 while ((creature_ptr->lev < PY_MAX_LEVEL) &&
4910 (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
4912 creature_ptr->lev++;
4913 if (creature_ptr->lev > creature_ptr->max_plv)
4915 creature_ptr->max_plv = creature_ptr->lev;
4917 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
4918 (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
4920 level_reward = TRUE;
4922 if (creature_ptr->prace == RACE_BEASTMAN)
4924 if (one_in_(5)) level_mutation = TRUE;
4926 level_inc_stat = TRUE;
4928 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
4932 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
4933 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4934 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
4935 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
4936 creature_ptr->level_up_message = TRUE;
4937 handle_stuff(creature_ptr);
4939 creature_ptr->level_up_message = FALSE;
4942 if (!(creature_ptr->max_plv % 10))
4951 cnv_stat(creature_ptr->stat_max[0], tmp);
4952 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
4953 cnv_stat(creature_ptr->stat_max[1], tmp);
4954 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
4955 cnv_stat(creature_ptr->stat_max[2], tmp);
4956 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
4957 cnv_stat(creature_ptr->stat_max[3], tmp);
4958 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
4959 cnv_stat(creature_ptr->stat_max[4], tmp);
4960 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
4961 cnv_stat(creature_ptr->stat_max[5], tmp);
4962 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
4965 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
4970 if ((choice >= 'a') && (choice <= 'f')) break;
4972 for (n = 0; n < A_MAX; n++)
4973 if (n != choice - 'a')
4975 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
4977 do_inc_stat(creature_ptr, choice - 'a');
4980 else if (!(creature_ptr->max_plv % 2))
4981 do_inc_stat(creature_ptr, randint0(6));
4986 msg_print(_("あなたは変わった気がする...", "You feel different..."));
4987 (void)gain_mutation(creature_ptr, 0);
4988 level_mutation = FALSE;
4992 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
4997 gain_level_reward(creature_ptr, 0);
4998 level_reward = FALSE;
5001 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5002 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5003 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
5004 handle_stuff(creature_ptr);
5007 if (old_lev != creature_ptr->lev)
5008 autopick_load_pref(creature_ptr, FALSE);
5013 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
5015 * @param out_val 出力先文字列ポインタ
5018 void cnv_stat(int val, char *out_val)
5022 sprintf(out_val, " %2d", val);
5026 int bonus = (val - 18);
5029 sprintf(out_val, "18/%3s", "***");
5031 else if (bonus >= 100)
5033 sprintf(out_val, "18/%03d", bonus);
5037 sprintf(out_val, " 18/%02d", bonus);
5043 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
5044 * Modify a stat value by a "modifier", return new value
5046 * @param amount 加減算値
5050 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
5051 * Or even: 18/13, 18/23, 18/33, ..., 18/220
5052 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
5053 * Or even: 18/13, 18/03, 18, 17, ..., 3
5056 s16b modify_stat_value(int value, int amount)
5060 for (int i = 0; i < amount; i++)
5062 if (value < 18) value++;
5066 else if (amount < 0)
5068 for (int i = 0; i < (0 - amount); i++)
5070 if (value >= 18 + 10) value -= 10;
5071 else if (value > 18) value = 18;
5072 else if (value > 3) value--;
5082 * Hack -- Calculates the total number of points earned -JWT-
5086 long calc_score(player_type *creature_ptr)
5088 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
5091 if (!preserve_mode) mult += 10;
5092 if (!autoroller) mult += 10;
5093 if (!smart_learn) mult -= 20;
5094 if (smart_cheat) mult += 30;
5095 if (ironman_shops) mult += 50;
5096 if (ironman_small_levels) mult += 10;
5097 if (ironman_empty_levels) mult += 20;
5098 if (!powerup_home) mult += 50;
5099 if (ironman_rooms) mult += 100;
5100 if (ironman_nightmare) mult += 100;
5102 if (mult < 5) mult = 5;
5105 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
5106 if (max_dlv[i] > max_dl)
5107 max_dl = max_dlv[i];
5109 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
5110 u32b point_h = point_l / 0x10000L;
5111 point_l = point_l % 0x10000L;
5114 point_h += point_l / 0x10000L;
5115 point_l %= 0x10000L;
5117 point_l += ((point_h % 100) << 16);
5121 u32b point = (point_h << 16) + (point_l);
5122 if (creature_ptr->arena_number >= 0)
5123 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
5125 if (ironman_downward) point *= 2;
5126 if (creature_ptr->pclass == CLASS_BERSERKER)
5128 if (creature_ptr->prace == RACE_SPECTRE)
5132 if ((creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
5135 if (current_world_ptr->total_winner) point = 2;
5138 if (easy_band) point = (0 - point);
5144 void cheat_death(player_type *creature_ptr)
5146 if (creature_ptr->sc)
5147 creature_ptr->sc = creature_ptr->age = 0;
5148 creature_ptr->age++;
5150 current_world_ptr->noscore |= 0x0001;
5151 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
5154 (void)life_stream(creature_ptr, FALSE, FALSE);
5155 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
5158 for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
5160 creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
5162 for (; magic_idx < EATER_EXT * 3; magic_idx++)
5164 creature_ptr->magic_num1[magic_idx] = 0;
5168 creature_ptr->csp = creature_ptr->msp;
5169 creature_ptr->csp_frac = 0;
5170 if (creature_ptr->word_recall)
5172 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
5174 creature_ptr->word_recall = 0;
5175 creature_ptr->redraw |= (PR_STATUS);
5178 if (creature_ptr->alter_reality)
5180 creature_ptr->alter_reality = 0;
5181 creature_ptr->redraw |= (PR_STATUS);
5184 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
5185 creature_ptr->is_dead = FALSE;
5186 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
5188 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5189 floor_ptr->dun_level = 0;
5190 floor_ptr->inside_arena = FALSE;
5191 creature_ptr->phase_out = FALSE;
5193 floor_ptr->inside_quest = 0;
5194 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
5195 creature_ptr->dungeon_idx = 0;
5196 if (lite_town || vanilla_town)
5198 creature_ptr->wilderness_y = 1;
5199 creature_ptr->wilderness_x = 1;
5202 creature_ptr->oldpy = 10;
5203 creature_ptr->oldpx = 34;
5207 creature_ptr->oldpy = 33;
5208 creature_ptr->oldpx = 131;
5213 creature_ptr->wilderness_y = 48;
5214 creature_ptr->wilderness_x = 5;
5215 creature_ptr->oldpy = 33;
5216 creature_ptr->oldpx = 131;
5219 creature_ptr->wild_mode = FALSE;
5220 creature_ptr->leaving = TRUE;
5222 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
5226 leave_floor(creature_ptr);
5227 wipe_monsters_list(creature_ptr);
5232 * @param creature_ptr プレーヤーへの参照ポインタ
5233 * @return 祝福状態ならばTRUE
5235 bool is_blessed(player_type *creature_ptr)
5237 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
5241 bool is_oppose_acid(player_type *creature_ptr)
5243 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5247 bool is_oppose_elec(player_type *creature_ptr)
5249 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5253 bool is_oppose_fire(player_type *creature_ptr)
5255 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5259 bool is_oppose_cold(player_type *creature_ptr)
5261 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5265 bool is_oppose_pois(player_type *creature_ptr)
5267 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5271 bool is_tim_esp(player_type *creature_ptr)
5273 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5277 bool is_tim_stealth(player_type *creature_ptr)
5279 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5283 bool is_time_limit_esp(player_type *creature_ptr)
5285 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5289 bool is_time_limit_stealth(player_type *creature_ptr)
5291 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5295 bool can_two_hands_wielding(player_type *creature_ptr)
5297 return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);
5303 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
5306 void stop_singing(player_type *creature_ptr)
5308 if (creature_ptr->pclass != CLASS_BARD) return;
5310 /* Are there interupted song? */
5311 if (INTERUPTING_SONG_EFFECT(creature_ptr))
5313 /* Forget interupted song */
5314 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
5318 /* The player is singing? */
5319 if (!SINGING_SONG_EFFECT(creature_ptr)) return;
5321 /* Hack -- if called from set_action(), avoid recursive loop */
5322 if (creature_ptr->action == ACTION_SING) set_action(creature_ptr, ACTION_NONE);
5324 /* Message text of each song or etc. */
5325 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
5327 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
5328 SINGING_SONG_ID(creature_ptr) = 0;
5329 creature_ptr->update |= (PU_BONUS);
5330 creature_ptr->redraw |= (PR_STATUS);
5334 * @brief 口を使う継続的な処理を中断する
5335 * @param caster_ptr プレーヤーへの参照ポインタ
5338 void stop_mouth(player_type *caster_ptr)
5340 if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
5341 if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
5346 * @brief ペットの維持コスト計算
5349 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
5352 bool have_a_unique = FALSE;
5353 DEPTH total_friend_levels = 0;
5357 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
5359 monster_type *m_ptr;
5360 monster_race *r_ptr;
5362 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
5363 if (!monster_is_valid(m_ptr)) continue;
5364 r_ptr = &r_info[m_ptr->r_idx];
5369 if (r_ptr->flags1 & RF1_UNIQUE)
5371 if (creature_ptr->pclass == CLASS_CAVALRY)
5373 if (creature_ptr->riding == m_idx)
5374 total_friend_levels += (r_ptr->level + 5) * 2;
5375 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
5376 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
5378 total_friend_levels += (r_ptr->level + 5) * 10;
5379 have_a_unique = TRUE;
5382 total_friend_levels += (r_ptr->level + 5) * 10;
5385 total_friend_levels += r_ptr->level;
5393 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
5394 if (upkeep_factor < 0) upkeep_factor = 0;
5395 if (upkeep_factor > 1000) upkeep_factor = 1000;
5396 return upkeep_factor;
5402 bool music_singing(player_type *caster_ptr, int music_songs)
5404 return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs);