OSDN Git Service

[Refactor] PlayerStealthクラスの導入
authordis- <dis.rogue@gmail.com>
Wed, 10 Mar 2021 00:33:36 +0000 (09:33 +0900)
committerdis- <dis.rogue@gmail.com>
Wed, 10 Mar 2021 08:30:47 +0000 (17:30 +0900)
隠密処理を担当するクラスを実装し、処理を整理した。
この実装に際してPlayerStatusBaseを修正して例外処理関数を導入している。

Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/player-status/player-speed.cpp
src/player-status/player-speed.h
src/player-status/player-status-base.cpp
src/player-status/player-status-base.h
src/player-status/player-stealth.cpp [new file with mode: 0644]
src/player-status/player-stealth.h [new file with mode: 0644]
src/player/player-status-flags.cpp
src/player/player-status.cpp

index e17a815..7695915 100644 (file)
     <ClCompile Include="..\..\src\player-info\weapon-effect-info.cpp" />\r
     <ClCompile Include="..\..\src\player-status\player-speed.cpp" />\r
     <ClCompile Include="..\..\src\player-status\player-status-base.cpp" />\r
+    <ClCompile Include="..\..\src\player-status\player-stealth.cpp" />\r
     <ClCompile Include="..\..\src\player\player-status-resist.cpp" />\r
     <ClCompile Include="..\..\src\room\vault-builder.cpp" />\r
     <ClCompile Include="..\..\src\specific-object\blade-turner.cpp" />\r
     <ClInclude Include="..\..\src\player-info\weapon-effect-info.h" />\r
     <ClInclude Include="..\..\src\player-status\player-speed.h" />\r
     <ClInclude Include="..\..\src\player-status\player-status-base.h" />\r
+    <ClInclude Include="..\..\src\player-status\player-stealth.h" />\r
     <ClInclude Include="..\..\src\player\player-status-resist.h" />\r
     <ClInclude Include="..\..\src\room\vault-builder.h" />\r
     <ClInclude Include="..\..\src\specific-object\blade-turner.h" />\r
index e7e3396..600ee45 100644 (file)
     <ClCompile Include="..\..\src\player-status\player-status-base.cpp">\r
       <Filter>player-status</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\src\player-status\player-stealth.cpp">\r
+      <Filter>player-status</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\src\combat\shoot.h">\r
     <ClInclude Include="..\..\src\player-status\player-status-base.h">\r
       <Filter>player-status</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\src\player-status\player-stealth.h">\r
+      <Filter>player-status</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="..\..\src\wall.bmp" />\r
index 5b2c099..cdd77b6 100644 (file)
@@ -636,8 +636,10 @@ hengband_SOURCES = \
        \
        player-status/player-status-base.h \
        player-status/player-speed.h \
+       player-status/player-stealth.h \
        player-status/player-status-base.cpp \
        player-status/player-speed.cpp \
+       player-status/player-stealth.cpp \
        \
        player-info/avatar.h player-info/avatar.cpp \
        player-info/base-status-info.cpp player-info/base-status-info.h \
index f389f0c..4d09314 100644 (file)
@@ -346,9 +346,9 @@ s16b PlayerSpeed::action_value()
  * @details
  * * セット二刀流は両手のフラグをONにする
  */
-BIT_FLAGS PlayerSpeed::equipments_flags()
+BIT_FLAGS PlayerSpeed::equipments_flags(tr_type check_flag)
 {
-    BIT_FLAGS result = PlayerStatusBase::equipments_flags();
+    BIT_FLAGS result = PlayerStatusBase::equipments_flags(check_flag);
 
     if (this->special_weapon_set_value() != 0)
         set_bits(result, FLAG_CAUSE_INVEN_MAIN_HAND | FLAG_CAUSE_INVEN_SUB_HAND);
@@ -357,27 +357,18 @@ BIT_FLAGS PlayerSpeed::equipments_flags()
 }
 
 /*
- * @brief 速度計算 - 合計値
- * @return 計算済の速度値 11 - 209
+ * @brief 速度計算 - 乗馬時の例外処理
+ * @return 計算済の速度値
  * @details
- * * 非乗馬時 - 乗馬以外の全要素の単純加算
+ * * 非乗馬時 - ここまでの修正値合算をそのまま使用
  * * 乗馬時 - 乗馬の速度と重量減衰のみを計算
  */
