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 ACTION_SKILL_POWER result = 0;
72 if (PlayerClass(player_ptr).equals(PlayerClassType::NINJA)) {
73 if (heavy_armor(this->player_ptr)) {
74 result -= (this->player_ptr->lev) / 10;
75 } else if ((!this->player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->player_ptr))
76 && (!this->player_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->player_ptr))) {
77 result += (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)) {
98 if (muta.has(PlayerMutationType::MOTION)) {
105 * @brief 隠密能力計算 - 一時効果
108 * * 呪術を唱えていると減算(-(詠唱数+1))
112 int16_t PlayerStealth::time_effect_value()
115 if (this->player_ptr->realm1 == REALM_HEX) {
116 SpellHex spell_hex(this->player_ptr);
117 if (spell_hex.is_spelling_any()) {
118 result -= spell_hex.get_casting_num() + 1;
122 if (is_shero(this->player_ptr)) {
126 if (is_time_limit_stealth(this->player_ptr)) {
133 bool PlayerStealth::is_aggravated_s_fairy()
135 return player_aggravate_state(this->player_ptr) == AGGRAVATE_S_FAIRY;
139 * @brief 隠密能力計算 - 影フェアリー反感時の例外処理
142 * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
144 int16_t PlayerStealth::set_exception_value(int16_t value)
146 if (this->is_aggravated_s_fairy()) {
147 value = std::min<int16_t>(value - 3, (value + 2) / 2);
154 * @return マイナスフラグの集合体
156 * * TR_STELATHがマイナスの要素に加え、種族影フェアリーかつ反感のとき種族にマイナスフラグを与える
158 BIT_FLAGS PlayerStealth::get_bad_flags()
160 BIT_FLAGS result = PlayerStatusBase::get_bad_flags();
162 if (this->is_aggravated_s_fairy())
163 set_bits(result, FLAG_CAUSE_RACE);
169 * @brief 隠密値の上限と下限の設定
174 void PlayerStealth::set_locals()
176 this->default_value = 1;
178 this->max_value = 30;
179 this->tr_flag = TR_STEALTH;
180 this->tr_bad_flag = TR_STEALTH;