1 #include "player-status/player-basic-statistics.h"
2 #include "core/player-redraw-types.h"
3 #include "core/player-update-types.h"
4 #include "core/window-redrawer.h"
5 #include "mutation/mutation-flag-types.h"
6 #include "object/object-flags.h"
7 #include "player/mimic-info-table.h"
8 #include "player/player-class.h"
9 #include "player/player-personality.h"
10 #include "player/player-status.h"
11 #include "player/race-info-table.h"
12 #include "player/special-defense-types.h"
13 #include "realm/realm-hex-numbers.h"
14 #include "spell-realm/spells-hex.h"
15 #include "system/player-type-definition.h"
16 #include "util/bit-flags-calculator.h"
24 s16b PlayerBasicStatistics::modification_value()
26 return PlayerStatusBase::get_value();
31 * @return status_typeに対応するステータスの実値を返す
33 s16b PlayerBasicStatistics::get_value()
36 return this->owner_ptr->stat_index[(int)this->ability_type];
40 * @brief 基礎ステータス補正計算 - 種族
46 s16b PlayerBasicStatistics::race_value()
48 const player_race *tmp_rp_ptr;
49 if (this->owner_ptr->mimic_form)
50 tmp_rp_ptr = &mimic_info[this->owner_ptr->mimic_form];
52 tmp_rp_ptr = &race_info[this->owner_ptr->prace];
54 return tmp_rp_ptr->r_adj[this->ability_type];
58 * @brief ステータス補正計算 - 職業
64 s16b PlayerBasicStatistics::class_value()
66 const player_class *c_ptr = &class_info[this->owner_ptr->pclass];
67 return c_ptr->c_adj[this->ability_type];
71 * @brief ステータス補正計算 - 性格
77 s16b PlayerBasicStatistics::personality_value()
79 const player_personality *a_ptr = &personality_info[this->owner_ptr->pseikaku];
80 return a_ptr->a_adj[this->ability_type];
86 * * owner_ptrのステータスを更新する
88 void PlayerBasicStatistics::update_value()
91 this->update_top_status();
92 this->update_use_status();
93 this->update_index_status();
99 * * owner_ptrのステータス最大値を更新する
100 * * 更新対象はset_locals()で設定したstatus_typeで決定される
102 void PlayerBasicStatistics::update_top_status()
104 int status = (int)this->ability_type;
105 int top = modify_stat_value(this->owner_ptr->stat_max[status], this->owner_ptr->stat_add[status]);
107 if (this->owner_ptr->stat_top[status] != top) {
108 this->owner_ptr->stat_top[status] = (s16b)top;
109 set_bits(this->owner_ptr->redraw, PR_STATS);
110 set_bits(this->owner_ptr->window_flags, PW_PLAYER);
115 * @brief ステータス現在値更新の例外処理
116 * @param 通常処理されたステータスの値
117 * @returns 例外処理されたステータスの値
119 * * owner_ptrのステータス現在値を更新する際の例外処理
120 * * 派生クラスでoverrideして使用する。
122 s16b PlayerBasicStatistics::set_exception_use_status(s16b value)
128 * @brief ステータス現在値更新処理
130 * * owner_ptrのステータス現在値を更新する
131 * * 更新対象はset_locals()で設定したstatus_typeで決定される
133 void PlayerBasicStatistics::update_use_status()
135 int status = (int)this->ability_type;
136 s16b use = modify_stat_value(this->owner_ptr->stat_cur[status], this->owner_ptr->stat_add[status]);
138 use = this->set_exception_use_status(use);
140 if (this->owner_ptr->stat_use[status] != use) {
141 this->owner_ptr->stat_use[status] = (s16b)use;
142 set_bits(this->owner_ptr->redraw, PR_STATS);
143 set_bits(this->owner_ptr->window_flags, PW_PLAYER);
148 * @brief ステータス内部値更新処理
150 * * owner_ptrのステータス内部値を更新する
151 * * ステータス内部値は実際の数値処理に使われる0-37の整数値
152 * * 更新対象はset_locals()で設定したstatus_typeで決定される
154 void PlayerBasicStatistics::update_index_status()
156 int status = (int)this->ability_type;
158 if (this->owner_ptr->stat_use[status] <= 18)
159 index = (this->owner_ptr->stat_use[status] - 3);
160 else if (this->owner_ptr->stat_use[status] <= 18 + 219)
161 index = (15 + (this->owner_ptr->stat_use[status] - 18) / 10);
165 if (this->owner_ptr->stat_index[status] == index)
168 this->owner_ptr->stat_index[status] = (s16b)index;
169 if (status == A_CON) {
170 set_bits(this->owner_ptr->update, PU_HP);
171 } else if (status == A_INT) {
172 if (mp_ptr->spell_stat == A_INT) {
173 set_bits(this->owner_ptr->update, (PU_MANA | PU_SPELLS));
175 } else if (status == A_WIS) {
176 if (mp_ptr->spell_stat == A_WIS) {
177 set_bits(this->owner_ptr->update, (PU_MANA | PU_SPELLS));
179 } else if (status == A_CHR) {
180 if (mp_ptr->spell_stat == A_CHR) {
181 set_bits(this->owner_ptr->update, (PU_MANA | PU_SPELLS));
185 set_bits(this->owner_ptr->window_flags, PW_PLAYER);