-s16b PlayerSpeed::getValue()
+s16b PlayerSpeed::set_exception_value(s16b value)
 {
-    s16b pow = PlayerStatusBase::getValue();
-
     if (this->owner_ptr->riding) {
-        pow = this->default_value;
-        pow += this->riding_value();
-        pow += this->inventory_weight_value();
-
-        if ((pow > this->max_value)) {
-            pow = this->max_value;
-        }
-
-        if (pow < this->min_value)
-            pow = this->min_value;
+        value = this->default_value;
+        value += this->riding_value();
+        value += this->inventory_weight_value();
     }
-    return pow;
+    return value;
 }
index f0e2896..1b813dc 100644 (file)
@@ -3,10 +3,8 @@
 
 class PlayerSpeed : public PlayerStatusBase {
 public:
-    PlayerSpeed(player_type *owner_ptr)
-        : PlayerStatusBase(owner_ptr){};
-
-    s16b getValue() override;
+    using PlayerStatusBase::PlayerStatusBase;
+    PlayerSpeed() = delete;
 
 protected:
     void set_locals() override;
@@ -20,6 +18,7 @@ protected:
     s16b riding_value() override;
     s16b inventory_weight_value() override;
     s16b action_value() override;
-    BIT_FLAGS equipments_flags() override;
+    BIT_FLAGS equipments_flags(tr_type check_flag) override;
     s16b special_weapon_set_value();
+    s16b set_exception_value(s16b value) override;
 };
index 38bd315..bb5554f 100644 (file)
@@ -30,6 +30,7 @@ s16b PlayerStatusBase::getValue()
 
     pow += this->action_value();
     pow += this->battleform_value();
+    pow += this->class_base_value();
     pow += this->class_value();
     pow += this->equipments_value();
     pow += this->inventory_weight_value();
@@ -38,6 +39,7 @@ s16b PlayerStatusBase::getValue()
     pow += this->race_value();
     pow += this->riding_value();
     pow += this->time_effect_value();
+    pow = this->set_exception_value(pow);
 
     if ((pow > this->max_value)) {
         pow = this->max_value;
@@ -53,9 +55,10 @@ s16b PlayerStatusBase::getValue()
  * @brief 修正値が0でないところにビットを立てて返す。
  * @return 判定結果のBIT_FLAGS
  */
-BIT_FLAGS PlayerStatusBase::getFlags()
+BIT_FLAGS PlayerStatusBase::getAllFlags()
 {
-    BIT_FLAGS result = equipments_flags();
+    this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
+    BIT_FLAGS result = equipments_flags(this->tr_flag);
 
     if (this->class_value() != 0)
         set_bits(result, FLAG_CAUSE_CLASS);
@@ -88,12 +91,52 @@ BIT_FLAGS PlayerStatusBase::getFlags()
 }
 
 /*!
- * @brief 修正値が0以下のところにビットを立てて返す。
+ * @brief 修正値が1以上のところにビットを立てて返す。
+ * @return 判定結果のBIT_FLAGS
+ */
+BIT_FLAGS PlayerStatusBase::getGoodFlags()
+{
+    this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
+    BIT_FLAGS result = equipments_flags(this->tr_flag);
+
+    if (this->class_value() > 0)
+        set_bits(result, FLAG_CAUSE_CLASS);
+
+    if (this->race_value() > 0)
+        set_bits(result, FLAG_CAUSE_RACE);
+
+    if (this->battleform_value() > 0)
+        set_bits(result, FLAG_CAUSE_BATTLE_FORM);
+
+    if (this->mutation_value() > 0)
+        set_bits(result, FLAG_CAUSE_MUTATION);
+
+    if (this->time_effect_value() > 0)
+        set_bits(result, FLAG_CAUSE_MAGIC_TIME_EFFECT);
+
+    if (this->personality_value() > 0)
+        set_bits(result, FLAG_CAUSE_PERSONALITY);
+
+    if (this->riding_value() > 0)
+        set_bits(result, FLAG_CAUSE_RIDING);
+
+    if (this->inventory_weight_value() > 0)
+        set_bits(result, FLAG_CAUSE_INVEN_PACK);
+
+    if (this->action_value() > 0)
+        set_bits(result, FLAG_CAUSE_ACTION);
+
+    return result;
+}
+
+/*!
+ * @brief 修正値が-1以下のところにビットを立てて返す。
  * @return 判定結果のBIT_FLAGS
  */
 BIT_FLAGS PlayerStatusBase::getBadFlags()
 {
-    BIT_FLAGS result = equipments_bad_flags();
+    this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
+    BIT_FLAGS result = equipments_bad_flags(this->tr_bad_flag);
 
     if (this->class_value() < 0)
         set_bits(result, FLAG_CAUSE_CLASS);
@@ -134,9 +177,13 @@ void PlayerStatusBase::set_locals()
     this->tr_bad_flag = TR_FLAG_MAX;
 }
 
-BIT_FLAGS PlayerStatusBase::equipments_flags()
+/*!
+ * @brief 判定するflagを持つ装備品に対応するBIT_FLAGSを返す
+ * @params check_flag 判定するtr_type
+ * @return 判定結果のBIT_FLAGS
+ */
+BIT_FLAGS PlayerStatusBase::equipments_flags(tr_type check_flag)
 {
-    this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
     object_type *o_ptr;
     BIT_FLAGS flgs[TR_FLAG_SIZE];
     BIT_FLAGS result = 0L;
@@ -147,15 +194,19 @@ BIT_FLAGS PlayerStatusBase::equipments_flags()
 
         object_flags(owner_ptr, o_ptr, flgs);
 
-        if (has_flag(flgs, tr_flag))
+        if (has_flag(flgs, check_flag))
             set_bits(result, convert_inventory_slot_type_to_flag_cause(static_cast<inventory_slot_type>(i)));
     }
     return result;
 }
 
