OSDN Git Service

[Refactor] struct player_type を class PlayerType に置換。
[hengbandforosx/hengbandosx.git] / src / player-ability / player-strength.cpp
index 161c704..af8236c 100644 (file)
@@ -1,16 +1,24 @@
 #include "player-ability/player-strength.h"
 #include "mutation/mutation-flag-types.h"
 #include "object/object-flags.h"
-#include "player/mimic-info-table.h"
-#include "player/player-class.h"
+#include "player-base/player-class.h"
+#include "player-base/player-race.h"
+#include "player-info/monk-data-type.h"
+#include "player-info/samurai-data-type.h"
 #include "player/player-personality.h"
 #include "player/race-info-table.h"
 #include "player/special-defense-types.h"
 #include "realm/realm-hex-numbers.h"
+#include "realm/realm-types.h"
 #include "spell-realm/spells-hex.h"
 #include "system/player-type-definition.h"
 #include "util/bit-flags-calculator.h"
 
+PlayerStrength::PlayerStrength(PlayerType *player_ptr)
+    : PlayerBasicStatistics(player_ptr)
+{
+}
+
 void PlayerStrength::set_locals()
 {
     this->max_value = +99;
@@ -23,22 +31,12 @@ void PlayerStrength::set_locals()
 /*!
  * @brief 腕力補正計算 - 種族
  * @return 腕力補正値
- * @details
- * * 種族による腕力修正値。
- * * エントは別途レベル26,41,46到達ごとに加算(+1)
  */
 int16_t PlayerStrength::race_value()
 {
     int16_t result = PlayerBasicStatistics::race_value();
 
-    if (is_specific_player_race(this->owner_ptr, player_race_type::ENT)) {
-        if (this->owner_ptr->lev > 25)
-            result++;
-        if (this->owner_ptr->lev > 40)
-            result++;
-        if (this->owner_ptr->lev > 45)
-            result++;
-    }
+    result += PlayerRace(this->player_ptr).additional_strength();
 
     return result;
 }
@@ -56,17 +54,17 @@ int16_t PlayerStrength::time_effect_value()
 {
     int16_t result = 0;
 
-    if (this->owner_ptr->realm1 == REALM_HEX) {
-        RealmHex realm_hex(this->owner_ptr);
-        if (realm_hex.hex_spelling(HEX_XTRA_MIGHT)) {
+    if (this->player_ptr->realm1 == REALM_HEX) {
+        SpellHex spell_hex(this->player_ptr);
+        if (spell_hex.is_spelling_specific(HEX_XTRA_MIGHT)) {
             result += 4;
         }
-        if (realm_hex.hex_spelling(HEX_BUILDING)) {
+        if (spell_hex.is_spelling_specific(HEX_BUILDING)) {
             result += 4;
         }
     }
 
-    if (this->owner_ptr->tsuyoshi) {
+    if (this->player_ptr->tsuyoshi) {
         result += 4;
     }
 
@@ -82,17 +80,18 @@ int16_t PlayerStrength::time_effect_value()
  * * 白虎の構えで加算(+2)
  * * 朱雀の構えで減算(-2)
  */
-int16_t PlayerStrength::battleform_value()
+int16_t PlayerStrength::stance_value()
 {
     int16_t result = 0;
 
-    if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
+    PlayerClass pc(player_ptr);
+    if (pc.samurai_stance_is(SamuraiStanceType::KOUKIJIN)) {
         result += 5;
     }
 
-    if (any_bits(this->owner_ptr->special_defense, KAMAE_BYAKKO)) {
+    if (pc.monk_stance_is(MonkStanceType::BYAKKO)) {
         result += 2;
-    } else if (any_bits(this->owner_ptr->special_defense, KAMAE_SUZAKU)) {
+    } else if (pc.monk_stance_is(MonkStanceType::SUZAKU)) {
         result -= 2;
     }
 
@@ -111,12 +110,12 @@ int16_t PlayerStrength::mutation_value()
 {
     int16_t result = 0;
 
-    if (this->owner_ptr->muta.any()) {
-        if (this->owner_ptr->muta.has(MUTA::HYPER_STR)) {
+    if (this->player_ptr->muta.any()) {
+        if (this->player_ptr->muta.has(PlayerMutationType::HYPER_STR)) {
             result += 4;
         }
 
-        if (this->owner_ptr->muta.has(MUTA::PUNY)) {
+        if (this->player_ptr->muta.has(PlayerMutationType::PUNY)) {
             result -= 4;
         }
     }