OSDN Git Service

Merge pull request #938 from dis-/feature/RefactorPlayreInfraVision
[hengbandforosx/hengbandosx.git] / src / player-status / player-strength.cpp
1 #include "player-status/player-strength.h"
2 #include "mutation/mutation-flag-types.h"
3 #include "object/object-flags.h"
4 #include "player/mimic-info-table.h"
5 #include "player/player-class.h"
6 #include "player/player-personality.h"
7 #include "player/race-info-table.h"
8 #include "player/special-defense-types.h"
9 #include "realm/realm-hex-numbers.h"
10 #include "spell-realm/spells-hex.h"
11 #include "system/player-type-definition.h"
12 #include "util/bit-flags-calculator.h"
13
14 void PlayerStrength::set_locals() 
15 {
16     this->max_value = +99;
17     this->min_value = -99;
18     this->status_type = A_STR;
19     this->tr_flag = TR_STR;
20     this->tr_bad_flag = TR_STR;
21 }
22
23 /*!
24  * @brief 腕力補正計算 - 種族
25  * @return 腕力補正値
26  * @details
27  * * 種族による腕力修正値。
28  * * エントは別途レベル26,41,46到達ごとに加算(+1)
29  */
30 s16b PlayerStrength::race_value()
31 {
32     s16b result = PlayerBasicStatistics::race_value();
33
34     if (is_specific_player_race(this->owner_ptr, RACE_ENT)) {
35         if (this->owner_ptr->lev > 25)
36             result++;
37         if (this->owner_ptr->lev > 40)
38             result++;
39         if (this->owner_ptr->lev > 45)
40             result++;
41     }
42
43     return result;
44 }
45
46 /*!
47  * @brief 腕力補正計算 - 一時効果
48  * @return 腕力補正値
49  * @details
50  * * 一時効果による腕力修正値
51  * * 呪術の腕力強化で加算(+4)
52  * * 呪術の肉体強化で加算(+4)
53  * * ネオ・つよしスペシャル中で加算(+4)
54  */
55 s16b PlayerStrength::time_effect_value()
56 {
57     s16b result = 0;
58
59     if (this->owner_ptr->realm1 == REALM_HEX) {
60         if (hex_spelling(this->owner_ptr, HEX_XTRA_MIGHT)) {
61             result += 4;
62         }
63         if (hex_spelling(this->owner_ptr, HEX_BUILDING)) {
64             result += 4;
65         }
66     }
67
68     if (this->owner_ptr->tsuyoshi) {
69         result += 4;
70     }
71
72     return result;
73 }
74
75
76 /*!
77  * @brief 腕力補正計算 - 型
78  * @return 腕力補正値
79  * @details
80  * * 型による腕力修正値
81  * * 降鬼陣で加算(+5)
82  * * 白虎の構えで加算(+2)
83  * * 朱雀の構えで減算(-2)
84  */
85 s16b PlayerStrength::battleform_value()
86 {
87     s16b result = 0;
88
89     if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
90         result += 5;
91     }
92
93     if (any_bits(this->owner_ptr->special_defense, KAMAE_BYAKKO)) {
94         result += 2;
95     } else if (any_bits(this->owner_ptr->special_defense, KAMAE_SUZAKU)) {
96         result -= 2;
97     }
98
99     return result;
100 }
101
102 /*!
103  * @brief 腕力補正計算 - 変異
104  * @return 腕力補正値
105  * @details
106  * * 変異による腕力修正値
107  * * 変異MUT3_HYPER_STRで加算(+4)
108  * * 変異MUT3_PUNYで減算(-4)
109  */
110 s16b PlayerStrength::mutation_value()
111 {
112     s16b result = 0;
113
114     if (this->owner_ptr->muta.any()) {
115         if (this->owner_ptr->muta.has(MUTA::HYPER_STR)) {
116             result += 4;
117         }
118
119         if (this->owner_ptr->muta.has(MUTA::PUNY)) {
120             result -= 4;
121         }
122     }
123
124     return result;
125 }