OSDN Git Service

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