1 #include "birth/auto-roller.h"
2 #include "birth/birth-stat.h"
3 #include "birth/birth-util.h"
4 #include "cmd-io/cmd-gameoption.h"
5 #include "main/sound-of-music.h"
6 #include "player/player-personality.h"
7 #include "system/game-option-types.h"
8 #include "term/term-color-types.h"
11 * ランダムクエストのモンスターを確定するために試行する回数 / Maximum number of tries for selection of a proper quest monster
15 /*! オートローラの能力値的要求水準 / Autoroll limit */
18 /*! オートローラ中、各能力値が水準を超えた回数 / Autoroll matches */
21 /*! オートローラの試行回数 / Autoroll round */
25 * @brief オートローラで得たい能力値の基準を決める。
26 * @param creature_ptr プレーヤーへの参照ポインタ
29 bool get_stat_limits(player_type *creature_ptr)
32 put_str(_("最低限得たい能力値を設定して下さい。", "Set minimum stats."), 10, 10);
33 put_str(_("2/8で項目選択、4/6で値の増減、Enterで次へ", "2/8 for Select, 4/6 for Change value, Enter for Goto next"), 11, 10);
34 put_str(_(" 基本値 種族 職業 性格 合計値 最大値", " Base Rac Cla Per Total Maximum"), 13, 10);
40 for (int i = 0; i < A_MAX; i++) {
43 int j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
44 int m = adjust_stat(17, j);
46 sprintf(cur, "18/%02d", (m - 18));
48 sprintf(cur, "%2d", m);
50 m = adjust_stat(cval[i], j);
52 sprintf(inp, "18/%02d", (m - 18));
54 sprintf(inp, "%2d", m);
56 sprintf(buf, "%6s %2d %+3d %+3d %+3d = %6s %6s", stat_names[i], cval[i], rp_ptr->r_adj[i], cp_ptr->c_adj[i], ap_ptr->a_adj[i], inp, cur);
57 put_str(buf, 14 + i, 10);
65 c_put_str(TERM_WHITE, _("決定する", "Accept"), 21, 35);
66 } else if (os < A_MAX) {
67 c_put_str(TERM_WHITE, cur, 14 + os, 10);
70 c_put_str(TERM_YELLOW, _("決定する", "Accept"), 21, 35);
72 int j = rp_ptr->r_adj[cs] + cp_ptr->c_adj[cs] + ap_ptr->a_adj[cs];
73 int m = adjust_stat(cval[cs], j);
75 sprintf(inp, "18/%02d", (m - 18));
77 sprintf(inp, "%2d", m);
80 cur, "%6s %2d %+3d %+3d %+3d = %6s", stat_names[cs], cval[cs], rp_ptr->r_adj[cs], cp_ptr->c_adj[cs], ap_ptr->a_adj[cs], inp);
81 c_put_str(TERM_YELLOW, cur, 14 + cs, 10);
120 } else if (cval[cs] > 3) {
131 if (cval[cs] == 17) {
134 } else if (cval[cs] < 17) {
158 show_help(creature_ptr, "jbirth.txt#AutoRoller");
160 show_help(creature_ptr, "birth.txt#AutoRoller");
166 do_cmd_options_aux(creature_ptr, OPT_PAGE_BIRTH, "初期オプション((*)はスコアに影響)");
168 do_cmd_options_aux(creature_ptr, OPT_PAGE_BIRTH, "Birth Option((*)s effect score)");
178 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == 6))
182 for (int i = 0; i < A_MAX; i++)
183 stat_limit[i] = (s16b)cval[i];
188 void initialize_chara_limit(chara_limit_type *chara_limit_ptr)
190 chara_limit_ptr->agemin = 0;
191 chara_limit_ptr->agemax = 0;
192 chara_limit_ptr->htmin = 0;
193 chara_limit_ptr->htmax = 0;
194 chara_limit_ptr->wtmin = 0;
195 chara_limit_ptr->wtmax = 0;
196 chara_limit_ptr->scmin = 0;
197 chara_limit_ptr->scmax = 0;
201 * @brief オートローラで得たい年齢、身長、体重、社会的地位の基準を決める。
204 bool get_chara_limits(player_type *creature_ptr, chara_limit_type *chara_limit_ptr)
208 char buf[80], cur[80];
209 concptr itemname[] = { _("年齢", "age"), _("身長(インチ)", "height"), _("体重(ポンド)", "weight"), _("社会的地位", "social class") };
212 put_str(_("2/4/6/8で項目選択、+/-で値の増減、Enterで次へ", "2/4/6/8 for Select, +/- for Change value, Enter for Goto next"), 11, 10);
214 _("注意:身長と体重の最大値/最小値ぎりぎりの値は非常に出現確率が低くなります。", "Caution: Values near minimum or maximum are extremely rare."), 23, 2);
216 int max_percent, min_percent;
217 if (creature_ptr->psex == SEX_MALE) {
218 max_percent = (int)(rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1) * 100 / (int)(rp_ptr->m_b_ht);
219 min_percent = (int)(rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1) * 100 / (int)(rp_ptr->m_b_ht);
221 max_percent = (int)(rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1) * 100 / (int)(rp_ptr->f_b_ht);
222 min_percent = (int)(rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1) * 100 / (int)(rp_ptr->f_b_ht);
225 put_str(_("体格/地位の最小値/最大値を設定して下さい。", "Set minimum/maximum attribute."), 10, 10);
226 put_str(_(" 項 目 最小値 最大値", " Parameter Min Max"), 13, 20);
229 for (int i = 0; i < MAXITEMS; i++) {
232 case 0: /* Minimum age */
233 m = rp_ptr->b_age + 1;
235 case 1: /* Maximum age */
236 m = rp_ptr->b_age + rp_ptr->m_age;
239 case 2: /* Minimum height */
240 if (creature_ptr->psex == SEX_MALE)
241 m = rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1;
243 m = rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1;
245 case 3: /* Maximum height */
246 if (creature_ptr->psex == SEX_MALE)
247 m = rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1;
249 m = rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1;
251 case 4: /* Minimum weight */
252 if (creature_ptr->psex == SEX_MALE)
253 m = (rp_ptr->m_b_wt * min_percent / 100) - (rp_ptr->m_m_wt * min_percent / 75) + 1;
255 m = (rp_ptr->f_b_wt * min_percent / 100) - (rp_ptr->f_m_wt * min_percent / 75) + 1;
257 case 5: /* Maximum weight */
258 if (creature_ptr->psex == SEX_MALE)
259 m = (rp_ptr->m_b_wt * max_percent / 100) + (rp_ptr->m_m_wt * max_percent / 75) - 1;
261 m = (rp_ptr->f_b_wt * max_percent / 100) + (rp_ptr->f_m_wt * max_percent / 75) - 1;
263 case 6: /* Minimum social class */
266 case 7: /* Maximum social class */
278 for (int i = 0; i < 4; i++) {
279 sprintf(buf, "%-12s (%3d - %3d)", itemname[i], mval[i * 2], mval[i * 2 + 1]);
280 put_str(buf, 14 + i, 20);
281 for (int j = 0; j < 2; j++) {
282 sprintf(buf, " %3d", cval[i * 2 + j]);
283 put_str(buf, 14 + i, 45 + 8 * j);
291 const char accept[] = _("決定する", "Accept");
293 c_put_str(TERM_WHITE, accept, 19, 35);
295 c_put_str(TERM_WHITE, cur, 14 + os / 2, 45 + 8 * (os % 2));
297 if (cs == MAXITEMS) {
298 c_put_str(TERM_YELLOW, accept, 19, 35);
300 sprintf(cur, " %3d", cval[cs]);
301 c_put_str(TERM_YELLOW, cur, 14 + cs / 2, 45 + 8 * (cs % 2));
315 break; /*後でもう一回breakせんと*/
348 if (cs != MAXITEMS) {
350 if (cval[cs] > cval[cs - 1]) {
355 if (cval[cs] > mval[cs]) {
365 if (cs != MAXITEMS) {
367 if (cval[cs] < mval[cs]) {
372 if (cval[cs] < cval[cs + 1]) {
381 if (cs != MAXITEMS) {
383 if (cval[cs] < mval[cs]) {
388 if (cval[cs] < cval[cs + 1]) {
389 cval[cs] = cval[cs + 1];
397 if (cs != MAXITEMS) {
399 if (cval[cs] > cval[cs - 1]) {
400 cval[cs] = cval[cs - 1];
404 if (cval[cs] > mval[cs]) {
414 show_help(creature_ptr, "jbirth.txt#AutoRoller");
416 show_help(creature_ptr, "birth.txt#AutoRoller");
421 do_cmd_options_aux(creature_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
429 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == MAXITEMS))
433 chara_limit_ptr->agemin = (s16b)cval[0];
434 chara_limit_ptr->agemax = (s16b)cval[1];
435 chara_limit_ptr->htmin = (s16b)cval[2];
436 chara_limit_ptr->htmax = (s16b)cval[3];
437 chara_limit_ptr->wtmin = (s16b)cval[4];
438 chara_limit_ptr->wtmax = (s16b)cval[5];
439 chara_limit_ptr->scmin = (s16b)cval[6];
440 chara_limit_ptr->scmax = (s16b)cval[7];