1 #include "birth/birth-select-class.h"
2 #include "birth/birth-util.h"
3 #include "io/input-key-acceptor.h"
4 #include "player-info/race-info.h"
5 #include "player/player-class.h"
6 #include "system/player-type-definition.h"
7 #include "term/screen-processor.h"
8 #include "term/term-color-types.h"
9 #include "util/int-char-converter.h"
10 #include "world/world.h"
12 static const char p2 = ')';
14 static TERM_COLOR birth_class_color(int cs)
17 if (is_retired_class(static_cast<player_class_type>(cs)))
19 if (is_winner_class(static_cast<player_class_type>(cs)))
25 static void enumerate_class_list(char *sym)
27 for (int n = 0; n < MAX_CLASS; n++) {
28 cp_ptr = &class_info[n];
30 concptr str = cp_ptr->title;
34 sym[n] = ('A' + n - 26);
37 if (!(rp_ptr->choice & (1UL << n)))
38 sprintf(buf, "%c%c(%s)", sym[n], p2, str);
40 sprintf(buf, "%c%c%s", sym[n], p2, str);
42 c_put_str(birth_class_color(n), buf, 13 + (n / 4), 2 + 19 * (n % 4));
46 static void display_class_stat(int cs, int *os, char *cur, char *sym)
51 c_put_str(birth_class_color(*os), cur, 13 + (*os / 4), 2 + 19 * (*os % 4));
53 if (cs == MAX_CLASS) {
54 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
59 cp_ptr = &class_info[cs];
61 concptr str = cp_ptr->title;
62 if (!(rp_ptr->choice & (1UL << cs)))
63 sprintf(cur, "%c%c(%s)", sym[cs], p2, str);
65 sprintf(cur, "%c%c%s", sym[cs], p2, str);
67 c_put_str(TERM_L_BLUE, cp_ptr->title, 3, 40);
68 put_str(_("の職業修正", ": Class modification"), 3, 40 + strlen(cp_ptr->title));
69 put_str(_("腕力 知能 賢さ 器用 耐久 魅力 経験 ", "Str Int Wis Dex Con Chr EXP "), 4, 40);
71 sprintf(buf, "%+3d %+3d %+3d %+3d %+3d %+3d %+4d%% ", cp_ptr->c_adj[0], cp_ptr->c_adj[1], cp_ptr->c_adj[2], cp_ptr->c_adj[3], cp_ptr->c_adj[4],
72 cp_ptr->c_adj[5], cp_ptr->c_exp);
73 c_put_str(TERM_L_BLUE, buf, 5, 40);
76 sprintf(buf, "%+3d", cp_ptr->c_mhp);
77 c_put_str(TERM_L_BLUE, buf, 6, 42);
79 put_str(_("隠密", "Stealth"), 6, 47);
80 if (cs == CLASS_BERSERKER)
83 sprintf(buf, " %+2d", cp_ptr->c_stl);
84 c_put_str(TERM_L_BLUE, buf, 6, _(51, 54));
87 c_put_str(TERM_YELLOW, cur, 13 + (cs / 4), 2 + 19 * (cs % 4));
91 static void interpret_class_select_key_move(char c, int *cs)
109 if ((*cs + 4) <= MAX_CLASS)
114 static bool select_class(player_type *creature_ptr, char *cur, char *sym, int *k)
116 int cs = creature_ptr->pclass;
119 display_class_stat(cs, &os, cur, sym);
124 sprintf(buf, _("職業を選んで下さい (%c-%c) ('='初期オプション設定, 灰色:勝利済): ", "Choose a class (%c-%c) ('=' for options, Gray is winner): "),
125 sym[0], sym[MAX_CLASS - 1]);
135 if (c == ' ' || c == '\r' || c == '\n') {
136 if (cs == MAX_CLASS) {
137 *k = randint0(MAX_CLASS);
146 interpret_class_select_key_move(c, &cs);
148 *k = randint0(MAX_CLASS);
153 *k = (islower(c) ? A2I(c) : -1);
154 if ((*k >= 0) && (*k < MAX_CLASS)) {
159 *k = (isupper(c) ? (26 + c - 'A') : -1);
160 if ((*k >= 26) && (*k < MAX_CLASS)) {
166 birth_help_option(creature_ptr, c, BK_CLASS);
173 * @brief プレイヤーの職業選択を行う / Player class
175 bool get_player_class(player_type *creature_ptr)
179 _("注意:《職業》によってキャラクターの先天的な能力やボーナスが変化します。", "Note: Your 'class' determines various intrinsic abilities and bonuses."),
181 put_str(_("()で囲まれた選択肢はこの種族には似合わない職業です。", "Any entries in parentheses should only be used by advanced players."), 11, 5);
185 enumerate_class_list(sym);
188 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
190 if (!select_class(creature_ptr, cur, sym, &k))
193 creature_ptr->pclass = static_cast<player_class_type>(k);
194 cp_ptr = &class_info[creature_ptr->pclass];
195 mp_ptr = &m_info[creature_ptr->pclass];
196 c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15);