1 #include "birth/birth-stat.h"
2 #include "core/player-redraw-types.h"
3 #include "sv-definition/sv-weapon-types.h"
4 #include "player/player-class.h"
5 #include "player/player-personality.h"
6 #include "player/player-personalities-types.h"
7 #include "player/player-race.h"
8 #include "player/player-skill.h"
9 #include "spell/spells-status.h"
10 #include "player/player-race-types.h"
13 * @brief プレイヤーの能力値表現に基づいて加減算を行う。
15 * @param amount 加減算する値
18 int adjust_stat(int value, int amount)
21 for (int i = 0; i < (0 - amount); i++) {
22 if (value >= 18 + 10) {
24 } else if (value > 18) {
26 } else if (value > 3) {
30 } else if (amount > 0) {
31 for (int i = 0; i < amount; i++) {
44 * @brief プレイヤーの能力値を一通りロールする。 / Roll for a characters stats
45 * @param creature_ptr プレーヤーへの参照ポインタ
48 * calc_bonuses()による、独立ステータスからの副次ステータス算出も行っている。
49 * For efficiency, we include a chunk of "calc_bonuses()".\n
51 void get_stats(player_type* creature_ptr)
55 for (int i = 0; i < 2; i++) {
56 s32b tmp = randint0(60 * 60 * 60);
59 /* Extract 5 + 1d3 + 1d4 + 1d5 */
69 creature_ptr->stat_cur[3 * i] = creature_ptr->stat_max[3 * i] = val;
71 /* Extract 5 + 1d3 + 1d4 + 1d5 */
81 creature_ptr->stat_cur[3 * i + 1] = creature_ptr->stat_max[3 * i + 1] = val;
88 val += (BASE_STATUS)tmp;
91 creature_ptr->stat_cur[3 * i + 2] = creature_ptr->stat_max[3 * i + 2] = val;
94 if ((sum > 42 + 5 * 6) && (sum < 57 + 5 * 6))
100 * @brief その他「オートローラ中は算出の対象にしない」副次ステータスを処理する / Roll for some info that the auto-roller ignores
103 void get_extra(player_type* creature_ptr, bool roll_hitdie)
105 if (creature_ptr->prace == RACE_ANDROID)
106 creature_ptr->expfact = rp_ptr->r_exp;
108 creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
110 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)))
111 creature_ptr->expfact -= 15;
113 /* Reset record of race/realm changes */
114 creature_ptr->start_race = creature_ptr->prace;
115 creature_ptr->old_race1 = 0L;
116 creature_ptr->old_race2 = 0L;
117 creature_ptr->old_realm = 0;
119 for (int i = 0; i < 64; i++) {
120 if (creature_ptr->pclass == CLASS_SORCERER)
121 creature_ptr->spell_exp[i] = SPELL_EXP_MASTER;
122 else if (creature_ptr->pclass == CLASS_RED_MAGE)
123 creature_ptr->spell_exp[i] = SPELL_EXP_SKILLED;
125 creature_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
128 for (int i = 0; i < 5; i++)
129 for (int j = 0; j < 64; j++)
130 creature_ptr->weapon_exp[i][j] = s_info[creature_ptr->pclass].w_start[i][j];
132 if ((creature_ptr->pseikaku == PERSONALITY_SEXY) && (creature_ptr->weapon_exp[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] < WEAPON_EXP_BEGINNER)) {
133 creature_ptr->weapon_exp[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_BEGINNER;
136 for (int i = 0; i < GINOU_MAX; i++)
137 creature_ptr->skill_exp[i] = s_info[creature_ptr->pclass].s_start[i];
139 if (creature_ptr->pclass == CLASS_SORCERER)
140 creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
142 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
145 roll_hitdice(creature_ptr, SPOP_NO_UPDATE);
147 creature_ptr->mhp = creature_ptr->player_hp[0];
151 * @brief プレイヤーの限界ステータスを決める。
152 * @param creature_ptr プレーヤーへの参照ポインタ
154 * @details 新生の薬やステータスシャッフルでもこの関数が呼ばれる
156 void get_max_stats(player_type* creature_ptr)
161 for (int i = 0; i < A_MAX; i++) {
162 dice[i] = randint1(7);
170 for (int i = 0; i < A_MAX; i++) {
171 BASE_STATUS max_max = 18 + 60 + dice[i] * 10;
172 creature_ptr->stat_max_max[i] = max_max;
173 if (creature_ptr->stat_max[i] > max_max)
174 creature_ptr->stat_max[i] = max_max;
175 if (creature_ptr->stat_cur[i] > max_max)
176 creature_ptr->stat_cur[i] = max_max;
179 creature_ptr->knowledge &= ~(KNOW_STAT);
180 creature_ptr->redraw |= (PR_STATS);