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] =
222 * @brief 基本必要経験値テーブル /
223 * Base experience levels, may be adjusted up for race and/or class
225 const s32b player_exp[PY_MAX_LEVEL] =
280 * @brief 基本必要強化値テーブル(アンドロイド専用)
282 const s32b player_exp_a[PY_MAX_LEVEL] =
337 * 知力/賢さによるレベル毎の習得可能魔法数テーブル
338 * Stat Table (INT/WIS) -- Number of half-spells per level
340 const byte adj_mag_study[] =
367 4 /* 18/100-18/109 */,
368 4 /* 18/110-18/119 */,
369 5 /* 18/120-18/129 */,
370 5 /* 18/130-18/139 */,
371 5 /* 18/140-18/149 */,
372 5 /* 18/150-18/159 */,
373 5 /* 18/160-18/169 */,
374 5 /* 18/170-18/179 */,
375 5 /* 18/180-18/189 */,
376 5 /* 18/190-18/199 */,
377 5 /* 18/200-18/209 */,
378 6 /* 18/210-18/219 */,
384 * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
386 const byte adj_mag_mana[] =
403 10 /* 18/00-18/09 */,
404 11 /* 18/10-18/19 */,
405 11 /* 18/20-18/29 */,
406 12 /* 18/30-18/39 */,
407 12 /* 18/40-18/49 */,
408 13 /* 18/50-18/59 */,
409 14 /* 18/60-18/69 */,
410 15 /* 18/70-18/79 */,
411 16 /* 18/80-18/89 */,
412 17 /* 18/90-18/99 */,
413 18 /* 18/100-18/109 */,
414 19 /* 18/110-18/119 */,
415 20 /* 18/120-18/129 */,
416 21 /* 18/130-18/139 */,
417 22 /* 18/140-18/149 */,
418 23 /* 18/150-18/159 */,
419 24 /* 18/160-18/169 */,
420 25 /* 18/170-18/179 */,
421 26 /* 18/180-18/189 */,
422 27 /* 18/190-18/199 */,
423 28 /* 18/200-18/209 */,
424 29 /* 18/210-18/219 */,
429 * 知力/賢さによる最低魔法失敗率テーブル
430 * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
432 const byte adj_mag_fail[] =
459 3 /* 18/100-18/109 */,
460 2 /* 18/110-18/119 */,
461 2 /* 18/120-18/129 */,
462 2 /* 18/130-18/139 */,
463 2 /* 18/140-18/149 */,
464 1 /* 18/150-18/159 */,
465 1 /* 18/160-18/169 */,
466 1 /* 18/170-18/179 */,
467 1 /* 18/180-18/189 */,
468 1 /* 18/190-18/199 */,
469 0 /* 18/200-18/209 */,
470 0 /* 18/210-18/219 */,
475 * 知力/賢さによる魔法失敗率修正テーブル
476 * Stat Table (INT/WIS) -- Various things
478 const byte adj_mag_stat[] =
505 8 /* 18/100-18/109 */,
506 9 /* 18/110-18/119 */,
507 10 /* 18/120-18/129 */,
508 11 /* 18/130-18/139 */,
509 12 /* 18/140-18/149 */,
510 13 /* 18/150-18/159 */,
511 14 /* 18/160-18/169 */,
512 15 /* 18/170-18/179 */,
513 16 /* 18/180-18/189 */,
514 17 /* 18/190-18/199 */,
515 18 /* 18/200-18/209 */,
516 19 /* 18/210-18/219 */,
522 * Stat Table (CHR) -- payment percentages
524 const byte adj_chr_gold[] =
541 100 /* 18/00-18/09 */,
542 99 /* 18/10-18/19 */,
543 98 /* 18/20-18/29 */,
544 97 /* 18/30-18/39 */,
545 96 /* 18/40-18/49 */,
546 95 /* 18/50-18/59 */,
547 94 /* 18/60-18/69 */,
548 93 /* 18/70-18/79 */,
549 92 /* 18/80-18/89 */,
550 91 /* 18/90-18/99 */,
551 90 /* 18/100-18/109 */,
552 89 /* 18/110-18/119 */,
553 88 /* 18/120-18/129 */,
554 87 /* 18/130-18/139 */,
555 86 /* 18/140-18/149 */,
556 85 /* 18/150-18/159 */,
557 84 /* 18/160-18/169 */,
558 83 /* 18/170-18/179 */,
559 82 /* 18/180-18/189 */,
560 81 /* 18/190-18/199 */,
561 80 /* 18/200-18/209 */,
562 79 /* 18/210-18/219 */,
568 * Stat Table (INT) -- Magic devices
570 const byte adj_int_dev[] =
597 8 /* 18/100-18/109 */,
598 9 /* 18/110-18/119 */,
599 10 /* 18/120-18/129 */,
600 11 /* 18/130-18/139 */,
601 12 /* 18/140-18/149 */,
602 13 /* 18/150-18/159 */,
603 14 /* 18/160-18/169 */,
604 15 /* 18/170-18/179 */,
605 16 /* 18/180-18/189 */,
606 17 /* 18/190-18/199 */,
607 18 /* 18/200-18/209 */,
608 19 /* 18/210-18/219 */,
614 * Stat Table (WIS) -- Saving throw
616 const byte adj_wis_sav[] =
643 7 /* 18/100-18/109 */,
644 8 /* 18/110-18/119 */,
645 9 /* 18/120-18/129 */,
646 10 /* 18/130-18/139 */,
647 11 /* 18/140-18/149 */,
648 12 /* 18/150-18/159 */,
649 13 /* 18/160-18/169 */,
650 14 /* 18/170-18/179 */,
651 15 /* 18/180-18/189 */,
652 16 /* 18/190-18/199 */,
653 17 /* 18/200-18/209 */,
654 18 /* 18/210-18/219 */,
660 * Stat Table (DEX) -- disarming
662 const byte adj_dex_dis[] =
689 8 /* 18/100-18/109 */,
690 8 /* 18/110-18/119 */,
691 8 /* 18/120-18/129 */,
692 8 /* 18/130-18/139 */,
693 8 /* 18/140-18/149 */,
694 9 /* 18/150-18/159 */,
695 9 /* 18/160-18/169 */,
696 9 /* 18/170-18/179 */,
697 9 /* 18/180-18/189 */,
698 9 /* 18/190-18/199 */,
699 10 /* 18/200-18/209 */,
700 10 /* 18/210-18/219 */,
706 * Stat Table (INT) -- disarming
708 const byte adj_int_dis[] =
735 10 /* 18/100-18/109 */,
736 10 /* 18/110-18/119 */,
737 11 /* 18/120-18/129 */,
738 12 /* 18/130-18/139 */,
739 13 /* 18/140-18/149 */,
740 14 /* 18/150-18/159 */,
741 15 /* 18/160-18/169 */,
742 16 /* 18/170-18/179 */,
743 17 /* 18/180-18/189 */,
744 18 /* 18/190-18/199 */,
745 19 /* 18/200-18/209 */,
746 19 /* 18/210-18/219 */,
752 * Stat Table (DEX) -- bonus to ac (plus 128)
754 const byte adj_dex_ta[] =
771 128 + 2 /* 18/00-18/09 */,
772 128 + 2 /* 18/10-18/19 */,
773 128 + 2 /* 18/20-18/29 */,
774 128 + 2 /* 18/30-18/39 */,
775 128 + 2 /* 18/40-18/49 */,
776 128 + 3 /* 18/50-18/59 */,
777 128 + 3 /* 18/60-18/69 */,
778 128 + 3 /* 18/70-18/79 */,
779 128 + 4 /* 18/80-18/89 */,
780 128 + 5 /* 18/90-18/99 */,
781 128 + 6 /* 18/100-18/109 */,
782 128 + 7 /* 18/110-18/119 */,
783 128 + 8 /* 18/120-18/129 */,
784 128 + 9 /* 18/130-18/139 */,
785 128 + 9 /* 18/140-18/149 */,
786 128 + 10 /* 18/150-18/159 */,
787 128 + 11 /* 18/160-18/169 */,
788 128 + 12 /* 18/170-18/179 */,
789 128 + 13 /* 18/180-18/189 */,
790 128 + 14 /* 18/190-18/199 */,
791 128 + 15 /* 18/200-18/209 */,
792 128 + 15 /* 18/210-18/219 */,
793 128 + 16 /* 18/220+ */
798 * Stat Table (STR) -- bonus to dam (plus 128)
800 const byte adj_str_td[] =
817 128 + 2 /* 18/00-18/09 */,
818 128 + 2 /* 18/10-18/19 */,
819 128 + 3 /* 18/20-18/29 */,
820 128 + 3 /* 18/30-18/39 */,
821 128 + 3 /* 18/40-18/49 */,
822 128 + 3 /* 18/50-18/59 */,
823 128 + 3 /* 18/60-18/69 */,
824 128 + 4 /* 18/70-18/79 */,
825 128 + 5 /* 18/80-18/89 */,
826 128 + 5 /* 18/90-18/99 */,
827 128 + 6 /* 18/100-18/109 */,
828 128 + 7 /* 18/110-18/119 */,
829 128 + 8 /* 18/120-18/129 */,
830 128 + 9 /* 18/130-18/139 */,
831 128 + 10 /* 18/140-18/149 */,
832 128 + 11 /* 18/150-18/159 */,
833 128 + 12 /* 18/160-18/169 */,
834 128 + 13 /* 18/170-18/179 */,
835 128 + 14 /* 18/180-18/189 */,
836 128 + 15 /* 18/190-18/199 */,
837 128 + 16 /* 18/200-18/209 */,
838 128 + 18 /* 18/210-18/219 */,
839 128 + 20 /* 18/220+ */
844 * Stat Table (DEX) -- bonus to hit (plus 128)
846 const byte adj_dex_th[] =
863 128 + 3 /* 18/00-18/09 */,
864 128 + 3 /* 18/10-18/19 */,
865 128 + 3 /* 18/20-18/29 */,
866 128 + 3 /* 18/30-18/39 */,
867 128 + 3 /* 18/40-18/49 */,
868 128 + 4 /* 18/50-18/59 */,
869 128 + 4 /* 18/60-18/69 */,
870 128 + 4 /* 18/70-18/79 */,
871 128 + 4 /* 18/80-18/89 */,
872 128 + 5 /* 18/90-18/99 */,
873 128 + 6 /* 18/100-18/109 */,
874 128 + 7 /* 18/110-18/119 */,
875 128 + 8 /* 18/120-18/129 */,
876 128 + 9 /* 18/130-18/139 */,
877 128 + 9 /* 18/140-18/149 */,
878 128 + 10 /* 18/150-18/159 */,
879 128 + 11 /* 18/160-18/169 */,
880 128 + 12 /* 18/170-18/179 */,
881 128 + 13 /* 18/180-18/189 */,
882 128 + 14 /* 18/190-18/199 */,
883 128 + 15 /* 18/200-18/209 */,
884 128 + 15 /* 18/210-18/219 */,
885 128 + 16 /* 18/220+ */
890 * Stat Table (STR) -- bonus to hit (plus 128)
892 const byte adj_str_th[] =
909 128 + 1 /* 18/00-18/09 */,
910 128 + 1 /* 18/10-18/19 */,
911 128 + 1 /* 18/20-18/29 */,
912 128 + 1 /* 18/30-18/39 */,
913 128 + 1 /* 18/40-18/49 */,
914 128 + 1 /* 18/50-18/59 */,
915 128 + 1 /* 18/60-18/69 */,
916 128 + 2 /* 18/70-18/79 */,
917 128 + 3 /* 18/80-18/89 */,
918 128 + 4 /* 18/90-18/99 */,
919 128 + 5 /* 18/100-18/109 */,
920 128 + 6 /* 18/110-18/119 */,
921 128 + 7 /* 18/120-18/129 */,
922 128 + 8 /* 18/130-18/139 */,
923 128 + 9 /* 18/140-18/149 */,
924 128 + 10 /* 18/150-18/159 */,
925 128 + 11 /* 18/160-18/169 */,
926 128 + 12 /* 18/170-18/179 */,
927 128 + 13 /* 18/180-18/189 */,
928 128 + 14 /* 18/190-18/199 */,
929 128 + 15 /* 18/200-18/209 */,
930 128 + 15 /* 18/210-18/219 */,
931 128 + 16 /* 18/220+ */
936 * Stat Table (STR) -- weight limit in deca-pounds
938 const byte adj_str_wgt[] =
955 25 /* 18/00-18/09 */,
956 26 /* 18/10-18/19 */,
957 27 /* 18/20-18/29 */,
958 28 /* 18/30-18/39 */,
959 29 /* 18/40-18/49 */,
960 30 /* 18/50-18/59 */,
961 31 /* 18/60-18/69 */,
962 31 /* 18/70-18/79 */,
963 32 /* 18/80-18/89 */,
964 32 /* 18/90-18/99 */,
965 33 /* 18/100-18/109 */,
966 33 /* 18/110-18/119 */,
967 34 /* 18/120-18/129 */,
968 34 /* 18/130-18/139 */,
969 35 /* 18/140-18/149 */,
970 35 /* 18/150-18/159 */,
971 36 /* 18/160-18/169 */,
972 36 /* 18/170-18/179 */,
973 37 /* 18/180-18/189 */,
974 37 /* 18/190-18/199 */,
975 38 /* 18/200-18/209 */,
976 38 /* 18/210-18/219 */,
982 * Stat Table (STR) -- weapon weight limit in pounds
984 const byte adj_str_hold[] =
1001 19 /* 18/00-18/09 */,
1002 20 /* 18/10-18/19 */,
1003 21 /* 18/20-18/29 */,
1004 22 /* 18/30-18/39 */,
1005 23 /* 18/40-18/49 */,
1006 24 /* 18/50-18/59 */,
1007 25 /* 18/60-18/69 */,
1008 26 /* 18/70-18/79 */,
1009 27 /* 18/80-18/89 */,
1010 28 /* 18/90-18/99 */,
1011 30 /* 18/100-18/109 */,
1012 31 /* 18/110-18/119 */,
1013 32 /* 18/120-18/129 */,
1014 33 /* 18/130-18/139 */,
1015 34 /* 18/140-18/149 */,
1016 35 /* 18/150-18/159 */,
1017 37 /* 18/160-18/169 */,
1018 40 /* 18/170-18/179 */,
1019 44 /* 18/180-18/189 */,
1020 48 /* 18/190-18/199 */,
1021 50 /* 18/200-18/209 */,
1022 50 /* 18/210-18/219 */,
1028 * Stat Table (STR) -- digging value
1030 const byte adj_str_dig[] =
1047 9 /* 18/00-18/09 */,
1048 10 /* 18/10-18/19 */,
1049 12 /* 18/20-18/29 */,
1050 15 /* 18/30-18/39 */,
1051 20 /* 18/40-18/49 */,
1052 25 /* 18/50-18/59 */,
1053 30 /* 18/60-18/69 */,
1054 35 /* 18/70-18/79 */,
1055 40 /* 18/80-18/89 */,
1056 45 /* 18/90-18/99 */,
1057 50 /* 18/100-18/109 */,
1058 55 /* 18/110-18/119 */,
1059 60 /* 18/120-18/129 */,
1060 65 /* 18/130-18/139 */,
1061 70 /* 18/140-18/149 */,
1062 75 /* 18/150-18/159 */,
1063 80 /* 18/160-18/169 */,
1064 85 /* 18/170-18/179 */,
1065 90 /* 18/180-18/189 */,
1066 95 /* 18/190-18/199 */,
1067 100 /* 18/200-18/209 */,
1068 100 /* 18/210-18/219 */,
1073 * 器用さによる盗難防止&体当たり成功判定修正テーブル
1074 * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
1076 const byte adj_dex_safe[] =
1093 10 /* 18/00-18/09 */,
1094 10 /* 18/10-18/19 */,
1095 15 /* 18/20-18/29 */,
1096 15 /* 18/30-18/39 */,
1097 20 /* 18/40-18/49 */,
1098 25 /* 18/50-18/59 */,
1099 30 /* 18/60-18/69 */,
1100 35 /* 18/70-18/79 */,
1101 40 /* 18/80-18/89 */,
1102 45 /* 18/90-18/99 */,
1103 50 /* 18/100-18/109 */,
1104 60 /* 18/110-18/119 */,
1105 70 /* 18/120-18/129 */,
1106 80 /* 18/130-18/139 */,
1107 90 /* 18/140-18/149 */,
1108 100 /* 18/150-18/159 */,
1109 100 /* 18/160-18/169 */,
1110 100 /* 18/170-18/179 */,
1111 100 /* 18/180-18/189 */,
1112 100 /* 18/190-18/199 */,
1113 100 /* 18/200-18/209 */,
1114 100 /* 18/210-18/219 */,
1119 * 耐久による基本HP自然治癒値テーブル /
1120 * Stat Table (CON) -- base regeneration rate
1122 const byte adj_con_fix[] =
1139 2 /* 18/00-18/09 */,
1140 2 /* 18/10-18/19 */,
1141 2 /* 18/20-18/29 */,
1142 2 /* 18/30-18/39 */,
1143 2 /* 18/40-18/49 */,
1144 3 /* 18/50-18/59 */,
1145 3 /* 18/60-18/69 */,
1146 3 /* 18/70-18/79 */,
1147 3 /* 18/80-18/89 */,
1148 3 /* 18/90-18/99 */,
1149 4 /* 18/100-18/109 */,
1150 4 /* 18/110-18/119 */,
1151 5 /* 18/120-18/129 */,
1152 6 /* 18/130-18/139 */,
1153 6 /* 18/140-18/149 */,
1154 7 /* 18/150-18/159 */,
1155 7 /* 18/160-18/169 */,
1156 8 /* 18/170-18/179 */,
1157 8 /* 18/180-18/189 */,
1158 8 /* 18/190-18/199 */,
1159 9 /* 18/200-18/209 */,
1160 9 /* 18/210-18/219 */,
1165 * 耐久による基本HP自然治癒値テーブル /
1166 * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
1168 const byte adj_con_mhp[] =
1185 128 + 4 /* 18/00-18/09 */,
1186 128 + 5 /* 18/10-18/19 */,
1187 128 + 6 /* 18/20-18/29 */,
1188 128 + 7 /* 18/30-18/39 */,
1189 128 + 8 /* 18/40-18/49 */,
1190 128 + 9 /* 18/50-18/59 */,
1191 128 + 10 /* 18/60-18/69 */,
1192 128 + 11 /* 18/70-18/79 */,
1193 128 + 12 /* 18/80-18/89 */,
1194 128 + 14 /* 18/90-18/99 */,
1195 128 + 17 /* 18/100-18/109 */,
1196 128 + 20 /* 18/110-18/119 */,
1197 128 + 23 /* 18/120-18/129 */,
1198 128 + 26 /* 18/130-18/139 */,
1199 128 + 29 /* 18/140-18/149 */,
1200 128 + 32 /* 18/150-18/159 */,
1201 128 + 35 /* 18/160-18/169 */,
1202 128 + 38 /* 18/170-18/179 */,
1203 128 + 40 /* 18/180-18/189 */,
1204 128 + 42 /* 18/190-18/199 */,
1205 128 + 44 /* 18/200-18/209 */,
1206 128 + 46 /* 18/210-18/219 */,
1207 128 + 48 /* 18/220+ */
1212 * Stat Table (CHR) -- charm
1214 const byte adj_chr_chm[] =
1231 9 /* 18/00-18/09 */,
1232 10 /* 18/10-18/19 */,
1233 12 /* 18/20-18/29 */,
1234 15 /* 18/30-18/39 */,
1235 18 /* 18/40-18/49 */,
1236 21 /* 18/50-18/59 */,
1237 24 /* 18/60-18/69 */,
1238 28 /* 18/70-18/79 */,
1239 32 /* 18/80-18/89 */,
1240 36 /* 18/90-18/99 */,
1241 39 /* 18/100-18/109 */,
1242 42 /* 18/110-18/119 */,
1243 45 /* 18/120-18/129 */,
1244 49 /* 18/130-18/139 */,
1245 53 /* 18/140-18/149 */,
1246 57 /* 18/150-18/159 */,
1247 61 /* 18/160-18/169 */,
1248 65 /* 18/170-18/179 */,
1249 69 /* 18/180-18/189 */,
1250 73 /* 18/190-18/199 */,
1251 77 /* 18/200-18/209 */,
1252 81 /* 18/210-18/219 */,
1256 /*** Player information ***/
1259 * Static player info record
1264 * Pointer to the player info
1266 player_type *p_ptr = &p_body;
1269 * Return alignment title
1271 concptr your_alignment(player_type *creature_ptr)
1273 if (creature_ptr->align > 150) return _("大善", "Lawful");
1274 else if (creature_ptr->align > 50) return _("中善", "Good");
1275 else if (creature_ptr->align > 10) return _("小善", "Neutral Good");
1276 else if (creature_ptr->align > -11) return _("中立", "Neutral");
1277 else if (creature_ptr->align > -51) return _("小悪", "Neutral Evil");
1278 else if (creature_ptr->align > -151) return _("中悪", "Evil");
1279 else return _("大悪", "Chaotic");
1284 * Return proficiency level of weapons and misc. skills (except riding)
1286 int weapon_exp_level(int weapon_exp)
1288 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1289 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1290 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1291 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
1292 else return EXP_LEVEL_MASTER;
1297 * Return proficiency level of riding
1299 int riding_exp_level(int riding_exp)
1301 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1302 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1303 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1304 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
1305 else return EXP_LEVEL_MASTER;
1310 * Return proficiency level of spells
1312 int spell_exp_level(int spell_exp)
1314 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1315 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1316 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1317 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
1318 else return EXP_LEVEL_MASTER;
1323 * @brief プレイヤーの全ステータスを更新する /
1324 * Calculate the players current "state", taking into account
1325 * not only race/class intrinsics, but also objects being worn
1326 * and temporary spell effects.
1330 * See also calc_mana() and calc_hitpoints().
1332 * Take note of the new "speed code", in particular, a very strong
1333 * player will start slowing down as soon as he reaches 150 pounds,
1334 * but not until he reaches 450 pounds will he be half as fast as
1335 * a normal kobold. This both hurts and helps the player, hurts
1336 * because in the old days a player could just avoid 300 pounds,
1337 * and helps because now carrying 300 pounds is not very painful.
1339 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
1340 * damage, since that would affect non-combat things. These values
1341 * are actually added in later, at the appropriate place.
1343 * This function induces various "status" messages.
1346 void calc_bonuses(player_type *creature_ptr)
1350 int default_hand = 0;
1351 int empty_hands_status = empty_hands(creature_ptr, TRUE);
1354 BIT_FLAGS flgs[TR_FLAG_SIZE];
1356 bool yoiyami = FALSE;
1357 bool down_saving = FALSE;
1359 bool have_sw = FALSE, have_kabe = FALSE;
1360 bool easy_2weapon = FALSE;
1361 bool riding_levitation = FALSE;
1362 OBJECT_IDX this_o_idx, next_o_idx = 0;
1363 const player_race *tmp_rp_ptr;
1365 /* Save the old vision stuff */
1366 bool old_telepathy = creature_ptr->telepathy;
1367 bool old_esp_animal = creature_ptr->esp_animal;
1368 bool old_esp_undead = creature_ptr->esp_undead;
1369 bool old_esp_demon = creature_ptr->esp_demon;
1370 bool old_esp_orc = creature_ptr->esp_orc;
1371 bool old_esp_troll = creature_ptr->esp_troll;
1372 bool old_esp_giant = creature_ptr->esp_giant;
1373 bool old_esp_dragon = creature_ptr->esp_dragon;
1374 bool old_esp_human = creature_ptr->esp_human;
1375 bool old_esp_evil = creature_ptr->esp_evil;
1376 bool old_esp_good = creature_ptr->esp_good;
1377 bool old_esp_nonliving = creature_ptr->esp_nonliving;
1378 bool old_esp_unique = creature_ptr->esp_unique;
1379 bool old_see_inv = creature_ptr->see_inv;
1380 bool old_mighty_throw = creature_ptr->mighty_throw;
1382 /* Current feature under player. */
1383 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1384 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1386 /* Save the old armor class */
1387 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
1388 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
1390 /* Clear extra blows/shots */
1391 extra_blows[0] = extra_blows[1] = 0;
1393 /* Clear the stat modifiers */
1394 for (int i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
1397 /* Clear the Displayed/Real armor class */
1398 creature_ptr->dis_ac = creature_ptr->ac = 0;
1400 /* Clear the Displayed/Real Bonuses */
1401 creature_ptr->dis_to_h[0] = creature_ptr->to_h[0] = 0;
1402 creature_ptr->dis_to_h[1] = creature_ptr->to_h[1] = 0;
1403 creature_ptr->dis_to_d[0] = creature_ptr->to_d[0] = 0;
1404 creature_ptr->dis_to_d[1] = creature_ptr->to_d[1] = 0;
1405 creature_ptr->dis_to_h_b = creature_ptr->to_h_b = 0;
1406 creature_ptr->dis_to_a = creature_ptr->to_a = 0;
1407 creature_ptr->to_h_m = 0;
1408 creature_ptr->to_d_m = 0;
1410 creature_ptr->to_m_chance = 0;
1412 /* Clear the Extra Dice Bonuses */
1413 creature_ptr->to_dd[0] = creature_ptr->to_ds[0] = 0;
1414 creature_ptr->to_dd[1] = creature_ptr->to_ds[1] = 0;
1416 /* Start with "normal" speed */
1419 /* Start with a single blow per turn */
1420 creature_ptr->num_blow[0] = 1;
1421 creature_ptr->num_blow[1] = 1;
1423 /* Start with a single shot per turn */
1424 creature_ptr->num_fire = 100;
1426 /* Reset the "xtra" tval */
1427 creature_ptr->tval_xtra = 0;
1429 /* Reset the "ammo" tval */
1430 creature_ptr->tval_ammo = 0;
1432 /* Clear all the flags */
1433 creature_ptr->cursed = 0L;
1434 creature_ptr->bless_blade = FALSE;
1435 creature_ptr->xtra_might = FALSE;
1436 creature_ptr->impact[0] = FALSE;
1437 creature_ptr->impact[1] = FALSE;
1438 creature_ptr->pass_wall = FALSE;
1439 creature_ptr->kill_wall = FALSE;
1440 creature_ptr->dec_mana = FALSE;
1441 creature_ptr->easy_spell = FALSE;
1442 creature_ptr->heavy_spell = FALSE;
1443 creature_ptr->see_inv = FALSE;
1444 creature_ptr->free_act = FALSE;
1445 creature_ptr->slow_digest = FALSE;
1446 creature_ptr->regenerate = FALSE;
1447 creature_ptr->can_swim = FALSE;
1448 creature_ptr->levitation = FALSE;
1449 creature_ptr->hold_exp = FALSE;
1450 creature_ptr->telepathy = FALSE;
1451 creature_ptr->esp_animal = FALSE;
1452 creature_ptr->esp_undead = FALSE;
1453 creature_ptr->esp_demon = FALSE;
1454 creature_ptr->esp_orc = FALSE;
1455 creature_ptr->esp_troll = FALSE;
1456 creature_ptr->esp_giant = FALSE;
1457 creature_ptr->esp_dragon = FALSE;
1458 creature_ptr->esp_human = FALSE;
1459 creature_ptr->esp_evil = FALSE;
1460 creature_ptr->esp_good = FALSE;
1461 creature_ptr->esp_nonliving = FALSE;
1462 creature_ptr->esp_unique = FALSE;
1463 creature_ptr->lite = FALSE;
1464 creature_ptr->sustain_str = FALSE;
1465 creature_ptr->sustain_int = FALSE;
1466 creature_ptr->sustain_wis = FALSE;
1467 creature_ptr->sustain_con = FALSE;
1468 creature_ptr->sustain_dex = FALSE;
1469 creature_ptr->sustain_chr = FALSE;
1470 creature_ptr->resist_acid = FALSE;
1471 creature_ptr->resist_elec = FALSE;
1472 creature_ptr->resist_fire = FALSE;
1473 creature_ptr->resist_cold = FALSE;
1474 creature_ptr->resist_pois = FALSE;
1475 creature_ptr->resist_conf = FALSE;
1476 creature_ptr->resist_sound = FALSE;
1477 creature_ptr->resist_lite = FALSE;
1478 creature_ptr->resist_dark = FALSE;
1479 creature_ptr->resist_chaos = FALSE;
1480 creature_ptr->resist_disen = FALSE;
1481 creature_ptr->resist_shard = FALSE;
1482 creature_ptr->resist_nexus = FALSE;
1483 creature_ptr->resist_blind = FALSE;
1484 creature_ptr->resist_neth = FALSE;
1485 creature_ptr->resist_time = FALSE;
1486 creature_ptr->resist_water = FALSE;
1487 creature_ptr->resist_fear = FALSE;
1488 creature_ptr->reflect = FALSE;
1489 creature_ptr->sh_fire = FALSE;
1490 creature_ptr->sh_elec = FALSE;
1491 creature_ptr->sh_cold = FALSE;
1492 creature_ptr->anti_magic = FALSE;
1493 creature_ptr->anti_tele = FALSE;
1494 creature_ptr->warning = FALSE;
1495 creature_ptr->mighty_throw = FALSE;
1496 creature_ptr->see_nocto = FALSE;
1498 creature_ptr->immune_acid = FALSE;
1499 creature_ptr->immune_elec = FALSE;
1500 creature_ptr->immune_fire = FALSE;
1501 creature_ptr->immune_cold = FALSE;
1503 creature_ptr->ryoute = FALSE;
1504 creature_ptr->migite = FALSE;
1505 creature_ptr->hidarite = FALSE;
1506 creature_ptr->no_flowed = FALSE;
1508 if (creature_ptr->mimic_form) tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1509 else tmp_rp_ptr = &race_info[creature_ptr->prace];
1511 /* Base infravision (purely racial) */
1512 creature_ptr->see_infra = tmp_rp_ptr->infra;
1514 /* Base skill -- disarming */
1515 creature_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
1517 /* Base skill -- magic devices */
1518 creature_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
1520 /* Base skill -- saving throw */
1521 creature_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
1523 /* Base skill -- stealth */
1524 creature_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
1526 /* Base skill -- searching ability */
1527 creature_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
1529 /* Base skill -- searching frequency */
1530 creature_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
1532 /* Base skill -- combat (normal) */
1533 creature_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
1535 /* Base skill -- combat (shooting) */
1536 creature_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1538 /* Base skill -- combat (throwing) */
1539 creature_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1541 /* Base skill -- digging */
1542 creature_ptr->skill_dig = 0;
1544 if (has_melee_weapon(creature_ptr, INVEN_RARM)) creature_ptr->migite = TRUE;
1545 if (has_melee_weapon(creature_ptr, INVEN_LARM))
1547 creature_ptr->hidarite = TRUE;
1548 if (!creature_ptr->migite) default_hand = 1;
1551 if (can_two_hands_wielding(creature_ptr))
1553 if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
1554 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
1556 creature_ptr->ryoute = TRUE;
1558 else if (creature_ptr->hidarite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) &&
1559 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM]))
1561 creature_ptr->ryoute = TRUE;
1565 switch (creature_ptr->pclass)
1568 case CLASS_FORCETRAINER:
1569 case CLASS_BERSERKER:
1570 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
1572 creature_ptr->migite = TRUE;
1573 creature_ptr->ryoute = TRUE;
1580 if (!creature_ptr->migite && !creature_ptr->hidarite)
1582 if (empty_hands_status & EMPTY_HAND_RARM) creature_ptr->migite = TRUE;
1583 else if (empty_hands_status == EMPTY_HAND_LARM)
1585 creature_ptr->hidarite = TRUE;
1590 if (creature_ptr->special_defense & KAMAE_MASK)
1592 if (!(empty_hands_status & EMPTY_HAND_RARM))
1594 set_action(creature_ptr, ACTION_NONE);
1598 switch (creature_ptr->pclass)
1601 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1602 if (creature_ptr->lev > 44) creature_ptr->regenerate = TRUE;
1605 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1607 case CLASS_CHAOS_WARRIOR:
1608 if (creature_ptr->lev > 29) creature_ptr->resist_chaos = TRUE;
1609 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1611 case CLASS_MINDCRAFTER:
1612 if (creature_ptr->lev > 9) creature_ptr->resist_fear = TRUE;
1613 if (creature_ptr->lev > 19) creature_ptr->sustain_wis = TRUE;
1614 if (creature_ptr->lev > 29) creature_ptr->resist_conf = TRUE;
1615 if (creature_ptr->lev > 39) creature_ptr->telepathy = TRUE;
1618 case CLASS_FORCETRAINER:
1619 /* Unencumbered Monks become faster every 10 levels */
1620 if (!(heavy_armor(creature_ptr)))
1622 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1623 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1624 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1625 new_speed += (creature_ptr->lev) / 10;
1627 /* Free action if unencumbered at level 25 */
1628 if (creature_ptr->lev > 24)
1629 creature_ptr->free_act = TRUE;
1632 case CLASS_SORCERER:
1633 creature_ptr->to_a -= 50;
1634 creature_ptr->dis_to_a -= 50;
1637 creature_ptr->resist_sound = TRUE;
1640 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1642 case CLASS_BERSERKER:
1643 creature_ptr->shero = 1;
1644 creature_ptr->sustain_str = TRUE;
1645 creature_ptr->sustain_dex = TRUE;
1646 creature_ptr->sustain_con = TRUE;
1647 creature_ptr->regenerate = TRUE;
1648 creature_ptr->free_act = TRUE;
1650 if (creature_ptr->lev > 29) new_speed++;
1651 if (creature_ptr->lev > 39) new_speed++;
1652 if (creature_ptr->lev > 44) new_speed++;
1653 if (creature_ptr->lev > 49) new_speed++;
1654 creature_ptr->to_a += 10 + creature_ptr->lev / 2;
1655 creature_ptr->dis_to_a += 10 + creature_ptr->lev / 2;
1656 creature_ptr->skill_dig += (100 + creature_ptr->lev * 8);
1657 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1658 creature_ptr->redraw |= PR_STATUS;
1660 case CLASS_MIRROR_MASTER:
1661 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1664 /* Unencumbered Ninjas become faster every 10 levels */
1665 if (heavy_armor(creature_ptr))
1667 new_speed -= (creature_ptr->lev) / 10;
1668 creature_ptr->skill_stl -= (creature_ptr->lev) / 10;
1670 else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1671 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1674 if (!(PRACE_IS_(creature_ptr, RACE_KLACKON) ||
1675 PRACE_IS_(creature_ptr, RACE_SPRITE) ||
1676 (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
1677 new_speed += (creature_ptr->lev) / 10;
1678 creature_ptr->skill_stl += (creature_ptr->lev) / 10;
1680 /* Free action if unencumbered at level 25 */
1681 if (creature_ptr->lev > 24)
1682 creature_ptr->free_act = TRUE;
1684 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1685 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1687 creature_ptr->to_a += creature_ptr->lev / 2 + 5;
1688 creature_ptr->dis_to_a += creature_ptr->lev / 2 + 5;
1690 creature_ptr->slow_digest = TRUE;
1691 creature_ptr->resist_fear = TRUE;
1692 if (creature_ptr->lev > 19) creature_ptr->resist_pois = TRUE;
1693 if (creature_ptr->lev > 24) creature_ptr->sustain_dex = TRUE;
1694 if (creature_ptr->lev > 29) creature_ptr->see_inv = TRUE;
1695 if (creature_ptr->lev > 44)
1697 creature_ptr->oppose_pois = 1;
1698 creature_ptr->redraw |= PR_STATUS;
1700 creature_ptr->see_nocto = TRUE;
1705 if (creature_ptr->mimic_form)
1707 switch (creature_ptr->mimic_form)
1710 creature_ptr->hold_exp = TRUE;
1711 creature_ptr->resist_chaos = TRUE;
1712 creature_ptr->resist_neth = TRUE;
1713 creature_ptr->resist_fire = TRUE;
1714 creature_ptr->oppose_fire = 1;
1715 creature_ptr->see_inv = TRUE;
1717 creature_ptr->redraw |= PR_STATUS;
1718 creature_ptr->to_a += 10;
1719 creature_ptr->dis_to_a += 10;
1721 case MIMIC_DEMON_LORD:
1722 creature_ptr->hold_exp = TRUE;
1723 creature_ptr->resist_chaos = TRUE;
1724 creature_ptr->resist_neth = TRUE;
1725 creature_ptr->immune_fire = TRUE;
1726 creature_ptr->resist_acid = TRUE;
1727 creature_ptr->resist_fire = TRUE;
1728 creature_ptr->resist_cold = TRUE;
1729 creature_ptr->resist_elec = TRUE;
1730 creature_ptr->resist_pois = TRUE;
1731 creature_ptr->resist_conf = TRUE;
1732 creature_ptr->resist_disen = TRUE;
1733 creature_ptr->resist_nexus = TRUE;
1734 creature_ptr->resist_fear = TRUE;
1735 creature_ptr->sh_fire = TRUE;
1736 creature_ptr->see_inv = TRUE;
1737 creature_ptr->telepathy = TRUE;
1738 creature_ptr->levitation = TRUE;
1739 creature_ptr->kill_wall = TRUE;
1741 creature_ptr->to_a += 20;
1742 creature_ptr->dis_to_a += 20;
1745 creature_ptr->resist_dark = TRUE;
1746 creature_ptr->hold_exp = TRUE;
1747 creature_ptr->resist_neth = TRUE;
1748 creature_ptr->resist_cold = TRUE;
1749 creature_ptr->resist_pois = TRUE;
1750 creature_ptr->see_inv = TRUE;
1752 creature_ptr->to_a += 10;
1753 creature_ptr->dis_to_a += 10;
1754 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1760 switch (creature_ptr->prace)
1763 creature_ptr->resist_lite = TRUE;
1766 creature_ptr->hold_exp = TRUE;
1769 creature_ptr->free_act = TRUE;
1772 creature_ptr->resist_blind = TRUE;
1775 creature_ptr->resist_dark = TRUE;
1777 case RACE_HALF_TROLL:
1778 creature_ptr->sustain_str = TRUE;
1780 if (creature_ptr->lev > 14)
1782 /* High level trolls heal fast... */
1783 creature_ptr->regenerate = TRUE;
1785 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER)
1787 creature_ptr->slow_digest = TRUE;
1788 /* Let's not make Regeneration
1789 * a disadvantage for the poor warriors who can
1790 * never learn a spell that satisfies hunger (actually
1791 * neither can rogues, but half-trolls are not
1792 * supposed to play rogues) */
1797 creature_ptr->sustain_con = TRUE;
1798 creature_ptr->regenerate = TRUE; /* Amberites heal fast... */
1801 creature_ptr->resist_lite = TRUE;
1802 creature_ptr->see_inv = TRUE;
1804 case RACE_BARBARIAN:
1805 creature_ptr->resist_fear = TRUE;
1807 case RACE_HALF_OGRE:
1808 creature_ptr->resist_dark = TRUE;
1809 creature_ptr->sustain_str = TRUE;
1811 case RACE_HALF_GIANT:
1812 creature_ptr->sustain_str = TRUE;
1813 creature_ptr->resist_shard = TRUE;
1815 case RACE_HALF_TITAN:
1816 creature_ptr->resist_chaos = TRUE;
1819 creature_ptr->resist_sound = TRUE;
1822 creature_ptr->resist_acid = TRUE;
1823 if (creature_ptr->lev > 19) creature_ptr->immune_acid = TRUE;
1826 creature_ptr->resist_conf = TRUE;
1827 creature_ptr->resist_acid = TRUE;
1829 /* Klackons become faster */
1830 new_speed += (creature_ptr->lev) / 10;
1833 creature_ptr->resist_pois = TRUE;
1836 creature_ptr->resist_disen = TRUE;
1837 creature_ptr->resist_dark = TRUE;
1840 creature_ptr->resist_dark = TRUE;
1841 if (creature_ptr->lev > 19) creature_ptr->see_inv = TRUE;
1843 case RACE_DRACONIAN:
1844 creature_ptr->levitation = TRUE;
1845 if (creature_ptr->lev > 4) creature_ptr->resist_fire = TRUE;
1846 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1847 if (creature_ptr->lev > 14) creature_ptr->resist_acid = TRUE;
1848 if (creature_ptr->lev > 19) creature_ptr->resist_elec = TRUE;
1849 if (creature_ptr->lev > 34) creature_ptr->resist_pois = TRUE;
1851 case RACE_MIND_FLAYER:
1852 creature_ptr->sustain_int = TRUE;
1853 creature_ptr->sustain_wis = TRUE;
1854 if (creature_ptr->lev > 14) creature_ptr->see_inv = TRUE;
1855 if (creature_ptr->lev > 29) creature_ptr->telepathy = TRUE;
1858 creature_ptr->resist_fire = TRUE;
1859 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1862 creature_ptr->slow_digest = TRUE;
1863 creature_ptr->free_act = TRUE;
1864 creature_ptr->see_inv = TRUE;
1865 creature_ptr->resist_pois = TRUE;
1866 if (creature_ptr->lev > 34) creature_ptr->hold_exp = TRUE;
1869 creature_ptr->resist_shard = TRUE;
1870 creature_ptr->hold_exp = TRUE;
1871 creature_ptr->see_inv = TRUE;
1872 creature_ptr->resist_pois = TRUE;
1873 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1876 creature_ptr->resist_neth = TRUE;
1877 creature_ptr->hold_exp = TRUE;
1878 creature_ptr->see_inv = TRUE;
1879 creature_ptr->resist_pois = TRUE;
1880 creature_ptr->slow_digest = TRUE;
1881 if (creature_ptr->lev > 4) creature_ptr->resist_cold = TRUE;
1884 creature_ptr->resist_dark = TRUE;
1885 creature_ptr->hold_exp = TRUE;
1886 creature_ptr->resist_neth = TRUE;
1887 creature_ptr->resist_cold = TRUE;
1888 creature_ptr->resist_pois = TRUE;
1889 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1892 creature_ptr->levitation = TRUE;
1893 creature_ptr->free_act = TRUE;
1894 creature_ptr->resist_neth = TRUE;
1895 creature_ptr->hold_exp = TRUE;
1896 creature_ptr->see_inv = TRUE;
1897 creature_ptr->resist_pois = TRUE;
1898 creature_ptr->slow_digest = TRUE;
1899 creature_ptr->resist_cold = TRUE;
1900 creature_ptr->pass_wall = TRUE;
1901 if (creature_ptr->lev > 34) creature_ptr->telepathy = TRUE;
1904 creature_ptr->levitation = TRUE;
1905 creature_ptr->resist_lite = TRUE;
1907 /* Sprites become faster */
1908 new_speed += (creature_ptr->lev) / 10;
1911 creature_ptr->resist_conf = TRUE;
1912 creature_ptr->resist_sound = TRUE;
1915 /* Ents dig like maniacs, but only with their hands. */
1916 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
1917 creature_ptr->skill_dig += creature_ptr->lev * 10;
1918 /* Ents get tougher and stronger as they age, but lose dexterity. */
1919 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_STR]++;
1920 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_STR]++;
1921 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_STR]++;
1923 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_DEX]--;
1924 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_DEX]--;
1925 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_DEX]--;
1927 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_CON]++;
1928 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_CON]++;
1929 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_CON]++;
1932 creature_ptr->levitation = TRUE;
1933 creature_ptr->see_inv = TRUE;
1936 creature_ptr->resist_fire = TRUE;
1937 creature_ptr->resist_neth = TRUE;
1938 creature_ptr->hold_exp = TRUE;
1939 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1940 if (creature_ptr->lev > 44)
1942 creature_ptr->oppose_fire = 1;
1943 creature_ptr->redraw |= PR_STATUS;
1947 creature_ptr->sustain_con = TRUE;
1950 creature_ptr->levitation = TRUE;
1953 creature_ptr->resist_conf = TRUE;
1956 creature_ptr->slow_digest = TRUE;
1957 creature_ptr->free_act = TRUE;
1958 creature_ptr->resist_pois = TRUE;
1959 creature_ptr->hold_exp = TRUE;
1962 creature_ptr->resist_water = TRUE;
1970 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU))
1972 creature_ptr->see_inv = TRUE;
1973 creature_ptr->free_act = TRUE;
1974 creature_ptr->slow_digest = TRUE;
1975 creature_ptr->regenerate = TRUE;
1976 creature_ptr->levitation = TRUE;
1977 creature_ptr->hold_exp = TRUE;
1978 creature_ptr->telepathy = TRUE;
1979 creature_ptr->lite = TRUE;
1980 creature_ptr->sustain_str = TRUE;
1981 creature_ptr->sustain_int = TRUE;
1982 creature_ptr->sustain_wis = TRUE;
1983 creature_ptr->sustain_con = TRUE;
1984 creature_ptr->sustain_dex = TRUE;
1985 creature_ptr->sustain_chr = TRUE;
1986 creature_ptr->resist_acid = TRUE;
1987 creature_ptr->resist_elec = TRUE;
1988 creature_ptr->resist_fire = TRUE;
1989 creature_ptr->resist_cold = TRUE;
1990 creature_ptr->resist_pois = TRUE;
1991 creature_ptr->resist_conf = TRUE;
1992 creature_ptr->resist_sound = TRUE;
1993 creature_ptr->resist_lite = TRUE;
1994 creature_ptr->resist_dark = TRUE;
1995 creature_ptr->resist_chaos = TRUE;
1996 creature_ptr->resist_disen = TRUE;
1997 creature_ptr->resist_shard = TRUE;
1998 creature_ptr->resist_nexus = TRUE;
1999 creature_ptr->resist_blind = TRUE;
2000 creature_ptr->resist_neth = TRUE;
2001 creature_ptr->resist_fear = TRUE;
2002 creature_ptr->reflect = TRUE;
2003 creature_ptr->sh_fire = TRUE;
2004 creature_ptr->sh_elec = TRUE;
2005 creature_ptr->sh_cold = TRUE;
2006 creature_ptr->to_a += 100;
2007 creature_ptr->dis_to_a += 100;
2009 /* Temporary shield */
2010 else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef)
2012 creature_ptr->to_a += 50;
2013 creature_ptr->dis_to_a += 50;
2016 if (creature_ptr->tim_res_nether)
2018 creature_ptr->resist_neth = TRUE;
2021 if (creature_ptr->tim_sh_fire)
2023 creature_ptr->sh_fire = TRUE;
2026 if (creature_ptr->tim_res_time)
2028 creature_ptr->resist_time = TRUE;
2032 if (creature_ptr->pseikaku == SEIKAKU_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE);
2034 if (creature_ptr->pseikaku == SEIKAKU_NAMAKE) creature_ptr->to_m_chance += 10;
2035 if (creature_ptr->pseikaku == SEIKAKU_KIREMONO) creature_ptr->to_m_chance -= 3;
2036 if ((creature_ptr->pseikaku == SEIKAKU_GAMAN) || (creature_ptr->pseikaku == SEIKAKU_CHIKARA)) creature_ptr->to_m_chance++;
2038 if (creature_ptr->pseikaku == SEIKAKU_CHARGEMAN)
2040 creature_ptr->to_m_chance += 5;
2041 creature_ptr->resist_conf = TRUE;
2045 if (creature_ptr->pseikaku == SEIKAKU_LUCKY) creature_ptr->muta3 |= MUT3_GOOD_LUCK;
2047 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
2049 creature_ptr->resist_blind = TRUE;
2050 creature_ptr->resist_conf = TRUE;
2051 creature_ptr->hold_exp = TRUE;
2052 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
2054 if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
2055 /* Munchkin become faster */
2056 new_speed += (creature_ptr->lev) / 10 + 5;
2059 if (music_singing(creature_ptr, MUSIC_WALL))
2061 creature_ptr->kill_wall = TRUE;
2064 /* Hack -- apply racial/class stat maxes */
2065 /* Apply the racial modifiers */
2066 for (int i = 0; i < A_MAX; i++)
2068 /* Modify the stats for "race" */
2069 creature_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
2072 /* I'm adding the mutations here for the lack of a better place... */
2073 if (creature_ptr->muta3)
2075 /* Hyper Strength */
2076 if (creature_ptr->muta3 & MUT3_HYPER_STR)
2078 creature_ptr->stat_add[A_STR] += 4;
2082 if (creature_ptr->muta3 & MUT3_PUNY)
2084 creature_ptr->stat_add[A_STR] -= 4;
2087 /* Living computer */
2088 if (creature_ptr->muta3 & MUT3_HYPER_INT)
2090 creature_ptr->stat_add[A_INT] += 4;
2091 creature_ptr->stat_add[A_WIS] += 4;
2095 if (creature_ptr->muta3 & MUT3_MORONIC)
2097 creature_ptr->stat_add[A_INT] -= 4;
2098 creature_ptr->stat_add[A_WIS] -= 4;
2101 if (creature_ptr->muta3 & MUT3_RESILIENT)
2103 creature_ptr->stat_add[A_CON] += 4;
2106 if (creature_ptr->muta3 & MUT3_XTRA_FAT)
2108 creature_ptr->stat_add[A_CON] += 2;
2112 if (creature_ptr->muta3 & MUT3_ALBINO)
2114 creature_ptr->stat_add[A_CON] -= 4;
2117 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
2119 creature_ptr->stat_add[A_CON] -= 2;
2120 creature_ptr->stat_add[A_CHR] -= 1;
2121 creature_ptr->regenerate = FALSE;
2122 /* Cancel innate regeneration */
2125 if (creature_ptr->muta3 & MUT3_SILLY_VOI)
2127 creature_ptr->stat_add[A_CHR] -= 4;
2130 if (creature_ptr->muta3 & MUT3_BLANK_FAC)
2132 creature_ptr->stat_add[A_CHR] -= 1;
2135 if (creature_ptr->muta3 & MUT3_XTRA_EYES)
2137 creature_ptr->skill_fos += 15;
2138 creature_ptr->skill_srh += 15;
2141 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
2143 creature_ptr->skill_sav += (15 + (creature_ptr->lev / 5));
2146 if (creature_ptr->muta3 & MUT3_XTRA_NOIS)
2148 creature_ptr->skill_stl -= 3;
2151 if (creature_ptr->muta3 & MUT3_INFRAVIS)
2153 creature_ptr->see_infra += 3;
2156 if (creature_ptr->muta3 & MUT3_XTRA_LEGS)
2161 if (creature_ptr->muta3 & MUT3_SHORT_LEG)
2166 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
2168 creature_ptr->sh_elec = TRUE;
2171 if (creature_ptr->muta3 & MUT3_FIRE_BODY)
2173 creature_ptr->sh_fire = TRUE;
2174 creature_ptr->lite = TRUE;
2177 if (creature_ptr->muta3 & MUT3_WART_SKIN)
2179 creature_ptr->stat_add[A_CHR] -= 2;
2180 creature_ptr->to_a += 5;
2181 creature_ptr->dis_to_a += 5;
2184 if (creature_ptr->muta3 & MUT3_SCALES)
2186 creature_ptr->stat_add[A_CHR] -= 1;
2187 creature_ptr->to_a += 10;
2188 creature_ptr->dis_to_a += 10;
2191 if (creature_ptr->muta3 & MUT3_IRON_SKIN)
2193 creature_ptr->stat_add[A_DEX] -= 1;
2194 creature_ptr->to_a += 25;
2195 creature_ptr->dis_to_a += 25;
2198 if (creature_ptr->muta3 & MUT3_WINGS)
2200 creature_ptr->levitation = TRUE;
2203 if (creature_ptr->muta3 & MUT3_FEARLESS)
2205 creature_ptr->resist_fear = TRUE;
2208 if (creature_ptr->muta3 & MUT3_REGEN)
2210 creature_ptr->regenerate = TRUE;
2213 if (creature_ptr->muta3 & MUT3_ESP)
2215 creature_ptr->telepathy = TRUE;
2218 if (creature_ptr->muta3 & MUT3_LIMBER)
2220 creature_ptr->stat_add[A_DEX] += 3;
2223 if (creature_ptr->muta3 & MUT3_ARTHRITIS)
2225 creature_ptr->stat_add[A_DEX] -= 3;
2228 if (creature_ptr->muta3 & MUT3_MOTION)
2230 creature_ptr->free_act = TRUE;
2231 creature_ptr->skill_stl += 1;
2234 if (creature_ptr->muta3 & MUT3_ILL_NORM)
2236 creature_ptr->stat_add[A_CHR] = 0;
2240 if (creature_ptr->tsuyoshi)
2242 creature_ptr->stat_add[A_STR] += 4;
2243 creature_ptr->stat_add[A_CON] += 4;
2246 /* Scan the usable creature_ptr->inventory_list */
2247 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
2249 int bonus_to_h, bonus_to_d;
2250 o_ptr = &creature_ptr->inventory_list[i];
2251 if (!o_ptr->k_idx) continue;
2253 object_flags(o_ptr, flgs);
2255 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
2256 if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD;
2259 if (have_flag(flgs, TR_STR)) creature_ptr->stat_add[A_STR] += o_ptr->pval;
2260 if (have_flag(flgs, TR_INT)) creature_ptr->stat_add[A_INT] += o_ptr->pval;
2261 if (have_flag(flgs, TR_WIS)) creature_ptr->stat_add[A_WIS] += o_ptr->pval;
2262 if (have_flag(flgs, TR_DEX)) creature_ptr->stat_add[A_DEX] += o_ptr->pval;
2263 if (have_flag(flgs, TR_CON)) creature_ptr->stat_add[A_CON] += o_ptr->pval;
2264 if (have_flag(flgs, TR_CHR)) creature_ptr->stat_add[A_CHR] += o_ptr->pval;
2266 if (have_flag(flgs, TR_MAGIC_MASTERY)) creature_ptr->skill_dev += 8 * o_ptr->pval;
2268 /* Affect stealth */
2269 if (have_flag(flgs, TR_STEALTH)) creature_ptr->skill_stl += o_ptr->pval;
2271 /* Affect searching ability (factor of five) */
2272 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_srh += (o_ptr->pval * 5);
2274 /* Affect searching frequency (factor of five) */
2275 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_fos += (o_ptr->pval * 5);
2277 /* Affect infravision */
2278 if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval;
2280 /* Affect digging (factor of 20) */
2281 if (have_flag(flgs, TR_TUNNEL)) creature_ptr->skill_dig += (o_ptr->pval * 20);
2284 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
2287 if (have_flag(flgs, TR_BLOWS))
2289 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->ryoute) extra_blows[0] += o_ptr->pval;
2290 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->ryoute) extra_blows[1] += o_ptr->pval;
2291 else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; }
2294 /* Hack -- cause earthquakes */
2295 if (have_flag(flgs, TR_IMPACT)) creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
2298 if (have_flag(flgs, TR_AGGRAVATE)) creature_ptr->cursed |= TRC_AGGRAVATE;
2299 if (have_flag(flgs, TR_DRAIN_EXP)) creature_ptr->cursed |= TRC_DRAIN_EXP;
2300 if (have_flag(flgs, TR_TY_CURSE)) creature_ptr->cursed |= TRC_TY_CURSE;
2301 if (have_flag(flgs, TR_ADD_L_CURSE)) creature_ptr->cursed |= TRC_ADD_L_CURSE;
2302 if (have_flag(flgs, TR_ADD_H_CURSE)) creature_ptr->cursed |= TRC_ADD_H_CURSE;
2303 if (have_flag(flgs, TR_DRAIN_HP)) creature_ptr->cursed |= TRC_DRAIN_HP;
2304 if (have_flag(flgs, TR_DRAIN_MANA)) creature_ptr->cursed |= TRC_DRAIN_MANA;
2305 if (have_flag(flgs, TR_CALL_ANIMAL)) creature_ptr->cursed |= TRC_CALL_ANIMAL;
2306 if (have_flag(flgs, TR_CALL_DEMON)) creature_ptr->cursed |= TRC_CALL_DEMON;
2307 if (have_flag(flgs, TR_CALL_DRAGON)) creature_ptr->cursed |= TRC_CALL_DRAGON;
2308 if (have_flag(flgs, TR_CALL_UNDEAD)) creature_ptr->cursed |= TRC_CALL_UNDEAD;
2309 if (have_flag(flgs, TR_COWARDICE)) creature_ptr->cursed |= TRC_COWARDICE;
2310 if (have_flag(flgs, TR_LOW_MELEE)) creature_ptr->cursed |= TRC_LOW_MELEE;
2311 if (have_flag(flgs, TR_LOW_AC)) creature_ptr->cursed |= TRC_LOW_AC;
2312 if (have_flag(flgs, TR_LOW_MAGIC)) creature_ptr->cursed |= TRC_LOW_MAGIC;
2313 if (have_flag(flgs, TR_FAST_DIGEST)) creature_ptr->cursed |= TRC_FAST_DIGEST;
2314 if (have_flag(flgs, TR_SLOW_REGEN)) creature_ptr->cursed |= TRC_SLOW_REGEN;
2315 if (have_flag(flgs, TR_DEC_MANA)) creature_ptr->dec_mana = TRUE;
2316 if (have_flag(flgs, TR_BLESSED)) creature_ptr->bless_blade = TRUE;
2317 if (have_flag(flgs, TR_XTRA_MIGHT)) creature_ptr->xtra_might = TRUE;
2318 if (have_flag(flgs, TR_SLOW_DIGEST)) creature_ptr->slow_digest = TRUE;
2319 if (have_flag(flgs, TR_REGEN)) creature_ptr->regenerate = TRUE;
2320 if (have_flag(flgs, TR_TELEPATHY)) creature_ptr->telepathy = TRUE;
2321 if (have_flag(flgs, TR_ESP_ANIMAL)) creature_ptr->esp_animal = TRUE;
2322 if (have_flag(flgs, TR_ESP_UNDEAD)) creature_ptr->esp_undead = TRUE;
2323 if (have_flag(flgs, TR_ESP_DEMON)) creature_ptr->esp_demon = TRUE;
2324 if (have_flag(flgs, TR_ESP_ORC)) creature_ptr->esp_orc = TRUE;
2325 if (have_flag(flgs, TR_ESP_TROLL)) creature_ptr->esp_troll = TRUE;
2326 if (have_flag(flgs, TR_ESP_GIANT)) creature_ptr->esp_giant = TRUE;
2327 if (have_flag(flgs, TR_ESP_DRAGON)) creature_ptr->esp_dragon = TRUE;
2328 if (have_flag(flgs, TR_ESP_HUMAN)) creature_ptr->esp_human = TRUE;
2329 if (have_flag(flgs, TR_ESP_EVIL)) creature_ptr->esp_evil = TRUE;
2330 if (have_flag(flgs, TR_ESP_GOOD)) creature_ptr->esp_good = TRUE;
2331 if (have_flag(flgs, TR_ESP_NONLIVING)) creature_ptr->esp_nonliving = TRUE;
2332 if (have_flag(flgs, TR_ESP_UNIQUE)) creature_ptr->esp_unique = TRUE;
2334 if (have_flag(flgs, TR_SEE_INVIS)) creature_ptr->see_inv = TRUE;
2335 if (have_flag(flgs, TR_LEVITATION)) creature_ptr->levitation = TRUE;
2336 if (have_flag(flgs, TR_FREE_ACT)) creature_ptr->free_act = TRUE;
2337 if (have_flag(flgs, TR_HOLD_EXP)) creature_ptr->hold_exp = TRUE;
2338 if (have_flag(flgs, TR_WARNING)) {
2339 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription), '$')))
2340 creature_ptr->warning = TRUE;
2343 if (have_flag(flgs, TR_TELEPORT))
2345 if (object_is_cursed(o_ptr)) creature_ptr->cursed |= TRC_TELEPORT;
2348 concptr insc = quark_str(o_ptr->inscription);
2350 if (o_ptr->inscription && my_strchr(insc, '.'))
2353 * {.} will stop random teleportation.
2358 /* Controlled random teleportation */
2359 creature_ptr->cursed |= TRC_TELEPORT_SELF;
2364 /* Immunity flags */
2365 if (have_flag(flgs, TR_IM_FIRE)) creature_ptr->immune_fire = TRUE;
2366 if (have_flag(flgs, TR_IM_ACID)) creature_ptr->immune_acid = TRUE;
2367 if (have_flag(flgs, TR_IM_COLD)) creature_ptr->immune_cold = TRUE;
2368 if (have_flag(flgs, TR_IM_ELEC)) creature_ptr->immune_elec = TRUE;
2370 /* Resistance flags */
2371 if (have_flag(flgs, TR_RES_ACID)) creature_ptr->resist_acid = TRUE;
2372 if (have_flag(flgs, TR_RES_ELEC)) creature_ptr->resist_elec = TRUE;
2373 if (have_flag(flgs, TR_RES_FIRE)) creature_ptr->resist_fire = TRUE;
2374 if (have_flag(flgs, TR_RES_COLD)) creature_ptr->resist_cold = TRUE;
2375 if (have_flag(flgs, TR_RES_POIS)) creature_ptr->resist_pois = TRUE;
2376 if (have_flag(flgs, TR_RES_FEAR)) creature_ptr->resist_fear = TRUE;
2377 if (have_flag(flgs, TR_RES_CONF)) creature_ptr->resist_conf = TRUE;
2378 if (have_flag(flgs, TR_RES_SOUND)) creature_ptr->resist_sound = TRUE;
2379 if (have_flag(flgs, TR_RES_LITE)) creature_ptr->resist_lite = TRUE;
2380 if (have_flag(flgs, TR_RES_DARK)) creature_ptr->resist_dark = TRUE;
2381 if (have_flag(flgs, TR_RES_CHAOS)) creature_ptr->resist_chaos = TRUE;
2382 if (have_flag(flgs, TR_RES_DISEN)) creature_ptr->resist_disen = TRUE;
2383 if (have_flag(flgs, TR_RES_SHARDS)) creature_ptr->resist_shard = TRUE;
2384 if (have_flag(flgs, TR_RES_NEXUS)) creature_ptr->resist_nexus = TRUE;
2385 if (have_flag(flgs, TR_RES_BLIND)) creature_ptr->resist_blind = TRUE;
2386 if (have_flag(flgs, TR_RES_NETHER)) creature_ptr->resist_neth = TRUE;
2388 if (have_flag(flgs, TR_REFLECT)) creature_ptr->reflect = TRUE;
2389 if (have_flag(flgs, TR_SH_FIRE)) creature_ptr->sh_fire = TRUE;
2390 if (have_flag(flgs, TR_SH_ELEC)) creature_ptr->sh_elec = TRUE;
2391 if (have_flag(flgs, TR_SH_COLD)) creature_ptr->sh_cold = TRUE;
2392 if (have_flag(flgs, TR_NO_MAGIC)) creature_ptr->anti_magic = TRUE;
2393 if (have_flag(flgs, TR_NO_TELE)) creature_ptr->anti_tele = TRUE;
2396 if (have_flag(flgs, TR_SUST_STR)) creature_ptr->sustain_str = TRUE;
2397 if (have_flag(flgs, TR_SUST_INT)) creature_ptr->sustain_int = TRUE;
2398 if (have_flag(flgs, TR_SUST_WIS)) creature_ptr->sustain_wis = TRUE;
2399 if (have_flag(flgs, TR_SUST_DEX)) creature_ptr->sustain_dex = TRUE;
2400 if (have_flag(flgs, TR_SUST_CON)) creature_ptr->sustain_con = TRUE;
2401 if (have_flag(flgs, TR_SUST_CHR)) creature_ptr->sustain_chr = TRUE;
2403 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
2404 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
2405 if (o_ptr->name2 == EGO_RING_RES_TIME) creature_ptr->resist_time = TRUE;
2406 if (o_ptr->name2 == EGO_RING_THROW) creature_ptr->mighty_throw = TRUE;
2407 if (have_flag(flgs, TR_EASY_SPELL)) creature_ptr->easy_spell = TRUE;
2408 if (o_ptr->name2 == EGO_AMU_FOOL) creature_ptr->heavy_spell = TRUE;
2409 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
2411 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
2413 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2415 creature_ptr->to_m_chance += 10;
2419 creature_ptr->to_m_chance += 3;
2423 if (o_ptr->tval == TV_CAPTURE) continue;
2425 /* Modify the base armor class */
2426 creature_ptr->ac += o_ptr->ac;
2428 /* The base armor class is always known */
2429 creature_ptr->dis_ac += o_ptr->ac;
2431 /* Apply the bonuses to armor class */
2432 creature_ptr->to_a += o_ptr->to_a;
2434 /* Apply the mental bonuses to armor class, if known */
2435 if (object_is_known(o_ptr)) creature_ptr->dis_to_a += o_ptr->to_a;
2437 if (o_ptr->curse_flags & TRC_LOW_MELEE)
2439 int slot = i - INVEN_RARM;
2442 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2444 creature_ptr->to_h[slot] -= 15;
2445 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h[slot] -= 15;
2449 creature_ptr->to_h[slot] -= 5;
2450 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h[slot] -= 5;
2455 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2457 creature_ptr->to_h_b -= 15;
2458 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h_b -= 15;
2462 creature_ptr->to_h_b -= 5;
2463 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_h_b -= 5;
2468 if (o_ptr->curse_flags & TRC_LOW_AC)
2470 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2472 creature_ptr->to_a -= 30;
2473 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_a -= 30;
2477 creature_ptr->to_a -= 10;
2478 if (o_ptr->ident & IDENT_MENTAL) creature_ptr->dis_to_a -= 10;
2482 /* Hack -- do not apply "weapon" bonuses */
2483 if (i == INVEN_RARM && has_melee_weapon(creature_ptr, i)) continue;
2484 if (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) continue;
2486 /* Hack -- do not apply "bow" bonuses */
2487 if (i == INVEN_BOW) continue;
2489 bonus_to_h = o_ptr->to_h;
2490 bonus_to_d = o_ptr->to_d;
2492 if (creature_ptr->pclass == CLASS_NINJA)
2494 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2;
2495 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2;
2498 /* To Bow and Natural attack */
2500 /* Apply the bonuses to hit/damage */
2501 creature_ptr->to_h_b += (s16b)bonus_to_h;
2502 creature_ptr->to_h_m += (s16b)bonus_to_h;
2503 creature_ptr->to_d_m += (s16b)bonus_to_d;
2505 /* Apply the mental bonuses tp hit/damage, if known */
2506 if (object_is_known(o_ptr)) creature_ptr->dis_to_h_b += (s16b)bonus_to_h;
2509 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !creature_ptr->ryoute)
2511 /* Apply the bonuses to hit/damage */
2512 creature_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2513 creature_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2515 /* Apply the mental bonuses tp hit/damage, if known */
2516 if (object_is_known(o_ptr))
2518 creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2519 creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2525 if (creature_ptr->migite && creature_ptr->hidarite)
2527 /* Apply the bonuses to hit/damage */
2528 creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2529 creature_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2530 creature_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2531 creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2533 /* Apply the mental bonuses tp hit/damage, if known */
2534 if (!object_is_known(o_ptr)) continue;
2536 creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2537 creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2538 creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2539 creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2543 /* Apply the bonuses to hit/damage */
2544 creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
2545 creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
2547 /* Apply the mental bonuses to hit/damage, if known */
2548 if (!object_is_known(o_ptr)) continue;
2550 creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
2551 creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
2554 /* Shield skill bonus */
2555 if (object_is_armour(&creature_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&creature_ptr->inventory_list[INVEN_LARM]))
2557 creature_ptr->ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2558 creature_ptr->dis_ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2561 if (old_mighty_throw != creature_ptr->mighty_throw)
2563 /* Redraw average damege display of Shuriken */
2564 creature_ptr->window |= PW_INVEN;
2567 if (creature_ptr->cursed & TRC_TELEPORT) creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
2569 /* Monks get extra ac for armour _not worn_ */
2570 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr))
2572 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx))
2574 creature_ptr->to_a += (creature_ptr->lev * 3) / 2;
2575 creature_ptr->dis_to_a += (creature_ptr->lev * 3) / 2;
2577 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15))
2579 creature_ptr->to_a += ((creature_ptr->lev - 13) / 3);
2580 creature_ptr->dis_to_a += ((creature_ptr->lev - 13) / 3);
2582 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10))
2584 creature_ptr->to_a += ((creature_ptr->lev - 8) / 3);
2585 creature_ptr->dis_to_a += ((creature_ptr->lev - 8) / 3);
2587 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4))
2589 creature_ptr->to_a += (creature_ptr->lev - 2) / 3;
2590 creature_ptr->dis_to_a += (creature_ptr->lev - 2) / 3;
2592 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx))
2594 creature_ptr->to_a += (creature_ptr->lev / 2);
2595 creature_ptr->dis_to_a += (creature_ptr->lev / 2);
2597 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx))
2599 creature_ptr->to_a += (creature_ptr->lev / 3);
2600 creature_ptr->dis_to_a += (creature_ptr->lev / 3);
2602 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2604 creature_ptr->stat_add[A_STR] += 2;
2605 creature_ptr->stat_add[A_DEX] += 2;
2606 creature_ptr->stat_add[A_CON] -= 3;
2608 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2611 else if (creature_ptr->special_defense & KAMAE_GENBU)
2613 creature_ptr->stat_add[A_INT] -= 1;
2614 creature_ptr->stat_add[A_WIS] -= 1;
2615 creature_ptr->stat_add[A_DEX] -= 2;
2616 creature_ptr->stat_add[A_CON] += 3;
2618 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2620 creature_ptr->stat_add[A_STR] -= 2;
2621 creature_ptr->stat_add[A_INT] += 1;
2622 creature_ptr->stat_add[A_WIS] += 1;
2623 creature_ptr->stat_add[A_DEX] += 2;
2624 creature_ptr->stat_add[A_CON] -= 2;
2628 if (creature_ptr->special_defense & KATA_KOUKIJIN)
2630 for (int i = 0; i < A_MAX; i++)
2631 creature_ptr->stat_add[i] += 5;
2632 creature_ptr->to_a -= 50;
2633 creature_ptr->dis_to_a -= 50;
2636 /* Hack -- aura of fire also provides light */
2637 if (creature_ptr->sh_fire) creature_ptr->lite = TRUE;
2639 /* Golems also get an intrinsic AC bonus */
2640 if (PRACE_IS_(creature_ptr, RACE_GOLEM) || PRACE_IS_(creature_ptr, RACE_ANDROID))
2642 creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
2643 creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
2647 if (creature_ptr->realm1 == REALM_HEX)
2649 if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + CASTING_HEX_NUM(creature_ptr));
2650 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
2651 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
2652 if (hex_spelling(creature_ptr, HEX_BUILDING))
2654 creature_ptr->stat_add[A_STR] += 4;
2655 creature_ptr->stat_add[A_DEX] += 4;
2656 creature_ptr->stat_add[A_CON] += 4;
2659 if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
2661 creature_ptr->sh_fire = TRUE;
2662 creature_ptr->regenerate = TRUE;
2665 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
2667 creature_ptr->sh_cold = TRUE;
2668 creature_ptr->to_a += 30;
2669 creature_ptr->dis_to_a += 30;
2672 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
2674 creature_ptr->sh_elec = TRUE;
2678 for (int i = INVEN_RARM; i <= INVEN_FEET; i++)
2680 ARMOUR_CLASS ac = 0;
2681 o_ptr = &creature_ptr->inventory_list[i];
2682 if (!o_ptr->k_idx) continue;
2683 if (!object_is_armour(o_ptr)) continue;
2684 if (!object_is_cursed(o_ptr)) continue;
2686 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
2687 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
2688 creature_ptr->to_a += (s16b)ac;
2689 creature_ptr->dis_to_a += (s16b)ac;
2693 /* Calculate stats */
2695 for (int i = 0; i < A_MAX; i++)
2699 /* Extract the new "stat_use" value for the stat */
2700 top = modify_stat_value(creature_ptr->stat_max[i], creature_ptr->stat_add[i]);
2702 /* Notice changes */
2703 if (creature_ptr->stat_top[i] != top)
2705 /* Save the new value */
2706 creature_ptr->stat_top[i] = (s16b)top;
2707 creature_ptr->redraw |= (PR_STATS);
2708 creature_ptr->window |= (PW_PLAYER);
2711 /* Extract the new "stat_use" value for the stat */
2712 use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
2714 if ((i == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM))
2716 /* 10 to 18/90 charisma, guaranteed, based on level */
2717 if (use < 8 + 2 * creature_ptr->lev)
2719 use = 8 + 2 * creature_ptr->lev;
2723 /* Notice changes */
2724 if (creature_ptr->stat_use[i] != use)
2726 /* Save the new value */
2727 creature_ptr->stat_use[i] = (s16b)use;
2728 creature_ptr->redraw |= (PR_STATS);
2729 creature_ptr->window |= (PW_PLAYER);
2732 /* Values: 3, 4, ..., 17 */
2733 if (use <= 18) ind = (use - 3);
2735 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
2736 else if (use <= 18 + 219) ind = (15 + (use - 18) / 10);
2738 /* Range: 18/220+ */
2741 /* Notice changes */
2742 if (creature_ptr->stat_ind[i] == ind) continue;
2744 /* Save the new index */
2745 creature_ptr->stat_ind[i] = (s16b)ind;
2747 /* Change in CON affects Hitpoints */
2750 creature_ptr->update |= (PU_HP);
2753 /* Change in INT may affect Mana/Spells */
2754 else if (i == A_INT)
2756 if (mp_ptr->spell_stat == A_INT)
2758 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2762 /* Change in WIS may affect Mana/Spells */
2763 else if (i == A_WIS)
2765 if (mp_ptr->spell_stat == A_WIS)
2767 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2771 /* Change in WIS may affect Mana/Spells */
2772 else if (i == A_CHR)
2774 if (mp_ptr->spell_stat == A_CHR)
2776 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2780 creature_ptr->window |= (PW_PLAYER);
2784 /* Apply temporary "stun" */
2785 if (creature_ptr->stun > 50)
2787 creature_ptr->to_h[0] -= 20;
2788 creature_ptr->to_h[1] -= 20;
2789 creature_ptr->to_h_b -= 20;
2790 creature_ptr->to_h_m -= 20;
2791 creature_ptr->dis_to_h[0] -= 20;
2792 creature_ptr->dis_to_h[1] -= 20;
2793 creature_ptr->dis_to_h_b -= 20;
2794 creature_ptr->to_d[0] -= 20;
2795 creature_ptr->to_d[1] -= 20;
2796 creature_ptr->to_d_m -= 20;
2797 creature_ptr->dis_to_d[0] -= 20;
2798 creature_ptr->dis_to_d[1] -= 20;
2800 else if (creature_ptr->stun)
2802 creature_ptr->to_h[0] -= 5;
2803 creature_ptr->to_h[1] -= 5;
2804 creature_ptr->to_h_b -= 5;
2805 creature_ptr->to_h_m -= 5;
2806 creature_ptr->dis_to_h[0] -= 5;
2807 creature_ptr->dis_to_h[1] -= 5;
2808 creature_ptr->dis_to_h_b -= 5;
2809 creature_ptr->to_d[0] -= 5;
2810 creature_ptr->to_d[1] -= 5;
2811 creature_ptr->to_d_m -= 5;
2812 creature_ptr->dis_to_d[0] -= 5;
2813 creature_ptr->dis_to_d[1] -= 5;
2817 if (creature_ptr->wraith_form)
2819 creature_ptr->reflect = TRUE;
2820 creature_ptr->pass_wall = TRUE;
2823 if (creature_ptr->kabenuke)
2825 creature_ptr->pass_wall = TRUE;
2828 /* Temporary blessing */
2829 if (is_blessed(creature_ptr))
2831 creature_ptr->to_a += 5;
2832 creature_ptr->dis_to_a += 5;
2833 creature_ptr->to_h[0] += 10;
2834 creature_ptr->to_h[1] += 10;
2835 creature_ptr->to_h_b += 10;
2836 creature_ptr->to_h_m += 10;
2837 creature_ptr->dis_to_h[0] += 10;
2838 creature_ptr->dis_to_h[1] += 10;
2839 creature_ptr->dis_to_h_b += 10;
2842 if (creature_ptr->magicdef)
2844 creature_ptr->resist_blind = TRUE;
2845 creature_ptr->resist_conf = TRUE;
2846 creature_ptr->reflect = TRUE;
2847 creature_ptr->free_act = TRUE;
2848 creature_ptr->levitation = TRUE;
2851 /* Temporary "Hero" */
2852 if (IS_HERO(creature_ptr))
2854 creature_ptr->to_h[0] += 12;
2855 creature_ptr->to_h[1] += 12;
2856 creature_ptr->to_h_b += 12;
2857 creature_ptr->to_h_m += 12;
2858 creature_ptr->dis_to_h[0] += 12;
2859 creature_ptr->dis_to_h[1] += 12;
2860 creature_ptr->dis_to_h_b += 12;
2863 /* Temporary "Beserk" */
2864 if (creature_ptr->shero)
2866 creature_ptr->to_h[0] += 12;
2867 creature_ptr->to_h[1] += 12;
2868 creature_ptr->to_h_b -= 12;
2869 creature_ptr->to_h_m += 12;
2870 creature_ptr->to_d[0] += 3 + (creature_ptr->lev / 5);
2871 creature_ptr->to_d[1] += 3 + (creature_ptr->lev / 5);
2872 creature_ptr->to_d_m += 3 + (creature_ptr->lev / 5);
2873 creature_ptr->dis_to_h[0] += 12;
2874 creature_ptr->dis_to_h[1] += 12;
2875 creature_ptr->dis_to_h_b -= 12;
2876 creature_ptr->dis_to_d[0] += 3 + (creature_ptr->lev / 5);
2877 creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
2878 creature_ptr->to_a -= 10;
2879 creature_ptr->dis_to_a -= 10;
2880 creature_ptr->skill_stl -= 7;
2881 creature_ptr->skill_dev -= 20;
2882 creature_ptr->skill_sav -= 30;
2883 creature_ptr->skill_srh -= 15;
2884 creature_ptr->skill_fos -= 15;
2885 creature_ptr->skill_tht -= 20;
2886 creature_ptr->skill_dig += 30;
2889 /* Temporary "fast" */
2890 if (IS_FAST(creature_ptr))
2895 /* Temporary "slow" */
2896 if (creature_ptr->slow)
2901 /* Temporary "telepathy" */
2902 if (is_time_limit_esp(creature_ptr))
2904 creature_ptr->telepathy = TRUE;
2907 if (creature_ptr->ele_immune)
2909 if (creature_ptr->special_defense & DEFENSE_ACID)
2910 creature_ptr->immune_acid = TRUE;
2911 else if (creature_ptr->special_defense & DEFENSE_ELEC)
2912 creature_ptr->immune_elec = TRUE;
2913 else if (creature_ptr->special_defense & DEFENSE_FIRE)
2914 creature_ptr->immune_fire = TRUE;
2915 else if (creature_ptr->special_defense & DEFENSE_COLD)
2916 creature_ptr->immune_cold = TRUE;
2919 /* Temporary see invisible */
2920 if (creature_ptr->tim_invis)
2922 creature_ptr->see_inv = TRUE;
2925 /* Temporary infravision boost */
2926 if (creature_ptr->tim_infra)
2928 creature_ptr->see_infra += 3;
2931 /* Temporary regeneration boost */
2932 if (creature_ptr->tim_regen)
2934 creature_ptr->regenerate = TRUE;
2937 /* Temporary levitation */
2938 if (creature_ptr->tim_levitation)
2940 creature_ptr->levitation = TRUE;
2943 /* Temporary reflection */
2944 if (creature_ptr->tim_reflect)
2946 creature_ptr->reflect = TRUE;
2949 /* Hack -- Hero/Shero -> Res fear */
2950 if (IS_HERO(creature_ptr) || creature_ptr->shero)
2952 creature_ptr->resist_fear = TRUE;
2955 /* Hack -- Telepathy Change */
2956 if (creature_ptr->telepathy != old_telepathy)
2958 creature_ptr->update |= (PU_MONSTERS);
2961 if ((creature_ptr->esp_animal != old_esp_animal) ||
2962 (creature_ptr->esp_undead != old_esp_undead) ||
2963 (creature_ptr->esp_demon != old_esp_demon) ||
2964 (creature_ptr->esp_orc != old_esp_orc) ||
2965 (creature_ptr->esp_troll != old_esp_troll) ||
2966 (creature_ptr->esp_giant != old_esp_giant) ||
2967 (creature_ptr->esp_dragon != old_esp_dragon) ||
2968 (creature_ptr->esp_human != old_esp_human) ||
2969 (creature_ptr->esp_evil != old_esp_evil) ||
2970 (creature_ptr->esp_good != old_esp_good) ||
2971 (creature_ptr->esp_nonliving != old_esp_nonliving) ||
2972 (creature_ptr->esp_unique != old_esp_unique))
2974 creature_ptr->update |= (PU_MONSTERS);
2977 /* Hack -- See Invis Change */
2978 if (creature_ptr->see_inv != old_see_inv)
2980 creature_ptr->update |= (PU_MONSTERS);
2983 /* Bloating slows the player down (a little) */
2984 if (creature_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
2986 if (creature_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
2988 if ((creature_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
2989 (creature_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
2991 creature_ptr->to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2992 creature_ptr->dis_to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2995 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2997 int penalty1, penalty2;
2998 penalty1 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_RARM].weight) / 8);
2999 penalty2 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_LARM].weight) / 8);
3000 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
3002 penalty1 = penalty1 / 2 - 5;
3003 penalty2 = penalty2 / 2 - 5;
3005 creature_ptr->to_a += 10;
3006 creature_ptr->dis_to_a += 10;
3010 if (penalty1 > 0) penalty1 /= 2;
3011 if (penalty2 > 0) penalty2 /= 2;
3013 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)))
3015 penalty1 = MAX(0, penalty1 - 10);
3016 penalty2 = MAX(0, penalty2 - 10);
3018 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
3020 penalty1 = MIN(0, penalty1);
3021 penalty2 = MIN(0, penalty2);
3022 creature_ptr->to_a += 10;
3023 creature_ptr->dis_to_a += 10;
3027 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
3029 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
3033 if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
3034 if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
3035 creature_ptr->to_h[0] -= (s16b)penalty1;
3036 creature_ptr->to_h[1] -= (s16b)penalty2;
3037 creature_ptr->dis_to_h[0] -= (s16b)penalty1;
3038 creature_ptr->dis_to_h[1] -= (s16b)penalty2;
3041 /* Extract the current weight (in tenth pounds) */
3042 int j = creature_ptr->total_weight;
3044 if (!creature_ptr->riding)
3046 /* Extract the "weight limit" (in tenth pounds) */
3047 count = (int)weight_limit(creature_ptr);
3051 monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
3052 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
3053 SPEED speed = riding_m_ptr->mspeed;
3055 if (riding_m_ptr->mspeed > 110)
3057 new_speed = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
3058 if (new_speed < 110) new_speed = 110;
3064 new_speed += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
3065 if (MON_FAST(riding_m_ptr)) new_speed += 10;
3066 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
3067 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
3068 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) creature_ptr->can_swim = TRUE;
3070 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) creature_ptr->pass_wall = FALSE;
3071 if (riding_r_ptr->flags2 & RF2_KILL_WALL) creature_ptr->kill_wall = TRUE;
3073 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;
3075 /* Extract the "weight limit" */
3076 count = 1500 + riding_r_ptr->level * 25;
3079 /* Apply "encumbrance" from weight */
3080 if (j > count) new_speed -= ((j - count) / (count / 5));
3082 /* Searching slows the player down */
3083 if (creature_ptr->action == ACTION_SEARCH) new_speed -= 10;
3086 if (creature_ptr->prace == RACE_MERFOLK)
3088 if (have_flag(f_ptr->flags, FF_WATER))
3090 new_speed += (2 + creature_ptr->lev / 10);
3092 else if (!creature_ptr->levitation)
3098 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
3099 creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
3100 creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3101 creature_ptr->to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3102 creature_ptr->to_d_m += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3103 creature_ptr->to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3104 creature_ptr->to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3105 creature_ptr->to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3106 creature_ptr->to_h_m += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3107 creature_ptr->to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3108 creature_ptr->to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3109 creature_ptr->to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3110 creature_ptr->to_h_m += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3112 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
3113 creature_ptr->dis_to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
3114 creature_ptr->dis_to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3115 creature_ptr->dis_to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
3116 creature_ptr->dis_to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3117 creature_ptr->dis_to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3118 creature_ptr->dis_to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
3119 creature_ptr->dis_to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3120 creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3121 creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
3123 /* Obtain the "hold" value */
3124 hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
3126 /* Examine the "current bow" */
3127 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
3129 /* It is hard to carholdry a heavy bow */
3130 creature_ptr->heavy_shoot = is_heavy_shoot(creature_ptr, o_ptr);
3131 if (creature_ptr->heavy_shoot)
3133 /* Hard to wield a heavy bow */
3134 creature_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
3135 creature_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
3138 /* Compute "extra shots" if needed */
3141 creature_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr);
3143 /* Apply special flags */
3144 if (o_ptr->k_idx && !creature_ptr->heavy_shoot)
3147 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
3149 /* Snipers love Cross bows */
3150 if ((creature_ptr->pclass == CLASS_SNIPER) &&
3151 (creature_ptr->tval_ammo == TV_BOLT))
3153 creature_ptr->to_h_b += (10 + (creature_ptr->lev / 5));
3154 creature_ptr->dis_to_h_b += (10 + (creature_ptr->lev / 5));
3159 if (creature_ptr->ryoute) hold *= 2;
3161 for (int i = 0; i < 2; i++)
3163 /* Examine the "main weapon" */
3164 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
3166 object_flags(o_ptr, flgs);
3168 /* Assume not heavy */
3169 creature_ptr->heavy_wield[i] = FALSE;
3170 creature_ptr->icky_wield[i] = FALSE;
3171 creature_ptr->riding_wield[i] = FALSE;
3173 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
3175 creature_ptr->num_blow[i] = 1;
3179 /* It is hard to hold a heavy weapon */
3180 if (hold < o_ptr->weight / 10)
3182 /* Hard to wield a heavy weapon */
3183 creature_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
3184 creature_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
3187 creature_ptr->heavy_wield[i] = TRUE;
3189 else if (creature_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE;
3191 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
3193 creature_ptr->to_a += 5;
3194 creature_ptr->dis_to_a += 5;
3197 /* Normal weapons */
3198 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i])
3200 int str_index, dex_index;
3202 int num = 0, wgt = 0, mul = 0, div = 0;
3204 /* Analyze the class */
3205 switch (creature_ptr->pclass)
3208 num = 6; wgt = 70; mul = 5; break;
3210 case CLASS_BERSERKER:
3211 num = 6; wgt = 70; mul = 7; break;
3214 case CLASS_HIGH_MAGE:
3215 case CLASS_BLUE_MAGE:
3216 num = 3; wgt = 100; mul = 2; break;
3219 case CLASS_MAGIC_EATER:
3220 case CLASS_MINDCRAFTER:
3221 num = 5; wgt = 100; mul = 3; break;
3224 num = 5; wgt = 40; mul = 3; break;
3227 num = 5; wgt = 70; mul = 4; break;
3231 num = 5; wgt = 70; mul = 4; break;
3234 num = 5; wgt = 150; mul = 5; break;
3236 case CLASS_WARRIOR_MAGE:
3237 case CLASS_RED_MAGE:
3238 num = 5; wgt = 70; mul = 3; break;
3240 case CLASS_CHAOS_WARRIOR:
3241 num = 5; wgt = 70; mul = 4; break;
3244 num = 5; wgt = 60; mul = 3; break;
3247 num = 4; wgt = 100; mul = 3; break;
3249 case CLASS_IMITATOR:
3250 num = 5; wgt = 70; mul = 4; break;
3252 case CLASS_BEASTMASTER:
3253 num = 5; wgt = 70; mul = 3; break;
3256 if ((creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
3257 else { num = 5; wgt = 100; mul = 3; }
3260 case CLASS_SORCERER:
3261 num = 1; wgt = 1; mul = 1; break;
3266 num = 4; wgt = 70; mul = 2; break;
3268 case CLASS_FORCETRAINER:
3269 num = 4; wgt = 60; mul = 2; break;
3271 case CLASS_MIRROR_MASTER:
3272 num = 3; wgt = 100; mul = 3; break;
3275 num = 4; wgt = 20; mul = 1; break;
3278 /* Hex - extra mights gives +1 bonus to max blows */
3279 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
3281 /* Enforce a minimum "weight" (tenth pounds) */
3282 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
3284 /* Access the strength vs weight */
3285 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
3287 if (creature_ptr->ryoute && !omoi) str_index++;
3288 if (creature_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1);
3291 if (str_index > 11) str_index = 11;
3293 /* Index by dexterity */
3294 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
3297 if (dex_index > 11) dex_index = 11;
3299 /* Use the blows table */
3300 creature_ptr->num_blow[i] = blows_table[str_index][dex_index];
3303 if (creature_ptr->num_blow[i] > num) creature_ptr->num_blow[i] = (s16b)num;
3305 /* Add in the "bonus blows" */
3306 creature_ptr->num_blow[i] += (s16b)extra_blows[i];
3309 if (creature_ptr->pclass == CLASS_WARRIOR) creature_ptr->num_blow[i] += (creature_ptr->lev / 40);
3310 else if (creature_ptr->pclass == CLASS_BERSERKER)
3312 creature_ptr->num_blow[i] += (creature_ptr->lev / 23);
3314 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30)) creature_ptr->num_blow[i] ++;
3316 if (creature_ptr->special_defense & KATA_FUUJIN) creature_ptr->num_blow[i] -= 1;
3318 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) creature_ptr->num_blow[i] = 1;
3321 /* Require at least one blow */
3322 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3324 /* Boost digging skill by weapon weight */
3325 creature_ptr->skill_dig += (o_ptr->weight / 10);
3329 /* Priest weapon penalty for non-blessed edged weapons */
3330 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
3331 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
3333 /* Reduce the real bonuses */
3334 creature_ptr->to_h[i] -= 2;
3335 creature_ptr->to_d[i] -= 2;
3337 /* Reduce the mental bonuses */
3338 creature_ptr->dis_to_h[i] -= 2;
3339 creature_ptr->dis_to_d[i] -= 2;
3342 creature_ptr->icky_wield[i] = TRUE;
3344 else if (creature_ptr->pclass == CLASS_BERSERKER)
3346 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3347 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3348 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3349 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3350 if (((i == 0) && !creature_ptr->hidarite) || creature_ptr->ryoute)
3352 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3353 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3354 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3355 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3358 else if (creature_ptr->pclass == CLASS_SORCERER)
3360 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
3362 /* Reduce the real bonuses */
3363 creature_ptr->to_h[i] -= 200;
3364 creature_ptr->to_d[i] -= 200;
3366 /* Reduce the mental bonuses */
3367 creature_ptr->dis_to_h[i] -= 200;
3368 creature_ptr->dis_to_d[i] -= 200;
3371 creature_ptr->icky_wield[i] = TRUE;
3375 /* Reduce the real bonuses */
3376 creature_ptr->to_h[i] -= 30;
3377 creature_ptr->to_d[i] -= 10;
3379 /* Reduce the mental bonuses */
3380 creature_ptr->dis_to_h[i] -= 30;
3381 creature_ptr->dis_to_d[i] -= 10;
3386 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr))
3388 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3389 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
3390 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
3391 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3392 if (hex_spelling(creature_ptr, HEX_RUNESWORD))
3394 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
3395 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
3396 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
3400 if (creature_ptr->riding == 0) continue;
3402 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3404 creature_ptr->to_h[i] += 15;
3405 creature_ptr->dis_to_h[i] += 15;
3406 creature_ptr->to_dd[i] += 2;
3410 if (have_flag(flgs, TR_RIDING)) continue;
3413 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3419 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3421 if (penalty < 30) penalty = 30;
3424 creature_ptr->to_h[i] -= (s16b)penalty;
3425 creature_ptr->dis_to_h[i] -= (s16b)penalty;
3428 creature_ptr->riding_wield[i] = TRUE;
3431 if (creature_ptr->riding)
3435 creature_ptr->riding_ryoute = FALSE;
3437 if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
3438 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
3440 switch (creature_ptr->pclass)
3443 case CLASS_FORCETRAINER:
3444 case CLASS_BERSERKER:
3445 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
3446 creature_ptr->riding_ryoute = TRUE;
3451 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3453 if (creature_ptr->tval_ammo != TV_ARROW) penalty = 5;
3457 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3459 if (penalty < 30) penalty = 30;
3462 if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
3463 creature_ptr->to_h_b -= (s16b)penalty;
3464 creature_ptr->dis_to_h_b -= (s16b)penalty;
3467 /* Different calculation for monks with empty hands */
3468 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) &&
3469 (empty_hands_status & EMPTY_HAND_RARM) && !creature_ptr->hidarite)
3471 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
3472 creature_ptr->num_blow[0] = 0;
3474 if (creature_ptr->pclass == CLASS_FORCETRAINER)
3476 if (blow_base > 18) creature_ptr->num_blow[0]++;
3477 if (blow_base > 31) creature_ptr->num_blow[0]++;
3478 if (blow_base > 44) creature_ptr->num_blow[0]++;
3479 if (blow_base > 58) creature_ptr->num_blow[0]++;
3482 creature_ptr->to_d[0] += P_PTR_KI / 5;
3483 creature_ptr->dis_to_d[0] += P_PTR_KI / 5;
3488 if (blow_base > 12) creature_ptr->num_blow[0]++;
3489 if (blow_base > 22) creature_ptr->num_blow[0]++;
3490 if (blow_base > 31) creature_ptr->num_blow[0]++;
3491 if (blow_base > 39) creature_ptr->num_blow[0]++;
3492 if (blow_base > 46) creature_ptr->num_blow[0]++;
3493 if (blow_base > 53) creature_ptr->num_blow[0]++;
3494 if (blow_base > 59) creature_ptr->num_blow[0]++;
3497 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
3498 creature_ptr->num_blow[0] /= 2;
3501 creature_ptr->to_h[0] += (creature_ptr->lev / 3);
3502 creature_ptr->dis_to_h[0] += (creature_ptr->lev / 3);
3504 creature_ptr->to_d[0] += (creature_ptr->lev / 6);
3505 creature_ptr->dis_to_d[0] += (creature_ptr->lev / 6);
3508 if (creature_ptr->special_defense & KAMAE_BYAKKO)
3510 creature_ptr->to_a -= 40;
3511 creature_ptr->dis_to_a -= 40;
3514 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
3516 creature_ptr->to_a -= 50;
3517 creature_ptr->dis_to_a -= 50;
3518 creature_ptr->resist_acid = TRUE;
3519 creature_ptr->resist_fire = TRUE;
3520 creature_ptr->resist_elec = TRUE;
3521 creature_ptr->resist_cold = TRUE;
3522 creature_ptr->resist_pois = TRUE;
3523 creature_ptr->sh_fire = TRUE;
3524 creature_ptr->sh_elec = TRUE;
3525 creature_ptr->sh_cold = TRUE;
3526 creature_ptr->levitation = TRUE;
3528 else if (creature_ptr->special_defense & KAMAE_GENBU)
3530 creature_ptr->to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3531 creature_ptr->dis_to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3532 creature_ptr->reflect = TRUE;
3533 creature_ptr->num_blow[0] -= 2;
3534 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42)) creature_ptr->num_blow[0]--;
3535 if (creature_ptr->num_blow[0] < 0) creature_ptr->num_blow[0] = 0;
3537 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
3539 creature_ptr->to_h[0] -= (creature_ptr->lev / 3);
3540 creature_ptr->to_d[0] -= (creature_ptr->lev / 6);
3542 creature_ptr->dis_to_h[0] -= (creature_ptr->lev / 3);
3543 creature_ptr->dis_to_d[0] -= (creature_ptr->lev / 6);
3544 creature_ptr->num_blow[0] /= 2;
3545 creature_ptr->levitation = TRUE;
3548 creature_ptr->num_blow[0] += 1 + extra_blows[0];
3551 if (creature_ptr->riding) creature_ptr->levitation = riding_levitation;
3553 creature_ptr->monk_armour_aux = FALSE;
3555 if (heavy_armor(creature_ptr))
3557 creature_ptr->monk_armour_aux = TRUE;
3560 for (int i = 0; i < 2; i++)
3562 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3564 OBJECT_TYPE_VALUE tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
3565 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
3567 creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3568 creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3569 if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
3571 if (!s_info[creature_ptr->pclass].w_max[tval][sval])
3573 creature_ptr->to_h[i] -= 40;
3574 creature_ptr->dis_to_h[i] -= 40;
3575 creature_ptr->icky_wield[i] = TRUE;
3581 if (creature_ptr->pclass != CLASS_NINJA) continue;
3583 if ((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD))
3586 creature_ptr->to_h[i] -= 40;
3587 creature_ptr->dis_to_h[i] -= 40;
3588 creature_ptr->icky_wield[i] = TRUE;
3589 creature_ptr->num_blow[i] /= 2;
3590 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3593 /* Maximum speed is (+99). (internally it's 110 + 99) */
3594 /* Temporary lightspeed forces to be maximum speed */
3595 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (new_speed > 209))
3600 /* Minimum speed is (-99). (internally it's 110 - 99) */
3601 if (new_speed < 11) new_speed = 11;
3603 /* Display the speed (if needed) */
3604 if (creature_ptr->pspeed != (byte)new_speed)
3606 creature_ptr->pspeed = (byte)new_speed;
3607 creature_ptr->redraw |= (PR_SPEED);
3612 if (creature_ptr->to_a > (0 - creature_ptr->ac))
3613 creature_ptr->to_a = 0 - creature_ptr->ac;
3614 if (creature_ptr->dis_to_a > (0 - creature_ptr->dis_ac))
3615 creature_ptr->dis_to_a = 0 - creature_ptr->dis_ac;
3618 /* Redraw armor (if needed) */
3619 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a))
3621 creature_ptr->redraw |= (PR_ARMOR);
3622 creature_ptr->window |= (PW_PLAYER);
3625 if (creature_ptr->ryoute && !omoi)
3627 int bonus_to_h = 0, bonus_to_d = 0;
3628 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3629 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);
3631 creature_ptr->to_h[default_hand] += MAX(bonus_to_h, 1);
3632 creature_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1);
3633 creature_ptr->to_d[default_hand] += MAX(bonus_to_d, 1);
3634 creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
3637 bool is_special_class = creature_ptr->pclass == CLASS_MONK;
3638 is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
3639 is_special_class |= creature_ptr->pclass == CLASS_BERSERKER;
3640 if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
3641 creature_ptr->ryoute = FALSE;
3643 /* Affect Skill -- stealth (bonus one) */
3644 creature_ptr->skill_stl += 1;
3646 if (is_time_limit_stealth(creature_ptr)) creature_ptr->skill_stl += 99;
3648 /* Affect Skill -- disarming (DEX and INT) */
3649 creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
3650 creature_ptr->skill_dis += adj_int_dis[creature_ptr->stat_ind[A_INT]];
3652 /* Affect Skill -- magic devices (INT) */
3653 creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
3655 /* Affect Skill -- saving throw (WIS) */
3656 creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
3658 /* Affect Skill -- digging (STR) */
3659 creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
3661 /* Affect Skill -- disarming (Level, by Class) */
3662 creature_ptr->skill_dis += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
3664 /* Affect Skill -- magic devices (Level, by Class) */
3665 creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
3667 /* Affect Skill -- saving throw (Level, by Class) */
3668 creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
3670 /* Affect Skill -- stealth (Level, by Class) */
3671 creature_ptr->skill_stl += (cp_ptr->x_stl * creature_ptr->lev / 10);
3673 /* Affect Skill -- search ability (Level, by Class) */
3674 creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
3676 /* Affect Skill -- search frequency (Level, by Class) */
3677 creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
3679 /* Affect Skill -- combat (normal) (Level, by Class) */
3680 creature_ptr->skill_thn += ((cp_ptr->x_thn * creature_ptr->lev / 10) + (ap_ptr->a_thn * creature_ptr->lev / 50));
3682 /* Affect Skill -- combat (shooting) (Level, by Class) */
3683 creature_ptr->skill_thb += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3685 /* Affect Skill -- combat (throwing) (Level, by Class) */
3686 creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3688 if ((PRACE_IS_(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != SEIKAKU_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
3690 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
3691 creature_ptr->skill_stl = MIN(creature_ptr->skill_stl - 3, (creature_ptr->skill_stl + 2) / 2);
3694 /* Limit Skill -- stealth from 0 to 30 */
3695 if (creature_ptr->skill_stl > 30) creature_ptr->skill_stl = 30;
3696 if (creature_ptr->skill_stl < 0) creature_ptr->skill_stl = 0;
3698 /* Limit Skill -- digging from 1 up */
3699 if (creature_ptr->skill_dig < 1) creature_ptr->skill_dig = 1;
3701 if (creature_ptr->anti_magic && (creature_ptr->skill_sav < (90 + creature_ptr->lev))) creature_ptr->skill_sav = 90 + creature_ptr->lev;
3703 if (creature_ptr->tsubureru) creature_ptr->skill_sav = 10;
3705 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;
3707 if (down_saving) creature_ptr->skill_sav /= 2;
3709 /* Hack -- Each elemental immunity includes resistance */
3710 if (creature_ptr->immune_acid) creature_ptr->resist_acid = TRUE;
3711 if (creature_ptr->immune_elec) creature_ptr->resist_elec = TRUE;
3712 if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
3713 if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
3715 /* Hack -- handle "xtra" mode */
3716 if (current_world_ptr->character_xtra) return;
3718 /* Take note when "heavy bow" changes */
3719 if (creature_ptr->old_heavy_shoot != creature_ptr->heavy_shoot)
3721 if (creature_ptr->heavy_shoot)
3723 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
3725 else if (creature_ptr->inventory_list[INVEN_BOW].k_idx)
3727 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
3731 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
3734 creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
3737 for (int i = 0; i < 2; i++)
3739 /* Take note when "heavy weapon" changes */
3740 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
3742 if (creature_ptr->heavy_wield[i])
3744 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
3746 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3748 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
3750 else if (creature_ptr->heavy_wield[1 - i])
3752 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
3756 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
3759 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
3762 /* Take note when "heavy weapon" changes */
3763 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i])
3765 if (creature_ptr->riding_wield[i])
3767 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
3769 else if (!creature_ptr->riding)
3771 msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding."));
3773 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3775 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
3778 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
3781 /* Take note when "illegal weapon" changes */
3782 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i]) continue;
3784 if (creature_ptr->icky_wield[i])
3786 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
3787 if (current_world_ptr->is_loading_now)
3789 chg_virtue(creature_ptr, V_FAITH, -1);
3792 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3794 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
3798 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
3801 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
3804 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
3806 if (creature_ptr->riding_ryoute)
3809 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
3811 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
3817 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
3819 msg_print("You began to control riding pet with one hand.");
3823 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
3826 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))
3828 if (heavy_armor(creature_ptr))
3830 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
3831 if (current_world_ptr->is_loading_now)
3833 chg_virtue(creature_ptr, V_HARMONY, -1);
3838 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
3841 creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
3844 for (int i = 0; i < INVEN_PACK; i++)
3846 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
3847 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
3850 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)
3852 o_ptr = &floor_ptr->o_list[this_o_idx];
3853 next_o_idx = o_ptr->next_o_idx;
3855 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
3856 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
3859 if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
3861 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
3863 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
3864 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3867 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER)))
3869 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE];
3870 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3875 static void calc_alignment(player_type *creature_ptr)
3877 creature_ptr->align = 0;
3878 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3879 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
3881 monster_type *m_ptr;
3882 monster_race *r_ptr;
3883 m_ptr = &floor_ptr->m_list[m_idx];
3884 if (!monster_is_valid(m_ptr)) continue;
3885 r_ptr = &r_info[m_ptr->r_idx];
3887 if (!is_pet(m_ptr)) continue;
3889 if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3890 if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
3893 if (creature_ptr->mimic_form)
3895 switch (creature_ptr->mimic_form)
3898 creature_ptr->align -= 200;
3900 case MIMIC_DEMON_LORD:
3901 creature_ptr->align -= 200;
3907 switch (creature_ptr->prace)
3910 creature_ptr->align += 200;
3913 creature_ptr->align -= 200;
3918 for (int i = 0; i < 2; i++)
3920 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3921 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL) continue;
3922 creature_ptr->align -= 1000;
3925 /* Determine player alignment */
3928 for (int i = 0; i < 8; i++)
3930 switch (creature_ptr->vir_types[i])
3933 creature_ptr->align += creature_ptr->virtues[i] * 2;
3943 creature_ptr->align -= creature_ptr->virtues[i];
3946 creature_ptr->align += creature_ptr->virtues[i];
3951 for (int i = 0; i < j; i++)
3953 if (creature_ptr->align > 0)
3955 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
3956 if (creature_ptr->align < 0) creature_ptr->align = 0;
3958 else if (creature_ptr->align < 0)
3960 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
3961 if (creature_ptr->align > 0) creature_ptr->align = 0;
3968 * @brief プレイヤーの最大HPを計算する /
3969 * Calculate the players (maximal) hit points
3970 * Adjust current hitpoints if necessary
3974 static void calc_hitpoints(player_type *creature_ptr)
3976 /* Un-inflate "half-hitpoint bonus per level" value */
3977 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
3979 /* Calculate hitpoints */
3980 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
3983 if (creature_ptr->mimic_form)
3985 if (creature_ptr->pclass == CLASS_SORCERER)
3986 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3988 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3989 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
3992 if (creature_ptr->pclass == CLASS_SORCERER)
3994 if (creature_ptr->lev < 30)
3995 mhp = (mhp * (45 + creature_ptr->lev) / 100);
3997 mhp = (mhp * 75 / 100);
3998 bonus = (bonus * 65 / 100);
4003 if (creature_ptr->pclass == CLASS_BERSERKER)
4005 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
4008 /* Always have at least one hitpoint per level */
4009 if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
4011 /* Factor in the hero / superhero settings */
4012 if (IS_HERO(creature_ptr)) mhp += 10;
4013 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
4014 if (creature_ptr->tsuyoshi) mhp += 50;
4016 /* Factor in the hex spell settings */
4017 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) mhp += 15;
4018 if (hex_spelling(creature_ptr, HEX_BUILDING)) mhp += 60;
4020 /* New maximum hitpoints */
4021 if (creature_ptr->mhp == mhp) return;
4023 /* Enforce maximum */
4024 if (creature_ptr->chp >= mhp)
4026 creature_ptr->chp = mhp;
4027 creature_ptr->chp_frac = 0;
4031 /* レベルアップの時は上昇量を表示する */
4032 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
4034 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
4037 creature_ptr->mhp = mhp;
4039 creature_ptr->redraw |= PR_HP;
4040 creature_ptr->window |= PW_PLAYER;
4045 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
4048 * SWD: Experimental modification: multiple light sources have additive effect.
4050 static void calc_torch(player_type *creature_ptr)
4052 creature_ptr->cur_lite = 0;
4054 /* Loop through all wielded items */
4055 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
4058 o_ptr = &creature_ptr->inventory_list[i];
4059 /* Skip empty slots */
4060 if (!o_ptr->k_idx) continue;
4062 if (o_ptr->name2 == EGO_LITE_SHINE) creature_ptr->cur_lite++;
4065 if (o_ptr->name2 != EGO_LITE_DARKNESS)
4067 if (o_ptr->tval == TV_LITE)
4069 if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
4070 if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
4074 BIT_FLAGS flgs[TR_FLAG_SIZE];
4075 object_flags(o_ptr, flgs);
4078 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
4079 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
4080 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
4081 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
4082 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
4083 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
4084 creature_ptr->cur_lite += rad;
4087 /* max radius is 14 (was 5) without rewriting other code -- */
4088 if (d_info[creature_ptr->dungeon_idx].flags1 & DF1_DARKNESS && creature_ptr->cur_lite > 1)
4089 creature_ptr->cur_lite = 1;
4092 * check if the player doesn't have light radius,
4093 * but does weakly glow as an intrinsic.
4095 if (creature_ptr->cur_lite <= 0 && creature_ptr->lite) creature_ptr->cur_lite++;
4097 if (creature_ptr->cur_lite > 14) creature_ptr->cur_lite = 14;
4098 if (creature_ptr->cur_lite < 0) creature_ptr->cur_lite = 0;
4100 /* Notice changes in the "lite radius" */
4101 if (creature_ptr->old_lite == creature_ptr->cur_lite) return;
4103 /* Hack -- PU_MON_LITE for monsters' darkness */
4104 creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
4106 /* Remember the old lite */
4107 creature_ptr->old_lite = creature_ptr->cur_lite;
4109 if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
4110 set_superstealth(creature_ptr, FALSE);
4116 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
4117 * Calculate number of spells player should have, and forget,
4118 * or remember, spells until that number is properly reflected.
4121 * Note that this function induces various "status" messages,
4122 * which must be bypasses until the character is created.
4124 static void calc_spells(player_type *creature_ptr)
4126 /* Hack -- must be literate */
4127 if (!mp_ptr->spell_book) return;
4129 /* Hack -- wait for creation */
4130 if (!current_world_ptr->character_generated) return;
4132 /* Hack -- handle "xtra" mode */
4133 if (current_world_ptr->character_xtra) return;
4135 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
4137 creature_ptr->new_spells = 0;
4141 concptr p = spell_category_name(mp_ptr->spell_book);
4143 /* Determine the number of spells allowed */
4144 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
4146 /* Hack -- no negative spells */
4147 if (levels < 0) levels = 0;
4149 /* Extract total allowed spells */
4150 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
4153 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
4158 if (creature_ptr->pclass == CLASS_SAMURAI)
4162 else if (creature_ptr->realm2 == REALM_NONE)
4164 num_allowed = (num_allowed + 1) / 2;
4165 if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus;
4167 else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST))
4169 if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus;
4173 if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus;
4176 /* Count the number of spells we know */
4177 int num_boukyaku = 0;
4178 for (int j = 0; j < 64; j++)
4180 /* Count known spells */
4182 (creature_ptr->spell_forgotten1 & (1L << j)) :
4183 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
4189 /* See how many spells we must forget or may learn */
4190 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
4192 /* Forget spells which are too hard */
4193 for (int i = 63; i >= 0; i--)
4195 /* Efficiency -- all done */
4196 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
4198 /* Access the spell */
4199 int j = creature_ptr->spell_order[i];
4201 /* Skip non-spells */
4202 if (j >= 99) continue;
4205 const magic_type *s_ptr;
4206 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
4209 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4211 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
4214 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4216 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
4218 /* Skip spells we are allowed to know */
4219 if (s_ptr->slevel <= creature_ptr->lev) continue;
4222 bool is_spell_learned = (j < 32) ?
4223 (creature_ptr->spell_learned1 & (1L << j)) :
4224 (creature_ptr->spell_learned2 & (1L << (j - 32)));
4225 if (!is_spell_learned) continue;
4227 /* Mark as forgotten */
4231 creature_ptr->spell_forgotten1 |= (1L << j);
4232 which = creature_ptr->realm1;
4236 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
4237 which = creature_ptr->realm2;
4240 /* No longer known */
4243 creature_ptr->spell_learned1 &= ~(1L << j);
4244 which = creature_ptr->realm1;
4248 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
4249 which = creature_ptr->realm2;
4253 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4255 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4257 creature_ptr->new_spells++;
4260 /* Forget spells if we know too many spells */
4261 for (int i = 63; i >= 0; i--)
4263 /* Stop when possible */
4264 if (creature_ptr->new_spells >= 0) break;
4266 /* Efficiency -- all done */
4267 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
4269 /* Get the (i+1)th spell learned */
4270 int j = creature_ptr->spell_order[i];
4272 /* Skip unknown spells */
4273 if (j >= 99) continue;
4275 bool is_spell_learned = (j < 32) ?
4276 (creature_ptr->spell_learned1 & (1L << j)) :
4277 (creature_ptr->spell_learned2 & (1L << (j - 32)));
4278 if (!is_spell_learned) continue;
4280 /* Mark as forgotten */
4284 creature_ptr->spell_forgotten1 |= (1L << j);
4285 which = creature_ptr->realm1;
4289 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
4290 which = creature_ptr->realm2;
4293 /* No longer known */
4296 creature_ptr->spell_learned1 &= ~(1L << j);
4297 which = creature_ptr->realm1;
4301 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
4302 which = creature_ptr->realm2;
4306 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4308 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4310 creature_ptr->new_spells++;
4313 /* Check for spells to remember */
4314 for (int i = 0; i < 64; i++)
4316 /* None left to remember */
4317 if (creature_ptr->new_spells <= 0) break;
4319 /* Efficiency -- all done */
4320 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
4322 /* Get the next spell we learned */
4323 int j = creature_ptr->spell_order[i];
4325 /* Skip unknown spells */
4328 /* Access the spell */
4329 const magic_type *s_ptr;
4330 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
4333 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4335 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
4338 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4340 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
4342 /* Skip spells we cannot remember */
4343 if (s_ptr->slevel > creature_ptr->lev) continue;
4345 bool is_spell_learned = (j < 32) ?
4346 (creature_ptr->spell_forgotten1 & (1L << j)) :
4347 (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
4348 if (!is_spell_learned) continue;
4350 /* No longer forgotten */
4354 creature_ptr->spell_forgotten1 &= ~(1L << j);
4355 which = creature_ptr->realm1;
4359 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
4360 which = creature_ptr->realm2;
4363 /* Known once more */
4366 creature_ptr->spell_learned1 |= (1L << j);
4367 which = creature_ptr->realm1;
4371 creature_ptr->spell_learned2 |= (1L << (j - 32));
4372 which = creature_ptr->realm2;
4376 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
4378 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
4380 creature_ptr->new_spells--;
4383 if (creature_ptr->realm2 == REALM_NONE)
4385 /* Count spells that can be learned */
4387 for (int j = 0; j < 32; j++)
4389 const magic_type *s_ptr;
4390 if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
4391 else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
4393 /* Skip spells we cannot remember */
4394 if (s_ptr->slevel > creature_ptr->lev) continue;
4396 /* Skip spells we already know */
4397 if (creature_ptr->spell_learned1 & (1L << j))
4407 if ((creature_ptr->new_spells > k) &&
4408 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
4410 creature_ptr->new_spells = (s16b)k;
4414 if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
4416 /* Spell count changed */
4417 if (creature_ptr->old_spells == creature_ptr->new_spells) return;
4419 /* Message if needed */
4420 if (creature_ptr->new_spells)
4423 if (creature_ptr->new_spells < 10) {
4424 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
4427 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
4430 msg_format("You can learn %d more %s%s.",
4431 creature_ptr->new_spells, p,
4432 (creature_ptr->new_spells != 1) ? "s" : "");
4436 creature_ptr->old_spells = creature_ptr->new_spells;
4437 creature_ptr->redraw |= PR_STUDY;
4438 creature_ptr->window |= PW_OBJECT;
4443 * @brief プレイヤーの最大MPを計算する /
4444 * Calculate maximum mana. You do not need to know any spells.
4445 * Note that mana is lowered by heavy (or inappropriate) armor.
4448 * This function induces status messages.
4450 static void calc_mana(player_type *creature_ptr)
4452 /* Hack -- Must be literate */
4453 if (!mp_ptr->spell_book) return;
4456 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
4457 (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
4458 (creature_ptr->pclass == CLASS_BLUE_MAGE))
4460 levels = creature_ptr->lev;
4464 if (mp_ptr->spell_first > creature_ptr->lev)
4467 creature_ptr->msp = 0;
4469 /* Display mana later */
4470 creature_ptr->redraw |= (PR_MANA);
4474 /* Extract "effective" player level */
4475 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
4479 if (creature_ptr->pclass == CLASS_SAMURAI)
4481 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
4482 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4486 /* Extract total mana */
4487 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
4489 /* Hack -- usually add one mana */
4492 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4494 if (msp && (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2;
4496 /* Hack: High mages have a 25% mana bonus */
4497 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
4499 if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
4502 /* Only mages are affected */
4503 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
4505 BIT_FLAGS flgs[TR_FLAG_SIZE];
4507 /* Assume player is not encumbered by gloves */
4508 creature_ptr->cumber_glove = FALSE;
4510 /* Get the gloves */
4512 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
4514 /* Examine the gloves */
4515 object_flags(o_ptr, flgs);
4517 /* Normal gloves hurt mage-type spells */
4519 !(have_flag(flgs, TR_FREE_ACT)) &&
4520 !(have_flag(flgs, TR_DEC_MANA)) &&
4521 !(have_flag(flgs, TR_EASY_SPELL)) &&
4522 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
4523 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
4526 creature_ptr->cumber_glove = TRUE;
4529 msp = (3 * msp) / 4;
4533 /* Assume player not encumbered by armor */
4534 creature_ptr->cumber_armor = FALSE;
4536 /* Weigh the armor */
4538 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4539 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4540 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4541 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4542 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4543 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4544 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4546 /* Subtract a percentage of maximum mana. */
4547 switch (creature_ptr->pclass)
4549 /* For these classes, mana is halved if armour
4550 * is 30 pounds over their weight limit. */
4552 case CLASS_HIGH_MAGE:
4553 case CLASS_BLUE_MAGE:
4555 case CLASS_FORCETRAINER:
4556 case CLASS_SORCERER:
4558 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4559 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4563 /* Mana halved if armour is 40 pounds over weight limit. */
4568 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4569 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
4573 case CLASS_MINDCRAFTER:
4574 case CLASS_BEASTMASTER:
4575 case CLASS_MIRROR_MASTER:
4577 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
4578 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
4582 /* Mana halved if armour is 50 pounds over weight limit. */
4585 case CLASS_RED_MAGE:
4586 case CLASS_WARRIOR_MAGE:
4588 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
4589 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
4593 /* Mana halved if armour is 60 pounds over weight limit. */
4595 case CLASS_CHAOS_WARRIOR:
4597 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
4598 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
4602 /* For new classes created, but not yet added to this formula. */
4609 /* Determine the weight allowance */
4610 int max_wgt = mp_ptr->spell_weight;
4612 /* Heavy armor penalizes mana by a percentage. -LM- */
4613 if ((cur_wgt - max_wgt) > 0)
4616 creature_ptr->cumber_armor = TRUE;
4618 /* Subtract a percentage of maximum mana. */
4619 switch (creature_ptr->pclass)
4621 /* For these classes, mana is halved if armour
4622 * is 30 pounds over their weight limit. */
4624 case CLASS_HIGH_MAGE:
4625 case CLASS_BLUE_MAGE:
4627 msp -= msp * (cur_wgt - max_wgt) / 600;
4631 /* Mana halved if armour is 40 pounds over weight limit. */
4633 case CLASS_MINDCRAFTER:
4634 case CLASS_BEASTMASTER:
4636 case CLASS_FORCETRAINER:
4638 case CLASS_MIRROR_MASTER:
4640 msp -= msp * (cur_wgt - max_wgt) / 800;
4644 case CLASS_SORCERER:
4646 msp -= msp * (cur_wgt - max_wgt) / 900;
4650 /* Mana halved if armour is 50 pounds over weight limit. */
4654 case CLASS_RED_MAGE:
4656 msp -= msp * (cur_wgt - max_wgt) / 1000;
4660 /* Mana halved if armour is 60 pounds over weight limit. */
4662 case CLASS_CHAOS_WARRIOR:
4663 case CLASS_WARRIOR_MAGE:
4665 msp -= msp * (cur_wgt - max_wgt) / 1200;
4671 creature_ptr->cumber_armor = FALSE;
4675 /* For new classes created, but not yet added to this formula. */
4678 msp -= msp * (cur_wgt - max_wgt) / 800;
4684 /* Mana can never be negative */
4685 if (msp < 0) msp = 0;
4687 /* Maximum mana has changed */
4688 if (creature_ptr->msp != msp)
4690 /* Enforce maximum */
4691 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
4693 creature_ptr->csp = msp;
4694 creature_ptr->csp_frac = 0;
4698 /* レベルアップの時は上昇量を表示する */
4699 if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
4701 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
4705 creature_ptr->msp = msp;
4707 /* Display mana later */
4708 creature_ptr->redraw |= (PR_MANA);
4709 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4712 /* Hack -- handle "xtra" mode */
4713 if (current_world_ptr->character_xtra) return;
4715 /* Take note when "glove state" changes */
4716 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
4718 if (creature_ptr->cumber_glove)
4720 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
4724 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
4727 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
4730 /* Take note when "armor state" changes */
4731 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor) return;
4733 if (creature_ptr->cumber_armor)
4735 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
4739 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
4742 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
4747 * @brief 装備中の射撃武器の威力倍率を返す /
4748 * calcurate the fire rate of target object
4749 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
4750 * @return 射撃倍率の値(100で1.00倍)
4752 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
4754 /* Scan the usable creature_ptr->inventory_list */
4755 int extra_shots = 0;
4756 BIT_FLAGS flgs[TR_FLAG_SIZE];
4757 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
4760 q_ptr = &creature_ptr->inventory_list[i];
4761 if (!q_ptr->k_idx) continue;
4763 /* Do not apply current equip */
4764 if (i == INVEN_BOW) continue;
4766 object_flags(q_ptr, flgs);
4769 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4772 object_flags(o_ptr, flgs);
4773 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4776 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
4781 num += (extra_shots * 100);
4783 /* Hack -- Rangers love Bows */
4784 OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
4785 if ((creature_ptr->pclass == CLASS_RANGER) &&
4786 (tval_ammo == TV_ARROW))
4788 num += (creature_ptr->lev * 4);
4791 if ((creature_ptr->pclass == CLASS_CAVALRY) &&
4792 (tval_ammo == TV_ARROW))
4794 num += (creature_ptr->lev * 3);
4797 if (creature_ptr->pclass == CLASS_ARCHER)
4799 if (tval_ammo == TV_ARROW)
4800 num += ((creature_ptr->lev * 5) + 50);
4801 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
4802 num += (creature_ptr->lev * 4);
4806 * Addendum -- also "Reward" high level warriors,
4807 * with _any_ missile weapon -- TY
4809 if (creature_ptr->pclass == CLASS_WARRIOR &&
4810 (tval_ammo <= TV_BOLT) &&
4811 (tval_ammo >= TV_SHOT))
4813 num += (creature_ptr->lev * 2);
4815 if ((creature_ptr->pclass == CLASS_ROGUE) &&
4816 (tval_ammo == TV_SHOT))
4818 num += (creature_ptr->lev * 4);
4826 * @brief プレイヤーの所持重量制限を計算する /
4827 * Computes current weight limit.
4830 WEIGHT weight_limit(player_type *creature_ptr)
4832 /* Weight limit based only on strength */
4833 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
4834 if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
4836 /* Return the result */
4842 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
4843 * @param i 判定する手のID(右手:0 左手:1)
4844 * @return 持っているならばTRUE
4846 bool has_melee_weapon(player_type *creature_ptr, int i)
4848 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
4853 * @brief プレイヤーの現在開いている手の状態を返す
4854 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
4855 * @return 開いている手のビットフラグ
4857 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
4859 BIT_FLAGS16 status = EMPTY_HAND_NONE;
4860 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
4861 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
4863 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
4865 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
4866 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
4874 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
4875 * @return ペナルティが適用されるならばTRUE。
4877 bool heavy_armor(player_type *creature_ptr)
4879 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA)) return FALSE;
4881 /* Weight the armor */
4882 WEIGHT monk_arm_wgt = 0;
4883 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4884 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4885 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4886 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4887 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4888 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4889 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4891 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
4896 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
4898 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
4900 void update_creature(player_type *creature_ptr)
4902 if (!creature_ptr->update) return;
4904 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4905 if (creature_ptr->update & (PU_AUTODESTROY))
4907 creature_ptr->update &= ~(PU_AUTODESTROY);
4908 autopick_delayed_alter(creature_ptr);
4911 if (creature_ptr->update & (PU_COMBINE))
4913 creature_ptr->update &= ~(PU_COMBINE);
4914 combine_pack(creature_ptr);
4917 /* Reorder the pack */
4918 if (creature_ptr->update & (PU_REORDER))
4920 creature_ptr->update &= ~(PU_REORDER);
4921 reorder_pack(creature_ptr);
4924 if (creature_ptr->update & (PU_BONUS))
4926 creature_ptr->update &= ~(PU_BONUS);
4927 calc_alignment(creature_ptr);
4928 calc_bonuses(creature_ptr);
4931 if (creature_ptr->update & (PU_TORCH))
4933 creature_ptr->update &= ~(PU_TORCH);
4934 calc_torch(creature_ptr);
4937 if (creature_ptr->update & (PU_HP))
4939 creature_ptr->update &= ~(PU_HP);
4940 calc_hitpoints(creature_ptr);
4943 if (creature_ptr->update & (PU_MANA))
4945 creature_ptr->update &= ~(PU_MANA);
4946 calc_mana(creature_ptr);
4949 if (creature_ptr->update & (PU_SPELLS))
4951 creature_ptr->update &= ~(PU_SPELLS);
4952 calc_spells(creature_ptr);
4955 /* Character is not ready yet, no screen updates */
4956 if (!current_world_ptr->character_generated) return;
4958 /* Character is in "icky" mode, no screen updates */
4959 if (current_world_ptr->character_icky) return;
4961 if (creature_ptr->update & (PU_UN_LITE))
4963 creature_ptr->update &= ~(PU_UN_LITE);
4964 forget_lite(floor_ptr);
4967 if (creature_ptr->update & (PU_UN_VIEW))
4969 creature_ptr->update &= ~(PU_UN_VIEW);
4970 forget_view(floor_ptr);
4973 if (creature_ptr->update & (PU_VIEW))
4975 creature_ptr->update &= ~(PU_VIEW);
4976 update_view(creature_ptr);
4979 if (creature_ptr->update & (PU_LITE))
4981 creature_ptr->update &= ~(PU_LITE);
4982 update_lite(creature_ptr);
4985 if (creature_ptr->update & (PU_FLOW))
4987 creature_ptr->update &= ~(PU_FLOW);
4988 update_flow(creature_ptr);
4991 if (creature_ptr->update & (PU_DISTANCE))
4993 creature_ptr->update &= ~(PU_DISTANCE);
4995 update_monsters(creature_ptr, TRUE);
4998 if (creature_ptr->update & (PU_MON_LITE))
5000 creature_ptr->update &= ~(PU_MON_LITE);
5001 update_mon_lite(creature_ptr);
5005 * Mega-Hack -- Delayed visual update
5006 * Only used if update_view(), update_lite() or update_mon_lite() was called
5008 if (creature_ptr->update & (PU_DELAY_VIS))
5010 creature_ptr->update &= ~(PU_DELAY_VIS);
5011 delayed_visual_update(creature_ptr);
5014 if (creature_ptr->update & (PU_MONSTERS))
5016 creature_ptr->update &= ~(PU_MONSTERS);
5017 update_monsters(creature_ptr, FALSE);
5023 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
5024 * @return 魔道書を一冊も持っていないならTRUEを返す
5026 bool player_has_no_spellbooks(player_type *creature_ptr)
5029 for (int i = 0; i < INVEN_PACK; i++)
5031 o_ptr = &creature_ptr->inventory_list[i];
5032 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
5035 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5036 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
5038 o_ptr = &floor_ptr->o_list[i];
5039 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
5046 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
5048 creature_ptr->energy_use = (ENERGY)need_cost;
5052 void free_turn(player_type *creature_ptr)
5054 creature_ptr->energy_use = 0;
5059 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
5062 * @return 配置に成功したらTRUE
5064 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
5066 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
5068 /* Save player location */
5069 creature_ptr->y = y;
5070 creature_ptr->x = x;
5076 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
5079 void wreck_the_pattern(player_type *creature_ptr)
5081 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5082 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
5083 if (pattern_type == PATTERN_TILE_WRECKED) return;
5085 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
5086 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
5088 if (!IS_INVULN(creature_ptr))
5089 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
5091 int to_ruin = randint1(45) + 35;
5095 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
5097 if (pattern_tile(r_y, r_x) &&
5098 (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
5100 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
5104 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
5109 * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
5110 * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ
5111 * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
5114 void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
5116 if (creature_ptr->phase_out || !current_world_ptr->character_dungeon) return;
5119 if (!necro && m_ptr)
5121 GAME_TEXT m_name[MAX_NLEN];
5122 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
5124 power = r_ptr->level / 2;
5126 monster_desc(creature_ptr, m_name, m_ptr, 0);
5128 if (!(r_ptr->flags1 & RF1_UNIQUE))
5130 if (r_ptr->flags1 & RF1_FRIENDS)
5135 if (!current_world_ptr->is_loading_now)
5136 return; /* No effect yet, just loaded... */
5139 return; /* Cannot see it for some reason */
5141 if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
5145 return; /* Pet eldritch horrors are safe most of the time */
5147 if (randint1(100) > power) return;
5149 if (saving_throw(creature_ptr->skill_sav - power))
5151 return; /* Save, no adverse effects */
5154 if (creature_ptr->image)
5156 /* Something silly happens... */
5157 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5158 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
5162 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
5163 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
5166 return; /* Never mind; we can't see it clearly enough */
5169 /* Something frightening happens... */
5170 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5171 horror_desc[randint0(MAX_SAN_HORROR)], m_name);
5173 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
5175 /* Demon characters are unaffected */
5176 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;
5177 if (current_world_ptr->wizard) return;
5179 /* Undead characters are 50% likely to be unaffected */
5180 if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE)
5181 || PRACE_IS_(creature_ptr, RACE_VAMPIRE) || PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
5182 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD))
5184 if (saving_throw(25 + creature_ptr->lev)) return;
5189 monster_race *r_ptr;
5190 GAME_TEXT m_name[MAX_NLEN];
5193 get_mon_num_prep(creature_ptr, get_nightmare, NULL);
5195 r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH)];
5196 power = r_ptr->level + 10;
5197 desc = r_name + r_ptr->name;
5199 get_mon_num_prep(creature_ptr, NULL, NULL);
5204 if (!(r_ptr->flags1 & RF1_UNIQUE))
5205 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
5208 sprintf(m_name, "%s", desc);
5210 if (!(r_ptr->flags1 & RF1_UNIQUE))
5212 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
5216 if (saving_throw(creature_ptr->skill_sav * 100 / power))
5218 msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
5223 if (creature_ptr->image)
5225 /* Something silly happens... */
5226 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5227 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
5231 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
5232 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
5235 /* Never mind; we can't see it clearly enough */
5239 /* Something frightening happens... */
5240 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
5241 horror_desc[randint0(MAX_SAN_HORROR)], desc);
5243 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
5245 if (!creature_ptr->mimic_form)
5247 switch (creature_ptr->prace)
5249 /* Demons may make a saving throw */
5252 if (saving_throw(20 + creature_ptr->lev)) return;
5254 /* Undead may make a saving throw */
5259 if (saving_throw(10 + creature_ptr->lev)) return;
5265 /* Demons may make a saving throw */
5266 if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
5268 if (saving_throw(20 + creature_ptr->lev)) return;
5270 /* Undead may make a saving throw */
5271 else if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
5273 if (saving_throw(10 + creature_ptr->lev)) return;
5279 msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
5282 /* 過去の効果無効率再現のため5回saving_throw 実行 */
5283 if (saving_throw(creature_ptr->skill_sav - power)
5284 && saving_throw(creature_ptr->skill_sav - power)
5285 && saving_throw(creature_ptr->skill_sav - power)
5286 && saving_throw(creature_ptr->skill_sav - power)
5287 && saving_throw(creature_ptr->skill_sav - power)
5293 switch (randint1(22))
5296 if (!(creature_ptr->muta3 & MUT3_MORONIC))
5298 if ((creature_ptr->stat_use[A_INT] < 4) && (creature_ptr->stat_use[A_WIS] < 4))
5300 msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
5304 msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
5307 if (creature_ptr->muta3 & MUT3_HYPER_INT)
5309 msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
5310 creature_ptr->muta3 &= ~(MUT3_HYPER_INT);
5312 creature_ptr->muta3 |= MUT3_MORONIC;
5316 if (!(creature_ptr->muta2 & MUT2_COWARDICE) && !creature_ptr->resist_fear)
5318 msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
5320 /* Duh, the following should never happen, but anyway... */
5321 if (creature_ptr->muta3 & MUT3_FEARLESS)
5323 msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
5324 creature_ptr->muta3 &= ~(MUT3_FEARLESS);
5327 creature_ptr->muta2 |= MUT2_COWARDICE;
5331 if (!(creature_ptr->muta2 & MUT2_HALLU) && !creature_ptr->resist_chaos)
5333 msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
5334 creature_ptr->muta2 |= MUT2_HALLU;
5338 if (!(creature_ptr->muta2 & MUT2_BERS_RAGE) && !creature_ptr->resist_conf)
5340 msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
5341 creature_ptr->muta2 |= MUT2_BERS_RAGE;
5353 if (!creature_ptr->resist_conf)
5355 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
5357 if (!creature_ptr->resist_chaos && one_in_(3))
5359 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
5367 if (!creature_ptr->resist_conf)
5369 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
5371 if (!creature_ptr->free_act)
5373 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4);
5375 if (!creature_ptr->resist_chaos)
5377 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
5380 (void)do_dec_stat(creature_ptr, A_INT);
5381 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
5384 (void)do_dec_stat(creature_ptr, A_WIS);
5385 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
5391 if (lose_all_info(creature_ptr))
5392 msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
5399 /* Lose int & wis */
5400 do_dec_stat(creature_ptr, A_INT);
5401 do_dec_stat(creature_ptr, A_WIS);
5407 creature_ptr->update |= PU_BONUS;
5408 handle_stuff(creature_ptr);
5413 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
5414 * Advance experience levels and print experience
5417 void check_experience(player_type *creature_ptr)
5419 /* Hack -- lower limit */
5420 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
5421 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
5422 if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
5424 /* Hack -- upper limit */
5425 if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
5426 if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
5427 if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
5429 /* Hack -- maintain "max" experience */
5430 if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
5432 /* Hack -- maintain "max max" experience */
5433 if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
5435 /* Redraw experience */
5436 creature_ptr->redraw |= (PR_EXP);
5437 handle_stuff(creature_ptr);
5439 /* Lose levels while possible */
5440 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5441 PLAYER_LEVEL old_lev = creature_ptr->lev;
5442 while ((creature_ptr->lev > 1) &&
5443 (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
5446 creature_ptr->lev--;
5447 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5448 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5449 creature_ptr->window |= (PW_PLAYER);
5450 handle_stuff(creature_ptr);
5453 /* Gain levels while possible */
5454 bool level_reward = FALSE;
5455 bool level_mutation = FALSE;
5456 bool level_inc_stat = FALSE;
5457 while ((creature_ptr->lev < PY_MAX_LEVEL) &&
5458 (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
5461 creature_ptr->lev++;
5463 /* Save the highest level */
5464 if (creature_ptr->lev > creature_ptr->max_plv)
5466 creature_ptr->max_plv = creature_ptr->lev;
5468 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
5469 (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
5471 level_reward = TRUE;
5473 if (creature_ptr->prace == RACE_BEASTMAN)
5475 if (one_in_(5)) level_mutation = TRUE;
5477 level_inc_stat = TRUE;
5479 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
5484 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
5486 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5487 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
5488 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
5491 creature_ptr->level_up_message = TRUE;
5492 handle_stuff(creature_ptr);
5494 creature_ptr->level_up_message = FALSE;
5498 if (!(creature_ptr->max_plv % 10))
5507 cnv_stat(creature_ptr->stat_max[0], tmp);
5508 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
5509 cnv_stat(creature_ptr->stat_max[1], tmp);
5510 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
5511 cnv_stat(creature_ptr->stat_max[2], tmp);
5512 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
5513 cnv_stat(creature_ptr->stat_max[3], tmp);
5514 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
5515 cnv_stat(creature_ptr->stat_max[4], tmp);
5516 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
5517 cnv_stat(creature_ptr->stat_max[5], tmp);
5518 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
5521 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
5526 if ((choice >= 'a') && (choice <= 'f')) break;
5528 for (n = 0; n < A_MAX; n++)
5529 if (n != choice - 'a')
5531 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
5533 do_inc_stat(creature_ptr, choice - 'a');
5536 else if (!(creature_ptr->max_plv % 2))
5537 do_inc_stat(creature_ptr, randint0(6));
5542 msg_print(_("あなたは変わった気がする...", "You feel different..."));
5543 (void)gain_mutation(creature_ptr, 0);
5544 level_mutation = FALSE;
5548 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
5553 gain_level_reward(creature_ptr, 0);
5554 level_reward = FALSE;
5557 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5558 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5559 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
5560 handle_stuff(creature_ptr);
5563 /* Load an autopick preference file */
5564 if (old_lev != creature_ptr->lev) autopick_load_pref(creature_ptr, FALSE);
5569 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
5571 * @param out_val 出力先文字列ポインタ
5574 void cnv_stat(int val, char *out_val)
5578 sprintf(out_val, " %2d", val);
5582 int bonus = (val - 18);
5585 sprintf(out_val, "18/%3s", "***");
5587 else if (bonus >= 100)
5589 sprintf(out_val, "18/%03d", bonus);
5593 sprintf(out_val, " 18/%02d", bonus);
5599 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
5600 * Modify a stat value by a "modifier", return new value
5602 * @param amount 加減算値
5606 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
5607 * Or even: 18/13, 18/23, 18/33, ..., 18/220
5608 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
5609 * Or even: 18/13, 18/03, 18, 17, ..., 3
5612 s16b modify_stat_value(int value, int amount)
5617 /* Apply each point */
5618 for (int i = 0; i < amount; i++)
5620 /* One point at a time */
5621 if (value < 18) value++;
5623 /* Ten "points" at a time */
5629 else if (amount < 0)
5631 /* Apply each point */
5632 for (int i = 0; i < (0 - amount); i++)
5634 /* Ten points at a time */
5635 if (value >= 18 + 10) value -= 10;
5637 /* Hack -- prevent weirdness */
5638 else if (value > 18) value = 18;
5640 /* One point at a time */
5641 else if (value > 3) value--;
5645 /* Return new value */
5652 * Hack -- Calculates the total number of points earned -JWT-
5656 long calc_score(player_type *creature_ptr)
5658 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
5661 if (!preserve_mode) mult += 10;
5662 if (!autoroller) mult += 10;
5663 if (!smart_learn) mult -= 20;
5664 if (smart_cheat) mult += 30;
5665 if (ironman_shops) mult += 50;
5666 if (ironman_small_levels) mult += 10;
5667 if (ironman_empty_levels) mult += 20;
5668 if (!powerup_home) mult += 50;
5669 if (ironman_rooms) mult += 100;
5670 if (ironman_nightmare) mult += 100;
5672 if (mult < 5) mult = 5;
5675 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
5676 if (max_dlv[i] > max_dl)
5677 max_dl = max_dlv[i];
5679 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
5680 u32b point_h = point_l / 0x10000L;
5681 point_l = point_l % 0x10000L;
5684 point_h += point_l / 0x10000L;
5685 point_l %= 0x10000L;
5687 point_l += ((point_h % 100) << 16);
5691 u32b point = (point_h << 16) + (point_l);
5692 if (creature_ptr->arena_number >= 0)
5693 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
5695 if (ironman_downward) point *= 2;
5696 if (creature_ptr->pclass == CLASS_BERSERKER)
5698 if (creature_ptr->prace == RACE_SPECTRE)
5702 if ((creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
5705 if (current_world_ptr->total_winner) point = 2;
5708 if (easy_band) point = (0 - point);
5714 void cheat_death(player_type *creature_ptr)
5716 /* Mark social class, reset age, if needed */
5717 if (creature_ptr->sc) creature_ptr->sc = creature_ptr->age = 0;
5720 creature_ptr->age++;
5723 current_world_ptr->noscore |= 0x0001;
5725 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
5728 (void)life_stream(creature_ptr, FALSE, FALSE);
5730 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
5733 for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
5735 creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
5737 for (; magic_idx < EATER_EXT * 3; magic_idx++)
5739 creature_ptr->magic_num1[magic_idx] = 0;
5743 /* Restore spell points */
5744 creature_ptr->csp = creature_ptr->msp;
5745 creature_ptr->csp_frac = 0;
5747 /* Hack -- cancel recall */
5748 if (creature_ptr->word_recall)
5750 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
5753 /* Hack -- Prevent recall */
5754 creature_ptr->word_recall = 0;
5755 creature_ptr->redraw |= (PR_STATUS);
5758 /* Hack -- cancel alter */
5759 if (creature_ptr->alter_reality)
5761 /* Hack -- Prevent alter */
5762 creature_ptr->alter_reality = 0;
5763 creature_ptr->redraw |= (PR_STATUS);
5766 /* Note cause of death */
5767 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
5770 creature_ptr->is_dead = FALSE;
5772 /* Hack -- Prevent starvation */
5773 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
5775 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
5776 floor_ptr->dun_level = 0;
5777 floor_ptr->inside_arena = FALSE;
5778 creature_ptr->phase_out = FALSE;
5780 floor_ptr->inside_quest = 0;
5781 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
5782 creature_ptr->dungeon_idx = 0;
5783 if (lite_town || vanilla_town)
5785 creature_ptr->wilderness_y = 1;
5786 creature_ptr->wilderness_x = 1;
5789 creature_ptr->oldpy = 10;
5790 creature_ptr->oldpx = 34;
5794 creature_ptr->oldpy = 33;
5795 creature_ptr->oldpx = 131;
5800 creature_ptr->wilderness_y = 48;
5801 creature_ptr->wilderness_x = 5;
5802 creature_ptr->oldpy = 33;
5803 creature_ptr->oldpx = 131;
5806 creature_ptr->wild_mode = FALSE;
5807 creature_ptr->leaving = TRUE;
5809 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
5813 /* Prepare next floor */
5814 leave_floor(creature_ptr);
5815 wipe_monsters_list(creature_ptr);
5820 * @param creature_ptr プレーヤーへの参照ポインタ
5821 * @return 祝福状態ならばTRUE
5823 bool is_blessed(player_type *creature_ptr)
5825 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
5829 bool is_oppose_acid(player_type *creature_ptr)
5831 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5835 bool is_oppose_elec(player_type *creature_ptr)
5837 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5841 bool is_oppose_fire(player_type *creature_ptr)
5843 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5847 bool is_oppose_cold(player_type *creature_ptr)
5849 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5853 bool is_oppose_pois(player_type *creature_ptr)
5855 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
5859 bool is_tim_esp(player_type *creature_ptr)
5861 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5865 bool is_tim_stealth(player_type *creature_ptr)
5867 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5871 bool is_time_limit_esp(player_type *creature_ptr)
5873 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
5877 bool is_time_limit_stealth(player_type *creature_ptr)
5879 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
5883 bool can_two_hands_wielding(player_type *creature_ptr)
5885 return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);