-BIT_FLAGS PlayerStatusBase::equipments_bad_flags()
+/*!
+ * @brief 判定するflagを持ち、pvalが負の装備品に対応するBIT_FLAGSを返す
+ * @params check_flag 判定するtr_type
+ * @return 判定結果のBIT_FLAGS
+ */
+BIT_FLAGS PlayerStatusBase::equipments_bad_flags(tr_type check_flag)
 {
-    this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
     object_type *o_ptr;
     BIT_FLAGS flgs[TR_FLAG_SIZE];
     BIT_FLAGS result = 0L;
@@ -166,7 +217,7 @@ BIT_FLAGS PlayerStatusBase::equipments_bad_flags()
 
         object_flags(owner_ptr, o_ptr, flgs);
 
-        if (has_flag(flgs, tr_bad_flag)) {
+        if (has_flag(flgs, check_flag)) {
             if (o_ptr->pval < 0) {
                 set_bits(result, convert_inventory_slot_type_to_flag_cause(static_cast<inventory_slot_type>(i)));
             }
@@ -175,6 +226,10 @@ BIT_FLAGS PlayerStatusBase::equipments_bad_flags()
     return result;
 }
 
+/*!
+ * @brief this->tr_flagを持つ装備品のpval合計値を返す
+ * @return 該当するfalgを持つ全装備のpvalの合計値
+ */
 s16b PlayerStatusBase::equipments_value()
 {
     this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
@@ -186,7 +241,7 @@ s16b PlayerStatusBase::equipments_value()
 
         if (!o_ptr->k_idx)
             continue;
-        if (has_flag(flgs, tr_flag))
+        if (has_flag(flgs, this->tr_flag))
             result += o_ptr->pval;
     }
     return result;
@@ -200,6 +255,10 @@ s16b PlayerStatusBase::class_value()
 {
     return 0;
 }
+s16b PlayerStatusBase::class_base_value()
+{
+    return 0;
+} 
 s16b PlayerStatusBase::personality_value()
 {
     return 0;
@@ -228,3 +287,15 @@ s16b PlayerStatusBase::action_value()
 {
     return 0;
 }
+
+/*!
+ * @brief 値を直接変更する例外処理。
+ * @params value 単純加算された修正値の合計
+ * @details
+ * * 派生クラスで必要とされる例外処理でoverrideされる
+ * @return 直接変更された値。このままmin-max処理され最終的なvalueになる。
+ */
+s16b PlayerStatusBase::set_exception_value(s16b value)
+{
+    return value;
+}
index 1a3c670..a0782e3 100644 (file)
@@ -8,8 +8,10 @@ public:
     PlayerStatusBase() = delete;
     virtual ~PlayerStatusBase() = default;
     virtual s16b getValue();
-    virtual BIT_FLAGS getFlags();
+    virtual BIT_FLAGS getAllFlags();
+    virtual BIT_FLAGS getGoodFlags();
     virtual BIT_FLAGS getBadFlags();
+
 protected:
     s16b default_value;
     s16b min_value;
@@ -20,6 +22,7 @@ protected:
     virtual void set_locals();
     virtual s16b race_value();
     virtual s16b class_value();
+    virtual s16b class_base_value();
     virtual s16b personality_value();
     virtual s16b equipments_value();
     virtual s16b time_effect_value();
@@ -28,6 +31,7 @@ protected:
     virtual s16b riding_value();
     virtual s16b inventory_weight_value();
     virtual s16b action_value();
-    virtual BIT_FLAGS equipments_flags();
-    virtual BIT_FLAGS equipments_bad_flags();
+    virtual s16b set_exception_value(s16b value);
+    virtual BIT_FLAGS equipments_flags(tr_type check_flag);
+    virtual BIT_FLAGS equipments_bad_flags(tr_type check_flag);
 };
diff --git a/src/player-status/player-stealth.cpp b/src/player-status/player-stealth.cpp
new file mode 100644 (file)
index 0000000..399f0ce
--- /dev/null
@@ -0,0 +1,170 @@
+#include "player-status/player-stealth.h"
+#include "mind/mind-ninja.h"
+#include "mutation/mutation-flag-types.h"
+#include "player/mimic-info-table.h"
+#include "player/player-class.h"
+#include "player/player-personality.h"
+#include "player/player-race-types.h"
+#include "player/player-skill.h"
+#include "player/player-status-flags.h"
+#include "player/race-info-table.h"
+#include "spell-realm/spells-hex.h"
+#include "util/bit-flags-calculator.h"
+
+/*!
+ * @brief 隠密能力計算 - 種族
+ * @return 隠密能力の増分
+ * @details
+ * * 種族による加算
+ */
+s16b PlayerStealth::race_value()
+{
+    const player_race *tmp_rp_ptr;
+
+    if (this->owner_ptr->mimic_form)
+        tmp_rp_ptr = &mimic_info[this->owner_ptr->mimic_form];
+    else
+        tmp_rp_ptr = &race_info[this->owner_ptr->prace];
+
+    return tmp_rp_ptr->r_stl;
+}
+
+/*!
+ * @brief 隠密能力計算 - 性格
+ * @return 隠密能力の増分
+ * @details
+ * * 性格による加算
+ */
+s16b PlayerStealth::personality_value()
+{
+    const player_personality *a_ptr = &personality_info[this->owner_ptr->pseikaku];
+    return a_ptr->a_stl;
+}
+
+/*!
+ * @brief 隠密能力計算 - 職業(基礎値)
+ * @return 隠密能力の増分
+ * @details
+ * * 職業による加算
+ */
+s16b PlayerStealth::base_class_value()
+{
+    const player_class *c_ptr = &class_info[this->owner_ptr->pclass];
+    return c_ptr->c_stl + (c_ptr->x_stl * this->owner_ptr->lev / 10);
+}
+
+/*!
+ * @brief 隠密能力計算 - 職業(追加分)
+ * @return 隠密能力の増分
+ * @details
+ * * 忍者がheavy_armorならば減算(-レベル/10)
+ * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
+ */
+s16b PlayerStealth::class_value()
+{
+    ACTION_SKILL_POWER result = 0;
+
+    if (this->owner_ptr->pclass == CLASS_NINJA) {
+        if (heavy_armor(this->owner_ptr)) {
+            result -= (this->owner_ptr->lev) / 10;
+        } else if ((!this->owner_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->owner_ptr))
+            && (!this->owner_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->owner_ptr))) {
+            result += (this->owner_ptr->lev) / 10;
+        }
+    }
+
+    return result;
+}
+
+/*!
+ * @brief 隠密能力計算 - 変異
+ * @return 隠密能力の増分
+ * @details
+ * * 変異MUT3_XTRA_NOISで減算(-3)
+ * * 変異MUT3_MOTIONで加算(+1)
+ */
+s16b PlayerStealth::mutation_value()
+{
+    s16b result = 0;
+    if (any_bits(this->owner_ptr->muta3, MUT3_XTRA_NOIS)) {
+        result -= 3;
+    }
+    if (any_bits(this->owner_ptr->muta3, MUT3_MOTION)) {
+        result += 1;
+    }
+    return result;
+}
+
+/*!
+ * @brief 隠密能力計算 - 一時効果
+ * @return 隠密能力の増分
+ * @details
+ * * 呪術を唱えていると減算(-(詠唱数+1))
+ * * 狂戦士化で減算(-7)
+ * * 隠密の歌で加算(+999)
+ */
+s16b PlayerStealth::time_effect_value()
+{
+    s16b result = 0;
+    if (this->owner_ptr->realm1 == REALM_HEX) {
+        if (hex_spelling_any(this->owner_ptr))
+            result -= (1 + casting_hex_num(this->owner_ptr));
+    }
+    if (is_shero(this->owner_ptr)) {
+        result -= 7;
+    }
+    if (is_time_limit_stealth(this->owner_ptr))
+        result += 999;
+
+    return result;
+}
+
+bool PlayerStealth::is_aggravated_s_fairy()
+{
+    return player_aggravate_state(this->owner_ptr) == AGGRAVATE_S_FAIRY;
+}
+
+/*!
+ * @brief 隠密能力計算 - 影フェアリー反感時の例外処理
+ * @return 修正後の隠密能力
+ * @details
+ * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
+ */
+s16b PlayerStealth::set_exception_value(s16b value)
+{
+    if (this->is_aggravated_s_fairy()) {
+        value = MIN(value - 3, (value + 2) / 2);
+    }
+    return value;
+}
+
+/*!
+ * @brief 隠密マイナスフラグ判定
+ * @return マイナスフラグの集合体
+ * @details
+ * * TR_STELATHがマイナスの要素に加え、種族影フェアリーかつ反感のとき種族にマイナスフラグを与える
+ */
+BIT_FLAGS PlayerStealth::getBadFlags()
+{
+    BIT_FLAGS result = PlayerStatusBase::getBadFlags();
+
+    if (this->is_aggravated_s_fairy())
+        set_bits(result, FLAG_CAUSE_RACE);
+
+    return result;
+}
+
+/*!
+ * @brief 隠密値の上限と下限の設定
+ * @details
+ * * 初期値1
+ * * 最大30、最低0に補正
+ */
+void PlayerStealth::set_locals()
+{
+    this->default_value = 1;
+    this->min_value = 0;
+    this->max_value = 30;
+    this->tr_flag = TR_STEALTH;
+    this->tr_bad_flag = TR_STEALTH;
+}
diff --git a/src/player-status/player-stealth.h b/src/player-status/player-stealth.h
new file mode 100644 (file)
index 0000000..c0b9fed
--- /dev/null
@@ -0,0 +1,21 @@
+#pragma once
+#include "player-status/player-status-base.h"
+
+class PlayerStealth : public PlayerStatusBase {
+public:
+    using PlayerStatusBase::PlayerStatusBase;
+    PlayerStealth() = delete;
+
+    BIT_FLAGS getBadFlags() override;
+
+protected:
+    void set_locals() override;
+    s16b race_value() override;
+    s16b class_value() override;
+    s16b base_class_value();
+    s16b personality_value() override;
+    s16b time_effect_value() override;
+    s16b mutation_value() override;
+    s16b set_exception_value(s16b value) override;
+    bool is_aggravated_s_fairy();
+};
index 14863b1..2378962 100644 (file)
@@ -13,6 +13,7 @@
 #include "object-hook/hook-weapon.h"
 #include "object/object-flags.h"
 #include "player-status/player-speed.h"
