7 #include "player-move.h"
8 #include "player-status.h"
9 #include "player-effects.h"
10 #include "player-skill.h"
11 #include "player-race.h"
12 #include "player-class.h"
13 #include "player-personality.h"
14 #include "player-damage.h"
16 #include "floor-events.h"
21 #include "spells-status.h"
23 #include "object-hook.h"
24 #include "object-ego.h"
26 #include "monster-status.h"
27 #include "monsterrace-hook.h"
30 #include "realm-hex.h"
31 #include "realm-song.h"
33 #include "cmd-spell.h"
35 #include "objectkind.h"
36 #include "monsterrace.h"
41 #include "view-mainwindow.h"
43 #include "cmd-magiceat.h"
46 * @brief 能力値テーブル / Abbreviations of healthy stats
48 const concptr stat_names[6] =
51 "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :"
53 "STR : ", "INT : ", "WIS : ", "DEX : ", "CON : ", "CHR : "
59 * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats
61 const concptr stat_names_reduced[6] =
64 "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:"
66 "Str : ", "Int : ", "Wis : ", "Dex : ", "Con : ", "Chr : "
71 /* ELDRITCH_HORRORによるsanity blast処理に関するメッセージの最大数 / Number of entries in the sanity-blast descriptions */
72 #define MAX_SAN_HORROR 20 /*!< 恐ろしい対象の形容数(正常時) */
73 #define MAX_SAN_FUNNY 22 /*!< 恐ろしい対象の形容数(幻覚時) */
74 #define MAX_SAN_COMMENT 5 /*!< 恐ろしい対象を見たときの絶叫メッセージ数(幻覚時) */
78 * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(通常時)
80 static concptr horror_desc[MAX_SAN_HORROR] =
136 * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(幻覚状態時)
138 static concptr funny_desc[MAX_SAN_FUNNY] =
199 * @var funny_comments
200 * @brief ELDRITCH HORROR効果時の幻覚時間延長を示す錯乱表現
202 static concptr funny_comments[MAX_SAN_COMMENT] =
223 * @brief 基本必要経験値テーブル /
224 * Base experience levels, may be adjusted up for race and/or class
226 const s32b player_exp[PY_MAX_LEVEL] =
282 * @brief 基本必要強化値テーブル(アンドロイド専用)
284 const s32b player_exp_a[PY_MAX_LEVEL] =
340 * 知力/賢さによるレベル毎の習得可能魔法数テーブル
341 * Stat Table (INT/WIS) -- Number of half-spells per level
343 const byte adj_mag_study[] =
370 4 /* 18/100-18/109 */,
371 4 /* 18/110-18/119 */,
372 5 /* 18/120-18/129 */,
373 5 /* 18/130-18/139 */,
374 5 /* 18/140-18/149 */,
375 5 /* 18/150-18/159 */,
376 5 /* 18/160-18/169 */,
377 5 /* 18/170-18/179 */,
378 5 /* 18/180-18/189 */,
379 5 /* 18/190-18/199 */,
380 5 /* 18/200-18/209 */,
381 6 /* 18/210-18/219 */,
388 * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
390 const byte adj_mag_mana[] =
407 10 /* 18/00-18/09 */,
408 11 /* 18/10-18/19 */,
409 11 /* 18/20-18/29 */,
410 12 /* 18/30-18/39 */,
411 12 /* 18/40-18/49 */,
412 13 /* 18/50-18/59 */,
413 14 /* 18/60-18/69 */,
414 15 /* 18/70-18/79 */,
415 16 /* 18/80-18/89 */,
416 17 /* 18/90-18/99 */,
417 18 /* 18/100-18/109 */,
418 19 /* 18/110-18/119 */,
419 20 /* 18/120-18/129 */,
420 21 /* 18/130-18/139 */,
421 22 /* 18/140-18/149 */,
422 23 /* 18/150-18/159 */,
423 24 /* 18/160-18/169 */,
424 25 /* 18/170-18/179 */,
425 26 /* 18/180-18/189 */,
426 27 /* 18/190-18/199 */,
427 28 /* 18/200-18/209 */,
428 29 /* 18/210-18/219 */,
434 * 知力/賢さによる最低魔法失敗率テーブル
435 * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
437 const byte adj_mag_fail[] =
464 3 /* 18/100-18/109 */,
465 2 /* 18/110-18/119 */,
466 2 /* 18/120-18/129 */,
467 2 /* 18/130-18/139 */,
468 2 /* 18/140-18/149 */,
469 1 /* 18/150-18/159 */,
470 1 /* 18/160-18/169 */,
471 1 /* 18/170-18/179 */,
472 1 /* 18/180-18/189 */,
473 1 /* 18/190-18/199 */,
474 0 /* 18/200-18/209 */,
475 0 /* 18/210-18/219 */,
481 * 知力/賢さによる魔法失敗率修正テーブル
482 * Stat Table (INT/WIS) -- Various things
484 const byte adj_mag_stat[] =
511 8 /* 18/100-18/109 */,
512 9 /* 18/110-18/119 */,
513 10 /* 18/120-18/129 */,
514 11 /* 18/130-18/139 */,
515 12 /* 18/140-18/149 */,
516 13 /* 18/150-18/159 */,
517 14 /* 18/160-18/169 */,
518 15 /* 18/170-18/179 */,
519 16 /* 18/180-18/189 */,
520 17 /* 18/190-18/199 */,
521 18 /* 18/200-18/209 */,
522 19 /* 18/210-18/219 */,
529 * Stat Table (CHR) -- payment percentages
531 const byte adj_chr_gold[] =
548 100 /* 18/00-18/09 */,
549 99 /* 18/10-18/19 */,
550 98 /* 18/20-18/29 */,
551 97 /* 18/30-18/39 */,
552 96 /* 18/40-18/49 */,
553 95 /* 18/50-18/59 */,
554 94 /* 18/60-18/69 */,
555 93 /* 18/70-18/79 */,
556 92 /* 18/80-18/89 */,
557 91 /* 18/90-18/99 */,
558 90 /* 18/100-18/109 */,
559 89 /* 18/110-18/119 */,
560 88 /* 18/120-18/129 */,
561 87 /* 18/130-18/139 */,
562 86 /* 18/140-18/149 */,
563 85 /* 18/150-18/159 */,
564 84 /* 18/160-18/169 */,
565 83 /* 18/170-18/179 */,
566 82 /* 18/180-18/189 */,
567 81 /* 18/190-18/199 */,
568 80 /* 18/200-18/209 */,
569 79 /* 18/210-18/219 */,
576 * Stat Table (INT) -- Magic devices
578 const byte adj_int_dev[] =
605 8 /* 18/100-18/109 */,
606 9 /* 18/110-18/119 */,
607 10 /* 18/120-18/129 */,
608 11 /* 18/130-18/139 */,
609 12 /* 18/140-18/149 */,
610 13 /* 18/150-18/159 */,
611 14 /* 18/160-18/169 */,
612 15 /* 18/170-18/179 */,
613 16 /* 18/180-18/189 */,
614 17 /* 18/190-18/199 */,
615 18 /* 18/200-18/209 */,
616 19 /* 18/210-18/219 */,
623 * Stat Table (WIS) -- Saving throw
625 const byte adj_wis_sav[] =
652 7 /* 18/100-18/109 */,
653 8 /* 18/110-18/119 */,
654 9 /* 18/120-18/129 */,
655 10 /* 18/130-18/139 */,
656 11 /* 18/140-18/149 */,
657 12 /* 18/150-18/159 */,
658 13 /* 18/160-18/169 */,
659 14 /* 18/170-18/179 */,
660 15 /* 18/180-18/189 */,
661 16 /* 18/190-18/199 */,
662 17 /* 18/200-18/209 */,
663 18 /* 18/210-18/219 */,
670 * Stat Table (DEX) -- disarming
672 const byte adj_dex_dis[] =
699 8 /* 18/100-18/109 */,
700 8 /* 18/110-18/119 */,
701 8 /* 18/120-18/129 */,
702 8 /* 18/130-18/139 */,
703 8 /* 18/140-18/149 */,
704 9 /* 18/150-18/159 */,
705 9 /* 18/160-18/169 */,
706 9 /* 18/170-18/179 */,
707 9 /* 18/180-18/189 */,
708 9 /* 18/190-18/199 */,
709 10 /* 18/200-18/209 */,
710 10 /* 18/210-18/219 */,
717 * Stat Table (INT) -- disarming
719 const byte adj_int_dis[] =
746 10 /* 18/100-18/109 */,
747 10 /* 18/110-18/119 */,
748 11 /* 18/120-18/129 */,
749 12 /* 18/130-18/139 */,
750 13 /* 18/140-18/149 */,
751 14 /* 18/150-18/159 */,
752 15 /* 18/160-18/169 */,
753 16 /* 18/170-18/179 */,
754 17 /* 18/180-18/189 */,
755 18 /* 18/190-18/199 */,
756 19 /* 18/200-18/209 */,
757 19 /* 18/210-18/219 */,
764 * Stat Table (DEX) -- bonus to ac (plus 128)
766 const byte adj_dex_ta[] =
783 128 + 2 /* 18/00-18/09 */,
784 128 + 2 /* 18/10-18/19 */,
785 128 + 2 /* 18/20-18/29 */,
786 128 + 2 /* 18/30-18/39 */,
787 128 + 2 /* 18/40-18/49 */,
788 128 + 3 /* 18/50-18/59 */,
789 128 + 3 /* 18/60-18/69 */,
790 128 + 3 /* 18/70-18/79 */,
791 128 + 4 /* 18/80-18/89 */,
792 128 + 5 /* 18/90-18/99 */,
793 128 + 6 /* 18/100-18/109 */,
794 128 + 7 /* 18/110-18/119 */,
795 128 + 8 /* 18/120-18/129 */,
796 128 + 9 /* 18/130-18/139 */,
797 128 + 9 /* 18/140-18/149 */,
798 128 + 10 /* 18/150-18/159 */,
799 128 + 11 /* 18/160-18/169 */,
800 128 + 12 /* 18/170-18/179 */,
801 128 + 13 /* 18/180-18/189 */,
802 128 + 14 /* 18/190-18/199 */,
803 128 + 15 /* 18/200-18/209 */,
804 128 + 15 /* 18/210-18/219 */,
805 128 + 16 /* 18/220+ */
811 * Stat Table (STR) -- bonus to dam (plus 128)
813 const byte adj_str_td[] =
830 128 + 2 /* 18/00-18/09 */,
831 128 + 2 /* 18/10-18/19 */,
832 128 + 3 /* 18/20-18/29 */,
833 128 + 3 /* 18/30-18/39 */,
834 128 + 3 /* 18/40-18/49 */,
835 128 + 3 /* 18/50-18/59 */,
836 128 + 3 /* 18/60-18/69 */,
837 128 + 4 /* 18/70-18/79 */,
838 128 + 5 /* 18/80-18/89 */,
839 128 + 5 /* 18/90-18/99 */,
840 128 + 6 /* 18/100-18/109 */,
841 128 + 7 /* 18/110-18/119 */,
842 128 + 8 /* 18/120-18/129 */,
843 128 + 9 /* 18/130-18/139 */,
844 128 + 10 /* 18/140-18/149 */,
845 128 + 11 /* 18/150-18/159 */,
846 128 + 12 /* 18/160-18/169 */,
847 128 + 13 /* 18/170-18/179 */,
848 128 + 14 /* 18/180-18/189 */,
849 128 + 15 /* 18/190-18/199 */,
850 128 + 16 /* 18/200-18/209 */,
851 128 + 18 /* 18/210-18/219 */,
852 128 + 20 /* 18/220+ */
858 * Stat Table (DEX) -- bonus to hit (plus 128)
860 const byte adj_dex_th[] =
877 128 + 3 /* 18/00-18/09 */,
878 128 + 3 /* 18/10-18/19 */,
879 128 + 3 /* 18/20-18/29 */,
880 128 + 3 /* 18/30-18/39 */,
881 128 + 3 /* 18/40-18/49 */,
882 128 + 4 /* 18/50-18/59 */,
883 128 + 4 /* 18/60-18/69 */,
884 128 + 4 /* 18/70-18/79 */,
885 128 + 4 /* 18/80-18/89 */,
886 128 + 5 /* 18/90-18/99 */,
887 128 + 6 /* 18/100-18/109 */,
888 128 + 7 /* 18/110-18/119 */,
889 128 + 8 /* 18/120-18/129 */,
890 128 + 9 /* 18/130-18/139 */,
891 128 + 9 /* 18/140-18/149 */,
892 128 + 10 /* 18/150-18/159 */,
893 128 + 11 /* 18/160-18/169 */,
894 128 + 12 /* 18/170-18/179 */,
895 128 + 13 /* 18/180-18/189 */,
896 128 + 14 /* 18/190-18/199 */,
897 128 + 15 /* 18/200-18/209 */,
898 128 + 15 /* 18/210-18/219 */,
899 128 + 16 /* 18/220+ */
905 * Stat Table (STR) -- bonus to hit (plus 128)
907 const byte adj_str_th[] =
924 128 + 1 /* 18/00-18/09 */,
925 128 + 1 /* 18/10-18/19 */,
926 128 + 1 /* 18/20-18/29 */,
927 128 + 1 /* 18/30-18/39 */,
928 128 + 1 /* 18/40-18/49 */,
929 128 + 1 /* 18/50-18/59 */,
930 128 + 1 /* 18/60-18/69 */,
931 128 + 2 /* 18/70-18/79 */,
932 128 + 3 /* 18/80-18/89 */,
933 128 + 4 /* 18/90-18/99 */,
934 128 + 5 /* 18/100-18/109 */,
935 128 + 6 /* 18/110-18/119 */,
936 128 + 7 /* 18/120-18/129 */,
937 128 + 8 /* 18/130-18/139 */,
938 128 + 9 /* 18/140-18/149 */,
939 128 + 10 /* 18/150-18/159 */,
940 128 + 11 /* 18/160-18/169 */,
941 128 + 12 /* 18/170-18/179 */,
942 128 + 13 /* 18/180-18/189 */,
943 128 + 14 /* 18/190-18/199 */,
944 128 + 15 /* 18/200-18/209 */,
945 128 + 15 /* 18/210-18/219 */,
946 128 + 16 /* 18/220+ */
952 * Stat Table (STR) -- weight limit in deca-pounds
954 const byte adj_str_wgt[] =
971 25 /* 18/00-18/09 */,
972 26 /* 18/10-18/19 */,
973 27 /* 18/20-18/29 */,
974 28 /* 18/30-18/39 */,
975 29 /* 18/40-18/49 */,
976 30 /* 18/50-18/59 */,
977 31 /* 18/60-18/69 */,
978 31 /* 18/70-18/79 */,
979 32 /* 18/80-18/89 */,
980 32 /* 18/90-18/99 */,
981 33 /* 18/100-18/109 */,
982 33 /* 18/110-18/119 */,
983 34 /* 18/120-18/129 */,
984 34 /* 18/130-18/139 */,
985 35 /* 18/140-18/149 */,
986 35 /* 18/150-18/159 */,
987 36 /* 18/160-18/169 */,
988 36 /* 18/170-18/179 */,
989 37 /* 18/180-18/189 */,
990 37 /* 18/190-18/199 */,
991 38 /* 18/200-18/209 */,
992 38 /* 18/210-18/219 */,
999 * Stat Table (STR) -- weapon weight limit in pounds
1001 const byte adj_str_hold[] =
1018 19 /* 18/00-18/09 */,
1019 20 /* 18/10-18/19 */,
1020 21 /* 18/20-18/29 */,
1021 22 /* 18/30-18/39 */,
1022 23 /* 18/40-18/49 */,
1023 24 /* 18/50-18/59 */,
1024 25 /* 18/60-18/69 */,
1025 26 /* 18/70-18/79 */,
1026 27 /* 18/80-18/89 */,
1027 28 /* 18/90-18/99 */,
1028 30 /* 18/100-18/109 */,
1029 31 /* 18/110-18/119 */,
1030 32 /* 18/120-18/129 */,
1031 33 /* 18/130-18/139 */,
1032 34 /* 18/140-18/149 */,
1033 35 /* 18/150-18/159 */,
1034 37 /* 18/160-18/169 */,
1035 40 /* 18/170-18/179 */,
1036 44 /* 18/180-18/189 */,
1037 48 /* 18/190-18/199 */,
1038 50 /* 18/200-18/209 */,
1039 50 /* 18/210-18/219 */,
1046 * Stat Table (STR) -- digging value
1048 const byte adj_str_dig[] =
1065 9 /* 18/00-18/09 */,
1066 10 /* 18/10-18/19 */,
1067 12 /* 18/20-18/29 */,
1068 15 /* 18/30-18/39 */,
1069 20 /* 18/40-18/49 */,
1070 25 /* 18/50-18/59 */,
1071 30 /* 18/60-18/69 */,
1072 35 /* 18/70-18/79 */,
1073 40 /* 18/80-18/89 */,
1074 45 /* 18/90-18/99 */,
1075 50 /* 18/100-18/109 */,
1076 55 /* 18/110-18/119 */,
1077 60 /* 18/120-18/129 */,
1078 65 /* 18/130-18/139 */,
1079 70 /* 18/140-18/149 */,
1080 75 /* 18/150-18/159 */,
1081 80 /* 18/160-18/169 */,
1082 85 /* 18/170-18/179 */,
1083 90 /* 18/180-18/189 */,
1084 95 /* 18/190-18/199 */,
1085 100 /* 18/200-18/209 */,
1086 100 /* 18/210-18/219 */,
1091 * 器用さによる盗難防止&体当たり成功判定修正テーブル
1092 * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
1094 const byte adj_dex_safe[] =
1111 10 /* 18/00-18/09 */,
1112 10 /* 18/10-18/19 */,
1113 15 /* 18/20-18/29 */,
1114 15 /* 18/30-18/39 */,
1115 20 /* 18/40-18/49 */,
1116 25 /* 18/50-18/59 */,
1117 30 /* 18/60-18/69 */,
1118 35 /* 18/70-18/79 */,
1119 40 /* 18/80-18/89 */,
1120 45 /* 18/90-18/99 */,
1121 50 /* 18/100-18/109 */,
1122 60 /* 18/110-18/119 */,
1123 70 /* 18/120-18/129 */,
1124 80 /* 18/130-18/139 */,
1125 90 /* 18/140-18/149 */,
1126 100 /* 18/150-18/159 */,
1127 100 /* 18/160-18/169 */,
1128 100 /* 18/170-18/179 */,
1129 100 /* 18/180-18/189 */,
1130 100 /* 18/190-18/199 */,
1131 100 /* 18/200-18/209 */,
1132 100 /* 18/210-18/219 */,
1138 * 耐久による基本HP自然治癒値テーブル /
1139 * Stat Table (CON) -- base regeneration rate
1141 const byte adj_con_fix[] =
1158 2 /* 18/00-18/09 */,
1159 2 /* 18/10-18/19 */,
1160 2 /* 18/20-18/29 */,
1161 2 /* 18/30-18/39 */,
1162 2 /* 18/40-18/49 */,
1163 3 /* 18/50-18/59 */,
1164 3 /* 18/60-18/69 */,
1165 3 /* 18/70-18/79 */,
1166 3 /* 18/80-18/89 */,
1167 3 /* 18/90-18/99 */,
1168 4 /* 18/100-18/109 */,
1169 4 /* 18/110-18/119 */,
1170 5 /* 18/120-18/129 */,
1171 6 /* 18/130-18/139 */,
1172 6 /* 18/140-18/149 */,
1173 7 /* 18/150-18/159 */,
1174 7 /* 18/160-18/169 */,
1175 8 /* 18/170-18/179 */,
1176 8 /* 18/180-18/189 */,
1177 8 /* 18/190-18/199 */,
1178 9 /* 18/200-18/209 */,
1179 9 /* 18/210-18/219 */,
1185 * 耐久による基本HP自然治癒値テーブル /
1186 * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
1188 const byte adj_con_mhp[] =
1205 128 + 4 /* 18/00-18/09 */,
1206 128 + 5 /* 18/10-18/19 */,
1207 128 + 6 /* 18/20-18/29 */,
1208 128 + 7 /* 18/30-18/39 */,
1209 128 + 8 /* 18/40-18/49 */,
1210 128 + 9 /* 18/50-18/59 */,
1211 128 + 10 /* 18/60-18/69 */,
1212 128 + 11 /* 18/70-18/79 */,
1213 128 + 12 /* 18/80-18/89 */,
1214 128 + 14 /* 18/90-18/99 */,
1215 128 + 17 /* 18/100-18/109 */,
1216 128 + 20 /* 18/110-18/119 */,
1217 128 + 23 /* 18/120-18/129 */,
1218 128 + 26 /* 18/130-18/139 */,
1219 128 + 29 /* 18/140-18/149 */,
1220 128 + 32 /* 18/150-18/159 */,
1221 128 + 35 /* 18/160-18/169 */,
1222 128 + 38 /* 18/170-18/179 */,
1223 128 + 40 /* 18/180-18/189 */,
1224 128 + 42 /* 18/190-18/199 */,
1225 128 + 44 /* 18/200-18/209 */,
1226 128 + 46 /* 18/210-18/219 */,
1227 128 + 48 /* 18/220+ */
1233 * Stat Table (CHR) -- charm
1235 const byte adj_chr_chm[] =
1252 9 /* 18/00-18/09 */,
1253 10 /* 18/10-18/19 */,
1254 12 /* 18/20-18/29 */,
1255 15 /* 18/30-18/39 */,
1256 18 /* 18/40-18/49 */,
1257 21 /* 18/50-18/59 */,
1258 24 /* 18/60-18/69 */,
1259 28 /* 18/70-18/79 */,
1260 32 /* 18/80-18/89 */,
1261 36 /* 18/90-18/99 */,
1262 39 /* 18/100-18/109 */,
1263 42 /* 18/110-18/119 */,
1264 45 /* 18/120-18/129 */,
1265 49 /* 18/130-18/139 */,
1266 53 /* 18/140-18/149 */,
1267 57 /* 18/150-18/159 */,
1268 61 /* 18/160-18/169 */,
1269 65 /* 18/170-18/179 */,
1270 69 /* 18/180-18/189 */,
1271 73 /* 18/190-18/199 */,
1272 77 /* 18/200-18/209 */,
1273 81 /* 18/210-18/219 */,
1278 /*** Player information ***/
1281 * Static player info record
1286 * Pointer to the player info
1288 player_type *p_ptr = &p_body;
1291 * Return alignment title
1293 concptr your_alignment(player_type *creature_ptr)
1295 if (creature_ptr->align > 150) return _("大善", "Lawful");
1296 else if (creature_ptr->align > 50) return _("中善", "Good");
1297 else if (creature_ptr->align > 10) return _("小善", "Neutral Good");
1298 else if (creature_ptr->align > -11) return _("中立", "Neutral");
1299 else if (creature_ptr->align > -51) return _("小悪", "Neutral Evil");
1300 else if (creature_ptr->align > -151) return _("中悪", "Evil");
1301 else return _("大悪", "Chaotic");
1306 * Return proficiency level of weapons and misc. skills (except riding)
1308 int weapon_exp_level(int weapon_exp)
1310 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1311 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1312 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1313 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
1314 else return EXP_LEVEL_MASTER;
1319 * Return proficiency level of riding
1321 int riding_exp_level(int riding_exp)
1323 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1324 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1325 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1326 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
1327 else return EXP_LEVEL_MASTER;
1332 * Return proficiency level of spells
1334 int spell_exp_level(int spell_exp)
1336 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1337 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1338 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1339 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
1340 else return EXP_LEVEL_MASTER;
1345 * @brief プレイヤーの全ステータスを更新する /
1346 * Calculate the players current "state", taking into account
1347 * not only race/class intrinsics, but also objects being worn
1348 * and temporary spell effects.
1352 * See also calc_mana() and calc_hitpoints().
1354 * Take note of the new "speed code", in particular, a very strong
1355 * player will start slowing down as soon as he reaches 150 pounds,
1356 * but not until he reaches 450 pounds will he be half as fast as
1357 * a normal kobold. This both hurts and helps the player, hurts
1358 * because in the old days a player could just avoid 300 pounds,
1359 * and helps because now carrying 300 pounds is not very painful.
1361 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
1362 * damage, since that would affect non-combat things. These values
1363 * are actually added in later, at the appropriate place.
1365 * This function induces various "status" messages.
1368 void calc_bonuses(player_type *creature_ptr)
1372 int default_hand = 0;
1373 int empty_hands_status = empty_hands(creature_ptr, TRUE);
1376 BIT_FLAGS flgs[TR_FLAG_SIZE];
1378 bool yoiyami = FALSE;
1379 bool down_saving = FALSE;
1381 bool have_sw = FALSE, have_kabe = FALSE;
1382 bool easy_2weapon = FALSE;
1383 bool riding_levitation = FALSE;
1384 OBJECT_IDX this_o_idx, next_o_idx = 0;
1385 const player_race *tmp_rp_ptr;
1387 /* Save the old vision stuff */
1388 bool old_telepathy = creature_ptr->telepathy;
1389 bool old_esp_animal = creature_ptr->esp_animal;
1390 bool old_esp_undead = creature_ptr->esp_undead;
1391 bool old_esp_demon = creature_ptr->esp_demon;
1392 bool old_esp_orc = creature_ptr->esp_orc;
1393 bool old_esp_troll = creature_ptr->esp_troll;
1394 bool old_esp_giant = creature_ptr->esp_giant;
1395 bool old_esp_dragon = creature_ptr->esp_dragon;
1396 bool old_esp_human = creature_ptr->esp_human;
1397 bool old_esp_evil = creature_ptr->esp_evil;
1398 bool old_esp_good = creature_ptr->esp_good;
1399 bool old_esp_nonliving = creature_ptr->esp_nonliving;
1400 bool old_esp_unique = creature_ptr->esp_unique;
1401 bool old_see_inv = creature_ptr->see_inv;
1402 bool old_mighty_throw = creature_ptr->mighty_throw;
1404 /* Current feature under player. */
1405 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1406 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1408 /* Save the old armor class */
1409 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
1410 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
1412 /* Clear extra blows/shots */
1413 extra_blows[0] = extra_blows[1] = 0;
1415 /* Clear the stat modifiers */
1416 for (i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
1419 /* Clear the Displayed/Real armor class */
1420 creature_ptr->dis_ac = creature_ptr->ac = 0;
1422 /* Clear the Displayed/Real Bonuses */
1423 creature_ptr->dis_to_h[0] = creature_ptr->to_h[0] = 0;
1424 creature_ptr->dis_to_h[1] = creature_ptr->to_h[1] = 0;
1425 creature_ptr->dis_to_d[0] = creature_ptr->to_d[0] = 0;
1426 creature_ptr->dis_to_d[1] = creature_ptr->to_d[1] = 0;
1427 creature_ptr->dis_to_h_b = creature_ptr->to_h_b = 0;
1428 creature_ptr->dis_to_a = creature_ptr->to_a = 0;
1429 creature_ptr->to_h_m = 0;
1430 creature_ptr->to_d_m = 0;
1432 creature_ptr->to_m_chance = 0;
1434 /* Clear the Extra Dice Bonuses */
1435 creature_ptr->to_dd[0] = creature_ptr->to_ds[0] = 0;
1436 creature_ptr->to_dd[1] = creature_ptr->to_ds[1] = 0;
1438 /* Start with "normal" speed */
1441 /* Start with a single blow per turn */
1442 creature_ptr->num_blow[0] = 1;
1443 creature_ptr->num_blow[1] = 1;
1445 /* Start with a single shot per turn */
1446 creature_ptr->num_fire = 100;
1448 /* Reset the "xtra" tval */
1449 creature_ptr->tval_xtra = 0;
1451 /* Reset the "ammo" tval */
1452 creature_ptr->tval_ammo = 0;
1454 /* Clear all the flags */
1455 creature_ptr->cursed = 0L;
1456 creature_ptr->bless_blade = FALSE;
1457 creature_ptr->xtra_might = FALSE;
1458 creature_ptr->impact[0] = FALSE;
1459 creature_ptr->impact[1] = FALSE;
1460 creature_ptr->pass_wall = FALSE;
1461 creature_ptr->kill_wall = FALSE;
1462 creature_ptr->dec_mana = FALSE;
1463 creature_ptr->easy_spell = FALSE;
1464 creature_ptr->heavy_spell = FALSE;
1465 creature_ptr->see_inv = FALSE;
1466 creature_ptr->free_act = FALSE;
1467 creature_ptr->slow_digest = FALSE;
1468 creature_ptr->regenerate = FALSE;
1469 creature_ptr->can_swim = FALSE;
1470 creature_ptr->levitation = FALSE;
1471 creature_ptr->hold_exp = FALSE;
1472 creature_ptr->telepathy = FALSE;
1473 creature_ptr->esp_animal = FALSE;
1474 creature_ptr->esp_undead = FALSE;
1475 creature_ptr->esp_demon = FALSE;
1476 creature_ptr->esp_orc = FALSE;
1477 creature_ptr->esp_troll = FALSE;
1478 creature_ptr->esp_giant = FALSE;
1479 creature_ptr->esp_dragon = FALSE;
1480 creature_ptr->esp_human = FALSE;
1481 creature_ptr->esp_evil = FALSE;
1482 creature_ptr->esp_good = FALSE;
1483 creature_ptr->esp_nonliving = FALSE;
1484 creature_ptr->esp_unique = FALSE;
1485 creature_ptr->lite = FALSE;
1486 creature_ptr->sustain_str = FALSE;
1487 creature_ptr->sustain_int = FALSE;
1488 creature_ptr->sustain_wis = FALSE;
1489 creature_ptr->sustain_con = FALSE;
1490 creature_ptr->sustain_dex = FALSE;
1491 creature_ptr->sustain_chr = FALSE;
1492 creature_ptr->resist_acid = FALSE;
1493 creature_ptr->resist_elec = FALSE;
1494 creature_ptr->resist_fire = FALSE;
1495 creature_ptr->resist_cold = FALSE;
1496 creature_ptr->resist_pois = FALSE;
1497 creature_ptr->resist_conf = FALSE;
1498 creature_ptr->resist_sound = FALSE;
1499 creature_ptr->resist_lite = FALSE;
1500 creature_ptr->resist_dark = FALSE;
1501 creature_ptr->resist_chaos = FALSE;
1502 creature_ptr->resist_disen = FALSE;
1503 creature_ptr->resist_shard = FALSE;
1504 creature_ptr->resist_nexus = FALSE;
1505 creature_ptr->resist_blind = FALSE;
1506 creature_ptr->resist_neth = FALSE;
1507 creature_ptr->resist_time = FALSE;
1508 creature_ptr->resist_water = FALSE;
1509 creature_ptr->resist_fear = FALSE;
1510 creature_ptr->reflect = FALSE;
1511 creature_ptr->sh_fire = FALSE;
1512 creature_ptr->sh_elec = FALSE;
1513 creature_ptr->sh_cold = FALSE;
1514 creature_ptr->anti_magic = FALSE;
1515 creature_ptr->anti_tele = FALSE;
1516 creature_ptr->warning = FALSE;
1517 creature_ptr->mighty_throw = FALSE;
1518 creature_ptr->see_nocto = FALSE;
1520 creature_ptr->immune_acid = FALSE;
1521 creature_ptr->immune_elec = FALSE;
1522 creature_ptr->immune_fire = FALSE;
1523 creature_ptr->immune_cold = FALSE;
1525 creature_ptr->ryoute = FALSE;
1526 creature_ptr->migite = FALSE;
1527 creature_ptr->hidarite = FALSE;
1528 creature_ptr->no_flowed = FALSE;
1530 if (creature_ptr->mimic_form) tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1531 else tmp_rp_ptr = &race_info[creature_ptr->prace];
1533 /* Base infravision (purely racial) */
1534 creature_ptr->see_infra = tmp_rp_ptr->infra;
1536 /* Base skill -- disarming */
1537 creature_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
1539 /* Base skill -- magic devices */
1540 creature_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
1542 /* Base skill -- saving throw */
1543 creature_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
1545 /* Base skill -- stealth */
1546 creature_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
1548 /* Base skill -- searching ability */
1549 creature_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
1551 /* Base skill -- searching frequency */
1552 creature_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
1554 /* Base skill -- combat (normal) */
1555 creature_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
1557 /* Base skill -- combat (shooting) */
1558 creature_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1560 /* Base skill -- combat (throwing) */
1561 creature_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1563 /* Base skill -- digging */
1564 creature_ptr->skill_dig = 0;
1566 if (has_melee_weapon(creature_ptr, INVEN_RARM)) creature_ptr->migite = TRUE;
1567 if (has_melee_weapon(creature_ptr, INVEN_LARM))
1569 creature_ptr->hidarite = TRUE;
1570 if (!creature_ptr->migite) default_hand = 1;
1573 if (can_two_hands_wielding(creature_ptr))
1575 if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
1576 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
1578 creature_ptr->ryoute = TRUE;
1580 else if (creature_ptr->hidarite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) &&
1581 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM]))
1583 creature_ptr->ryoute = TRUE;
1587 switch (creature_ptr->pclass)
1590 case CLASS_FORCETRAINER:
1591 case CLASS_BERSERKER:
1592 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
1594 creature_ptr->migite = TRUE;
1595 creature_ptr->ryoute = TRUE;
1602 if (!creature_ptr->migite && !creature_ptr->hidarite)
1604 if (empty_hands_status & EMPTY_HAND_RARM) creature_ptr->migite = TRUE;
1605 else if (empty_hands_status == EMPTY_HAND_LARM)
1607 creature_ptr->hidarite = TRUE;
1612 if (creature_ptr->special_defense & KAMAE_MASK)
1614 if (!(empty_hands_status & EMPTY_HAND_RARM))
1616 set_action(creature_ptr, ACTION_NONE);
1620 switch (creature_ptr->pclass)
1623 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1624 if (creature_ptr->lev > 44) creature_ptr->regenerate = TRUE;
1627 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1629 case CLASS_CHAOS_WARRIOR:
1630 if (creature_ptr->lev > 29) creature_ptr->resist_chaos = TRUE;
1631 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1633 case CLASS_MINDCRAFTER:
1634 if (creature_ptr->lev > 9) creature_ptr->resist_fear = TRUE;
1635 if (creature_ptr->lev > 19) creature_ptr->sustain_wis = TRUE;
1636 if (creature_ptr->lev > 29) creature_ptr->resist_conf = TRUE;
1637 if (creature_ptr->lev > 39) creature_ptr->telepathy = TRUE;
1640 case CLASS_FORCETRAINER:
1641 /* Unencumbered Monks become faster every 10 levels */
1642 if (!(heavy_armor(creature_ptr)))
1644 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1645 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1646 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1647 new_speed += (creature_ptr->lev) / 10;
1649 /* Free action if unencumbered at level 25 */
1650 if (creature_ptr->lev > 24)
1651 creature_ptr->free_act = TRUE;
1654 case CLASS_SORCERER:
1655 creature_ptr->to_a -= 50;
1656 creature_ptr->dis_to_a -= 50;
1659 creature_ptr->resist_sound = TRUE;
1662 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1664 case CLASS_BERSERKER:
1665 creature_ptr->shero = 1;
1666 creature_ptr->sustain_str = TRUE;
1667 creature_ptr->sustain_dex = TRUE;
1668 creature_ptr->sustain_con = TRUE;
1669 creature_ptr->regenerate = TRUE;
1670 creature_ptr->free_act = TRUE;
1672 if (creature_ptr->lev > 29) new_speed++;
1673 if (creature_ptr->lev > 39) new_speed++;
1674 if (creature_ptr->lev > 44) new_speed++;
1675 if (creature_ptr->lev > 49) new_speed++;
1676 creature_ptr->to_a += 10 + creature_ptr->lev / 2;
1677 creature_ptr->dis_to_a += 10 + creature_ptr->lev / 2;
1678 creature_ptr->skill_dig += (100 + creature_ptr->lev * 8);
1679 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1680 creature_ptr->redraw |= PR_STATUS;
1682 case CLASS_MIRROR_MASTER:
1683 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1686 /* Unencumbered Ninjas become faster every 10 levels */
1687 if (heavy_armor(creature_ptr))
1689 new_speed -= (creature_ptr->lev) / 10;
1690 creature_ptr->skill_stl -= (creature_ptr->lev) / 10;
1692 else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1693 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1696 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1697 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1698 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1699 new_speed += (creature_ptr->lev) / 10;
1700 creature_ptr->skill_stl += (creature_ptr->lev) / 10;
1702 /* Free action if unencumbered at level 25 */
1703 if (creature_ptr->lev > 24)
1704 creature_ptr->free_act = TRUE;
1706 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1707 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1709 creature_ptr->to_a += creature_ptr->lev / 2 + 5;
1710 creature_ptr->dis_to_a += creature_ptr->lev / 2 + 5;
1712 creature_ptr->slow_digest = TRUE;
1713 creature_ptr->resist_fear = TRUE;
1714 if (creature_ptr->lev > 19) creature_ptr->resist_pois = TRUE;
1715 if (creature_ptr->lev > 24) creature_ptr->sustain_dex = TRUE;
1716 if (creature_ptr->lev > 29) creature_ptr->see_inv = TRUE;
1717 if (creature_ptr->lev > 44)
1719 creature_ptr->oppose_pois = 1;
1720 creature_ptr->redraw |= PR_STATUS;
1722 creature_ptr->see_nocto = TRUE;
1727 if (creature_ptr->mimic_form)
1729 switch (creature_ptr->mimic_form)
1732 creature_ptr->hold_exp = TRUE;
1733 creature_ptr->resist_chaos = TRUE;
1734 creature_ptr->resist_neth = TRUE;
1735 creature_ptr->resist_fire = TRUE;
1736 creature_ptr->oppose_fire = 1;
1737 creature_ptr->see_inv = TRUE;
1739 creature_ptr->redraw |= PR_STATUS;
1740 creature_ptr->to_a += 10;
1741 creature_ptr->dis_to_a += 10;
1743 case MIMIC_DEMON_LORD:
1744 creature_ptr->hold_exp = TRUE;
1745 creature_ptr->resist_chaos = TRUE;
1746 creature_ptr->resist_neth = TRUE;
1747 creature_ptr->immune_fire = TRUE;
1748 creature_ptr->resist_acid = TRUE;
1749 creature_ptr->resist_fire = TRUE;
1750 creature_ptr->resist_cold = TRUE;
1751 creature_ptr->resist_elec = TRUE;
1752 creature_ptr->resist_pois = TRUE;
1753 creature_ptr->resist_conf = TRUE;
1754 creature_ptr->resist_disen = TRUE;
1755 creature_ptr->resist_nexus = TRUE;
1756 creature_ptr->resist_fear = TRUE;
1757 creature_ptr->sh_fire = TRUE;
1758 creature_ptr->see_inv = TRUE;
1759 creature_ptr->telepathy = TRUE;
1760 creature_ptr->levitation = TRUE;
1761 creature_ptr->kill_wall = TRUE;
1763 creature_ptr->to_a += 20;
1764 creature_ptr->dis_to_a += 20;
1767 creature_ptr->resist_dark = TRUE;
1768 creature_ptr->hold_exp = TRUE;
1769 creature_ptr->resist_neth = TRUE;
1770 creature_ptr->resist_cold = TRUE;
1771 creature_ptr->resist_pois = TRUE;
1772 creature_ptr->see_inv = TRUE;
1774 creature_ptr->to_a += 10;
1775 creature_ptr->dis_to_a += 10;
1776 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1782 switch (creature_ptr->prace)
1785 creature_ptr->resist_lite = TRUE;
1788 creature_ptr->hold_exp = TRUE;
1791 creature_ptr->free_act = TRUE;
1794 creature_ptr->resist_blind = TRUE;
1797 creature_ptr->resist_dark = TRUE;
1799 case RACE_HALF_TROLL:
1800 creature_ptr->sustain_str = TRUE;
1802 if (creature_ptr->lev > 14)
1804 /* High level trolls heal fast... */
1805 creature_ptr->regenerate = TRUE;
1807 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER)
1809 creature_ptr->slow_digest = TRUE;
1810 /* Let's not make Regeneration
1811 * a disadvantage for the poor warriors who can
1812 * never learn a spell that satisfies hunger (actually
1813 * neither can rogues, but half-trolls are not
1814 * supposed to play rogues) */
1819 creature_ptr->sustain_con = TRUE;
1820 creature_ptr->regenerate = TRUE; /* Amberites heal fast... */
1823 creature_ptr->resist_lite = TRUE;
1824 creature_ptr->see_inv = TRUE;
1826 case RACE_BARBARIAN:
1827 creature_ptr->resist_fear = TRUE;
1829 case RACE_HALF_OGRE:
1830 creature_ptr->resist_dark = TRUE;
1831 creature_ptr->sustain_str = TRUE;
1833 case RACE_HALF_GIANT:
1834 creature_ptr->sustain_str = TRUE;
1835 creature_ptr->resist_shard = TRUE;
1837 case RACE_HALF_TITAN:
1838 creature_ptr->resist_chaos = TRUE;
1841 creature_ptr->resist_sound = TRUE;
1844 creature_ptr->resist_acid = TRUE;
1845 if (creature_ptr->lev > 19) creature_ptr->immune_acid = TRUE;
1848 creature_ptr->resist_conf = TRUE;
1849 creature_ptr->resist_acid = TRUE;
1851 /* Klackons become faster */
1852 new_speed += (creature_ptr->lev) / 10;
1855 creature_ptr->resist_pois = TRUE;
1858 creature_ptr->resist_disen = TRUE;
1859 creature_ptr->resist_dark = TRUE;
1862 creature_ptr->resist_dark = TRUE;
1863 if (creature_ptr->lev > 19) creature_ptr->see_inv = TRUE;
1865 case RACE_DRACONIAN:
1866 creature_ptr->levitation = TRUE;
1867 if (creature_ptr->lev > 4) creature_ptr->resist_fire = TRUE;
1868 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1869 if (creature_ptr->lev > 14) creature_ptr->resist_acid = TRUE;
1870 if (creature_ptr->lev > 19) creature_ptr->resist_elec = TRUE;
1871 if (creature_ptr->lev > 34) creature_ptr->resist_pois = TRUE;
1873 case RACE_MIND_FLAYER:
1874 creature_ptr->sustain_int = TRUE;
1875 creature_ptr->sustain_wis = TRUE;
1876 if (creature_ptr->lev > 14) creature_ptr->see_inv = TRUE;
1877 if (creature_ptr->lev > 29) creature_ptr->telepathy = TRUE;
1880 creature_ptr->resist_fire = TRUE;
1881 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1884 creature_ptr->slow_digest = TRUE;
1885 creature_ptr->free_act = TRUE;
1886 creature_ptr->see_inv = TRUE;
1887 creature_ptr->resist_pois = TRUE;
1888 if (creature_ptr->lev > 34) creature_ptr->hold_exp = TRUE;
1891 creature_ptr->resist_shard = TRUE;
1892 creature_ptr->hold_exp = TRUE;
1893 creature_ptr->see_inv = TRUE;
1894 creature_ptr->resist_pois = TRUE;
1895 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1898 creature_ptr->resist_neth = TRUE;
1899 creature_ptr->hold_exp = TRUE;
1900 creature_ptr->see_inv = TRUE;
1901 creature_ptr->resist_pois = TRUE;
1902 creature_ptr->slow_digest = TRUE;
1903 if (creature_ptr->lev > 4) creature_ptr->resist_cold = TRUE;
1906 creature_ptr->resist_dark = TRUE;
1907 creature_ptr->hold_exp = TRUE;
1908 creature_ptr->resist_neth = TRUE;
1909 creature_ptr->resist_cold = TRUE;
1910 creature_ptr->resist_pois = TRUE;
1911 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1914 creature_ptr->levitation = TRUE;
1915 creature_ptr->free_act = TRUE;
1916 creature_ptr->resist_neth = TRUE;
1917 creature_ptr->hold_exp = TRUE;
1918 creature_ptr->see_inv = TRUE;
1919 creature_ptr->resist_pois = TRUE;
1920 creature_ptr->slow_digest = TRUE;
1921 creature_ptr->resist_cold = TRUE;
1922 creature_ptr->pass_wall = TRUE;
1923 if (creature_ptr->lev > 34) creature_ptr->telepathy = TRUE;
1926 creature_ptr->levitation = TRUE;
1927 creature_ptr->resist_lite = TRUE;
1929 /* Sprites become faster */
1930 new_speed += (creature_ptr->lev) / 10;
1933 creature_ptr->resist_conf = TRUE;
1934 creature_ptr->resist_sound = TRUE;
1937 /* Ents dig like maniacs, but only with their hands. */
1938 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
1939 creature_ptr->skill_dig += creature_ptr->lev * 10;
1940 /* Ents get tougher and stronger as they age, but lose dexterity. */
1941 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_STR]++;
1942 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_STR]++;
1943 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_STR]++;
1945 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_DEX]--;
1946 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_DEX]--;
1947 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_DEX]--;
1949 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_CON]++;
1950 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_CON]++;
1951 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_CON]++;
1954 creature_ptr->levitation = TRUE;
1955 creature_ptr->see_inv = TRUE;
1958 creature_ptr->resist_fire = TRUE;
1959 creature_ptr->resist_neth = TRUE;
1960 creature_ptr->hold_exp = TRUE;
1961 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1962 if (creature_ptr->lev > 44)
1964 creature_ptr->oppose_fire = 1;
1965 creature_ptr->redraw |= PR_STATUS;
1969 creature_ptr->sustain_con = TRUE;
1972 creature_ptr->levitation = TRUE;
1975 creature_ptr->resist_conf = TRUE;
1978 creature_ptr->slow_digest = TRUE;
1979 creature_ptr->free_act = TRUE;
1980 creature_ptr->resist_pois = TRUE;
1981 creature_ptr->hold_exp = TRUE;
1984 creature_ptr->resist_water = TRUE;
1992 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU))
1994 creature_ptr->see_inv = TRUE;
1995 creature_ptr->free_act = TRUE;
1996 creature_ptr->slow_digest = TRUE;
1997 creature_ptr->regenerate = TRUE;
1998 creature_ptr->levitation = TRUE;
1999 creature_ptr->hold_exp = TRUE;
2000 creature_ptr->telepathy = TRUE;
2001 creature_ptr->lite = TRUE;
2002 creature_ptr->sustain_str = TRUE;
2003 creature_ptr->sustain_int = TRUE;
2004 creature_ptr->sustain_wis = TRUE;
2005 creature_ptr->sustain_con = TRUE;
2006 creature_ptr->sustain_dex = TRUE;
2007 creature_ptr->sustain_chr = TRUE;
2008 creature_ptr->resist_acid = TRUE;
2009 creature_ptr->resist_elec = TRUE;
2010 creature_ptr->resist_fire = TRUE;
2011 creature_ptr->resist_cold = TRUE;
2012 creature_ptr->resist_pois = TRUE;
2013 creature_ptr->resist_conf = TRUE;
2014 creature_ptr->resist_sound = TRUE;
2015 creature_ptr->resist_lite = TRUE;
2016 creature_ptr->resist_dark = TRUE;
2017 creature_ptr->resist_chaos = TRUE;
2018 creature_ptr->resist_disen = TRUE;
2019 creature_ptr->resist_shard = TRUE;
2020 creature_ptr->resist_nexus = TRUE;
2021 creature_ptr->resist_blind = TRUE;
2022 creature_ptr->resist_neth = TRUE;
2023 creature_ptr->resist_fear = TRUE;
2024 creature_ptr->reflect = TRUE;
2025 creature_ptr->sh_fire = TRUE;
2026 creature_ptr->sh_elec = TRUE;
2027 creature_ptr->sh_cold = TRUE;
2028 creature_ptr->to_a += 100;
2029 creature_ptr->dis_to_a += 100;
2031 /* Temporary shield */
2032 else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef)
2034 creature_ptr->to_a += 50;
2035 creature_ptr->dis_to_a += 50;
2038 if (creature_ptr->tim_res_nether)
2040 creature_ptr->resist_neth = TRUE;
2043 if (creature_ptr->tim_sh_fire)
2045 creature_ptr->sh_fire = TRUE;
2048 if (creature_ptr->tim_res_time)
2050 creature_ptr->resist_time = TRUE;
2054 if (creature_ptr->pseikaku == SEIKAKU_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE);
2056 if (creature_ptr->pseikaku == SEIKAKU_NAMAKE) creature_ptr->to_m_chance += 10;
2057 if (creature_ptr->pseikaku == SEIKAKU_KIREMONO) creature_ptr->to_m_chance -= 3;
2058 if ((creature_ptr->pseikaku == SEIKAKU_GAMAN) || (creature_ptr->pseikaku == SEIKAKU_CHIKARA)) creature_ptr->to_m_chance++;
2060 if (creature_ptr->pseikaku == SEIKAKU_CHARGEMAN)
2062 creature_ptr->to_m_chance += 5;
2063 creature_ptr->resist_conf = TRUE;
2067 if (creature_ptr->pseikaku == SEIKAKU_LUCKY) creature_ptr->muta3 |= MUT3_GOOD_LUCK;
2069 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
2071 creature_ptr->resist_blind = TRUE;
2072 creature_ptr->resist_conf = TRUE;
2073 creature_ptr->hold_exp = TRUE;
2074 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
2076 if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
2077 /* Munchkin become faster */
2078 new_speed += (creature_ptr->lev) / 10 + 5;
2081 if (music_singing(creature_ptr, MUSIC_WALL))
2083 creature_ptr->kill_wall = TRUE;
2086 /* Hack -- apply racial/class stat maxes */
2087 /* Apply the racial modifiers */
2088 for (i = 0; i < A_MAX; i++)
2090 /* Modify the stats for "race" */
2091 creature_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
2094 /* I'm adding the mutations here for the lack of a better place... */
2095 if (creature_ptr->muta3)
2097 /* Hyper Strength */
2098 if (creature_ptr->muta3 & MUT3_HYPER_STR)
2100 creature_ptr->stat_add[A_STR] += 4;
2104 if (creature_ptr->muta3 & MUT3_PUNY)
2106 creature_ptr->stat_add[A_STR] -= 4;
2109 /* Living computer */
2110 if (creature_ptr->muta3 & MUT3_HYPER_INT)
2112 creature_ptr->stat_add[A_INT] += 4;
2113 creature_ptr->stat_add[A_WIS] += 4;
2117 if (creature_ptr->muta3 & MUT3_MORONIC)
2119 creature_ptr->stat_add[A_INT] -= 4;
2120 creature_ptr->stat_add[A_WIS] -= 4;
2123 if (creature_ptr->muta3 & MUT3_RESILIENT)
2125 creature_ptr->stat_add[A_CON] += 4;
2128 if (creature_ptr->muta3 & MUT3_XTRA_FAT)
2130 creature_ptr->stat_add[A_CON] += 2;
2134 if (creature_ptr->muta3 & MUT3_ALBINO)
2136 creature_ptr->stat_add[A_CON] -= 4;
2139 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
2141 creature_ptr->stat_add[A_CON] -= 2;
2142 creature_ptr->stat_add[A_CHR] -= 1;
2143 creature_ptr->regenerate = FALSE;
2144 /* Cancel innate regeneration */
2147 if (creature_ptr->muta3 & MUT3_SILLY_VOI)
2149 creature_ptr->stat_add[A_CHR] -= 4;
2152 if (creature_ptr->muta3 & MUT3_BLANK_FAC)
2154 creature_ptr->stat_add[A_CHR] -= 1;
2157 if (creature_ptr->muta3 & MUT3_XTRA_EYES)
2159 creature_ptr->skill_fos += 15;
2160 creature_ptr->skill_srh += 15;
2163 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
2165 creature_ptr->skill_sav += (15 + (creature_ptr->lev / 5));
2168 if (creature_ptr->muta3 & MUT3_XTRA_NOIS)
2170 creature_ptr->skill_stl -= 3;
2173 if (creature_ptr->muta3 & MUT3_INFRAVIS)
2175 creature_ptr->see_infra += 3;
2178 if (creature_ptr->muta3 & MUT3_XTRA_LEGS)
2183 if (creature_ptr->muta3 & MUT3_SHORT_LEG)
2188 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
2190 creature_ptr->sh_elec = TRUE;
2193 if (creature_ptr->muta3 & MUT3_FIRE_BODY)
2195 creature_ptr->sh_fire = TRUE;
2196 creature_ptr->lite = TRUE;
2199 if (creature_ptr->muta3 & MUT3_WART_SKIN)
2201 creature_ptr->stat_add[A_CHR] -= 2;
2202 creature_ptr->to_a += 5;
2203 creature_ptr->dis_to_a += 5;
2206 if (creature_ptr->muta3 & MUT3_SCALES)
2208 creature_ptr->stat_add[A_CHR] -= 1;
2209 creature_ptr->to_a += 10;
2210 creature_ptr->dis_to_a += 10;
2213 if (creature_ptr->muta3 & MUT3_IRON_SKIN)
2215 creature_ptr->stat_add[A_DEX] -= 1;
2216 creature_ptr->to_a += 25;
2217 creature_ptr->dis_to_a += 25;
2220 if (creature_ptr->muta3 & MUT3_WINGS)
2222 creature_ptr->levitation = TRUE;
2225 if (creature_ptr->muta3 & MUT3_FEARLESS)
2227 creature_ptr->resist_fear = TRUE;
2230 if (creature_ptr->muta3 & MUT3_REGEN)
2232 creature_ptr->regenerate = TRUE;
2235 if (creature_ptr->muta3 & MUT3_ESP)
2237 creature_ptr->telepathy = TRUE;
2240 if (creature_ptr->muta3 & MUT3_LIMBER)
2242 creature_ptr->stat_add[A_DEX] += 3;
2245 if (creature_ptr->muta3 & MUT3_ARTHRITIS)
2247 creature_ptr->stat_add[A_DEX] -= 3;
2250 if (creature_ptr->muta3 & MUT3_MOTION)
2252 creature_ptr->free_act = TRUE;
2253 creature_ptr->skill_stl += 1;
2256 if (creature_ptr->muta3 & MUT3_ILL_NORM)
2258 creature_ptr->stat_add[A_CHR] = 0;
2262 if (creature_ptr->tsuyoshi)
2264 creature_ptr->stat_add[A_STR] += 4;
2265 creature_ptr->stat_add[A_CON] += 4;
2268 /* Scan the usable creature_ptr->inventory_list */
2269 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2271 int bonus_to_h, bonus_to_d;
2272 o_ptr = &creature_ptr->inventory_list[i];
2273 if (!o_ptr->k_idx) continue;
2275 object_flags(o_ptr, flgs);
2277 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
2278 if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD;
2281 if (have_flag(flgs, TR_STR)) creature_ptr->stat_add[A_STR] += o_ptr->pval;
2282 if (have_flag(flgs, TR_INT)) creature_ptr->stat_add[A_INT] += o_ptr->pval;
2283 if (have_flag(flgs, TR_WIS)) creature_ptr->stat_add[A_WIS] += o_ptr->pval;
2284 if (have_flag(flgs, TR_DEX)) creature_ptr->stat_add[A_DEX] += o_ptr->pval;
2285 if (have_flag(flgs, TR_CON)) creature_ptr->stat_add[A_CON] += o_ptr->pval;
2286 if (have_flag(flgs, TR_CHR)) creature_ptr->stat_add[A_CHR] += o_ptr->pval;
2288 if (have_flag(flgs, TR_MAGIC_MASTERY)) creature_ptr->skill_dev += 8 * o_ptr->pval;
2290 /* Affect stealth */
2291 if (have_flag(flgs, TR_STEALTH)) creature_ptr->skill_stl += o_ptr->pval;
2293 /* Affect searching ability (factor of five) */
2294 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_srh += (o_ptr->pval * 5);
2296 /* Affect searching frequency (factor of five) */
2297 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_fos += (o_ptr->pval * 5);
2299 /* Affect infravision */
2300 if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval;
2302 /* Affect digging (factor of 20) */
2303 if (have_flag(flgs, TR_TUNNEL)) creature_ptr->skill_dig += (o_ptr->pval * 20);
2306 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
2309 if (have_flag(flgs, TR_BLOWS))
2311 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->ryoute) extra_blows[0] += o_ptr->pval;
2312 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->ryoute) extra_blows[1] += o_ptr->pval;
2313 else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; }
2316 /* Hack -- cause earthquakes */
2317 if (have_flag(flgs, TR_IMPACT)) creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
2320 if (have_flag(flgs, TR_AGGRAVATE)) creature_ptr->cursed |= TRC_AGGRAVATE;
2321 if (have_flag(flgs, TR_DRAIN_EXP)) creature_ptr->cursed |= TRC_DRAIN_EXP;
2322 if (have_flag(flgs, TR_TY_CURSE)) creature_ptr->cursed |= TRC_TY_CURSE;
2323 if (have_flag(flgs, TR_ADD_L_CURSE)) creature_ptr->cursed |= TRC_ADD_L_CURSE;
2324 if (have_flag(flgs, TR_ADD_H_CURSE)) creature_ptr->cursed |= TRC_ADD_H_CURSE;
2325 if (have_flag(flgs, TR_DRAIN_HP)) creature_ptr->cursed |= TRC_DRAIN_HP;
2326 if (have_flag(flgs, TR_DRAIN_MANA)) creature_ptr->cursed |= TRC_DRAIN_MANA;
2327 if (have_flag(flgs, TR_CALL_ANIMAL)) creature_ptr->cursed |= TRC_CALL_ANIMAL;
2328 if (have_flag(flgs, TR_CALL_DEMON)) creature_ptr->cursed |= TRC_CALL_DEMON;
2329 if (have_flag(flgs, TR_CALL_DRAGON)) creature_ptr->cursed |= TRC_CALL_DRAGON;
2330 if (have_flag(flgs, TR_CALL_UNDEAD)) creature_ptr->cursed |= TRC_CALL_UNDEAD;
2331 if (have_flag(flgs, TR_COWARDICE)) creature_ptr->cursed |= TRC_COWARDICE;
2332 if (have_flag(flgs, TR_LOW_MELEE)) creature_ptr->cursed |= TRC_LOW_MELEE;
2333 if (have_flag(flgs, TR_LOW_AC)) creature_ptr->cursed |= TRC_LOW_AC;
2334 if (have_flag(flgs, TR_LOW_MAGIC)) creature_ptr->cursed |= TRC_LOW_MAGIC;
2335 if (have_flag(flgs, TR_FAST_DIGEST)) creature_ptr->cursed |= TRC_FAST_DIGEST;
2336 if (have_flag(flgs, TR_SLOW_REGEN)) creature_ptr->cursed |= TRC_SLOW_REGEN;
2337 if (have_flag(flgs, TR_DEC_MANA)) creature_ptr->dec_mana = TRUE;
2338 if (have_flag(flgs, TR_BLESSED)) creature_ptr->bless_blade = TRUE;
2339 if (have_flag(flgs, TR_XTRA_MIGHT)) creature_ptr->xtra_might = TRUE;
2340 if (have_flag(flgs, TR_SLOW_DIGEST)) creature_ptr->slow_digest = TRUE;
2341 if (have_flag(flgs, TR_REGEN)) creature_ptr->regenerate = TRUE;
2342 if (have_flag(flgs, TR_TELEPATHY)) creature_ptr->telepathy = TRUE;
2343 if (have_flag(flgs, TR_ESP_ANIMAL)) creature_ptr->esp_animal = TRUE;
2344 if (have_flag(flgs, TR_ESP_UNDEAD)) creature_ptr->esp_undead = TRUE;
2345 if (have_flag(flgs, TR_ESP_DEMON)) creature_ptr->esp_demon = TRUE;
2346 if (have_flag(flgs, TR_ESP_ORC)) creature_ptr->esp_orc = TRUE;
2347 if (have_flag(flgs, TR_ESP_TROLL)) creature_ptr->esp_troll = TRUE;
2348 if (have_flag(flgs, TR_ESP_GIANT)) creature_ptr->esp_giant = TRUE;
2349 if (have_flag(flgs, TR_ESP_DRAGON)) creature_ptr->esp_dragon = TRUE;
2350 if (have_flag(flgs, TR_ESP_HUMAN)) creature_ptr->esp_human = TRUE;
2351 if (have_flag(flgs, TR_ESP_EVIL)) creature_ptr->esp_evil = TRUE;
2352 if (have_flag(flgs, TR_ESP_GOOD)) creature_ptr->esp_good = TRUE;
2353 if (have_flag(flgs, TR_ESP_NONLIVING)) creature_ptr->esp_nonliving = TRUE;
2354 if (have_flag(flgs, TR_ESP_UNIQUE)) creature_ptr->esp_unique = TRUE;
2356 if (have_flag(flgs, TR_SEE_INVIS)) creature_ptr->see_inv = TRUE;
2357 if (have_flag(flgs, TR_LEVITATION)) creature_ptr->levitation = TRUE;
2358 if (have_flag(flgs, TR_FREE_ACT)) creature_ptr->free_act = TRUE;
2359 if (have_flag(flgs, TR_HOLD_EXP)) creature_ptr->hold_exp = TRUE;
2360 if (have_flag(flgs, TR_WARNING)) {
2361 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription), '$')))
2362 creature_ptr->warning = TRUE;
2365 if (have_flag(flgs, TR_TELEPORT))
2367 if (object_is_cursed(o_ptr)) creature_ptr->cursed |= TRC_TELEPORT;
2370 concptr insc = quark_str(o_ptr->inscription);
2372 if (o_ptr->inscription && my_strchr(insc, '.'))
2375 * {.} will stop random teleportation.
2380 /* Controlled random teleportation */
2381 creature_ptr->cursed |= TRC_TELEPORT_SELF;
2386 /* Immunity flags */
2387 if (have_flag(flgs, TR_IM_FIRE)) creature_ptr->immune_fire = TRUE;
2388 if (have_flag(flgs, TR_IM_ACID)) creature_ptr->immune_acid = TRUE;
2389 if (have_flag(flgs, TR_IM_COLD)) creature_ptr->immune_cold = TRUE;
2390 if (have_flag(flgs, TR_IM_ELEC)) creature_ptr->immune_elec = TRUE;
2392 /* Resistance flags */
2393 if (have_flag(flgs, TR_RES_ACID)) creature_ptr->resist_acid = TRUE;
2394 if (have_flag(flgs, TR_RES_ELEC)) creature_ptr->resist_elec = TRUE;
2395 if (have_flag(flgs, TR_RES_FIRE)) creature_ptr->resist_fire = TRUE;
2396 if (have_flag(flgs, TR_RES_COLD)) creature_ptr->resist_cold = TRUE;
2397 if (have_flag(flgs, TR_RES_POIS)) creature_ptr->resist_pois = TRUE;
2398 if (have_flag(flgs, TR_RES_FEAR)) creature_ptr->resist_fear = TRUE;
2399 if (have_flag(flgs, TR_RES_CONF)) creature_ptr->resist_conf = TRUE;
2400 if (have_flag(flgs, TR_RES_SOUND)) creature_ptr->resist_sound = TRUE;
2401 if (have_flag(flgs, TR_RES_LITE)) creature_ptr->resist_lite = TRUE;
2402 if (have_flag(flgs, TR_RES_DARK)) creature_ptr->resist_dark = TRUE;
2403 if (have_flag(flgs, TR_RES_CHAOS)) creature_ptr->resist_chaos = TRUE;
2404 if (have_flag(flgs, TR_RES_DISEN)) creature_ptr->resist_disen = TRUE;
2405 if (have_flag(flgs, TR_RES_SHARDS)) creature_ptr->resist_shard = TRUE;
2406 if (have_flag(flgs, TR_RES_NEXUS)) creature_ptr->resist_nexus = TRUE;
2407 if (have_flag(flgs, TR_RES_BLIND)) creature_ptr->resist_blind = TRUE;
2408 if (have_flag(flgs, TR_RES_NETHER)) creature_ptr->resist_neth = TRUE;
2410 if (have_flag(flgs, TR_REFLECT)) creature_ptr->reflect = TRUE;
2411 if (have_flag(flgs, TR_SH_FIRE)) creature_ptr->sh_fire = TRUE;
2412 if (have_flag(flgs, TR_SH_ELEC)) creature_ptr->sh_elec = TRUE;
2413 if (have_flag(flgs, TR_SH_COLD)) creature_ptr->sh_cold = TRUE;
2414 if (have_flag(flgs, TR_NO_MAGIC)) creature_ptr->anti_magic = TRUE;
2415 if (have_flag(flgs, TR_NO_TELE)) creature_ptr->anti_tele = TRUE;
2418 if (have_flag(flgs, TR_SUST_STR)) creature_ptr->sustain_str = TRUE;
2419 if (have_flag(flgs, TR_SUST_INT)) creature_ptr->sustain_int = TRUE;
2420 if (have_flag(flgs, TR_SUST_WIS)) creature_ptr->sustain_wis = TRUE;
2421 if (have_flag(flgs, TR_SUST_DEX)) creature_ptr->sustain_dex = TRUE;
2422 if (have_flag(flgs, TR_SUST_CON)) creature_ptr->sustain_con = TRUE;
2423 if (have_flag(flgs, TR_SUST_CHR)) creature_ptr->sustain_chr = TRUE;
2425 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
2426 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
2427 if (o_ptr->name2 == EGO_RING_RES_TIME) creature_ptr->resist_time = TRUE;
2428 if (o_ptr->name2 == EGO_RING_THROW) creature_ptr->mighty_throw = TRUE;
2429 if (have_flag(flgs, TR_EASY_SPELL)) creature_ptr->easy_spell = TRUE;
2430 if (o_ptr->name2 == EGO_AMU_FOOL) creature_ptr->heavy_spell = TRUE;
2431 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
2433 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
2435 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2437 creature_ptr->to_m_chance += 10;
2441 creature_ptr->to_m_chance += 3;
2445 if (o_ptr->tval == TV_CAPTURE) continue;
2447 /* Modify the base armor class */
2448 creature_ptr->ac += o_ptr->ac;
2450 /* The base armor class is always known */
2451 creature_ptr->dis_ac += o_ptr->ac;
2453 /* Apply the bonuses to armor class */
2454 creature_ptr->to_a += o_ptr->to_a;
2456 /* Apply the mental bonuses to armor class, if known */
2457 if (object_is_known(o_ptr)) creature_ptr->dis_to_a += o_ptr->to_a;
2459 if (o_ptr->curse_flags & TRC_LOW_MELEE)
2461 int slot = i - INVEN_RARM;
2464 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2466 creature_ptr->to_h[slot] -= 15;
2467 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h[slot] -= 15;
2471 creature_ptr->to_h[slot] -= 5;
2472 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h[slot] -= 5;
2477 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2479 creature_ptr->to_h_b -= 15;
2480 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h_b -= 15;
2484 creature_ptr->to_h_b -= 5;
2485 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h_b -= 5;
2490 if (o_ptr->curse_flags & TRC_LOW_AC)
2492 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2494 creature_ptr->to_a -= 30;
2495 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_a -= 30;
2499 creature_ptr->to_a -= 10;
2500 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_a -= 10;
2504 /* Hack -- do not apply "weapon" bonuses */
2505 if (i == INVEN_RARM && has_melee_weapon(creature_ptr, i)) continue;
2506 if (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) continue;
2508 /* Hack -- do not apply "bow" bonuses */
2509 if (i == INVEN_BOW) continue;
2511 bonus_to_h = o_ptr->to_h;
2512 bonus_to_d = o_ptr->to_d;
2514 if (creature_ptr->pclass == CLASS_NINJA)
2516 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2;
2517 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2;
2520 /* To Bow and Natural attack */
2522 /* Apply the bonuses to hit/damage */
2523 creature_ptr->to_h_b += (s16b)bonus_to_h;
2524 creature_ptr->to_h_m += (s16b)bonus_to_h;
2525 creature_ptr->to_d_m += (s16b)bonus_to_d;
2527 /* Apply the mental bonuses tp hit/damage, if known */
2528 if (object_is_known(o_ptr)) creature_ptr->dis_to_h_b += (s16b)bonus_to_h;
2531 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !creature_ptr->ryoute)
2533 /* Apply the bonuses to hit/damage */
2534 creature_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2535 creature_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2537 /* Apply the mental bonuses tp hit/damage, if known */
2538 if (object_is_known(o_ptr))
2540 creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2541 creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2544 else if (creature_ptr->migite && creature_ptr->hidarite)
2546 /* Apply the bonuses to hit/damage */
2547 creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2548 creature_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2549 creature_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2550 creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2552 /* Apply the mental bonuses tp hit/damage, if known */
2553 if (object_is_known(o_ptr))
2555 creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2556 creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2557 creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2558 creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2563 /* Apply the bonuses to hit/damage */
2564 creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
2565 creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
2567 /* Apply the mental bonuses to hit/damage, if known */
2568 if (object_is_known(o_ptr))
2570 creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
2571 creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
2576 /* Shield skill bonus */
2577 if (object_is_armour(&creature_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&creature_ptr->inventory_list[INVEN_LARM]))
2579 creature_ptr->ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2580 creature_ptr->dis_ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2583 if (old_mighty_throw != creature_ptr->mighty_throw)
2585 /* Redraw average damege display of Shuriken */
2586 creature_ptr->window |= PW_INVEN;
2589 if (creature_ptr->cursed & TRC_TELEPORT) creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
2591 /* Monks get extra ac for armour _not worn_ */
2592 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr))
2594 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx))
2596 creature_ptr->to_a += (creature_ptr->lev * 3) / 2;
2597 creature_ptr->dis_to_a += (creature_ptr->lev * 3) / 2;
2599 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15))
2601 creature_ptr->to_a += ((creature_ptr->lev - 13) / 3);
2602 creature_ptr->dis_to_a += ((creature_ptr->lev - 13) / 3);
2604 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10))
2606 creature_ptr->to_a += ((creature_ptr->lev - 8) / 3);
2607 creature_ptr->dis_to_a += ((creature_ptr->lev - 8) / 3);
2609 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4))
2611 creature_ptr->to_a += (creature_ptr->lev - 2) / 3;
2612 creature_ptr->dis_to_a += (creature_ptr->lev - 2) / 3;
2614 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx))
2616 creature_ptr->to_a += (creature_ptr->lev / 2);
2617 creature_ptr->dis_to_a += (creature_ptr->lev / 2);
2619 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx))
2621 creature_ptr->to_a += (creature_ptr->lev / 3);
2622 creature_ptr->dis_to_a += (creature_ptr->lev / 3);
2624 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2626 creature_ptr->stat_add[A_STR] += 2;
2627 creature_ptr->stat_add[A_DEX] += 2;
2628 creature_ptr->stat_add[A_CON] -= 3;
2630 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2633 else if (creature_ptr->special_defense & KAMAE_GENBU)
2635 creature_ptr->stat_add[A_INT] -= 1;
2636 creature_ptr->stat_add[A_WIS] -= 1;
2637 creature_ptr->stat_add[A_DEX] -= 2;
2638 creature_ptr->stat_add[A_CON] += 3;
2640 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2642 creature_ptr->stat_add[A_STR] -= 2;
2643 creature_ptr->stat_add[A_INT] += 1;
2644 creature_ptr->stat_add[A_WIS] += 1;
2645 creature_ptr->stat_add[A_DEX] += 2;
2646 creature_ptr->stat_add[A_CON] -= 2;
2650 if (creature_ptr->special_defense & KATA_KOUKIJIN)
2652 for (i = 0; i < A_MAX; i++)
2653 creature_ptr->stat_add[i] += 5;
2654 creature_ptr->to_a -= 50;
2655 creature_ptr->dis_to_a -= 50;
2658 /* Hack -- aura of fire also provides light */
2659 if (creature_ptr->sh_fire) creature_ptr->lite = TRUE;
2661 /* Golems also get an intrinsic AC bonus */
2662 if (PRACE_IS_(creature_ptr, RACE_GOLEM) || PRACE_IS_(creature_ptr, RACE_ANDROID))
2664 creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
2665 creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
2669 if (creature_ptr->realm1 == REALM_HEX)
2671 if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + CASTING_HEX_NUM(creature_ptr));
2672 if (hex_spelling(HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
2673 if (hex_spelling(HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
2674 if (hex_spelling(HEX_BUILDING))
2676 creature_ptr->stat_add[A_STR] += 4;
2677 creature_ptr->stat_add[A_DEX] += 4;
2678 creature_ptr->stat_add[A_CON] += 4;
2680 if (hex_spelling(HEX_DEMON_AURA))
2682 creature_ptr->sh_fire = TRUE;
2683 creature_ptr->regenerate = TRUE;
2685 if (hex_spelling(HEX_ICE_ARMOR))
2687 creature_ptr->sh_cold = TRUE;
2688 creature_ptr->to_a += 30;
2689 creature_ptr->dis_to_a += 30;
2691 if (hex_spelling(HEX_SHOCK_CLOAK))
2693 creature_ptr->sh_elec = TRUE;
2696 for (i = INVEN_RARM; i <= INVEN_FEET; i++)
2698 ARMOUR_CLASS ac = 0;
2699 o_ptr = &creature_ptr->inventory_list[i];
2700 if (!o_ptr->k_idx) continue;
2701 if (!object_is_armour(o_ptr)) continue;
2702 if (!object_is_cursed(o_ptr)) continue;
2704 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
2705 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
2706 creature_ptr->to_a += (s16b)ac;
2707 creature_ptr->dis_to_a += (s16b)ac;
2711 /* Calculate stats */
2712 for (i = 0; i < A_MAX; i++)
2716 /* Extract the new "stat_use" value for the stat */
2717 top = modify_stat_value(creature_ptr->stat_max[i], creature_ptr->stat_add[i]);
2719 /* Notice changes */
2720 if (creature_ptr->stat_top[i] != top)
2722 /* Save the new value */
2723 creature_ptr->stat_top[i] = (s16b)top;
2724 creature_ptr->redraw |= (PR_STATS);
2725 creature_ptr->window |= (PW_PLAYER);
2729 /* Extract the new "stat_use" value for the stat */
2730 use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
2732 if ((i == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM))
2734 /* 10 to 18/90 charisma, guaranteed, based on level */
2735 if (use < 8 + 2 * creature_ptr->lev)
2737 use = 8 + 2 * creature_ptr->lev;
2741 /* Notice changes */
2742 if (creature_ptr->stat_use[i] != use)
2744 /* Save the new value */
2745 creature_ptr->stat_use[i] = (s16b)use;
2746 creature_ptr->redraw |= (PR_STATS);
2747 creature_ptr->window |= (PW_PLAYER);
2751 /* Values: 3, 4, ..., 17 */
2752 if (use <= 18) ind = (use - 3);
2754 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
2755 else if (use <= 18 + 219) ind = (15 + (use - 18) / 10);
2757 /* Range: 18/220+ */
2760 /* Notice changes */
2761 if (creature_ptr->stat_ind[i] != ind)
2763 /* Save the new index */
2764 creature_ptr->stat_ind[i] = (s16b)ind;
2766 /* Change in CON affects Hitpoints */
2769 creature_ptr->update |= (PU_HP);
2772 /* Change in INT may affect Mana/Spells */
2773 else if (i == A_INT)
2775 if (mp_ptr->spell_stat == A_INT)
2777 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2781 /* Change in WIS may affect Mana/Spells */
2782 else if (i == A_WIS)
2784 if (mp_ptr->spell_stat == A_WIS)
2786 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2790 /* Change in WIS may affect Mana/Spells */
2791 else if (i == A_CHR)
2793 if (mp_ptr->spell_stat == A_CHR)
2795 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2799 creature_ptr->window |= (PW_PLAYER);
2803 /* Apply temporary "stun" */
2804 if (creature_ptr->stun > 50)
2806 creature_ptr->to_h[0] -= 20;
2807 creature_ptr->to_h[1] -= 20;
2808 creature_ptr->to_h_b -= 20;
2809 creature_ptr->to_h_m -= 20;
2810 creature_ptr->dis_to_h[0] -= 20;
2811 creature_ptr->dis_to_h[1] -= 20;
2812 creature_ptr->dis_to_h_b -= 20;
2813 creature_ptr->to_d[0] -= 20;
2814 creature_ptr->to_d[1] -= 20;
2815 creature_ptr->to_d_m -= 20;
2816 creature_ptr->dis_to_d[0] -= 20;
2817 creature_ptr->dis_to_d[1] -= 20;
2819 else if (creature_ptr->stun)
2821 creature_ptr->to_h[0] -= 5;
2822 creature_ptr->to_h[1] -= 5;
2823 creature_ptr->to_h_b -= 5;
2824 creature_ptr->to_h_m -= 5;
2825 creature_ptr->dis_to_h[0] -= 5;
2826 creature_ptr->dis_to_h[1] -= 5;
2827 creature_ptr->dis_to_h_b -= 5;
2828 creature_ptr->to_d[0] -= 5;
2829 creature_ptr->to_d[1] -= 5;
2830 creature_ptr->to_d_m -= 5;
2831 creature_ptr->dis_to_d[0] -= 5;
2832 creature_ptr->dis_to_d[1] -= 5;
2836 if (creature_ptr->wraith_form)
2838 creature_ptr->reflect = TRUE;
2839 creature_ptr->pass_wall = TRUE;
2842 if (creature_ptr->kabenuke)
2844 creature_ptr->pass_wall = TRUE;
2847 /* Temporary blessing */
2848 if (is_blessed(creature_ptr))
2850 creature_ptr->to_a += 5;
2851 creature_ptr->dis_to_a += 5;
2852 creature_ptr->to_h[0] += 10;
2853 creature_ptr->to_h[1] += 10;
2854 creature_ptr->to_h_b += 10;
2855 creature_ptr->to_h_m += 10;
2856 creature_ptr->dis_to_h[0] += 10;
2857 creature_ptr->dis_to_h[1] += 10;
2858 creature_ptr->dis_to_h_b += 10;
2861 if (creature_ptr->magicdef)
2863 creature_ptr->resist_blind = TRUE;
2864 creature_ptr->resist_conf = TRUE;
2865 creature_ptr->reflect = TRUE;
2866 creature_ptr->free_act = TRUE;
2867 creature_ptr->levitation = TRUE;
2870 /* Temporary "Hero" */
2871 if (IS_HERO(creature_ptr))
2873 creature_ptr->to_h[0] += 12;
2874 creature_ptr->to_h[1] += 12;
2875 creature_ptr->to_h_b += 12;
2876 creature_ptr->to_h_m += 12;
2877 creature_ptr->dis_to_h[0] += 12;
2878 creature_ptr->dis_to_h[1] += 12;
2879 creature_ptr->dis_to_h_b += 12;
2882 /* Temporary "Beserk" */
2883 if (creature_ptr->shero)
2885 creature_ptr->to_h[0] += 12;
2886 creature_ptr->to_h[1] += 12;
2887 creature_ptr->to_h_b -= 12;
2888 creature_ptr->to_h_m += 12;
2889 creature_ptr->to_d[0] += 3 + (creature_ptr->lev / 5);
2890 creature_ptr->to_d[1] += 3 + (creature_ptr->lev / 5);
2891 creature_ptr->to_d_m += 3 + (creature_ptr->lev / 5);
2892 creature_ptr->dis_to_h[0] += 12;
2893 creature_ptr->dis_to_h[1] += 12;
2894 creature_ptr->dis_to_h_b -= 12;
2895 creature_ptr->dis_to_d[0] += 3 + (creature_ptr->lev / 5);
2896 creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
2897 creature_ptr->to_a -= 10;
2898 creature_ptr->dis_to_a -= 10;
2899 creature_ptr->skill_stl -= 7;
2900 creature_ptr->skill_dev -= 20;
2901 creature_ptr->skill_sav -= 30;
2902 creature_ptr->skill_srh -= 15;
2903 creature_ptr->skill_fos -= 15;
2904 creature_ptr->skill_tht -= 20;
2905 creature_ptr->skill_dig += 30;
2908 /* Temporary "fast" */
2909 if (IS_FAST(creature_ptr))
2914 /* Temporary "slow" */
2915 if (creature_ptr->slow)
2920 /* Temporary "telepathy" */
2921 if (is_time_limit_esp(creature_ptr))
2923 creature_ptr->telepathy = TRUE;
2926 if (creature_ptr->ele_immune)
2928 if (creature_ptr->special_defense & DEFENSE_ACID)
2929 creature_ptr->immune_acid = TRUE;
2930 else if (creature_ptr->special_defense & DEFENSE_ELEC)
2931 creature_ptr->immune_elec = TRUE;
2932 else if (creature_ptr->special_defense & DEFENSE_FIRE)
2933 creature_ptr->immune_fire = TRUE;
2934 else if (creature_ptr->special_defense & DEFENSE_COLD)
2935 creature_ptr->immune_cold = TRUE;
2938 /* Temporary see invisible */
2939 if (creature_ptr->tim_invis)
2941 creature_ptr->see_inv = TRUE;
2944 /* Temporary infravision boost */
2945 if (creature_ptr->tim_infra)
2947 creature_ptr->see_infra += 3;
2950 /* Temporary regeneration boost */
2951 if (creature_ptr->tim_regen)
2953 creature_ptr->regenerate = TRUE;
2956 /* Temporary levitation */
2957 if (creature_ptr->tim_levitation)
2959 creature_ptr->levitation = TRUE;
2962 /* Temporary reflection */
2963 if (creature_ptr->tim_reflect)
2965 creature_ptr->reflect = TRUE;
2968 /* Hack -- Hero/Shero -> Res fear */
2969 if (IS_HERO(creature_ptr) || creature_ptr->shero)
2971 creature_ptr->resist_fear = TRUE;
2974 /* Hack -- Telepathy Change */
2975 if (creature_ptr->telepathy != old_telepathy)
2977 creature_ptr->update |= (PU_MONSTERS);
2980 if ((creature_ptr->esp_animal != old_esp_animal) ||
2981 (creature_ptr->esp_undead != old_esp_undead) ||
2982 (creature_ptr->esp_demon != old_esp_demon) ||
2983 (creature_ptr->esp_orc != old_esp_orc) ||
2984 (creature_ptr->esp_troll != old_esp_troll) ||
2985 (creature_ptr->esp_giant != old_esp_giant) ||
2986 (creature_ptr->esp_dragon != old_esp_dragon) ||
2987 (creature_ptr->esp_human != old_esp_human) ||
2988 (creature_ptr->esp_evil != old_esp_evil) ||
2989 (creature_ptr->esp_good != old_esp_good) ||
2990 (creature_ptr->esp_nonliving != old_esp_nonliving) ||
2991 (creature_ptr->esp_unique != old_esp_unique))
2993 creature_ptr->update |= (PU_MONSTERS);
2996 /* Hack -- See Invis Change */
2997 if (creature_ptr->see_inv != old_see_inv)
2999 creature_ptr->update |= (PU_MONSTERS);
3002 /* Bloating slows the player down (a little) */
3003 if (creature_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
3005 if (creature_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
3007 if ((creature_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
3008 (creature_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
3010 creature_ptr->to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3011 creature_ptr->dis_to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
3014 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
3016 int penalty1, penalty2;
3017 penalty1 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_RARM].weight) / 8);
3018 penalty2 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_LARM].weight) / 8);
3019 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
3021 penalty1 = penalty1 / 2 - 5;
3022 penalty2 = penalty2 / 2 - 5;
3024 creature_ptr->to_a += 10;
3025 creature_ptr->dis_to_a += 10;
3029 if (penalty1 > 0) penalty1 /= 2;
3030 if (penalty2 > 0) penalty2 /= 2;
3032 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)))
3034 penalty1 = MAX(0, penalty1 - 10);
3035 penalty2 = MAX(0, penalty2 - 10);
3037 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
3039 penalty1 = MIN(0, penalty1);
3040 penalty2 = MIN(0, penalty2);
3041 creature_ptr->to_a += 10;
3042 creature_ptr->dis_to_a += 10;
3046 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
3048 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
3051 if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
3052 if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
3053 creature_ptr->to_h[0] -= (s16b)penalty1;
3054 creature_ptr->to_h[1] -= (s16b)penalty2;
3055 creature_ptr->dis_to_h[0] -= (s16b)penalty1;
3056 creature_ptr->dis_to_h[1] -= (s16b)penalty2;
3059 /* Extract the current weight (in tenth pounds) */
3060 j = creature_ptr->total_weight;
3062 if (!creature_ptr->riding)
3064 /* Extract the "weight limit" (in tenth pounds) */
3065 i = (int)weight_limit(creature_ptr);
3069 monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
3070 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
3071 SPEED speed = riding_m_ptr->mspeed;
3073 if (riding_m_ptr->mspeed > 110)
3075 new_speed = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
3076 if (new_speed < 110) new_speed = 110;
3082 new_speed += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
3083 if (MON_FAST(riding_m_ptr)) new_speed += 10;
3084 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
3085 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
3086 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) creature_ptr->can_swim = TRUE;
3088 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) creature_ptr->pass_wall = FALSE;
3089 if (riding_r_ptr->flags2 & RF2_KILL_WALL) creature_ptr->kill_wall = TRUE;
3091 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
3093 /* Extract the "weight limit" */
3094 i = 1500 + riding_r_ptr->level * 25;
3097 /* Apply "encumbrance" from weight */
3098 if (j > i) new_speed -= ((j - i) / (i / 5));
3100 /* Searching slows the player down */
3101 if (creature_ptr->action == ACTION_SEARCH) new_speed -= 10;
3104 if (creature_ptr->prace == RACE_MERFOLK)
3106 if (have_flag(f_ptr->flags, FF_WATER))
3108 new_speed += (2 + creature_ptr->lev / 10);
3110 else if (!creature_ptr->levitation)
3116 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
3117 creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
3118 creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3119 creature_ptr->to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3120 creature_ptr->to_d_m += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3121 creature_ptr->to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3122 creature_ptr->to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3123 creature_ptr->to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3124 creature_ptr->to_h_m += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3125 creature_ptr->to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3126 creature_ptr->to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3127 creature_ptr->to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3128 creature_ptr->to_h_m += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3130 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
3131 creature_ptr->dis_to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
3132 creature_ptr->dis_to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3133 creature_ptr->dis_to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3134 creature_ptr->dis_to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3135 creature_ptr->dis_to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3136 creature_ptr->dis_to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3137 creature_ptr->dis_to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3138 creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3139 creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3142 /* Obtain the "hold" value */
3143 hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
3146 /* Examine the "current bow" */
3147 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3149 /* It is hard to carholdry a heavy bow */
3150 creature_ptr->heavy_shoot = is_heavy_shoot(creature_ptr, o_ptr);
3151 if (creature_ptr->heavy_shoot)
3153 /* Hard to wield a heavy bow */
3154 creature_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
3155 creature_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
3158 /* Compute "extra shots" if needed */
3161 creature_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr);
3163 /* Apply special flags */
3164 if (o_ptr->k_idx && !creature_ptr->heavy_shoot)
3167 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
3169 /* Snipers love Cross bows */
3170 if ((creature_ptr->pclass == CLASS_SNIPER) &&
3171 (creature_ptr->tval_ammo == TV_BOLT))
3173 creature_ptr->to_h_b += (10 + (creature_ptr->lev / 5));
3174 creature_ptr->dis_to_h_b += (10 + (creature_ptr->lev / 5));
3179 if (creature_ptr->ryoute) hold *= 2;
3181 for (i = 0; i < 2; i++)
3183 /* Examine the "main weapon" */
3184 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
3186 object_flags(o_ptr, flgs);
3188 /* Assume not heavy */
3189 creature_ptr->heavy_wield[i] = FALSE;
3190 creature_ptr->icky_wield[i] = FALSE;
3191 creature_ptr->riding_wield[i] = FALSE;
3193 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
3195 creature_ptr->num_blow[i] = 1;
3198 /* It is hard to hold a heavy weapon */
3199 if (hold < o_ptr->weight / 10)
3201 /* Hard to wield a heavy weapon */
3202 creature_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
3203 creature_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
3206 creature_ptr->heavy_wield[i] = TRUE;
3208 else if (creature_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE;
3210 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
3212 creature_ptr->to_a += 5;
3213 creature_ptr->dis_to_a += 5;
3216 /* Normal weapons */
3217 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i])
3219 int str_index, dex_index;
3221 int num = 0, wgt = 0, mul = 0, div = 0;
3223 /* Analyze the class */
3224 switch (creature_ptr->pclass)
3227 num = 6; wgt = 70; mul = 5; break;
3229 case CLASS_BERSERKER:
3230 num = 6; wgt = 70; mul = 7; break;
3233 case CLASS_HIGH_MAGE:
3234 case CLASS_BLUE_MAGE:
3235 num = 3; wgt = 100; mul = 2; break;
3238 case CLASS_MAGIC_EATER:
3239 case CLASS_MINDCRAFTER:
3240 num = 5; wgt = 100; mul = 3; break;
3243 num = 5; wgt = 40; mul = 3; break;
3246 num = 5; wgt = 70; mul = 4; break;
3250 num = 5; wgt = 70; mul = 4; break;
3253 num = 5; wgt = 150; mul = 5; break;
3255 case CLASS_WARRIOR_MAGE:
3256 case CLASS_RED_MAGE:
3257 num = 5; wgt = 70; mul = 3; break;
3259 case CLASS_CHAOS_WARRIOR:
3260 num = 5; wgt = 70; mul = 4; break;
3263 num = 5; wgt = 60; mul = 3; break;
3266 num = 4; wgt = 100; mul = 3; break;
3268 case CLASS_IMITATOR:
3269 num = 5; wgt = 70; mul = 4; break;
3271 case CLASS_BEASTMASTER:
3272 num = 5; wgt = 70; mul = 3; break;
3275 if ((creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
3276 else { num = 5; wgt = 100; mul = 3; }
3279 case CLASS_SORCERER:
3280 num = 1; wgt = 1; mul = 1; break;
3285 num = 4; wgt = 70; mul = 2; break;
3287 case CLASS_FORCETRAINER:
3288 num = 4; wgt = 60; mul = 2; break;
3290 case CLASS_MIRROR_MASTER:
3291 num = 3; wgt = 100; mul = 3; break;
3294 num = 4; wgt = 20; mul = 1; break;
3297 /* Hex - extra mights gives +1 bonus to max blows */
3298 if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
3300 /* Enforce a minimum "weight" (tenth pounds) */
3301 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
3303 /* Access the strength vs weight */
3304 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
3306 if (creature_ptr->ryoute && !omoi) str_index++;
3307 if (creature_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1);
3310 if (str_index > 11) str_index = 11;
3312 /* Index by dexterity */
3313 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
3316 if (dex_index > 11) dex_index = 11;
3318 /* Use the blows table */
3319 creature_ptr->num_blow[i] = blows_table[str_index][dex_index];
3322 if (creature_ptr->num_blow[i] > num) creature_ptr->num_blow[i] = (s16b)num;
3324 /* Add in the "bonus blows" */
3325 creature_ptr->num_blow[i] += (s16b)extra_blows[i];
3328 if (creature_ptr->pclass == CLASS_WARRIOR) creature_ptr->num_blow[i] += (creature_ptr->lev / 40);
3329 else if (creature_ptr->pclass == CLASS_BERSERKER)
3331 creature_ptr->num_blow[i] += (creature_ptr->lev / 23);
3333 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30)) creature_ptr->num_blow[i] ++;
3335 if (creature_ptr->special_defense & KATA_FUUJIN) creature_ptr->num_blow[i] -= 1;
3337 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) creature_ptr->num_blow[i] = 1;
3340 /* Require at least one blow */
3341 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3343 /* Boost digging skill by weapon weight */
3344 creature_ptr->skill_dig += (o_ptr->weight / 10);
3348 /* Priest weapon penalty for non-blessed edged weapons */
3349 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
3350 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
3352 /* Reduce the real bonuses */
3353 creature_ptr->to_h[i] -= 2;
3354 creature_ptr->to_d[i] -= 2;
3356 /* Reduce the mental bonuses */
3357 creature_ptr->dis_to_h[i] -= 2;
3358 creature_ptr->dis_to_d[i] -= 2;
3361 creature_ptr->icky_wield[i] = TRUE;
3363 else if (creature_ptr->pclass == CLASS_BERSERKER)
3365 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3366 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3367 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3368 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3369 if (((i == 0) && !creature_ptr->hidarite) || creature_ptr->ryoute)
3371 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3372 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3373 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3374 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3377 else if (creature_ptr->pclass == CLASS_SORCERER)
3379 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
3381 /* Reduce the real bonuses */
3382 creature_ptr->to_h[i] -= 200;
3383 creature_ptr->to_d[i] -= 200;
3385 /* Reduce the mental bonuses */
3386 creature_ptr->dis_to_h[i] -= 200;
3387 creature_ptr->dis_to_d[i] -= 200;
3390 creature_ptr->icky_wield[i] = TRUE;
3394 /* Reduce the real bonuses */
3395 creature_ptr->to_h[i] -= 30;
3396 creature_ptr->to_d[i] -= 10;
3398 /* Reduce the mental bonuses */
3399 creature_ptr->dis_to_h[i] -= 30;
3400 creature_ptr->dis_to_d[i] -= 10;
3404 if (creature_ptr->realm1 == REALM_HEX)
3406 if (object_is_cursed(o_ptr))
3408 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3409 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
3410 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
3411 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3412 if (hex_spelling(HEX_RUNESWORD))
3414 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
3415 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
3416 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
3420 if (creature_ptr->riding)
3422 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3424 creature_ptr->to_h[i] += 15;
3425 creature_ptr->dis_to_h[i] += 15;
3426 creature_ptr->to_dd[i] += 2;
3428 else if (!(have_flag(flgs, TR_RIDING)))
3431 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3437 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3439 if (penalty < 30) penalty = 30;
3441 creature_ptr->to_h[i] -= (s16b)penalty;
3442 creature_ptr->dis_to_h[i] -= (s16b)penalty;
3445 creature_ptr->riding_wield[i] = TRUE;
3450 if (creature_ptr->riding)
3454 creature_ptr->riding_ryoute = FALSE;
3456 if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
3457 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
3459 switch (creature_ptr->pclass)
3462 case CLASS_FORCETRAINER:
3463 case CLASS_BERSERKER:
3464 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
3465 creature_ptr->riding_ryoute = TRUE;
3470 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3472 if (creature_ptr->tval_ammo != TV_ARROW) penalty = 5;
3476 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3478 if (penalty < 30) penalty = 30;
3480 if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
3481 creature_ptr->to_h_b -= (s16b)penalty;
3482 creature_ptr->dis_to_h_b -= (s16b)penalty;
3485 /* Different calculation for monks with empty hands */
3486 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) &&
3487 (empty_hands_status & EMPTY_HAND_RARM) && !creature_ptr->hidarite)
3489 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
3490 creature_ptr->num_blow[0] = 0;
3492 if (creature_ptr->pclass == CLASS_FORCETRAINER)
3494 if (blow_base > 18) creature_ptr->num_blow[0]++;
3495 if (blow_base > 31) creature_ptr->num_blow[0]++;
3496 if (blow_base > 44) creature_ptr->num_blow[0]++;
3497 if (blow_base > 58) creature_ptr->num_blow[0]++;
3500 creature_ptr->to_d[0] += P_PTR_KI / 5;
3501 creature_ptr->dis_to_d[0] += P_PTR_KI / 5;
3506 if (blow_base > 12) creature_ptr->num_blow[0]++;
3507 if (blow_base > 22) creature_ptr->num_blow[0]++;
3508 if (blow_base > 31) creature_ptr->num_blow[0]++;
3509 if (blow_base > 39) creature_ptr->num_blow[0]++;
3510 if (blow_base > 46) creature_ptr->num_blow[0]++;
3511 if (blow_base > 53) creature_ptr->num_blow[0]++;
3512 if (blow_base > 59) creature_ptr->num_blow[0]++;
3515 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
3516 creature_ptr->num_blow[0] /= 2;
3519 creature_ptr->to_h[0] += (creature_ptr->lev / 3);
3520 creature_ptr->dis_to_h[0] += (creature_ptr->lev / 3);
3522 creature_ptr->to_d[0] += (creature_ptr->lev / 6);
3523 creature_ptr->dis_to_d[0] += (creature_ptr->lev / 6);
3526 if (creature_ptr->special_defense & KAMAE_BYAKKO)
3528 creature_ptr->to_a -= 40;
3529 creature_ptr->dis_to_a -= 40;
3532 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
3534 creature_ptr->to_a -= 50;
3535 creature_ptr->dis_to_a -= 50;
3536 creature_ptr->resist_acid = TRUE;
3537 creature_ptr->resist_fire = TRUE;
3538 creature_ptr->resist_elec = TRUE;
3539 creature_ptr->resist_cold = TRUE;
3540 creature_ptr->resist_pois = TRUE;
3541 creature_ptr->sh_fire = TRUE;
3542 creature_ptr->sh_elec = TRUE;
3543 creature_ptr->sh_cold = TRUE;
3544 creature_ptr->levitation = TRUE;
3546 else if (creature_ptr->special_defense & KAMAE_GENBU)
3548 creature_ptr->to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3549 creature_ptr->dis_to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3550 creature_ptr->reflect = TRUE;
3551 creature_ptr->num_blow[0] -= 2;
3552 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42)) creature_ptr->num_blow[0]--;
3553 if (creature_ptr->num_blow[0] < 0) creature_ptr->num_blow[0] = 0;
3555 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
3557 creature_ptr->to_h[0] -= (creature_ptr->lev / 3);
3558 creature_ptr->to_d[0] -= (creature_ptr->lev / 6);
3560 creature_ptr->dis_to_h[0] -= (creature_ptr->lev / 3);
3561 creature_ptr->dis_to_d[0] -= (creature_ptr->lev / 6);
3562 creature_ptr->num_blow[0] /= 2;
3563 creature_ptr->levitation = TRUE;
3566 creature_ptr->num_blow[0] += 1 + extra_blows[0];
3569 if (creature_ptr->riding) creature_ptr->levitation = riding_levitation;
3571 creature_ptr->monk_armour_aux = FALSE;
3573 if (heavy_armor(creature_ptr))
3575 creature_ptr->monk_armour_aux = TRUE;
3578 for (i = 0; i < 2; i++)
3580 if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3582 OBJECT_TYPE_VALUE tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
3583 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
3585 creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3586 creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3587 if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
3589 if (!s_info[creature_ptr->pclass].w_max[tval][sval])
3591 creature_ptr->to_h[i] -= 40;
3592 creature_ptr->dis_to_h[i] -= 40;
3593 creature_ptr->icky_wield[i] = TRUE;
3596 else if (creature_ptr->pclass == CLASS_NINJA)
3598 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (creature_ptr->inventory_list[INVEN_LARM - i].tval == TV_SHIELD))
3600 creature_ptr->to_h[i] -= 40;
3601 creature_ptr->dis_to_h[i] -= 40;
3602 creature_ptr->icky_wield[i] = TRUE;
3603 creature_ptr->num_blow[i] /= 2;
3604 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3610 /* Maximum speed is (+99). (internally it's 110 + 99) */
3611 /* Temporary lightspeed forces to be maximum speed */
3612 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (new_speed > 209))
3617 /* Minimum speed is (-99). (internally it's 110 - 99) */
3618 if (new_speed < 11) new_speed = 11;
3620 /* Display the speed (if needed) */
3621 if (creature_ptr->pspeed != (byte)new_speed)
3623 creature_ptr->pspeed = (byte)new_speed;
3624 creature_ptr->redraw |= (PR_SPEED);
3629 if (creature_ptr->to_a > (0 - creature_ptr->ac))
3630 creature_ptr->to_a = 0 - creature_ptr->ac;
3631 if (creature_ptr->dis_to_a > (0 - creature_ptr->dis_ac))
3632 creature_ptr->dis_to_a = 0 - creature_ptr->dis_ac;
3635 /* Redraw armor (if needed) */
3636 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a))
3638 creature_ptr->redraw |= (PR_ARMOR);
3639 creature_ptr->window |= (PW_PLAYER);
3642 if (creature_ptr->ryoute && !omoi)
3644 int bonus_to_h = 0, bonus_to_d = 0;
3645 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3646 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);
3648 creature_ptr->to_h[default_hand] += MAX(bonus_to_h, 1);
3649 creature_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1);
3650 creature_ptr->to_d[default_hand] += MAX(bonus_to_d, 1);
3651 creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
3654 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) creature_ptr->ryoute = FALSE;
3656 /* Affect Skill -- stealth (bonus one) */
3657 creature_ptr->skill_stl += 1;
3659 if (is_time_limit_stealth(creature_ptr)) creature_ptr->skill_stl += 99;
3661 /* Affect Skill -- disarming (DEX and INT) */
3662 creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
3663 creature_ptr->skill_dis += adj_int_dis[creature_ptr->stat_ind[A_INT]];
3665 /* Affect Skill -- magic devices (INT) */
3666 creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
3668 /* Affect Skill -- saving throw (WIS) */
3669 creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
3671 /* Affect Skill -- digging (STR) */
3672 creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
3674 /* Affect Skill -- disarming (Level, by Class) */
3675 creature_ptr->skill_dis += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
3677 /* Affect Skill -- magic devices (Level, by Class) */
3678 creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
3680 /* Affect Skill -- saving throw (Level, by Class) */
3681 creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
3683 /* Affect Skill -- stealth (Level, by Class) */
3684 creature_ptr->skill_stl += (cp_ptr->x_stl * creature_ptr->lev / 10);
3686 /* Affect Skill -- search ability (Level, by Class) */
3687 creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
3689 /* Affect Skill -- search frequency (Level, by Class) */
3690 creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
3692 /* Affect Skill -- combat (normal) (Level, by Class) */
3693 creature_ptr->skill_thn += ((cp_ptr->x_thn * creature_ptr->lev / 10) + (ap_ptr->a_thn * creature_ptr->lev / 50));
3695 /* Affect Skill -- combat (shooting) (Level, by Class) */
3696 creature_ptr->skill_thb += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3698 /* Affect Skill -- combat (throwing) (Level, by Class) */
3699 creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3701 if ((PRACE_IS_(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != SEIKAKU_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
3703 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
3704 creature_ptr->skill_stl = MIN(creature_ptr->skill_stl - 3, (creature_ptr->skill_stl + 2) / 2);
3707 /* Limit Skill -- stealth from 0 to 30 */
3708 if (creature_ptr->skill_stl > 30) creature_ptr->skill_stl = 30;
3709 if (creature_ptr->skill_stl < 0) creature_ptr->skill_stl = 0;
3711 /* Limit Skill -- digging from 1 up */
3712 if (creature_ptr->skill_dig < 1) creature_ptr->skill_dig = 1;
3714 if (creature_ptr->anti_magic && (creature_ptr->skill_sav < (90 + creature_ptr->lev))) creature_ptr->skill_sav = 90 + creature_ptr->lev;
3716 if (creature_ptr->tsubureru) creature_ptr->skill_sav = 10;
3718 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (creature_ptr->skill_sav < (95 + creature_ptr->lev))) creature_ptr->skill_sav = 95 + creature_ptr->lev;
3720 if (down_saving) creature_ptr->skill_sav /= 2;
3722 /* Hack -- Each elemental immunity includes resistance */
3723 if (creature_ptr->immune_acid) creature_ptr->resist_acid = TRUE;
3724 if (creature_ptr->immune_elec) creature_ptr->resist_elec = TRUE;
3725 if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
3726 if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
3728 /* Hack -- handle "xtra" mode */
3729 if (current_world_ptr->character_xtra) return;
3731 /* Take note when "heavy bow" changes */
3732 if (creature_ptr->old_heavy_shoot != creature_ptr->heavy_shoot)
3734 if (creature_ptr->heavy_shoot)
3736 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
3738 else if (creature_ptr->inventory_list[INVEN_BOW].k_idx)
3740 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
3744 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
3748 creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
3751 for (i = 0; i < 2; i++)
3753 /* Take note when "heavy weapon" changes */
3754 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
3756 if (creature_ptr->heavy_wield[i])
3758 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
3760 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3762 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
3764 else if (creature_ptr->heavy_wield[1 - i])
3766 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
3770 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
3774 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
3777 /* Take note when "heavy weapon" changes */
3778 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i])
3780 if (creature_ptr->riding_wield[i])
3782 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
3784 else if (!creature_ptr->riding)
3786 msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding."));
3788 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3790 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
3793 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
3796 /* Take note when "illegal weapon" changes */
3797 if (creature_ptr->old_icky_wield[i] != creature_ptr->icky_wield[i])
3799 if (creature_ptr->icky_wield[i])
3801 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
3802 if (current_world_ptr->is_loading_now)
3804 chg_virtue(creature_ptr, V_FAITH, -1);
3807 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3809 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
3813 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
3817 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
3821 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
3823 if (creature_ptr->riding_ryoute)
3826 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
3828 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
3834 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
3836 msg_print("You began to control riding pet with one hand.");
3840 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
3843 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))
3845 if (heavy_armor(creature_ptr))
3847 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
3848 if (current_world_ptr->is_loading_now)
3850 chg_virtue(creature_ptr, V_HARMONY, -1);
3855 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
3858 creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
3861 for (i = 0; i < INVEN_PACK; i++)
3863 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
3864 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
3867 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)
3869 o_ptr = &floor_ptr->o_list[this_o_idx];
3870 next_o_idx = o_ptr->next_o_idx;
3872 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
3873 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
3876 if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
3878 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
3880 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
3881 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3884 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER)))
3886 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE];
3887 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3892 static void calc_alignment(player_type *creature_ptr)
3895 creature_ptr->align = 0;
3896 int i, j, neutral[2];
3898 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3899 for (m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
3901 monster_type *m_ptr;
3902 monster_race *r_ptr;
3903 m_ptr = &floor_ptr->m_list[m_idx];
3904 if (!monster_is_valid(m_ptr)) continue;
3905 r_ptr = &r_info[m_ptr->r_idx];
3909 if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3910 if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
3914 if (creature_ptr->mimic_form)
3916 switch (creature_ptr->mimic_form)
3919 creature_ptr->align -= 200;
3921 case MIMIC_DEMON_LORD:
3922 creature_ptr->align -= 200;
3928 switch (creature_ptr->prace)
3931 creature_ptr->align += 200;
3934 creature_ptr->align -= 200;
3939 for (i = 0; i < 2; i++)
3941 if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3943 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) creature_ptr->align -= 1000;
3947 /* Determine player alignment */
3948 for (i = 0, j = 0; i < 8; i++)
3950 switch (creature_ptr->vir_types[i])
3953 creature_ptr->align += creature_ptr->virtues[i] * 2;
3963 creature_ptr->align -= creature_ptr->virtues[i];
3966 creature_ptr->align += creature_ptr->virtues[i];
3971 for (i = 0; i < j; i++)
3973 if (creature_ptr->align > 0)
3975 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
3976 if (creature_ptr->align < 0) creature_ptr->align = 0;
3978 else if (creature_ptr->align < 0)
3980 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
3981 if (creature_ptr->align > 0) creature_ptr->align = 0;
3988 * @brief プレイヤーの最大HPを計算する /
3989 * Calculate the players (maximal) hit points
3990 * Adjust current hitpoints if necessary
3994 static void calc_hitpoints(player_type *creature_ptr)
3999 /* Un-inflate "half-hitpoint bonus per level" value */
4000 bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
4002 /* Calculate hitpoints */
4003 mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
4005 if (creature_ptr->mimic_form)
4007 if (creature_ptr->pclass == CLASS_SORCERER)
4008 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
4010 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4011 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
4014 if (creature_ptr->pclass == CLASS_SORCERER)
4016 if (creature_ptr->lev < 30)
4017 mhp = (mhp * (45 + creature_ptr->lev) / 100);
4019 mhp = (mhp * 75 / 100);
4020 bonus = (bonus * 65 / 100);
4025 if (creature_ptr->pclass == CLASS_BERSERKER)
4027 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
4030 /* Always have at least one hitpoint per level */
4031 if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
4033 /* Factor in the hero / superhero settings */
4034 if (IS_HERO(creature_ptr)) mhp += 10;
4035 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
4036 if (creature_ptr->tsuyoshi) mhp += 50;
4038 /* Factor in the hex spell settings */
4039 if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
4040 if (hex_spelling(HEX_BUILDING)) mhp += 60;
4042 /* New maximum hitpoints */
4043 if (creature_ptr->mhp != mhp)
4045 /* Enforce maximum */
4046 if (creature_ptr->chp >= mhp)
4048 creature_ptr->chp = mhp;
4049 creature_ptr->chp_frac = 0;
4053 /* レベルアップの時は上昇量を表示する */
4054 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
4056 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
4059 /* Save the new max-hitpoints */
4060 creature_ptr->mhp = mhp;
4062 /* Display hitpoints (later) */
4063 creature_ptr->redraw |= (PR_HP);
4064 creature_ptr->window |= (PW_PLAYER);
4070 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
4073 * SWD: Experimental modification: multiple light sources have additive effect.
4075 static void calc_torch(player_type *creature_ptr)
4080 BIT_FLAGS flgs[TR_FLAG_SIZE];
4082 /* Assume no light */
4083 creature_ptr->cur_lite = 0;
4085 /* Loop through all wielded items */
4086 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4088 o_ptr = &creature_ptr->inventory_list[i];
4089 /* Skip empty slots */
4090 if (!o_ptr->k_idx) continue;
4092 if (o_ptr->name2 == EGO_LITE_SHINE) creature_ptr->cur_lite++;
4095 if (o_ptr->name2 != EGO_LITE_DARKNESS)
4097 if (o_ptr->tval == TV_LITE)
4099 if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
4100 if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
4103 object_flags(o_ptr, flgs);
4105 /* calc the lite_radius */
4108 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
4109 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
4110 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
4111 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
4112 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
4113 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
4114 creature_ptr->cur_lite += rad;
4117 /* max radius is 14 (was 5) without rewriting other code -- */
4118 if (d_info[creature_ptr->dungeon_idx].flags1 & DF1_DARKNESS && creature_ptr->cur_lite > 1)
4119 creature_ptr->cur_lite = 1;
4122 * check if the player doesn't have light radius,
4123 * but does weakly glow as an intrinsic.
4125 if (creature_ptr->cur_lite <= 0 && creature_ptr->lite) creature_ptr->cur_lite++;
4127 if (creature_ptr->cur_lite > 14) creature_ptr->cur_lite = 14;
4128 if (creature_ptr->cur_lite < 0) creature_ptr->cur_lite = 0;
4130 /* end experimental mods */
4132 /* Notice changes in the "lite radius" */
4133 if (creature_ptr->old_lite != creature_ptr->cur_lite)
4135 /* Hack -- PU_MON_LITE for monsters' darkness */
4136 creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
4138 /* Remember the old lite */
4139 creature_ptr->old_lite = creature_ptr->cur_lite;
4141 if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
4142 set_superstealth(creature_ptr, FALSE);
4148 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
4149 * Calculate number of spells player should have, and forget,
4150 * or remember, spells until that number is properly reflected.
4153 * Note that this function induces various "status" messages,
4154 * which must be bypasses until the character is created.
4156 static void calc_spells(player_type *creature_ptr)
4158 int i, j, k, levels;
4160 int num_boukyaku = 0;
4162 const magic_type *s_ptr;
4168 /* Hack -- must be literate */
4169 if (!mp_ptr->spell_book) return;
4171 /* Hack -- wait for creation */
4172 if (!current_world_ptr->character_generated) return;
4174 /* Hack -- handle "xtra" mode */
4175 if (current_world_ptr->character_xtra) return;
4177 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
4179 creature_ptr->new_spells = 0;
4183 p = spell_category_name(mp_ptr->spell_book);
4185 /* Determine the number of spells allowed */
4186 levels = creature_ptr->lev - mp_ptr->spell_first + 1;
4188 /* Hack -- no negative spells */
4189 if (levels < 0) levels = 0;
4191 /* Extract total allowed spells */
4192 num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
4194 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
4198 if (creature_ptr->pclass == CLASS_SAMURAI)
4202 else if (creature_ptr->realm2 == REALM_NONE)
4204 num_allowed = (num_allowed + 1) / 2;
4205 if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus;
4207 else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST))
4209 if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus;
4213 if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus;
4216 /* Count the number of spells we know */
4217 for (j = 0; j < 64; j++)
4219 /* Count known spells */
4221 (creature_ptr->spell_forgotten1 & (1L << j)) :
4222 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
4228 /* See how many spells we must forget or may learn */
4229 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
4231 /* Forget spells which are too hard */
4232 for (i = 63; i >= 0; i--)
4234 /* Efficiency -- all done */
4235 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
4237 /* Access the spell */
4238 j = creature_ptr->spell_order[i];
4240 /* Skip non-spells */
4241 if (j >= 99) continue;
4245 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
4248 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4250 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
4253 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4255 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
4257 /* Skip spells we are allowed to know */
4258 if (s_ptr->slevel <= creature_ptr->lev) continue;
4262 (creature_ptr->spell_learned1 & (1L << j)) :
4263 (creature_ptr->spell_learned2 & (1L << (j - 32))))
4265 /* Mark as forgotten */
4268 creature_ptr->spell_forgotten1 |= (1L << j);
4269 which = creature_ptr->realm1;
4273 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
4274 which = creature_ptr->realm2;
4277 /* No longer known */
4280 creature_ptr->spell_learned1 &= ~(1L << j);
4281 which = creature_ptr->realm1;
4285 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
4286 which = creature_ptr->realm2;
4290 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4292 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4296 /* One more can be learned */
4297 creature_ptr->new_spells++;
4301 /* Forget spells if we know too many spells */
4302 for (i = 63; i >= 0; i--)
4304 /* Stop when possible */
4305 if (creature_ptr->new_spells >= 0) break;
4307 /* Efficiency -- all done */
4308 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
4310 /* Get the (i+1)th spell learned */
4311 j = creature_ptr->spell_order[i];
4313 /* Skip unknown spells */
4314 if (j >= 99) continue;
4316 /* Forget it (if learned) */
4318 (creature_ptr->spell_learned1 & (1L << j)) :
4319 (creature_ptr->spell_learned2 & (1L << (j - 32))))
4321 /* Mark as forgotten */
4324 creature_ptr->spell_forgotten1 |= (1L << j);
4325 which = creature_ptr->realm1;
4329 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
4330 which = creature_ptr->realm2;
4333 /* No longer known */
4336 creature_ptr->spell_learned1 &= ~(1L << j);
4337 which = creature_ptr->realm1;
4341 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
4342 which = creature_ptr->realm2;
4346 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4348 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4351 /* One more can be learned */
4352 creature_ptr->new_spells++;
4356 /* Check for spells to remember */
4357 for (i = 0; i < 64; i++)
4359 /* None left to remember */
4360 if (creature_ptr->new_spells <= 0) break;
4362 /* Efficiency -- all done */
4363 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
4365 /* Get the next spell we learned */
4366 j = creature_ptr->spell_order[i];
4368 /* Skip unknown spells */
4371 /* Access the spell */
4372 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
4375 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4377 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
4380 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4382 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
4384 /* Skip spells we cannot remember */
4385 if (s_ptr->slevel > creature_ptr->lev) continue;
4387 /* First set of spells */
4389 (creature_ptr->spell_forgotten1 & (1L << j)) :
4390 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
4392 /* No longer forgotten */
4395 creature_ptr->spell_forgotten1 &= ~(1L << j);
4396 which = creature_ptr->realm1;
4400 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
4401 which = creature_ptr->realm2;
4404 /* Known once more */
4407 creature_ptr->spell_learned1 |= (1L << j);
4408 which = creature_ptr->realm1;
4412 creature_ptr->spell_learned2 |= (1L << (j - 32));
4413 which = creature_ptr->realm2;
4417 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4419 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4422 /* One less can be learned */
4423 creature_ptr->new_spells--;
4429 if (creature_ptr->realm2 == REALM_NONE)
4431 /* Count spells that can be learned */
4432 for (j = 0; j < 32; j++)
4434 if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4435 else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4437 /* Skip spells we cannot remember */
4438 if (s_ptr->slevel > creature_ptr->lev) continue;
4440 /* Skip spells we already know */
4441 if (creature_ptr->spell_learned1 & (1L << j))
4450 if ((creature_ptr->new_spells > k) &&
4451 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
4453 creature_ptr->new_spells = (s16b)k;
4457 if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
4459 /* Spell count changed */
4460 if (creature_ptr->old_spells != creature_ptr->new_spells)
4462 /* Message if needed */
4463 if (creature_ptr->new_spells)
4466 if (creature_ptr->new_spells < 10) {
4467 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
4470 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
4473 msg_format("You can learn %d more %s%s.",
4474 creature_ptr->new_spells, p,
4475 (creature_ptr->new_spells != 1) ? "s" : "");
4480 /* Save the new_spells value */
4481 creature_ptr->old_spells = creature_ptr->new_spells;
4483 /* Redraw Study Status */
4484 creature_ptr->redraw |= (PR_STUDY);
4486 /* Redraw object recall */
4487 creature_ptr->window |= (PW_OBJECT);
4493 * @brief プレイヤーの最大MPを計算する /
4494 * Calculate maximum mana. You do not need to know any spells.
4495 * Note that mana is lowered by heavy (or inappropriate) armor.
4498 * This function induces status messages.
4500 static void calc_mana(player_type *creature_ptr)
4502 int msp, levels, cur_wgt, max_wgt;
4507 /* Hack -- Must be literate */
4508 if (!mp_ptr->spell_book) return;
4510 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
4511 (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
4512 (creature_ptr->pclass == CLASS_BLUE_MAGE))
4514 levels = creature_ptr->lev;
4518 if (mp_ptr->spell_first > creature_ptr->lev)
4521 creature_ptr->msp = 0;
4523 /* Display mana later */
4524 creature_ptr->redraw |= (PR_MANA);
4528 /* Extract "effective" player level */
4529 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
4532 if (creature_ptr->pclass == CLASS_SAMURAI)
4534 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
4535 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4539 /* Extract total mana */
4540 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
4542 /* Hack -- usually add one mana */
4545 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4547 if (msp && (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2;
4549 /* Hack: High mages have a 25% mana bonus */
4550 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
4552 if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
4555 /* Only mages are affected */
4556 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
4558 BIT_FLAGS flgs[TR_FLAG_SIZE];
4560 /* Assume player is not encumbered by gloves */
4561 creature_ptr->cumber_glove = FALSE;
4563 /* Get the gloves */
4564 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
4566 /* Examine the gloves */
4567 object_flags(o_ptr, flgs);
4569 /* Normal gloves hurt mage-type spells */
4571 !(have_flag(flgs, TR_FREE_ACT)) &&
4572 !(have_flag(flgs, TR_DEC_MANA)) &&
4573 !(have_flag(flgs, TR_EASY_SPELL)) &&
4574 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
4575 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
4578 creature_ptr->cumber_glove = TRUE;
4581 msp = (3 * msp) / 4;
4585 /* Assume player not encumbered by armor */
4586 creature_ptr->cumber_armor = FALSE;
4588 /* Weigh the armor */
4590 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4591 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4592 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4593 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4594 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4595 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4596 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4598 /* Subtract a percentage of maximum mana. */
4599 switch (creature_ptr->pclass)
4601 /* For these classes, mana is halved if armour
4602 * is 30 pounds over their weight limit. */
4604 case CLASS_HIGH_MAGE:
4605 case CLASS_BLUE_MAGE:
4607 case CLASS_FORCETRAINER:
4608 case CLASS_SORCERER:
4610 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4611 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4615 /* Mana halved if armour is 40 pounds over weight limit. */
4620 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4621 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
4625 case CLASS_MINDCRAFTER:
4626 case CLASS_BEASTMASTER:
4627 case CLASS_MIRROR_MASTER:
4629 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
4630 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
4634 /* Mana halved if armour is 50 pounds over weight limit. */
4637 case CLASS_RED_MAGE:
4638 case CLASS_WARRIOR_MAGE:
4640 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
4641 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
4645 /* Mana halved if armour is 60 pounds over weight limit. */
4647 case CLASS_CHAOS_WARRIOR:
4649 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
4650 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
4654 /* For new classes created, but not yet added to this formula. */
4661 /* Determine the weight allowance */
4662 max_wgt = mp_ptr->spell_weight;
4664 /* Heavy armor penalizes mana by a percentage. -LM- */
4665 if ((cur_wgt - max_wgt) > 0)
4668 creature_ptr->cumber_armor = TRUE;
4670 /* Subtract a percentage of maximum mana. */
4671 switch (creature_ptr->pclass)
4673 /* For these classes, mana is halved if armour
4674 * is 30 pounds over their weight limit. */
4676 case CLASS_HIGH_MAGE:
4677 case CLASS_BLUE_MAGE:
4679 msp -= msp * (cur_wgt - max_wgt) / 600;
4683 /* Mana halved if armour is 40 pounds over weight limit. */
4685 case CLASS_MINDCRAFTER:
4686 case CLASS_BEASTMASTER:
4688 case CLASS_FORCETRAINER:
4690 case CLASS_MIRROR_MASTER:
4692 msp -= msp * (cur_wgt - max_wgt) / 800;
4696 case CLASS_SORCERER:
4698 msp -= msp * (cur_wgt - max_wgt) / 900;
4702 /* Mana halved if armour is 50 pounds over weight limit. */
4706 case CLASS_RED_MAGE:
4708 msp -= msp * (cur_wgt - max_wgt) / 1000;
4712 /* Mana halved if armour is 60 pounds over weight limit. */
4714 case CLASS_CHAOS_WARRIOR:
4715 case CLASS_WARRIOR_MAGE:
4717 msp -= msp * (cur_wgt - max_wgt) / 1200;
4723 creature_ptr->cumber_armor = FALSE;
4727 /* For new classes created, but not yet added to this formula. */
4730 msp -= msp * (cur_wgt - max_wgt) / 800;
4736 /* Mana can never be negative */
4737 if (msp < 0) msp = 0;
4740 /* Maximum mana has changed */
4741 if (creature_ptr->msp != msp)
4743 /* Enforce maximum */
4744 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
4746 creature_ptr->csp = msp;
4747 creature_ptr->csp_frac = 0;
4751 /* レベルアップの時は上昇量を表示する */
4752 if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
4754 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
4758 creature_ptr->msp = msp;
4760 /* Display mana later */
4761 creature_ptr->redraw |= (PR_MANA);
4762 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4766 /* Hack -- handle "xtra" mode */
4767 if (current_world_ptr->character_xtra) return;
4769 /* Take note when "glove state" changes */
4770 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
4772 if (creature_ptr->cumber_glove)
4774 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
4778 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
4782 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
4786 /* Take note when "armor state" changes */
4787 if (creature_ptr->old_cumber_armor != creature_ptr->cumber_armor)
4789 if (creature_ptr->cumber_armor)
4791 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
4795 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
4799 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
4805 * @brief 装備中の射撃武器の威力倍率を返す /
4806 * calcurate the fire rate of target object
4807 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
4808 * @return 射撃倍率の値(100で1.00倍)
4810 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
4812 int extra_shots = 0;
4815 OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
4817 BIT_FLAGS flgs[TR_FLAG_SIZE];
4819 /* Scan the usable creature_ptr->inventory_list */
4820 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4822 q_ptr = &creature_ptr->inventory_list[i];
4823 if (!q_ptr->k_idx) continue;
4825 /* Do not apply current equip */
4826 if (i == INVEN_BOW) continue;
4828 object_flags(q_ptr, flgs);
4831 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4834 object_flags(o_ptr, flgs);
4835 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4837 if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, o_ptr))
4841 num += (extra_shots * 100);
4843 /* Hack -- Rangers love Bows */
4844 if ((creature_ptr->pclass == CLASS_RANGER) &&
4845 (tval_ammo == TV_ARROW))
4847 num += (creature_ptr->lev * 4);
4850 if ((creature_ptr->pclass == CLASS_CAVALRY) &&
4851 (tval_ammo == TV_ARROW))
4853 num += (creature_ptr->lev * 3);
4856 if (creature_ptr->pclass == CLASS_ARCHER)
4858 if (tval_ammo == TV_ARROW)
4859 num += ((creature_ptr->lev * 5) + 50);
4860 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
4861 num += (creature_ptr->lev * 4);
4865 * Addendum -- also "Reward" high level warriors,
4866 * with _any_ missile weapon -- TY
4868 if (creature_ptr->pclass == CLASS_WARRIOR &&
4869 (tval_ammo <= TV_BOLT) &&
4870 (tval_ammo >= TV_SHOT))
4872 num += (creature_ptr->lev * 2);
4874 if ((creature_ptr->pclass == CLASS_ROGUE) &&
4875 (tval_ammo == TV_SHOT))
4877 num += (creature_ptr->lev * 4);
4885 * @brief プレイヤーの所持重量制限を計算する /
4886 * Computes current weight limit.
4889 WEIGHT weight_limit(player_type *creature_ptr)
4893 /* Weight limit based only on strength */
4894 i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
4895 if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
4897 /* Return the result */
4903 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
4904 * @param i 判定する手のID(右手:0 左手:1)
4905 * @return 持っているならばTRUE
4907 bool has_melee_weapon(player_type *creature_ptr, int i)
4909 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
4914 * @brief プレイヤーの現在開いている手の状態を返す
4915 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
4916 * @return 開いている手のビットフラグ
4918 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
4920 BIT_FLAGS16 status = EMPTY_HAND_NONE;
4922 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
4923 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
4925 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
4927 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
4928 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
4936 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
4937 * @return ペナルティが適用されるならばTRUE。
4939 bool heavy_armor(player_type *creature_ptr)
4941 WEIGHT monk_arm_wgt = 0;
4943 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA)) return FALSE;
4945 /* Weight the armor */
4946 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4947 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4948 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4949 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4950 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4951 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4952 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4954 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
4959 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
4961 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
4963 void update_creature(player_type *creature_ptr)
4965 if (!creature_ptr->update) return;
4967 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4968 if (creature_ptr->update & (PU_AUTODESTROY))
4970 creature_ptr->update &= ~(PU_AUTODESTROY);
4971 autopick_delayed_alter(creature_ptr);
4974 if (creature_ptr->update & (PU_COMBINE))
4976 creature_ptr->update &= ~(PU_COMBINE);
4977 combine_pack(creature_ptr);
4980 /* Reorder the pack */
4981 if (creature_ptr->update & (PU_REORDER))
4983 creature_ptr->update &= ~(PU_REORDER);
4984 reorder_pack(creature_ptr);
4987 if (creature_ptr->update & (PU_BONUS))
4989 creature_ptr->update &= ~(PU_BONUS);
4990 calc_alignment(creature_ptr);
4991 calc_bonuses(creature_ptr);
4994 if (creature_ptr->update & (PU_TORCH))
4996 creature_ptr->update &= ~(PU_TORCH);
4997 calc_torch(creature_ptr);
5000 if (creature_ptr->update & (PU_HP))
5002 creature_ptr->update &= ~(PU_HP);
5003 calc_hitpoints(creature_ptr);
5006 if (creature_ptr->update & (PU_MANA))
5008 creature_ptr->update &= ~(PU_MANA);
5009 calc_mana(creature_ptr);
5012 if (creature_ptr->update & (PU_SPELLS))
5014 creature_ptr->update &= ~(PU_SPELLS);
5015 calc_spells(creature_ptr);
5018 /* Character is not ready yet, no screen updates */
5019 if (!current_world_ptr->character_generated) return;
5021 /* Character is in "icky" mode, no screen updates */
5022 if (current_world_ptr->character_icky) return;
5024 if (creature_ptr->update & (PU_UN_LITE))
5026 creature_ptr->update &= ~(PU_UN_LITE);
5027 forget_lite(floor_ptr);
5030 if (creature_ptr->update & (PU_UN_VIEW))
5032 creature_ptr->update &= ~(PU_UN_VIEW);
5033 forget_view(floor_ptr);
5036 if (creature_ptr->update & (PU_VIEW))
5038 creature_ptr->update &= ~(PU_VIEW);
5039 update_view(creature_ptr, floor_ptr);
5042 if (creature_ptr->update & (PU_LITE))
5044 creature_ptr->update &= ~(PU_LITE);
5045 update_lite(creature_ptr);
5048 if (creature_ptr->update & (PU_FLOW))
5050 creature_ptr->update &= ~(PU_FLOW);
5051 update_flow(creature_ptr);
5054 if (creature_ptr->update & (PU_DISTANCE))
5056 creature_ptr->update &= ~(PU_DISTANCE);
5058 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
5059 /* creature_ptr->update &= ~(PU_MONSTERS); */
5061 update_monsters(TRUE);
5064 if (creature_ptr->update & (PU_MON_LITE))
5066 creature_ptr->update &= ~(PU_MON_LITE);
5067 update_mon_lite(creature_ptr);
5071 * Mega-Hack -- Delayed visual update
5072 * Only used if update_view(), update_lite() or update_mon_lite() was called
5074 if (creature_ptr->update & (PU_DELAY_VIS))
5076 creature_ptr->update &= ~(PU_DELAY_VIS);
5077 delayed_visual_update(creature_ptr);
5080 if (creature_ptr->update & (PU_MONSTERS))
5082 creature_ptr->update &= ~(PU_MONSTERS);
5083 update_monsters(FALSE);
5089 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
5090 * @return 魔道書を一冊も持っていないならTRUEを返す
5092 bool player_has_no_spellbooks(player_type *creature_ptr)
5097 for (i = 0; i < INVEN_PACK; i++)
5099 o_ptr = &creature_ptr->inventory_list[i];
5100 if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
5103 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5104 for (i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
5106 o_ptr = &floor_ptr->o_list[i];
5107 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
5114 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
5116 creature_ptr->energy_use = (ENERGY)need_cost;
5120 void free_turn(player_type *creature_ptr)
5122 creature_ptr->energy_use = 0;
5127 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
5130 * @return 配置に成功したらTRUE
5132 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
5134 /* Paranoia XXX XXX */
5135 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
5137 /* Save player location */
5138 creature_ptr->y = y;
5139 creature_ptr->x = x;
5147 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
5150 void wreck_the_pattern(player_type *creature_ptr)
5154 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5155 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
5157 if (pattern_type == PATTERN_TILE_WRECKED)
5159 /* Ruined already */
5163 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
5164 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
5166 if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
5167 to_ruin = randint1(45) + 35;
5171 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
5173 if (pattern_tile(r_y, r_x) &&
5174 (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
5176 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
5180 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
5185 * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
5186 * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ
5187 * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
5190 void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
5194 if (creature_ptr->phase_out || !current_world_ptr->character_dungeon) return;
5196 if (!necro && m_ptr)
5198 GAME_TEXT m_name[MAX_NLEN];
5199 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
5201 power = r_ptr->level / 2;
5203 monster_desc(m_name, m_ptr, 0);
5205 if (!(r_ptr->flags1 & RF1_UNIQUE))
5207 if (r_ptr->flags1 & RF1_FRIENDS)
5212 if (!current_world_ptr->is_loading_now)
5213 return; /* No effect yet, just loaded... */
5216 return; /* Cannot see it for some reason */
5218 if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
5222 return; /* Pet eldritch horrors are safe most of the time */
5224 if (randint1(100) > power) return;
5226 if (saving_throw(creature_ptr->skill_sav - power))
5228 return; /* Save, no adverse effects */
5231 if (creature_ptr->image)
5233 /* Something silly happens... */
5234 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5235 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
5239 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
5240 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
5243 return; /* Never mind; we can't see it clearly enough */
5246 /* Something frightening happens... */
5247 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5248 horror_desc[randint0(MAX_SAN_HORROR)], m_name);
5250 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
5252 /* Demon characters are unaffected */
5253 if (PRACE_IS_(creature_ptr, RACE_IMP) || PRACE_IS_(creature_ptr, RACE_DEMON) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return;
5254 if (current_world_ptr->wizard) return;
5256 /* Undead characters are 50% likely to be unaffected */
5257 if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE)
5258 || PRACE_IS_(creature_ptr, RACE_VAMPIRE) || PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
5259 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD))
5261 if (saving_throw(25 + creature_ptr->lev)) return;
5266 monster_race *r_ptr;
5267 GAME_TEXT m_name[MAX_NLEN];
5270 get_mon_num_prep(get_nightmare, NULL);
5272 r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
5273 power = r_ptr->level + 10;
5274 desc = r_name + r_ptr->name;
5276 get_mon_num_prep(NULL, NULL);
5281 if (!(r_ptr->flags1 & RF1_UNIQUE))
5282 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
5285 sprintf(m_name, "%s", desc);
5287 if (!(r_ptr->flags1 & RF1_UNIQUE))
5289 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
5293 if (saving_throw(creature_ptr->skill_sav * 100 / power))
5295 msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
5300 if (creature_ptr->image)
5302 /* Something silly happens... */
5303 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5304 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
5308 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
5309 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
5312 /* Never mind; we can't see it clearly enough */
5316 /* Something frightening happens... */
5317 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5318 horror_desc[randint0(MAX_SAN_HORROR)], desc);
5320 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
5322 if (!creature_ptr->mimic_form)
5324 switch (creature_ptr->prace)
5326 /* Demons may make a saving throw */
5329 if (saving_throw(20 + creature_ptr->lev)) return;
5331 /* Undead may make a saving throw */
5336 if (saving_throw(10 + creature_ptr->lev)) return;
5342 /* Demons may make a saving throw */
5343 if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
5345 if (saving_throw(20 + creature_ptr->lev)) return;
5347 /* Undead may make a saving throw */
5348 else if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
5350 if (saving_throw(10 + creature_ptr->lev)) return;
5356 msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
5359 /* 過去の効果無効率再現のため5回saving_throw 実行 */
5360 if (saving_throw(creature_ptr->skill_sav - power)
5361 && saving_throw(creature_ptr->skill_sav - power)
5362 && saving_throw(creature_ptr->skill_sav - power)
5363 && saving_throw(creature_ptr->skill_sav - power)
5364 && saving_throw(creature_ptr->skill_sav - power)
5370 switch (randint1(22))
5373 if (!(creature_ptr->muta3 & MUT3_MORONIC))
5375 if ((creature_ptr->stat_use[A_INT] < 4) && (creature_ptr->stat_use[A_WIS] < 4))
5377 msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
5381 msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
5384 if (creature_ptr->muta3 & MUT3_HYPER_INT)
5386 msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
5387 creature_ptr->muta3 &= ~(MUT3_HYPER_INT);
5389 creature_ptr->muta3 |= MUT3_MORONIC;
5393 if (!(creature_ptr->muta2 & MUT2_COWARDICE) && !creature_ptr->resist_fear)
5395 msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
5397 /* Duh, the following should never happen, but anyway... */
5398 if (creature_ptr->muta3 & MUT3_FEARLESS)
5400 msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
5401 creature_ptr->muta3 &= ~(MUT3_FEARLESS);
5404 creature_ptr->muta2 |= MUT2_COWARDICE;
5408 if (!(creature_ptr->muta2 & MUT2_HALLU) && !creature_ptr->resist_chaos)
5410 msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
5411 creature_ptr->muta2 |= MUT2_HALLU;
5415 if (!(creature_ptr->muta2 & MUT2_BERS_RAGE) && !creature_ptr->resist_conf)
5417 msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
5418 creature_ptr->muta2 |= MUT2_BERS_RAGE;
5430 if (!creature_ptr->resist_conf)
5432 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
5434 if (!creature_ptr->resist_chaos && one_in_(3))
5436 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
5444 if (!creature_ptr->resist_conf)
5446 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
5448 if (!creature_ptr->free_act)
5450 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4);
5452 if (!creature_ptr->resist_chaos)
5454 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
5457 (void)do_dec_stat(creature_ptr, A_INT);
5458 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
5461 (void)do_dec_stat(creature_ptr, A_WIS);
5462 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
5467 if (lose_all_info(creature_ptr))
5468 msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
5475 /* Lose int & wis */
5476 do_dec_stat(creature_ptr, A_INT);
5477 do_dec_stat(creature_ptr, A_WIS);
5483 creature_ptr->update |= PU_BONUS;
5484 handle_stuff(creature_ptr);
5489 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
5490 * Advance experience levels and print experience
5493 void check_experience(player_type *creature_ptr)
5495 bool level_reward = FALSE;
5496 bool level_mutation = FALSE;
5497 bool level_inc_stat = FALSE;
5498 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5499 PLAYER_LEVEL old_lev = creature_ptr->lev;
5501 /* Hack -- lower limit */
5502 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
5503 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
5504 if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
5506 /* Hack -- upper limit */
5507 if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
5508 if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
5509 if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
5511 /* Hack -- maintain "max" experience */
5512 if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
5514 /* Hack -- maintain "max max" experience */
5515 if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
5517 /* Redraw experience */
5518 creature_ptr->redraw |= (PR_EXP);
5519 handle_stuff(creature_ptr);
5522 /* Lose levels while possible */
5523 while ((creature_ptr->lev > 1) &&
5524 (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
5527 creature_ptr->lev--;
5528 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5529 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5530 creature_ptr->window |= (PW_PLAYER);
5531 handle_stuff(creature_ptr);
5535 /* Gain levels while possible */
5536 while ((creature_ptr->lev < PY_MAX_LEVEL) &&
5537 (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
5540 creature_ptr->lev++;
5542 /* Save the highest level */
5543 if (creature_ptr->lev > creature_ptr->max_plv)
5545 creature_ptr->max_plv = creature_ptr->lev;
5547 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
5548 (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
5550 level_reward = TRUE;
5552 if (creature_ptr->prace == RACE_BEASTMAN)
5554 if (one_in_(5)) level_mutation = TRUE;
5556 level_inc_stat = TRUE;
5558 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
5563 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
5565 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5566 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
5567 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
5570 creature_ptr->level_up_message = TRUE;
5571 handle_stuff(creature_ptr);
5573 creature_ptr->level_up_message = FALSE;
5577 if (!(creature_ptr->max_plv % 10))
5586 cnv_stat(creature_ptr->stat_max[0], tmp);
5587 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
5588 cnv_stat(creature_ptr->stat_max[1], tmp);
5589 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
5590 cnv_stat(creature_ptr->stat_max[2], tmp);
5591 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
5592 cnv_stat(creature_ptr->stat_max[3], tmp);
5593 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
5594 cnv_stat(creature_ptr->stat_max[4], tmp);
5595 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
5596 cnv_stat(creature_ptr->stat_max[5], tmp);
5597 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
5600 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
5605 if ((choice >= 'a') && (choice <= 'f')) break;
5607 for (n = 0; n < A_MAX; n++)
5608 if (n != choice - 'a')
5610 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
5612 do_inc_stat(creature_ptr, choice - 'a');
5615 else if (!(creature_ptr->max_plv % 2))
5616 do_inc_stat(creature_ptr, randint0(6));
5621 msg_print(_("あなたは変わった気がする...", "You feel different..."));
5622 (void)gain_mutation(creature_ptr, 0);
5623 level_mutation = FALSE;
5627 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
5632 gain_level_reward(creature_ptr, 0);
5633 level_reward = FALSE;
5636 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5637 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5638 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
5639 handle_stuff(creature_ptr);
5642 /* Load an autopick preference file */
5643 if (old_lev != creature_ptr->lev) autopick_load_pref(creature_ptr, FALSE);
5648 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
5650 * @param out_val 出力先文字列ポインタ
5653 void cnv_stat(int val, char *out_val)
5658 int bonus = (val - 18);
5662 sprintf(out_val, "18/%3s", "***");
5664 else if (bonus >= 100)
5666 sprintf(out_val, "18/%03d", bonus);
5670 sprintf(out_val, " 18/%02d", bonus);
5677 sprintf(out_val, " %2d", val);
5683 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
5684 * Modify a stat value by a "modifier", return new value
5686 * @param amount 加減算値
5690 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
5691 * Or even: 18/13, 18/23, 18/33, ..., 18/220
5692 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
5693 * Or even: 18/13, 18/03, 18, 17, ..., 3
5696 s16b modify_stat_value(int value, int amount)
5703 /* Apply each point */
5704 for (i = 0; i < amount; i++)
5706 /* One point at a time */
5707 if (value < 18) value++;
5709 /* Ten "points" at a time */
5715 else if (amount < 0)
5717 /* Apply each point */
5718 for (i = 0; i < (0 - amount); i++)
5720 /* Ten points at a time */
5721 if (value >= 18 + 10) value -= 10;
5723 /* Hack -- prevent weirdness */
5724 else if (value > 18) value = 18;
5726 /* One point at a time */
5727 else if (value > 3) value--;
5731 /* Return new value */
5732 return (s16b)(value);
5738 * Hack -- Calculates the total number of points earned -JWT-
5742 long calc_score(player_type *creature_ptr)
5746 u32b point, point_h, point_l;
5747 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
5749 if (!preserve_mode) mult += 10;
5750 if (!autoroller) mult += 10;
5751 if (!smart_learn) mult -= 20;
5752 if (smart_cheat) mult += 30;
5753 if (ironman_shops) mult += 50;
5754 if (ironman_small_levels) mult += 10;
5755 if (ironman_empty_levels) mult += 20;
5756 if (!powerup_home) mult += 50;
5757 if (ironman_rooms) mult += 100;
5758 if (ironman_nightmare) mult += 100;
5760 if (mult < 5) mult = 5;
5762 for (i = 0; i < current_world_ptr->max_d_idx; i++)
5763 if (max_dlv[i] > max_dl)
5764 max_dl = max_dlv[i];
5766 point_l = (creature_ptr->max_max_exp + (100 * max_dl));
5767 point_h = point_l / 0x10000L;
5768 point_l = point_l % 0x10000L;
5771 point_h += point_l / 0x10000L;
5772 point_l %= 0x10000L;
5774 point_l += ((point_h % 100) << 16);
5778 point = (point_h << 16) + (point_l);
5779 if (creature_ptr->arena_number >= 0)
5780 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
5782 if (ironman_downward) point *= 2;
5783 if (creature_ptr->pclass == CLASS_BERSERKER)
5785 if (creature_ptr->prace == RACE_SPECTRE)
5789 if ((creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
5792 if (current_world_ptr->total_winner) point = 2;
5794 if (easy_band) point = (0 - point);
5800 void cheat_death(player_type *creature_ptr)
5802 /* Mark social class, reset age, if needed */
5803 if (creature_ptr->sc) creature_ptr->sc = creature_ptr->age = 0;
5806 creature_ptr->age++;
5809 current_world_ptr->noscore |= 0x0001;
5811 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
5814 (void)life_stream(creature_ptr, FALSE, FALSE);
5816 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
5819 for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
5821 creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
5823 for (; magic_idx < EATER_EXT * 3; magic_idx++)
5825 creature_ptr->magic_num1[magic_idx] = 0;
5829 /* Restore spell points */
5830 creature_ptr->csp = creature_ptr->msp;
5831 creature_ptr->csp_frac = 0;
5833 /* Hack -- cancel recall */
5834 if (creature_ptr->word_recall)
5836 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
5839 /* Hack -- Prevent recall */
5840 creature_ptr->word_recall = 0;
5841 creature_ptr->redraw |= (PR_STATUS);
5844 /* Hack -- cancel alter */
5845 if (creature_ptr->alter_reality)
5847 /* Hack -- Prevent alter */
5848 creature_ptr->alter_reality = 0;
5849 creature_ptr->redraw |= (PR_STATUS);
5852 /* Note cause of death */
5853 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
5856 creature_ptr->is_dead = FALSE;
5858 /* Hack -- Prevent starvation */
5859 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
5861 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5862 floor_ptr->dun_level = 0;
5863 floor_ptr->inside_arena = FALSE;
5864 creature_ptr->phase_out = FALSE;
5866 floor_ptr->inside_quest = 0;
5867 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
5868 creature_ptr->dungeon_idx = 0;
5869 if (lite_town || vanilla_town)
5871 creature_ptr->wilderness_y = 1;
5872 creature_ptr->wilderness_x = 1;
5875 creature_ptr->oldpy = 10;
5876 creature_ptr->oldpx = 34;
5880 creature_ptr->oldpy = 33;
5881 creature_ptr->oldpx = 131;
5886 creature_ptr->wilderness_y = 48;
5887 creature_ptr->wilderness_x = 5;
5888 creature_ptr->oldpy = 33;
5889 creature_ptr->oldpx = 131;
5891 creature_ptr->wild_mode = FALSE;
5892 creature_ptr->leaving = TRUE;
5894 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
5898 /* Prepare next floor */
5899 leave_floor(creature_ptr);
5905 * @param creature_ptr プレーヤーへの参照ポインタ
5906 * @return 祝福状態ならばTRUE
5908 bool is_blessed(player_type *creature_ptr)
5910 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(HEX_BLESS);
5914 bool is_oppose_acid(player_type *creature_ptr)
5916 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5920 bool is_oppose_elec(player_type *creature_ptr)
5922 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5926 bool is_oppose_fire(player_type *creature_ptr)
5928 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5932 bool is_oppose_cold(player_type *creature_ptr)
5934 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5938 bool is_oppose_pois(player_type *creature_ptr)
5940 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5944 bool is_tim_esp(player_type *creature_ptr)
5946 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5950 bool is_tim_stealth(player_type *creature_ptr)
5952 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5956 bool is_time_limit_esp(player_type *creature_ptr)
5958 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5962 bool is_time_limit_stealth(player_type *creature_ptr)
5964 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5968 bool can_two_hands_wielding(player_type *creature_ptr)
5970 return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);