OSDN Git Service

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