1 #include "system/angband.h"
2 #include "birth/birth-select-realm.h"
3 #include "term/gameterm.h"
4 #include "birth/birth-explanations-table.h"
5 #include "birth/birth-util.h"
7 static byte count_realm_selection(s32b choices, int* count)
9 byte auto_select = REALM_NONE;
10 if (choices & CH_LIFE) {
12 auto_select = REALM_LIFE;
15 if (choices & CH_SORCERY) {
17 auto_select = REALM_SORCERY;
20 if (choices & CH_NATURE) {
22 auto_select = REALM_NATURE;
25 if (choices & CH_CHAOS) {
27 auto_select = REALM_CHAOS;
30 if (choices & CH_DEATH) {
32 auto_select = REALM_DEATH;
35 if (choices & CH_TRUMP) {
37 auto_select = REALM_TRUMP;
40 if (choices & CH_ARCANE) {
42 auto_select = REALM_ARCANE;
45 if (choices & CH_ENCHANT) {
47 auto_select = REALM_CRAFT;
50 if (choices & CH_DAEMON) {
52 auto_select = REALM_DAEMON;
55 if (choices & CH_CRUSADE) {
57 auto_select = REALM_CRUSADE;
60 if (choices & CH_MUSIC) {
62 auto_select = REALM_MUSIC;
65 if (choices & CH_HISSATSU) {
67 auto_select = REALM_HISSATSU;
70 if (choices & CH_HEX) {
72 auto_select = REALM_HEX;
79 * @brief プレイヤーの魔法領域を選択する / Choose from one of the available magical realms
80 * @param choices 選択可能な魔法領域のビット配列
81 * @param count 選択可能な魔法領域を返すポインタ群。
84 static byte select_realm(player_type* creature_ptr, s32b choices, int* count)
86 byte auto_select = count_realm_selection(choices, count);
89 /* Auto-select the realm */
93 /* Constraint to the 1st realm */
94 if (creature_ptr->realm2 != 255) {
95 if (creature_ptr->pclass == CLASS_PRIEST) {
96 if (is_good_realm(creature_ptr->realm1)) {
97 choices &= ~(CH_DEATH | CH_DAEMON);
99 choices &= ~(CH_LIFE | CH_CRUSADE);
105 put_str(_("注意:魔法の領域の選択によりあなたが習得する呪文のタイプが決まります。",
106 "Note: The realm of magic will determine which spells you can learn."),
112 char sym[VALID_REALM];
114 int picks[VALID_REALM] = { 0 };
115 for (int i = 0; i < 32; i++) {
117 if (choices & (1L << i)) {
118 if (creature_ptr->realm1 == i + 1) {
119 if (creature_ptr->realm2 == 255)
124 if (creature_ptr->realm2 == i + 1)
129 sprintf(buf, "%c%c %s", sym[n], p2, realm_names[i + 1]);
130 put_str(buf, 12 + (n / 5), 2 + 15 * (n % 5));
136 sprintf(cur, "%c%c %s", '*', p2, _("ランダム", "Random"));
144 c_put_str(TERM_WHITE, cur, 12 + (os / 5), 2 + 15 * (os % 5));
147 sprintf(cur, "%c%c %s", '*', p2, _("ランダム", "Random"));
149 sprintf(cur, "%c%c %s", sym[cs], p2, realm_names[picks[cs]]);
150 sprintf(buf, "%s", realm_names[picks[cs]]);
151 c_put_str(TERM_L_BLUE, buf, 3, 40);
152 prt(_("の特徴", ": Characteristic"), 3, 40 + strlen(buf));
153 prt(realm_subinfo[technic2magic(picks[cs]) - 1], 4, 40);
155 c_put_str(TERM_YELLOW, cur, 12 + (cs / 5), 2 + 15 * (cs % 5));
162 sprintf(buf, _("領域を選んで下さい(%c-%c) ('='初期オプション設定): ", "Choose a realm (%c-%c) ('=' for options): "), sym[0], sym[n - 1]);
164 put_str(buf, 10, 10);
172 if (c == ' ' || c == '\r' || c == '\n') {
207 k = (islower(c) ? A2I(c) : -1);
208 if ((k >= 0) && (k < n)) {
213 k = (isupper(c) ? (26 + c - 'A') : -1);
214 if ((k >= 26) && (k < n)) {
221 show_help(creature_ptr, _("jmagic.txt#MagicRealms", "magic.txt#MagicRealms"));
222 } else if (c == '=') {
224 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth option((*)s effect score)"));
227 } else if (c != '2' && c != '4' && c != '6' && c != '8')
232 return (byte)(picks[k]);
236 * @brief 選択した魔法領域の解説を表示する / Choose the magical realms
237 * @return ユーザが魔法領域の確定を選んだらTRUEを返す。
239 bool get_player_realms(player_type* creature_ptr)
241 /* Clean up infomation of modifications */
246 /* Select the first realm */
247 creature_ptr->realm1 = REALM_NONE;
248 creature_ptr->realm2 = 255;
253 creature_ptr->realm1 = select_realm(creature_ptr, realm_choices1[creature_ptr->pclass], &count);
255 if (255 == creature_ptr->realm1)
257 if (!creature_ptr->realm1)
266 roff_to_buf(realm_explanations[technic2magic(creature_ptr->realm1) - 1], 74, temp, sizeof(temp));
268 for (int i = 0; i < 10; i++) {
278 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
282 } else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
286 /* Select the second realm */
287 creature_ptr->realm2 = REALM_NONE;
288 if (creature_ptr->realm1) {
289 /* Print the realm */
290 put_str(_("魔法 :", "Magic :"), 6, 1);
291 c_put_str(TERM_L_BLUE, realm_names[creature_ptr->realm1], 6, 15);
293 /* Select the second realm */
299 creature_ptr->realm2 = select_realm(creature_ptr, realm_choices2[creature_ptr->pclass], &count);
301 if (255 == creature_ptr->realm2)
303 if (!creature_ptr->realm2)
312 roff_to_buf(realm_explanations[technic2magic(creature_ptr->realm2) - 1], 74, temp, sizeof(temp));
314 for (int i = 0; i < A_MAX; i++) {
324 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
328 } else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
332 if (creature_ptr->realm2) {
333 /* Print the realm */
334 c_put_str(TERM_L_BLUE, format("%s, %s", realm_names[creature_ptr->realm1], realm_names[creature_ptr->realm2]), 6, 15);