+#include "player-status/player-stealth.h"
 #include "player/attack-defense-types.h"
 #include "player/mimic-info-table.h"
 #include "player/player-class.h"
@@ -163,7 +164,7 @@ BIT_FLAGS get_player_flags(player_type *creature_ptr, tr_type tr_flag)
     case TR_FORCE_WEAPON:
         return check_equipment_flags(creature_ptr, tr_flag);
     case TR_STEALTH:
-        return player_flags_stealth(creature_ptr);
+        return PlayerStealth(creature_ptr).getAllFlags();
     case TR_SEARCH:
         return 0;
     case TR_INFRA:
@@ -171,7 +172,7 @@ BIT_FLAGS get_player_flags(player_type *creature_ptr, tr_type tr_flag)
     case TR_TUNNEL:
         return 0;
     case TR_SPEED:
-        return PlayerSpeed(creature_ptr).getFlags();
+        return PlayerSpeed(creature_ptr).getAllFlags();
     case TR_BLOWS:
         return 0;
     case TR_CHAOTIC:
index d9a4479..a496a52 100644 (file)
@@ -60,7 +60,7 @@
 #include "pet/pet-util.h"
 #include "player-info/avatar.h"
 #include "player-status/player-speed.h"
-#include "player-status/player-status-base.h"
+#include "player-status/player-stealth.h"
 #include "player/attack-defense-types.h"
 #include "player/digestion-processor.h"
 #include "player/mimic-info-table.h"
 static bool is_martial_arts_mode(player_type *creature_ptr);
 
 static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr);
