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-class.h"
5 #include "player-base/player-race.h"
6 #include "player-info/class-info.h"
7 #include "player-info/equipment-info.h"
8 #include "player-info/mimic-info-table.h"
9 #include "player-info/race-types.h"
10 #include "player/player-personality.h"
11 #include "player/player-skill.h"
12 #include "player/player-status-flags.h"
13 #include "player/player-status.h"
14 #include "player/race-info-table.h"
15 #include "spell-realm/spells-hex.h"
16 #include "system/object-type-definition.h"
17 #include "system/player-type-definition.h"
18 #include "util/bit-flags-calculator.h"
19 #include "util/enum-converter.h"
21 PlayerStealth::PlayerStealth(PlayerType *player_ptr)
22 : PlayerStatusBase(player_ptr)
32 int16_t PlayerStealth::race_value()
34 return PlayerRace(this->player_ptr).get_info()->r_stl;
43 int16_t PlayerStealth::personality_value()
45 const player_personality *a_ptr = &personality_info[this->player_ptr->ppersonality];
50 * @brief 隠密能力計算 - 職業(基礎値)
55 int16_t PlayerStealth::class_base_value()
57 const player_class_info *c_ptr = &class_info[enum2i(this->player_ptr->pclass)];
58 return c_ptr->c_stl + (c_ptr->x_stl * this->player_ptr->lev / 10);
62 * @brief 隠密能力計算 - 職業(追加分)
65 * * 忍者がheavy_armorならば減算(-レベル/10)
66 * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
68 int16_t PlayerStealth::class_value()
70 if (!PlayerClass(this->player_ptr).equals(PlayerClassType::NINJA)) {
75 if (heavy_armor(this->player_ptr)) {
76 bonus -= (this->player_ptr->lev) / 10;
77 } else if ((!this->player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->player_ptr)) && (!this->player_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->player_ptr))) {
78 bonus += (this->player_ptr->lev) / 10;
88 * * 変異MUT3_XTRA_NOISで減算(-3)
89 * * 変異MUT3_MOTIONで加算(+1)
91 int16_t PlayerStealth::mutation_value()
94 const auto &muta = this->player_ptr->muta;
95 if (muta.has(PlayerMutationType::XTRA_NOIS)) {
99 if (muta.has(PlayerMutationType::MOTION)) {
107 * @brief 隠密能力計算 - 一時効果
110 * * 呪術を唱えていると減算(-(詠唱数+1))
114 int16_t PlayerStealth::time_effect_value()
117 if (this->player_ptr->realm1 == REALM_HEX) {
118 SpellHex spell_hex(this->player_ptr);
119 if (spell_hex.is_spelling_any()) {
120 bonus -= spell_hex.get_casting_num() + 1;
124 if (is_shero(this->player_ptr)) {
128 if (is_time_limit_stealth(this->player_ptr)) {
135 bool PlayerStealth::is_aggravated_s_fairy()
137 return player_aggravate_state(this->player_ptr) == AGGRAVATE_S_FAIRY;
141 * @brief 隠密能力計算 - 影フェアリー反感時の例外処理
144 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
146 int16_t PlayerStealth::set_exception_value(int16_t value)
148 if (this->is_aggravated_s_fairy()) {
149 value = std::min<int16_t>(value - 3, (value + 2) / 2);
157 * @return マイナスフラグの集合体
159 * * TR_STELATHがマイナスの要素に加え、種族影フェアリーかつ反感のとき種族にマイナスフラグを与える
161 BIT_FLAGS PlayerStealth::get_bad_flags()
163 auto flags = PlayerStatusBase::get_bad_flags();
164 if (this->is_aggravated_s_fairy()) {
165 set_bits(flags, FLAG_CAUSE_RACE);
172 * @brief 隠密値の上限と下限の設定
177 void PlayerStealth::set_locals()
179 this->default_value = 1;
181 this->max_value = 30;
182 this->tr_flag = TR_STEALTH;
183 this->tr_bad_flag = TR_STEALTH;