1 #include "birth/auto-roller.h"
2 #include "birth/birth-stat.h"
3 #include "birth/birth-util.h"
4 #include "player/player-personality.h"
5 #include "system/game-option-types.h"
6 #include "term/term-color-types.h"
9 * ランダムクエストのモンスターを確定するために試行する回数 / Maximum number of tries for selection of a proper quest monster
13 /*! オートローラの能力値的要求水準 / Autoroll limit */
16 /*! オートローラ中、各能力値が水準を超えた回数 / Autoroll matches */
19 /*! オートローラの試行回数 / Autoroll round */
23 * @brief オートローラで得たい能力値の基準を決める。
24 * @param creature_ptr プレーヤーへの参照ポインタ
27 bool get_stat_limits(player_type *creature_ptr)
30 put_str(_("最低限得たい能力値を設定して下さい。", "Set minimum stats."), 10, 10);
31 put_str(_("2/8で項目選択、4/6で値の増減、Enterで次へ", "2/8 for Select, 4/6 for Change value, Enter for Goto next"), 11, 10);
32 put_str(_(" 基本値 種族 職業 性格 合計値 最大値", " Base Rac Cla Per Total Maximum"), 13, 10);
38 for (int i = 0; i < A_MAX; i++) {
41 int j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
42 int m = adjust_stat(17, j);
44 sprintf(cur, "18/%02d", (m - 18));
46 sprintf(cur, "%2d", m);
48 m = adjust_stat(cval[i], j);
50 sprintf(inp, "18/%02d", (m - 18));
52 sprintf(inp, "%2d", m);
54 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);
55 put_str(buf, 14 + i, 10);
63 c_put_str(TERM_WHITE, _("決定する", "Accept"), 21, 35);
64 } else if (os < A_MAX) {
65 c_put_str(TERM_WHITE, cur, 14 + os, 10);
68 c_put_str(TERM_YELLOW, _("決定する", "Accept"), 21, 35);
70 int j = rp_ptr->r_adj[cs] + cp_ptr->c_adj[cs] + ap_ptr->a_adj[cs];
71 int m = adjust_stat(cval[cs], j);
73 sprintf(inp, "18/%02d", (m - 18));
75 sprintf(inp, "%2d", m);
78 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);
79 c_put_str(TERM_YELLOW, cur, 14 + cs, 10);
118 } else if (cval[cs] > 3) {
129 if (cval[cs] == 17) {
132 } else if (cval[cs] < 17) {
156 show_help(creature_ptr, "jbirth.txt#AutoRoller");
158 show_help(creature_ptr, "birth.txt#AutoRoller");
164 do_cmd_options_aux(OPT_PAGE_BIRTH, "初期オプション((*)はスコアに影響)");
166 do_cmd_options_aux(OPT_PAGE_BIRTH, "Birth Option((*)s effect score)");
176 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == 6))
180 for (int i = 0; i < A_MAX; i++)
181 stat_limit[i] = (s16b)cval[i];
186 void initialize_chara_limit(chara_limit_type *chara_limit_ptr)
188 chara_limit_ptr->agemin = 0;
189 chara_limit_ptr->agemax = 0;
190 chara_limit_ptr->htmin = 0;
191 chara_limit_ptr->htmax = 0;
192 chara_limit_ptr->wtmin = 0;
193 chara_limit_ptr->wtmax = 0;
194 chara_limit_ptr->scmin = 0;
195 chara_limit_ptr->scmax = 0;
199 * @brief オートローラで得たい年齢、身長、体重、社会的地位の基準を決める。
202 bool get_chara_limits(player_type *creature_ptr, chara_limit_type *chara_limit_ptr)
206 char buf[80], cur[80];
207 concptr itemname[] = { _("年齢", "age"), _("身長(インチ)", "height"), _("体重(ポンド)", "weight"), _("社会的地位", "social class") };
210 put_str(_("2/4/6/8で項目選択、+/-で値の増減、Enterで次へ", "2/4/6/8 for Select, +/- for Change value, Enter for Goto next"), 11, 10);
212 _("注意:身長と体重の最大値/最小値ぎりぎりの値は非常に出現確率が低くなります。", "Caution: Values near minimum or maximum are extremely rare."), 23, 2);
214 int max_percent, min_percent;
215 if (creature_ptr->psex == SEX_MALE) {
216 max_percent = (int)(rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1) * 100 / (int)(rp_ptr->m_b_ht);
217 min_percent = (int)(rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1) * 100 / (int)(rp_ptr->m_b_ht);
219 max_percent = (int)(rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1) * 100 / (int)(rp_ptr->f_b_ht);
220 min_percent = (int)(rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1) * 100 / (int)(rp_ptr->f_b_ht);
223 put_str(_("体格/地位の最小値/最大値を設定して下さい。", "Set minimum/maximum attribute."), 10, 10);
224 put_str(_(" 項 目 最小値 最大値", " Parameter Min Max"), 13, 20);
227 for (int i = 0; i < MAXITEMS; i++) {
230 case 0: /* Minimum age */
231 m = rp_ptr->b_age + 1;
233 case 1: /* Maximum age */
234 m = rp_ptr->b_age + rp_ptr->m_age;
237 case 2: /* Minimum height */
238 if (creature_ptr->psex == SEX_MALE)
239 m = rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1;
241 m = rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1;
243 case 3: /* Maximum height */
244 if (creature_ptr->psex == SEX_MALE)
245 m = rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1;
247 m = rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1;
249 case 4: /* Minimum weight */
250 if (creature_ptr->psex == SEX_MALE)
251 m = (rp_ptr->m_b_wt * min_percent / 100) - (rp_ptr->m_m_wt * min_percent / 75) + 1;
253 m = (rp_ptr->f_b_wt * min_percent / 100) - (rp_ptr->f_m_wt * min_percent / 75) + 1;
255 case 5: /* Maximum weight */
256 if (creature_ptr->psex == SEX_MALE)
257 m = (rp_ptr->m_b_wt * max_percent / 100) + (rp_ptr->m_m_wt * max_percent / 75) - 1;
259 m = (rp_ptr->f_b_wt * max_percent / 100) + (rp_ptr->f_m_wt * max_percent / 75) - 1;
261 case 6: /* Minimum social class */
264 case 7: /* Maximum social class */
276 for (int i = 0; i < 4; i++) {
277 sprintf(buf, "%-12s (%3d - %3d)", itemname[i], mval[i * 2], mval[i * 2 + 1]);
278 put_str(buf, 14 + i, 20);
279 for (int j = 0; j < 2; j++) {
280 sprintf(buf, " %3d", cval[i * 2 + j]);
281 put_str(buf, 14 + i, 45 + 8 * j);
289 const char accept[] = _("決定する", "Accept");
291 c_put_str(TERM_WHITE, accept, 19, 35);
293 c_put_str(TERM_WHITE, cur, 14 + os / 2, 45 + 8 * (os % 2));
295 if (cs == MAXITEMS) {
296 c_put_str(TERM_YELLOW, accept, 19, 35);
298 sprintf(cur, " %3d", cval[cs]);
299 c_put_str(TERM_YELLOW, cur, 14 + cs / 2, 45 + 8 * (cs % 2));
313 break; /*後でもう一回breakせんと*/
346 if (cs != MAXITEMS) {
348 if (cval[cs] > cval[cs - 1]) {
353 if (cval[cs] > mval[cs]) {
363 if (cs != MAXITEMS) {
365 if (cval[cs] < mval[cs]) {
370 if (cval[cs] < cval[cs + 1]) {
379 if (cs != MAXITEMS) {
381 if (cval[cs] < mval[cs]) {
386 if (cval[cs] < cval[cs + 1]) {
387 cval[cs] = cval[cs + 1];
395 if (cs != MAXITEMS) {
397 if (cval[cs] > cval[cs - 1]) {
398 cval[cs] = cval[cs - 1];
402 if (cval[cs] > mval[cs]) {
412 show_help(creature_ptr, "jbirth.txt#AutoRoller");
414 show_help(creature_ptr, "birth.txt#AutoRoller");
419 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
427 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == MAXITEMS))
431 chara_limit_ptr->agemin = (s16b)cval[0];
432 chara_limit_ptr->agemax = (s16b)cval[1];
433 chara_limit_ptr->htmin = (s16b)cval[2];
434 chara_limit_ptr->htmax = (s16b)cval[3];
435 chara_limit_ptr->wtmin = (s16b)cval[4];
436 chara_limit_ptr->wtmax = (s16b)cval[5];
437 chara_limit_ptr->scmin = (s16b)cval[6];
438 chara_limit_ptr->scmax = (s16b)cval[7];