1 #include "system/angband.h"
2 #include "player/player-status.h"
3 #include "art-definition/art-sword-types.h"
4 #include "art-definition/art-weapon-types.h"
5 #include "autopick/autopick-reader-writer.h"
6 #include "autopick/autopick.h"
7 #include "cmd-action/cmd-pet.h"
8 #include "cmd-action/cmd-spell.h"
9 #include "cmd-building/cmd-building.h"
10 #include "cmd-io/cmd-dump.h"
11 #include "cmd-item/cmd-magiceat.h"
12 #include "combat/attack-power-table.h"
13 #include "core/stuff-handler.h"
14 #include "dungeon/dungeon.h"
15 #include "dungeon/quest.h"
16 #include "floor/floor-events.h"
17 #include "floor/floor.h"
18 #include "game-option/birth-options.h"
19 #include "grid/feature.h"
20 #include "inventory/inventory-object.h"
21 #include "io/files-util.h"
22 #include "io/input-key-acceptor.h"
23 #include "io/write-diary.h"
24 #include "main/sound-definitions-table.h"
25 #include "main/sound-of-music.h"
26 #include "market/arena-info-table.h"
27 #include "mind/mind-force-trainer.h"
28 #include "monster-race/race-flags1.h"
29 #include "monster-race/race-flags2.h"
30 #include "monster-race/race-flags3.h"
31 #include "monster-race/race-flags7.h"
32 #include "monster-race/monster-race-hook.h"
33 #include "monster-race/monster-race.h"
34 #include "monster/monster-info.h"
35 #include "monster-floor/monster-remover.h"
36 #include "monster/monster-status.h"
37 #include "monster/monster-update.h"
38 #include "monster/smart-learn-types.h"
39 #include "mutation/mutation.h"
40 #include "object-enchant/object-ego.h"
41 #include "object-enchant/special-object-flags.h"
42 #include "object-enchant/tr-types.h"
43 #include "object-enchant/trc-types.h"
44 #include "object/object-flags.h"
45 #include "object/object-hook.h"
46 #include "object/object-mark-types.h"
47 #include "object/object-info.h"
48 #include "perception/object-perception.h"
49 #include "pet/pet-util.h"
50 #include "player/avatar.h"
51 #include "player/mimic-info-table.h"
52 #include "player/patron.h"
53 #include "player/player-class.h"
54 #include "player/player-damage.h"
55 #include "player/player-effects.h"
56 #include "player/player-move.h"
57 #include "player/player-personalities-types.h"
58 #include "player/player-personality.h"
59 #include "player/player-race-types.h"
60 #include "player/player-skill.h"
61 #include "player/race-info-table.h"
62 #include "realm/realm-hex-numbers.h"
63 #include "realm/realm-song-numbers.h"
64 #include "specific-object/bow.h"
65 #include "spell-realm/spells-hex.h"
66 #include "spell/range-calc.h"
67 #include "spell/spells-describer.h"
68 #include "spell/spells-execution.h"
69 #include "spell/spells-status.h"
70 #include "spell/spells-util.h"
71 #include "spell/technic-info-table.h"
72 #include "sv-definition/sv-lite-types.h"
73 #include "sv-definition/sv-weapon-types.h"
74 #include "util/quarks.h"
75 #include "view/display-main-window.h"
76 #include "view/display-messages.h"
77 #include "world/world.h"
80 * @brief 能力値テーブル / Abbreviations of healthy stats
82 const concptr stat_names[6] =
85 "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :"
87 "STR : ", "INT : ", "WIS : ", "DEX : ", "CON : ", "CHR : "
92 * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats
94 const concptr stat_names_reduced[6] =
97 "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:"
99 "Str : ", "Int : ", "Wis : ", "Dex : ", "Con : ", "Chr : "
104 * @brief 基本必要経験値テーブル /
105 * Base experience levels, may be adjusted up for race and/or class
107 const s32b player_exp[PY_MAX_LEVEL] =
162 * @brief 基本必要強化値テーブル(アンドロイド専用)
164 const s32b player_exp_a[PY_MAX_LEVEL] =
219 * 知力/賢さによるレベル毎の習得可能魔法数テーブル
220 * Stat Table (INT/WIS) -- Number of half-spells per level
222 const byte adj_mag_study[] =
249 4 /* 18/100-18/109 */,
250 4 /* 18/110-18/119 */,
251 5 /* 18/120-18/129 */,
252 5 /* 18/130-18/139 */,
253 5 /* 18/140-18/149 */,
254 5 /* 18/150-18/159 */,
255 5 /* 18/160-18/169 */,
256 5 /* 18/170-18/179 */,
257 5 /* 18/180-18/189 */,
258 5 /* 18/190-18/199 */,
259 5 /* 18/200-18/209 */,
260 6 /* 18/210-18/219 */,
266 * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
268 const byte adj_mag_mana[] =
285 10 /* 18/00-18/09 */,
286 11 /* 18/10-18/19 */,
287 11 /* 18/20-18/29 */,
288 12 /* 18/30-18/39 */,
289 12 /* 18/40-18/49 */,
290 13 /* 18/50-18/59 */,
291 14 /* 18/60-18/69 */,
292 15 /* 18/70-18/79 */,
293 16 /* 18/80-18/89 */,
294 17 /* 18/90-18/99 */,
295 18 /* 18/100-18/109 */,
296 19 /* 18/110-18/119 */,
297 20 /* 18/120-18/129 */,
298 21 /* 18/130-18/139 */,
299 22 /* 18/140-18/149 */,
300 23 /* 18/150-18/159 */,
301 24 /* 18/160-18/169 */,
302 25 /* 18/170-18/179 */,
303 26 /* 18/180-18/189 */,
304 27 /* 18/190-18/199 */,
305 28 /* 18/200-18/209 */,
306 29 /* 18/210-18/219 */,
311 * 知力/賢さによる最低魔法失敗率テーブル
312 * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
314 const byte adj_mag_fail[] =
341 3 /* 18/100-18/109 */,
342 2 /* 18/110-18/119 */,
343 2 /* 18/120-18/129 */,
344 2 /* 18/130-18/139 */,
345 2 /* 18/140-18/149 */,
346 1 /* 18/150-18/159 */,
347 1 /* 18/160-18/169 */,
348 1 /* 18/170-18/179 */,
349 1 /* 18/180-18/189 */,
350 1 /* 18/190-18/199 */,
351 0 /* 18/200-18/209 */,
352 0 /* 18/210-18/219 */,
357 * 知力/賢さによる魔法失敗率修正テーブル
358 * Stat Table (INT/WIS) -- Various things
360 const byte adj_mag_stat[] =
387 8 /* 18/100-18/109 */,
388 9 /* 18/110-18/119 */,
389 10 /* 18/120-18/129 */,
390 11 /* 18/130-18/139 */,
391 12 /* 18/140-18/149 */,
392 13 /* 18/150-18/159 */,
393 14 /* 18/160-18/169 */,
394 15 /* 18/170-18/179 */,
395 16 /* 18/180-18/189 */,
396 17 /* 18/190-18/199 */,
397 18 /* 18/200-18/209 */,
398 19 /* 18/210-18/219 */,
404 * Stat Table (CHR) -- payment percentages
406 const byte adj_chr_gold[] =
423 100 /* 18/00-18/09 */,
424 99 /* 18/10-18/19 */,
425 98 /* 18/20-18/29 */,
426 97 /* 18/30-18/39 */,
427 96 /* 18/40-18/49 */,
428 95 /* 18/50-18/59 */,
429 94 /* 18/60-18/69 */,
430 93 /* 18/70-18/79 */,
431 92 /* 18/80-18/89 */,
432 91 /* 18/90-18/99 */,
433 90 /* 18/100-18/109 */,
434 89 /* 18/110-18/119 */,
435 88 /* 18/120-18/129 */,
436 87 /* 18/130-18/139 */,
437 86 /* 18/140-18/149 */,
438 85 /* 18/150-18/159 */,
439 84 /* 18/160-18/169 */,
440 83 /* 18/170-18/179 */,
441 82 /* 18/180-18/189 */,
442 81 /* 18/190-18/199 */,
443 80 /* 18/200-18/209 */,
444 79 /* 18/210-18/219 */,
450 * Stat Table (INT) -- Magic devices
452 const byte adj_int_dev[] =
479 8 /* 18/100-18/109 */,
480 9 /* 18/110-18/119 */,
481 10 /* 18/120-18/129 */,
482 11 /* 18/130-18/139 */,
483 12 /* 18/140-18/149 */,
484 13 /* 18/150-18/159 */,
485 14 /* 18/160-18/169 */,
486 15 /* 18/170-18/179 */,
487 16 /* 18/180-18/189 */,
488 17 /* 18/190-18/199 */,
489 18 /* 18/200-18/209 */,
490 19 /* 18/210-18/219 */,
496 * Stat Table (WIS) -- Saving throw
498 const byte adj_wis_sav[] =
525 7 /* 18/100-18/109 */,
526 8 /* 18/110-18/119 */,
527 9 /* 18/120-18/129 */,
528 10 /* 18/130-18/139 */,
529 11 /* 18/140-18/149 */,
530 12 /* 18/150-18/159 */,
531 13 /* 18/160-18/169 */,
532 14 /* 18/170-18/179 */,
533 15 /* 18/180-18/189 */,
534 16 /* 18/190-18/199 */,
535 17 /* 18/200-18/209 */,
536 18 /* 18/210-18/219 */,
542 * Stat Table (DEX) -- disarming
544 const byte adj_dex_dis[] =
571 8 /* 18/100-18/109 */,
572 8 /* 18/110-18/119 */,
573 8 /* 18/120-18/129 */,
574 8 /* 18/130-18/139 */,
575 8 /* 18/140-18/149 */,
576 9 /* 18/150-18/159 */,
577 9 /* 18/160-18/169 */,
578 9 /* 18/170-18/179 */,
579 9 /* 18/180-18/189 */,
580 9 /* 18/190-18/199 */,
581 10 /* 18/200-18/209 */,
582 10 /* 18/210-18/219 */,
588 * Stat Table (INT) -- disarming
590 const byte adj_int_dis[] =
617 10 /* 18/100-18/109 */,
618 10 /* 18/110-18/119 */,
619 11 /* 18/120-18/129 */,
620 12 /* 18/130-18/139 */,
621 13 /* 18/140-18/149 */,
622 14 /* 18/150-18/159 */,
623 15 /* 18/160-18/169 */,
624 16 /* 18/170-18/179 */,
625 17 /* 18/180-18/189 */,
626 18 /* 18/190-18/199 */,
627 19 /* 18/200-18/209 */,
628 19 /* 18/210-18/219 */,
634 * Stat Table (DEX) -- bonus to ac (plus 128)
636 const byte adj_dex_ta[] =
653 128 + 2 /* 18/00-18/09 */,
654 128 + 2 /* 18/10-18/19 */,
655 128 + 2 /* 18/20-18/29 */,
656 128 + 2 /* 18/30-18/39 */,
657 128 + 2 /* 18/40-18/49 */,
658 128 + 3 /* 18/50-18/59 */,
659 128 + 3 /* 18/60-18/69 */,
660 128 + 3 /* 18/70-18/79 */,
661 128 + 4 /* 18/80-18/89 */,
662 128 + 5 /* 18/90-18/99 */,
663 128 + 6 /* 18/100-18/109 */,
664 128 + 7 /* 18/110-18/119 */,
665 128 + 8 /* 18/120-18/129 */,
666 128 + 9 /* 18/130-18/139 */,
667 128 + 9 /* 18/140-18/149 */,
668 128 + 10 /* 18/150-18/159 */,
669 128 + 11 /* 18/160-18/169 */,
670 128 + 12 /* 18/170-18/179 */,
671 128 + 13 /* 18/180-18/189 */,
672 128 + 14 /* 18/190-18/199 */,
673 128 + 15 /* 18/200-18/209 */,
674 128 + 15 /* 18/210-18/219 */,
675 128 + 16 /* 18/220+ */
680 * Stat Table (STR) -- bonus to dam (plus 128)
682 const byte adj_str_td[] =
699 128 + 2 /* 18/00-18/09 */,
700 128 + 2 /* 18/10-18/19 */,
701 128 + 3 /* 18/20-18/29 */,
702 128 + 3 /* 18/30-18/39 */,
703 128 + 3 /* 18/40-18/49 */,
704 128 + 3 /* 18/50-18/59 */,
705 128 + 3 /* 18/60-18/69 */,
706 128 + 4 /* 18/70-18/79 */,
707 128 + 5 /* 18/80-18/89 */,
708 128 + 5 /* 18/90-18/99 */,
709 128 + 6 /* 18/100-18/109 */,
710 128 + 7 /* 18/110-18/119 */,
711 128 + 8 /* 18/120-18/129 */,
712 128 + 9 /* 18/130-18/139 */,
713 128 + 10 /* 18/140-18/149 */,
714 128 + 11 /* 18/150-18/159 */,
715 128 + 12 /* 18/160-18/169 */,
716 128 + 13 /* 18/170-18/179 */,
717 128 + 14 /* 18/180-18/189 */,
718 128 + 15 /* 18/190-18/199 */,
719 128 + 16 /* 18/200-18/209 */,
720 128 + 18 /* 18/210-18/219 */,
721 128 + 20 /* 18/220+ */
726 * Stat Table (DEX) -- bonus to hit (plus 128)
728 const byte adj_dex_th[] =
745 128 + 3 /* 18/00-18/09 */,
746 128 + 3 /* 18/10-18/19 */,
747 128 + 3 /* 18/20-18/29 */,
748 128 + 3 /* 18/30-18/39 */,
749 128 + 3 /* 18/40-18/49 */,
750 128 + 4 /* 18/50-18/59 */,
751 128 + 4 /* 18/60-18/69 */,
752 128 + 4 /* 18/70-18/79 */,
753 128 + 4 /* 18/80-18/89 */,
754 128 + 5 /* 18/90-18/99 */,
755 128 + 6 /* 18/100-18/109 */,
756 128 + 7 /* 18/110-18/119 */,
757 128 + 8 /* 18/120-18/129 */,
758 128 + 9 /* 18/130-18/139 */,
759 128 + 9 /* 18/140-18/149 */,
760 128 + 10 /* 18/150-18/159 */,
761 128 + 11 /* 18/160-18/169 */,
762 128 + 12 /* 18/170-18/179 */,
763 128 + 13 /* 18/180-18/189 */,
764 128 + 14 /* 18/190-18/199 */,
765 128 + 15 /* 18/200-18/209 */,
766 128 + 15 /* 18/210-18/219 */,
767 128 + 16 /* 18/220+ */
772 * Stat Table (STR) -- bonus to hit (plus 128)
774 const byte adj_str_th[] =
791 128 + 1 /* 18/00-18/09 */,
792 128 + 1 /* 18/10-18/19 */,
793 128 + 1 /* 18/20-18/29 */,
794 128 + 1 /* 18/30-18/39 */,
795 128 + 1 /* 18/40-18/49 */,
796 128 + 1 /* 18/50-18/59 */,
797 128 + 1 /* 18/60-18/69 */,
798 128 + 2 /* 18/70-18/79 */,
799 128 + 3 /* 18/80-18/89 */,
800 128 + 4 /* 18/90-18/99 */,
801 128 + 5 /* 18/100-18/109 */,
802 128 + 6 /* 18/110-18/119 */,
803 128 + 7 /* 18/120-18/129 */,
804 128 + 8 /* 18/130-18/139 */,
805 128 + 9 /* 18/140-18/149 */,
806 128 + 10 /* 18/150-18/159 */,
807 128 + 11 /* 18/160-18/169 */,
808 128 + 12 /* 18/170-18/179 */,
809 128 + 13 /* 18/180-18/189 */,
810 128 + 14 /* 18/190-18/199 */,
811 128 + 15 /* 18/200-18/209 */,
812 128 + 15 /* 18/210-18/219 */,
813 128 + 16 /* 18/220+ */
818 * Stat Table (STR) -- weight limit in deca-pounds
820 const byte adj_str_wgt[] =
837 25 /* 18/00-18/09 */,
838 26 /* 18/10-18/19 */,
839 27 /* 18/20-18/29 */,
840 28 /* 18/30-18/39 */,
841 29 /* 18/40-18/49 */,
842 30 /* 18/50-18/59 */,
843 31 /* 18/60-18/69 */,
844 31 /* 18/70-18/79 */,
845 32 /* 18/80-18/89 */,
846 32 /* 18/90-18/99 */,
847 33 /* 18/100-18/109 */,
848 33 /* 18/110-18/119 */,
849 34 /* 18/120-18/129 */,
850 34 /* 18/130-18/139 */,
851 35 /* 18/140-18/149 */,
852 35 /* 18/150-18/159 */,
853 36 /* 18/160-18/169 */,
854 36 /* 18/170-18/179 */,
855 37 /* 18/180-18/189 */,
856 37 /* 18/190-18/199 */,
857 38 /* 18/200-18/209 */,
858 38 /* 18/210-18/219 */,
864 * Stat Table (STR) -- weapon weight limit in pounds
866 const byte adj_str_hold[] =
883 19 /* 18/00-18/09 */,
884 20 /* 18/10-18/19 */,
885 21 /* 18/20-18/29 */,
886 22 /* 18/30-18/39 */,
887 23 /* 18/40-18/49 */,
888 24 /* 18/50-18/59 */,
889 25 /* 18/60-18/69 */,
890 26 /* 18/70-18/79 */,
891 27 /* 18/80-18/89 */,
892 28 /* 18/90-18/99 */,
893 30 /* 18/100-18/109 */,
894 31 /* 18/110-18/119 */,
895 32 /* 18/120-18/129 */,
896 33 /* 18/130-18/139 */,
897 34 /* 18/140-18/149 */,
898 35 /* 18/150-18/159 */,
899 37 /* 18/160-18/169 */,
900 40 /* 18/170-18/179 */,
901 44 /* 18/180-18/189 */,
902 48 /* 18/190-18/199 */,
903 50 /* 18/200-18/209 */,
904 50 /* 18/210-18/219 */,
910 * Stat Table (STR) -- digging value
912 const byte adj_str_dig[] =
930 10 /* 18/10-18/19 */,
931 12 /* 18/20-18/29 */,
932 15 /* 18/30-18/39 */,
933 20 /* 18/40-18/49 */,
934 25 /* 18/50-18/59 */,
935 30 /* 18/60-18/69 */,
936 35 /* 18/70-18/79 */,
937 40 /* 18/80-18/89 */,
938 45 /* 18/90-18/99 */,
939 50 /* 18/100-18/109 */,
940 55 /* 18/110-18/119 */,
941 60 /* 18/120-18/129 */,
942 65 /* 18/130-18/139 */,
943 70 /* 18/140-18/149 */,
944 75 /* 18/150-18/159 */,
945 80 /* 18/160-18/169 */,
946 85 /* 18/170-18/179 */,
947 90 /* 18/180-18/189 */,
948 95 /* 18/190-18/199 */,
949 100 /* 18/200-18/209 */,
950 100 /* 18/210-18/219 */,
955 * 器用さによる盗難防止&体当たり成功判定修正テーブル
956 * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
958 const byte adj_dex_safe[] =
975 10 /* 18/00-18/09 */,
976 10 /* 18/10-18/19 */,
977 15 /* 18/20-18/29 */,
978 15 /* 18/30-18/39 */,
979 20 /* 18/40-18/49 */,
980 25 /* 18/50-18/59 */,
981 30 /* 18/60-18/69 */,
982 35 /* 18/70-18/79 */,
983 40 /* 18/80-18/89 */,
984 45 /* 18/90-18/99 */,
985 50 /* 18/100-18/109 */,
986 60 /* 18/110-18/119 */,
987 70 /* 18/120-18/129 */,
988 80 /* 18/130-18/139 */,
989 90 /* 18/140-18/149 */,
990 100 /* 18/150-18/159 */,
991 100 /* 18/160-18/169 */,
992 100 /* 18/170-18/179 */,
993 100 /* 18/180-18/189 */,
994 100 /* 18/190-18/199 */,
995 100 /* 18/200-18/209 */,
996 100 /* 18/210-18/219 */,
1001 * 耐久による基本HP自然治癒値テーブル /
1002 * Stat Table (CON) -- base regeneration rate
1004 const byte adj_con_fix[] =
1021 2 /* 18/00-18/09 */,
1022 2 /* 18/10-18/19 */,
1023 2 /* 18/20-18/29 */,
1024 2 /* 18/30-18/39 */,
1025 2 /* 18/40-18/49 */,
1026 3 /* 18/50-18/59 */,
1027 3 /* 18/60-18/69 */,
1028 3 /* 18/70-18/79 */,
1029 3 /* 18/80-18/89 */,
1030 3 /* 18/90-18/99 */,
1031 4 /* 18/100-18/109 */,
1032 4 /* 18/110-18/119 */,
1033 5 /* 18/120-18/129 */,
1034 6 /* 18/130-18/139 */,
1035 6 /* 18/140-18/149 */,
1036 7 /* 18/150-18/159 */,
1037 7 /* 18/160-18/169 */,
1038 8 /* 18/170-18/179 */,
1039 8 /* 18/180-18/189 */,
1040 8 /* 18/190-18/199 */,
1041 9 /* 18/200-18/209 */,
1042 9 /* 18/210-18/219 */,
1047 * 耐久による基本HP自然治癒値テーブル /
1048 * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
1050 const byte adj_con_mhp[] =
1067 128 + 4 /* 18/00-18/09 */,
1068 128 + 5 /* 18/10-18/19 */,
1069 128 + 6 /* 18/20-18/29 */,
1070 128 + 7 /* 18/30-18/39 */,
1071 128 + 8 /* 18/40-18/49 */,
1072 128 + 9 /* 18/50-18/59 */,
1073 128 + 10 /* 18/60-18/69 */,
1074 128 + 11 /* 18/70-18/79 */,
1075 128 + 12 /* 18/80-18/89 */,
1076 128 + 14 /* 18/90-18/99 */,
1077 128 + 17 /* 18/100-18/109 */,
1078 128 + 20 /* 18/110-18/119 */,
1079 128 + 23 /* 18/120-18/129 */,
1080 128 + 26 /* 18/130-18/139 */,
1081 128 + 29 /* 18/140-18/149 */,
1082 128 + 32 /* 18/150-18/159 */,
1083 128 + 35 /* 18/160-18/169 */,
1084 128 + 38 /* 18/170-18/179 */,
1085 128 + 40 /* 18/180-18/189 */,
1086 128 + 42 /* 18/190-18/199 */,
1087 128 + 44 /* 18/200-18/209 */,
1088 128 + 46 /* 18/210-18/219 */,
1089 128 + 48 /* 18/220+ */
1094 * Stat Table (CHR) -- charm
1096 const byte adj_chr_chm[] =
1113 9 /* 18/00-18/09 */,
1114 10 /* 18/10-18/19 */,
1115 12 /* 18/20-18/29 */,
1116 15 /* 18/30-18/39 */,
1117 18 /* 18/40-18/49 */,
1118 21 /* 18/50-18/59 */,
1119 24 /* 18/60-18/69 */,
1120 28 /* 18/70-18/79 */,
1121 32 /* 18/80-18/89 */,
1122 36 /* 18/90-18/99 */,
1123 39 /* 18/100-18/109 */,
1124 42 /* 18/110-18/119 */,
1125 45 /* 18/120-18/129 */,
1126 49 /* 18/130-18/139 */,
1127 53 /* 18/140-18/149 */,
1128 57 /* 18/150-18/159 */,
1129 61 /* 18/160-18/169 */,
1130 65 /* 18/170-18/179 */,
1131 69 /* 18/180-18/189 */,
1132 73 /* 18/190-18/199 */,
1133 77 /* 18/200-18/209 */,
1134 81 /* 18/210-18/219 */,
1138 /*** Player information ***/
1141 * Static player info record
1146 * Pointer to the player info
1148 player_type *p_ptr = &p_body;
1151 * Return alignment title
1153 concptr your_alignment(player_type *creature_ptr)
1155 if (creature_ptr->align > 150) return _("大善", "Lawful");
1156 else if (creature_ptr->align > 50) return _("中善", "Good");
1157 else if (creature_ptr->align > 10) return _("小善", "Neutral Good");
1158 else if (creature_ptr->align > -11) return _("中立", "Neutral");
1159 else if (creature_ptr->align > -51) return _("小悪", "Neutral Evil");
1160 else if (creature_ptr->align > -151) return _("中悪", "Evil");
1161 else return _("大悪", "Chaotic");
1166 * Return proficiency level of weapons and misc. skills (except riding)
1168 int weapon_exp_level(int weapon_exp)
1170 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1171 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1172 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1173 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
1174 else return EXP_LEVEL_MASTER;
1179 * Return proficiency level of riding
1181 int riding_exp_level(int riding_exp)
1183 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1184 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1185 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1186 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
1187 else return EXP_LEVEL_MASTER;
1192 * Return proficiency level of spells
1194 int spell_exp_level(int spell_exp)
1196 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1197 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1198 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1199 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
1200 else return EXP_LEVEL_MASTER;
1205 * @brief プレイヤーの全ステータスを更新する /
1206 * Calculate the players current "state", taking into account
1207 * not only race/class intrinsics, but also objects being worn
1208 * and temporary spell effects.
1212 * See also calc_mana() and calc_hitpoints().
1214 * Take note of the new "speed code", in particular, a very strong
1215 * player will start slowing down as soon as he reaches 150 pounds,
1216 * but not until he reaches 450 pounds will he be half as fast as
1217 * a normal kobold. This both hurts and helps the player, hurts
1218 * because in the old days a player could just avoid 300 pounds,
1219 * and helps because now carrying 300 pounds is not very painful.
1221 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
1222 * damage, since that would affect non-combat things. These values
1223 * are actually added in later, at the appropriate place.
1225 * This function induces various "status" messages.
1228 void calc_bonuses(player_type *creature_ptr)
1232 int default_hand = 0;
1233 int empty_hands_status = empty_hands(creature_ptr, TRUE);
1236 BIT_FLAGS flgs[TR_FLAG_SIZE];
1238 bool yoiyami = FALSE;
1239 bool down_saving = FALSE;
1241 bool have_sw = FALSE, have_kabe = FALSE;
1242 bool easy_2weapon = FALSE;
1243 bool riding_levitation = FALSE;
1244 OBJECT_IDX this_o_idx, next_o_idx = 0;
1245 const player_race *tmp_rp_ptr;
1247 /* Save the old vision stuff */
1248 bool old_telepathy = creature_ptr->telepathy;
1249 bool old_esp_animal = creature_ptr->esp_animal;
1250 bool old_esp_undead = creature_ptr->esp_undead;
1251 bool old_esp_demon = creature_ptr->esp_demon;
1252 bool old_esp_orc = creature_ptr->esp_orc;
1253 bool old_esp_troll = creature_ptr->esp_troll;
1254 bool old_esp_giant = creature_ptr->esp_giant;
1255 bool old_esp_dragon = creature_ptr->esp_dragon;
1256 bool old_esp_human = creature_ptr->esp_human;
1257 bool old_esp_evil = creature_ptr->esp_evil;
1258 bool old_esp_good = creature_ptr->esp_good;
1259 bool old_esp_nonliving = creature_ptr->esp_nonliving;
1260 bool old_esp_unique = creature_ptr->esp_unique;
1261 bool old_see_inv = creature_ptr->see_inv;
1262 bool old_mighty_throw = creature_ptr->mighty_throw;
1264 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1265 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1267 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
1268 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
1270 extra_blows[0] = extra_blows[1] = 0;
1272 for (int i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
1274 creature_ptr->dis_ac = creature_ptr->ac = 0;
1275 creature_ptr->dis_to_h[0] = creature_ptr->to_h[0] = 0;
1276 creature_ptr->dis_to_h[1] = creature_ptr->to_h[1] = 0;
1277 creature_ptr->dis_to_d[0] = creature_ptr->to_d[0] = 0;
1278 creature_ptr->dis_to_d[1] = creature_ptr->to_d[1] = 0;
1279 creature_ptr->dis_to_h_b = creature_ptr->to_h_b = 0;
1280 creature_ptr->dis_to_a = creature_ptr->to_a = 0;
1281 creature_ptr->to_h_m = 0;
1282 creature_ptr->to_d_m = 0;
1283 creature_ptr->to_m_chance = 0;
1284 creature_ptr->to_dd[0] = creature_ptr->to_ds[0] = 0;
1285 creature_ptr->to_dd[1] = creature_ptr->to_ds[1] = 0;
1288 creature_ptr->num_blow[0] = 1;
1289 creature_ptr->num_blow[1] = 1;
1290 creature_ptr->num_fire = 100;
1291 creature_ptr->tval_xtra = 0;
1292 creature_ptr->tval_ammo = 0;
1293 creature_ptr->cursed = 0L;
1294 creature_ptr->bless_blade = FALSE;
1295 creature_ptr->xtra_might = FALSE;
1296 creature_ptr->impact[0] = FALSE;
1297 creature_ptr->impact[1] = FALSE;
1298 creature_ptr->pass_wall = FALSE;
1299 creature_ptr->kill_wall = FALSE;
1300 creature_ptr->dec_mana = FALSE;
1301 creature_ptr->easy_spell = FALSE;
1302 creature_ptr->heavy_spell = FALSE;
1303 creature_ptr->see_inv = FALSE;
1304 creature_ptr->free_act = FALSE;
1305 creature_ptr->slow_digest = FALSE;
1306 creature_ptr->regenerate = FALSE;
1307 creature_ptr->can_swim = FALSE;
1308 creature_ptr->levitation = FALSE;
1309 creature_ptr->hold_exp = FALSE;
1310 creature_ptr->telepathy = FALSE;
1311 creature_ptr->esp_animal = FALSE;
1312 creature_ptr->esp_undead = FALSE;
1313 creature_ptr->esp_demon = FALSE;
1314 creature_ptr->esp_orc = FALSE;
1315 creature_ptr->esp_troll = FALSE;
1316 creature_ptr->esp_giant = FALSE;
1317 creature_ptr->esp_dragon = FALSE;
1318 creature_ptr->esp_human = FALSE;
1319 creature_ptr->esp_evil = FALSE;
1320 creature_ptr->esp_good = FALSE;
1321 creature_ptr->esp_nonliving = FALSE;
1322 creature_ptr->esp_unique = FALSE;
1323 creature_ptr->lite = FALSE;
1324 creature_ptr->sustain_str = FALSE;
1325 creature_ptr->sustain_int = FALSE;
1326 creature_ptr->sustain_wis = FALSE;
1327 creature_ptr->sustain_con = FALSE;
1328 creature_ptr->sustain_dex = FALSE;
1329 creature_ptr->sustain_chr = FALSE;
1330 creature_ptr->resist_acid = FALSE;
1331 creature_ptr->resist_elec = FALSE;
1332 creature_ptr->resist_fire = FALSE;
1333 creature_ptr->resist_cold = FALSE;
1334 creature_ptr->resist_pois = FALSE;
1335 creature_ptr->resist_conf = FALSE;
1336 creature_ptr->resist_sound = FALSE;
1337 creature_ptr->resist_lite = FALSE;
1338 creature_ptr->resist_dark = FALSE;
1339 creature_ptr->resist_chaos = FALSE;
1340 creature_ptr->resist_disen = FALSE;
1341 creature_ptr->resist_shard = FALSE;
1342 creature_ptr->resist_nexus = FALSE;
1343 creature_ptr->resist_blind = FALSE;
1344 creature_ptr->resist_neth = FALSE;
1345 creature_ptr->resist_time = FALSE;
1346 creature_ptr->resist_water = FALSE;
1347 creature_ptr->resist_fear = FALSE;
1348 creature_ptr->reflect = FALSE;
1349 creature_ptr->sh_fire = FALSE;
1350 creature_ptr->sh_elec = FALSE;
1351 creature_ptr->sh_cold = FALSE;
1352 creature_ptr->anti_magic = FALSE;
1353 creature_ptr->anti_tele = FALSE;
1354 creature_ptr->warning = FALSE;
1355 creature_ptr->mighty_throw = FALSE;
1356 creature_ptr->see_nocto = FALSE;
1357 creature_ptr->immune_acid = FALSE;
1358 creature_ptr->immune_elec = FALSE;
1359 creature_ptr->immune_fire = FALSE;
1360 creature_ptr->immune_cold = FALSE;
1361 creature_ptr->ryoute = FALSE;
1362 creature_ptr->migite = FALSE;
1363 creature_ptr->hidarite = FALSE;
1364 creature_ptr->no_flowed = FALSE;
1366 if (creature_ptr->mimic_form) tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
1367 else tmp_rp_ptr = &race_info[creature_ptr->prace];
1369 creature_ptr->see_infra = tmp_rp_ptr->infra;
1370 creature_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
1371 creature_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
1372 creature_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
1373 creature_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
1374 creature_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
1375 creature_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
1376 creature_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
1377 creature_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1378 creature_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
1379 creature_ptr->skill_dig = 0;
1381 if (has_melee_weapon(creature_ptr, INVEN_RARM)) creature_ptr->migite = TRUE;
1382 if (has_melee_weapon(creature_ptr, INVEN_LARM))
1384 creature_ptr->hidarite = TRUE;
1385 if (!creature_ptr->migite) default_hand = 1;
1388 if (can_two_hands_wielding(creature_ptr))
1390 if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
1391 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
1393 creature_ptr->ryoute = TRUE;
1395 else if (creature_ptr->hidarite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) &&
1396 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM]))
1398 creature_ptr->ryoute = TRUE;
1402 switch (creature_ptr->pclass)
1405 case CLASS_FORCETRAINER:
1406 case CLASS_BERSERKER:
1407 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
1409 creature_ptr->migite = TRUE;
1410 creature_ptr->ryoute = TRUE;
1417 if (!creature_ptr->migite && !creature_ptr->hidarite)
1419 if (empty_hands_status & EMPTY_HAND_RARM) creature_ptr->migite = TRUE;
1420 else if (empty_hands_status == EMPTY_HAND_LARM)
1422 creature_ptr->hidarite = TRUE;
1427 if (creature_ptr->special_defense & KAMAE_MASK)
1429 if (!(empty_hands_status & EMPTY_HAND_RARM))
1431 set_action(creature_ptr, ACTION_NONE);
1435 switch (creature_ptr->pclass)
1438 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1439 if (creature_ptr->lev > 44) creature_ptr->regenerate = TRUE;
1442 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1444 case CLASS_CHAOS_WARRIOR:
1445 if (creature_ptr->lev > 29) creature_ptr->resist_chaos = TRUE;
1446 if (creature_ptr->lev > 39) creature_ptr->resist_fear = TRUE;
1448 case CLASS_MINDCRAFTER:
1449 if (creature_ptr->lev > 9) creature_ptr->resist_fear = TRUE;
1450 if (creature_ptr->lev > 19) creature_ptr->sustain_wis = TRUE;
1451 if (creature_ptr->lev > 29) creature_ptr->resist_conf = TRUE;
1452 if (creature_ptr->lev > 39) creature_ptr->telepathy = TRUE;
1455 case CLASS_FORCETRAINER:
1456 if (!(heavy_armor(creature_ptr)))
1458 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) ||
1459 is_specific_player_race(creature_ptr, RACE_SPRITE) ||
1460 (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
1461 new_speed += (creature_ptr->lev) / 10;
1463 if (creature_ptr->lev > 24)
1464 creature_ptr->free_act = TRUE;
1468 case CLASS_SORCERER:
1469 creature_ptr->to_a -= 50;
1470 creature_ptr->dis_to_a -= 50;
1473 creature_ptr->resist_sound = TRUE;
1476 if (creature_ptr->lev > 29) creature_ptr->resist_fear = TRUE;
1478 case CLASS_BERSERKER:
1479 creature_ptr->shero = 1;
1480 creature_ptr->sustain_str = TRUE;
1481 creature_ptr->sustain_dex = TRUE;
1482 creature_ptr->sustain_con = TRUE;
1483 creature_ptr->regenerate = TRUE;
1484 creature_ptr->free_act = TRUE;
1486 if (creature_ptr->lev > 29) new_speed++;
1487 if (creature_ptr->lev > 39) new_speed++;
1488 if (creature_ptr->lev > 44) new_speed++;
1489 if (creature_ptr->lev > 49) new_speed++;
1490 creature_ptr->to_a += 10 + creature_ptr->lev / 2;
1491 creature_ptr->dis_to_a += 10 + creature_ptr->lev / 2;
1492 creature_ptr->skill_dig += (100 + creature_ptr->lev * 8);
1493 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1494 creature_ptr->redraw |= PR_STATUS;
1496 case CLASS_MIRROR_MASTER:
1497 if (creature_ptr->lev > 39) creature_ptr->reflect = TRUE;
1500 if (heavy_armor(creature_ptr))
1502 new_speed -= (creature_ptr->lev) / 10;
1503 creature_ptr->skill_stl -= (creature_ptr->lev) / 10;
1505 else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1506 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1509 if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) ||
1510 is_specific_player_race(creature_ptr, RACE_SPRITE) ||
1511 (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
1512 new_speed += (creature_ptr->lev) / 10;
1513 creature_ptr->skill_stl += (creature_ptr->lev) / 10;
1514 if (creature_ptr->lev > 24)
1515 creature_ptr->free_act = TRUE;
1518 if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
1519 (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
1521 creature_ptr->to_a += creature_ptr->lev / 2 + 5;
1522 creature_ptr->dis_to_a += creature_ptr->lev / 2 + 5;
1525 creature_ptr->slow_digest = TRUE;
1526 creature_ptr->resist_fear = TRUE;
1527 if (creature_ptr->lev > 19) creature_ptr->resist_pois = TRUE;
1528 if (creature_ptr->lev > 24) creature_ptr->sustain_dex = TRUE;
1529 if (creature_ptr->lev > 29) creature_ptr->see_inv = TRUE;
1530 if (creature_ptr->lev > 44)
1532 creature_ptr->oppose_pois = 1;
1533 creature_ptr->redraw |= PR_STATUS;
1536 creature_ptr->see_nocto = TRUE;
1540 if (creature_ptr->mimic_form)
1542 switch (creature_ptr->mimic_form)
1545 creature_ptr->hold_exp = TRUE;
1546 creature_ptr->resist_chaos = TRUE;
1547 creature_ptr->resist_neth = TRUE;
1548 creature_ptr->resist_fire = TRUE;
1549 creature_ptr->oppose_fire = 1;
1550 creature_ptr->see_inv = TRUE;
1552 creature_ptr->redraw |= PR_STATUS;
1553 creature_ptr->to_a += 10;
1554 creature_ptr->dis_to_a += 10;
1556 case MIMIC_DEMON_LORD:
1557 creature_ptr->hold_exp = TRUE;
1558 creature_ptr->resist_chaos = TRUE;
1559 creature_ptr->resist_neth = TRUE;
1560 creature_ptr->immune_fire = TRUE;
1561 creature_ptr->resist_acid = TRUE;
1562 creature_ptr->resist_fire = TRUE;
1563 creature_ptr->resist_cold = TRUE;
1564 creature_ptr->resist_elec = TRUE;
1565 creature_ptr->resist_pois = TRUE;
1566 creature_ptr->resist_conf = TRUE;
1567 creature_ptr->resist_disen = TRUE;
1568 creature_ptr->resist_nexus = TRUE;
1569 creature_ptr->resist_fear = TRUE;
1570 creature_ptr->sh_fire = TRUE;
1571 creature_ptr->see_inv = TRUE;
1572 creature_ptr->telepathy = TRUE;
1573 creature_ptr->levitation = TRUE;
1574 creature_ptr->kill_wall = TRUE;
1576 creature_ptr->to_a += 20;
1577 creature_ptr->dis_to_a += 20;
1580 creature_ptr->resist_dark = TRUE;
1581 creature_ptr->hold_exp = TRUE;
1582 creature_ptr->resist_neth = TRUE;
1583 creature_ptr->resist_cold = TRUE;
1584 creature_ptr->resist_pois = TRUE;
1585 creature_ptr->see_inv = TRUE;
1587 creature_ptr->to_a += 10;
1588 creature_ptr->dis_to_a += 10;
1589 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1595 switch (creature_ptr->prace)
1598 creature_ptr->resist_lite = TRUE;
1601 creature_ptr->hold_exp = TRUE;
1604 creature_ptr->free_act = TRUE;
1607 creature_ptr->resist_blind = TRUE;
1610 creature_ptr->resist_dark = TRUE;
1612 case RACE_HALF_TROLL:
1613 creature_ptr->sustain_str = TRUE;
1615 if (creature_ptr->lev > 14)
1617 creature_ptr->regenerate = TRUE;
1618 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER)
1620 creature_ptr->slow_digest = TRUE;
1621 /* Let's not make Regeneration
1622 * a disadvantage for the poor warriors who can
1623 * never learn a spell that satisfies hunger (actually
1624 * neither can rogues, but half-trolls are not
1625 * supposed to play rogues) */
1630 creature_ptr->sustain_con = TRUE;
1631 creature_ptr->regenerate = TRUE;
1634 creature_ptr->resist_lite = TRUE;
1635 creature_ptr->see_inv = TRUE;
1637 case RACE_BARBARIAN:
1638 creature_ptr->resist_fear = TRUE;
1640 case RACE_HALF_OGRE:
1641 creature_ptr->resist_dark = TRUE;
1642 creature_ptr->sustain_str = TRUE;
1644 case RACE_HALF_GIANT:
1645 creature_ptr->sustain_str = TRUE;
1646 creature_ptr->resist_shard = TRUE;
1648 case RACE_HALF_TITAN:
1649 creature_ptr->resist_chaos = TRUE;
1652 creature_ptr->resist_sound = TRUE;
1655 creature_ptr->resist_acid = TRUE;
1656 if (creature_ptr->lev > 19) creature_ptr->immune_acid = TRUE;
1659 creature_ptr->resist_conf = TRUE;
1660 creature_ptr->resist_acid = TRUE;
1661 new_speed += (creature_ptr->lev) / 10;
1664 creature_ptr->resist_pois = TRUE;
1667 creature_ptr->resist_disen = TRUE;
1668 creature_ptr->resist_dark = TRUE;
1671 creature_ptr->resist_dark = TRUE;
1672 if (creature_ptr->lev > 19) creature_ptr->see_inv = TRUE;
1674 case RACE_DRACONIAN:
1675 creature_ptr->levitation = TRUE;
1676 if (creature_ptr->lev > 4) creature_ptr->resist_fire = TRUE;
1677 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1678 if (creature_ptr->lev > 14) creature_ptr->resist_acid = TRUE;
1679 if (creature_ptr->lev > 19) creature_ptr->resist_elec = TRUE;
1680 if (creature_ptr->lev > 34) creature_ptr->resist_pois = TRUE;
1682 case RACE_MIND_FLAYER:
1683 creature_ptr->sustain_int = TRUE;
1684 creature_ptr->sustain_wis = TRUE;
1685 if (creature_ptr->lev > 14) creature_ptr->see_inv = TRUE;
1686 if (creature_ptr->lev > 29) creature_ptr->telepathy = TRUE;
1689 creature_ptr->resist_fire = TRUE;
1690 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1693 creature_ptr->slow_digest = TRUE;
1694 creature_ptr->free_act = TRUE;
1695 creature_ptr->see_inv = TRUE;
1696 creature_ptr->resist_pois = TRUE;
1697 if (creature_ptr->lev > 34) creature_ptr->hold_exp = TRUE;
1700 creature_ptr->resist_shard = TRUE;
1701 creature_ptr->hold_exp = TRUE;
1702 creature_ptr->see_inv = TRUE;
1703 creature_ptr->resist_pois = TRUE;
1704 if (creature_ptr->lev > 9) creature_ptr->resist_cold = TRUE;
1707 creature_ptr->resist_neth = TRUE;
1708 creature_ptr->hold_exp = TRUE;
1709 creature_ptr->see_inv = TRUE;
1710 creature_ptr->resist_pois = TRUE;
1711 creature_ptr->slow_digest = TRUE;
1712 if (creature_ptr->lev > 4) creature_ptr->resist_cold = TRUE;
1715 creature_ptr->resist_dark = TRUE;
1716 creature_ptr->hold_exp = TRUE;
1717 creature_ptr->resist_neth = TRUE;
1718 creature_ptr->resist_cold = TRUE;
1719 creature_ptr->resist_pois = TRUE;
1720 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1723 creature_ptr->levitation = TRUE;
1724 creature_ptr->free_act = TRUE;
1725 creature_ptr->resist_neth = TRUE;
1726 creature_ptr->hold_exp = TRUE;
1727 creature_ptr->see_inv = TRUE;
1728 creature_ptr->resist_pois = TRUE;
1729 creature_ptr->slow_digest = TRUE;
1730 creature_ptr->resist_cold = TRUE;
1731 creature_ptr->pass_wall = TRUE;
1732 if (creature_ptr->lev > 34) creature_ptr->telepathy = TRUE;
1735 creature_ptr->levitation = TRUE;
1736 creature_ptr->resist_lite = TRUE;
1738 new_speed += (creature_ptr->lev) / 10;
1741 creature_ptr->resist_conf = TRUE;
1742 creature_ptr->resist_sound = TRUE;
1745 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
1746 creature_ptr->skill_dig += creature_ptr->lev * 10;
1748 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_STR]++;
1749 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_STR]++;
1750 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_STR]++;
1752 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_DEX]--;
1753 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_DEX]--;
1754 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_DEX]--;
1756 if (creature_ptr->lev > 25) creature_ptr->stat_add[A_CON]++;
1757 if (creature_ptr->lev > 40) creature_ptr->stat_add[A_CON]++;
1758 if (creature_ptr->lev > 45) creature_ptr->stat_add[A_CON]++;
1761 creature_ptr->levitation = TRUE;
1762 creature_ptr->see_inv = TRUE;
1765 creature_ptr->resist_fire = TRUE;
1766 creature_ptr->resist_neth = TRUE;
1767 creature_ptr->hold_exp = TRUE;
1768 if (creature_ptr->lev > 9) creature_ptr->see_inv = TRUE;
1769 if (creature_ptr->lev > 44)
1771 creature_ptr->oppose_fire = 1;
1772 creature_ptr->redraw |= PR_STATUS;
1777 creature_ptr->sustain_con = TRUE;
1780 creature_ptr->levitation = TRUE;
1783 creature_ptr->resist_conf = TRUE;
1786 creature_ptr->slow_digest = TRUE;
1787 creature_ptr->free_act = TRUE;
1788 creature_ptr->resist_pois = TRUE;
1789 creature_ptr->hold_exp = TRUE;
1792 creature_ptr->resist_water = TRUE;
1799 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU))
1801 creature_ptr->see_inv = TRUE;
1802 creature_ptr->free_act = TRUE;
1803 creature_ptr->slow_digest = TRUE;
1804 creature_ptr->regenerate = TRUE;
1805 creature_ptr->levitation = TRUE;
1806 creature_ptr->hold_exp = TRUE;
1807 creature_ptr->telepathy = TRUE;
1808 creature_ptr->lite = TRUE;
1809 creature_ptr->sustain_str = TRUE;
1810 creature_ptr->sustain_int = TRUE;
1811 creature_ptr->sustain_wis = TRUE;
1812 creature_ptr->sustain_con = TRUE;
1813 creature_ptr->sustain_dex = TRUE;
1814 creature_ptr->sustain_chr = TRUE;
1815 creature_ptr->resist_acid = TRUE;
1816 creature_ptr->resist_elec = TRUE;
1817 creature_ptr->resist_fire = TRUE;
1818 creature_ptr->resist_cold = TRUE;
1819 creature_ptr->resist_pois = TRUE;
1820 creature_ptr->resist_conf = TRUE;
1821 creature_ptr->resist_sound = TRUE;
1822 creature_ptr->resist_lite = TRUE;
1823 creature_ptr->resist_dark = TRUE;
1824 creature_ptr->resist_chaos = TRUE;
1825 creature_ptr->resist_disen = TRUE;
1826 creature_ptr->resist_shard = TRUE;
1827 creature_ptr->resist_nexus = TRUE;
1828 creature_ptr->resist_blind = TRUE;
1829 creature_ptr->resist_neth = TRUE;
1830 creature_ptr->resist_fear = TRUE;
1831 creature_ptr->reflect = TRUE;
1832 creature_ptr->sh_fire = TRUE;
1833 creature_ptr->sh_elec = TRUE;
1834 creature_ptr->sh_cold = TRUE;
1835 creature_ptr->to_a += 100;
1836 creature_ptr->dis_to_a += 100;
1838 else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef)
1840 creature_ptr->to_a += 50;
1841 creature_ptr->dis_to_a += 50;
1844 if (creature_ptr->tim_res_nether)
1846 creature_ptr->resist_neth = TRUE;
1849 if (creature_ptr->tim_sh_fire)
1851 creature_ptr->sh_fire = TRUE;
1854 if (creature_ptr->tim_res_time)
1856 creature_ptr->resist_time = TRUE;
1859 if (creature_ptr->pseikaku == PERSONALITY_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE);
1860 if (creature_ptr->pseikaku == PERSONALITY_LAZY) creature_ptr->to_m_chance += 10;
1861 if (creature_ptr->pseikaku == PERSONALITY_SHREWD) creature_ptr->to_m_chance -= 3;
1862 if ((creature_ptr->pseikaku == PERSONALITY_PATIENT) || (creature_ptr->pseikaku == PERSONALITY_MIGHTY)) creature_ptr->to_m_chance++;
1863 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
1865 creature_ptr->to_m_chance += 5;
1866 creature_ptr->resist_conf = TRUE;
1869 if (creature_ptr->pseikaku == PERSONALITY_LUCKY) creature_ptr->muta3 |= MUT3_GOOD_LUCK;
1870 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)
1872 creature_ptr->resist_blind = TRUE;
1873 creature_ptr->resist_conf = TRUE;
1874 creature_ptr->hold_exp = TRUE;
1875 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1877 if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
1878 new_speed += (creature_ptr->lev) / 10 + 5;
1881 if (music_singing(creature_ptr, MUSIC_WALL))
1883 creature_ptr->kill_wall = TRUE;
1886 for (int i = 0; i < A_MAX; i++)
1888 creature_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
1891 if (creature_ptr->muta3)
1893 if (creature_ptr->muta3 & MUT3_HYPER_STR)
1895 creature_ptr->stat_add[A_STR] += 4;
1898 if (creature_ptr->muta3 & MUT3_PUNY)
1900 creature_ptr->stat_add[A_STR] -= 4;
1903 if (creature_ptr->muta3 & MUT3_HYPER_INT)
1905 creature_ptr->stat_add[A_INT] += 4;
1906 creature_ptr->stat_add[A_WIS] += 4;
1909 if (creature_ptr->muta3 & MUT3_MORONIC)
1911 creature_ptr->stat_add[A_INT] -= 4;
1912 creature_ptr->stat_add[A_WIS] -= 4;
1915 if (creature_ptr->muta3 & MUT3_RESILIENT)
1917 creature_ptr->stat_add[A_CON] += 4;
1920 if (creature_ptr->muta3 & MUT3_XTRA_FAT)
1922 creature_ptr->stat_add[A_CON] += 2;
1926 if (creature_ptr->muta3 & MUT3_ALBINO)
1928 creature_ptr->stat_add[A_CON] -= 4;
1931 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1933 creature_ptr->stat_add[A_CON] -= 2;
1934 creature_ptr->stat_add[A_CHR] -= 1;
1935 creature_ptr->regenerate = FALSE;
1938 if (creature_ptr->muta3 & MUT3_SILLY_VOI)
1940 creature_ptr->stat_add[A_CHR] -= 4;
1943 if (creature_ptr->muta3 & MUT3_BLANK_FAC)
1945 creature_ptr->stat_add[A_CHR] -= 1;
1948 if (creature_ptr->muta3 & MUT3_XTRA_EYES)
1950 creature_ptr->skill_fos += 15;
1951 creature_ptr->skill_srh += 15;
1954 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1956 creature_ptr->skill_sav += (15 + (creature_ptr->lev / 5));
1959 if (creature_ptr->muta3 & MUT3_XTRA_NOIS)
1961 creature_ptr->skill_stl -= 3;
1964 if (creature_ptr->muta3 & MUT3_INFRAVIS)
1966 creature_ptr->see_infra += 3;
1969 if (creature_ptr->muta3 & MUT3_XTRA_LEGS)
1974 if (creature_ptr->muta3 & MUT3_SHORT_LEG)
1979 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
1981 creature_ptr->sh_elec = TRUE;
1984 if (creature_ptr->muta3 & MUT3_FIRE_BODY)
1986 creature_ptr->sh_fire = TRUE;
1987 creature_ptr->lite = TRUE;
1990 if (creature_ptr->muta3 & MUT3_WART_SKIN)
1992 creature_ptr->stat_add[A_CHR] -= 2;
1993 creature_ptr->to_a += 5;
1994 creature_ptr->dis_to_a += 5;
1997 if (creature_ptr->muta3 & MUT3_SCALES)
1999 creature_ptr->stat_add[A_CHR] -= 1;
2000 creature_ptr->to_a += 10;
2001 creature_ptr->dis_to_a += 10;
2004 if (creature_ptr->muta3 & MUT3_IRON_SKIN)
2006 creature_ptr->stat_add[A_DEX] -= 1;
2007 creature_ptr->to_a += 25;
2008 creature_ptr->dis_to_a += 25;
2011 if (creature_ptr->muta3 & MUT3_WINGS)
2013 creature_ptr->levitation = TRUE;
2016 if (creature_ptr->muta3 & MUT3_FEARLESS)
2018 creature_ptr->resist_fear = TRUE;
2021 if (creature_ptr->muta3 & MUT3_REGEN)
2023 creature_ptr->regenerate = TRUE;
2026 if (creature_ptr->muta3 & MUT3_ESP)
2028 creature_ptr->telepathy = TRUE;
2031 if (creature_ptr->muta3 & MUT3_LIMBER)
2033 creature_ptr->stat_add[A_DEX] += 3;
2036 if (creature_ptr->muta3 & MUT3_ARTHRITIS)
2038 creature_ptr->stat_add[A_DEX] -= 3;
2041 if (creature_ptr->muta3 & MUT3_MOTION)
2043 creature_ptr->free_act = TRUE;
2044 creature_ptr->skill_stl += 1;
2047 if (creature_ptr->muta3 & MUT3_ILL_NORM)
2049 creature_ptr->stat_add[A_CHR] = 0;
2053 if (creature_ptr->tsuyoshi)
2055 creature_ptr->stat_add[A_STR] += 4;
2056 creature_ptr->stat_add[A_CON] += 4;
2059 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
2061 int bonus_to_h, bonus_to_d;
2062 o_ptr = &creature_ptr->inventory_list[i];
2063 if (!o_ptr->k_idx) continue;
2065 object_flags(o_ptr, flgs);
2067 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
2068 if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD;
2070 if (have_flag(flgs, TR_STR)) creature_ptr->stat_add[A_STR] += o_ptr->pval;
2071 if (have_flag(flgs, TR_INT)) creature_ptr->stat_add[A_INT] += o_ptr->pval;
2072 if (have_flag(flgs, TR_WIS)) creature_ptr->stat_add[A_WIS] += o_ptr->pval;
2073 if (have_flag(flgs, TR_DEX)) creature_ptr->stat_add[A_DEX] += o_ptr->pval;
2074 if (have_flag(flgs, TR_CON)) creature_ptr->stat_add[A_CON] += o_ptr->pval;
2075 if (have_flag(flgs, TR_CHR)) creature_ptr->stat_add[A_CHR] += o_ptr->pval;
2076 if (have_flag(flgs, TR_MAGIC_MASTERY)) creature_ptr->skill_dev += 8 * o_ptr->pval;
2077 if (have_flag(flgs, TR_STEALTH)) creature_ptr->skill_stl += o_ptr->pval;
2078 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_srh += (o_ptr->pval * 5);
2079 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_fos += (o_ptr->pval * 5);
2080 if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval;
2081 if (have_flag(flgs, TR_TUNNEL)) creature_ptr->skill_dig += (o_ptr->pval * 20);
2082 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
2083 if (have_flag(flgs, TR_BLOWS))
2085 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->ryoute) extra_blows[0] += o_ptr->pval;
2086 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->ryoute) extra_blows[1] += o_ptr->pval;
2087 else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; }
2090 if (have_flag(flgs, TR_IMPACT)) creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
2091 if (have_flag(flgs, TR_AGGRAVATE)) creature_ptr->cursed |= TRC_AGGRAVATE;
2092 if (have_flag(flgs, TR_DRAIN_EXP)) creature_ptr->cursed |= TRC_DRAIN_EXP;
2093 if (have_flag(flgs, TR_TY_CURSE)) creature_ptr->cursed |= TRC_TY_CURSE;
2094 if (have_flag(flgs, TR_ADD_L_CURSE)) creature_ptr->cursed |= TRC_ADD_L_CURSE;
2095 if (have_flag(flgs, TR_ADD_H_CURSE)) creature_ptr->cursed |= TRC_ADD_H_CURSE;
2096 if (have_flag(flgs, TR_DRAIN_HP)) creature_ptr->cursed |= TRC_DRAIN_HP;
2097 if (have_flag(flgs, TR_DRAIN_MANA)) creature_ptr->cursed |= TRC_DRAIN_MANA;
2098 if (have_flag(flgs, TR_CALL_ANIMAL)) creature_ptr->cursed |= TRC_CALL_ANIMAL;
2099 if (have_flag(flgs, TR_CALL_DEMON)) creature_ptr->cursed |= TRC_CALL_DEMON;
2100 if (have_flag(flgs, TR_CALL_DRAGON)) creature_ptr->cursed |= TRC_CALL_DRAGON;
2101 if (have_flag(flgs, TR_CALL_UNDEAD)) creature_ptr->cursed |= TRC_CALL_UNDEAD;
2102 if (have_flag(flgs, TR_COWARDICE)) creature_ptr->cursed |= TRC_COWARDICE;
2103 if (have_flag(flgs, TR_LOW_MELEE)) creature_ptr->cursed |= TRC_LOW_MELEE;
2104 if (have_flag(flgs, TR_LOW_AC)) creature_ptr->cursed |= TRC_LOW_AC;
2105 if (have_flag(flgs, TR_LOW_MAGIC)) creature_ptr->cursed |= TRC_LOW_MAGIC;
2106 if (have_flag(flgs, TR_FAST_DIGEST)) creature_ptr->cursed |= TRC_FAST_DIGEST;
2107 if (have_flag(flgs, TR_SLOW_REGEN)) creature_ptr->cursed |= TRC_SLOW_REGEN;
2108 if (have_flag(flgs, TR_DEC_MANA)) creature_ptr->dec_mana = TRUE;
2109 if (have_flag(flgs, TR_BLESSED)) creature_ptr->bless_blade = TRUE;
2110 if (have_flag(flgs, TR_XTRA_MIGHT)) creature_ptr->xtra_might = TRUE;
2111 if (have_flag(flgs, TR_SLOW_DIGEST)) creature_ptr->slow_digest = TRUE;
2112 if (have_flag(flgs, TR_REGEN)) creature_ptr->regenerate = TRUE;
2113 if (have_flag(flgs, TR_TELEPATHY)) creature_ptr->telepathy = TRUE;
2114 if (have_flag(flgs, TR_ESP_ANIMAL)) creature_ptr->esp_animal = TRUE;
2115 if (have_flag(flgs, TR_ESP_UNDEAD)) creature_ptr->esp_undead = TRUE;
2116 if (have_flag(flgs, TR_ESP_DEMON)) creature_ptr->esp_demon = TRUE;
2117 if (have_flag(flgs, TR_ESP_ORC)) creature_ptr->esp_orc = TRUE;
2118 if (have_flag(flgs, TR_ESP_TROLL)) creature_ptr->esp_troll = TRUE;
2119 if (have_flag(flgs, TR_ESP_GIANT)) creature_ptr->esp_giant = TRUE;
2120 if (have_flag(flgs, TR_ESP_DRAGON)) creature_ptr->esp_dragon = TRUE;
2121 if (have_flag(flgs, TR_ESP_HUMAN)) creature_ptr->esp_human = TRUE;
2122 if (have_flag(flgs, TR_ESP_EVIL)) creature_ptr->esp_evil = TRUE;
2123 if (have_flag(flgs, TR_ESP_GOOD)) creature_ptr->esp_good = TRUE;
2124 if (have_flag(flgs, TR_ESP_NONLIVING)) creature_ptr->esp_nonliving = TRUE;
2125 if (have_flag(flgs, TR_ESP_UNIQUE)) creature_ptr->esp_unique = TRUE;
2127 if (have_flag(flgs, TR_SEE_INVIS)) creature_ptr->see_inv = TRUE;
2128 if (have_flag(flgs, TR_LEVITATION)) creature_ptr->levitation = TRUE;
2129 if (have_flag(flgs, TR_FREE_ACT)) creature_ptr->free_act = TRUE;
2130 if (have_flag(flgs, TR_HOLD_EXP)) creature_ptr->hold_exp = TRUE;
2131 if (have_flag(flgs, TR_WARNING)) {
2132 if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
2133 creature_ptr->warning = TRUE;
2136 if (have_flag(flgs, TR_TELEPORT))
2138 if (object_is_cursed(o_ptr)) creature_ptr->cursed |= TRC_TELEPORT;
2141 concptr insc = quark_str(o_ptr->inscription);
2143 /* {.} will stop random teleportation. */
2144 if (o_ptr->inscription && angband_strchr(insc, '.'))
2149 creature_ptr->cursed |= TRC_TELEPORT_SELF;
2154 if (have_flag(flgs, TR_IM_FIRE)) creature_ptr->immune_fire = TRUE;
2155 if (have_flag(flgs, TR_IM_ACID)) creature_ptr->immune_acid = TRUE;
2156 if (have_flag(flgs, TR_IM_COLD)) creature_ptr->immune_cold = TRUE;
2157 if (have_flag(flgs, TR_IM_ELEC)) creature_ptr->immune_elec = TRUE;
2159 if (have_flag(flgs, TR_RES_ACID)) creature_ptr->resist_acid = TRUE;
2160 if (have_flag(flgs, TR_RES_ELEC)) creature_ptr->resist_elec = TRUE;
2161 if (have_flag(flgs, TR_RES_FIRE)) creature_ptr->resist_fire = TRUE;
2162 if (have_flag(flgs, TR_RES_COLD)) creature_ptr->resist_cold = TRUE;
2163 if (have_flag(flgs, TR_RES_POIS)) creature_ptr->resist_pois = TRUE;
2164 if (have_flag(flgs, TR_RES_FEAR)) creature_ptr->resist_fear = TRUE;
2165 if (have_flag(flgs, TR_RES_CONF)) creature_ptr->resist_conf = TRUE;
2166 if (have_flag(flgs, TR_RES_SOUND)) creature_ptr->resist_sound = TRUE;
2167 if (have_flag(flgs, TR_RES_LITE)) creature_ptr->resist_lite = TRUE;
2168 if (have_flag(flgs, TR_RES_DARK)) creature_ptr->resist_dark = TRUE;
2169 if (have_flag(flgs, TR_RES_CHAOS)) creature_ptr->resist_chaos = TRUE;
2170 if (have_flag(flgs, TR_RES_DISEN)) creature_ptr->resist_disen = TRUE;
2171 if (have_flag(flgs, TR_RES_SHARDS)) creature_ptr->resist_shard = TRUE;
2172 if (have_flag(flgs, TR_RES_NEXUS)) creature_ptr->resist_nexus = TRUE;
2173 if (have_flag(flgs, TR_RES_BLIND)) creature_ptr->resist_blind = TRUE;
2174 if (have_flag(flgs, TR_RES_NETHER)) creature_ptr->resist_neth = TRUE;
2176 if (have_flag(flgs, TR_REFLECT)) creature_ptr->reflect = TRUE;
2177 if (have_flag(flgs, TR_SH_FIRE)) creature_ptr->sh_fire = TRUE;
2178 if (have_flag(flgs, TR_SH_ELEC)) creature_ptr->sh_elec = TRUE;
2179 if (have_flag(flgs, TR_SH_COLD)) creature_ptr->sh_cold = TRUE;
2180 if (have_flag(flgs, TR_NO_MAGIC)) creature_ptr->anti_magic = TRUE;
2181 if (have_flag(flgs, TR_NO_TELE)) creature_ptr->anti_tele = TRUE;
2183 if (have_flag(flgs, TR_SUST_STR)) creature_ptr->sustain_str = TRUE;
2184 if (have_flag(flgs, TR_SUST_INT)) creature_ptr->sustain_int = TRUE;
2185 if (have_flag(flgs, TR_SUST_WIS)) creature_ptr->sustain_wis = TRUE;
2186 if (have_flag(flgs, TR_SUST_DEX)) creature_ptr->sustain_dex = TRUE;
2187 if (have_flag(flgs, TR_SUST_CON)) creature_ptr->sustain_con = TRUE;
2188 if (have_flag(flgs, TR_SUST_CHR)) creature_ptr->sustain_chr = TRUE;
2190 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
2191 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
2192 if (o_ptr->name2 == EGO_RING_RES_TIME) creature_ptr->resist_time = TRUE;
2193 if (o_ptr->name2 == EGO_RING_THROW) creature_ptr->mighty_throw = TRUE;
2194 if (have_flag(flgs, TR_EASY_SPELL)) creature_ptr->easy_spell = TRUE;
2195 if (o_ptr->name2 == EGO_AMU_FOOL) creature_ptr->heavy_spell = TRUE;
2196 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
2198 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
2200 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2202 creature_ptr->to_m_chance += 10;
2206 creature_ptr->to_m_chance += 3;
2210 if (o_ptr->tval == TV_CAPTURE) continue;
2212 creature_ptr->ac += o_ptr->ac;
2213 creature_ptr->dis_ac += o_ptr->ac;
2214 creature_ptr->to_a += o_ptr->to_a;
2215 if (object_is_known(o_ptr)) creature_ptr->dis_to_a += o_ptr->to_a;
2217 if (o_ptr->curse_flags & TRC_LOW_MELEE)
2219 int slot = i - INVEN_RARM;
2222 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2224 creature_ptr->to_h[slot] -= 15;
2225 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h[slot] -= 15;
2229 creature_ptr->to_h[slot] -= 5;
2230 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h[slot] -= 5;
2235 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2237 creature_ptr->to_h_b -= 15;
2238 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h_b -= 15;
2242 creature_ptr->to_h_b -= 5;
2243 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h_b -= 5;
2248 if (o_ptr->curse_flags & TRC_LOW_AC)
2250 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
2252 creature_ptr->to_a -= 30;
2253 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_a -= 30;
2257 creature_ptr->to_a -= 10;
2258 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_a -= 10;
2262 if (i == INVEN_RARM && has_melee_weapon(creature_ptr, i)) continue;
2263 if (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) continue;
2264 if (i == INVEN_BOW) continue;
2266 bonus_to_h = o_ptr->to_h;
2267 bonus_to_d = o_ptr->to_d;
2269 if (creature_ptr->pclass == CLASS_NINJA)
2271 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2;
2272 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2;
2275 creature_ptr->to_h_b += (s16b)bonus_to_h;
2276 creature_ptr->to_h_m += (s16b)bonus_to_h;
2277 creature_ptr->to_d_m += (s16b)bonus_to_d;
2279 if (object_is_known(o_ptr)) creature_ptr->dis_to_h_b += (s16b)bonus_to_h;
2281 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !creature_ptr->ryoute)
2283 creature_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2284 creature_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2285 if (object_is_known(o_ptr))
2287 creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
2288 creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
2294 if (creature_ptr->migite && creature_ptr->hidarite)
2296 creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2297 creature_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2298 creature_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2299 creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2300 if (!object_is_known(o_ptr)) continue;
2302 creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
2303 creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
2304 creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
2305 creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
2309 creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
2310 creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
2312 if (!object_is_known(o_ptr)) continue;
2314 creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
2315 creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
2318 if (object_is_armour(&creature_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&creature_ptr->inventory_list[INVEN_LARM]))
2320 creature_ptr->ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2321 creature_ptr->dis_ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
2324 if (old_mighty_throw != creature_ptr->mighty_throw)
2326 creature_ptr->window |= PW_INVEN;
2329 if (creature_ptr->cursed & TRC_TELEPORT) creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
2331 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr))
2333 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx))
2335 creature_ptr->to_a += (creature_ptr->lev * 3) / 2;
2336 creature_ptr->dis_to_a += (creature_ptr->lev * 3) / 2;
2338 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15))
2340 creature_ptr->to_a += ((creature_ptr->lev - 13) / 3);
2341 creature_ptr->dis_to_a += ((creature_ptr->lev - 13) / 3);
2343 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10))
2345 creature_ptr->to_a += ((creature_ptr->lev - 8) / 3);
2346 creature_ptr->dis_to_a += ((creature_ptr->lev - 8) / 3);
2348 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4))
2350 creature_ptr->to_a += (creature_ptr->lev - 2) / 3;
2351 creature_ptr->dis_to_a += (creature_ptr->lev - 2) / 3;
2353 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx))
2355 creature_ptr->to_a += (creature_ptr->lev / 2);
2356 creature_ptr->dis_to_a += (creature_ptr->lev / 2);
2358 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx))
2360 creature_ptr->to_a += (creature_ptr->lev / 3);
2361 creature_ptr->dis_to_a += (creature_ptr->lev / 3);
2363 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2365 creature_ptr->stat_add[A_STR] += 2;
2366 creature_ptr->stat_add[A_DEX] += 2;
2367 creature_ptr->stat_add[A_CON] -= 3;
2369 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2372 else if (creature_ptr->special_defense & KAMAE_GENBU)
2374 creature_ptr->stat_add[A_INT] -= 1;
2375 creature_ptr->stat_add[A_WIS] -= 1;
2376 creature_ptr->stat_add[A_DEX] -= 2;
2377 creature_ptr->stat_add[A_CON] += 3;
2379 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2381 creature_ptr->stat_add[A_STR] -= 2;
2382 creature_ptr->stat_add[A_INT] += 1;
2383 creature_ptr->stat_add[A_WIS] += 1;
2384 creature_ptr->stat_add[A_DEX] += 2;
2385 creature_ptr->stat_add[A_CON] -= 2;
2389 if (creature_ptr->special_defense & KATA_KOUKIJIN)
2391 for (int i = 0; i < A_MAX; i++)
2392 creature_ptr->stat_add[i] += 5;
2393 creature_ptr->to_a -= 50;
2394 creature_ptr->dis_to_a -= 50;
2397 if (creature_ptr->sh_fire) creature_ptr->lite = TRUE;
2399 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID))
2401 creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
2402 creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
2405 if (creature_ptr->realm1 == REALM_HEX)
2407 if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + casting_hex_num(creature_ptr));
2408 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
2409 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
2410 if (hex_spelling(creature_ptr, HEX_BUILDING))
2412 creature_ptr->stat_add[A_STR] += 4;
2413 creature_ptr->stat_add[A_DEX] += 4;
2414 creature_ptr->stat_add[A_CON] += 4;
2417 if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
2419 creature_ptr->sh_fire = TRUE;
2420 creature_ptr->regenerate = TRUE;
2423 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
2425 creature_ptr->sh_cold = TRUE;
2426 creature_ptr->to_a += 30;
2427 creature_ptr->dis_to_a += 30;
2430 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
2432 creature_ptr->sh_elec = TRUE;
2436 for (int i = INVEN_RARM; i <= INVEN_FEET; i++)
2438 ARMOUR_CLASS ac = 0;
2439 o_ptr = &creature_ptr->inventory_list[i];
2440 if (!o_ptr->k_idx) continue;
2441 if (!object_is_armour(o_ptr)) continue;
2442 if (!object_is_cursed(o_ptr)) continue;
2444 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
2445 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
2446 creature_ptr->to_a += (s16b)ac;
2447 creature_ptr->dis_to_a += (s16b)ac;
2452 for (int i = 0; i < A_MAX; i++)
2455 int top = modify_stat_value(creature_ptr->stat_max[i], creature_ptr->stat_add[i]);
2457 if (creature_ptr->stat_top[i] != top)
2459 creature_ptr->stat_top[i] = (s16b)top;
2460 creature_ptr->redraw |= (PR_STATS);
2461 creature_ptr->window |= (PW_PLAYER);
2464 int use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
2466 if ((i == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM))
2468 /* 10 to 18/90 charisma, guaranteed, based on level */
2469 if (use < 8 + 2 * creature_ptr->lev)
2471 use = 8 + 2 * creature_ptr->lev;
2475 if (creature_ptr->stat_use[i] != use)
2477 creature_ptr->stat_use[i] = (s16b)use;
2478 creature_ptr->redraw |= (PR_STATS);
2479 creature_ptr->window |= (PW_PLAYER);
2482 if (use <= 18) ind = (use - 3);
2483 else if (use <= 18 + 219) ind = (15 + (use - 18) / 10);
2486 if (creature_ptr->stat_ind[i] == ind) continue;
2487 creature_ptr->stat_ind[i] = (s16b)ind;
2490 creature_ptr->update |= (PU_HP);
2492 else if (i == A_INT)
2494 if (mp_ptr->spell_stat == A_INT)
2496 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2499 else if (i == A_WIS)
2501 if (mp_ptr->spell_stat == A_WIS)
2503 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2506 else if (i == A_CHR)
2508 if (mp_ptr->spell_stat == A_CHR)
2510 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2514 creature_ptr->window |= (PW_PLAYER);
2518 if (creature_ptr->stun > 50)
2520 creature_ptr->to_h[0] -= 20;
2521 creature_ptr->to_h[1] -= 20;
2522 creature_ptr->to_h_b -= 20;
2523 creature_ptr->to_h_m -= 20;
2524 creature_ptr->dis_to_h[0] -= 20;
2525 creature_ptr->dis_to_h[1] -= 20;
2526 creature_ptr->dis_to_h_b -= 20;
2527 creature_ptr->to_d[0] -= 20;
2528 creature_ptr->to_d[1] -= 20;
2529 creature_ptr->to_d_m -= 20;
2530 creature_ptr->dis_to_d[0] -= 20;
2531 creature_ptr->dis_to_d[1] -= 20;
2533 else if (creature_ptr->stun)
2535 creature_ptr->to_h[0] -= 5;
2536 creature_ptr->to_h[1] -= 5;
2537 creature_ptr->to_h_b -= 5;
2538 creature_ptr->to_h_m -= 5;
2539 creature_ptr->dis_to_h[0] -= 5;
2540 creature_ptr->dis_to_h[1] -= 5;
2541 creature_ptr->dis_to_h_b -= 5;
2542 creature_ptr->to_d[0] -= 5;
2543 creature_ptr->to_d[1] -= 5;
2544 creature_ptr->to_d_m -= 5;
2545 creature_ptr->dis_to_d[0] -= 5;
2546 creature_ptr->dis_to_d[1] -= 5;
2549 if (creature_ptr->wraith_form)
2551 creature_ptr->reflect = TRUE;
2552 creature_ptr->pass_wall = TRUE;
2555 if (creature_ptr->kabenuke)
2557 creature_ptr->pass_wall = TRUE;
2560 if (is_blessed(creature_ptr))
2562 creature_ptr->to_a += 5;
2563 creature_ptr->dis_to_a += 5;
2564 creature_ptr->to_h[0] += 10;
2565 creature_ptr->to_h[1] += 10;
2566 creature_ptr->to_h_b += 10;
2567 creature_ptr->to_h_m += 10;
2568 creature_ptr->dis_to_h[0] += 10;
2569 creature_ptr->dis_to_h[1] += 10;
2570 creature_ptr->dis_to_h_b += 10;
2573 if (creature_ptr->magicdef)
2575 creature_ptr->resist_blind = TRUE;
2576 creature_ptr->resist_conf = TRUE;
2577 creature_ptr->reflect = TRUE;
2578 creature_ptr->free_act = TRUE;
2579 creature_ptr->levitation = TRUE;
2582 if (IS_HERO(creature_ptr))
2584 creature_ptr->to_h[0] += 12;
2585 creature_ptr->to_h[1] += 12;
2586 creature_ptr->to_h_b += 12;
2587 creature_ptr->to_h_m += 12;
2588 creature_ptr->dis_to_h[0] += 12;
2589 creature_ptr->dis_to_h[1] += 12;
2590 creature_ptr->dis_to_h_b += 12;
2593 if (creature_ptr->shero)
2595 creature_ptr->to_h[0] += 12;
2596 creature_ptr->to_h[1] += 12;
2597 creature_ptr->to_h_b -= 12;
2598 creature_ptr->to_h_m += 12;
2599 creature_ptr->to_d[0] += 3 + (creature_ptr->lev / 5);
2600 creature_ptr->to_d[1] += 3 + (creature_ptr->lev / 5);
2601 creature_ptr->to_d_m += 3 + (creature_ptr->lev / 5);
2602 creature_ptr->dis_to_h[0] += 12;
2603 creature_ptr->dis_to_h[1] += 12;
2604 creature_ptr->dis_to_h_b -= 12;
2605 creature_ptr->dis_to_d[0] += 3 + (creature_ptr->lev / 5);
2606 creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
2607 creature_ptr->to_a -= 10;
2608 creature_ptr->dis_to_a -= 10;
2609 creature_ptr->skill_stl -= 7;
2610 creature_ptr->skill_dev -= 20;
2611 creature_ptr->skill_sav -= 30;
2612 creature_ptr->skill_srh -= 15;
2613 creature_ptr->skill_fos -= 15;
2614 creature_ptr->skill_tht -= 20;
2615 creature_ptr->skill_dig += 30;
2618 if (IS_FAST(creature_ptr))
2623 if (creature_ptr->slow)
2628 if (is_time_limit_esp(creature_ptr))
2630 creature_ptr->telepathy = TRUE;
2633 if (creature_ptr->ele_immune)
2635 if (creature_ptr->special_defense & DEFENSE_ACID)
2636 creature_ptr->immune_acid = TRUE;
2637 else if (creature_ptr->special_defense & DEFENSE_ELEC)
2638 creature_ptr->immune_elec = TRUE;
2639 else if (creature_ptr->special_defense & DEFENSE_FIRE)
2640 creature_ptr->immune_fire = TRUE;
2641 else if (creature_ptr->special_defense & DEFENSE_COLD)
2642 creature_ptr->immune_cold = TRUE;
2645 if (creature_ptr->tim_invis)
2647 creature_ptr->see_inv = TRUE;
2650 if (creature_ptr->tim_infra)
2652 creature_ptr->see_infra += 3;
2655 if (creature_ptr->tim_regen)
2657 creature_ptr->regenerate = TRUE;
2660 if (creature_ptr->tim_levitation)
2662 creature_ptr->levitation = TRUE;
2665 if (creature_ptr->tim_reflect)
2667 creature_ptr->reflect = TRUE;
2670 if (IS_HERO(creature_ptr) || creature_ptr->shero)
2672 creature_ptr->resist_fear = TRUE;
2675 if (creature_ptr->telepathy != old_telepathy)
2677 creature_ptr->update |= (PU_MONSTERS);
2680 if ((creature_ptr->esp_animal != old_esp_animal) ||
2681 (creature_ptr->esp_undead != old_esp_undead) ||
2682 (creature_ptr->esp_demon != old_esp_demon) ||
2683 (creature_ptr->esp_orc != old_esp_orc) ||
2684 (creature_ptr->esp_troll != old_esp_troll) ||
2685 (creature_ptr->esp_giant != old_esp_giant) ||
2686 (creature_ptr->esp_dragon != old_esp_dragon) ||
2687 (creature_ptr->esp_human != old_esp_human) ||
2688 (creature_ptr->esp_evil != old_esp_evil) ||
2689 (creature_ptr->esp_good != old_esp_good) ||
2690 (creature_ptr->esp_nonliving != old_esp_nonliving) ||
2691 (creature_ptr->esp_unique != old_esp_unique))
2693 creature_ptr->update |= (PU_MONSTERS);
2696 if (creature_ptr->see_inv != old_see_inv)
2698 creature_ptr->update |= (PU_MONSTERS);
2701 if (creature_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
2703 if (creature_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
2705 if ((creature_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
2706 (creature_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
2708 creature_ptr->to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2709 creature_ptr->dis_to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2712 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2714 int penalty1, penalty2;
2715 penalty1 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_RARM].weight) / 8);
2716 penalty2 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_LARM].weight) / 8);
2717 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
2719 penalty1 = penalty1 / 2 - 5;
2720 penalty2 = penalty2 / 2 - 5;
2722 creature_ptr->to_a += 10;
2723 creature_ptr->dis_to_a += 10;
2727 if (penalty1 > 0) penalty1 /= 2;
2728 if (penalty2 > 0) penalty2 /= 2;
2730 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)))
2732 penalty1 = MAX(0, penalty1 - 10);
2733 penalty2 = MAX(0, penalty2 - 10);
2735 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
2737 penalty1 = MIN(0, penalty1);
2738 penalty2 = MIN(0, penalty2);
2739 creature_ptr->to_a += 10;
2740 creature_ptr->dis_to_a += 10;
2744 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
2746 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
2750 if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
2751 if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
2752 creature_ptr->to_h[0] -= (s16b)penalty1;
2753 creature_ptr->to_h[1] -= (s16b)penalty2;
2754 creature_ptr->dis_to_h[0] -= (s16b)penalty1;
2755 creature_ptr->dis_to_h[1] -= (s16b)penalty2;
2758 int j = creature_ptr->total_weight;
2759 if (!creature_ptr->riding)
2761 count = (int)weight_limit(creature_ptr);
2765 monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
2766 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2767 SPEED speed = riding_m_ptr->mspeed;
2769 if (riding_m_ptr->mspeed > 110)
2771 new_speed = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2772 if (new_speed < 110) new_speed = 110;
2779 new_speed += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2780 if (monster_fast_remaining(riding_m_ptr)) new_speed += 10;
2781 if (monster_slow_remaining(riding_m_ptr)) new_speed -= 10;
2782 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
2783 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) creature_ptr->can_swim = TRUE;
2785 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) creature_ptr->pass_wall = FALSE;
2786 if (riding_r_ptr->flags2 & RF2_KILL_WALL) creature_ptr->kill_wall = TRUE;
2788 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2789 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2791 count = 1500 + riding_r_ptr->level * 25;
2794 if (j > count) new_speed -= ((j - count) / (count / 5));
2795 if (creature_ptr->action == ACTION_SEARCH) new_speed -= 10;
2796 if (creature_ptr->prace == RACE_MERFOLK)
2798 if (have_flag(f_ptr->flags, FF_WATER))
2800 new_speed += (2 + creature_ptr->lev / 10);
2802 else if (!creature_ptr->levitation)
2808 creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2809 creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2810 creature_ptr->to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2811 creature_ptr->to_d_m += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2812 creature_ptr->to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2813 creature_ptr->to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2814 creature_ptr->to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2815 creature_ptr->to_h_m += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2816 creature_ptr->to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2817 creature_ptr->to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2818 creature_ptr->to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2819 creature_ptr->to_h_m += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2820 creature_ptr->dis_to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2821 creature_ptr->dis_to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2822 creature_ptr->dis_to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2823 creature_ptr->dis_to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2824 creature_ptr->dis_to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2825 creature_ptr->dis_to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2826 creature_ptr->dis_to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2827 creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2828 creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2830 hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
2831 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2832 creature_ptr->heavy_shoot = is_heavy_shoot(creature_ptr, o_ptr);
2833 if (creature_ptr->heavy_shoot)
2835 creature_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
2836 creature_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
2841 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
2842 if (o_ptr->k_idx && !creature_ptr->heavy_shoot)
2844 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
2845 if ((creature_ptr->pclass == CLASS_SNIPER) &&
2846 (creature_ptr->tval_ammo == TV_BOLT))
2848 creature_ptr->to_h_b += (10 + (creature_ptr->lev / 5));
2849 creature_ptr->dis_to_h_b += (10 + (creature_ptr->lev / 5));
2854 if (creature_ptr->ryoute) hold *= 2;
2855 for (int i = 0; i < 2; i++)
2857 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2858 object_flags(o_ptr, flgs);
2859 creature_ptr->heavy_wield[i] = FALSE;
2860 creature_ptr->icky_wield[i] = FALSE;
2861 creature_ptr->riding_wield[i] = FALSE;
2862 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
2864 creature_ptr->num_blow[i] = 1;
2868 if (hold < o_ptr->weight / 10)
2870 creature_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
2871 creature_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
2872 creature_ptr->heavy_wield[i] = TRUE;
2874 else if (creature_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE;
2876 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
2878 creature_ptr->to_a += 5;
2879 creature_ptr->dis_to_a += 5;
2882 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i])
2884 int str_index, dex_index;
2885 int num = 0, wgt = 0, mul = 0, div = 0;
2886 switch (creature_ptr->pclass)
2889 num = 6; wgt = 70; mul = 5; break;
2891 case CLASS_BERSERKER:
2892 num = 6; wgt = 70; mul = 7; break;
2895 case CLASS_HIGH_MAGE:
2896 case CLASS_BLUE_MAGE:
2897 num = 3; wgt = 100; mul = 2; break;
2900 case CLASS_MAGIC_EATER:
2901 case CLASS_MINDCRAFTER:
2902 num = 5; wgt = 100; mul = 3; break;
2905 num = 5; wgt = 40; mul = 3; break;
2908 num = 5; wgt = 70; mul = 4; break;
2912 num = 5; wgt = 70; mul = 4; break;
2915 num = 5; wgt = 150; mul = 5; break;
2917 case CLASS_WARRIOR_MAGE:
2918 case CLASS_RED_MAGE:
2919 num = 5; wgt = 70; mul = 3; break;
2921 case CLASS_CHAOS_WARRIOR:
2922 num = 5; wgt = 70; mul = 4; break;
2925 num = 5; wgt = 60; mul = 3; break;
2928 num = 4; wgt = 100; mul = 3; break;
2930 case CLASS_IMITATOR:
2931 num = 5; wgt = 70; mul = 4; break;
2933 case CLASS_BEASTMASTER:
2934 num = 5; wgt = 70; mul = 3; break;
2937 if ((creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
2938 else { num = 5; wgt = 100; mul = 3; }
2941 case CLASS_SORCERER:
2942 num = 1; wgt = 1; mul = 1; break;
2947 num = 4; wgt = 70; mul = 2; break;
2949 case CLASS_FORCETRAINER:
2950 num = 4; wgt = 60; mul = 2; break;
2952 case CLASS_MIRROR_MASTER:
2953 num = 3; wgt = 100; mul = 3; break;
2956 num = 4; wgt = 20; mul = 1; break;
2959 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING))
2966 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
2967 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
2969 if (creature_ptr->ryoute && !omoi) str_index++;
2970 if (creature_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1);
2971 if (str_index > 11) str_index = 11;
2973 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
2974 if (dex_index > 11) dex_index = 11;
2976 creature_ptr->num_blow[i] = blows_table[str_index][dex_index];
2977 if (creature_ptr->num_blow[i] > num) creature_ptr->num_blow[i] = (s16b)num;
2979 creature_ptr->num_blow[i] += (s16b)extra_blows[i];
2980 if (creature_ptr->pclass == CLASS_WARRIOR) creature_ptr->num_blow[i] += (creature_ptr->lev / 40);
2981 else if (creature_ptr->pclass == CLASS_BERSERKER)
2982 creature_ptr->num_blow[i] += (creature_ptr->lev / 23);
2983 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
2984 creature_ptr->num_blow[i] ++;
2986 if (creature_ptr->special_defense & KATA_FUUJIN)
2987 creature_ptr->num_blow[i] -= 1;
2989 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
2990 creature_ptr->num_blow[i] = 1;
2992 if (creature_ptr->num_blow[i] < 1)
2993 creature_ptr->num_blow[i] = 1;
2995 creature_ptr->skill_dig += (o_ptr->weight / 10);
2998 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
2999 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
3001 creature_ptr->to_h[i] -= 2;
3002 creature_ptr->to_d[i] -= 2;
3003 creature_ptr->dis_to_h[i] -= 2;
3004 creature_ptr->dis_to_d[i] -= 2;
3005 creature_ptr->icky_wield[i] = TRUE;
3007 else if (creature_ptr->pclass == CLASS_BERSERKER)
3009 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3010 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3011 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3012 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3013 if (((i == 0) && !creature_ptr->hidarite) || creature_ptr->ryoute)
3015 creature_ptr->to_h[i] += creature_ptr->lev / 5;
3016 creature_ptr->to_d[i] += creature_ptr->lev / 6;
3017 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
3018 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
3021 else if (creature_ptr->pclass == CLASS_SORCERER)
3023 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
3025 creature_ptr->to_h[i] -= 200;
3026 creature_ptr->to_d[i] -= 200;
3027 creature_ptr->dis_to_h[i] -= 200;
3028 creature_ptr->dis_to_d[i] -= 200;
3029 creature_ptr->icky_wield[i] = TRUE;
3033 creature_ptr->to_h[i] -= 30;
3034 creature_ptr->to_d[i] -= 10;
3035 creature_ptr->dis_to_h[i] -= 30;
3036 creature_ptr->dis_to_d[i] -= 10;
3040 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr))
3042 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3043 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
3044 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
3045 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
3046 if (hex_spelling(creature_ptr, HEX_RUNESWORD))
3048 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
3049 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
3050 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
3054 if (creature_ptr->riding == 0) continue;
3056 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3058 creature_ptr->to_h[i] += 15;
3059 creature_ptr->dis_to_h[i] += 15;
3060 creature_ptr->to_dd[i] += 2;
3064 if (have_flag(flgs, TR_RIDING)) continue;
3067 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3073 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3075 if (penalty < 30) penalty = 30;
3078 creature_ptr->to_h[i] -= (s16b)penalty;
3079 creature_ptr->dis_to_h[i] -= (s16b)penalty;
3080 creature_ptr->riding_wield[i] = TRUE;
3083 if (creature_ptr->riding)
3087 creature_ptr->riding_ryoute = FALSE;
3089 if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
3090 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
3092 switch (creature_ptr->pclass)
3095 case CLASS_FORCETRAINER:
3096 case CLASS_BERSERKER:
3097 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
3098 creature_ptr->riding_ryoute = TRUE;
3103 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
3105 if (creature_ptr->tval_ammo != TV_ARROW) penalty = 5;
3109 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
3111 if (penalty < 30) penalty = 30;
3114 if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
3115 creature_ptr->to_h_b -= (s16b)penalty;
3116 creature_ptr->dis_to_h_b -= (s16b)penalty;
3119 /* Different calculation for monks with empty hands */
3120 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) &&
3121 (empty_hands_status & EMPTY_HAND_RARM) && !creature_ptr->hidarite)
3123 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
3124 creature_ptr->num_blow[0] = 0;
3126 if (creature_ptr->pclass == CLASS_FORCETRAINER)
3128 if (blow_base > 18) creature_ptr->num_blow[0]++;
3129 if (blow_base > 31) creature_ptr->num_blow[0]++;
3130 if (blow_base > 44) creature_ptr->num_blow[0]++;
3131 if (blow_base > 58) creature_ptr->num_blow[0]++;
3133 MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
3134 if (current_ki != 0)
3136 creature_ptr->to_d[0] += current_ki / 5;
3137 creature_ptr->dis_to_d[0] += current_ki / 5;
3142 if (blow_base > 12) creature_ptr->num_blow[0]++;
3143 if (blow_base > 22) creature_ptr->num_blow[0]++;
3144 if (blow_base > 31) creature_ptr->num_blow[0]++;
3145 if (blow_base > 39) creature_ptr->num_blow[0]++;
3146 if (blow_base > 46) creature_ptr->num_blow[0]++;
3147 if (blow_base > 53) creature_ptr->num_blow[0]++;
3148 if (blow_base > 59) creature_ptr->num_blow[0]++;
3151 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
3152 creature_ptr->num_blow[0] /= 2;
3155 creature_ptr->to_h[0] += (creature_ptr->lev / 3);
3156 creature_ptr->dis_to_h[0] += (creature_ptr->lev / 3);
3158 creature_ptr->to_d[0] += (creature_ptr->lev / 6);
3159 creature_ptr->dis_to_d[0] += (creature_ptr->lev / 6);
3162 if (creature_ptr->special_defense & KAMAE_BYAKKO)
3164 creature_ptr->to_a -= 40;
3165 creature_ptr->dis_to_a -= 40;
3168 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
3170 creature_ptr->to_a -= 50;
3171 creature_ptr->dis_to_a -= 50;
3172 creature_ptr->resist_acid = TRUE;
3173 creature_ptr->resist_fire = TRUE;
3174 creature_ptr->resist_elec = TRUE;
3175 creature_ptr->resist_cold = TRUE;
3176 creature_ptr->resist_pois = TRUE;
3177 creature_ptr->sh_fire = TRUE;
3178 creature_ptr->sh_elec = TRUE;
3179 creature_ptr->sh_cold = TRUE;
3180 creature_ptr->levitation = TRUE;
3182 else if (creature_ptr->special_defense & KAMAE_GENBU)
3184 creature_ptr->to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3185 creature_ptr->dis_to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
3186 creature_ptr->reflect = TRUE;
3187 creature_ptr->num_blow[0] -= 2;
3188 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42)) creature_ptr->num_blow[0]--;
3189 if (creature_ptr->num_blow[0] < 0) creature_ptr->num_blow[0] = 0;
3191 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
3193 creature_ptr->to_h[0] -= (creature_ptr->lev / 3);
3194 creature_ptr->to_d[0] -= (creature_ptr->lev / 6);
3196 creature_ptr->dis_to_h[0] -= (creature_ptr->lev / 3);
3197 creature_ptr->dis_to_d[0] -= (creature_ptr->lev / 6);
3198 creature_ptr->num_blow[0] /= 2;
3199 creature_ptr->levitation = TRUE;
3202 creature_ptr->num_blow[0] += 1 + extra_blows[0];
3205 if (creature_ptr->riding) creature_ptr->levitation = riding_levitation;
3207 creature_ptr->monk_armour_aux = FALSE;
3209 if (heavy_armor(creature_ptr))
3211 creature_ptr->monk_armour_aux = TRUE;
3214 for (int i = 0; i < 2; i++)
3216 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3218 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
3219 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
3221 creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3222 creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
3223 if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
3225 if (!s_info[creature_ptr->pclass].w_max[tval][sval])
3227 creature_ptr->to_h[i] -= 40;
3228 creature_ptr->dis_to_h[i] -= 40;
3229 creature_ptr->icky_wield[i] = TRUE;
3235 if (creature_ptr->pclass != CLASS_NINJA) continue;
3237 if ((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD))
3240 creature_ptr->to_h[i] -= 40;
3241 creature_ptr->dis_to_h[i] -= 40;
3242 creature_ptr->icky_wield[i] = TRUE;
3243 creature_ptr->num_blow[i] /= 2;
3244 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
3247 /* Maximum speed is (+99). (internally it's 110 + 99) */
3248 /* Temporary lightspeed forces to be maximum speed */
3249 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (new_speed > 209))
3254 /* Minimum speed is (-99). (internally it's 110 - 99) */
3255 if (new_speed < 11) new_speed = 11;
3257 if (creature_ptr->pspeed != (byte)new_speed)
3259 creature_ptr->pspeed = (byte)new_speed;
3260 creature_ptr->redraw |= (PR_SPEED);
3265 if (creature_ptr->to_a > (0 - creature_ptr->ac))
3266 creature_ptr->to_a = 0 - creature_ptr->ac;
3267 if (creature_ptr->dis_to_a > (0 - creature_ptr->dis_ac))
3268 creature_ptr->dis_to_a = 0 - creature_ptr->dis_ac;
3271 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a))
3273 creature_ptr->redraw |= (PR_ARMOR);
3274 creature_ptr->window |= (PW_PLAYER);
3277 if (creature_ptr->ryoute && !omoi)
3279 int bonus_to_h = 0, bonus_to_d = 0;
3280 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
3281 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);
3283 creature_ptr->to_h[default_hand] += MAX(bonus_to_h, 1);
3284 creature_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1);
3285 creature_ptr->to_d[default_hand] += MAX(bonus_to_d, 1);
3286 creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
3289 bool is_special_class = creature_ptr->pclass == CLASS_MONK;
3290 is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
3291 is_special_class |= creature_ptr->pclass == CLASS_BERSERKER;
3292 if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
3293 creature_ptr->ryoute = FALSE;
3295 creature_ptr->skill_stl += 1;
3297 if (is_time_limit_stealth(creature_ptr))
3298 creature_ptr->skill_stl += 99;
3300 creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
3301 creature_ptr->skill_dis += adj_int_dis[creature_ptr->stat_ind[A_INT]];
3302 creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
3303 creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
3304 creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
3305 creature_ptr->skill_dis += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
3306 creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
3307 creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
3308 creature_ptr->skill_stl += (cp_ptr->x_stl * creature_ptr->lev / 10);
3309 creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
3310 creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
3311 creature_ptr->skill_thn += ((cp_ptr->x_thn * creature_ptr->lev / 10) + (ap_ptr->a_thn * creature_ptr->lev / 50));
3312 creature_ptr->skill_thb += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3313 creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
3315 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
3317 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
3318 creature_ptr->skill_stl = MIN(creature_ptr->skill_stl - 3, (creature_ptr->skill_stl + 2) / 2);
3321 if (creature_ptr->skill_stl > 30) creature_ptr->skill_stl = 30;
3322 if (creature_ptr->skill_stl < 0) creature_ptr->skill_stl = 0;
3323 if (creature_ptr->skill_dig < 1) creature_ptr->skill_dig = 1;
3324 if (creature_ptr->anti_magic && (creature_ptr->skill_sav < (90 + creature_ptr->lev)))
3325 creature_ptr->skill_sav = 90 + creature_ptr->lev;
3326 if (creature_ptr->tsubureru) creature_ptr->skill_sav = 10;
3327 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (creature_ptr->skill_sav < (95 + creature_ptr->lev)))
3328 creature_ptr->skill_sav = 95 + creature_ptr->lev;
3330 if (down_saving) creature_ptr->skill_sav /= 2;
3332 if (creature_ptr->immune_acid) creature_ptr->resist_acid = TRUE;
3333 if (creature_ptr->immune_elec) creature_ptr->resist_elec = TRUE;
3334 if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
3335 if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
3337 if (current_world_ptr->character_xtra) return;
3339 if (creature_ptr->old_heavy_shoot != creature_ptr->heavy_shoot)
3341 if (creature_ptr->heavy_shoot)
3343 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
3345 else if (creature_ptr->inventory_list[INVEN_BOW].k_idx)
3347 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
3351 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
3354 creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
3357 for (int i = 0; i < 2; i++)
3359 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
3361 if (creature_ptr->heavy_wield[i])
3363 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
3365 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3367 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
3369 else if (creature_ptr->heavy_wield[1 - i])
3371 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
3375 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
3378 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
3381 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i])
3383 if (creature_ptr->riding_wield[i])
3385 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
3387 else if (!creature_ptr->riding)
3389 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
3391 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3393 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
3396 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
3399 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
3402 if (creature_ptr->icky_wield[i])
3404 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
3405 if (current_world_ptr->is_loading_now)
3407 chg_virtue(creature_ptr, V_FAITH, -1);
3410 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3412 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
3416 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
3419 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
3422 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
3424 if (creature_ptr->riding_ryoute)
3427 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
3429 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
3435 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
3437 msg_print("You began to control the pet you're riding with one hand.");
3441 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
3444 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))
3446 if (heavy_armor(creature_ptr))
3448 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
3449 if (current_world_ptr->is_loading_now)
3451 chg_virtue(creature_ptr, V_HARMONY, -1);
3456 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
3459 creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
3462 for (int i = 0; i < INVEN_PACK; i++)
3464 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
3465 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
3468 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)
3470 o_ptr = &floor_ptr->o_list[this_o_idx];
3471 next_o_idx = o_ptr->next_o_idx;
3473 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
3474 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
3477 if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
3479 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
3481 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
3482 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3485 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER)))
3487 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE];
3488 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3493 static void calc_alignment(player_type *creature_ptr)
3495 creature_ptr->align = 0;
3496 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3497 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
3499 monster_type *m_ptr;
3500 monster_race *r_ptr;
3501 m_ptr = &floor_ptr->m_list[m_idx];
3502 if (!monster_is_valid(m_ptr)) continue;
3503 r_ptr = &r_info[m_ptr->r_idx];
3505 if (!is_pet(m_ptr)) continue;
3507 if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3508 if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
3511 if (creature_ptr->mimic_form)
3513 switch (creature_ptr->mimic_form)
3516 creature_ptr->align -= 200;
3518 case MIMIC_DEMON_LORD:
3519 creature_ptr->align -= 200;
3525 switch (creature_ptr->prace)
3528 creature_ptr->align += 200;
3531 creature_ptr->align -= 200;
3536 for (int i = 0; i < 2; i++)
3538 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3539 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL) continue;
3540 creature_ptr->align -= 1000;
3545 for (int i = 0; i < 8; i++)
3547 switch (creature_ptr->vir_types[i])
3550 creature_ptr->align += creature_ptr->virtues[i] * 2;
3559 creature_ptr->align -= creature_ptr->virtues[i];
3562 creature_ptr->align += creature_ptr->virtues[i];
3567 for (int i = 0; i < j; i++)
3569 if (creature_ptr->align > 0)
3571 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
3572 if (creature_ptr->align < 0) creature_ptr->align = 0;
3574 else if (creature_ptr->align < 0)
3576 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
3577 if (creature_ptr->align > 0) creature_ptr->align = 0;
3584 * @brief プレイヤーの最大HPを計算する /
3585 * Calculate the players (maximal) hit points
3586 * Adjust current hitpoints if necessary
3590 static void calc_hitpoints(player_type *creature_ptr)
3592 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
3593 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
3596 if (creature_ptr->mimic_form)
3598 if (creature_ptr->pclass == CLASS_SORCERER)
3599 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3601 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3602 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
3605 if (creature_ptr->pclass == CLASS_SORCERER)
3607 if (creature_ptr->lev < 30)
3608 mhp = (mhp * (45 + creature_ptr->lev) / 100);
3610 mhp = (mhp * 75 / 100);
3611 bonus = (bonus * 65 / 100);
3616 if (creature_ptr->pclass == CLASS_BERSERKER)
3618 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
3621 if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
3622 if (IS_HERO(creature_ptr)) mhp += 10;
3623 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
3624 if (creature_ptr->tsuyoshi) mhp += 50;
3625 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) mhp += 15;
3626 if (hex_spelling(creature_ptr, HEX_BUILDING)) mhp += 60;
3627 if (creature_ptr->mhp == mhp) return;
3629 if (creature_ptr->chp >= mhp)
3631 creature_ptr->chp = mhp;
3632 creature_ptr->chp_frac = 0;
3636 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
3638 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
3641 creature_ptr->mhp = mhp;
3643 creature_ptr->redraw |= PR_HP;
3644 creature_ptr->window |= PW_PLAYER;
3649 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
3652 * SWD: Experimental modification: multiple light sources have additive effect.
3654 static void calc_torch(player_type *creature_ptr)
3656 creature_ptr->cur_lite = 0;
3657 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
3660 o_ptr = &creature_ptr->inventory_list[i];
3661 if (!o_ptr->k_idx) continue;
3663 if (o_ptr->name2 == EGO_LITE_SHINE) creature_ptr->cur_lite++;
3664 if (o_ptr->name2 != EGO_LITE_DARKNESS)
3666 if (o_ptr->tval == TV_LITE)
3668 if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
3669 if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
3673 BIT_FLAGS flgs[TR_FLAG_SIZE];
3674 object_flags(o_ptr, flgs);
3677 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
3678 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
3679 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
3680 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
3681 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
3682 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
3683 creature_ptr->cur_lite += rad;
3686 if (d_info[creature_ptr->dungeon_idx].flags1 & DF1_DARKNESS && creature_ptr->cur_lite > 1)
3687 creature_ptr->cur_lite = 1;
3689 if (creature_ptr->cur_lite <= 0 && creature_ptr->lite)
3690 creature_ptr->cur_lite++;
3692 if (creature_ptr->cur_lite > 14)
3693 creature_ptr->cur_lite = 14;
3695 if (creature_ptr->cur_lite < 0)
3696 creature_ptr->cur_lite = 0;
3698 if (creature_ptr->old_lite == creature_ptr->cur_lite)
3701 creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
3702 creature_ptr->old_lite = creature_ptr->cur_lite;
3704 if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
3705 set_superstealth(creature_ptr, FALSE);
3710 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
3711 * Calculate number of spells player should have, and forget,
3712 * or remember, spells until that number is properly reflected.
3715 * Note that this function induces various "status" messages,
3716 * which must be bypasses until the character is created.
3718 static void calc_spells(player_type *creature_ptr)
3720 if (!mp_ptr->spell_book) return;
3721 if (!current_world_ptr->character_generated) return;
3722 if (current_world_ptr->character_xtra) return;
3723 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3725 creature_ptr->new_spells = 0;
3729 concptr p = spell_category_name(mp_ptr->spell_book);
3730 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
3731 if (levels < 0) levels = 0;
3733 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
3735 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
3740 if (creature_ptr->pclass == CLASS_SAMURAI)
3744 else if (creature_ptr->realm2 == REALM_NONE)
3746 num_allowed = (num_allowed + 1) / 2;
3747 if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus;
3749 else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST))
3751 if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus;
3755 if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus;
3758 int num_boukyaku = 0;
3759 for (int j = 0; j < 64; j++)
3762 (creature_ptr->spell_forgotten1 & (1L << j)) :
3763 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
3769 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
3770 for (int i = 63; i >= 0; i--)
3772 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3774 int j = creature_ptr->spell_order[i];
3775 if (j >= 99) continue;
3777 const magic_type *s_ptr;
3778 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3781 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3783 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3786 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3788 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3790 if (s_ptr->slevel <= creature_ptr->lev) continue;
3792 bool is_spell_learned = (j < 32) ?
3793 (creature_ptr->spell_learned1 & (1L << j)) :
3794 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3795 if (!is_spell_learned) continue;
3800 creature_ptr->spell_forgotten1 |= (1L << j);
3801 which = creature_ptr->realm1;
3805 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3806 which = creature_ptr->realm2;
3811 creature_ptr->spell_learned1 &= ~(1L << j);
3812 which = creature_ptr->realm1;
3816 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3817 which = creature_ptr->realm2;
3821 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3823 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3825 creature_ptr->new_spells++;
3828 /* Forget spells if we know too many spells */
3829 for (int i = 63; i >= 0; i--)
3831 if (creature_ptr->new_spells >= 0) break;
3832 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3834 int j = creature_ptr->spell_order[i];
3835 if (j >= 99) continue;
3837 bool is_spell_learned = (j < 32) ?
3838 (creature_ptr->spell_learned1 & (1L << j)) :
3839 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3840 if (!is_spell_learned) continue;
3845 creature_ptr->spell_forgotten1 |= (1L << j);
3846 which = creature_ptr->realm1;
3850 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3851 which = creature_ptr->realm2;
3856 creature_ptr->spell_learned1 &= ~(1L << j);
3857 which = creature_ptr->realm1;
3861 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3862 which = creature_ptr->realm2;
3866 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3868 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3870 creature_ptr->new_spells++;
3873 /* Check for spells to remember */
3874 for (int i = 0; i < 64; i++)
3876 if (creature_ptr->new_spells <= 0) break;
3877 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
3878 int j = creature_ptr->spell_order[i];
3881 const magic_type *s_ptr;
3882 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3885 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3887 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3890 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3892 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3894 if (s_ptr->slevel > creature_ptr->lev) continue;
3896 bool is_spell_learned = (j < 32) ?
3897 (creature_ptr->spell_forgotten1 & (1L << j)) :
3898 (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
3899 if (!is_spell_learned) continue;
3904 creature_ptr->spell_forgotten1 &= ~(1L << j);
3905 which = creature_ptr->realm1;
3909 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
3910 which = creature_ptr->realm2;
3915 creature_ptr->spell_learned1 |= (1L << j);
3916 which = creature_ptr->realm1;
3920 creature_ptr->spell_learned2 |= (1L << (j - 32));
3921 which = creature_ptr->realm2;
3925 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3927 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3929 creature_ptr->new_spells--;
3932 if (creature_ptr->realm2 == REALM_NONE)
3935 for (int j = 0; j < 32; j++)
3937 const magic_type *s_ptr;
3938 if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3939 else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3941 if (s_ptr->slevel > creature_ptr->lev) continue;
3943 if (creature_ptr->spell_learned1 & (1L << j))
3952 if ((creature_ptr->new_spells > k) &&
3953 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
3955 creature_ptr->new_spells = (s16b)k;
3959 if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
3961 if (creature_ptr->old_spells == creature_ptr->new_spells) return;
3963 if (creature_ptr->new_spells)
3966 if (creature_ptr->new_spells < 10) {
3967 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
3970 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
3973 msg_format("You can learn %d more %s%s.",
3974 creature_ptr->new_spells, p,
3975 (creature_ptr->new_spells != 1) ? "s" : "");
3979 creature_ptr->old_spells = creature_ptr->new_spells;
3980 creature_ptr->redraw |= PR_STUDY;
3981 creature_ptr->window |= PW_OBJECT;
3986 * @brief プレイヤーの最大MPを計算する /
3987 * Calculate maximum mana. You do not need to know any spells.
3988 * Note that mana is lowered by heavy (or inappropriate) armor.
3991 * This function induces status messages.
3993 static void calc_mana(player_type *creature_ptr)
3995 if (!mp_ptr->spell_book) return;
3998 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3999 (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
4000 (creature_ptr->pclass == CLASS_BLUE_MAGE))
4002 levels = creature_ptr->lev;
4006 if (mp_ptr->spell_first > creature_ptr->lev)
4008 creature_ptr->msp = 0;
4009 creature_ptr->redraw |= (PR_MANA);
4013 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
4017 if (creature_ptr->pclass == CLASS_SAMURAI)
4019 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
4020 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4024 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
4026 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
4027 if (msp && (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)) msp += msp / 2;
4028 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
4029 if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
4032 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
4034 BIT_FLAGS flgs[TR_FLAG_SIZE];
4035 creature_ptr->cumber_glove = FALSE;
4037 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
4038 object_flags(o_ptr, flgs);
4040 !(have_flag(flgs, TR_FREE_ACT)) &&
4041 !(have_flag(flgs, TR_DEC_MANA)) &&
4042 !(have_flag(flgs, TR_EASY_SPELL)) &&
4043 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
4044 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
4046 creature_ptr->cumber_glove = TRUE;
4047 msp = (3 * msp) / 4;
4051 creature_ptr->cumber_armor = FALSE;
4054 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4055 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4056 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4057 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4058 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4059 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4060 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4062 switch (creature_ptr->pclass)
4065 case CLASS_HIGH_MAGE:
4066 case CLASS_BLUE_MAGE:
4068 case CLASS_FORCETRAINER:
4069 case CLASS_SORCERER:
4071 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4072 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4079 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4080 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
4083 case CLASS_MINDCRAFTER:
4084 case CLASS_BEASTMASTER:
4085 case CLASS_MIRROR_MASTER:
4087 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
4088 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
4093 case CLASS_RED_MAGE:
4094 case CLASS_WARRIOR_MAGE:
4096 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
4097 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
4101 case CLASS_CHAOS_WARRIOR:
4103 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
4104 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
4113 int max_wgt = mp_ptr->spell_weight;
4114 if ((cur_wgt - max_wgt) > 0)
4116 creature_ptr->cumber_armor = TRUE;
4117 switch (creature_ptr->pclass)
4120 case CLASS_HIGH_MAGE:
4121 case CLASS_BLUE_MAGE:
4123 msp -= msp * (cur_wgt - max_wgt) / 600;
4127 case CLASS_MINDCRAFTER:
4128 case CLASS_BEASTMASTER:
4130 case CLASS_FORCETRAINER:
4132 case CLASS_MIRROR_MASTER:
4134 msp -= msp * (cur_wgt - max_wgt) / 800;
4137 case CLASS_SORCERER:
4139 msp -= msp * (cur_wgt - max_wgt) / 900;
4145 case CLASS_RED_MAGE:
4147 msp -= msp * (cur_wgt - max_wgt) / 1000;
4151 case CLASS_CHAOS_WARRIOR:
4152 case CLASS_WARRIOR_MAGE:
4154 msp -= msp * (cur_wgt - max_wgt) / 1200;
4159 creature_ptr->cumber_armor = FALSE;
4164 msp -= msp * (cur_wgt - max_wgt) / 800;
4170 if (msp < 0) msp = 0;
4172 if (creature_ptr->msp != msp)
4174 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
4176 creature_ptr->csp = msp;
4177 creature_ptr->csp_frac = 0;
4181 if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
4183 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
4186 creature_ptr->msp = msp;
4187 creature_ptr->redraw |= (PR_MANA);
4188 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4191 if (current_world_ptr->character_xtra) return;
4193 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
4195 if (creature_ptr->cumber_glove)
4196 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
4198 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
4200 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
4203 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor) return;
4205 if (creature_ptr->cumber_armor)
4206 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
4208 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
4210 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
4215 * @brief 装備中の射撃武器の威力倍率を返す /
4216 * calcurate the fire rate of target object
4217 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
4218 * @return 射撃倍率の値(100で1.00倍)
4220 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
4222 int extra_shots = 0;
4223 BIT_FLAGS flgs[TR_FLAG_SIZE];
4224 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
4227 q_ptr = &creature_ptr->inventory_list[i];
4228 if (!q_ptr->k_idx) continue;
4230 if (i == INVEN_BOW) continue;
4232 object_flags(q_ptr, flgs);
4233 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4236 object_flags(o_ptr, flgs);
4237 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4240 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
4244 num += (extra_shots * 100);
4246 tval_type tval_ammo = bow_tval_ammo(o_ptr);
4247 if ((creature_ptr->pclass == CLASS_RANGER) &&
4248 (tval_ammo == TV_ARROW))
4250 num += (creature_ptr->lev * 4);
4253 if ((creature_ptr->pclass == CLASS_CAVALRY) &&
4254 (tval_ammo == TV_ARROW))
4256 num += (creature_ptr->lev * 3);
4259 if (creature_ptr->pclass == CLASS_ARCHER)
4261 if (tval_ammo == TV_ARROW)
4262 num += ((creature_ptr->lev * 5) + 50);
4263 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
4264 num += (creature_ptr->lev * 4);
4267 if (creature_ptr->pclass == CLASS_WARRIOR &&
4268 (tval_ammo <= TV_BOLT) &&
4269 (tval_ammo >= TV_SHOT))
4271 num += (creature_ptr->lev * 2);
4274 if ((creature_ptr->pclass == CLASS_ROGUE) &&
4275 (tval_ammo == TV_SHOT))
4277 num += (creature_ptr->lev * 4);
4285 * @brief プレイヤーの所持重量制限を計算する /
4286 * Computes current weight limit.
4289 WEIGHT weight_limit(player_type *creature_ptr)
4291 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
4292 if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
4298 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
4299 * @param i 判定する手のID(右手:0 左手:1)
4300 * @return 持っているならばTRUE
4302 bool has_melee_weapon(player_type *creature_ptr, int i)
4304 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
4309 * @brief プレイヤーの現在開いている手の状態を返す
4310 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
4311 * @return 開いている手のビットフラグ
4313 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
4315 BIT_FLAGS16 status = EMPTY_HAND_NONE;
4316 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
4317 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
4319 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
4321 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
4322 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
4330 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
4331 * @return ペナルティが適用されるならばTRUE。
4333 bool heavy_armor(player_type *creature_ptr)
4335 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
4338 WEIGHT monk_arm_wgt = 0;
4339 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4340 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4341 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4342 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4343 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4344 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4345 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4347 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
4352 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
4354 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
4356 void update_creature(player_type *creature_ptr)
4358 if (!creature_ptr->update) return;
4360 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4361 if (creature_ptr->update & (PU_AUTODESTROY))
4363 creature_ptr->update &= ~(PU_AUTODESTROY);
4364 autopick_delayed_alter(creature_ptr);
4367 if (creature_ptr->update & (PU_COMBINE))
4369 creature_ptr->update &= ~(PU_COMBINE);
4370 combine_pack(creature_ptr);
4373 if (creature_ptr->update & (PU_REORDER))
4375 creature_ptr->update &= ~(PU_REORDER);
4376 reorder_pack(creature_ptr);
4379 if (creature_ptr->update & (PU_BONUS))
4381 creature_ptr->update &= ~(PU_BONUS);
4382 calc_alignment(creature_ptr);
4383 calc_bonuses(creature_ptr);
4386 if (creature_ptr->update & (PU_TORCH))
4388 creature_ptr->update &= ~(PU_TORCH);
4389 calc_torch(creature_ptr);
4392 if (creature_ptr->update & (PU_HP))
4394 creature_ptr->update &= ~(PU_HP);
4395 calc_hitpoints(creature_ptr);
4398 if (creature_ptr->update & (PU_MANA))
4400 creature_ptr->update &= ~(PU_MANA);
4401 calc_mana(creature_ptr);
4404 if (creature_ptr->update & (PU_SPELLS))
4406 creature_ptr->update &= ~(PU_SPELLS);
4407 calc_spells(creature_ptr);
4410 if (!current_world_ptr->character_generated) return;
4411 if (current_world_ptr->character_icky) return;
4412 if (creature_ptr->update & (PU_UN_LITE))
4414 creature_ptr->update &= ~(PU_UN_LITE);
4415 forget_lite(floor_ptr);
4418 if (creature_ptr->update & (PU_UN_VIEW))
4420 creature_ptr->update &= ~(PU_UN_VIEW);
4421 forget_view(floor_ptr);
4424 if (creature_ptr->update & (PU_VIEW))
4426 creature_ptr->update &= ~(PU_VIEW);
4427 update_view(creature_ptr);
4430 if (creature_ptr->update & (PU_LITE))
4432 creature_ptr->update &= ~(PU_LITE);
4433 update_lite(creature_ptr);
4436 if (creature_ptr->update & (PU_FLOW))
4438 creature_ptr->update &= ~(PU_FLOW);
4439 update_flow(creature_ptr);
4442 if (creature_ptr->update & (PU_DISTANCE))
4444 creature_ptr->update &= ~(PU_DISTANCE);
4446 update_monsters(creature_ptr, TRUE);
4449 if (creature_ptr->update & (PU_MON_LITE))
4451 creature_ptr->update &= ~(PU_MON_LITE);
4452 update_mon_lite(creature_ptr);
4455 if (creature_ptr->update & (PU_DELAY_VIS))
4457 creature_ptr->update &= ~(PU_DELAY_VIS);
4458 delayed_visual_update(creature_ptr);
4461 if (creature_ptr->update & (PU_MONSTERS))
4463 creature_ptr->update &= ~(PU_MONSTERS);
4464 update_monsters(creature_ptr, FALSE);
4470 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
4471 * @return 魔道書を一冊も持っていないならTRUEを返す
4473 bool player_has_no_spellbooks(player_type *creature_ptr)
4476 for (int i = 0; i < INVEN_PACK; i++)
4478 o_ptr = &creature_ptr->inventory_list[i];
4479 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4482 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4483 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
4485 o_ptr = &floor_ptr->o_list[i];
4486 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4493 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
4495 creature_ptr->energy_use = (ENERGY)need_cost;
4499 void free_turn(player_type *creature_ptr)
4501 creature_ptr->energy_use = 0;
4506 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
4509 * @return 配置に成功したらTRUE
4511 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
4513 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
4515 /* Save player location */
4516 creature_ptr->y = y;
4517 creature_ptr->x = x;
4523 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
4526 void wreck_the_pattern(player_type *creature_ptr)
4528 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4529 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
4530 if (pattern_type == PATTERN_TILE_WRECKED) return;
4532 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
4533 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
4535 if (!IS_INVULN(creature_ptr))
4536 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
4538 int to_ruin = randint1(45) + 35;
4542 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
4544 if (pattern_tile(floor_ptr, r_y, r_x) &&
4545 (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
4547 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
4551 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
4556 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
4557 * Advance experience levels and print experience
4560 void check_experience(player_type *creature_ptr)
4562 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
4563 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
4564 if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
4566 if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
4567 if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
4568 if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
4570 if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
4571 if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
4573 creature_ptr->redraw |= (PR_EXP);
4574 handle_stuff(creature_ptr);
4576 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4577 PLAYER_LEVEL old_lev = creature_ptr->lev;
4578 while ((creature_ptr->lev > 1) &&
4579 (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
4581 creature_ptr->lev--;
4582 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4583 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
4584 creature_ptr->window |= (PW_PLAYER);
4585 handle_stuff(creature_ptr);
4588 bool level_reward = FALSE;
4589 bool level_mutation = FALSE;
4590 bool level_inc_stat = FALSE;
4591 while ((creature_ptr->lev < PY_MAX_LEVEL) &&
4592 (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
4594 creature_ptr->lev++;
4595 if (creature_ptr->lev > creature_ptr->max_plv)
4597 creature_ptr->max_plv = creature_ptr->lev;
4599 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
4600 (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
4602 level_reward = TRUE;
4604 if (creature_ptr->prace == RACE_BEASTMAN)
4606 if (one_in_(5)) level_mutation = TRUE;
4608 level_inc_stat = TRUE;
4610 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
4614 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
4615 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4616 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
4617 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
4618 creature_ptr->level_up_message = TRUE;
4619 handle_stuff(creature_ptr);
4621 creature_ptr->level_up_message = FALSE;
4624 if (!(creature_ptr->max_plv % 10))
4633 cnv_stat(creature_ptr->stat_max[0], tmp);
4634 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
4635 cnv_stat(creature_ptr->stat_max[1], tmp);
4636 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
4637 cnv_stat(creature_ptr->stat_max[2], tmp);
4638 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
4639 cnv_stat(creature_ptr->stat_max[3], tmp);
4640 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
4641 cnv_stat(creature_ptr->stat_max[4], tmp);
4642 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
4643 cnv_stat(creature_ptr->stat_max[5], tmp);
4644 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
4647 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
4652 if ((choice >= 'a') && (choice <= 'f')) break;
4654 for (n = 0; n < A_MAX; n++)
4655 if (n != choice - 'a')
4657 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
4659 do_inc_stat(creature_ptr, choice - 'a');
4662 else if (!(creature_ptr->max_plv % 2))
4663 do_inc_stat(creature_ptr, randint0(6));
4668 msg_print(_("あなたは変わった気がする...", "You feel different..."));
4669 (void)gain_mutation(creature_ptr, 0);
4670 level_mutation = FALSE;
4674 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
4679 gain_level_reward(creature_ptr, 0);
4680 level_reward = FALSE;
4683 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4684 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
4685 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4686 handle_stuff(creature_ptr);
4689 if (old_lev != creature_ptr->lev)
4690 autopick_load_pref(creature_ptr, FALSE);
4695 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
4697 * @param out_val 出力先文字列ポインタ
4700 void cnv_stat(int val, char *out_val)
4704 sprintf(out_val, " %2d", val);
4708 int bonus = (val - 18);
4711 sprintf(out_val, "18/%3s", "***");
4713 else if (bonus >= 100)
4715 sprintf(out_val, "18/%03d", bonus);
4719 sprintf(out_val, " 18/%02d", bonus);
4725 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
4726 * Modify a stat value by a "modifier", return new value
4728 * @param amount 加減算値
4732 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
4733 * Or even: 18/13, 18/23, 18/33, ..., 18/220
4734 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
4735 * Or even: 18/13, 18/03, 18, 17, ..., 3
4738 s16b modify_stat_value(int value, int amount)
4742 for (int i = 0; i < amount; i++)
4744 if (value < 18) value++;
4748 else if (amount < 0)
4750 for (int i = 0; i < (0 - amount); i++)
4752 if (value >= 18 + 10) value -= 10;
4753 else if (value > 18) value = 18;
4754 else if (value > 3) value--;
4764 * Hack -- Calculates the total number of points earned -JWT-
4768 long calc_score(player_type *creature_ptr)
4770 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
4773 if (!preserve_mode) mult += 10;
4774 if (!autoroller) mult += 10;
4775 if (!smart_learn) mult -= 20;
4776 if (smart_cheat) mult += 30;
4777 if (ironman_shops) mult += 50;
4778 if (ironman_small_levels) mult += 10;
4779 if (ironman_empty_levels) mult += 20;
4780 if (!powerup_home) mult += 50;
4781 if (ironman_rooms) mult += 100;
4782 if (ironman_nightmare) mult += 100;
4784 if (mult < 5) mult = 5;
4787 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
4788 if (max_dlv[i] > max_dl)
4789 max_dl = max_dlv[i];
4791 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
4792 u32b point_h = point_l / 0x10000L;
4793 point_l = point_l % 0x10000L;
4796 point_h += point_l / 0x10000L;
4797 point_l %= 0x10000L;
4799 point_l += ((point_h % 100) << 16);
4803 u32b point = (point_h << 16) + (point_l);
4804 if (creature_ptr->arena_number >= 0)
4805 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
4807 if (ironman_downward) point *= 2;
4808 if (creature_ptr->pclass == CLASS_BERSERKER)
4810 if (creature_ptr->prace == RACE_SPECTRE)
4814 if ((creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) && point)
4817 if (current_world_ptr->total_winner) point = 2;
4820 if (easy_band) point = (0 - point);
4826 void cheat_death(player_type *creature_ptr)
4828 if (creature_ptr->sc)
4829 creature_ptr->sc = creature_ptr->age = 0;
4830 creature_ptr->age++;
4832 current_world_ptr->noscore |= 0x0001;
4833 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
4836 (void)life_stream(creature_ptr, FALSE, FALSE);
4837 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
4840 for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
4842 creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
4844 for (; magic_idx < EATER_EXT * 3; magic_idx++)
4846 creature_ptr->magic_num1[magic_idx] = 0;
4850 creature_ptr->csp = creature_ptr->msp;
4851 creature_ptr->csp_frac = 0;
4852 if (creature_ptr->word_recall)
4854 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
4856 creature_ptr->word_recall = 0;
4857 creature_ptr->redraw |= (PR_STATUS);
4860 if (creature_ptr->alter_reality)
4862 creature_ptr->alter_reality = 0;
4863 creature_ptr->redraw |= (PR_STATUS);
4866 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
4867 creature_ptr->is_dead = FALSE;
4868 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
4870 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4871 floor_ptr->dun_level = 0;
4872 floor_ptr->inside_arena = FALSE;
4873 creature_ptr->phase_out = FALSE;
4875 floor_ptr->inside_quest = 0;
4876 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
4877 creature_ptr->dungeon_idx = 0;
4878 if (lite_town || vanilla_town)
4880 creature_ptr->wilderness_y = 1;
4881 creature_ptr->wilderness_x = 1;
4884 creature_ptr->oldpy = 10;
4885 creature_ptr->oldpx = 34;
4889 creature_ptr->oldpy = 33;
4890 creature_ptr->oldpx = 131;
4895 creature_ptr->wilderness_y = 48;
4896 creature_ptr->wilderness_x = 5;
4897 creature_ptr->oldpy = 33;
4898 creature_ptr->oldpx = 131;
4901 creature_ptr->wild_mode = FALSE;
4902 creature_ptr->leaving = TRUE;
4904 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
4908 leave_floor(creature_ptr);
4909 wipe_monsters_list(creature_ptr);
4914 * @param creature_ptr プレーヤーへの参照ポインタ
4915 * @return 祝福状態ならばTRUE
4917 bool is_blessed(player_type *creature_ptr)
4919 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
4923 bool is_oppose_acid(player_type *creature_ptr)
4925 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4929 bool is_oppose_elec(player_type *creature_ptr)
4931 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4935 bool is_oppose_fire(player_type *creature_ptr)
4937 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4941 bool is_oppose_cold(player_type *creature_ptr)
4943 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4947 bool is_oppose_pois(player_type *creature_ptr)
4949 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4953 bool is_tim_esp(player_type *creature_ptr)
4955 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
4959 bool is_tim_stealth(player_type *creature_ptr)
4961 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
4965 bool is_time_limit_esp(player_type *creature_ptr)
4967 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
4971 bool is_time_limit_stealth(player_type *creature_ptr)
4973 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
4977 bool can_two_hands_wielding(player_type *creature_ptr)
4979 return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);
4985 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
4988 void stop_singing(player_type *creature_ptr)
4990 if (creature_ptr->pclass != CLASS_BARD) return;
4992 /* Are there interupted song? */
4993 if (INTERUPTING_SONG_EFFECT(creature_ptr))
4995 /* Forget interupted song */
4996 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
5000 /* The player is singing? */
5001 if (!SINGING_SONG_EFFECT(creature_ptr)) return;
5003 /* Hack -- if called from set_action(), avoid recursive loop */
5004 if (creature_ptr->action == ACTION_SING) set_action(creature_ptr, ACTION_NONE);
5006 /* Message text of each song or etc. */
5007 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
5009 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
5010 SINGING_SONG_ID(creature_ptr) = 0;
5011 creature_ptr->update |= (PU_BONUS);
5012 creature_ptr->redraw |= (PR_STATUS);
5016 * @brief 口を使う継続的な処理を中断する
5017 * @param caster_ptr プレーヤーへの参照ポインタ
5020 void stop_mouth(player_type *caster_ptr)
5022 if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
5023 if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
5028 * @brief ペットの維持コスト計算
5031 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
5034 bool have_a_unique = FALSE;
5035 DEPTH total_friend_levels = 0;
5039 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
5041 monster_type *m_ptr;
5042 monster_race *r_ptr;
5044 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
5045 if (!monster_is_valid(m_ptr)) continue;
5046 r_ptr = &r_info[m_ptr->r_idx];
5051 if (r_ptr->flags1 & RF1_UNIQUE)
5053 if (creature_ptr->pclass == CLASS_CAVALRY)
5055 if (creature_ptr->riding == m_idx)
5056 total_friend_levels += (r_ptr->level + 5) * 2;
5057 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
5058 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
5060 total_friend_levels += (r_ptr->level + 5) * 10;
5061 have_a_unique = TRUE;
5064 total_friend_levels += (r_ptr->level + 5) * 10;
5067 total_friend_levels += r_ptr->level;
5075 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
5076 if (upkeep_factor < 0) upkeep_factor = 0;
5077 if (upkeep_factor > 1000) upkeep_factor = 1000;
5078 return upkeep_factor;
5084 bool music_singing(player_type *caster_ptr, int music_songs)
5086 return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs);