3 * @brief プレイヤーの作成を行う / Create a player character
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2013 Deskull Doxygen向けのコメント整理\n
16 #include "main/music-definitions-table.h"
17 #include "main/sound-definitions-table.h"
18 #include "market/building.h"
20 #include "core/show-file.h"
21 #include "io/read-pref-file.h"
24 #include "object-ego.h"
27 #include "io/write-diary.h"
28 #include "cmd/cmd-dump.h"
32 #include "monsterrace-hook.h"
33 #include "market/store.h"
36 #include "player/process-name.h"
37 #include "view/display-player.h" // 暫定。後で消す.
38 #include "player-class.h"
39 #include "player-status.h"
40 #include "player-personality.h"
41 #include "player-sex.h"
42 #include "player/race-info-table.h"
43 #include "spell/spells-util.h"
44 #include "spells-status.h"
48 #include "dungeon-file.h"
49 #include "floor-town.h"
51 #include "cmd/cmd-help.h"
52 #include "player-skill.h"
54 #include "object/object-kind.h"
55 #include "monsterrace.h"
56 #include "autopick/autopick.h"
58 #include "realm/realm.h"
60 #include "view/display-main-window.h" // 暫定。後で消す.
61 #include "birth/birth-explanations-table.h"
64 * The last character rolled,
65 * holded for quick start
67 birther previous_char;
71 * How often the autoroller will update the display and pause
72 * to check for user interuptions.
73 * Bigger values will make the autoroller faster, but slower
74 * system may have problems because the user can't stop the
75 * autoroller for this number of rolls.
77 #define AUTOROLLER_STEP 5431L
80 * ランダムクエストのモンスターを確定するために試行する回数 / Maximum number of tries for selection of a proper quest monster
85 #define MAX_CLASS_CHOICE MAX_CLASS
88 static concptr seikaku_jouhou[MAX_SEIKAKU] =
91 "ふつうは、特に特筆するべき部分がない性格です。あらゆる技能を平均的にこなします。",
93 "ちからじまんは、肉体的な能力や技能が上昇します。しかし、魔法に関係する能力や技能は劣り、戦士よりのステータスを持ちます。",
95 "きれものは、肉体的な能力は下がりますが、知能や魔法に関係する技能は上昇し、メイジよりのステータスを持ちます。",
97 "しあわせものは、神を信仰する能力が高くなります。肉体的には平均的な能力を持ち、プリーストに近いステータスとなります。",
99 "すばしっこいは、どのスキルも比較的うまくこなしますが、肉体的な能力は低くなります。",
101 "いのちしらずは、戦闘力、魔法能力の両方が上昇しますが、魔法防御、HPといった能力は悪くなります。",
103 "好きな食べ物は焼きビーフン。抑えてはいるが、冒険心旺盛な一匹狼。正義感、勇気とも平均以上だがカッとしやすい所もある。計画的人生より行き当たりばったりの人生を選んでしまうタイプで、異性の扱いは苦手。",
105 "なまけものは、あらゆるスキルが低く、何をやってもうまくいきません。",
107 "セクシーギャルは、あらゆるスキルをうまくこなすことができます。しかし、その人をなめた性格は全てのモンスターを怒らせることになるでしょう。この性格は女性しか選ぶことができません。",
109 "ラッキーマンは、能力値はなまけものに匹敵するくらい低いにもかかわらず、どんなことをしてもなぜかうまくいってしまいます。この性格は男性しか選ぶことができません。",
111 "がまんづよいは、じっくりと物事にとりくむ慎重な性格で、他の性格に比べて高い耐久力を得ることができます。しかし、自分から行動するのは苦手で、多くの技能は低くなってしまいます。",
113 "いかさまは、初心者の練習用の性格です。あらゆる能力が高くなっています。この性格を使えば勝利者になることは容易ですが、勝利しても全く自慢になりません。",
115 "チャージマンは「こんなところ」に連れて行かれても仕方のない可愛そうなお友達なんDA。腕っ節やタフさはマンモス並みに強いのだけれど知能面はまるで駄目なのが分かるだろう?この性格は最初から気が狂っているので、混乱したり幻覚を見る心配がないのです。",
119 "\"Ordinary\" is a personality with no special skills or talents, with unmodified stats and skills.",
121 "\"Mighty\" raises your physical stats and skills, but reduces stats and skills which influence magic. It makes your stats suitable for a warrior. Also it directly influences your hit-points and spell fail rate.",
123 "\"Shrewd\" reduces your physical stats, and raises your intelligence and magical skills. It makes your stats suitable for a mage. Also it directly influences your hit-points and spell fail rate.",
125 "\"Pious\" deepens your faith in your God. It makes your physical ability average, and your stats suitable for priest.",
127 "\"Nimble\" improves most skills except for melee combat.",
129 "\"Fearless\" raises both your melee and magical ability. Stats such as magic defense and constitution are reduced. Also it has a direct bad influence on your hit-points.",
131 "\"Combat\" gives you comparatively high melee and shooting abilities, and average constitution. Other skills such as stealth, magic defence, and magical devices are weakened. All \"Combat\" people have great respect for the legendary \"Combat Echizen\".\n\
132 (See \"Death Crimson\" / Ecole Software Corp.)",
134 "A \"Lazy\" person has no good stats and can do no action well. Also it has a direct bad influence on your spell fail rate.",
136 "\"Sexy\" rises all of your abilities, but your haughty attitude will aggravate all monsters. Only females can choose this personality.",
138 "A \"Lucky\" man has poor stats, equivalent to a \"Lazy\" person. Mysteriously, however, he can do all things well. Only males can choose this personality.",
140 "A \"Patient\" person does things carefully. Patient people have high constitution, and high resilience, but poor abilities in most other skills. Also it directly influences your hit-points.",
142 "\"Munchkin\" is a personality for beginners. It raises all your stats and skills. With this personality, you can win the game easily, but gain little honor in doing so.",
144 "\"ChargeMan\" is a crazy killer. You are strong and tough but have poor intelligence. Since you're already insane, confusion and hallucinations do not affect you.",
149 /*! 魔法領域の詳細解説メッセージテーブル */
150 static concptr realm_jouhou[VALID_REALM] =
153 "生命は回復能力に優れた魔法です。治療や防御、感知魔法が多く含まれていますが、攻撃呪文もわずかに持っています。特に高レベルの呪文にはアンデッドを塵に帰す力をあると言われています。",
155 "仙術は「meta」領域であり、感知や鑑定、さらに退却用の呪文や自身の能力を高める呪文などの便利な呪文が含まれています。しかし、直接攻撃用の呪文は持っていません。",
157 "自然の魔法は使用者を元素のマスターにします。これには防御、探知、治療と攻撃呪文が含まれています。また、生命以外の領域で最高の治療呪文もこの領域にあります。",
159 "カオスの魔法は制御が困難で、予測のできない魔法もあります。カオスは非常に非元素的であり、カオスの呪文は想像できる最も恐るべき破壊兵器です。この呪文を唱えるものはカオスの尖兵に対し、敵や自分自身さえも変異させるよう要求します。",
161 "黒魔術である暗黒の魔法ほど邪悪なカテゴリーはありません。これらの呪文は比較的学ぶのが困難ですが、高レベルになると術者に生物とアンデッドを自由に操る能力を与えます。残念なことに、もっとも強力な呪文はその触媒として術者自身の血を必要とし、詠唱中にしばしば術者を傷つけます。",
163 "トランプの魔法はテレポート系の呪文で精選されたものを持っており、その出入り口は他の生物を召喚するためにも使えるため、召喚呪文から選りすぐられたものも同様に持っています。しかし、この魔法によって全ての怪物が別の場所へ呼ばれるのを理解するわけではなく、もし召喚呪文に失敗するとその生物は敵となります。",
165 "秘術の魔法は、全ての領域から有用な呪文だけを取り入れようとした多用途領域です。必要な「道具」的呪文を持っていても高レベルの強力な呪文は持っていません。結果として、全ての呪文書は街で買い求めることができます。また、他の領域に存在する同様な呪文の方がより低レベル、低コストで唱えることができます。",
167 "匠の魔法は、自分や道具を強化するための魔法が含まれています。魔法によって自分自身の戦闘力を非常に高めることができますが、相手を直接攻撃するような呪文は含まれていません。",
169 "悪魔の魔法は暗黒と同様非常に邪悪なカテゴリーです。様々な攻撃魔法に優れ、また悪魔のごとき知覚能力を得ることができます。高レベルの呪文は悪魔を自在に操り、自分自身の肉体をも悪魔化させることができます。",
171 "破邪は「正義」の魔法です。直接敵を傷つける魔法が多く含まれ、特に邪悪な敵に対する力は恐るべきものがあります。しかし、善良な敵にはあまり効果がありません。",
173 "歌集は、歌によって効果を発揮する魔法です。魔法と同様、使った時に効果のあるものと、歌い続けることによって持続して効果を発揮するものがあります。後者の場合は、MPの続く限り効果を発揮することができますが、同時に歌える歌は1つだけという制限もあります。",
175 "武芸の書は、様々な戦闘の技について書かれています。この本は技を覚えるときに読む必要がありますが、一度覚えた技は使うのに本を持つ必要はありません。技を使うときには必ず武器を装備していなければいけません。",
177 "呪術は忌むべき領域です。複数の呪いの言葉を歌のように紡ぎながら詠唱します。多くの呪文は詠唱し続けることによって効果が持続されます。呪文には相手の行動を束縛するもの、ダメージを与えるもの、攻撃に対して反撃するものが多くあります。"
180 "Life magic is very good for healing; it relies mostly on healing, protection and detection spells. Also life magic has a few attack spells as well. It's said that some high level spells of life magic can disintegrate Undead monsters into ash.",
182 "Sorcery is a `meta` realm, including enchantment and general spells. It provides superb protection spells, spells to enhance your odds in combat and, most importantly, a vast selection of spells for gathering information. However, Sorcery has one weakness: it has no spells to deal direct damage to your enemies.",
184 "Nature magic makes you a master of the elements; it provides protection, detection, curing and attack spells. Nature also has a spell of Herbal Healing, which is the only powerful healing spell outside the realm of Life magic.",
186 "There are few types of magic more unpredictable and difficult to control than Chaos magic. Chaos is the very element of unmaking, and the Chaos spells are the most terrible weapons of destruction imaginable. The caster can also call on the primal forces of Chaos to induce mutations in his/her opponents and even him/herself.",
188 "There is no fouler nor more evil category of spells than the necromantic spells of Death Magic. These spells are relatively hard to learn, but at higher levels the spells give the caster power over living and the (un)dead, but the most powerful spells need his / her own blood as the focus, often hurting the caster in the process of casting.",
190 "Trump magic has, indeed, an admirable selection of teleportation spells. Since the Trump gateways can also be used to summon other creatures, Trump magic has an equally impressive selection of summoning spells. However, not all monsters appreciate being drawn to another place by Trump user.",
192 "Arcane magic is a general purpose realm of magic. It attempts to encompass all 'useful' spells from all realms. This is the downside of Arcane magic: while Arcane does have all the necessary 'tool' spells for a dungeon delver, it has no ultra-powerful high level spells. As a consequence, all Arcane spellbooks can be bought in town. It should also be noted that the 'specialized' realms usually offer the same spell at a lower level and cost.",
194 "Craft magic can strengthen the caster or his or her equipment. These spells can greatly improve the caster's fighting ability. Using them against opponents directly is not possible.",
196 "Demon is a very evil realm, same as Death. It provides various attack spells and devilish detection spells. At higher levels, Demon magic provides the ability to dominate demons and to polymorph yourself into a demon.",
198 "Crusade is a magic of 'Justice'. It includes damage spells, which are greatly effective against foul and evil monsters, but have poor effects against good monsters.",
200 "Music magic works through the caster singing songs. There are two types of songs; one which shows effects instantly and another which shows effects continuously until SP runs out. The latter type has a limit: only one song can be sung at a time.",
202 "The books of Kendo describe various combat techniques. When learning new techniques, you are required to carry the books, but once you memorize them, you don't have to carry them. When using a technique, wielding a weapon is required.",
204 "Hex is an unsavory realm, like the death and demon realms. Some of the spells can act continuously by stringing together curses like a song. Spells may obstruct monsters' actions, deal damage to monsters in sight, or return damage to monsters who have damaged the caster."
208 /*! 魔法領域の簡易解説メッセージテーブル */
209 static concptr realm_subinfo[VALID_REALM] =
221 "邪悪な怪物に対する攻撃に優れています",
226 "Good at detection and healing.",
227 "Utility and protective spells.",
228 "Good at detection and defence.",
229 "Offensive and destructive.",
230 "Ruins living creatures.",
231 "Good at summoning and teleportation.",
232 "Very useful but not as potent.",
233 "Support for melee fighting.",
234 "Good at both offence and defence.",
235 "Destroys evil creatures.",
236 "Songs with magical effects.",
237 "Special attacks on melee.",
238 "Good at obstacle and revenge."
243 /*! オートローラの能力値的要求水準 / Autoroll limit */
244 static s16b stat_limit[6];
246 /*! オートローラの年齢、身長、体重、社会的地位の要求水準 */
254 /*! オートローラ中、各能力値が水準を超えた回数 / Autoroll matches */
255 static s32b stat_match[6];
257 /*! オートローラの試行回数 / Autoroll round */
258 static s32b auto_round;
261 * @brief プレイヤー作成を中断して変愚蛮怒を終了する
264 static void birth_quit(void)
270 * @brief 指定されたヘルプファイルを表示する / Show specific help file
271 * @param creature_ptr プレーヤーへの参照ポインタ
272 * @param helpfile ファイル名
275 static void show_help(player_type *creature_ptr, concptr helpfile)
278 (void)show_file(creature_ptr, TRUE, helpfile, NULL, 0, 0);
284 * @brief プレイヤーの魔法領域を選択する / Choose from one of the available magical realms
285 * @param choices 選択可能な魔法領域のビット配列
286 * @param count 選択可能な魔法領域を返すポインタ群。
287 * @return 選択した魔法領域のID
289 static byte choose_realm(player_type *creature_ptr, s32b choices, int *count)
291 int picks[VALID_REALM] = { 0 };
293 byte auto_select = REALM_NONE;
296 char sym[VALID_REALM];
298 char buf[80], cur[80];
300 /* Count the choices */
301 if (choices & CH_LIFE)
304 auto_select = REALM_LIFE;
306 if (choices & CH_SORCERY)
309 auto_select = REALM_SORCERY;
311 if (choices & CH_NATURE)
314 auto_select = REALM_NATURE;
316 if (choices & CH_CHAOS)
319 auto_select = REALM_CHAOS;
321 if (choices & CH_DEATH)
324 auto_select = REALM_DEATH;
326 if (choices & CH_TRUMP)
329 auto_select = REALM_TRUMP;
331 if (choices & CH_ARCANE)
334 auto_select = REALM_ARCANE;
336 if (choices & CH_ENCHANT)
339 auto_select = REALM_CRAFT;
341 if (choices & CH_DAEMON)
344 auto_select = REALM_DAEMON;
346 if (choices & CH_CRUSADE)
349 auto_select = REALM_CRUSADE;
351 if (choices & CH_MUSIC)
354 auto_select = REALM_MUSIC;
356 if (choices & CH_HISSATSU)
359 auto_select = REALM_HISSATSU;
361 if (choices & CH_HEX)
364 auto_select = REALM_HEX;
369 /* Auto-select the realm */
370 if ((*count) < 2) return auto_select;
372 /* Constraint to the 1st realm */
373 if (creature_ptr->realm2 != 255)
375 if (creature_ptr->pclass == CLASS_PRIEST)
377 if (is_good_realm(creature_ptr->realm1))
379 choices &= ~(CH_DEATH | CH_DAEMON);
383 choices &= ~(CH_LIFE | CH_CRUSADE);
389 put_str(_("注意:魔法の領域の選択によりあなたが習得する呪文のタイプが決まります。", "Note: The realm of magic will determine which spells you can learn."), 23, 5);
392 for (i = 0; i < 32; i++)
395 if (choices & (1L << i))
397 if (creature_ptr->realm1 == i + 1)
399 if (creature_ptr->realm2 == 255)
404 if (creature_ptr->realm2 == i + 1)
409 sprintf(buf, "%c%c %s", sym[n], p2, realm_names[i + 1]);
410 put_str(buf, 12 + (n / 5), 2 + 15 * (n % 5));
414 sprintf(cur, "%c%c %s", '*', p2, _("ランダム", "Random"));
423 c_put_str(TERM_WHITE, cur, 12 + (os / 5), 2 + 15 * (os % 5));
427 sprintf(cur, "%c%c %s", '*', p2, _("ランダム", "Random"));
431 sprintf(cur, "%c%c %s", sym[cs], p2, realm_names[picks[cs]]);
432 sprintf(buf, "%s", realm_names[picks[cs]]);
433 c_put_str(TERM_L_BLUE, buf, 3, 40);
434 prt(_("の特徴", ": Characteristic"), 3, 40 + strlen(buf));
435 prt(realm_subinfo[technic2magic(picks[cs]) - 1], 4, 40);
437 c_put_str(TERM_YELLOW, cur, 12 + (cs / 5), 2 + 15 * (cs % 5));
443 sprintf(buf, _("領域を選んで下さい(%c-%c) ('='初期オプション設定): ", "Choose a realm (%c-%c) ('=' for options): "), sym[0], sym[n - 1]);
445 put_str(buf, 10, 10);
447 if (c == 'Q') birth_quit();
448 if (c == 'S') return 255;
449 if (c == ' ' || c == '\r' || c == '\n')
469 if (cs >= 5) cs -= 5;
481 if ((cs + 5) <= n) cs += 5;
483 k = (islower(c) ? A2I(c) : -1);
484 if ((k >= 0) && (k < n))
489 k = (isupper(c) ? (26 + c - 'A') : -1);
490 if ((k >= 26) && (k < n))
498 show_help(creature_ptr, _("jmagic.txt#MagicRealms", "magic.txt#MagicRealms"));
503 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth option((*)s effect score)"));
507 else if (c != '2' && c != '4' && c != '6' && c != '8') bell();
513 return (byte)(picks[k]);
518 * @brief 選択した魔法領域の解説を表示する / Choose the magical realms
519 * @return ユーザが魔法領域の確定を選んだらTRUEを返す。
521 static bool get_player_realms(player_type *creature_ptr)
525 /* Clean up infomation of modifications */
530 /* Select the first realm */
531 creature_ptr->realm1 = REALM_NONE;
532 creature_ptr->realm2 = 255;
538 creature_ptr->realm1 = choose_realm(creature_ptr, realm_choices1[creature_ptr->pclass], &count);
540 if (255 == creature_ptr->realm1) return FALSE;
541 if (!creature_ptr->realm1) break;
549 roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm1) - 1], 74, temp, sizeof(temp));
551 for (i = 0; i < 10; i++)
564 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
569 else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) break;
572 /* Select the second realm */
573 creature_ptr->realm2 = REALM_NONE;
574 if (creature_ptr->realm1)
576 /* Print the realm */
577 put_str(_("魔法 :", "Magic :"), 6, 1);
578 c_put_str(TERM_L_BLUE, realm_names[creature_ptr->realm1], 6, 15);
580 /* Select the second realm */
587 creature_ptr->realm2 = choose_realm(creature_ptr, realm_choices2[creature_ptr->pclass], &count);
589 if (255 == creature_ptr->realm2) return FALSE;
590 if (!creature_ptr->realm2) break;
598 roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm2) - 1], 74, temp, sizeof(temp));
600 for (i = 0; i < A_MAX; i++)
613 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
618 else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) break;
620 if (creature_ptr->realm2)
622 /* Print the realm */
623 c_put_str(TERM_L_BLUE, format("%s, %s", realm_names[creature_ptr->realm1], realm_names[creature_ptr->realm2]), 6, 15);
632 * @brief プレイヤーのクイックスタート情報をプレイヤー構造体から保存する / Save the current data for later
633 * @param birther_ptr クイックスタート構造体の参照ポインタ
636 static void save_prev_data(player_type *creature_ptr, birther *birther_ptr)
641 birther_ptr->psex = creature_ptr->psex;
642 birther_ptr->prace = creature_ptr->prace;
643 birther_ptr->pclass = creature_ptr->pclass;
644 birther_ptr->pseikaku = creature_ptr->pseikaku;
645 birther_ptr->realm1 = creature_ptr->realm1;
646 birther_ptr->realm2 = creature_ptr->realm2;
647 birther_ptr->age = creature_ptr->age;
648 birther_ptr->ht = creature_ptr->ht;
649 birther_ptr->wt = creature_ptr->wt;
650 birther_ptr->sc = creature_ptr->sc;
651 birther_ptr->au = creature_ptr->au;
654 for (i = 0; i < A_MAX; i++)
656 birther_ptr->stat_max[i] = creature_ptr->stat_max[i];
657 birther_ptr->stat_max_max[i] = creature_ptr->stat_max_max[i];
661 for (i = 0; i < PY_MAX_LEVEL; i++)
663 birther_ptr->player_hp[i] = creature_ptr->player_hp[i];
666 birther_ptr->chaos_patron = creature_ptr->chaos_patron;
668 /* Save the virtues */
669 for (i = 0; i < 8; i++)
671 birther_ptr->vir_types[i] = creature_ptr->vir_types[i];
674 /* Save the history */
675 for (i = 0; i < 4; i++)
677 strcpy(birther_ptr->history[i], creature_ptr->history[i]);
683 * @brief プレイヤーのクイックスタート情報をプレイヤー構造体へ読み込む / Load the previous data
684 * @param swap TRUEならば現在のプレイヤー構造体上との内容をスワップする形で読み込む。
687 static void load_prev_data(player_type *creature_ptr, bool swap)
693 /*** Save the current data ***/
694 if (swap) save_prev_data(creature_ptr, &temp);
697 /*** Load the previous data ***/
700 creature_ptr->psex = previous_char.psex;
701 creature_ptr->prace = previous_char.prace;
702 creature_ptr->pclass = previous_char.pclass;
703 creature_ptr->pseikaku = previous_char.pseikaku;
704 creature_ptr->realm1 = previous_char.realm1;
705 creature_ptr->realm2 = previous_char.realm2;
706 creature_ptr->age = previous_char.age;
707 creature_ptr->ht = previous_char.ht;
708 creature_ptr->wt = previous_char.wt;
709 creature_ptr->sc = previous_char.sc;
710 creature_ptr->au = previous_char.au;
713 for (i = 0; i < A_MAX; i++)
715 creature_ptr->stat_cur[i] = creature_ptr->stat_max[i] = previous_char.stat_max[i];
716 creature_ptr->stat_max_max[i] = previous_char.stat_max_max[i];
720 for (i = 0; i < PY_MAX_LEVEL; i++)
722 creature_ptr->player_hp[i] = previous_char.player_hp[i];
724 creature_ptr->mhp = creature_ptr->player_hp[0];
725 creature_ptr->chp = creature_ptr->player_hp[0];
727 creature_ptr->chaos_patron = previous_char.chaos_patron;
729 for (i = 0; i < 8; i++)
731 creature_ptr->vir_types[i] = previous_char.vir_types[i];
734 /* Load the history */
735 for (i = 0; i < 4; i++)
737 strcpy(creature_ptr->history[i], previous_char.history[i]);
740 /*** Save the previous data ***/
743 (void)COPY(&previous_char, &temp, birther);
751 * @brief プレイヤーの能力値表現に基づいて加減算を行う。
752 * @param value 現在の能力値
753 * @param amount 加減算する値
756 static int adjust_stat(int value, int amount)
760 /* Negative amounts */
764 for (i = 0; i < (0 - amount); i++)
766 if (value >= 18 + 10)
781 /* Positive amounts */
785 for (i = 0; i < amount; i++)
798 /* Return the result */
806 * @brief プレイヤーの能力値を一通りロールする。 / Roll for a characters stats
808 * calc_bonuses()による、独立ステータスからの副次ステータス算出も行っている。
809 * For efficiency, we include a chunk of "calc_bonuses()".\n
812 static void get_stats(player_type *creature_ptr)
814 /* Roll and verify some stats */
821 for (i = 0; i < 2; i++)
823 s32b tmp = randint0(60 * 60 * 60);
826 /* Extract 5 + 1d3 + 1d4 + 1d5 */
828 val += tmp % 3; tmp /= 3;
829 val += tmp % 4; tmp /= 4;
830 val += tmp % 5; tmp /= 5;
832 /* Save that value */
834 creature_ptr->stat_cur[3 * i] = creature_ptr->stat_max[3 * i] = val;
836 /* Extract 5 + 1d3 + 1d4 + 1d5 */
838 val += tmp % 3; tmp /= 3;
839 val += tmp % 4; tmp /= 4;
840 val += tmp % 5; tmp /= 5;
842 /* Save that value */
844 creature_ptr->stat_cur[3 * i + 1] = creature_ptr->stat_max[3 * i + 1] = val;
846 /* Extract 5 + 1d3 + 1d4 + 1d5 */
848 val += tmp % 3; tmp /= 3;
849 val += tmp % 4; tmp /= 4;
850 val += (BASE_STATUS)tmp;
852 /* Save that value */
854 creature_ptr->stat_cur[3 * i + 2] = creature_ptr->stat_max[3 * i + 2] = val;
858 if ((sum > 42 + 5 * 6) && (sum < 57 + 5 * 6)) break;
859 /* 57 was 54... I hate 'magic numbers' :< TY */
864 * @brief プレイヤーの限界ステータスを決める。
867 void get_max_stats(player_type *creature_ptr)
872 /* Roll and verify some stats */
876 for (j = i = 0; i < A_MAX; i++)
879 dice[i] = randint1(7);
881 /* Collect the maximum */
889 /* Acquire the stats */
890 for (i = 0; i < A_MAX; i++)
892 BASE_STATUS max_max = 18 + 60 + dice[i] * 10;
894 /* Save that value */
895 creature_ptr->stat_max_max[i] = max_max;
896 if (creature_ptr->stat_max[i] > max_max)
897 creature_ptr->stat_max[i] = max_max;
898 if (creature_ptr->stat_cur[i] > max_max)
899 creature_ptr->stat_cur[i] = max_max;
901 creature_ptr->knowledge &= ~(KNOW_STAT);
902 creature_ptr->redraw |= (PR_STATS);
907 * @brief その他「オートローラ中は算出の対象にしない」副次ステータスを処理する / Roll for some info that the auto-roller ignores
910 static void get_extra(player_type *creature_ptr, bool roll_hitdie)
914 /* Experience factor */
915 if (creature_ptr->prace == RACE_ANDROID) creature_ptr->expfact = rp_ptr->r_exp;
916 else creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
918 if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA)) && ((creature_ptr->prace == RACE_KLACKON) || (creature_ptr->prace == RACE_SPRITE)))
919 creature_ptr->expfact -= 15;
921 /* Reset record of race/realm changes */
922 creature_ptr->start_race = creature_ptr->prace;
923 creature_ptr->old_race1 = 0L;
924 creature_ptr->old_race2 = 0L;
925 creature_ptr->old_realm = 0;
927 for (i = 0; i < 64; i++)
929 if (creature_ptr->pclass == CLASS_SORCERER) creature_ptr->spell_exp[i] = SPELL_EXP_MASTER;
930 else if (creature_ptr->pclass == CLASS_RED_MAGE) creature_ptr->spell_exp[i] = SPELL_EXP_SKILLED;
931 else creature_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
934 for (i = 0; i < 5; i++)
935 for (j = 0; j < 64; j++)
936 creature_ptr->weapon_exp[i][j] = s_info[creature_ptr->pclass].w_start[i][j];
937 if ((creature_ptr->pseikaku == SEIKAKU_SEXY) && (creature_ptr->weapon_exp[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] < WEAPON_EXP_BEGINNER))
939 creature_ptr->weapon_exp[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_BEGINNER;
942 for (i = 0; i < GINOU_MAX; i++)
943 creature_ptr->skill_exp[i] = s_info[creature_ptr->pclass].s_start[i];
946 if (creature_ptr->pclass == CLASS_SORCERER)
947 creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
949 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
951 /* Roll for hit point unless quick-start */
952 if (roll_hitdie) roll_hitdice(creature_ptr, SPOP_NO_UPDATE);
954 /* Initial hitpoints */
955 creature_ptr->mhp = creature_ptr->player_hp[0];
960 * @brief プレイヤーの生い立ちの自動生成を行う。 / Get the racial history, and social class, using the "history charts".
963 static void get_history(player_type *creature_ptr)
965 int i, n, chart, roll, social_class;
971 /* Clear the previous history strings */
972 for (i = 0; i < 4; i++) creature_ptr->history[i][0] = '\0';
974 /* Clear the history text */
977 /* Initial social class */
978 social_class = randint1(4);
981 switch (creature_ptr->prace)
1026 case RACE_HALF_TROLL:
1036 case RACE_HALF_OGRE:
1041 case RACE_HALF_GIANT:
1046 case RACE_HALF_TITAN:
1076 case RACE_DRACONIAN:
1081 case RACE_MIND_FLAYER:
1169 /* Process the history */
1175 /* Roll for nobility */
1176 roll = randint1(100);
1179 /* Access the proper entry in the table */
1180 while ((chart != bg[i].chart) || (roll > bg[i].roll))
1185 /* Acquire the textual history */
1186 (void)strcat(buf, bg[i].info);
1188 /* Add in the social class */
1189 social_class += (int)(bg[i].bonus) - 50;
1191 /* Enter the next chart */
1196 /* Verify social class */
1197 if (social_class > 100) social_class = 100;
1198 else if (social_class < 1) social_class = 1;
1200 /* Save the social class */
1201 creature_ptr->sc = (s16b)social_class;
1204 /* Skip leading spaces */
1205 for (s = buf; *s == ' '; s++) /* loop */;
1207 /* Get apparent length */
1210 /* Kill trailing spaces */
1212 while ((n > 0) && (s[n - 1] == ' ')) s[--n] = '\0';
1216 roff_to_buf(s, 60, temp, sizeof(temp));
1218 for (i = 0; i < 4; i++) {
1219 if (t[0] == 0)break;
1220 else { strcpy(creature_ptr->history[i], t); t += strlen(t) + 1; }
1226 * @brief プレイヤーの身長体重を決める / Get character's height and weight
1229 void get_height_weight(player_type *creature_ptr)
1231 int h_percent; /* 身長が平均にくらべてどのくらい違うか. */
1233 /* Calculate the height/weight for males */
1234 if (creature_ptr->psex == SEX_MALE)
1236 creature_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
1237 h_percent = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
1238 creature_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * h_percent / 100
1239 , (int)(rp_ptr->m_m_wt) * h_percent / 300);
1242 /* Calculate the height/weight for females */
1243 else if (creature_ptr->psex == SEX_FEMALE)
1245 creature_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
1246 h_percent = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
1247 creature_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * h_percent / 100
1248 , (int)(rp_ptr->f_m_wt) * h_percent / 300);
1254 * @brief プレイヤーの年齢を決める。 / Computes character's age, height, and weight by henkma
1255 * @details 内部でget_height_weight()も呼び出している。
1258 static void get_ahw(player_type *creature_ptr)
1260 /* Get character's age */
1261 creature_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
1263 /* Get character's height and weight */
1264 get_height_weight(creature_ptr);
1268 * @brief プレイヤーの初期所持金を決める。 / Get the player's starting money
1271 static void get_money(player_type *creature_ptr)
1275 /* Social Class determines starting gold */
1276 gold = (creature_ptr->sc * 6) + randint1(100) + 300;
1277 if (creature_ptr->pclass == CLASS_TOURIST)
1280 /* Process the stats */
1281 for (i = 0; i < A_MAX; i++)
1283 /* Mega-Hack -- reduce gold for high stats */
1284 if (creature_ptr->stat_max[i] >= 18 + 50) gold -= 300;
1285 else if (creature_ptr->stat_max[i] >= 18 + 20) gold -= 200;
1286 else if (creature_ptr->stat_max[i] > 18) gold -= 150;
1287 else gold -= (creature_ptr->stat_max[i] - 8) * 10;
1290 /* Minimum 100 gold */
1291 if (gold < 100) gold = 100;
1293 if (creature_ptr->pseikaku == SEIKAKU_NAMAKE)
1295 else if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
1297 if (creature_ptr->prace == RACE_ANDROID) gold /= 5;
1300 creature_ptr->au = gold;
1306 * @brief put_stats()のサブルーチンとして、オートロール中のステータスを表示する / Display stat values, subset of "put_stats()"
1307 * @details See 'display_player(p_ptr, )' for screen layout constraints.
1310 static void birth_put_stats(player_type *creature_ptr)
1321 /* Put the stats (and percents) */
1322 for (i = 0; i < A_MAX; i++)
1324 /* Race/Class bonus */
1325 j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
1327 /* Obtain the current stat */
1328 m = adjust_stat(creature_ptr->stat_max[i], j);
1332 c_put_str(TERM_L_GREEN, buf, 3 + i, col + 24);
1334 /* Put the percent */
1337 if (stat_match[i] > 1000000L)
1339 /* Prevent overflow */
1340 p = stat_match[i] / (auto_round / 1000L);
1344 p = 1000L * stat_match[i] / auto_round;
1347 attr = (p < 100) ? TERM_YELLOW : TERM_L_GREEN;
1348 sprintf(buf, "%3d.%d%%", p / 10, p % 10);
1349 c_put_str(attr, buf, 3 + i, col + 13);
1352 /* Never happened */
1355 c_put_str(TERM_RED, _("(なし)", "(NONE)"), 3 + i, col + 13);
1363 * @brief ベースアイテム構造体の鑑定済みフラグをリセットする。
1366 static void k_info_reset(void)
1370 /* Reset the "objects" */
1371 for (i = 1; i < max_k_idx; i++)
1373 object_kind *k_ptr = &k_info[i];
1376 k_ptr->tried = FALSE;
1379 k_ptr->aware = FALSE;
1385 * @brief プレイヤー構造体の内容を初期値で消去する(名前を除く) / Clear all the global "character" data (without name)
1388 static void player_wipe_without_name(player_type *creature_ptr)
1393 /* Temporary copy for migration - written back later */
1394 COPY(&tmp, creature_ptr, player_type);
1396 /* Hack -- free the "last message" string */
1397 if (creature_ptr->last_message) string_free(creature_ptr->last_message);
1399 if (creature_ptr->inventory_list != NULL) C_WIPE(creature_ptr->inventory_list, INVEN_TOTAL, object_type);
1401 /* Hack -- zero the struct */
1402 (void)WIPE(creature_ptr, player_type);
1404 //TODO: キャラ作成からゲーム開始までに current_floor_ptr を参照しなければならない処理は今後整理して外す。
1405 creature_ptr->current_floor_ptr = &floor_info;
1407 C_MAKE(creature_ptr->inventory_list, INVEN_TOTAL, object_type);
1409 /* Wipe the history */
1410 for (i = 0; i < 4; i++)
1412 strcpy(creature_ptr->history[i], "");
1415 /* Wipe the quests */
1416 for (i = 0; i < max_q_idx; i++)
1418 quest_type* const q_ptr = &quest[i];
1420 q_ptr->status = QUEST_STATUS_UNTAKEN;
1428 q_ptr->comptime = 0;
1432 creature_ptr->total_weight = 0;
1435 creature_ptr->inven_cnt = 0;
1436 creature_ptr->equip_cnt = 0;
1438 /* Clear the inventory */
1439 for (i = 0; i < INVEN_TOTAL; i++)
1441 object_wipe(&creature_ptr->inventory_list[i]);
1444 /* Start with no artifacts made yet */
1445 for (i = 0; i < max_a_idx; i++)
1447 artifact_type *a_ptr = &a_info[i];
1451 /* Reset the objects */
1454 /* Reset the "monsters" */
1455 for (i = 1; i < max_r_idx; i++)
1457 monster_race *r_ptr = &r_info[i];
1459 /* Hack -- Reset the counter */
1462 /* Hack -- Reset the max counter */
1463 r_ptr->max_num = 100;
1465 /* Hack -- Reset the max counter */
1466 if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 1;
1468 /* Hack -- Non-unique Nazguls are semi-unique */
1469 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num = MAX_NAZGUL_NUM;
1471 /* Clear visible kills in this life */
1472 r_ptr->r_pkills = 0;
1474 /* Clear all kills in this life */
1475 r_ptr->r_akills = 0;
1479 /* Hack -- Well fed player */
1480 creature_ptr->food = PY_FOOD_FULL - 1;
1483 /* Wipe the spells */
1484 if (creature_ptr->pclass == CLASS_SORCERER)
1486 creature_ptr->spell_learned1 = creature_ptr->spell_learned2 = 0xffffffffL;
1487 creature_ptr->spell_worked1 = creature_ptr->spell_worked2 = 0xffffffffL;
1491 creature_ptr->spell_learned1 = creature_ptr->spell_learned2 = 0L;
1492 creature_ptr->spell_worked1 = creature_ptr->spell_worked2 = 0L;
1494 creature_ptr->spell_forgotten1 = creature_ptr->spell_forgotten2 = 0L;
1495 for (i = 0; i < 64; i++) creature_ptr->spell_order[i] = 99;
1496 creature_ptr->learned_spells = 0;
1497 creature_ptr->add_spells = 0;
1498 creature_ptr->knowledge = 0;
1500 /* Clean the mutation count */
1501 creature_ptr->mutant_regenerate_mod = 100;
1503 /* Clear "cheat" options */
1511 cheat_diary_output = FALSE;
1514 /* Assume no winning game */
1515 current_world_ptr->total_winner = FALSE;
1517 creature_ptr->timewalk = FALSE;
1519 /* Assume no panic save */
1520 creature_ptr->panic_save = 0;
1522 /* Assume no cheating */
1523 current_world_ptr->noscore = 0;
1524 current_world_ptr->wizard = FALSE;
1526 /* Not waiting to report score */
1527 creature_ptr->wait_report_score = FALSE;
1529 /* Default pet command settings */
1530 creature_ptr->pet_follow_distance = PET_FOLLOW_DIST;
1531 creature_ptr->pet_extra_flags = (PF_TELEPORT | PF_ATTACK_SPELL | PF_SUMMON_SPELL);
1533 /* Wipe the recall depths */
1534 for (i = 0; i < current_world_ptr->max_d_idx; i++)
1539 creature_ptr->visit = 1;
1541 /* Reset wild_mode to FALSE */
1542 creature_ptr->wild_mode = FALSE;
1544 for (i = 0; i < 108; i++)
1546 creature_ptr->magic_num1[i] = 0;
1547 creature_ptr->magic_num2[i] = 0;
1551 creature_ptr->max_plv = creature_ptr->lev = 1;
1553 /* Initialize arena and rewards information -KMW- */
1554 creature_ptr->arena_number = 0;
1555 creature_ptr->current_floor_ptr->inside_arena = FALSE;
1556 creature_ptr->current_floor_ptr->inside_quest = 0;
1557 for (i = 0; i < MAX_MANE; i++)
1559 creature_ptr->mane_spell[i] = -1;
1560 creature_ptr->mane_dam[i] = 0;
1563 creature_ptr->mane_num = 0;
1564 creature_ptr->exit_bldg = TRUE; /* only used for arena now -KMW- */
1567 creature_ptr->today_mon = 0;
1569 /* Reset monster arena */
1570 update_gambling_monsters(creature_ptr);
1572 /* Reset mutations */
1573 creature_ptr->muta1 = 0;
1574 creature_ptr->muta2 = 0;
1575 creature_ptr->muta3 = 0;
1578 for (i = 0; i < 8; i++) creature_ptr->virtues[i] = 0;
1580 creature_ptr->dungeon_idx = 0;
1582 /* Set the recall dungeon accordingly */
1583 if (vanilla_town || ironman_downward)
1585 creature_ptr->recall_dungeon = DUNGEON_ANGBAND;
1589 creature_ptr->recall_dungeon = DUNGEON_GALGALS;
1592 /* Data migration */
1593 memcpy(creature_ptr->name, tmp.name, sizeof(tmp.name));
1599 * @brief ダンジョン内部のクエストを初期化する / Initialize random quests and final quests
1600 * @param creature_ptr プレーヤーへの参照ポインタ
1603 static void init_dungeon_quests(player_type *creature_ptr)
1605 int number_of_quests = MAX_RANDOM_QUEST - MIN_RANDOM_QUEST + 1;
1608 /* Init the random quests */
1609 init_flags = INIT_ASSIGN;
1610 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
1611 floor_ptr->inside_quest = MIN_RANDOM_QUEST;
1613 process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
1615 floor_ptr->inside_quest = 0;
1617 /* Generate quests */
1618 for (i = MIN_RANDOM_QUEST + number_of_quests - 1; i >= MIN_RANDOM_QUEST; i--)
1620 quest_type *q_ptr = &quest[i];
1621 monster_race *quest_r_ptr;
1623 q_ptr->status = QUEST_STATUS_TAKEN;
1624 determine_random_questor(creature_ptr, q_ptr);
1627 quest_r_ptr = &r_info[q_ptr->r_idx];
1628 quest_r_ptr->flags1 |= RF1_QUESTOR;
1633 /* Init the two main quests (Oberon + Serpent) */
1634 init_flags = INIT_ASSIGN;
1635 floor_ptr->inside_quest = QUEST_OBERON;
1637 process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
1639 quest[QUEST_OBERON].status = QUEST_STATUS_TAKEN;
1641 floor_ptr->inside_quest = QUEST_SERPENT;
1643 process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
1645 quest[QUEST_SERPENT].status = QUEST_STATUS_TAKEN;
1646 floor_ptr->inside_quest = 0;
1651 * @brief ゲームターンを初期化する / Reset turn
1652 * @details アンデッド系種族は開始時刻を夜からにする。
1655 static void init_turn(player_type *creature_ptr)
1657 if ((creature_ptr->prace == RACE_VAMPIRE) ||
1658 (creature_ptr->prace == RACE_SKELETON) ||
1659 (creature_ptr->prace == RACE_ZOMBIE) ||
1660 (creature_ptr->prace == RACE_SPECTRE))
1662 /* Undead start just after midnight */
1663 current_world_ptr->game_turn = (TURNS_PER_TICK * 3 * TOWN_DAWN) / 4 + 1;
1664 current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
1668 current_world_ptr->game_turn = 1;
1669 current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
1672 current_world_ptr->dungeon_turn = 1;
1673 current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
1678 * @brief 所持状態にあるアイテムの中から一部枠の装備可能なものを装備させる。
1681 static void wield_all(player_type *creature_ptr)
1685 object_type object_type_body;
1690 /* Scan through the slots backwards */
1691 for (item = INVEN_PACK - 1; item >= 0; item--)
1693 o_ptr = &creature_ptr->inventory_list[item];
1695 /* Skip non-objects */
1696 if (!o_ptr->k_idx) continue;
1698 /* Make sure we can wield it and that there's nothing else in that slot */
1699 slot = wield_slot(creature_ptr, o_ptr);
1700 if (slot < INVEN_RARM) continue;
1701 if (slot == INVEN_LITE) continue; /* Does not wield toaches because buys a lantern soon */
1702 if (creature_ptr->inventory_list[slot].k_idx) continue;
1704 i_ptr = &object_type_body;
1705 object_copy(i_ptr, o_ptr);
1708 /* Decrease the item (from the pack) */
1711 inven_item_increase(creature_ptr, item, -1);
1712 inven_item_optimize(creature_ptr, item);
1715 /* Decrease the item (from the floor) */
1718 floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
1719 floor_item_optimize(creature_ptr, 0 - item);
1722 o_ptr = &creature_ptr->inventory_list[slot];
1723 object_copy(o_ptr, i_ptr);
1724 creature_ptr->total_weight += i_ptr->weight;
1726 /* Increment the equip counter by hand */
1727 creature_ptr->equip_cnt++;
1735 * プレイヤーの職業毎の初期装備テーブル。/\n
1736 * Each player starts out with a few items, given as tval/sval pairs.\n
1737 * In addition, he always has some food and a few torches.\n
1739 static byte player_init[MAX_CLASS][3][2] =
1743 { TV_RING, SV_RING_RES_FEAR }, /* Warriors need it! */
1744 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1745 { TV_SWORD, SV_BROAD_SWORD }
1750 { TV_SORCERY_BOOK, 0 }, /* Hack: for realm1 book */
1751 { TV_DEATH_BOOK, 0 }, /* Hack: for realm2 book */
1752 { TV_SWORD, SV_DAGGER }
1757 { TV_SORCERY_BOOK, 0 }, /* Hack: for Life / Death book */
1758 { TV_DEATH_BOOK, 0 }, /* Hack: for realm2 book */
1759 { TV_HAFTED, SV_MACE }
1764 { TV_SORCERY_BOOK, 0 }, /* Hack: for realm1 book */
1765 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1766 { TV_SWORD, SV_DAGGER }
1771 { TV_NATURE_BOOK, 0 },
1772 { TV_DEATH_BOOK, 0 }, /* Hack: for realm2 book */
1773 { TV_SWORD, SV_DAGGER }
1778 { TV_SORCERY_BOOK, 0 },
1779 { TV_SCROLL, SV_SCROLL_PROTECTION_FROM_EVIL },
1780 { TV_SWORD, SV_BROAD_SWORD }
1785 { TV_SORCERY_BOOK, 0 }, /* Hack: for realm1 book */
1786 { TV_DEATH_BOOK, 0 }, /* Hack: for realm2 book */
1787 { TV_SWORD, SV_SHORT_SWORD }
1792 { TV_SORCERY_BOOK, 0 }, /* Hack: For realm1 book */
1793 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
1794 { TV_SWORD, SV_BROAD_SWORD }
1799 { TV_SORCERY_BOOK, 0 },
1800 { TV_POTION, SV_POTION_SPEED },
1801 { TV_POTION, SV_POTION_HEROISM }
1806 { TV_POTION, SV_POTION_SPEED },
1807 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1808 { TV_SWORD, SV_SMALL_SWORD }
1813 { TV_SORCERY_BOOK, 0 }, /* Hack: for realm1 book */
1814 { TV_RING, SV_RING_SUSTAIN_INT},
1815 { TV_SWORD, SV_DAGGER }
1820 { TV_FOOD, SV_FOOD_JERKY},
1821 { TV_SCROLL, SV_SCROLL_MAPPING },
1827 { TV_POTION, SV_POTION_SPEED },
1828 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1829 { TV_SWORD, SV_SHORT_SWORD}
1834 { TV_TRUMP_BOOK, 0 },
1835 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1836 { TV_POLEARM, SV_SPEAR}
1841 { TV_HAFTED, SV_WIZSTAFF }, /* Hack: for realm1 book */
1842 { TV_RING, SV_RING_SUSTAIN_INT},
1843 { TV_WAND, SV_WAND_MAGIC_MISSILE }
1848 { TV_BOW, SV_SHORT_BOW },
1849 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL},
1850 { TV_SWORD, SV_SHORT_SWORD },
1855 { TV_WAND, SV_WAND_MAGIC_MISSILE },
1856 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR},
1857 { TV_SWORD, SV_SHORT_SWORD },
1862 { TV_MUSIC_BOOK, 0 },
1863 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR},
1864 { TV_SWORD, SV_SHORT_SWORD },
1869 { TV_ARCANE_BOOK, 0 },
1870 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR},
1871 { TV_SWORD, SV_SHORT_SWORD },
1876 { TV_HISSATSU_BOOK, 0 },
1877 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1878 { TV_SWORD, SV_BROAD_SWORD }
1883 { TV_SORCERY_BOOK, 0 },
1884 { TV_POTION, SV_POTION_SPEED },
1885 { TV_POTION, SV_POTION_RESTORE_MANA }
1890 { TV_SOFT_ARMOR, SV_ROBE },
1891 { TV_WAND, SV_WAND_MAGIC_MISSILE },
1892 { TV_SWORD, SV_DAGGER }
1897 { TV_BOW, SV_SHORT_BOW },
1898 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL},
1899 { TV_POLEARM, SV_BROAD_SPEAR}
1904 { TV_POTION, SV_POTION_HEALING },
1905 { TV_HARD_ARMOR, SV_AUGMENTED_CHAIN_MAIL },
1906 { TV_POLEARM, SV_BROAD_AXE }
1911 { TV_RING, SV_RING_RES_FEAR }, /* Warriors need it! */
1912 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1913 { TV_POLEARM, SV_BROAD_AXE }
1917 { TV_POTION, SV_POTION_SPEED },
1918 { TV_RING, SV_RING_SUSTAIN_INT},
1919 { TV_SWORD, SV_DAGGER }
1923 { TV_POTION, SV_POTION_SPEED },
1924 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1925 { TV_SWORD, SV_DAGGER }
1929 { TV_BOW, SV_LIGHT_XBOW },
1930 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1931 { TV_SWORD, SV_DAGGER }
1936 * @brief 初期所持アイテムの処理 / Add an outfit object
1937 * @details アイテムを既知のものとした上でwield_all()関数により装備させる。
1938 * @param o_ptr 処理したいオブジェクト構造体の参照ポインタ
1941 static void add_outfit(player_type *creature_ptr, object_type *o_ptr)
1945 object_aware(creature_ptr, o_ptr);
1946 object_known(o_ptr);
1947 slot = inven_carry(creature_ptr, o_ptr);
1949 /* Auto-inscription */
1950 autopick_alter_item(creature_ptr, slot, FALSE);
1952 /* Now try wielding everything */
1953 wield_all(creature_ptr);
1958 * @brief 種族/職業/性格などに基づき初期所持アイテムを設定するメインセット関数。 / Init players with some belongings
1959 * @details Having an item makes the player "aware" of its purpose.
1962 void player_outfit(player_type *creature_ptr)
1965 OBJECT_TYPE_VALUE tv;
1966 OBJECT_SUBTYPE_VALUE sv;
1973 /* Give the player some food */
1974 switch (creature_ptr->prace)
1978 /* Vampires can drain blood of creatures */
1982 /* Demon can drain vitality from humanoid corpse */
1983 get_mon_num_prep(creature_ptr, monster_hook_human, NULL);
1985 for (i = rand_range(3, 4); i > 0; i--)
1987 object_prep(q_ptr, lookup_kind(TV_CORPSE, SV_CORPSE));
1988 q_ptr->pval = get_mon_num(creature_ptr, 2, 0);
1992 add_outfit(creature_ptr, q_ptr);
2001 /* Staff (of Nothing) */
2002 object_prep(q_ptr, lookup_kind(TV_STAFF, SV_STAFF_NOTHING));
2005 add_outfit(creature_ptr, q_ptr);
2009 /* Potions of Water */
2010 object_prep(q_ptr, lookup_kind(TV_POTION, SV_POTION_WATER));
2011 q_ptr->number = (ITEM_NUMBER)rand_range(15, 23);
2012 add_outfit(creature_ptr, q_ptr);
2018 object_prep(q_ptr, lookup_kind(TV_FLASK, SV_ANY));
2020 /* Fuel with oil (move pval to xtra4) */
2021 apply_magic(creature_ptr, q_ptr, 1, AM_NO_FIXED_ART);
2023 q_ptr->number = (ITEM_NUMBER)rand_range(7, 12);
2024 add_outfit(creature_ptr, q_ptr);
2030 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
2031 q_ptr->number = (ITEM_NUMBER)rand_range(3, 7);
2033 add_outfit(creature_ptr, q_ptr);
2037 if ((creature_ptr->prace == RACE_VAMPIRE) && (creature_ptr->pclass != CLASS_NINJA))
2039 /* Hack -- Give the player scrolls of DARKNESS! */
2040 object_prep(q_ptr, lookup_kind(TV_SCROLL, SV_SCROLL_DARKNESS));
2042 q_ptr->number = (ITEM_NUMBER)rand_range(2, 5);
2044 add_outfit(creature_ptr, q_ptr);
2046 else if (creature_ptr->pclass != CLASS_NINJA)
2048 /* Hack -- Give the player some torches */
2049 object_prep(q_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH));
2050 q_ptr->number = (ITEM_NUMBER)rand_range(3, 7);
2051 q_ptr->xtra4 = rand_range(3, 7) * 500;
2053 add_outfit(creature_ptr, q_ptr);
2057 if (creature_ptr->prace == RACE_MERFOLK)
2059 object_prep(q_ptr, lookup_kind(TV_RING, SV_RING_LEVITATION_FALL));
2061 add_outfit(creature_ptr, q_ptr);
2064 if ((creature_ptr->pclass == CLASS_RANGER) || (creature_ptr->pclass == CLASS_CAVALRY))
2066 /* Hack -- Give the player some arrows */
2067 object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL));
2068 q_ptr->number = (byte)rand_range(15, 20);
2070 add_outfit(creature_ptr, q_ptr);
2072 if (creature_ptr->pclass == CLASS_RANGER)
2074 /* Hack -- Give the player some arrows */
2075 object_prep(q_ptr, lookup_kind(TV_BOW, SV_SHORT_BOW));
2077 add_outfit(creature_ptr, q_ptr);
2079 else if (creature_ptr->pclass == CLASS_ARCHER)
2081 /* Hack -- Give the player some arrows */
2082 object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL));
2083 q_ptr->number = (ITEM_NUMBER)rand_range(15, 20);
2085 add_outfit(creature_ptr, q_ptr);
2087 else if (creature_ptr->pclass == CLASS_HIGH_MAGE)
2089 /* Hack -- Give the player some arrows */
2090 object_prep(q_ptr, lookup_kind(TV_WAND, SV_WAND_MAGIC_MISSILE));
2092 q_ptr->pval = (PARAMETER_VALUE)rand_range(25, 30);
2094 add_outfit(creature_ptr, q_ptr);
2096 else if (creature_ptr->pclass == CLASS_SORCERER)
2098 OBJECT_TYPE_VALUE book_tval;
2099 for (book_tval = TV_LIFE_BOOK; book_tval <= TV_LIFE_BOOK + MAX_MAGIC - 1; book_tval++)
2101 /* Hack -- Give the player some arrows */
2102 object_prep(q_ptr, lookup_kind(book_tval, 0));
2105 add_outfit(creature_ptr, q_ptr);
2108 else if (creature_ptr->pclass == CLASS_TOURIST)
2110 if (creature_ptr->pseikaku != SEIKAKU_SEXY)
2112 /* Hack -- Give the player some arrows */
2113 object_prep(q_ptr, lookup_kind(TV_SHOT, SV_AMMO_LIGHT));
2114 q_ptr->number = rand_range(15, 20);
2116 add_outfit(creature_ptr, q_ptr);
2119 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_BISCUIT));
2120 q_ptr->number = rand_range(2, 4);
2122 add_outfit(creature_ptr, q_ptr);
2124 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_WAYBREAD));
2125 q_ptr->number = rand_range(2, 4);
2127 add_outfit(creature_ptr, q_ptr);
2129 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_JERKY));
2130 q_ptr->number = rand_range(1, 3);
2132 add_outfit(creature_ptr, q_ptr);
2134 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_PINT_OF_ALE));
2135 q_ptr->number = rand_range(2, 4);
2137 add_outfit(creature_ptr, q_ptr);
2139 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_PINT_OF_WINE));
2140 q_ptr->number = rand_range(2, 4);
2142 add_outfit(creature_ptr, q_ptr);
2144 else if (creature_ptr->pclass == CLASS_NINJA)
2146 /* Hack -- Give the player some arrows */
2147 object_prep(q_ptr, lookup_kind(TV_SPIKE, 0));
2148 q_ptr->number = rand_range(15, 20);
2150 add_outfit(creature_ptr, q_ptr);
2152 else if (creature_ptr->pclass == CLASS_SNIPER)
2154 /* Hack -- Give the player some bolts */
2155 object_prep(q_ptr, lookup_kind(TV_BOLT, SV_AMMO_NORMAL));
2156 q_ptr->number = rand_range(15, 20);
2158 add_outfit(creature_ptr, q_ptr);
2161 if (creature_ptr->pseikaku == SEIKAKU_SEXY)
2163 player_init[creature_ptr->pclass][2][0] = TV_HAFTED;
2164 player_init[creature_ptr->pclass][2][1] = SV_WHIP;
2167 /* Hack -- Give the player three useful objects */
2168 for (i = 0; i < 3; i++)
2170 /* Look up standard equipment */
2171 tv = player_init[creature_ptr->pclass][i][0];
2172 sv = player_init[creature_ptr->pclass][i][1];
2174 if ((creature_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue;
2175 /* Hack to initialize spellbooks */
2176 if (tv == TV_SORCERY_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm1 - 1;
2177 else if (tv == TV_DEATH_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm2 - 1;
2179 else if (tv == TV_RING && sv == SV_RING_RES_FEAR &&
2180 creature_ptr->prace == RACE_BARBARIAN)
2181 /* Barbarians do not need a ring of resist fear */
2182 sv = SV_RING_SUSTAIN_STR;
2184 else if (tv == TV_RING && sv == SV_RING_SUSTAIN_INT && creature_ptr->prace == RACE_MIND_FLAYER)
2187 sv = SV_POTION_RESTORE_MANA;
2191 /* Hack -- Give the player an object */
2192 object_prep(q_ptr, lookup_kind(tv, sv));
2194 /* Assassins begin the game with a poisoned dagger */
2195 if ((tv == TV_SWORD || tv == TV_HAFTED) && (creature_ptr->pclass == CLASS_ROGUE &&
2196 creature_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */
2198 q_ptr->name2 = EGO_BRAND_POIS;
2201 add_outfit(creature_ptr, q_ptr);
2204 /* Hack -- make aware of the water */
2205 k_info[lookup_kind(TV_POTION, SV_POTION_WATER)].aware = TRUE;
2209 * @brief プレイヤーの種族選択を行う / Player race
2212 static bool get_player_race(player_type *creature_ptr)
2217 char sym[MAX_RACES];
2219 char buf[80], cur[80];
2223 put_str(_("注意:《種族》によってキャラクターの先天的な資質やボーナスが変化します。",
2224 "Note: Your 'race' determines various intrinsic factors and bonuses."), 23, 5);
2227 for (n = 0; n < MAX_RACES; n++)
2230 rp_ptr = &race_info[n];
2231 str = rp_ptr->title;
2237 sym[n] = ('A' + n - 26);
2238 sprintf(buf, "%c%c%s", sym[n], p2, str);
2239 put_str(buf, 12 + (n / 5), 1 + 16 * (n % 5));
2243 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2247 cs = creature_ptr->prace;
2254 c_put_str(TERM_WHITE, cur, 12 + (os / 5), 1 + 16 * (os % 5));
2255 put_str(" ", 3, 40);
2256 if (cs == MAX_RACES)
2258 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2259 put_str(" ", 4, 40);
2260 put_str(" ", 5, 40);
2264 rp_ptr = &race_info[cs];
2265 str = rp_ptr->title;
2266 sprintf(cur, "%c%c%s", sym[cs], p2, str);
2267 c_put_str(TERM_L_BLUE, rp_ptr->title, 3, 40);
2268 put_str(_("腕力 知能 賢さ 器用 耐久 魅力 経験 ", "Str Int Wis Dex Con Chr EXP "), 4, 40);
2269 put_str(_("の種族修正", ": Race modification"), 3, 40 + strlen(rp_ptr->title));
2271 sprintf(buf, "%+3d %+3d %+3d %+3d %+3d %+3d %+4d%% ",
2272 rp_ptr->r_adj[0], rp_ptr->r_adj[1], rp_ptr->r_adj[2], rp_ptr->r_adj[3],
2273 rp_ptr->r_adj[4], rp_ptr->r_adj[5], (rp_ptr->r_exp - 100));
2274 c_put_str(TERM_L_BLUE, buf, 5, 40);
2276 c_put_str(TERM_YELLOW, cur, 12 + (cs / 5), 1 + 16 * (cs % 5));
2282 sprintf(buf, _("種族を選んで下さい (%c-%c) ('='初期オプション設定): ", "Choose a race (%c-%c) ('=' for options): "), sym[0], sym[MAX_RACES - 1]);
2284 put_str(buf, 10, 10);
2286 if (c == 'Q') birth_quit();
2287 if (c == 'S') return FALSE;
2288 if (c == ' ' || c == '\r' || c == '\n')
2290 if (cs == MAX_RACES)
2292 k = randint0(MAX_RACES);
2304 k = randint0(MAX_RACES);
2310 if (cs >= 5) cs -= 5;
2318 if (cs < MAX_RACES) cs++;
2322 if ((cs + 5) <= MAX_RACES) cs += 5;
2324 k = (islower(c) ? A2I(c) : -1);
2325 if ((k >= 0) && (k < MAX_RACES))
2330 k = (isupper(c) ? (26 + c - 'A') : -1);
2331 if ((k >= 26) && (k < MAX_RACES))
2340 show_help(creature_ptr, "jraceclas.txt#TheRaces");
2342 show_help(creature_ptr, "raceclas.txt#TheRaces");
2348 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
2351 else if (c != '2' && c != '4' && c != '6' && c != '8') bell();
2355 creature_ptr->prace = (byte)k;
2357 rp_ptr = &race_info[creature_ptr->prace];
2360 c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15);
2368 * @brief プレイヤーの職業選択を行う / Player class
2371 static bool get_player_class(player_type *creature_ptr)
2375 char sym[MAX_CLASS_CHOICE];
2377 char buf[80], cur[80];
2383 put_str(_("注意:《職業》によってキャラクターの先天的な能力やボーナスが変化します。",
2384 "Note: Your 'class' determines various intrinsic abilities and bonuses."), 23, 5);
2386 put_str(_("()で囲まれた選択肢はこの種族には似合わない職業です。",
2387 "Any entries in parentheses should only be used by advanced players."), 11, 5);
2391 for (n = 0; n < MAX_CLASS_CHOICE; n++)
2394 cp_ptr = &class_info[n];
2395 mp_ptr = &m_info[n];
2396 str = cp_ptr->title;
2400 sym[n] = ('A' + n - 26);
2403 if (!(rp_ptr->choice & (1L << n)))
2404 sprintf(buf, "%c%c(%s)", sym[n], p2, str);
2406 sprintf(buf, "%c%c%s", sym[n], p2, str);
2408 put_str(buf, 13 + (n / 4), 2 + 19 * (n % 4));
2411 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2415 cs = creature_ptr->pclass;
2416 os = MAX_CLASS_CHOICE;
2422 c_put_str(TERM_WHITE, cur, 13 + (os / 4), 2 + 19 * (os % 4));
2423 put_str(" ", 3, 40);
2424 if (cs == MAX_CLASS_CHOICE)
2426 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2427 put_str(" ", 4, 40);
2428 put_str(" ", 5, 40);
2432 cp_ptr = &class_info[cs];
2433 mp_ptr = &m_info[cs];
2434 str = cp_ptr->title;
2435 if (!(rp_ptr->choice & (1L << cs)))
2436 sprintf(cur, "%c%c(%s)", sym[cs], p2, str);
2438 sprintf(cur, "%c%c%s", sym[cs], p2, str);
2440 c_put_str(TERM_L_BLUE, cp_ptr->title, 3, 40);
2441 put_str(_("の職業修正", ": Class modification"), 3, 40 + strlen(cp_ptr->title));
2442 put_str(_("腕力 知能 賢さ 器用 耐久 魅力 経験 ", "Str Int Wis Dex Con Chr EXP "), 4, 40);
2443 sprintf(buf, "%+3d %+3d %+3d %+3d %+3d %+3d %+4d%% ",
2444 cp_ptr->c_adj[0], cp_ptr->c_adj[1], cp_ptr->c_adj[2], cp_ptr->c_adj[3],
2445 cp_ptr->c_adj[4], cp_ptr->c_adj[5], cp_ptr->c_exp);
2446 c_put_str(TERM_L_BLUE, buf, 5, 40);
2448 c_put_str(TERM_YELLOW, cur, 13 + (cs / 4), 2 + 19 * (cs % 4));
2454 sprintf(buf, _("職業を選んで下さい (%c-%c) ('='初期オプション設定): ", "Choose a class (%c-%c) ('=' for options): "), sym[0], sym[MAX_CLASS_CHOICE - 1]);
2456 put_str(buf, 10, 10);
2458 if (c == 'Q') birth_quit();
2459 if (c == 'S') return FALSE;
2460 if (c == ' ' || c == '\r' || c == '\n')
2462 if (cs == MAX_CLASS_CHOICE)
2464 k = randint0(MAX_CLASS_CHOICE);
2476 k = randint0(MAX_CLASS_CHOICE);
2482 if (cs >= 4) cs -= 4;
2490 if (cs < MAX_CLASS_CHOICE) cs++;
2494 if ((cs + 4) <= MAX_CLASS_CHOICE) cs += 4;
2496 k = (islower(c) ? A2I(c) : -1);
2497 if ((k >= 0) && (k < MAX_CLASS_CHOICE))
2502 k = (isupper(c) ? (26 + c - 'A') : -1);
2503 if ((k >= 26) && (k < MAX_CLASS_CHOICE))
2512 show_help(creature_ptr, "jraceclas.txt#TheClasses");
2514 show_help(creature_ptr, "raceclas.txt#TheClasses");
2520 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
2523 else if (c != '2' && c != '4' && c != '6' && c != '8') bell();
2527 creature_ptr->pclass = (byte)k;
2528 cp_ptr = &class_info[creature_ptr->pclass];
2529 mp_ptr = &m_info[creature_ptr->pclass];
2532 c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15);
2539 * @brief プレイヤーの性格選択を行う / Player Player seikaku
2542 static bool get_player_seikaku(player_type *creature_ptr)
2547 char sym[MAX_SEIKAKU];
2549 char buf[80], cur[80];
2555 put_str(_("注意:《性格》によってキャラクターの能力やボーナスが変化します。", "Note: Your personality determines various intrinsic abilities and bonuses."), 23, 5);
2558 for (n = 0; n < MAX_SEIKAKU; n++)
2560 if (seikaku_info[n].sex && (seikaku_info[n].sex != (creature_ptr->psex + 1))) continue;
2563 ap_ptr = &seikaku_info[n];
2564 str = ap_ptr->title;
2568 sym[n] = ('A' + n - 26);
2571 sprintf(buf, "%c%c%s", I2A(n), p2, str);
2572 put_str(buf, 12 + (n / 4), 2 + 18 * (n % 4));
2575 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2579 cs = creature_ptr->pseikaku;
2586 c_put_str(TERM_WHITE, cur, 12 + (os / 4), 2 + 18 * (os % 4));
2587 put_str(" ", 3, 40);
2588 if (cs == MAX_SEIKAKU)
2590 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
2591 put_str(" ", 4, 40);
2592 put_str(" ", 5, 40);
2596 ap_ptr = &seikaku_info[cs];
2597 str = ap_ptr->title;
2598 sprintf(cur, "%c%c%s", sym[cs], p2, str);
2599 c_put_str(TERM_L_BLUE, ap_ptr->title, 3, 40);
2600 put_str(_("の性格修正", ": Personality modification"), 3, 40 + strlen(ap_ptr->title));
2601 put_str(_("腕力 知能 賢さ 器用 耐久 魅力 ", "Str Int Wis Dex Con Chr "), 4, 40);
2602 sprintf(buf, "%+3d %+3d %+3d %+3d %+3d %+3d ",
2603 ap_ptr->a_adj[0], ap_ptr->a_adj[1], ap_ptr->a_adj[2], ap_ptr->a_adj[3],
2604 ap_ptr->a_adj[4], ap_ptr->a_adj[5]);
2605 c_put_str(TERM_L_BLUE, buf, 5, 40);
2607 c_put_str(TERM_YELLOW, cur, 12 + (cs / 4), 2 + 18 * (cs % 4));
2613 sprintf(buf, _("性格を選んで下さい (%c-%c) ('='初期オプション設定): ", "Choose a personality (%c-%c) ('=' for options): "), sym[0], sym[MAX_SEIKAKU - 1]);
2615 put_str(buf, 10, 10);
2617 if (c == 'Q') birth_quit();
2618 if (c == 'S') return FALSE;
2619 if (c == ' ' || c == '\r' || c == '\n')
2621 if (cs == MAX_SEIKAKU)
2625 k = randint0(MAX_SEIKAKU);
2626 } while (seikaku_info[k].sex && (seikaku_info[k].sex != (creature_ptr->psex + 1)));
2641 } while (seikaku_info[k].sex && (seikaku_info[k].sex != (creature_ptr->psex + 1)));
2647 if (cs >= 4) cs -= 4;
2648 if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex + 1)))
2659 if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex + 1)))
2669 if (cs < MAX_SEIKAKU) cs++;
2670 if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex + 1)))
2672 if ((cs + 1) <= MAX_SEIKAKU)
2680 if ((cs + 4) <= MAX_SEIKAKU) cs += 4;
2681 if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex + 1)))
2683 if ((cs + 4) <= MAX_SEIKAKU)
2689 k = (islower(c) ? A2I(c) : -1);
2690 if ((k >= 0) && (k < MAX_SEIKAKU))
2692 if ((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (creature_ptr->psex + 1)))
2698 k = (isupper(c) ? (26 + c - 'A') : -1);
2699 if ((k >= 26) && (k < MAX_SEIKAKU))
2701 if ((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (creature_ptr->psex + 1)))
2711 show_help(creature_ptr, "jraceclas.txt#ThePersonalities");
2713 show_help(creature_ptr, "raceclas.txt#ThePersonalities");
2719 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
2722 else if (c != '2' && c != '4' && c != '6' && c != '8') bell();
2726 creature_ptr->pseikaku = (CHARACTER_IDX)k;
2727 ap_ptr = &seikaku_info[creature_ptr->pseikaku];
2729 strcpy(tmp, ap_ptr->title);
2730 if (ap_ptr->no == 1)
2733 strcpy(tmp, ap_ptr->title);
2736 strcat(tmp, creature_ptr->name);
2738 c_put_str(TERM_L_BLUE, tmp, 1, 34);
2744 * @brief オートローラで得たい能力値の基準を決める。
2745 * @param creature_ptr プレーヤーへの参照ポインタ
2748 static bool get_stat_limits(player_type *creature_ptr)
2750 int i, j, m, cs, os;
2753 char buf[80], cur[80];
2759 /* Extra infomation */
2760 put_str(_("最低限得たい能力値を設定して下さい。", "Set minimum stats."), 10, 10);
2761 put_str(_("2/8で項目選択、4/6で値の増減、Enterで次へ", "2/8 for Select, 4/6 for Change value, Enter for Goto next"), 11, 10);
2763 put_str(_(" 基本値 種族 職業 性格 合計値 最大値", " Base Rac Cla Per Total Maximum"), 13, 10);
2765 /* Output the maximum stats */
2766 for (i = 0; i < A_MAX; i++)
2768 /* Reset the "success" counter */
2772 /* Race/Class bonus */
2773 j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
2775 /* Obtain the "maximal" stat */
2776 m = adjust_stat(17, j);
2781 sprintf(cur, "18/%02d", (m - 18));
2787 sprintf(cur, "%2d", m);
2790 /* Obtain the current stat */
2791 m = adjust_stat(cval[i], j);
2796 sprintf(inp, "18/%02d", (m - 18));
2802 sprintf(inp, "%2d", m);
2805 /* Prepare a prompt */
2806 sprintf(buf, "%6s %2d %+3d %+3d %+3d = %6s %6s",
2807 stat_names[i], cval[i], rp_ptr->r_adj[i], cp_ptr->c_adj[i],
2808 ap_ptr->a_adj[i], inp, cur);
2810 /* Dump the prompt */
2811 put_str(buf, 14 + i, 10);
2814 /* Get a minimum stat */
2824 c_put_str(TERM_WHITE, _("決定する", "Accept"), 21, 35);
2826 else if (os < A_MAX)
2828 c_put_str(TERM_WHITE, cur, 14 + os, 10);
2832 c_put_str(TERM_YELLOW, _("決定する", "Accept"), 21, 35);
2836 /* Race/Class bonus */
2837 j = rp_ptr->r_adj[cs] + cp_ptr->c_adj[cs] + ap_ptr->a_adj[cs];
2839 /* Obtain the current stat */
2840 m = adjust_stat(cval[cs], j);
2845 sprintf(inp, "18/%02d", (m - 18));
2851 sprintf(inp, "%2d", m);
2854 /* Prepare a prompt */
2855 sprintf(cur, "%6s %2d %+3d %+3d %+3d = %6s",
2856 stat_names[cs], cval[cs], rp_ptr->r_adj[cs],
2857 cp_ptr->c_adj[cs], ap_ptr->a_adj[cs], inp);
2858 c_put_str(TERM_YELLOW, cur, 14 + cs, 10);
2863 /* Prompt for the minimum stats */
2886 if (cs < A_MAX) cs++;
2897 else if (cval[cs] > 3)
2914 else if (cval[cs] < 17)
2938 show_help(creature_ptr, "jbirth.txt#AutoRoller");
2940 show_help(creature_ptr, "birth.txt#AutoRoller");
2946 do_cmd_options_aux(OPT_PAGE_BIRTH, "初期オプション((*)はスコアに影響)");
2948 do_cmd_options_aux(OPT_PAGE_BIRTH, "Birth Option((*)s effect score)");
2957 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == 6))break;
2960 for (i = 0; i < A_MAX; i++)
2962 /* Save the minimum stat */
2963 stat_limit[i] = (s16b)cval[i];
2971 * @brief オートローラで得たい年齢、身長、体重、社会的地位の基準を決める。
2974 static bool get_chara_limits(player_type *creature_ptr)
2978 int i, j, m, cs, os;
2979 int mval[MAXITEMS], cval[MAXITEMS];
2980 int max_percent, min_percent;
2982 char buf[80], cur[80];
2983 concptr itemname[] = {
2985 _("身長(インチ)", "height"),
2986 _("体重(ポンド)", "weight"),
2987 _("社会的地位", "social class")
2992 /* Prompt for the minimum stats */
2993 put_str(_("2/4/6/8で項目選択、+/-で値の増減、Enterで次へ", "2/4/6/8 for Select, +/- for Change value, Enter for Goto next"), 11, 10);
2994 put_str(_("注意:身長と体重の最大値/最小値ぎりぎりの値は非常に出現確率が低くなります。", "Caution: Values near minimum or maximum are extremely rare."), 23, 2);
2996 if (creature_ptr->psex == SEX_MALE)
2998 max_percent = (int)(rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1) * 100 / (int)(rp_ptr->m_b_ht);
2999 min_percent = (int)(rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1) * 100 / (int)(rp_ptr->m_b_ht);
3003 max_percent = (int)(rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1) * 100 / (int)(rp_ptr->f_b_ht);
3004 min_percent = (int)(rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1) * 100 / (int)(rp_ptr->f_b_ht);
3007 put_str(_("体格/地位の最小値/最大値を設定して下さい。", "Set minimum/maximum attribute."), 10, 10);
3008 put_str(_(" 項 目 最小値 最大値", " Parameter Min Max"), 13, 20);
3010 /* Output the maximum stats */
3011 for (i = 0; i < MAXITEMS; i++)
3013 /* Obtain the "maximal" stat */
3016 case 0: /* Minimum age */
3017 m = rp_ptr->b_age + 1;
3019 case 1: /* Maximum age */
3020 m = rp_ptr->b_age + rp_ptr->m_age;
3023 case 2: /* Minimum height */
3024 if (creature_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht - rp_ptr->m_m_ht * 4 + 1;
3025 else m = rp_ptr->f_b_ht - rp_ptr->f_m_ht * 4 + 1;
3027 case 3: /* Maximum height */
3028 if (creature_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht + rp_ptr->m_m_ht * 4 - 1;
3029 else m = rp_ptr->f_b_ht + rp_ptr->f_m_ht * 4 - 1;
3031 case 4: /* Minimum weight */
3032 if (creature_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * min_percent / 100) - (rp_ptr->m_m_wt * min_percent / 75) + 1;
3033 else m = (rp_ptr->f_b_wt * min_percent / 100) - (rp_ptr->f_m_wt * min_percent / 75) + 1;
3035 case 5: /* Maximum weight */
3036 if (creature_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * max_percent / 100) + (rp_ptr->m_m_wt * max_percent / 75) - 1;
3037 else m = (rp_ptr->f_b_wt * max_percent / 100) + (rp_ptr->f_m_wt * max_percent / 75) - 1;
3039 case 6: /* Minimum social class */
3042 case 7: /* Maximum social class */
3050 /* Save the maximum or minimum */
3055 for (i = 0; i < 4; i++)
3057 /* Prepare a prompt */
3058 sprintf(buf, "%-12s (%3d - %3d)", itemname[i], mval[i * 2], mval[i * 2 + 1]);
3060 /* Dump the prompt */
3061 put_str(buf, 14 + i, 20);
3063 for (j = 0; j < 2; j++)
3065 sprintf(buf, " %3d", cval[i * 2 + j]);
3066 put_str(buf, 14 + i, 45 + 8 * j);
3070 /* Get a minimum stat */
3078 const char accept[] = _("決定する", "Accept");
3082 c_put_str(TERM_WHITE, accept, 19, 35);
3086 c_put_str(TERM_WHITE, cur, 14 + os / 2, 45 + 8 * (os % 2));
3091 c_put_str(TERM_YELLOW, accept, 19, 35);
3095 /* Prepare a prompt */
3096 sprintf(cur, " %3d", cval[cs]);
3097 c_put_str(TERM_YELLOW, cur, 14 + cs / 2, 45 + 8 * (cs % 2));
3102 /* Prompt for the minimum stats */
3111 break; /*後でもう一回breakせんと*/
3115 if (cs == MAXITEMS) break;
3121 if (cs - 2 >= 0) cs -= 2;
3125 if (cs < MAXITEMS) cs += 2;
3126 if (cs > MAXITEMS) cs = MAXITEMS;
3134 if (cs < MAXITEMS) cs++;
3142 if (cval[cs] > cval[cs - 1])
3150 if (cval[cs] > mval[cs])
3164 if (cval[cs] < mval[cs])
3172 if (cval[cs] < cval[cs + 1])
3185 if (cval[cs] < mval[cs])
3187 cval[cs] = mval[cs];
3193 if (cval[cs] < cval[cs + 1])
3195 cval[cs] = cval[cs + 1];
3206 if (cval[cs] > cval[cs - 1])
3208 cval[cs] = cval[cs - 1];
3214 if (cval[cs] > mval[cs])
3216 cval[cs] = mval[cs];
3224 show_help(creature_ptr, "jbirth.txt#AutoRoller");
3226 show_help(creature_ptr, "birth.txt#AutoRoller");
3231 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
3238 if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == MAXITEMS))break;
3241 /* Input the minimum stats */
3242 chara_limit.agemin = (s16b)cval[0];
3243 chara_limit.agemax = (s16b)cval[1];
3244 chara_limit.htmin = (s16b)cval[2];
3245 chara_limit.htmax = (s16b)cval[3];
3246 chara_limit.wtmin = (s16b)cval[4];
3247 chara_limit.wtmax = (s16b)cval[5];
3248 chara_limit.scmin = (s16b)cval[6];
3249 chara_limit.scmax = (s16b)cval[7];
3254 #define HISTPREF_LIMIT 1024
3255 static char *histpref_buf = NULL;
3258 * @brief 生い立ちメッセージの内容をバッファに加える。 / Hook function for reading the histpref.prf file.
3261 void add_history_from_pref_line(concptr t)
3263 /* Do nothing if the buffer is not ready */
3264 if (!histpref_buf) return;
3266 my_strcat(histpref_buf, t, HISTPREF_LIMIT);
3270 * @brief 生い立ちメッセージをファイルからロードする。
3273 static bool do_cmd_histpref(player_type *creature_ptr, void(*process_autopick_file_command)(char*))
3280 char histbuf[HISTPREF_LIMIT];
3282 if (!get_check(_("生い立ち設定ファイルをロードしますか? ", "Load background history preference file? "))) return FALSE;
3284 /* Prepare the buffer */
3286 histpref_buf = histbuf;
3289 sprintf(buf, "histedit-%s.prf", creature_ptr->base_name);
3291 sprintf(buf, "histpref-%s.prf", creature_ptr->base_name);
3293 err = process_histpref_file(creature_ptr, buf, process_autopick_file_command);
3295 /* Process 'hist????.prf' if 'hist????-<name>.prf' doesn't exist */
3299 strcpy(buf, "histedit.prf");
3301 strcpy(buf, "histpref.prf");
3303 err = process_histpref_file(creature_ptr, buf, process_autopick_file_command);
3308 msg_print(_("生い立ち設定ファイルの読み込みに失敗しました。", "Failed to load background history preference."));
3311 /* Kill the buffer */
3312 histpref_buf = NULL;
3316 else if (!histpref_buf[0])
3318 msg_print(_("有効な生い立ち設定はこのファイルにありません。", "There does not exist valid background history preference."));
3321 /* Kill the buffer */
3322 histpref_buf = NULL;
3327 /* Clear the previous history strings */
3328 for (i = 0; i < 4; i++) creature_ptr->history[i][0] = '\0';
3330 /* Skip leading spaces */
3331 for (s = histpref_buf; *s == ' '; s++) /* loop */;
3333 /* Get apparent length */
3336 /* Kill trailing spaces */
3337 while ((n > 0) && (s[n - 1] == ' ')) s[--n] = '\0';
3339 roff_to_buf(s, 60, temp, sizeof(temp));
3341 for (i = 0; i < 4; i++)
3343 if (t[0] == 0) break;
3346 strcpy(creature_ptr->history[i], t);
3351 /* Fill the remaining spaces */
3352 for (i = 0; i < 4; i++)
3354 for (j = 0; creature_ptr->history[i][j]; j++) /* loop */;
3356 for (; j < 59; j++) creature_ptr->history[i][j] = ' ';
3357 creature_ptr->history[i][59] = '\0';
3360 /* Kill the buffer */
3361 histpref_buf = NULL;
3367 * @brief 生い立ちメッセージを編集する。/Character background edit-mode
3370 static void edit_history(player_type *creature_ptr, void(*process_autopick_file_command)(char*))
3372 char old_history[4][60];
3373 TERM_LEN y = 0, x = 0;
3376 /* Edit character background */
3377 for (i = 0; i < 4; i++)
3379 sprintf(old_history[i], "%s", creature_ptr->history[i]);
3381 /* Turn 0 to space */
3382 for (i = 0; i < 4; i++)
3384 for (j = 0; creature_ptr->history[i][j]; j++) /* loop */;
3386 for (; j < 59; j++) creature_ptr->history[i][j] = ' ';
3387 creature_ptr->history[i][59] = '\0';
3390 display_player(creature_ptr, 1, map_name);
3392 c_put_str(TERM_L_GREEN, "(キャラクターの生い立ち - 編集モード)", 11, 20);
3393 put_str("[ カーソルキーで移動、Enterで終了、Ctrl-Aでファイル読み込み ]", 17, 10);
3395 c_put_str(TERM_L_GREEN, "(Character Background - Edit Mode)", 11, 20);
3396 put_str("[ Cursor key for Move, Enter for End, Ctrl-A for Read pref ]", 17, 10);
3404 for (i = 0; i < 4; i++)
3406 put_str(creature_ptr->history[i], i + 12, 10);
3409 if (iskanji2(creature_ptr->history[y], x))
3410 c_put_str(TERM_L_BLUE, format("%c%c", creature_ptr->history[y][x], creature_ptr->history[y][x + 1]), y + 12, x + 10);
3413 c_put_str(TERM_L_BLUE, format("%c", creature_ptr->history[y][x]), y + 12, x + 10);
3415 /* Place cursor just after cost of current stat */
3416 Term_gotoxy(x + 10, y + 12);
3418 /* Get special key code */
3419 skey = inkey_special(TRUE);
3421 /* Get a character code */
3422 if (!(skey & SKEY_MASK)) c = (char)skey;
3425 if (skey == SKEY_UP || c == KTRL('p'))
3430 if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--;
3433 else if (skey == SKEY_DOWN || c == KTRL('n'))
3438 if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--;
3441 else if (skey == SKEY_RIGHT || c == KTRL('f'))
3444 if (iskanji2(creature_ptr->history[y], x)) x++;
3453 else if (skey == SKEY_LEFT || c == KTRL('b'))
3467 if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--;
3470 else if (c == '\r' || c == '\n')
3472 Term_erase(0, 11, 255);
3473 Term_erase(0, 17, 255);
3475 put_str("(キャラクターの生い立ち - 編集済み)", 11, 20);
3477 put_str("(Character Background - Edited)", 11, 20);
3481 else if (c == ESCAPE)
3485 put_str("(キャラクターの生い立ち)", 11, 25);
3487 put_str("(Character Background)", 11, 25);
3490 for (i = 0; i < 4; i++)
3492 sprintf(creature_ptr->history[i], "%s", old_history[i]);
3493 put_str(creature_ptr->history[i], i + 12, 10);
3497 else if (c == KTRL('A'))
3499 if (do_cmd_histpref(creature_ptr, process_autopick_file_command))
3502 if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--;
3506 else if (c == '\010')
3519 creature_ptr->history[y][x] = ' ';
3521 if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1)))
3524 creature_ptr->history[y][x] = ' ';
3529 else if (iskanji(c) || isprint(c))
3531 else if (isprint(c)) /* BUGFIX */
3535 if (iskanji2(creature_ptr->history[y], x))
3537 creature_ptr->history[y][x + 1] = ' ';
3549 if (iskanji2(creature_ptr->history[y], x + 1))
3551 creature_ptr->history[y][x + 2] = ' ';
3554 creature_ptr->history[y][x++] = c;
3559 creature_ptr->history[y][x++] = c;
3567 } /* while (TRUE) */
3573 * @brief player_birth()関数のサブセット/Helper function for 'player_birth()'
3575 * The delay may be reduced, but is recommended to keep players
3576 * from continuously rolling up characters, which can be VERY
3577 * expensive CPU wise. And it cuts down on player stupidity.
3580 static bool player_birth_aux(player_type *creature_ptr, void(*process_autopick_file_command)(char*))
3582 int i, k, n, cs, os;
3597 char buf[80], cur[80];
3603 /* Title everything */
3604 put_str(_("名前 :", "Name :"), 1, 26);
3605 put_str(_("性別 :", "Sex :"), 3, 1);
3606 put_str(_("種族 :", "Race :"), 4, 1);
3607 put_str(_("職業 :", "Class :"), 5, 1);
3609 /* Dump the default name */
3610 c_put_str(TERM_L_BLUE, creature_ptr->name, 1, 34);
3612 /*** Instructions ***/
3614 /* Display some helpful information */
3615 put_str(_("キャラクターを作成します。('S'やり直す, 'Q'終了, '?'ヘルプ)", "Make your charactor. ('S' Restart, 'Q' Quit, '?' Help)"), 8, 10);
3617 /*** Player sex ***/
3620 put_str(_("注意:《性別》の違いはゲーム上ほとんど影響を及ぼしません。", "Note: Your 'sex' does not have any significant gameplay effects."), 23, 5);
3622 /* Prompt for "Sex" */
3623 for (n = 0; n < MAX_SEXES; n++)
3626 sp_ptr = &sex_info[n];
3630 sprintf(buf, "%c%c%s", I2A(n), p2, sp_ptr->title);
3632 sprintf(buf, "%c%c %s", I2A(n), p2, sp_ptr->title);
3634 put_str(buf, 12 + (n / 5), 2 + 15 * (n % 5));
3638 sprintf(cur, "%c%c%s", '*', p2, "ランダム");
3640 sprintf(cur, "%c%c %s", '*', p2, "Random");
3651 put_str(cur, 12 + (os / 5), 2 + 15 * (os % 5));
3652 if (cs == MAX_SEXES)
3654 sprintf(cur, "%c%c%s", '*', p2, "ランダム");
3656 sprintf(cur, "%c%c %s", '*', p2, "Random");
3660 sp_ptr = &sex_info[cs];
3661 str = sp_ptr->title;
3663 sprintf(cur, "%c%c%s", I2A(cs), p2, str);
3665 sprintf(cur, "%c%c %s", I2A(cs), p2, str);
3668 c_put_str(TERM_YELLOW, cur, 12 + (cs / 5), 2 + 15 * (cs % 5));
3675 sprintf(buf, "性別を選んで下さい (%c-%c) ('='初期オプション設定): ", I2A(0), I2A(n - 1));
3677 sprintf(buf, "Choose a sex (%c-%c) ('=' for options): ", I2A(0), I2A(n - 1));
3680 put_str(buf, 10, 10);
3682 if (c == 'Q') birth_quit();
3683 if (c == 'S') return FALSE;
3684 if (c == ' ' || c == '\r' || c == '\n')
3686 if (cs == MAX_SEXES)
3687 k = randint0(MAX_SEXES);
3694 k = randint0(MAX_SEXES);
3703 if (cs < MAX_SEXES) cs++;
3705 k = (islower(c) ? A2I(c) : -1);
3706 if ((k >= 0) && (k < MAX_SEXES))
3712 if (c == '?') do_cmd_help(creature_ptr);
3717 do_cmd_options_aux(OPT_PAGE_BIRTH, "初期オプション((*)はスコアに影響)");
3719 do_cmd_options_aux(OPT_PAGE_BIRTH, "Birth Option((*)s effect score)");
3724 else if (c != '4' && c != '6')bell();
3728 creature_ptr->psex = (byte)k;
3729 sp_ptr = &sex_info[creature_ptr->psex];
3732 c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 15);
3737 /* Choose the players race */
3738 creature_ptr->prace = 0;
3744 if (!get_player_race(creature_ptr)) return FALSE;
3748 roff_to_buf(race_explanations[creature_ptr->prace], 74, temp, sizeof(temp));
3751 for (i = 0; i < 10; i++)
3762 if (get_check_strict("よろしいですか?", CHECK_DEFAULT_Y)) break;
3764 if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
3767 c_put_str(TERM_WHITE, " ", 4, 15);
3773 /* Choose the players class */
3774 creature_ptr->pclass = 0;
3780 if (!get_player_class(creature_ptr)) return FALSE;
3783 roff_to_buf(class_explanations[creature_ptr->pclass], 74, temp, sizeof(temp));
3786 for (i = 0; i < 9; i++)
3798 if (get_check_strict("よろしいですか?", CHECK_DEFAULT_Y)) break;
3800 if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
3802 c_put_str(TERM_WHITE, " ", 5, 15);
3805 /* Choose the magic realms */
3806 if (!get_player_realms(creature_ptr)) return FALSE;
3808 /* Choose the players seikaku */
3809 creature_ptr->pseikaku = 0;
3815 if (!get_player_seikaku(creature_ptr)) return FALSE;
3818 roff_to_buf(seikaku_jouhou[creature_ptr->pseikaku], 74, temp, sizeof(temp));
3821 for (i = 0; i < A_MAX; i++)
3832 if (get_check_strict("よろしいですか?", CHECK_DEFAULT_Y)) break;
3834 if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
3836 c_put_str(TERM_L_BLUE, creature_ptr->name, 1, 34);
3837 prt("", 1, 34 + strlen(creature_ptr->name));
3842 put_str(" ", 3, 40);
3843 put_str(" ", 4, 40);
3844 put_str(" ", 5, 40);
3848 do_cmd_options_aux(OPT_PAGE_BIRTH, "初期オプション((*)はスコアに影響)");
3850 do_cmd_options_aux(OPT_PAGE_BIRTH, "Birth Option((*)s effect score)");
3855 if (autoroller || autochara)
3863 if (!get_stat_limits(creature_ptr)) return FALSE;
3868 if (!get_chara_limits(creature_ptr)) return FALSE;
3873 /* Reset turn; before auto-roll and after choosing race */
3874 init_turn(creature_ptr);
3885 if (autoroller || autochara)
3891 put_str("回数 :", 10, col + 13);
3893 put_str("Round:", 10, col + 13);
3897 /* Indicate the state */
3899 put_str("(ESCで停止)", 12, col + 13);
3901 put_str("(Hit ESC to stop)", 12, col + 13);
3905 /* Otherwise just get a character */
3908 get_stats(creature_ptr);
3909 get_ahw(creature_ptr);
3910 get_history(creature_ptr);
3918 put_str("最小値", 2, col + 5);
3920 put_str(" Limit", 2, col + 5);
3926 put_str("成功率", 2, col + 13);
3928 put_str(" Freq", 2, col + 13);
3934 put_str("現在値", 2, col + 24);
3936 put_str(" Roll", 2, col + 24);
3940 /* Put the minimal stats */
3941 for (i = 0; i < A_MAX; i++)
3946 put_str(stat_names[i], 3 + i, col);
3948 /* Race/Class bonus */
3949 j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
3951 /* Obtain the current stat */
3952 m = adjust_stat(stat_limit[i], j);
3956 c_put_str(TERM_L_BLUE, buf, 3 + i, col + 5);
3961 while (autoroller || autochara)
3965 /* Get a new character */
3966 get_stats(creature_ptr);
3968 /* Advance the round */
3971 /* Hack -- Prevent overflow */
3972 if (auto_round >= 1000000000L)
3978 for (i = 0; i < A_MAX; i++)
3987 /* Check and count acceptable stats */
3988 for (i = 0; i < A_MAX; i++)
3990 /* This stat is okay */
3991 if (creature_ptr->stat_max[i] >= stat_limit[i])
3996 /* This stat is not okay */
4004 /* Break if "happy" */
4007 get_ahw(creature_ptr);
4008 get_history(creature_ptr);
4012 if ((creature_ptr->age < chara_limit.agemin) || (creature_ptr->age > chara_limit.agemax)) accept = FALSE;
4013 if ((creature_ptr->ht < chara_limit.htmin) || (creature_ptr->ht > chara_limit.htmax)) accept = FALSE;
4014 if ((creature_ptr->wt < chara_limit.wtmin) || (creature_ptr->wt > chara_limit.wtmax)) accept = FALSE;
4015 if ((creature_ptr->sc < chara_limit.scmin) || (creature_ptr->sc > chara_limit.scmax)) accept = FALSE;
4020 /* Take note every x rolls */
4021 flag = (!(auto_round % AUTOROLLER_STEP));
4023 /* Update display occasionally */
4027 birth_put_stats(creature_ptr);
4030 put_str(format("%10ld", auto_round), 10, col + 20);
4032 /* Make sure they see everything */
4035 /* Do not wait for a key */
4038 /* Check for a keypress */
4041 get_ahw(creature_ptr);
4042 get_history(creature_ptr);
4048 if (autoroller || autochara) sound(SOUND_LEVEL);
4056 /* Roll for base hitpoints */
4057 get_extra(creature_ptr, TRUE);
4060 get_money(creature_ptr);
4062 /* Hack -- get a chaos patron even if you are not a chaos warrior */
4063 creature_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
4068 /* Calculate the bonuses and hitpoints */
4069 creature_ptr->update |= (PU_BONUS | PU_HP);
4070 update_creature(creature_ptr);
4072 creature_ptr->chp = creature_ptr->mhp;
4073 creature_ptr->csp = creature_ptr->msp;
4075 display_player(creature_ptr, mode, map_name);
4077 /* Prepare a prompt (must squeeze everything in) */
4079 Term_addch(TERM_WHITE, b1);
4080 Term_addstr(-1, TERM_WHITE, _("'r' 次の数値", "'r'eroll"));
4082 if (prev) Term_addstr(-1, TERM_WHITE, _(", 'p' 前の数値", "'p'previous"));
4083 if (mode) Term_addstr(-1, TERM_WHITE, _(", 'h' その他の情報", ", 'h' Misc."));
4084 else Term_addstr(-1, TERM_WHITE, _(", 'h' 生い立ちを表示", ", 'h'istory"));
4085 Term_addstr(-1, TERM_WHITE, _(", Enter この数値に決定", ", or Enter to accept"));
4086 Term_addch(TERM_WHITE, b2);
4091 if (c == 'Q') birth_quit();
4094 if (c == 'S') return FALSE;
4096 /* Escape accepts the roll */
4097 if (c == '\r' || c == '\n' || c == ESCAPE) break;
4099 /* Reroll this character */
4100 if ((c == ' ') || (c == 'r')) break;
4102 /* Previous character */
4103 if (prev && (c == 'p'))
4105 load_prev_data(creature_ptr, TRUE);
4109 if ((c == 'H') || (c == 'h'))
4111 mode = ((mode != 0) ? 0 : 1);
4119 show_help(creature_ptr, "jbirth.txt#AutoRoller");
4121 show_help(creature_ptr, "birth.txt#AutoRoller");
4128 do_cmd_options_aux(OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Option((*)s effect score)"));
4138 if (c == '\r' || c == '\n' || c == ESCAPE) break;
4140 /* Save this for the "previous" character */
4141 save_prev_data(creature_ptr, &previous_char);
4142 previous_char.quick_ok = FALSE;
4144 /* Note that a previous roll exists */
4151 /* Get a name, recolor it, prepare savefile */
4152 get_name(creature_ptr);
4154 /* Process the player name */
4155 process_player_name(creature_ptr, current_world_ptr->creating_savefile);
4157 /*** Edit character background ***/
4158 edit_history(creature_ptr, process_autopick_file_command);
4162 get_max_stats(creature_ptr);
4164 get_virtues(creature_ptr);
4168 prt("[ 'Q' 中断, 'S' 初めから, Enter ゲーム開始 ]", 23, 14);
4170 prt("['Q'uit, 'S'tart over, or Enter to continue]", 23, 10);
4178 if (c == 'Q') birth_quit();
4181 if (c == 'S') return FALSE;
4184 /* Initialize random quests */
4185 init_dungeon_quests(creature_ptr);
4187 /* Save character data for quick start */
4188 save_prev_data(creature_ptr, &previous_char);
4189 previous_char.quick_ok = TRUE;
4196 * @brief クイックスタート処理の問い合わせと実行を行う。/Ask whether the player use Quick Start or not.
4199 static bool ask_quick_start(player_type *creature_ptr)
4201 /* Doesn't have previous data */
4202 if (!previous_char.quick_ok) return FALSE;
4207 put_str(_("クイック・スタートを使うと以前と全く同じキャラクターで始められます。", "Do you want to use the quick start function(same character as your last one)."), 11, 2);
4214 put_str(_("クイック・スタートを使いますか?[y/N]", "Use quick start? [y/N]"), 14, 10);
4217 if (c == 'Q') quit(NULL);
4218 else if (c == 'S') return FALSE;
4222 show_help(creature_ptr, "jbirth.txt#QuickStart");
4224 show_help(creature_ptr, "birth.txt#QuickStart");
4227 else if ((c == 'y') || (c == 'Y'))
4239 load_prev_data(creature_ptr, FALSE);
4240 init_turn(creature_ptr);
4241 init_dungeon_quests(creature_ptr);
4243 sp_ptr = &sex_info[creature_ptr->psex];
4244 rp_ptr = &race_info[creature_ptr->prace];
4245 cp_ptr = &class_info[creature_ptr->pclass];
4246 mp_ptr = &m_info[creature_ptr->pclass];
4247 ap_ptr = &seikaku_info[creature_ptr->pseikaku];
4249 /* Calc hitdie, but don't roll */
4250 get_extra(creature_ptr, FALSE);
4252 creature_ptr->update |= (PU_BONUS | PU_HP);
4253 update_creature(creature_ptr);
4254 creature_ptr->chp = creature_ptr->mhp;
4255 creature_ptr->csp = creature_ptr->msp;
4257 /* Process the player name */
4258 process_player_name(creature_ptr, FALSE);
4265 * @brief プレイヤー作成処理のメインルーチン/ Create a new character.
4267 * Note that we may be called with "junk" leftover in the various
4268 * fields, so we must be sure to clear them first.
4271 void player_birth(player_type *creature_ptr, void(*process_autopick_file_command)(char*))
4276 current_world_ptr->play_time = 0;
4278 wipe_monsters_list(creature_ptr);
4280 /* Wipe the player */
4281 player_wipe_without_name(creature_ptr);
4283 /* Create a new character */
4286 if (!ask_quick_start(creature_ptr))
4288 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DEFAULT);
4290 /* No, normal start */
4293 /* Roll up a new character */
4294 if (player_birth_aux(creature_ptr, process_autopick_file_command)) break;
4296 /* Wipe the player */
4297 player_wipe_without_name(creature_ptr);
4301 /* Note player birth in the message recall */
4304 message_add("====================");
4308 exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "------- Started New Game -------"));
4309 exe_write_diary(creature_ptr, DIARY_DIALY, 0, NULL);
4311 sprintf(buf, _(" 性別に%sを選択した。", " chose %s gender."), sex_info[creature_ptr->psex].title);
4312 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
4314 sprintf(buf, _(" 種族に%sを選択した。", " chose %s race."), race_info[creature_ptr->prace].title);
4315 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
4317 sprintf(buf, _(" 職業に%sを選択した。", " chose %s class."), class_info[creature_ptr->pclass].title);
4318 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
4320 if (creature_ptr->realm1)
4322 sprintf(buf, _(" 魔法の領域に%s%sを選択した。", " chose %s%s."), realm_names[creature_ptr->realm1], creature_ptr->realm2 ? format(_("と%s", " and %s realms"), realm_names[creature_ptr->realm2]) : _("", " realm"));
4323 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
4326 sprintf(buf, _(" 性格に%sを選択した。", " chose %s personality."), seikaku_info[creature_ptr->pseikaku].title);
4327 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
4329 /* Init the shops */
4330 for (i = 1; i < max_towns; i++)
4332 for (j = 0; j < MAX_STORES; j++)
4338 /* Generate the random seeds for the wilderness */
4341 /* Give beastman a mutation at character birth */
4342 if (creature_ptr->prace == RACE_BEASTMAN) creature_ptr->hack_mutation = TRUE;
4343 else creature_ptr->hack_mutation = FALSE;
4345 /* Set the message window flag as default */
4346 if (!window_flag[1])
4347 window_flag[1] |= PW_MESSAGE;
4349 /* Set the inv/equip window flag as default */
4350 if (!window_flag[2])
4351 window_flag[2] |= PW_INVEN;
4355 * @brief プレイヤー作成処理中のステータス表示処理
4356 * @param fff ファイルポインタ
4359 void dump_yourself(player_type *creature_ptr, FILE *fff)
4367 roff_to_buf(race_explanations[creature_ptr->prace], 78, temp, sizeof(temp));
4368 fprintf(fff, "\n\n");
4369 fprintf(fff, _("種族: %s\n", "Race: %s\n"), race_info[creature_ptr->prace].title);
4372 for (i = 0; i < 10; i++)
4376 fprintf(fff, "%s\n", t);
4379 roff_to_buf(class_explanations[creature_ptr->pclass], 78, temp, sizeof(temp));
4381 fprintf(fff, _("職業: %s\n", "Class: %s\n"), class_info[creature_ptr->pclass].title);
4384 for (i = 0; i < 10; i++)
4388 fprintf(fff, "%s\n", t);
4391 roff_to_buf(seikaku_jouhou[creature_ptr->pseikaku], 78, temp, sizeof(temp));
4393 fprintf(fff, _("性格: %s\n", "Pesonality: %s\n"), seikaku_info[creature_ptr->pseikaku].title);
4396 for (i = 0; i < A_MAX; i++)
4400 fprintf(fff, "%s\n", t);
4404 if (creature_ptr->realm1)
4406 roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm1) - 1], 78, temp, sizeof(temp));
4407 fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm1]);
4410 for (i = 0; i < A_MAX; i++)
4414 fprintf(fff, "%s\n", t);
4419 if (creature_ptr->realm2)
4421 roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm2) - 1], 78, temp, sizeof(temp));
4422 fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm2]);
4425 for (i = 0; i < A_MAX; i++)
4429 fprintf(fff, "%s\n", t);