OSDN Git Service

[Refactor] #40535 Separated open-close-execution.c/h and cmd-open-close.c/h from...
[hengband/hengband.git] / src / action / action-limited.c
1 #include "action/action-limited.h"
2 #include "dungeon/dungeon.h"
3 #include "floor/floor.h"
4 #include "game-option/disturbance-options.h"
5 #include "grid/grid.h"
6 #include "main/sound-definitions-table.h"
7 #include "main/sound-of-music.h"
8 #include "term/screen-processor.h"
9 #include "view/display-messages.h"
10
11 /*!
12  * @brief 魔法系コマンドが制限されているかを返す。
13  * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
14  */
15 bool cmd_limit_cast(player_type *creature_ptr)
16 {
17     if (creature_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) {
18         msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
19         msg_print(NULL);
20         return TRUE;
21     }
22
23     if (creature_ptr->anti_magic) {
24         msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
25         return TRUE;
26     }
27
28     if (creature_ptr->shero) {
29         msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
30         return TRUE;
31     }
32
33     return FALSE;
34 }
35
36 bool cmd_limit_confused(player_type *creature_ptr)
37 {
38     if (creature_ptr->confused) {
39         msg_print(_("混乱していてできない!", "You are too confused!"));
40         return TRUE;
41     }
42
43     return FALSE;
44 }
45
46 bool cmd_limit_image(player_type *creature_ptr)
47 {
48     if (creature_ptr->image) {
49         msg_print(_("幻覚が見えて集中できない!", "Your hallucinations prevent you from concentrating!"));
50         return TRUE;
51     }
52
53     return FALSE;
54 }
55
56 bool cmd_limit_stun(player_type *creature_ptr)
57 {
58     if (creature_ptr->stun) {
59         msg_print(_("頭が朦朧としていて集中できない!", "You are too stunned!"));
60         return TRUE;
61     }
62
63     return FALSE;
64 }
65
66 bool cmd_limit_arena(player_type *creature_ptr)
67 {
68     if (creature_ptr->current_floor_ptr->inside_arena) {
69         msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
70         msg_print(NULL);
71         return TRUE;
72     }
73
74     return FALSE;
75 }
76
77 bool cmd_limit_blind(player_type *creature_ptr)
78 {
79     if (creature_ptr->blind) {
80         msg_print(_("目が見えない。", "You can't see anything."));
81         return TRUE;
82     }
83
84     if (no_lite(creature_ptr)) {
85         msg_print(_("明かりがないので見えない。", "You have no light."));
86         return TRUE;
87     }
88
89     return FALSE;
90 }
91
92 bool cmd_limit_time_walk(player_type *creature_ptr)
93 {
94     if (creature_ptr->timewalk) {
95         if (flush_failure)
96             flush();
97
98         msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
99         sound(SOUND_FAIL);
100         return TRUE;
101     }
102
103     return FALSE;
104 }