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/asking-player.h"
14 #include "core/stuff-handler.h"
15 #include "dungeon/dungeon.h"
16 #include "dungeon/quest.h"
17 #include "floor/floor-events.h"
18 #include "floor/floor.h"
19 #include "game-option/birth-options.h"
20 #include "grid/feature.h"
21 #include "inventory/inventory-object.h"
22 #include "io/files-util.h"
23 #include "io/input-key-acceptor.h"
24 #include "io/write-diary.h"
25 #include "main/sound-definitions-table.h"
26 #include "main/sound-of-music.h"
27 #include "market/arena-info-table.h"
28 #include "mind/mind-force-trainer.h"
29 #include "monster-race/race-flags1.h"
30 #include "monster-race/race-flags2.h"
31 #include "monster-race/race-flags3.h"
32 #include "monster-race/race-flags7.h"
33 #include "monster-race/monster-race-hook.h"
34 #include "monster-race/monster-race.h"
35 #include "monster/monster-info.h"
36 #include "monster-floor/monster-remover.h"
37 #include "monster/monster-status.h"
38 #include "monster/monster-update.h"
39 #include "monster/smart-learn-types.h"
40 #include "mutation/mutation.h"
41 #include "object-enchant/object-ego.h"
42 #include "object-enchant/special-object-flags.h"
43 #include "object-enchant/tr-types.h"
44 #include "object-enchant/trc-types.h"
45 #include "object/object-flags.h"
46 #include "object/object-hook.h"
47 #include "object/object-mark-types.h"
48 #include "object/object-info.h"
49 #include "perception/object-perception.h"
50 #include "pet/pet-util.h"
51 #include "player/avatar.h"
52 #include "player/mimic-info-table.h"
53 #include "player/patron.h"
54 #include "player/player-class.h"
55 #include "player/player-damage.h"
56 #include "player/player-effects.h"
57 #include "player/player-move.h"
58 #include "player/player-personalities-types.h"
59 #include "player/player-personality.h"
60 #include "player/player-race-types.h"
61 #include "player/player-skill.h"
62 #include "player/race-info-table.h"
63 #include "realm/realm-hex-numbers.h"
64 #include "realm/realm-song-numbers.h"
65 #include "specific-object/bow.h"
66 #include "spell-realm/spells-hex.h"
67 #include "spell/range-calc.h"
68 #include "spell/spells-describer.h"
69 #include "spell/spells-execution.h"
70 #include "spell/spells-status.h"
71 #include "spell/spells-util.h"
72 #include "spell/technic-info-table.h"
73 #include "sv-definition/sv-lite-types.h"
74 #include "sv-definition/sv-weapon-types.h"
75 #include "term/screen-processor.h"
76 #include "util/bit-flags-calculator.h"
77 #include "util/quarks.h"
78 #include "util/string-processor.h"
79 #include "view/display-main-window.h"
80 #include "view/display-messages.h"
81 #include "world/world.h"
84 * @brief 能力値テーブル / Abbreviations of healthy stats
86 const concptr stat_names[6] =
89 "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :"
91 "STR : ", "INT : ", "WIS : ", "DEX : ", "CON : ", "CHR : "
96 * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats
98 const concptr stat_names_reduced[6] =
101 "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:"
103 "Str : ", "Int : ", "Wis : ", "Dex : ", "Con : ", "Chr : "
108 * @brief 基本必要経験値テーブル /
109 * Base experience levels, may be adjusted up for race and/or class
111 const s32b player_exp[PY_MAX_LEVEL] =
166 * @brief 基本必要強化値テーブル(アンドロイド専用)
168 const s32b player_exp_a[PY_MAX_LEVEL] =
223 * 知力/賢さによるレベル毎の習得可能魔法数テーブル
224 * Stat Table (INT/WIS) -- Number of half-spells per level
226 const byte adj_mag_study[] =
253 4 /* 18/100-18/109 */,
254 4 /* 18/110-18/119 */,
255 5 /* 18/120-18/129 */,
256 5 /* 18/130-18/139 */,
257 5 /* 18/140-18/149 */,
258 5 /* 18/150-18/159 */,
259 5 /* 18/160-18/169 */,
260 5 /* 18/170-18/179 */,
261 5 /* 18/180-18/189 */,
262 5 /* 18/190-18/199 */,
263 5 /* 18/200-18/209 */,
264 6 /* 18/210-18/219 */,
270 * Stat Table (INT/WIS) -- extra 1/4-mana-points per level
272 const byte adj_mag_mana[] =
289 10 /* 18/00-18/09 */,
290 11 /* 18/10-18/19 */,
291 11 /* 18/20-18/29 */,
292 12 /* 18/30-18/39 */,
293 12 /* 18/40-18/49 */,
294 13 /* 18/50-18/59 */,
295 14 /* 18/60-18/69 */,
296 15 /* 18/70-18/79 */,
297 16 /* 18/80-18/89 */,
298 17 /* 18/90-18/99 */,
299 18 /* 18/100-18/109 */,
300 19 /* 18/110-18/119 */,
301 20 /* 18/120-18/129 */,
302 21 /* 18/130-18/139 */,
303 22 /* 18/140-18/149 */,
304 23 /* 18/150-18/159 */,
305 24 /* 18/160-18/169 */,
306 25 /* 18/170-18/179 */,
307 26 /* 18/180-18/189 */,
308 27 /* 18/190-18/199 */,
309 28 /* 18/200-18/209 */,
310 29 /* 18/210-18/219 */,
315 * 知力/賢さによる最低魔法失敗率テーブル
316 * Stat Table (INT/WIS) -- Minimum failure rate (percentage)
318 const byte adj_mag_fail[] =
345 3 /* 18/100-18/109 */,
346 2 /* 18/110-18/119 */,
347 2 /* 18/120-18/129 */,
348 2 /* 18/130-18/139 */,
349 2 /* 18/140-18/149 */,
350 1 /* 18/150-18/159 */,
351 1 /* 18/160-18/169 */,
352 1 /* 18/170-18/179 */,
353 1 /* 18/180-18/189 */,
354 1 /* 18/190-18/199 */,
355 0 /* 18/200-18/209 */,
356 0 /* 18/210-18/219 */,
361 * 知力/賢さによる魔法失敗率修正テーブル
362 * Stat Table (INT/WIS) -- Various things
364 const byte adj_mag_stat[] =
391 8 /* 18/100-18/109 */,
392 9 /* 18/110-18/119 */,
393 10 /* 18/120-18/129 */,
394 11 /* 18/130-18/139 */,
395 12 /* 18/140-18/149 */,
396 13 /* 18/150-18/159 */,
397 14 /* 18/160-18/169 */,
398 15 /* 18/170-18/179 */,
399 16 /* 18/180-18/189 */,
400 17 /* 18/190-18/199 */,
401 18 /* 18/200-18/209 */,
402 19 /* 18/210-18/219 */,
408 * Stat Table (CHR) -- payment percentages
410 const byte adj_chr_gold[] =
427 100 /* 18/00-18/09 */,
428 99 /* 18/10-18/19 */,
429 98 /* 18/20-18/29 */,
430 97 /* 18/30-18/39 */,
431 96 /* 18/40-18/49 */,
432 95 /* 18/50-18/59 */,
433 94 /* 18/60-18/69 */,
434 93 /* 18/70-18/79 */,
435 92 /* 18/80-18/89 */,
436 91 /* 18/90-18/99 */,
437 90 /* 18/100-18/109 */,
438 89 /* 18/110-18/119 */,
439 88 /* 18/120-18/129 */,
440 87 /* 18/130-18/139 */,
441 86 /* 18/140-18/149 */,
442 85 /* 18/150-18/159 */,
443 84 /* 18/160-18/169 */,
444 83 /* 18/170-18/179 */,
445 82 /* 18/180-18/189 */,
446 81 /* 18/190-18/199 */,
447 80 /* 18/200-18/209 */,
448 79 /* 18/210-18/219 */,
454 * Stat Table (INT) -- Magic devices
456 const byte adj_int_dev[] =
483 8 /* 18/100-18/109 */,
484 9 /* 18/110-18/119 */,
485 10 /* 18/120-18/129 */,
486 11 /* 18/130-18/139 */,
487 12 /* 18/140-18/149 */,
488 13 /* 18/150-18/159 */,
489 14 /* 18/160-18/169 */,
490 15 /* 18/170-18/179 */,
491 16 /* 18/180-18/189 */,
492 17 /* 18/190-18/199 */,
493 18 /* 18/200-18/209 */,
494 19 /* 18/210-18/219 */,
500 * Stat Table (WIS) -- Saving throw
502 const byte adj_wis_sav[] =
529 7 /* 18/100-18/109 */,
530 8 /* 18/110-18/119 */,
531 9 /* 18/120-18/129 */,
532 10 /* 18/130-18/139 */,
533 11 /* 18/140-18/149 */,
534 12 /* 18/150-18/159 */,
535 13 /* 18/160-18/169 */,
536 14 /* 18/170-18/179 */,
537 15 /* 18/180-18/189 */,
538 16 /* 18/190-18/199 */,
539 17 /* 18/200-18/209 */,
540 18 /* 18/210-18/219 */,
546 * Stat Table (DEX) -- disarming
548 const byte adj_dex_dis[] =
575 8 /* 18/100-18/109 */,
576 8 /* 18/110-18/119 */,
577 8 /* 18/120-18/129 */,
578 8 /* 18/130-18/139 */,
579 8 /* 18/140-18/149 */,
580 9 /* 18/150-18/159 */,
581 9 /* 18/160-18/169 */,
582 9 /* 18/170-18/179 */,
583 9 /* 18/180-18/189 */,
584 9 /* 18/190-18/199 */,
585 10 /* 18/200-18/209 */,
586 10 /* 18/210-18/219 */,
592 * Stat Table (INT) -- disarming
594 const byte adj_int_dis[] =
621 10 /* 18/100-18/109 */,
622 10 /* 18/110-18/119 */,
623 11 /* 18/120-18/129 */,
624 12 /* 18/130-18/139 */,
625 13 /* 18/140-18/149 */,
626 14 /* 18/150-18/159 */,
627 15 /* 18/160-18/169 */,
628 16 /* 18/170-18/179 */,
629 17 /* 18/180-18/189 */,
630 18 /* 18/190-18/199 */,
631 19 /* 18/200-18/209 */,
632 19 /* 18/210-18/219 */,
638 * Stat Table (DEX) -- bonus to ac (plus 128)
640 const byte adj_dex_ta[] =
657 128 + 2 /* 18/00-18/09 */,
658 128 + 2 /* 18/10-18/19 */,
659 128 + 2 /* 18/20-18/29 */,
660 128 + 2 /* 18/30-18/39 */,
661 128 + 2 /* 18/40-18/49 */,
662 128 + 3 /* 18/50-18/59 */,
663 128 + 3 /* 18/60-18/69 */,
664 128 + 3 /* 18/70-18/79 */,
665 128 + 4 /* 18/80-18/89 */,
666 128 + 5 /* 18/90-18/99 */,
667 128 + 6 /* 18/100-18/109 */,
668 128 + 7 /* 18/110-18/119 */,
669 128 + 8 /* 18/120-18/129 */,
670 128 + 9 /* 18/130-18/139 */,
671 128 + 9 /* 18/140-18/149 */,
672 128 + 10 /* 18/150-18/159 */,
673 128 + 11 /* 18/160-18/169 */,
674 128 + 12 /* 18/170-18/179 */,
675 128 + 13 /* 18/180-18/189 */,
676 128 + 14 /* 18/190-18/199 */,
677 128 + 15 /* 18/200-18/209 */,
678 128 + 15 /* 18/210-18/219 */,
679 128 + 16 /* 18/220+ */
684 * Stat Table (STR) -- bonus to dam (plus 128)
686 const byte adj_str_td[] =
703 128 + 2 /* 18/00-18/09 */,
704 128 + 2 /* 18/10-18/19 */,
705 128 + 3 /* 18/20-18/29 */,
706 128 + 3 /* 18/30-18/39 */,
707 128 + 3 /* 18/40-18/49 */,
708 128 + 3 /* 18/50-18/59 */,
709 128 + 3 /* 18/60-18/69 */,
710 128 + 4 /* 18/70-18/79 */,
711 128 + 5 /* 18/80-18/89 */,
712 128 + 5 /* 18/90-18/99 */,
713 128 + 6 /* 18/100-18/109 */,
714 128 + 7 /* 18/110-18/119 */,
715 128 + 8 /* 18/120-18/129 */,
716 128 + 9 /* 18/130-18/139 */,
717 128 + 10 /* 18/140-18/149 */,
718 128 + 11 /* 18/150-18/159 */,
719 128 + 12 /* 18/160-18/169 */,
720 128 + 13 /* 18/170-18/179 */,
721 128 + 14 /* 18/180-18/189 */,
722 128 + 15 /* 18/190-18/199 */,
723 128 + 16 /* 18/200-18/209 */,
724 128 + 18 /* 18/210-18/219 */,
725 128 + 20 /* 18/220+ */
730 * Stat Table (DEX) -- bonus to hit (plus 128)
732 const byte adj_dex_th[] =
749 128 + 3 /* 18/00-18/09 */,
750 128 + 3 /* 18/10-18/19 */,
751 128 + 3 /* 18/20-18/29 */,
752 128 + 3 /* 18/30-18/39 */,
753 128 + 3 /* 18/40-18/49 */,
754 128 + 4 /* 18/50-18/59 */,
755 128 + 4 /* 18/60-18/69 */,
756 128 + 4 /* 18/70-18/79 */,
757 128 + 4 /* 18/80-18/89 */,
758 128 + 5 /* 18/90-18/99 */,
759 128 + 6 /* 18/100-18/109 */,
760 128 + 7 /* 18/110-18/119 */,
761 128 + 8 /* 18/120-18/129 */,
762 128 + 9 /* 18/130-18/139 */,
763 128 + 9 /* 18/140-18/149 */,
764 128 + 10 /* 18/150-18/159 */,
765 128 + 11 /* 18/160-18/169 */,
766 128 + 12 /* 18/170-18/179 */,
767 128 + 13 /* 18/180-18/189 */,
768 128 + 14 /* 18/190-18/199 */,
769 128 + 15 /* 18/200-18/209 */,
770 128 + 15 /* 18/210-18/219 */,
771 128 + 16 /* 18/220+ */
776 * Stat Table (STR) -- bonus to hit (plus 128)
778 const byte adj_str_th[] =
795 128 + 1 /* 18/00-18/09 */,
796 128 + 1 /* 18/10-18/19 */,
797 128 + 1 /* 18/20-18/29 */,
798 128 + 1 /* 18/30-18/39 */,
799 128 + 1 /* 18/40-18/49 */,
800 128 + 1 /* 18/50-18/59 */,
801 128 + 1 /* 18/60-18/69 */,
802 128 + 2 /* 18/70-18/79 */,
803 128 + 3 /* 18/80-18/89 */,
804 128 + 4 /* 18/90-18/99 */,
805 128 + 5 /* 18/100-18/109 */,
806 128 + 6 /* 18/110-18/119 */,
807 128 + 7 /* 18/120-18/129 */,
808 128 + 8 /* 18/130-18/139 */,
809 128 + 9 /* 18/140-18/149 */,
810 128 + 10 /* 18/150-18/159 */,
811 128 + 11 /* 18/160-18/169 */,
812 128 + 12 /* 18/170-18/179 */,
813 128 + 13 /* 18/180-18/189 */,
814 128 + 14 /* 18/190-18/199 */,
815 128 + 15 /* 18/200-18/209 */,
816 128 + 15 /* 18/210-18/219 */,
817 128 + 16 /* 18/220+ */
822 * Stat Table (STR) -- weight limit in deca-pounds
824 const byte adj_str_wgt[] =
841 25 /* 18/00-18/09 */,
842 26 /* 18/10-18/19 */,
843 27 /* 18/20-18/29 */,
844 28 /* 18/30-18/39 */,
845 29 /* 18/40-18/49 */,
846 30 /* 18/50-18/59 */,
847 31 /* 18/60-18/69 */,
848 31 /* 18/70-18/79 */,
849 32 /* 18/80-18/89 */,
850 32 /* 18/90-18/99 */,
851 33 /* 18/100-18/109 */,
852 33 /* 18/110-18/119 */,
853 34 /* 18/120-18/129 */,
854 34 /* 18/130-18/139 */,
855 35 /* 18/140-18/149 */,
856 35 /* 18/150-18/159 */,
857 36 /* 18/160-18/169 */,
858 36 /* 18/170-18/179 */,
859 37 /* 18/180-18/189 */,
860 37 /* 18/190-18/199 */,
861 38 /* 18/200-18/209 */,
862 38 /* 18/210-18/219 */,
868 * Stat Table (STR) -- weapon weight limit in pounds
870 const byte adj_str_hold[] =
887 19 /* 18/00-18/09 */,
888 20 /* 18/10-18/19 */,
889 21 /* 18/20-18/29 */,
890 22 /* 18/30-18/39 */,
891 23 /* 18/40-18/49 */,
892 24 /* 18/50-18/59 */,
893 25 /* 18/60-18/69 */,
894 26 /* 18/70-18/79 */,
895 27 /* 18/80-18/89 */,
896 28 /* 18/90-18/99 */,
897 30 /* 18/100-18/109 */,
898 31 /* 18/110-18/119 */,
899 32 /* 18/120-18/129 */,
900 33 /* 18/130-18/139 */,
901 34 /* 18/140-18/149 */,
902 35 /* 18/150-18/159 */,
903 37 /* 18/160-18/169 */,
904 40 /* 18/170-18/179 */,
905 44 /* 18/180-18/189 */,
906 48 /* 18/190-18/199 */,
907 50 /* 18/200-18/209 */,
908 50 /* 18/210-18/219 */,
914 * Stat Table (STR) -- digging value
916 const byte adj_str_dig[] =
934 10 /* 18/10-18/19 */,
935 12 /* 18/20-18/29 */,
936 15 /* 18/30-18/39 */,
937 20 /* 18/40-18/49 */,
938 25 /* 18/50-18/59 */,
939 30 /* 18/60-18/69 */,
940 35 /* 18/70-18/79 */,
941 40 /* 18/80-18/89 */,
942 45 /* 18/90-18/99 */,
943 50 /* 18/100-18/109 */,
944 55 /* 18/110-18/119 */,
945 60 /* 18/120-18/129 */,
946 65 /* 18/130-18/139 */,
947 70 /* 18/140-18/149 */,
948 75 /* 18/150-18/159 */,
949 80 /* 18/160-18/169 */,
950 85 /* 18/170-18/179 */,
951 90 /* 18/180-18/189 */,
952 95 /* 18/190-18/199 */,
953 100 /* 18/200-18/209 */,
954 100 /* 18/210-18/219 */,
959 * 器用さによる盗難防止&体当たり成功判定修正テーブル
960 * Stat Table (DEX) -- chance of avoiding "theft" and "falling"
962 const byte adj_dex_safe[] =
979 10 /* 18/00-18/09 */,
980 10 /* 18/10-18/19 */,
981 15 /* 18/20-18/29 */,
982 15 /* 18/30-18/39 */,
983 20 /* 18/40-18/49 */,
984 25 /* 18/50-18/59 */,
985 30 /* 18/60-18/69 */,
986 35 /* 18/70-18/79 */,
987 40 /* 18/80-18/89 */,
988 45 /* 18/90-18/99 */,
989 50 /* 18/100-18/109 */,
990 60 /* 18/110-18/119 */,
991 70 /* 18/120-18/129 */,
992 80 /* 18/130-18/139 */,
993 90 /* 18/140-18/149 */,
994 100 /* 18/150-18/159 */,
995 100 /* 18/160-18/169 */,
996 100 /* 18/170-18/179 */,
997 100 /* 18/180-18/189 */,
998 100 /* 18/190-18/199 */,
999 100 /* 18/200-18/209 */,
1000 100 /* 18/210-18/219 */,
1005 * 耐久による基本HP自然治癒値テーブル /
1006 * Stat Table (CON) -- base regeneration rate
1008 const byte adj_con_fix[] =
1025 2 /* 18/00-18/09 */,
1026 2 /* 18/10-18/19 */,
1027 2 /* 18/20-18/29 */,
1028 2 /* 18/30-18/39 */,
1029 2 /* 18/40-18/49 */,
1030 3 /* 18/50-18/59 */,
1031 3 /* 18/60-18/69 */,
1032 3 /* 18/70-18/79 */,
1033 3 /* 18/80-18/89 */,
1034 3 /* 18/90-18/99 */,
1035 4 /* 18/100-18/109 */,
1036 4 /* 18/110-18/119 */,
1037 5 /* 18/120-18/129 */,
1038 6 /* 18/130-18/139 */,
1039 6 /* 18/140-18/149 */,
1040 7 /* 18/150-18/159 */,
1041 7 /* 18/160-18/169 */,
1042 8 /* 18/170-18/179 */,
1043 8 /* 18/180-18/189 */,
1044 8 /* 18/190-18/199 */,
1045 9 /* 18/200-18/209 */,
1046 9 /* 18/210-18/219 */,
1051 * 耐久による基本HP自然治癒値テーブル /
1052 * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
1054 const byte adj_con_mhp[] =
1071 128 + 4 /* 18/00-18/09 */,
1072 128 + 5 /* 18/10-18/19 */,
1073 128 + 6 /* 18/20-18/29 */,
1074 128 + 7 /* 18/30-18/39 */,
1075 128 + 8 /* 18/40-18/49 */,
1076 128 + 9 /* 18/50-18/59 */,
1077 128 + 10 /* 18/60-18/69 */,
1078 128 + 11 /* 18/70-18/79 */,
1079 128 + 12 /* 18/80-18/89 */,
1080 128 + 14 /* 18/90-18/99 */,
1081 128 + 17 /* 18/100-18/109 */,
1082 128 + 20 /* 18/110-18/119 */,
1083 128 + 23 /* 18/120-18/129 */,
1084 128 + 26 /* 18/130-18/139 */,
1085 128 + 29 /* 18/140-18/149 */,
1086 128 + 32 /* 18/150-18/159 */,
1087 128 + 35 /* 18/160-18/169 */,
1088 128 + 38 /* 18/170-18/179 */,
1089 128 + 40 /* 18/180-18/189 */,
1090 128 + 42 /* 18/190-18/199 */,
1091 128 + 44 /* 18/200-18/209 */,
1092 128 + 46 /* 18/210-18/219 */,
1093 128 + 48 /* 18/220+ */
1098 * Stat Table (CHR) -- charm
1100 const byte adj_chr_chm[] =
1117 9 /* 18/00-18/09 */,
1118 10 /* 18/10-18/19 */,
1119 12 /* 18/20-18/29 */,
1120 15 /* 18/30-18/39 */,
1121 18 /* 18/40-18/49 */,
1122 21 /* 18/50-18/59 */,
1123 24 /* 18/60-18/69 */,
1124 28 /* 18/70-18/79 */,
1125 32 /* 18/80-18/89 */,
1126 36 /* 18/90-18/99 */,
1127 39 /* 18/100-18/109 */,
1128 42 /* 18/110-18/119 */,
1129 45 /* 18/120-18/129 */,
1130 49 /* 18/130-18/139 */,
1131 53 /* 18/140-18/149 */,
1132 57 /* 18/150-18/159 */,
1133 61 /* 18/160-18/169 */,
1134 65 /* 18/170-18/179 */,
1135 69 /* 18/180-18/189 */,
1136 73 /* 18/190-18/199 */,
1137 77 /* 18/200-18/209 */,
1138 81 /* 18/210-18/219 */,
1142 /*** Player information ***/
1145 * Static player info record
1150 * Pointer to the player info
1152 player_type *p_ptr = &p_body;
1155 * Return alignment title
1157 concptr your_alignment(player_type *creature_ptr)
1159 if (creature_ptr->align > 150) return _("大善", "Lawful");
1160 else if (creature_ptr->align > 50) return _("中善", "Good");
1161 else if (creature_ptr->align > 10) return _("小善", "Neutral Good");
1162 else if (creature_ptr->align > -11) return _("中立", "Neutral");
1163 else if (creature_ptr->align > -51) return _("小悪", "Neutral Evil");
1164 else if (creature_ptr->align > -151) return _("中悪", "Evil");
1165 else return _("大悪", "Chaotic");
1170 * Return proficiency level of weapons and misc. skills (except riding)
1172 int weapon_exp_level(int weapon_exp)
1174 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1175 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1176 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1177 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
1178 else return EXP_LEVEL_MASTER;
1183 * Return proficiency level of riding
1185 int riding_exp_level(int riding_exp)
1187 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1188 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1189 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1190 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
1191 else return EXP_LEVEL_MASTER;
1196 * Return proficiency level of spells
1198 int spell_exp_level(int spell_exp)
1200 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
1201 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
1202 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
1203 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
1204 else return EXP_LEVEL_MASTER;
1208 * @brief プレイヤー構造体の全ステータスを初期化する
1210 static void clear_creature_bonuses(player_type *creature_ptr)
1212 for (int i = 0; i < A_MAX; i++)
1213 creature_ptr->stat_add[i] = 0;
1215 creature_ptr->see_infra = 0;
1216 creature_ptr->skill_dis = 0;
1217 creature_ptr->skill_dev = 0;
1218 creature_ptr->skill_sav = 0;
1219 creature_ptr->skill_stl = 0;
1220 creature_ptr->skill_srh = 0;
1221 creature_ptr->skill_fos = 0;
1222 creature_ptr->skill_thn = 0;
1223 creature_ptr->skill_thb = 0;
1224 creature_ptr->skill_tht = 0;
1225 creature_ptr->skill_dig = 0;
1227 creature_ptr->dis_ac = creature_ptr->ac = 0;
1228 creature_ptr->dis_to_h[0] = creature_ptr->to_h[0] = 0;
1229 creature_ptr->dis_to_h[1] = creature_ptr->to_h[1] = 0;
1230 creature_ptr->dis_to_d[0] = creature_ptr->to_d[0] = 0;
1231 creature_ptr->dis_to_d[1] = creature_ptr->to_d[1] = 0;
1232 creature_ptr->dis_to_h_b = creature_ptr->to_h_b = 0;
1233 creature_ptr->dis_to_a = creature_ptr->to_a = 0;
1234 creature_ptr->to_h_m = 0;
1235 creature_ptr->to_d_m = 0;
1236 creature_ptr->to_m_chance = 0;
1237 creature_ptr->to_dd[0] = creature_ptr->to_ds[0] = 0;
1238 creature_ptr->to_dd[1] = creature_ptr->to_ds[1] = 0;
1240 creature_ptr->num_blow[0] = 1;
1241 creature_ptr->num_blow[1] = 1;
1242 creature_ptr->num_fire = 100;
1243 creature_ptr->tval_xtra = 0;
1244 creature_ptr->tval_ammo = 0;
1245 creature_ptr->cursed = 0L;
1246 creature_ptr->bless_blade = FALSE;
1247 creature_ptr->xtra_might = FALSE;
1248 creature_ptr->impact[0] = FALSE;
1249 creature_ptr->impact[1] = FALSE;
1250 creature_ptr->pass_wall = FALSE;
1251 creature_ptr->kill_wall = FALSE;
1252 creature_ptr->dec_mana = FALSE;
1253 creature_ptr->easy_spell = FALSE;
1254 creature_ptr->heavy_spell = FALSE;
1255 creature_ptr->see_inv = FALSE;
1256 creature_ptr->free_act = FALSE;
1257 creature_ptr->slow_digest = FALSE;
1258 creature_ptr->regenerate = FALSE;
1259 creature_ptr->can_swim = FALSE;
1260 creature_ptr->levitation = FALSE;
1261 creature_ptr->hold_exp = FALSE;
1262 creature_ptr->telepathy = FALSE;
1263 creature_ptr->esp_animal = FALSE;
1264 creature_ptr->esp_undead = FALSE;
1265 creature_ptr->esp_demon = FALSE;
1266 creature_ptr->esp_orc = FALSE;
1267 creature_ptr->esp_troll = FALSE;
1268 creature_ptr->esp_giant = FALSE;
1269 creature_ptr->esp_dragon = FALSE;
1270 creature_ptr->esp_human = FALSE;
1271 creature_ptr->esp_evil = FALSE;
1272 creature_ptr->esp_good = FALSE;
1273 creature_ptr->esp_nonliving = FALSE;
1274 creature_ptr->esp_unique = FALSE;
1275 creature_ptr->lite = FALSE;
1276 creature_ptr->sustain_str = FALSE;
1277 creature_ptr->sustain_int = FALSE;
1278 creature_ptr->sustain_wis = FALSE;
1279 creature_ptr->sustain_con = FALSE;
1280 creature_ptr->sustain_dex = FALSE;
1281 creature_ptr->sustain_chr = FALSE;
1282 creature_ptr->resist_acid = FALSE;
1283 creature_ptr->resist_elec = FALSE;
1284 creature_ptr->resist_fire = FALSE;
1285 creature_ptr->resist_cold = FALSE;
1286 creature_ptr->resist_pois = FALSE;
1287 creature_ptr->resist_conf = FALSE;
1288 creature_ptr->resist_sound = FALSE;
1289 creature_ptr->resist_lite = FALSE;
1290 creature_ptr->resist_dark = FALSE;
1291 creature_ptr->resist_chaos = FALSE;
1292 creature_ptr->resist_disen = FALSE;
1293 creature_ptr->resist_shard = FALSE;
1294 creature_ptr->resist_nexus = FALSE;
1295 creature_ptr->resist_blind = FALSE;
1296 creature_ptr->resist_neth = FALSE;
1297 creature_ptr->resist_time = FALSE;
1298 creature_ptr->resist_water = FALSE;
1299 creature_ptr->resist_fear = FALSE;
1300 creature_ptr->reflect = FALSE;
1301 creature_ptr->sh_fire = FALSE;
1302 creature_ptr->sh_elec = FALSE;
1303 creature_ptr->sh_cold = FALSE;
1304 creature_ptr->anti_magic = FALSE;
1305 creature_ptr->anti_tele = FALSE;
1306 creature_ptr->warning = FALSE;
1307 creature_ptr->mighty_throw = FALSE;
1308 creature_ptr->see_nocto = FALSE;
1309 creature_ptr->immune_acid = FALSE;
1310 creature_ptr->immune_elec = FALSE;
1311 creature_ptr->immune_fire = FALSE;
1312 creature_ptr->immune_cold = FALSE;
1313 creature_ptr->ryoute = FALSE;
1314 creature_ptr->migite = FALSE;
1315 creature_ptr->hidarite = FALSE;
1316 creature_ptr->no_flowed = FALSE;
1317 creature_ptr->pspeed = 110;
1321 * @brief プレイヤーの全ステータスを更新する /
1322 * Calculate the players current "state", taking into account
1323 * not only race/class intrinsics, but also objects being worn
1324 * and temporary spell effects.
1328 * See also calc_mana() and calc_hitpoints().
1330 * Take note of the new "speed code", in particular, a very strong
1331 * player will start slowing down as soon as he reaches 150 pounds,
1332 * but not until he reaches 450 pounds will he be half as fast as
1333 * a normal kobold. This both hurts and helps the player, hurts
1334 * because in the old days a player could just avoid 300 pounds,
1335 * and helps because now carrying 300 pounds is not very painful.
1337 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
1338 * damage, since that would affect non-combat things. These values
1339 * are actually added in later, at the appropriate place.
1341 * This function induces various "status" messages.
1344 void calc_bonuses(player_type *creature_ptr)
1347 int default_hand = 0;
1348 int empty_hands_status = empty_hands(creature_ptr, TRUE);
1351 BIT_FLAGS flgs[TR_FLAG_SIZE];
1353 bool yoiyami = FALSE;
1354 bool down_saving = FALSE;
1356 bool have_sw = FALSE, have_kabe = FALSE;
1357 bool easy_2weapon = FALSE;
1358 bool riding_levitation = FALSE;
1359 OBJECT_IDX this_o_idx, next_o_idx = 0;
1361 /* Save the old vision stuff */
1362 bool old_telepathy = creature_ptr->telepathy;
1363 bool old_esp_animal = creature_ptr->esp_animal;
1364 bool old_esp_undead = creature_ptr->esp_undead;
1365 bool old_esp_demon = creature_ptr->esp_demon;
1366 bool old_esp_orc = creature_ptr->esp_orc;
1367 bool old_esp_troll = creature_ptr->esp_troll;
1368 bool old_esp_giant = creature_ptr->esp_giant;
1369 bool old_esp_dragon = creature_ptr->esp_dragon;
1370 bool old_esp_human = creature_ptr->esp_human;
1371 bool old_esp_evil = creature_ptr->esp_evil;
1372 bool old_esp_good = creature_ptr->esp_good;
1373 bool old_esp_nonliving = creature_ptr->esp_nonliving;
1374 bool old_esp_unique = creature_ptr->esp_unique;
1375 bool old_see_inv = creature_ptr->see_inv;
1376 bool old_mighty_throw = creature_ptr->mighty_throw;
1377 s16b old_speed = creature_ptr->pspeed;
1379 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1380 feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1382 ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
1383 ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
1385 extra_blows[0] = extra_blows[1] = 0;
1387 clear_creature_bonuses(creature_ptr);
1388 calc_race_status(creature_ptr);
1390 creature_ptr->skill_dis = cp_ptr->c_dis + ap_ptr->a_dis;
1391 creature_ptr->skill_dev = cp_ptr->c_dev + ap_ptr->a_dev;
1392 creature_ptr->skill_sav = cp_ptr->c_sav + ap_ptr->a_sav;
1393 creature_ptr->skill_stl = cp_ptr->c_stl + ap_ptr->a_stl;
1394 creature_ptr->skill_srh = cp_ptr->c_srh + ap_ptr->a_srh;
1395 creature_ptr->skill_fos = cp_ptr->c_fos + ap_ptr->a_fos;
1396 creature_ptr->skill_thn = cp_ptr->c_thn + ap_ptr->a_thn;
1397 creature_ptr->skill_thb = cp_ptr->c_thb + ap_ptr->a_thb;
1398 creature_ptr->skill_tht = cp_ptr->c_thb + ap_ptr->a_thb;
1400 if (has_melee_weapon(creature_ptr, INVEN_RARM)) creature_ptr->migite = TRUE;
1401 if (has_melee_weapon(creature_ptr, INVEN_LARM))
1403 creature_ptr->hidarite = TRUE;
1404 if (!creature_ptr->migite) default_hand = 1;
1407 if (can_two_hands_wielding(creature_ptr))
1409 if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
1410 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
1412 creature_ptr->ryoute = TRUE;
1414 else if (creature_ptr->hidarite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) &&
1415 object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM]))
1417 creature_ptr->ryoute = TRUE;
1421 switch (creature_ptr->pclass)
1424 case CLASS_FORCETRAINER:
1425 case CLASS_BERSERKER:
1426 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
1428 creature_ptr->migite = TRUE;
1429 creature_ptr->ryoute = TRUE;
1436 if (!creature_ptr->migite && !creature_ptr->hidarite)
1438 if (empty_hands_status & EMPTY_HAND_RARM) creature_ptr->migite = TRUE;
1439 else if (empty_hands_status == EMPTY_HAND_LARM)
1441 creature_ptr->hidarite = TRUE;
1446 if (creature_ptr->special_defense & KAMAE_MASK)
1448 if (!(empty_hands_status & EMPTY_HAND_RARM))
1450 set_action(creature_ptr, ACTION_NONE);
1454 calc_class_status(creature_ptr);
1456 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU))
1458 creature_ptr->see_inv = TRUE;
1459 creature_ptr->free_act = TRUE;
1460 creature_ptr->slow_digest = TRUE;
1461 creature_ptr->regenerate = TRUE;
1462 creature_ptr->levitation = TRUE;
1463 creature_ptr->hold_exp = TRUE;
1464 creature_ptr->telepathy = TRUE;
1465 creature_ptr->lite = TRUE;
1466 creature_ptr->sustain_str = TRUE;
1467 creature_ptr->sustain_int = TRUE;
1468 creature_ptr->sustain_wis = TRUE;
1469 creature_ptr->sustain_con = TRUE;
1470 creature_ptr->sustain_dex = TRUE;
1471 creature_ptr->sustain_chr = TRUE;
1472 creature_ptr->resist_acid = TRUE;
1473 creature_ptr->resist_elec = TRUE;
1474 creature_ptr->resist_fire = TRUE;
1475 creature_ptr->resist_cold = TRUE;
1476 creature_ptr->resist_pois = TRUE;
1477 creature_ptr->resist_conf = TRUE;
1478 creature_ptr->resist_sound = TRUE;
1479 creature_ptr->resist_lite = TRUE;
1480 creature_ptr->resist_dark = TRUE;
1481 creature_ptr->resist_chaos = TRUE;
1482 creature_ptr->resist_disen = TRUE;
1483 creature_ptr->resist_shard = TRUE;
1484 creature_ptr->resist_nexus = TRUE;
1485 creature_ptr->resist_blind = TRUE;
1486 creature_ptr->resist_neth = TRUE;
1487 creature_ptr->resist_fear = TRUE;
1488 creature_ptr->reflect = TRUE;
1489 creature_ptr->sh_fire = TRUE;
1490 creature_ptr->sh_elec = TRUE;
1491 creature_ptr->sh_cold = TRUE;
1492 creature_ptr->to_a += 100;
1493 creature_ptr->dis_to_a += 100;
1495 else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef)
1497 creature_ptr->to_a += 50;
1498 creature_ptr->dis_to_a += 50;
1501 if (creature_ptr->tim_res_nether)
1503 creature_ptr->resist_neth = TRUE;
1506 if (creature_ptr->tim_sh_fire)
1508 creature_ptr->sh_fire = TRUE;
1511 if (creature_ptr->tim_res_time)
1513 creature_ptr->resist_time = TRUE;
1516 if (creature_ptr->pseikaku == PERSONALITY_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE);
1517 if (creature_ptr->pseikaku == PERSONALITY_LAZY) creature_ptr->to_m_chance += 10;
1518 if (creature_ptr->pseikaku == PERSONALITY_SHREWD) creature_ptr->to_m_chance -= 3;
1519 if ((creature_ptr->pseikaku == PERSONALITY_PATIENT) || (creature_ptr->pseikaku == PERSONALITY_MIGHTY)) creature_ptr->to_m_chance++;
1520 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
1522 creature_ptr->to_m_chance += 5;
1523 creature_ptr->resist_conf = TRUE;
1526 if (creature_ptr->pseikaku == PERSONALITY_LUCKY) creature_ptr->muta3 |= MUT3_GOOD_LUCK;
1527 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)
1529 creature_ptr->resist_blind = TRUE;
1530 creature_ptr->resist_conf = TRUE;
1531 creature_ptr->hold_exp = TRUE;
1532 if (creature_ptr->pclass != CLASS_NINJA) creature_ptr->lite = TRUE;
1534 if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
1535 creature_ptr->pspeed += (creature_ptr->lev) / 10 + 5;
1538 if (music_singing(creature_ptr, MUSIC_WALL))
1540 creature_ptr->kill_wall = TRUE;
1543 for (int i = 0; i < A_MAX; i++)
1545 creature_ptr->stat_add[i] += (cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
1548 if (creature_ptr->muta3)
1550 if (creature_ptr->muta3 & MUT3_HYPER_STR)
1552 creature_ptr->stat_add[A_STR] += 4;
1555 if (creature_ptr->muta3 & MUT3_PUNY)
1557 creature_ptr->stat_add[A_STR] -= 4;
1560 if (creature_ptr->muta3 & MUT3_HYPER_INT)
1562 creature_ptr->stat_add[A_INT] += 4;
1563 creature_ptr->stat_add[A_WIS] += 4;
1566 if (creature_ptr->muta3 & MUT3_MORONIC)
1568 creature_ptr->stat_add[A_INT] -= 4;
1569 creature_ptr->stat_add[A_WIS] -= 4;
1572 if (creature_ptr->muta3 & MUT3_RESILIENT)
1574 creature_ptr->stat_add[A_CON] += 4;
1577 if (creature_ptr->muta3 & MUT3_XTRA_FAT)
1579 creature_ptr->stat_add[A_CON] += 2;
1580 creature_ptr->pspeed -= 2;
1583 if (creature_ptr->muta3 & MUT3_ALBINO)
1585 creature_ptr->stat_add[A_CON] -= 4;
1588 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1590 creature_ptr->stat_add[A_CON] -= 2;
1591 creature_ptr->stat_add[A_CHR] -= 1;
1592 creature_ptr->regenerate = FALSE;
1595 if (creature_ptr->muta3 & MUT3_SILLY_VOI)
1597 creature_ptr->stat_add[A_CHR] -= 4;
1600 if (creature_ptr->muta3 & MUT3_BLANK_FAC)
1602 creature_ptr->stat_add[A_CHR] -= 1;
1605 if (creature_ptr->muta3 & MUT3_XTRA_EYES)
1607 creature_ptr->skill_fos += 15;
1608 creature_ptr->skill_srh += 15;
1611 if (creature_ptr->muta3 & MUT3_MAGIC_RES)
1613 creature_ptr->skill_sav += (15 + (creature_ptr->lev / 5));
1616 if (creature_ptr->muta3 & MUT3_XTRA_NOIS)
1618 creature_ptr->skill_stl -= 3;
1621 if (creature_ptr->muta3 & MUT3_INFRAVIS)
1623 creature_ptr->see_infra += 3;
1626 if (creature_ptr->muta3 & MUT3_XTRA_LEGS)
1628 creature_ptr->pspeed += 3;
1631 if (creature_ptr->muta3 & MUT3_SHORT_LEG)
1633 creature_ptr->pspeed -= 3;
1636 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
1638 creature_ptr->sh_elec = TRUE;
1641 if (creature_ptr->muta3 & MUT3_FIRE_BODY)
1643 creature_ptr->sh_fire = TRUE;
1644 creature_ptr->lite = TRUE;
1647 if (creature_ptr->muta3 & MUT3_WART_SKIN)
1649 creature_ptr->stat_add[A_CHR] -= 2;
1650 creature_ptr->to_a += 5;
1651 creature_ptr->dis_to_a += 5;
1654 if (creature_ptr->muta3 & MUT3_SCALES)
1656 creature_ptr->stat_add[A_CHR] -= 1;
1657 creature_ptr->to_a += 10;
1658 creature_ptr->dis_to_a += 10;
1661 if (creature_ptr->muta3 & MUT3_IRON_SKIN)
1663 creature_ptr->stat_add[A_DEX] -= 1;
1664 creature_ptr->to_a += 25;
1665 creature_ptr->dis_to_a += 25;
1668 if (creature_ptr->muta3 & MUT3_WINGS)
1670 creature_ptr->levitation = TRUE;
1673 if (creature_ptr->muta3 & MUT3_FEARLESS)
1675 creature_ptr->resist_fear = TRUE;
1678 if (creature_ptr->muta3 & MUT3_REGEN)
1680 creature_ptr->regenerate = TRUE;
1683 if (creature_ptr->muta3 & MUT3_ESP)
1685 creature_ptr->telepathy = TRUE;
1688 if (creature_ptr->muta3 & MUT3_LIMBER)
1690 creature_ptr->stat_add[A_DEX] += 3;
1693 if (creature_ptr->muta3 & MUT3_ARTHRITIS)
1695 creature_ptr->stat_add[A_DEX] -= 3;
1698 if (creature_ptr->muta3 & MUT3_MOTION)
1700 creature_ptr->free_act = TRUE;
1701 creature_ptr->skill_stl += 1;
1704 if (creature_ptr->muta3 & MUT3_ILL_NORM)
1706 creature_ptr->stat_add[A_CHR] = 0;
1710 if (creature_ptr->tsuyoshi)
1712 creature_ptr->stat_add[A_STR] += 4;
1713 creature_ptr->stat_add[A_CON] += 4;
1716 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
1718 int bonus_to_h, bonus_to_d;
1719 o_ptr = &creature_ptr->inventory_list[i];
1720 if (!o_ptr->k_idx) continue;
1722 object_flags(o_ptr, flgs);
1724 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
1725 if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD;
1727 if (have_flag(flgs, TR_STR)) creature_ptr->stat_add[A_STR] += o_ptr->pval;
1728 if (have_flag(flgs, TR_INT)) creature_ptr->stat_add[A_INT] += o_ptr->pval;
1729 if (have_flag(flgs, TR_WIS)) creature_ptr->stat_add[A_WIS] += o_ptr->pval;
1730 if (have_flag(flgs, TR_DEX)) creature_ptr->stat_add[A_DEX] += o_ptr->pval;
1731 if (have_flag(flgs, TR_CON)) creature_ptr->stat_add[A_CON] += o_ptr->pval;
1732 if (have_flag(flgs, TR_CHR)) creature_ptr->stat_add[A_CHR] += o_ptr->pval;
1733 if (have_flag(flgs, TR_MAGIC_MASTERY)) creature_ptr->skill_dev += 8 * o_ptr->pval;
1734 if (have_flag(flgs, TR_STEALTH)) creature_ptr->skill_stl += o_ptr->pval;
1735 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_srh += (o_ptr->pval * 5);
1736 if (have_flag(flgs, TR_SEARCH)) creature_ptr->skill_fos += (o_ptr->pval * 5);
1737 if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval;
1738 if (have_flag(flgs, TR_TUNNEL)) creature_ptr->skill_dig += (o_ptr->pval * 20);
1739 if (have_flag(flgs, TR_SPEED)) creature_ptr->pspeed += o_ptr->pval;
1740 if (have_flag(flgs, TR_BLOWS))
1742 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->ryoute) extra_blows[0] += o_ptr->pval;
1743 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->ryoute) extra_blows[1] += o_ptr->pval;
1744 else { extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval; }
1747 if (have_flag(flgs, TR_IMPACT)) creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
1748 if (have_flag(flgs, TR_AGGRAVATE)) creature_ptr->cursed |= TRC_AGGRAVATE;
1749 if (have_flag(flgs, TR_DRAIN_EXP)) creature_ptr->cursed |= TRC_DRAIN_EXP;
1750 if (have_flag(flgs, TR_TY_CURSE)) creature_ptr->cursed |= TRC_TY_CURSE;
1751 if (have_flag(flgs, TR_ADD_L_CURSE)) creature_ptr->cursed |= TRC_ADD_L_CURSE;
1752 if (have_flag(flgs, TR_ADD_H_CURSE)) creature_ptr->cursed |= TRC_ADD_H_CURSE;
1753 if (have_flag(flgs, TR_DRAIN_HP)) creature_ptr->cursed |= TRC_DRAIN_HP;
1754 if (have_flag(flgs, TR_DRAIN_MANA)) creature_ptr->cursed |= TRC_DRAIN_MANA;
1755 if (have_flag(flgs, TR_CALL_ANIMAL)) creature_ptr->cursed |= TRC_CALL_ANIMAL;
1756 if (have_flag(flgs, TR_CALL_DEMON)) creature_ptr->cursed |= TRC_CALL_DEMON;
1757 if (have_flag(flgs, TR_CALL_DRAGON)) creature_ptr->cursed |= TRC_CALL_DRAGON;
1758 if (have_flag(flgs, TR_CALL_UNDEAD)) creature_ptr->cursed |= TRC_CALL_UNDEAD;
1759 if (have_flag(flgs, TR_COWARDICE)) creature_ptr->cursed |= TRC_COWARDICE;
1760 if (have_flag(flgs, TR_LOW_MELEE)) creature_ptr->cursed |= TRC_LOW_MELEE;
1761 if (have_flag(flgs, TR_LOW_AC)) creature_ptr->cursed |= TRC_LOW_AC;
1762 if (have_flag(flgs, TR_LOW_MAGIC)) creature_ptr->cursed |= TRC_LOW_MAGIC;
1763 if (have_flag(flgs, TR_FAST_DIGEST)) creature_ptr->cursed |= TRC_FAST_DIGEST;
1764 if (have_flag(flgs, TR_SLOW_REGEN)) creature_ptr->cursed |= TRC_SLOW_REGEN;
1765 if (have_flag(flgs, TR_DEC_MANA)) creature_ptr->dec_mana = TRUE;
1766 if (have_flag(flgs, TR_BLESSED)) creature_ptr->bless_blade = TRUE;
1767 if (have_flag(flgs, TR_XTRA_MIGHT)) creature_ptr->xtra_might = TRUE;
1768 if (have_flag(flgs, TR_SLOW_DIGEST)) creature_ptr->slow_digest = TRUE;
1769 if (have_flag(flgs, TR_REGEN)) creature_ptr->regenerate = TRUE;
1770 if (have_flag(flgs, TR_TELEPATHY)) creature_ptr->telepathy = TRUE;
1771 if (have_flag(flgs, TR_ESP_ANIMAL)) creature_ptr->esp_animal = TRUE;
1772 if (have_flag(flgs, TR_ESP_UNDEAD)) creature_ptr->esp_undead = TRUE;
1773 if (have_flag(flgs, TR_ESP_DEMON)) creature_ptr->esp_demon = TRUE;
1774 if (have_flag(flgs, TR_ESP_ORC)) creature_ptr->esp_orc = TRUE;
1775 if (have_flag(flgs, TR_ESP_TROLL)) creature_ptr->esp_troll = TRUE;
1776 if (have_flag(flgs, TR_ESP_GIANT)) creature_ptr->esp_giant = TRUE;
1777 if (have_flag(flgs, TR_ESP_DRAGON)) creature_ptr->esp_dragon = TRUE;
1778 if (have_flag(flgs, TR_ESP_HUMAN)) creature_ptr->esp_human = TRUE;
1779 if (have_flag(flgs, TR_ESP_EVIL)) creature_ptr->esp_evil = TRUE;
1780 if (have_flag(flgs, TR_ESP_GOOD)) creature_ptr->esp_good = TRUE;
1781 if (have_flag(flgs, TR_ESP_NONLIVING)) creature_ptr->esp_nonliving = TRUE;
1782 if (have_flag(flgs, TR_ESP_UNIQUE)) creature_ptr->esp_unique = TRUE;
1784 if (have_flag(flgs, TR_SEE_INVIS)) creature_ptr->see_inv = TRUE;
1785 if (have_flag(flgs, TR_LEVITATION)) creature_ptr->levitation = TRUE;
1786 if (have_flag(flgs, TR_FREE_ACT)) creature_ptr->free_act = TRUE;
1787 if (have_flag(flgs, TR_HOLD_EXP)) creature_ptr->hold_exp = TRUE;
1788 if (have_flag(flgs, TR_WARNING)) {
1789 if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
1790 creature_ptr->warning = TRUE;
1793 if (have_flag(flgs, TR_TELEPORT))
1795 if (object_is_cursed(o_ptr)) creature_ptr->cursed |= TRC_TELEPORT;
1798 concptr insc = quark_str(o_ptr->inscription);
1800 /* {.} will stop random teleportation. */
1801 if (o_ptr->inscription && angband_strchr(insc, '.'))
1806 creature_ptr->cursed |= TRC_TELEPORT_SELF;
1811 if (have_flag(flgs, TR_IM_FIRE)) creature_ptr->immune_fire = TRUE;
1812 if (have_flag(flgs, TR_IM_ACID)) creature_ptr->immune_acid = TRUE;
1813 if (have_flag(flgs, TR_IM_COLD)) creature_ptr->immune_cold = TRUE;
1814 if (have_flag(flgs, TR_IM_ELEC)) creature_ptr->immune_elec = TRUE;
1816 if (have_flag(flgs, TR_RES_ACID)) creature_ptr->resist_acid = TRUE;
1817 if (have_flag(flgs, TR_RES_ELEC)) creature_ptr->resist_elec = TRUE;
1818 if (have_flag(flgs, TR_RES_FIRE)) creature_ptr->resist_fire = TRUE;
1819 if (have_flag(flgs, TR_RES_COLD)) creature_ptr->resist_cold = TRUE;
1820 if (have_flag(flgs, TR_RES_POIS)) creature_ptr->resist_pois = TRUE;
1821 if (have_flag(flgs, TR_RES_FEAR)) creature_ptr->resist_fear = TRUE;
1822 if (have_flag(flgs, TR_RES_CONF)) creature_ptr->resist_conf = TRUE;
1823 if (have_flag(flgs, TR_RES_SOUND)) creature_ptr->resist_sound = TRUE;
1824 if (have_flag(flgs, TR_RES_LITE)) creature_ptr->resist_lite = TRUE;
1825 if (have_flag(flgs, TR_RES_DARK)) creature_ptr->resist_dark = TRUE;
1826 if (have_flag(flgs, TR_RES_CHAOS)) creature_ptr->resist_chaos = TRUE;
1827 if (have_flag(flgs, TR_RES_DISEN)) creature_ptr->resist_disen = TRUE;
1828 if (have_flag(flgs, TR_RES_SHARDS)) creature_ptr->resist_shard = TRUE;
1829 if (have_flag(flgs, TR_RES_NEXUS)) creature_ptr->resist_nexus = TRUE;
1830 if (have_flag(flgs, TR_RES_BLIND)) creature_ptr->resist_blind = TRUE;
1831 if (have_flag(flgs, TR_RES_NETHER)) creature_ptr->resist_neth = TRUE;
1833 if (have_flag(flgs, TR_REFLECT)) creature_ptr->reflect = TRUE;
1834 if (have_flag(flgs, TR_SH_FIRE)) creature_ptr->sh_fire = TRUE;
1835 if (have_flag(flgs, TR_SH_ELEC)) creature_ptr->sh_elec = TRUE;
1836 if (have_flag(flgs, TR_SH_COLD)) creature_ptr->sh_cold = TRUE;
1837 if (have_flag(flgs, TR_NO_MAGIC)) creature_ptr->anti_magic = TRUE;
1838 if (have_flag(flgs, TR_NO_TELE)) creature_ptr->anti_tele = TRUE;
1840 if (have_flag(flgs, TR_SUST_STR)) creature_ptr->sustain_str = TRUE;
1841 if (have_flag(flgs, TR_SUST_INT)) creature_ptr->sustain_int = TRUE;
1842 if (have_flag(flgs, TR_SUST_WIS)) creature_ptr->sustain_wis = TRUE;
1843 if (have_flag(flgs, TR_SUST_DEX)) creature_ptr->sustain_dex = TRUE;
1844 if (have_flag(flgs, TR_SUST_CON)) creature_ptr->sustain_con = TRUE;
1845 if (have_flag(flgs, TR_SUST_CHR)) creature_ptr->sustain_chr = TRUE;
1847 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
1848 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
1849 if (o_ptr->name2 == EGO_RING_RES_TIME) creature_ptr->resist_time = TRUE;
1850 if (o_ptr->name2 == EGO_RING_THROW) creature_ptr->mighty_throw = TRUE;
1851 if (have_flag(flgs, TR_EASY_SPELL)) creature_ptr->easy_spell = TRUE;
1852 if (o_ptr->name2 == EGO_AMU_FOOL) creature_ptr->heavy_spell = TRUE;
1853 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
1855 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
1857 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1859 creature_ptr->to_m_chance += 10;
1863 creature_ptr->to_m_chance += 3;
1867 if (o_ptr->tval == TV_CAPTURE) continue;
1869 creature_ptr->ac += o_ptr->ac;
1870 creature_ptr->dis_ac += o_ptr->ac;
1871 creature_ptr->to_a += o_ptr->to_a;
1872 if (object_is_known(o_ptr)) creature_ptr->dis_to_a += o_ptr->to_a;
1874 if (o_ptr->curse_flags & TRC_LOW_MELEE)
1876 int slot = i - INVEN_RARM;
1879 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1881 creature_ptr->to_h[slot] -= 15;
1882 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h[slot] -= 15;
1886 creature_ptr->to_h[slot] -= 5;
1887 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h[slot] -= 5;
1892 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1894 creature_ptr->to_h_b -= 15;
1895 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h_b -= 15;
1899 creature_ptr->to_h_b -= 5;
1900 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_h_b -= 5;
1905 if (o_ptr->curse_flags & TRC_LOW_AC)
1907 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1909 creature_ptr->to_a -= 30;
1910 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_a -= 30;
1914 creature_ptr->to_a -= 10;
1915 if (object_is_fully_known(o_ptr)) creature_ptr->dis_to_a -= 10;
1919 if (i == INVEN_RARM && has_melee_weapon(creature_ptr, i)) continue;
1920 if (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) continue;
1921 if (i == INVEN_BOW) continue;
1923 bonus_to_h = o_ptr->to_h;
1924 bonus_to_d = o_ptr->to_d;
1926 if (creature_ptr->pclass == CLASS_NINJA)
1928 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h + 1) / 2;
1929 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d + 1) / 2;
1932 creature_ptr->to_h_b += (s16b)bonus_to_h;
1933 creature_ptr->to_h_m += (s16b)bonus_to_h;
1934 creature_ptr->to_d_m += (s16b)bonus_to_d;
1936 if (object_is_known(o_ptr)) creature_ptr->dis_to_h_b += (s16b)bonus_to_h;
1938 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !creature_ptr->ryoute)
1940 creature_ptr->to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
1941 creature_ptr->to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
1942 if (object_is_known(o_ptr))
1944 creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
1945 creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
1951 if (creature_ptr->migite && creature_ptr->hidarite)
1953 creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
1954 creature_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
1955 creature_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
1956 creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
1957 if (!object_is_known(o_ptr)) continue;
1959 creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
1960 creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
1961 creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
1962 creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
1966 creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
1967 creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
1969 if (!object_is_known(o_ptr)) continue;
1971 creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
1972 creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
1975 if (object_is_armour(&creature_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&creature_ptr->inventory_list[INVEN_LARM]))
1977 creature_ptr->ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
1978 creature_ptr->dis_ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
1981 if (old_mighty_throw != creature_ptr->mighty_throw)
1983 creature_ptr->window |= PW_INVEN;
1986 if (creature_ptr->cursed & TRC_TELEPORT) creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
1988 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(creature_ptr))
1990 if (!(creature_ptr->inventory_list[INVEN_BODY].k_idx))
1992 creature_ptr->to_a += (creature_ptr->lev * 3) / 2;
1993 creature_ptr->dis_to_a += (creature_ptr->lev * 3) / 2;
1995 if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15))
1997 creature_ptr->to_a += ((creature_ptr->lev - 13) / 3);
1998 creature_ptr->dis_to_a += ((creature_ptr->lev - 13) / 3);
2000 if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10))
2002 creature_ptr->to_a += ((creature_ptr->lev - 8) / 3);
2003 creature_ptr->dis_to_a += ((creature_ptr->lev - 8) / 3);
2005 if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4))
2007 creature_ptr->to_a += (creature_ptr->lev - 2) / 3;
2008 creature_ptr->dis_to_a += (creature_ptr->lev - 2) / 3;
2010 if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx))
2012 creature_ptr->to_a += (creature_ptr->lev / 2);
2013 creature_ptr->dis_to_a += (creature_ptr->lev / 2);
2015 if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx))
2017 creature_ptr->to_a += (creature_ptr->lev / 3);
2018 creature_ptr->dis_to_a += (creature_ptr->lev / 3);
2020 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2022 creature_ptr->stat_add[A_STR] += 2;
2023 creature_ptr->stat_add[A_DEX] += 2;
2024 creature_ptr->stat_add[A_CON] -= 3;
2026 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2029 else if (creature_ptr->special_defense & KAMAE_GENBU)
2031 creature_ptr->stat_add[A_INT] -= 1;
2032 creature_ptr->stat_add[A_WIS] -= 1;
2033 creature_ptr->stat_add[A_DEX] -= 2;
2034 creature_ptr->stat_add[A_CON] += 3;
2036 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2038 creature_ptr->stat_add[A_STR] -= 2;
2039 creature_ptr->stat_add[A_INT] += 1;
2040 creature_ptr->stat_add[A_WIS] += 1;
2041 creature_ptr->stat_add[A_DEX] += 2;
2042 creature_ptr->stat_add[A_CON] -= 2;
2046 if (creature_ptr->special_defense & KATA_KOUKIJIN)
2048 for (int i = 0; i < A_MAX; i++)
2049 creature_ptr->stat_add[i] += 5;
2050 creature_ptr->to_a -= 50;
2051 creature_ptr->dis_to_a -= 50;
2054 if (creature_ptr->sh_fire) creature_ptr->lite = TRUE;
2056 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID))
2058 creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
2059 creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
2062 if (creature_ptr->realm1 == REALM_HEX)
2064 if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + casting_hex_num(creature_ptr));
2065 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
2066 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
2067 if (hex_spelling(creature_ptr, HEX_BUILDING))
2069 creature_ptr->stat_add[A_STR] += 4;
2070 creature_ptr->stat_add[A_DEX] += 4;
2071 creature_ptr->stat_add[A_CON] += 4;
2074 if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
2076 creature_ptr->sh_fire = TRUE;
2077 creature_ptr->regenerate = TRUE;
2080 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
2082 creature_ptr->sh_cold = TRUE;
2083 creature_ptr->to_a += 30;
2084 creature_ptr->dis_to_a += 30;
2087 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
2089 creature_ptr->sh_elec = TRUE;
2090 creature_ptr->pspeed += 3;
2093 for (int i = INVEN_RARM; i <= INVEN_FEET; i++)
2095 ARMOUR_CLASS ac = 0;
2096 o_ptr = &creature_ptr->inventory_list[i];
2097 if (!o_ptr->k_idx) continue;
2098 if (!object_is_armour(o_ptr)) continue;
2099 if (!object_is_cursed(o_ptr)) continue;
2101 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
2102 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
2103 creature_ptr->to_a += (s16b)ac;
2104 creature_ptr->dis_to_a += (s16b)ac;
2109 for (int i = 0; i < A_MAX; i++)
2112 int top = modify_stat_value(creature_ptr->stat_max[i], creature_ptr->stat_add[i]);
2114 if (creature_ptr->stat_top[i] != top)
2116 creature_ptr->stat_top[i] = (s16b)top;
2117 creature_ptr->redraw |= (PR_STATS);
2118 creature_ptr->window |= (PW_PLAYER);
2121 int use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
2123 if ((i == A_CHR) && (creature_ptr->muta3 & MUT3_ILL_NORM))
2125 /* 10 to 18/90 charisma, guaranteed, based on level */
2126 if (use < 8 + 2 * creature_ptr->lev)
2128 use = 8 + 2 * creature_ptr->lev;
2132 if (creature_ptr->stat_use[i] != use)
2134 creature_ptr->stat_use[i] = (s16b)use;
2135 creature_ptr->redraw |= (PR_STATS);
2136 creature_ptr->window |= (PW_PLAYER);
2139 if (use <= 18) ind = (use - 3);
2140 else if (use <= 18 + 219) ind = (15 + (use - 18) / 10);
2143 if (creature_ptr->stat_ind[i] == ind) continue;
2144 creature_ptr->stat_ind[i] = (s16b)ind;
2147 creature_ptr->update |= (PU_HP);
2149 else if (i == A_INT)
2151 if (mp_ptr->spell_stat == A_INT)
2153 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2156 else if (i == A_WIS)
2158 if (mp_ptr->spell_stat == A_WIS)
2160 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2163 else if (i == A_CHR)
2165 if (mp_ptr->spell_stat == A_CHR)
2167 creature_ptr->update |= (PU_MANA | PU_SPELLS);
2171 creature_ptr->window |= (PW_PLAYER);
2175 if (creature_ptr->stun > 50)
2177 creature_ptr->to_h[0] -= 20;
2178 creature_ptr->to_h[1] -= 20;
2179 creature_ptr->to_h_b -= 20;
2180 creature_ptr->to_h_m -= 20;
2181 creature_ptr->dis_to_h[0] -= 20;
2182 creature_ptr->dis_to_h[1] -= 20;
2183 creature_ptr->dis_to_h_b -= 20;
2184 creature_ptr->to_d[0] -= 20;
2185 creature_ptr->to_d[1] -= 20;
2186 creature_ptr->to_d_m -= 20;
2187 creature_ptr->dis_to_d[0] -= 20;
2188 creature_ptr->dis_to_d[1] -= 20;
2190 else if (creature_ptr->stun)
2192 creature_ptr->to_h[0] -= 5;
2193 creature_ptr->to_h[1] -= 5;
2194 creature_ptr->to_h_b -= 5;
2195 creature_ptr->to_h_m -= 5;
2196 creature_ptr->dis_to_h[0] -= 5;
2197 creature_ptr->dis_to_h[1] -= 5;
2198 creature_ptr->dis_to_h_b -= 5;
2199 creature_ptr->to_d[0] -= 5;
2200 creature_ptr->to_d[1] -= 5;
2201 creature_ptr->to_d_m -= 5;
2202 creature_ptr->dis_to_d[0] -= 5;
2203 creature_ptr->dis_to_d[1] -= 5;
2206 if (creature_ptr->wraith_form)
2208 creature_ptr->reflect = TRUE;
2209 creature_ptr->pass_wall = TRUE;
2212 if (creature_ptr->kabenuke)
2214 creature_ptr->pass_wall = TRUE;
2217 if (is_blessed(creature_ptr))
2219 creature_ptr->to_a += 5;
2220 creature_ptr->dis_to_a += 5;
2221 creature_ptr->to_h[0] += 10;
2222 creature_ptr->to_h[1] += 10;
2223 creature_ptr->to_h_b += 10;
2224 creature_ptr->to_h_m += 10;
2225 creature_ptr->dis_to_h[0] += 10;
2226 creature_ptr->dis_to_h[1] += 10;
2227 creature_ptr->dis_to_h_b += 10;
2230 if (creature_ptr->magicdef)
2232 creature_ptr->resist_blind = TRUE;
2233 creature_ptr->resist_conf = TRUE;
2234 creature_ptr->reflect = TRUE;
2235 creature_ptr->free_act = TRUE;
2236 creature_ptr->levitation = TRUE;
2239 if (IS_HERO(creature_ptr))
2241 creature_ptr->to_h[0] += 12;
2242 creature_ptr->to_h[1] += 12;
2243 creature_ptr->to_h_b += 12;
2244 creature_ptr->to_h_m += 12;
2245 creature_ptr->dis_to_h[0] += 12;
2246 creature_ptr->dis_to_h[1] += 12;
2247 creature_ptr->dis_to_h_b += 12;
2250 if (creature_ptr->shero)
2252 creature_ptr->to_h[0] += 12;
2253 creature_ptr->to_h[1] += 12;
2254 creature_ptr->to_h_b -= 12;
2255 creature_ptr->to_h_m += 12;
2256 creature_ptr->to_d[0] += 3 + (creature_ptr->lev / 5);
2257 creature_ptr->to_d[1] += 3 + (creature_ptr->lev / 5);
2258 creature_ptr->to_d_m += 3 + (creature_ptr->lev / 5);
2259 creature_ptr->dis_to_h[0] += 12;
2260 creature_ptr->dis_to_h[1] += 12;
2261 creature_ptr->dis_to_h_b -= 12;
2262 creature_ptr->dis_to_d[0] += 3 + (creature_ptr->lev / 5);
2263 creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
2264 creature_ptr->to_a -= 10;
2265 creature_ptr->dis_to_a -= 10;
2266 creature_ptr->skill_stl -= 7;
2267 creature_ptr->skill_dev -= 20;
2268 creature_ptr->skill_sav -= 30;
2269 creature_ptr->skill_srh -= 15;
2270 creature_ptr->skill_fos -= 15;
2271 creature_ptr->skill_tht -= 20;
2272 creature_ptr->skill_dig += 30;
2275 if (IS_FAST(creature_ptr))
2277 creature_ptr->pspeed += 10;
2280 if (creature_ptr->slow)
2282 creature_ptr->pspeed -= 10;
2285 if (is_time_limit_esp(creature_ptr))
2287 creature_ptr->telepathy = TRUE;
2290 if (creature_ptr->ele_immune)
2292 if (creature_ptr->special_defense & DEFENSE_ACID)
2293 creature_ptr->immune_acid = TRUE;
2294 else if (creature_ptr->special_defense & DEFENSE_ELEC)
2295 creature_ptr->immune_elec = TRUE;
2296 else if (creature_ptr->special_defense & DEFENSE_FIRE)
2297 creature_ptr->immune_fire = TRUE;
2298 else if (creature_ptr->special_defense & DEFENSE_COLD)
2299 creature_ptr->immune_cold = TRUE;
2302 if (creature_ptr->tim_invis)
2304 creature_ptr->see_inv = TRUE;
2307 if (creature_ptr->tim_infra)
2309 creature_ptr->see_infra += 3;
2312 if (creature_ptr->tim_regen)
2314 creature_ptr->regenerate = TRUE;
2317 if (creature_ptr->tim_levitation)
2319 creature_ptr->levitation = TRUE;
2322 if (creature_ptr->tim_reflect)
2324 creature_ptr->reflect = TRUE;
2327 if (IS_HERO(creature_ptr) || creature_ptr->shero)
2329 creature_ptr->resist_fear = TRUE;
2332 if (creature_ptr->telepathy != old_telepathy)
2334 creature_ptr->update |= (PU_MONSTERS);
2337 if ((creature_ptr->esp_animal != old_esp_animal) ||
2338 (creature_ptr->esp_undead != old_esp_undead) ||
2339 (creature_ptr->esp_demon != old_esp_demon) ||
2340 (creature_ptr->esp_orc != old_esp_orc) ||
2341 (creature_ptr->esp_troll != old_esp_troll) ||
2342 (creature_ptr->esp_giant != old_esp_giant) ||
2343 (creature_ptr->esp_dragon != old_esp_dragon) ||
2344 (creature_ptr->esp_human != old_esp_human) ||
2345 (creature_ptr->esp_evil != old_esp_evil) ||
2346 (creature_ptr->esp_good != old_esp_good) ||
2347 (creature_ptr->esp_nonliving != old_esp_nonliving) ||
2348 (creature_ptr->esp_unique != old_esp_unique))
2350 creature_ptr->update |= (PU_MONSTERS);
2353 if (creature_ptr->see_inv != old_see_inv)
2355 creature_ptr->update |= (PU_MONSTERS);
2358 if (creature_ptr->food >= PY_FOOD_MAX) creature_ptr->pspeed -= 10;
2360 if (creature_ptr->special_defense & KAMAE_SUZAKU) creature_ptr->pspeed += 10;
2362 if ((creature_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
2363 (creature_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
2365 creature_ptr->to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2366 creature_ptr->dis_to_h[default_hand] += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
2369 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2371 int penalty1, penalty2;
2372 penalty1 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_RARM].weight) / 8);
2373 penalty2 = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[INVEN_LARM].weight) / 8);
2374 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN))
2376 penalty1 = penalty1 / 2 - 5;
2377 penalty2 = penalty2 / 2 - 5;
2378 creature_ptr->pspeed += 7;
2379 creature_ptr->to_a += 10;
2380 creature_ptr->dis_to_a += 10;
2384 if (penalty1 > 0) penalty1 /= 2;
2385 if (penalty2 > 0) penalty2 /= 2;
2387 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)))
2389 penalty1 = MAX(0, penalty1 - 10);
2390 penalty2 = MAX(0, penalty2 - 10);
2392 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
2394 penalty1 = MIN(0, penalty1);
2395 penalty2 = MIN(0, penalty2);
2396 creature_ptr->to_a += 10;
2397 creature_ptr->dis_to_a += 10;
2401 if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
2403 if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
2407 if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
2408 if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
2409 creature_ptr->to_h[0] -= (s16b)penalty1;
2410 creature_ptr->to_h[1] -= (s16b)penalty2;
2411 creature_ptr->dis_to_h[0] -= (s16b)penalty1;
2412 creature_ptr->dis_to_h[1] -= (s16b)penalty2;
2415 int j = creature_ptr->total_weight;
2416 if (!creature_ptr->riding)
2418 count = (int)weight_limit(creature_ptr);
2422 monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
2423 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
2424 SPEED speed = riding_m_ptr->mspeed;
2426 if (riding_m_ptr->mspeed > 110)
2428 creature_ptr->pspeed = 110 + (s16b)((speed - 110) * (creature_ptr->skill_exp[GINOU_RIDING] * 3 + creature_ptr->lev * 160L - 10000L) / (22000L));
2429 if (creature_ptr->pspeed < 110) creature_ptr->pspeed = 110;
2433 creature_ptr->pspeed = speed;
2436 creature_ptr->pspeed += (creature_ptr->skill_exp[GINOU_RIDING] + creature_ptr->lev * 160L) / 3200;
2437 if (monster_fast_remaining(riding_m_ptr)) creature_ptr->pspeed += 10;
2438 if (monster_slow_remaining(riding_m_ptr)) creature_ptr->pspeed -= 10;
2439 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
2440 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) creature_ptr->can_swim = TRUE;
2442 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) creature_ptr->pass_wall = FALSE;
2443 if (riding_r_ptr->flags2 & RF2_KILL_WALL) creature_ptr->kill_wall = TRUE;
2445 if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED)
2446 j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
2448 count = 1500 + riding_r_ptr->level * 25;
2451 if (j > count) creature_ptr->pspeed -= ((j - count) / (count / 5));
2452 if (creature_ptr->action == ACTION_SEARCH) creature_ptr->pspeed -= 10;
2453 if (creature_ptr->prace == RACE_MERFOLK)
2455 if (have_flag(f_ptr->flags, FF_WATER))
2457 creature_ptr->pspeed += (2 + creature_ptr->lev / 10);
2459 else if (!creature_ptr->levitation)
2461 creature_ptr->pspeed -= 2;
2465 creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2466 creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2467 creature_ptr->to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2468 creature_ptr->to_d_m += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2469 creature_ptr->to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2470 creature_ptr->to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2471 creature_ptr->to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2472 creature_ptr->to_h_m += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2473 creature_ptr->to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2474 creature_ptr->to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2475 creature_ptr->to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2476 creature_ptr->to_h_m += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2477 creature_ptr->dis_to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
2478 creature_ptr->dis_to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2479 creature_ptr->dis_to_d[1] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
2480 creature_ptr->dis_to_h[0] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2481 creature_ptr->dis_to_h[1] += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2482 creature_ptr->dis_to_h_b += ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2483 creature_ptr->dis_to_h[0] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2484 creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2485 creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
2487 hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
2488 o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2489 creature_ptr->heavy_shoot = is_heavy_shoot(creature_ptr, o_ptr);
2490 if (creature_ptr->heavy_shoot)
2492 creature_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
2493 creature_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
2498 creature_ptr->tval_ammo = (byte)bow_tval_ammo(o_ptr);
2499 if (o_ptr->k_idx && !creature_ptr->heavy_shoot)
2501 creature_ptr->num_fire = calc_num_fire(creature_ptr, o_ptr);
2502 if ((creature_ptr->pclass == CLASS_SNIPER) &&
2503 (creature_ptr->tval_ammo == TV_BOLT))
2505 creature_ptr->to_h_b += (10 + (creature_ptr->lev / 5));
2506 creature_ptr->dis_to_h_b += (10 + (creature_ptr->lev / 5));
2511 if (creature_ptr->ryoute) hold *= 2;
2512 for (int i = 0; i < 2; i++)
2514 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2515 object_flags(o_ptr, flgs);
2516 creature_ptr->heavy_wield[i] = FALSE;
2517 creature_ptr->icky_wield[i] = FALSE;
2518 creature_ptr->riding_wield[i] = FALSE;
2519 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
2521 creature_ptr->num_blow[i] = 1;
2525 if (hold < o_ptr->weight / 10)
2527 creature_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
2528 creature_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
2529 creature_ptr->heavy_wield[i] = TRUE;
2531 else if (creature_ptr->ryoute && (hold < o_ptr->weight / 5)) omoi = TRUE;
2533 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
2535 creature_ptr->to_a += 5;
2536 creature_ptr->dis_to_a += 5;
2539 if (o_ptr->k_idx && !creature_ptr->heavy_wield[i])
2541 int str_index, dex_index;
2542 int num = 0, wgt = 0, mul = 0, div = 0;
2543 switch (creature_ptr->pclass)
2546 num = 6; wgt = 70; mul = 5; break;
2548 case CLASS_BERSERKER:
2549 num = 6; wgt = 70; mul = 7; break;
2552 case CLASS_HIGH_MAGE:
2553 case CLASS_BLUE_MAGE:
2554 num = 3; wgt = 100; mul = 2; break;
2557 case CLASS_MAGIC_EATER:
2558 case CLASS_MINDCRAFTER:
2559 num = 5; wgt = 100; mul = 3; break;
2562 num = 5; wgt = 40; mul = 3; break;
2565 num = 5; wgt = 70; mul = 4; break;
2569 num = 5; wgt = 70; mul = 4; break;
2572 num = 5; wgt = 150; mul = 5; break;
2574 case CLASS_WARRIOR_MAGE:
2575 case CLASS_RED_MAGE:
2576 num = 5; wgt = 70; mul = 3; break;
2578 case CLASS_CHAOS_WARRIOR:
2579 num = 5; wgt = 70; mul = 4; break;
2582 num = 5; wgt = 60; mul = 3; break;
2585 num = 4; wgt = 100; mul = 3; break;
2587 case CLASS_IMITATOR:
2588 num = 5; wgt = 70; mul = 4; break;
2590 case CLASS_BEASTMASTER:
2591 num = 5; wgt = 70; mul = 3; break;
2594 if ((creature_ptr->riding) && (have_flag(flgs, TR_RIDING))) { num = 5; wgt = 70; mul = 4; }
2595 else { num = 5; wgt = 100; mul = 3; }
2598 case CLASS_SORCERER:
2599 num = 1; wgt = 1; mul = 1; break;
2604 num = 4; wgt = 70; mul = 2; break;
2606 case CLASS_FORCETRAINER:
2607 num = 4; wgt = 60; mul = 2; break;
2609 case CLASS_MIRROR_MASTER:
2610 num = 3; wgt = 100; mul = 3; break;
2613 num = 4; wgt = 20; mul = 1; break;
2616 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING))
2623 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
2624 str_index = (adj_str_blow[creature_ptr->stat_ind[A_STR]] * mul / div);
2626 if (creature_ptr->ryoute && !omoi) str_index++;
2627 if (creature_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index - 1);
2628 if (str_index > 11) str_index = 11;
2630 dex_index = (adj_dex_blow[creature_ptr->stat_ind[A_DEX]]);
2631 if (dex_index > 11) dex_index = 11;
2633 creature_ptr->num_blow[i] = blows_table[str_index][dex_index];
2634 if (creature_ptr->num_blow[i] > num) creature_ptr->num_blow[i] = (s16b)num;
2636 creature_ptr->num_blow[i] += (s16b)extra_blows[i];
2637 if (creature_ptr->pclass == CLASS_WARRIOR) creature_ptr->num_blow[i] += (creature_ptr->lev / 40);
2638 else if (creature_ptr->pclass == CLASS_BERSERKER)
2639 creature_ptr->num_blow[i] += (creature_ptr->lev / 23);
2640 else if ((creature_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (creature_ptr->stat_ind[A_DEX] >= 30))
2641 creature_ptr->num_blow[i] ++;
2643 if (creature_ptr->special_defense & KATA_FUUJIN)
2644 creature_ptr->num_blow[i] -= 1;
2646 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE))
2647 creature_ptr->num_blow[i] = 1;
2649 if (creature_ptr->num_blow[i] < 1)
2650 creature_ptr->num_blow[i] = 1;
2652 creature_ptr->skill_dig += (o_ptr->weight / 10);
2655 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
2656 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
2658 creature_ptr->to_h[i] -= 2;
2659 creature_ptr->to_d[i] -= 2;
2660 creature_ptr->dis_to_h[i] -= 2;
2661 creature_ptr->dis_to_d[i] -= 2;
2662 creature_ptr->icky_wield[i] = TRUE;
2664 else if (creature_ptr->pclass == CLASS_BERSERKER)
2666 creature_ptr->to_h[i] += creature_ptr->lev / 5;
2667 creature_ptr->to_d[i] += creature_ptr->lev / 6;
2668 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
2669 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
2670 if (((i == 0) && !creature_ptr->hidarite) || creature_ptr->ryoute)
2672 creature_ptr->to_h[i] += creature_ptr->lev / 5;
2673 creature_ptr->to_d[i] += creature_ptr->lev / 6;
2674 creature_ptr->dis_to_h[i] += creature_ptr->lev / 5;
2675 creature_ptr->dis_to_d[i] += creature_ptr->lev / 6;
2678 else if (creature_ptr->pclass == CLASS_SORCERER)
2680 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
2682 creature_ptr->to_h[i] -= 200;
2683 creature_ptr->to_d[i] -= 200;
2684 creature_ptr->dis_to_h[i] -= 200;
2685 creature_ptr->dis_to_d[i] -= 200;
2686 creature_ptr->icky_wield[i] = TRUE;
2690 creature_ptr->to_h[i] -= 30;
2691 creature_ptr->to_d[i] -= 10;
2692 creature_ptr->dis_to_h[i] -= 30;
2693 creature_ptr->dis_to_d[i] -= 10;
2697 if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr))
2699 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
2700 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
2701 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
2702 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
2703 if (hex_spelling(creature_ptr, HEX_RUNESWORD))
2705 if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
2706 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
2707 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
2711 if (creature_ptr->riding == 0) continue;
2713 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
2715 creature_ptr->to_h[i] += 15;
2716 creature_ptr->dis_to_h[i] += 15;
2717 creature_ptr->to_dd[i] += 2;
2721 if (have_flag(flgs, TR_RIDING)) continue;
2724 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
2730 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
2732 if (penalty < 30) penalty = 30;
2735 creature_ptr->to_h[i] -= (s16b)penalty;
2736 creature_ptr->dis_to_h[i] -= (s16b)penalty;
2737 creature_ptr->riding_wield[i] = TRUE;
2740 if (creature_ptr->riding)
2744 creature_ptr->riding_ryoute = FALSE;
2746 if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
2747 else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
2749 switch (creature_ptr->pclass)
2752 case CLASS_FORCETRAINER:
2753 case CLASS_BERSERKER:
2754 if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
2755 creature_ptr->riding_ryoute = TRUE;
2760 if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
2762 if (creature_ptr->tval_ammo != TV_ARROW) penalty = 5;
2766 penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
2768 if (penalty < 30) penalty = 30;
2771 if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
2772 creature_ptr->to_h_b -= (s16b)penalty;
2773 creature_ptr->dis_to_h_b -= (s16b)penalty;
2776 /* Different calculation for monks with empty hands */
2777 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) &&
2778 (empty_hands_status & EMPTY_HAND_RARM) && !creature_ptr->hidarite)
2780 int blow_base = creature_ptr->lev + adj_dex_blow[creature_ptr->stat_ind[A_DEX]];
2781 creature_ptr->num_blow[0] = 0;
2783 if (creature_ptr->pclass == CLASS_FORCETRAINER)
2785 if (blow_base > 18) creature_ptr->num_blow[0]++;
2786 if (blow_base > 31) creature_ptr->num_blow[0]++;
2787 if (blow_base > 44) creature_ptr->num_blow[0]++;
2788 if (blow_base > 58) creature_ptr->num_blow[0]++;
2790 MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
2791 if (current_ki != 0)
2793 creature_ptr->to_d[0] += current_ki / 5;
2794 creature_ptr->dis_to_d[0] += current_ki / 5;
2799 if (blow_base > 12) creature_ptr->num_blow[0]++;
2800 if (blow_base > 22) creature_ptr->num_blow[0]++;
2801 if (blow_base > 31) creature_ptr->num_blow[0]++;
2802 if (blow_base > 39) creature_ptr->num_blow[0]++;
2803 if (blow_base > 46) creature_ptr->num_blow[0]++;
2804 if (blow_base > 53) creature_ptr->num_blow[0]++;
2805 if (blow_base > 59) creature_ptr->num_blow[0]++;
2808 if (heavy_armor(creature_ptr) && (creature_ptr->pclass != CLASS_BERSERKER))
2809 creature_ptr->num_blow[0] /= 2;
2812 creature_ptr->to_h[0] += (creature_ptr->lev / 3);
2813 creature_ptr->dis_to_h[0] += (creature_ptr->lev / 3);
2815 creature_ptr->to_d[0] += (creature_ptr->lev / 6);
2816 creature_ptr->dis_to_d[0] += (creature_ptr->lev / 6);
2819 if (creature_ptr->special_defense & KAMAE_BYAKKO)
2821 creature_ptr->to_a -= 40;
2822 creature_ptr->dis_to_a -= 40;
2825 else if (creature_ptr->special_defense & KAMAE_SEIRYU)
2827 creature_ptr->to_a -= 50;
2828 creature_ptr->dis_to_a -= 50;
2829 creature_ptr->resist_acid = TRUE;
2830 creature_ptr->resist_fire = TRUE;
2831 creature_ptr->resist_elec = TRUE;
2832 creature_ptr->resist_cold = TRUE;
2833 creature_ptr->resist_pois = TRUE;
2834 creature_ptr->sh_fire = TRUE;
2835 creature_ptr->sh_elec = TRUE;
2836 creature_ptr->sh_cold = TRUE;
2837 creature_ptr->levitation = TRUE;
2839 else if (creature_ptr->special_defense & KAMAE_GENBU)
2841 creature_ptr->to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
2842 creature_ptr->dis_to_a += (creature_ptr->lev*creature_ptr->lev) / 50;
2843 creature_ptr->reflect = TRUE;
2844 creature_ptr->num_blow[0] -= 2;
2845 if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42)) creature_ptr->num_blow[0]--;
2846 if (creature_ptr->num_blow[0] < 0) creature_ptr->num_blow[0] = 0;
2848 else if (creature_ptr->special_defense & KAMAE_SUZAKU)
2850 creature_ptr->to_h[0] -= (creature_ptr->lev / 3);
2851 creature_ptr->to_d[0] -= (creature_ptr->lev / 6);
2853 creature_ptr->dis_to_h[0] -= (creature_ptr->lev / 3);
2854 creature_ptr->dis_to_d[0] -= (creature_ptr->lev / 6);
2855 creature_ptr->num_blow[0] /= 2;
2856 creature_ptr->levitation = TRUE;
2859 creature_ptr->num_blow[0] += 1 + extra_blows[0];
2862 if (creature_ptr->riding) creature_ptr->levitation = riding_levitation;
2864 creature_ptr->monk_armour_aux = FALSE;
2866 if (heavy_armor(creature_ptr))
2868 creature_ptr->monk_armour_aux = TRUE;
2871 for (int i = 0; i < 2; i++)
2873 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
2875 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2876 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2878 creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
2879 creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
2880 if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
2882 if (!s_info[creature_ptr->pclass].w_max[tval][sval])
2884 creature_ptr->to_h[i] -= 40;
2885 creature_ptr->dis_to_h[i] -= 40;
2886 creature_ptr->icky_wield[i] = TRUE;
2892 if (creature_ptr->pclass != CLASS_NINJA) continue;
2894 if ((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD))
2897 creature_ptr->to_h[i] -= 40;
2898 creature_ptr->dis_to_h[i] -= 40;
2899 creature_ptr->icky_wield[i] = TRUE;
2900 creature_ptr->num_blow[i] /= 2;
2901 if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
2904 /* Maximum speed is (+99). (internally it's 110 + 99) */
2905 /* Temporary lightspeed forces to be maximum speed */
2906 if ((creature_ptr->lightspeed && !creature_ptr->riding) || (creature_ptr->pspeed > 209))
2908 creature_ptr->pspeed = 209;
2911 /* Minimum speed is (-99). (internally it's 110 - 99) */
2912 if (creature_ptr->pspeed < 11) creature_ptr->pspeed = 11;
2914 if (creature_ptr->pspeed != old_speed)
2916 creature_ptr->redraw |= (PR_SPEED);
2921 if (creature_ptr->to_a > (0 - creature_ptr->ac))
2922 creature_ptr->to_a = 0 - creature_ptr->ac;
2923 if (creature_ptr->dis_to_a > (0 - creature_ptr->dis_ac))
2924 creature_ptr->dis_to_a = 0 - creature_ptr->dis_ac;
2927 if ((creature_ptr->dis_ac != old_dis_ac) || (creature_ptr->dis_to_a != old_dis_to_a))
2929 creature_ptr->redraw |= (PR_ARMOR);
2930 creature_ptr->window |= (PW_PLAYER);
2933 if (creature_ptr->ryoute && !omoi)
2935 int bonus_to_h = 0, bonus_to_d = 0;
2936 bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
2937 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);
2939 creature_ptr->to_h[default_hand] += MAX(bonus_to_h, 1);
2940 creature_ptr->dis_to_h[default_hand] += MAX(bonus_to_h, 1);
2941 creature_ptr->to_d[default_hand] += MAX(bonus_to_d, 1);
2942 creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
2945 bool is_special_class = creature_ptr->pclass == CLASS_MONK;
2946 is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
2947 is_special_class |= creature_ptr->pclass == CLASS_BERSERKER;
2948 if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
2949 creature_ptr->ryoute = FALSE;
2951 creature_ptr->skill_stl += 1;
2953 if (is_time_limit_stealth(creature_ptr))
2954 creature_ptr->skill_stl += 99;
2956 creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
2957 creature_ptr->skill_dis += adj_int_dis[creature_ptr->stat_ind[A_INT]];
2958 creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
2959 creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
2960 creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
2961 creature_ptr->skill_dis += ((cp_ptr->x_dis * creature_ptr->lev / 10) + (ap_ptr->a_dis * creature_ptr->lev / 50));
2962 creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
2963 creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
2964 creature_ptr->skill_stl += (cp_ptr->x_stl * creature_ptr->lev / 10);
2965 creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
2966 creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
2967 creature_ptr->skill_thn += ((cp_ptr->x_thn * creature_ptr->lev / 10) + (ap_ptr->a_thn * creature_ptr->lev / 50));
2968 creature_ptr->skill_thb += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
2969 creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
2971 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
2973 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
2974 creature_ptr->skill_stl = MIN(creature_ptr->skill_stl - 3, (creature_ptr->skill_stl + 2) / 2);
2977 if (creature_ptr->skill_stl > 30) creature_ptr->skill_stl = 30;
2978 if (creature_ptr->skill_stl < 0) creature_ptr->skill_stl = 0;
2979 if (creature_ptr->skill_dig < 1) creature_ptr->skill_dig = 1;
2980 if (creature_ptr->anti_magic && (creature_ptr->skill_sav < (90 + creature_ptr->lev)))
2981 creature_ptr->skill_sav = 90 + creature_ptr->lev;
2982 if (creature_ptr->tsubureru) creature_ptr->skill_sav = 10;
2983 if ((creature_ptr->ult_res || creature_ptr->resist_magic || creature_ptr->magicdef) && (creature_ptr->skill_sav < (95 + creature_ptr->lev)))
2984 creature_ptr->skill_sav = 95 + creature_ptr->lev;
2986 if (down_saving) creature_ptr->skill_sav /= 2;
2988 if (creature_ptr->immune_acid) creature_ptr->resist_acid = TRUE;
2989 if (creature_ptr->immune_elec) creature_ptr->resist_elec = TRUE;
2990 if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
2991 if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
2993 if (current_world_ptr->character_xtra) return;
2995 if (creature_ptr->old_heavy_shoot != creature_ptr->heavy_shoot)
2997 if (creature_ptr->heavy_shoot)
2999 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
3001 else if (creature_ptr->inventory_list[INVEN_BOW].k_idx)
3003 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
3007 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
3010 creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
3013 for (int i = 0; i < 2; i++)
3015 if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
3017 if (creature_ptr->heavy_wield[i])
3019 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
3021 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3023 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
3025 else if (creature_ptr->heavy_wield[1 - i])
3027 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
3031 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
3034 creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
3037 if (creature_ptr->old_riding_wield[i] != creature_ptr->riding_wield[i])
3039 if (creature_ptr->riding_wield[i])
3041 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
3043 else if (!creature_ptr->riding)
3045 msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
3047 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3049 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
3052 creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
3055 if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i])
3058 if (creature_ptr->icky_wield[i])
3060 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
3061 if (current_world_ptr->is_loading_now)
3063 chg_virtue(creature_ptr, V_FAITH, -1);
3066 else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
3068 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
3072 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
3075 creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
3078 if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
3080 if (creature_ptr->riding_ryoute)
3083 msg_format("%s馬を操れない。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
3085 msg_print("You are using both hand for fighting, and you can't control the pet you're riding.");
3091 msg_format("%s馬を操れるようになった。", (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
3093 msg_print("You began to control the pet you're riding with one hand.");
3097 creature_ptr->old_riding_ryoute = creature_ptr->riding_ryoute;
3100 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))
3102 if (heavy_armor(creature_ptr))
3104 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
3105 if (current_world_ptr->is_loading_now)
3107 chg_virtue(creature_ptr, V_HARMONY, -1);
3112 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
3115 creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
3118 for (int i = 0; i < INVEN_PACK; i++)
3120 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
3121 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
3124 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)
3126 o_ptr = &floor_ptr->o_list[this_o_idx];
3127 next_o_idx = o_ptr->next_o_idx;
3129 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
3130 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
3133 if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
3135 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
3137 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
3138 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3141 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER)))
3143 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_KABE];
3144 if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
3149 static void calc_alignment(player_type *creature_ptr)
3151 creature_ptr->align = 0;
3152 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
3153 for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
3155 monster_type *m_ptr;
3156 monster_race *r_ptr;
3157 m_ptr = &floor_ptr->m_list[m_idx];
3158 if (!monster_is_valid(m_ptr)) continue;
3159 r_ptr = &r_info[m_ptr->r_idx];
3161 if (!is_pet(m_ptr)) continue;
3163 if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3164 if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
3167 if (creature_ptr->mimic_form)
3169 switch (creature_ptr->mimic_form)
3172 creature_ptr->align -= 200;
3174 case MIMIC_DEMON_LORD:
3175 creature_ptr->align -= 200;
3181 switch (creature_ptr->prace)
3184 creature_ptr->align += 200;
3187 creature_ptr->align -= 200;
3192 for (int i = 0; i < 2; i++)
3194 if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
3195 if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL) continue;
3196 creature_ptr->align -= 1000;
3201 for (int i = 0; i < 8; i++)
3203 switch (creature_ptr->vir_types[i])
3206 creature_ptr->align += creature_ptr->virtues[i] * 2;
3215 creature_ptr->align -= creature_ptr->virtues[i];
3218 creature_ptr->align += creature_ptr->virtues[i];
3223 for (int i = 0; i < j; i++)
3225 if (creature_ptr->align > 0)
3227 creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
3228 if (creature_ptr->align < 0) creature_ptr->align = 0;
3230 else if (creature_ptr->align < 0)
3232 creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
3233 if (creature_ptr->align > 0) creature_ptr->align = 0;
3240 * @brief プレイヤーの最大HPを計算する /
3241 * Calculate the players (maximal) hit points
3242 * Adjust current hitpoints if necessary
3246 static void calc_hitpoints(player_type *creature_ptr)
3248 int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
3249 int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
3252 if (creature_ptr->mimic_form)
3254 if (creature_ptr->pclass == CLASS_SORCERER)
3255 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3257 tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3258 mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
3261 if (creature_ptr->pclass == CLASS_SORCERER)
3263 if (creature_ptr->lev < 30)
3264 mhp = (mhp * (45 + creature_ptr->lev) / 100);
3266 mhp = (mhp * 75 / 100);
3267 bonus = (bonus * 65 / 100);
3272 if (creature_ptr->pclass == CLASS_BERSERKER)
3274 mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
3277 if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
3278 if (IS_HERO(creature_ptr)) mhp += 10;
3279 if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
3280 if (creature_ptr->tsuyoshi) mhp += 50;
3281 if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) mhp += 15;
3282 if (hex_spelling(creature_ptr, HEX_BUILDING)) mhp += 60;
3283 if (creature_ptr->mhp == mhp) return;
3285 if (creature_ptr->chp >= mhp)
3287 creature_ptr->chp = mhp;
3288 creature_ptr->chp_frac = 0;
3292 if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
3294 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
3297 creature_ptr->mhp = mhp;
3299 creature_ptr->redraw |= PR_HP;
3300 creature_ptr->window |= PW_PLAYER;
3305 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
3308 * SWD: Experimental modification: multiple light sources have additive effect.
3310 static void calc_torch(player_type *creature_ptr)
3312 creature_ptr->cur_lite = 0;
3313 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
3316 o_ptr = &creature_ptr->inventory_list[i];
3317 if (!o_ptr->k_idx) continue;
3319 if (o_ptr->name2 == EGO_LITE_SHINE) creature_ptr->cur_lite++;
3320 if (o_ptr->name2 != EGO_LITE_DARKNESS)
3322 if (o_ptr->tval == TV_LITE)
3324 if ((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
3325 if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
3329 BIT_FLAGS flgs[TR_FLAG_SIZE];
3330 object_flags(o_ptr, flgs);
3333 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
3334 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
3335 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
3336 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
3337 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
3338 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
3339 creature_ptr->cur_lite += rad;
3342 if (d_info[creature_ptr->dungeon_idx].flags1 & DF1_DARKNESS && creature_ptr->cur_lite > 1)
3343 creature_ptr->cur_lite = 1;
3345 if (creature_ptr->cur_lite <= 0 && creature_ptr->lite)
3346 creature_ptr->cur_lite++;
3348 if (creature_ptr->cur_lite > 14)
3349 creature_ptr->cur_lite = 14;
3351 if (creature_ptr->cur_lite < 0)
3352 creature_ptr->cur_lite = 0;
3354 if (creature_ptr->old_lite == creature_ptr->cur_lite)
3357 creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
3358 creature_ptr->old_lite = creature_ptr->cur_lite;
3360 if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
3361 set_superstealth(creature_ptr, FALSE);
3366 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
3367 * Calculate number of spells player should have, and forget,
3368 * or remember, spells until that number is properly reflected.
3371 * Note that this function induces various "status" messages,
3372 * which must be bypasses until the character is created.
3374 static void calc_spells(player_type *creature_ptr)
3376 if (!mp_ptr->spell_book) return;
3377 if (!current_world_ptr->character_generated) return;
3378 if (current_world_ptr->character_xtra) return;
3379 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3381 creature_ptr->new_spells = 0;
3385 concptr p = spell_category_name(mp_ptr->spell_book);
3386 int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
3387 if (levels < 0) levels = 0;
3389 int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
3391 if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
3396 if (creature_ptr->pclass == CLASS_SAMURAI)
3400 else if (creature_ptr->realm2 == REALM_NONE)
3402 num_allowed = (num_allowed + 1) / 2;
3403 if (num_allowed > (32 + bonus)) num_allowed = 32 + bonus;
3405 else if ((creature_ptr->pclass == CLASS_MAGE) || (creature_ptr->pclass == CLASS_PRIEST))
3407 if (num_allowed > (96 + bonus)) num_allowed = 96 + bonus;
3411 if (num_allowed > (80 + bonus)) num_allowed = 80 + bonus;
3414 int num_boukyaku = 0;
3415 for (int j = 0; j < 64; j++)
3418 (creature_ptr->spell_forgotten1 & (1L << j)) :
3419 (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
3425 creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
3426 for (int i = 63; i >= 0; i--)
3428 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3430 int j = creature_ptr->spell_order[i];
3431 if (j >= 99) continue;
3433 const magic_type *s_ptr;
3434 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3437 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3439 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3442 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3444 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3446 if (s_ptr->slevel <= creature_ptr->lev) continue;
3448 bool is_spell_learned = (j < 32) ?
3449 (creature_ptr->spell_learned1 & (1L << j)) :
3450 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3451 if (!is_spell_learned) continue;
3456 creature_ptr->spell_forgotten1 |= (1L << j);
3457 which = creature_ptr->realm1;
3461 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3462 which = creature_ptr->realm2;
3467 creature_ptr->spell_learned1 &= ~(1L << j);
3468 which = creature_ptr->realm1;
3472 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3473 which = creature_ptr->realm2;
3477 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3479 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3481 creature_ptr->new_spells++;
3484 /* Forget spells if we know too many spells */
3485 for (int i = 63; i >= 0; i--)
3487 if (creature_ptr->new_spells >= 0) break;
3488 if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
3490 int j = creature_ptr->spell_order[i];
3491 if (j >= 99) continue;
3493 bool is_spell_learned = (j < 32) ?
3494 (creature_ptr->spell_learned1 & (1L << j)) :
3495 (creature_ptr->spell_learned2 & (1L << (j - 32)));
3496 if (!is_spell_learned) continue;
3501 creature_ptr->spell_forgotten1 |= (1L << j);
3502 which = creature_ptr->realm1;
3506 creature_ptr->spell_forgotten2 |= (1L << (j - 32));
3507 which = creature_ptr->realm2;
3512 creature_ptr->spell_learned1 &= ~(1L << j);
3513 which = creature_ptr->realm1;
3517 creature_ptr->spell_learned2 &= ~(1L << (j - 32));
3518 which = creature_ptr->realm2;
3522 msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3524 msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3526 creature_ptr->new_spells++;
3529 /* Check for spells to remember */
3530 for (int i = 0; i < 64; i++)
3532 if (creature_ptr->new_spells <= 0) break;
3533 if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
3534 int j = creature_ptr->spell_order[i];
3537 const magic_type *s_ptr;
3538 if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
3541 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3543 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][j % 32];
3546 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3548 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][j % 32];
3550 if (s_ptr->slevel > creature_ptr->lev) continue;
3552 bool is_spell_learned = (j < 32) ?
3553 (creature_ptr->spell_forgotten1 & (1L << j)) :
3554 (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
3555 if (!is_spell_learned) continue;
3560 creature_ptr->spell_forgotten1 &= ~(1L << j);
3561 which = creature_ptr->realm1;
3565 creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
3566 which = creature_ptr->realm2;
3571 creature_ptr->spell_learned1 |= (1L << j);
3572 which = creature_ptr->realm1;
3576 creature_ptr->spell_learned2 |= (1L << (j - 32));
3577 which = creature_ptr->realm2;
3581 msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
3583 msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
3585 creature_ptr->new_spells--;
3588 if (creature_ptr->realm2 == REALM_NONE)
3591 for (int j = 0; j < 32; j++)
3593 const magic_type *s_ptr;
3594 if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
3595 else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
3597 if (s_ptr->slevel > creature_ptr->lev) continue;
3599 if (creature_ptr->spell_learned1 & (1L << j))
3608 if ((creature_ptr->new_spells > k) &&
3609 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
3611 creature_ptr->new_spells = (s16b)k;
3615 if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
3617 if (creature_ptr->old_spells == creature_ptr->new_spells) return;
3619 if (creature_ptr->new_spells)
3622 if (creature_ptr->new_spells < 10) {
3623 msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
3626 msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
3629 msg_format("You can learn %d more %s%s.",
3630 creature_ptr->new_spells, p,
3631 (creature_ptr->new_spells != 1) ? "s" : "");
3635 creature_ptr->old_spells = creature_ptr->new_spells;
3636 creature_ptr->redraw |= PR_STUDY;
3637 creature_ptr->window |= PW_OBJECT;
3642 * @brief プレイヤーの最大MPを計算する /
3643 * Calculate maximum mana. You do not need to know any spells.
3644 * Note that mana is lowered by heavy (or inappropriate) armor.
3647 * This function induces status messages.
3649 static void calc_mana(player_type *creature_ptr)
3651 if (!mp_ptr->spell_book) return;
3654 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3655 (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
3656 (creature_ptr->pclass == CLASS_BLUE_MAGE))
3658 levels = creature_ptr->lev;
3662 if (mp_ptr->spell_first > creature_ptr->lev)
3664 creature_ptr->msp = 0;
3665 creature_ptr->redraw |= (PR_MANA);
3669 levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
3673 if (creature_ptr->pclass == CLASS_SAMURAI)
3675 msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
3676 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
3680 msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
3682 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
3683 if (msp && (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)) msp += msp / 2;
3684 if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
3685 if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
3688 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
3690 BIT_FLAGS flgs[TR_FLAG_SIZE];
3691 creature_ptr->cumber_glove = FALSE;
3693 o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
3694 object_flags(o_ptr, flgs);
3696 !(have_flag(flgs, TR_FREE_ACT)) &&
3697 !(have_flag(flgs, TR_DEC_MANA)) &&
3698 !(have_flag(flgs, TR_EASY_SPELL)) &&
3699 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
3700 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
3702 creature_ptr->cumber_glove = TRUE;
3703 msp = (3 * msp) / 4;
3707 creature_ptr->cumber_armor = FALSE;
3710 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3711 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3712 cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
3713 cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
3714 cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
3715 cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
3716 cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
3718 switch (creature_ptr->pclass)
3721 case CLASS_HIGH_MAGE:
3722 case CLASS_BLUE_MAGE:
3724 case CLASS_FORCETRAINER:
3725 case CLASS_SORCERER:
3727 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3728 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3735 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
3736 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
3739 case CLASS_MINDCRAFTER:
3740 case CLASS_BEASTMASTER:
3741 case CLASS_MIRROR_MASTER:
3743 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
3744 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
3749 case CLASS_RED_MAGE:
3750 case CLASS_WARRIOR_MAGE:
3752 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
3753 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
3757 case CLASS_CHAOS_WARRIOR:
3759 if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
3760 if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
3769 int max_wgt = mp_ptr->spell_weight;
3770 if ((cur_wgt - max_wgt) > 0)
3772 creature_ptr->cumber_armor = TRUE;
3773 switch (creature_ptr->pclass)
3776 case CLASS_HIGH_MAGE:
3777 case CLASS_BLUE_MAGE:
3779 msp -= msp * (cur_wgt - max_wgt) / 600;
3783 case CLASS_MINDCRAFTER:
3784 case CLASS_BEASTMASTER:
3786 case CLASS_FORCETRAINER:
3788 case CLASS_MIRROR_MASTER:
3790 msp -= msp * (cur_wgt - max_wgt) / 800;
3793 case CLASS_SORCERER:
3795 msp -= msp * (cur_wgt - max_wgt) / 900;
3801 case CLASS_RED_MAGE:
3803 msp -= msp * (cur_wgt - max_wgt) / 1000;
3807 case CLASS_CHAOS_WARRIOR:
3808 case CLASS_WARRIOR_MAGE:
3810 msp -= msp * (cur_wgt - max_wgt) / 1200;
3815 creature_ptr->cumber_armor = FALSE;
3820 msp -= msp * (cur_wgt - max_wgt) / 800;
3826 if (msp < 0) msp = 0;
3828 if (creature_ptr->msp != msp)
3830 if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
3832 creature_ptr->csp = msp;
3833 creature_ptr->csp_frac = 0;
3837 if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
3839 msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
3842 creature_ptr->msp = msp;
3843 creature_ptr->redraw |= (PR_MANA);
3844 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
3847 if (current_world_ptr->character_xtra) return;
3849 if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
3851 if (creature_ptr->cumber_glove)
3852 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
3854 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
3856 creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
3859 if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor) return;
3861 if (creature_ptr->cumber_armor)
3862 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
3864 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
3866 creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
3871 * @brief 装備中の射撃武器の威力倍率を返す /
3872 * calcurate the fire rate of target object
3873 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
3874 * @return 射撃倍率の値(100で1.00倍)
3876 s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
3878 int extra_shots = 0;
3879 BIT_FLAGS flgs[TR_FLAG_SIZE];
3880 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
3883 q_ptr = &creature_ptr->inventory_list[i];
3884 if (!q_ptr->k_idx) continue;
3886 if (i == INVEN_BOW) continue;
3888 object_flags(q_ptr, flgs);
3889 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3892 object_flags(o_ptr, flgs);
3893 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3896 if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
3900 num += (extra_shots * 100);
3902 tval_type tval_ammo = bow_tval_ammo(o_ptr);
3903 if ((creature_ptr->pclass == CLASS_RANGER) &&
3904 (tval_ammo == TV_ARROW))
3906 num += (creature_ptr->lev * 4);
3909 if ((creature_ptr->pclass == CLASS_CAVALRY) &&
3910 (tval_ammo == TV_ARROW))
3912 num += (creature_ptr->lev * 3);
3915 if (creature_ptr->pclass == CLASS_ARCHER)
3917 if (tval_ammo == TV_ARROW)
3918 num += ((creature_ptr->lev * 5) + 50);
3919 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
3920 num += (creature_ptr->lev * 4);
3923 if (creature_ptr->pclass == CLASS_WARRIOR &&
3924 (tval_ammo <= TV_BOLT) &&
3925 (tval_ammo >= TV_SHOT))
3927 num += (creature_ptr->lev * 2);
3930 if ((creature_ptr->pclass == CLASS_ROGUE) &&
3931 (tval_ammo == TV_SHOT))
3933 num += (creature_ptr->lev * 4);
3941 * @brief プレイヤーの所持重量制限を計算する /
3942 * Computes current weight limit.
3945 WEIGHT weight_limit(player_type *creature_ptr)
3947 WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50;
3948 if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
3954 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
3955 * @param i 判定する手のID(右手:0 左手:1)
3956 * @return 持っているならばTRUE
3958 bool has_melee_weapon(player_type *creature_ptr, int i)
3960 return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
3965 * @brief プレイヤーの現在開いている手の状態を返す
3966 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
3967 * @return 開いている手のビットフラグ
3969 BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
3971 BIT_FLAGS16 status = EMPTY_HAND_NONE;
3972 if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
3973 if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
3975 if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
3977 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
3978 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
3986 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
3987 * @return ペナルティが適用されるならばTRUE。
3989 bool heavy_armor(player_type *creature_ptr)
3991 if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA))
3994 WEIGHT monk_arm_wgt = 0;
3995 if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
3996 if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
3997 monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
3998 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
3999 monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4000 monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4001 monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4003 return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
4008 * @brief update のフラグに応じた更新をまとめて行う / Handle "update"
4010 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
4012 void update_creature(player_type *creature_ptr)
4014 if (!creature_ptr->update) return;
4016 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4017 if (creature_ptr->update & (PU_AUTODESTROY))
4019 creature_ptr->update &= ~(PU_AUTODESTROY);
4020 autopick_delayed_alter(creature_ptr);
4023 if (creature_ptr->update & (PU_COMBINE))
4025 creature_ptr->update &= ~(PU_COMBINE);
4026 combine_pack(creature_ptr);
4029 if (creature_ptr->update & (PU_REORDER))
4031 creature_ptr->update &= ~(PU_REORDER);
4032 reorder_pack(creature_ptr);
4035 if (creature_ptr->update & (PU_BONUS))
4037 creature_ptr->update &= ~(PU_BONUS);
4038 calc_alignment(creature_ptr);
4039 calc_bonuses(creature_ptr);
4042 if (creature_ptr->update & (PU_TORCH))
4044 creature_ptr->update &= ~(PU_TORCH);
4045 calc_torch(creature_ptr);
4048 if (creature_ptr->update & (PU_HP))
4050 creature_ptr->update &= ~(PU_HP);
4051 calc_hitpoints(creature_ptr);
4054 if (creature_ptr->update & (PU_MANA))
4056 creature_ptr->update &= ~(PU_MANA);
4057 calc_mana(creature_ptr);
4060 if (creature_ptr->update & (PU_SPELLS))
4062 creature_ptr->update &= ~(PU_SPELLS);
4063 calc_spells(creature_ptr);
4066 if (!current_world_ptr->character_generated) return;
4067 if (current_world_ptr->character_icky) return;
4068 if (creature_ptr->update & (PU_UN_LITE))
4070 creature_ptr->update &= ~(PU_UN_LITE);
4071 forget_lite(floor_ptr);
4074 if (creature_ptr->update & (PU_UN_VIEW))
4076 creature_ptr->update &= ~(PU_UN_VIEW);
4077 forget_view(floor_ptr);
4080 if (creature_ptr->update & (PU_VIEW))
4082 creature_ptr->update &= ~(PU_VIEW);
4083 update_view(creature_ptr);
4086 if (creature_ptr->update & (PU_LITE))
4088 creature_ptr->update &= ~(PU_LITE);
4089 update_lite(creature_ptr);
4092 if (creature_ptr->update & (PU_FLOW))
4094 creature_ptr->update &= ~(PU_FLOW);
4095 update_flow(creature_ptr);
4098 if (creature_ptr->update & (PU_DISTANCE))
4100 creature_ptr->update &= ~(PU_DISTANCE);
4102 update_monsters(creature_ptr, TRUE);
4105 if (creature_ptr->update & (PU_MON_LITE))
4107 creature_ptr->update &= ~(PU_MON_LITE);
4108 update_mon_lite(creature_ptr);
4111 if (creature_ptr->update & (PU_DELAY_VIS))
4113 creature_ptr->update &= ~(PU_DELAY_VIS);
4114 delayed_visual_update(creature_ptr);
4117 if (creature_ptr->update & (PU_MONSTERS))
4119 creature_ptr->update &= ~(PU_MONSTERS);
4120 update_monsters(creature_ptr, FALSE);
4126 * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
4127 * @return 魔道書を一冊も持っていないならTRUEを返す
4129 bool player_has_no_spellbooks(player_type *creature_ptr)
4132 for (int i = 0; i < INVEN_PACK; i++)
4134 o_ptr = &creature_ptr->inventory_list[i];
4135 if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4138 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4139 for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
4141 o_ptr = &floor_ptr->o_list[i];
4142 if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
4149 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
4151 creature_ptr->energy_use = (ENERGY)need_cost;
4155 void free_turn(player_type *creature_ptr)
4157 creature_ptr->energy_use = 0;
4162 * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
4165 * @return 配置に成功したらTRUE
4167 bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
4169 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
4171 /* Save player location */
4172 creature_ptr->y = y;
4173 creature_ptr->x = x;
4179 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
4182 void wreck_the_pattern(player_type *creature_ptr)
4184 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4185 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
4186 if (pattern_type == PATTERN_TILE_WRECKED) return;
4188 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
4189 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
4191 if (!IS_INVULN(creature_ptr))
4192 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
4194 int to_ruin = randint1(45) + 35;
4198 scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
4200 if (pattern_tile(floor_ptr, r_y, r_x) &&
4201 (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
4203 cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
4207 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
4212 * @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
4213 * Advance experience levels and print experience
4216 void check_experience(player_type *creature_ptr)
4218 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
4219 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
4220 if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
4222 if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
4223 if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
4224 if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
4226 if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
4227 if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
4229 creature_ptr->redraw |= (PR_EXP);
4230 handle_stuff(creature_ptr);
4232 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4233 PLAYER_LEVEL old_lev = creature_ptr->lev;
4234 while ((creature_ptr->lev > 1) &&
4235 (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
4237 creature_ptr->lev--;
4238 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4239 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
4240 creature_ptr->window |= (PW_PLAYER);
4241 handle_stuff(creature_ptr);
4244 bool level_reward = FALSE;
4245 bool level_mutation = FALSE;
4246 bool level_inc_stat = FALSE;
4247 while ((creature_ptr->lev < PY_MAX_LEVEL) &&
4248 (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
4250 creature_ptr->lev++;
4251 if (creature_ptr->lev > creature_ptr->max_plv)
4253 creature_ptr->max_plv = creature_ptr->lev;
4255 if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
4256 (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
4258 level_reward = TRUE;
4260 if (creature_ptr->prace == RACE_BEASTMAN)
4262 if (one_in_(5)) level_mutation = TRUE;
4264 level_inc_stat = TRUE;
4266 exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
4270 msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
4271 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4272 creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
4273 creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
4274 creature_ptr->level_up_message = TRUE;
4275 handle_stuff(creature_ptr);
4277 creature_ptr->level_up_message = FALSE;
4280 if (!(creature_ptr->max_plv % 10))
4289 cnv_stat(creature_ptr->stat_max[0], tmp);
4290 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
4291 cnv_stat(creature_ptr->stat_max[1], tmp);
4292 prt(format(_(" b) 知能 (現在値 %s)", " b) Int (cur %s)"), tmp), 3, 14);
4293 cnv_stat(creature_ptr->stat_max[2], tmp);
4294 prt(format(_(" c) 賢さ (現在値 %s)", " c) Wis (cur %s)"), tmp), 4, 14);
4295 cnv_stat(creature_ptr->stat_max[3], tmp);
4296 prt(format(_(" d) 器用 (現在値 %s)", " d) Dex (cur %s)"), tmp), 5, 14);
4297 cnv_stat(creature_ptr->stat_max[4], tmp);
4298 prt(format(_(" e) 耐久 (現在値 %s)", " e) Con (cur %s)"), tmp), 6, 14);
4299 cnv_stat(creature_ptr->stat_max[5], tmp);
4300 prt(format(_(" f) 魅力 (現在値 %s)", " f) Chr (cur %s)"), tmp), 7, 14);
4303 prt(_(" どの能力値を上げますか?", " Which stat do you want to raise?"), 1, 14);
4308 if ((choice >= 'a') && (choice <= 'f')) break;
4310 for (n = 0; n < A_MAX; n++)
4311 if (n != choice - 'a')
4313 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
4315 do_inc_stat(creature_ptr, choice - 'a');
4318 else if (!(creature_ptr->max_plv % 2))
4319 do_inc_stat(creature_ptr, randint0(6));
4324 msg_print(_("あなたは変わった気がする...", "You feel different..."));
4325 (void)gain_mutation(creature_ptr, 0);
4326 level_mutation = FALSE;
4330 * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
4335 gain_level_reward(creature_ptr, 0);
4336 level_reward = FALSE;
4339 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4340 creature_ptr->redraw |= (PR_LEV | PR_TITLE);
4341 creature_ptr->window |= (PW_PLAYER | PW_SPELL);
4342 handle_stuff(creature_ptr);
4345 if (old_lev != creature_ptr->lev)
4346 autopick_load_pref(creature_ptr, FALSE);
4351 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
4353 * @param out_val 出力先文字列ポインタ
4356 void cnv_stat(int val, char *out_val)
4360 sprintf(out_val, " %2d", val);
4364 int bonus = (val - 18);
4367 sprintf(out_val, "18/%3s", "***");
4369 else if (bonus >= 100)
4371 sprintf(out_val, "18/%03d", bonus);
4375 sprintf(out_val, " 18/%02d", bonus);
4381 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
4382 * Modify a stat value by a "modifier", return new value
4384 * @param amount 加減算値
4388 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
4389 * Or even: 18/13, 18/23, 18/33, ..., 18/220
4390 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
4391 * Or even: 18/13, 18/03, 18, 17, ..., 3
4394 s16b modify_stat_value(int value, int amount)
4398 for (int i = 0; i < amount; i++)
4400 if (value < 18) value++;
4404 else if (amount < 0)
4406 for (int i = 0; i < (0 - amount); i++)
4408 if (value >= 18 + 10) value -= 10;
4409 else if (value > 18) value = 18;
4410 else if (value > 3) value--;
4420 * Hack -- Calculates the total number of points earned -JWT-
4424 long calc_score(player_type *creature_ptr)
4426 int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
4429 if (!preserve_mode) mult += 10;
4430 if (!autoroller) mult += 10;
4431 if (!smart_learn) mult -= 20;
4432 if (smart_cheat) mult += 30;
4433 if (ironman_shops) mult += 50;
4434 if (ironman_small_levels) mult += 10;
4435 if (ironman_empty_levels) mult += 20;
4436 if (!powerup_home) mult += 50;
4437 if (ironman_rooms) mult += 100;
4438 if (ironman_nightmare) mult += 100;
4440 if (mult < 5) mult = 5;
4443 for (int i = 0; i < current_world_ptr->max_d_idx; i++)
4444 if (max_dlv[i] > max_dl)
4445 max_dl = max_dlv[i];
4447 u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
4448 u32b point_h = point_l / 0x10000L;
4449 point_l = point_l % 0x10000L;
4452 point_h += point_l / 0x10000L;
4453 point_l %= 0x10000L;
4455 point_l += ((point_h % 100) << 16);
4459 u32b point = (point_h << 16) + (point_l);
4460 if (creature_ptr->arena_number >= 0)
4461 point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
4463 if (ironman_downward) point *= 2;
4464 if (creature_ptr->pclass == CLASS_BERSERKER)
4466 if (creature_ptr->prace == RACE_SPECTRE)
4470 if ((creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) && point)
4473 if (current_world_ptr->total_winner) point = 2;
4476 if (easy_band) point = (0 - point);
4482 void cheat_death(player_type *creature_ptr)
4484 if (creature_ptr->sc)
4485 creature_ptr->sc = creature_ptr->age = 0;
4486 creature_ptr->age++;
4488 current_world_ptr->noscore |= 0x0001;
4489 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
4492 (void)life_stream(creature_ptr, FALSE, FALSE);
4493 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
4496 for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
4498 creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
4500 for (; magic_idx < EATER_EXT * 3; magic_idx++)
4502 creature_ptr->magic_num1[magic_idx] = 0;
4506 creature_ptr->csp = creature_ptr->msp;
4507 creature_ptr->csp_frac = 0;
4508 if (creature_ptr->word_recall)
4510 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
4512 creature_ptr->word_recall = 0;
4513 creature_ptr->redraw |= (PR_STATUS);
4516 if (creature_ptr->alter_reality)
4518 creature_ptr->alter_reality = 0;
4519 creature_ptr->redraw |= (PR_STATUS);
4522 (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
4523 creature_ptr->is_dead = FALSE;
4524 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
4526 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
4527 floor_ptr->dun_level = 0;
4528 floor_ptr->inside_arena = FALSE;
4529 creature_ptr->phase_out = FALSE;
4531 floor_ptr->inside_quest = 0;
4532 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
4533 creature_ptr->dungeon_idx = 0;
4534 if (lite_town || vanilla_town)
4536 creature_ptr->wilderness_y = 1;
4537 creature_ptr->wilderness_x = 1;
4540 creature_ptr->oldpy = 10;
4541 creature_ptr->oldpx = 34;
4545 creature_ptr->oldpy = 33;
4546 creature_ptr->oldpx = 131;
4551 creature_ptr->wilderness_y = 48;
4552 creature_ptr->wilderness_x = 5;
4553 creature_ptr->oldpy = 33;
4554 creature_ptr->oldpx = 131;
4557 creature_ptr->wild_mode = FALSE;
4558 creature_ptr->leaving = TRUE;
4560 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
4564 leave_floor(creature_ptr);
4565 wipe_monsters_list(creature_ptr);
4570 * @param creature_ptr プレーヤーへの参照ポインタ
4571 * @return 祝福状態ならばTRUE
4573 bool is_blessed(player_type *creature_ptr)
4575 return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
4579 bool is_oppose_acid(player_type *creature_ptr)
4581 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4585 bool is_oppose_elec(player_type *creature_ptr)
4587 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4591 bool is_oppose_fire(player_type *creature_ptr)
4593 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4597 bool is_oppose_cold(player_type *creature_ptr)
4599 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4603 bool is_oppose_pois(player_type *creature_ptr)
4605 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
4609 bool is_tim_esp(player_type *creature_ptr)
4611 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
4615 bool is_tim_stealth(player_type *creature_ptr)
4617 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
4621 bool is_time_limit_esp(player_type *creature_ptr)
4623 return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
4627 bool is_time_limit_stealth(player_type *creature_ptr)
4629 return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
4633 bool can_two_hands_wielding(player_type *creature_ptr)
4635 return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);
4641 * @brief 歌の停止を処理する / Stop singing if the player is a Bard
4644 void stop_singing(player_type *creature_ptr)
4646 if (creature_ptr->pclass != CLASS_BARD) return;
4648 /* Are there interupted song? */
4649 if (INTERUPTING_SONG_EFFECT(creature_ptr))
4651 /* Forget interupted song */
4652 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4656 /* The player is singing? */
4657 if (!SINGING_SONG_EFFECT(creature_ptr)) return;
4659 /* Hack -- if called from set_action(), avoid recursive loop */
4660 if (creature_ptr->action == ACTION_SING) set_action(creature_ptr, ACTION_NONE);
4662 /* Message text of each song or etc. */
4663 exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
4665 SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
4666 SINGING_SONG_ID(creature_ptr) = 0;
4667 creature_ptr->update |= (PU_BONUS);
4668 creature_ptr->redraw |= (PR_STATUS);
4672 * @brief 口を使う継続的な処理を中断する
4673 * @param caster_ptr プレーヤーへの参照ポインタ
4676 void stop_mouth(player_type *caster_ptr)
4678 if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
4679 if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
4684 * @brief ペットの維持コスト計算
4687 PERCENTAGE calculate_upkeep(player_type *creature_ptr)
4690 bool have_a_unique = FALSE;
4691 DEPTH total_friend_levels = 0;
4695 for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
4697 monster_type *m_ptr;
4698 monster_race *r_ptr;
4700 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4701 if (!monster_is_valid(m_ptr)) continue;
4702 r_ptr = &r_info[m_ptr->r_idx];
4707 if (r_ptr->flags1 & RF1_UNIQUE)
4709 if (creature_ptr->pclass == CLASS_CAVALRY)
4711 if (creature_ptr->riding == m_idx)
4712 total_friend_levels += (r_ptr->level + 5) * 2;
4713 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
4714 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
4716 total_friend_levels += (r_ptr->level + 5) * 10;
4717 have_a_unique = TRUE;
4720 total_friend_levels += (r_ptr->level + 5) * 10;
4723 total_friend_levels += r_ptr->level;
4731 upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
4732 if (upkeep_factor < 0) upkeep_factor = 0;
4733 if (upkeep_factor > 1000) upkeep_factor = 1000;
4734 return upkeep_factor;
4740 bool music_singing(player_type *caster_ptr, int music_songs)
4742 return (caster_ptr->pclass == CLASS_BARD) && (caster_ptr->magic_num1[0] == music_songs);