-static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_disarming(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_saving_throw(player_type *creature_ptr);
@@ -426,7 +425,7 @@ static void update_bonuses(player_type *creature_ptr)
 
     creature_ptr->pspeed = PlayerSpeed(creature_ptr).getValue();
     creature_ptr->see_infra = calc_intra_vision(creature_ptr);
-    creature_ptr->skill_stl = calc_stealth(creature_ptr);
+    creature_ptr->skill_stl = PlayerStealth(creature_ptr).getValue();
     creature_ptr->skill_dis = calc_disarming(creature_ptr);
     creature_ptr->skill_dev = calc_device_ability(creature_ptr);
     creature_ptr->skill_sav = calc_saving_throw(creature_ptr);
@@ -1211,206 +1210,6 @@ static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr)
 }
 
 /*!
- * @brief 隠密能力計算 - 種族
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 種族による加算
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_race(player_type *creature_ptr)
-{
-    const player_race *tmp_rp_ptr;
-
-    if (creature_ptr->mimic_form)
-        tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
-    else
-        tmp_rp_ptr = &race_info[creature_ptr->prace];
-
-    return tmp_rp_ptr->r_stl;
-}
-
-/*!
- * @brief 隠密能力計算 - 性格
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 性格による加算
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_personality(player_type *creature_ptr)
-{
-    const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
-
-    return a_ptr->a_stl;
-}
-
-/*!
- * @brief 隠密能力計算 - 職業(基礎値)
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 職業による加算
- */
-static ACTION_SKILL_POWER calc_player_base_stealth_by_class(player_type *creature_ptr)
-{
-    const player_class *c_ptr = &class_info[creature_ptr->pclass];
-    return c_ptr->c_stl + (c_ptr->x_stl * creature_ptr->lev / 10);
-}
-
-/*!
- * @brief 隠密能力計算 - 職業(追加分)
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 忍者がheavy_armorならば減算(-レベル/10)
- * * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
- */
-static ACTION_SKILL_POWER calc_player_additional_stealth_by_class(player_type *creature_ptr)
-{
-    ACTION_SKILL_POWER result = 0;
-
-    if (creature_ptr->pclass == CLASS_NINJA) {
-        if (heavy_armor(creature_ptr)) {
-            result -= (creature_ptr->lev) / 10;
-        } else if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr))
-            && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) {
-            result += (creature_ptr->lev) / 10;
-        }
-    }
-
-    return result;
-}
-
-/*!
- * @brief 隠密能力計算 - 装備
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 装備による修正(TR_STEALTHがあれば+pval*1)
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_equipment(player_type *creature_ptr)
-{
-    ACTION_SKILL_POWER result = 0;
-    for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-        object_type *o_ptr;
-        BIT_FLAGS flgs[TR_FLAG_SIZE];
-        o_ptr = &creature_ptr->inventory_list[i];
-        if (!o_ptr->k_idx)
-            continue;
-        object_flags(creature_ptr, o_ptr, flgs);
-        if (has_flag(flgs, TR_STEALTH))
-            result += o_ptr->pval;
-    }
-    return result;
-}
-
-/*!
- * @brief 隠密能力計算 - 変異
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 変異MUT3_XTRA_NOISで減算(-3)
- * * 変異MUT3_MOTIONで加算(+1)
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_mutation(player_type *creature_ptr)
-{
-    ACTION_SKILL_POWER result = 0;
-    if (any_bits(creature_ptr->muta3, MUT3_XTRA_NOIS)) {
-        result -= 3;
-    }
-    if (any_bits(creature_ptr->muta3, MUT3_MOTION)) {
-        result += 1;
-    }
-    return result;
-}
-
-/*!
- * @brief 隠密能力計算 - 一時効果
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力の増分
- * @details
- * * 呪術を唱えていると減算(-(詠唱数+1))
- * * 狂戦士化で減算(-7)
- * * 隠密の歌で加算(+999)
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_time_effect(player_type *creature_ptr)
-{
-    ACTION_SKILL_POWER result = 0;
-    if (creature_ptr->realm1 == REALM_HEX) {
-        if (hex_spelling_any(creature_ptr))
-            result -= (1 + casting_hex_num(creature_ptr));
-    }
-    if (is_shero(creature_ptr)) {
-        result -= 7;
-    }
-    if (is_time_limit_stealth(creature_ptr))
-        result += 999;
-
-    return result;
-}
-
-/*!
- * @brief 隠密能力計算 - 影フェアリー反感処理
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 修正後の隠密能力
- * @details
- * * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
- */
-static ACTION_SKILL_POWER calc_player_stealth_by_s_faiery(player_type *creature_ptr, ACTION_SKILL_POWER pow)
-{
-    if (player_aggravate_state(creature_ptr) == AGGRAVATE_S_FAIRY) {
-        pow = MIN(pow - 3, (pow + 2) / 2);
-    }
-    return pow;
-}
-
-BIT_FLAGS player_flags_stealth(player_type *creature_ptr)
-{
-    BIT_FLAGS result = check_equipment_flags(creature_ptr, TR_STEALTH);
-
-    if (calc_player_additional_stealth_by_class(creature_ptr) != 0)
-        set_bits(result, FLAG_CAUSE_CLASS);
-
-    if (calc_player_stealth_by_mutation(creature_ptr) != 0)
-        set_bits(result, FLAG_CAUSE_MUTATION);
-
-    if (calc_player_stealth_by_time_effect(creature_ptr) != 0)
-        set_bits(result, FLAG_CAUSE_MAGIC_TIME_EFFECT);
-
-    if (calc_player_stealth_by_s_faiery(creature_ptr, 0) != 0)
-        set_bits(result, FLAG_CAUSE_RACE);
-
-    return result;
-}
-
-/*!
- * @brief 隠密能力計算
- * @param creature_ptr 計算するクリーチャーの参照ポインタ
- * @return 隠密能力
- * @details
- * * 初期値1
- * * 最大30、最低0に補正
- */
-static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr)
-{
-    ACTION_SKILL_POWER pow = 1;
-    pow += calc_player_base_stealth_by_class(creature_ptr);
-    pow += calc_player_additional_stealth_by_class(creature_ptr);
-    pow += calc_player_stealth_by_race(creature_ptr);
-    pow += calc_player_stealth_by_personality(creature_ptr);
-    pow += calc_player_stealth_by_equipment(creature_ptr);
-    pow += calc_player_stealth_by_mutation(creature_ptr);
-    pow += calc_player_stealth_by_time_effect(creature_ptr);
-    pow = calc_player_stealth_by_s_faiery(creature_ptr, pow); /* Set New getValue */
-
-    if (pow > 30)
-        pow = 30;
-    if (pow < 0)
-        pow = 0;
-
-    return pow;
-}
-
-/*!
  * @brief 解除能力計算
  * @param creature_ptr 計算するクリーチャーの参照ポインタ
  * @return 解除能力