1 #include "player-status/player-stealth.h"
2 #include "mind/mind-ninja.h"
3 #include "mutation/mutation-flag-types.h"
4 #include "player-info/class-info.h"
5 #include "player-info/equipment-info.h"
6 #include "player-info/mimic-info-table.h"
7 #include "player-info/race-types.h"
8 #include "player/player-personality.h"
9 #include "player/player-skill.h"
10 #include "player/player-status-flags.h"
11 #include "player/player-status.h"
12 #include "player/race-info-table.h"
13 #include "spell-realm/spells-hex.h"
14 #include "system/object-type-definition.h"
15 #include "system/player-type-definition.h"
16 #include "util/bit-flags-calculator.h"
17 #include "util/enum-converter.h"
25 int16_t PlayerStealth::race_value()
27 const player_race_info *tmp_rp_ptr;
29 if (this->owner_ptr->mimic_form)
30 tmp_rp_ptr = &mimic_info[this->owner_ptr->mimic_form];
32 tmp_rp_ptr = &race_info[enum2i(this->owner_ptr->prace)];
34 return tmp_rp_ptr->r_stl;
43 int16_t PlayerStealth::personality_value()
45 const player_personality *a_ptr = &personality_info[this->owner_ptr->pseikaku];
50 * @brief 隠密能力計算 - 職業(基礎値)
55 int16_t PlayerStealth::class_base_value()
57 const player_class_info *c_ptr = &class_info[this->owner_ptr->pclass];
58 return c_ptr->c_stl + (c_ptr->x_stl * this->owner_ptr->lev / 10);
62 * @brief 隠密能力計算 - 職業(追加分)
65 * * 忍者がheavy_armorならば減算(-レベル/10)
66 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
68 int16_t PlayerStealth::class_value()
70 ACTION_SKILL_POWER result = 0;
72 if (this->owner_ptr->pclass == CLASS_NINJA) {
73 if (heavy_armor(this->owner_ptr)) {
74 result -= (this->owner_ptr->lev) / 10;
75 } else if ((!this->owner_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->owner_ptr))
76 && (!this->owner_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->owner_ptr))) {
77 result += (this->owner_ptr->lev) / 10;
88 * * 変異MUT3_XTRA_NOISで減算(-3)
89 * * 変異MUT3_MOTIONで加算(+1)
91 int16_t PlayerStealth::mutation_value()
94 const auto &muta = this->owner_ptr->muta;
95 if (muta.has(MUTA::XTRA_NOIS)) {
98 if (muta.has(MUTA::MOTION)) {
105 * @brief 隠密能力計算 - 一時効果
108 * * 呪術を唱えていると減算(-(詠唱数+1))
112 int16_t PlayerStealth::time_effect_value()
115 if (this->owner_ptr->realm1 == REALM_HEX) {
116 if (RealmHex(this->owner_ptr).is_spelling_any())
117 result -= (1 + casting_hex_num(this->owner_ptr));
119 if (is_shero(this->owner_ptr)) {
122 if (is_time_limit_stealth(this->owner_ptr))
128 bool PlayerStealth::is_aggravated_s_fairy()
130 return player_aggravate_state(this->owner_ptr) == AGGRAVATE_S_FAIRY;
134 * @brief 隠密能力計算 - 影フェアリー反感時の例外処理
137 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
139 int16_t PlayerStealth::set_exception_value(int16_t value)
141 if (this->is_aggravated_s_fairy()) {
142 value = MIN(value - 3, (value + 2) / 2);
149 * @return マイナスフラグの集合体
151 * * TR_STELATHがマイナスの要素に加え、種族影フェアリーかつ反感のとき種族にマイナスフラグを与える
153 BIT_FLAGS PlayerStealth::get_bad_flags()
155 BIT_FLAGS result = PlayerStatusBase::get_bad_flags();
157 if (this->is_aggravated_s_fairy())
158 set_bits(result, FLAG_CAUSE_RACE);
164 * @brief 隠密値の上限と下限の設定
169 void PlayerStealth::set_locals()
171 this->default_value = 1;
173 this->max_value = 30;
174 this->tr_flag = TR_STEALTH;
175 this->tr_bad_flag = TR_STEALTH;