OSDN Git Service

To be more idiomatic, add "at" after "glare" in an English message.
[hengband/hengband.git] / src / mind / mind-monk.c
1 #include "mind/mind-monk.h"
2 #include "action/action-limited.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "io/input-key-acceptor.h"
6 #include "mind/stances-table.h"
7 #include "player/attack-defense-types.h"
8 #include "player/special-defense-types.h"
9 #include "status/action-setter.h"
10 #include "term/screen-processor.h"
11 #include "util/int-char-converter.h"
12 #include "view/display-messages.h"
13
14 static void set_stance(player_type *creature_ptr, const int new_stance)
15 {
16     set_action(creature_ptr, ACTION_KAMAE);
17     if (creature_ptr->special_defense & (KAMAE_GENBU << new_stance)) {
18         msg_print(_("構え直した。", "You reassume a stance."));
19         return;
20     }
21
22     creature_ptr->special_defense &= ~(KAMAE_MASK);
23     creature_ptr->update |= PU_BONUS;
24     creature_ptr->redraw |= PR_STATE;
25     msg_format(_("%sの構えをとった。", "You assume the %s stance."), monk_stances[new_stance].desc);
26     creature_ptr->special_defense |= (KAMAE_GENBU << new_stance);
27 }
28
29 /*!
30  * @brief 修行僧の構え設定処理
31  * @return 構えを変化させたらTRUE、構え不能かキャンセルしたらFALSEを返す。
32  */
33 bool choose_monk_stance(player_type *creature_ptr)
34 {
35     if (cmd_limit_confused(creature_ptr))
36         return FALSE;
37
38     screen_save();
39     prt(_(" a) 構えをとく", " a) No form"), 2, 20);
40     for (int i = 0; i < MAX_KAMAE; i++) {
41         if (creature_ptr->lev >= monk_stances[i].min_level) {
42             char buf[80];
43             sprintf(buf, " %c) %-12s  %s", I2A(i + 1), monk_stances[i].desc, monk_stances[i].info);
44             prt(buf, 3 + i, 20);
45         }
46     }
47
48     prt("", 1, 0);
49     prt(_("        どの構えをとりますか?", "        Choose Stance: "), 1, 14);
50
51     int new_stance = 0;
52     while (TRUE) {
53         char choice = inkey();
54         if (choice == ESCAPE) {
55             screen_load();
56             return FALSE;
57         }
58         
59         if ((choice == 'a') || (choice == 'A')) {
60             if (creature_ptr->action == ACTION_KAMAE) {
61                 set_action(creature_ptr, ACTION_NONE);
62             } else
63                 msg_print(_("もともと構えていない。", "You are not in a special stance."));
64             screen_load();
65             return TRUE;
66         }
67         
68         if ((choice == 'b') || (choice == 'B')) {
69             new_stance = 0;
70             break;
71         } else if (((choice == 'c') || (choice == 'C')) && (creature_ptr->lev > 29)) {
72             new_stance = 1;
73             break;
74         } else if (((choice == 'd') || (choice == 'D')) && (creature_ptr->lev > 34)) {
75             new_stance = 2;
76             break;
77         } else if (((choice == 'e') || (choice == 'E')) && (creature_ptr->lev > 39)) {
78             new_stance = 3;
79             break;
80         }
81     }
82
83     set_stance(creature_ptr, new_stance);
84     creature_ptr->redraw |= PR_STATE;
85     screen_load();
86     return TRUE;
87 }