OSDN Git Service

Merge pull request #424 from backwardsEric/english-help-defend
[hengbandforosx/hengbandosx.git] / src / birth / birth-body-spec.cpp
1 #include "birth/birth-body-spec.h"
2 #include "player/player-personalities-types.h"
3 #include "player/player-race-types.h"
4 #include "player/player-race.h"
5
6 /*!
7  * @brief プレイヤーの身長体重を決める / Get character's height and weight
8  * @return なし
9  */
10 void get_height_weight(player_type *creature_ptr)
11 {
12     int deviation;
13     switch (creature_ptr->psex) {
14     case SEX_MALE:
15         creature_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
16         deviation = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
17         creature_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * deviation / 100, (int)(rp_ptr->m_m_wt) * deviation / 300);
18         return;
19     case SEX_FEMALE:
20         creature_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
21         deviation = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
22         creature_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * deviation / 100, (int)(rp_ptr->f_m_wt) * deviation / 300);
23     default:
24         return;
25     }
26 }
27
28 /*!
29  * @brief プレイヤーの年齢を決める。 / Computes character's age, height, and weight by henkma
30  * @details 内部でget_height_weight()も呼び出している。
31  * @return なし
32  */
33 void get_ahw(player_type *creature_ptr)
34 {
35     creature_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
36     get_height_weight(creature_ptr);
37 }
38
39 /*!
40  * @brief プレイヤーの初期所持金を決める。 / Get the player's starting money
41  * @param creature_ptr プレーヤーへの参照ポインタ
42  * @return なし
43  */
44 void get_money(player_type *creature_ptr)
45 {
46     int gold = (creature_ptr->sc * 6) + randint1(100) + 300;
47     if (creature_ptr->pclass == CLASS_TOURIST)
48         gold += 2000;
49
50     for (int i = 0; i < A_MAX; i++) {
51         if (creature_ptr->stat_max[i] >= 18 + 50)
52             gold -= 300;
53         else if (creature_ptr->stat_max[i] >= 18 + 20)
54             gold -= 200;
55         else if (creature_ptr->stat_max[i] > 18)
56             gold -= 150;
57         else
58             gold -= (creature_ptr->stat_max[i] - 8) * 10;
59     }
60
61     const int minimum_deposit = 100;
62     if (gold < minimum_deposit)
63         gold = minimum_deposit;
64
65     if (creature_ptr->pseikaku == PERSONALITY_LAZY)
66         gold /= 2;
67     else if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)
68         gold = 10000000;
69     if (creature_ptr->prace == RACE_ANDROID)
70         gold /= 5;
71
72     creature_ptr->au = gold;
73 }