1 #include "player-status/player-stealth.h"
2 #include "mind/mind-ninja.h"
3 #include "mutation/mutation-flag-types.h"
4 #include "player-base/player-race.h"
5 #include "player-info/class-info.h"
6 #include "player-info/equipment-info.h"
7 #include "player-info/mimic-info-table.h"
8 #include "player-info/race-types.h"
9 #include "player/player-personality.h"
10 #include "player/player-skill.h"
11 #include "player/player-status-flags.h"
12 #include "player/player-status.h"
13 #include "player/race-info-table.h"
14 #include "spell-realm/spells-hex.h"
15 #include "system/object-type-definition.h"
16 #include "system/player-type-definition.h"
17 #include "util/bit-flags-calculator.h"
18 #include "util/enum-converter.h"
20 PlayerStealth::PlayerStealth(player_type* player_ptr)
21 : PlayerStatusBase(player_ptr)
31 int16_t PlayerStealth::race_value()
33 return PlayerRace(this->player_ptr).get_info()->r_stl;
42 int16_t PlayerStealth::personality_value()
44 const player_personality *a_ptr = &personality_info[this->player_ptr->ppersonality];
49 * @brief 隠密能力計算 - 職業(基礎値)
54 int16_t PlayerStealth::class_base_value()
56 const player_class_info *c_ptr = &class_info[enum2i(this->player_ptr->pclass)];
57 return c_ptr->c_stl + (c_ptr->x_stl * this->player_ptr->lev / 10);
61 * @brief 隠密能力計算 - 職業(追加分)
64 * * 忍者がheavy_armorならば減算(-レベル/10)
65 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
67 int16_t PlayerStealth::class_value()
69 ACTION_SKILL_POWER result = 0;
71 if (this->player_ptr->pclass == PlayerClassType::NINJA) {
72 if (heavy_armor(this->player_ptr)) {
73 result -= (this->player_ptr->lev) / 10;
74 } else if ((!this->player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->player_ptr))
75 && (!this->player_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->player_ptr))) {
76 result += (this->player_ptr->lev) / 10;
87 * * 変異MUT3_XTRA_NOISで減算(-3)
88 * * 変異MUT3_MOTIONで加算(+1)
90 int16_t PlayerStealth::mutation_value()
93 const auto &muta = this->player_ptr->muta;
94 if (muta.has(MUTA::XTRA_NOIS)) {
97 if (muta.has(MUTA::MOTION)) {
104 * @brief 隠密能力計算 - 一時効果
107 * * 呪術を唱えていると減算(-(詠唱数+1))
111 int16_t PlayerStealth::time_effect_value()
114 if (this->player_ptr->realm1 == REALM_HEX) {
115 SpellHex spell_hex(this->player_ptr);
116 if (spell_hex.is_spelling_any()) {
117 result -= spell_hex.get_casting_num() + 1;
121 if (is_shero(this->player_ptr)) {
125 if (is_time_limit_stealth(this->player_ptr)) {
132 bool PlayerStealth::is_aggravated_s_fairy()
134 return player_aggravate_state(this->player_ptr) == AGGRAVATE_S_FAIRY;
138 * @brief 隠密能力計算 - 影フェアリー反感時の例外処理
141 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
143 int16_t PlayerStealth::set_exception_value(int16_t value)
145 if (this->is_aggravated_s_fairy()) {
146 value = std::min<int16_t>(value - 3, (value + 2) / 2);
153 * @return マイナスフラグの集合体
155 * * TR_STELATHがマイナスの要素に加え、種族影フェアリーかつ反感のとき種族にマイナスフラグを与える
157 BIT_FLAGS PlayerStealth::get_bad_flags()
159 BIT_FLAGS result = PlayerStatusBase::get_bad_flags();
161 if (this->is_aggravated_s_fairy())
162 set_bits(result, FLAG_CAUSE_RACE);
168 * @brief 隠密値の上限と下限の設定
173 void PlayerStealth::set_locals()
175 this->default_value = 1;
177 this->max_value = 30;
178 this->tr_flag = TR_STEALTH;
179 this->tr_bad_flag = TR_STEALTH;