OSDN Git Service

[Refactor] enum classの型名変更 MUTA -> PlayerMutationType
[hengbandforosx/hengbandosx.git] / src / player-ability / player-strength.cpp
1 #include "player-ability/player-strength.h"
2 #include "mutation/mutation-flag-types.h"
3 #include "object/object-flags.h"
4 #include "player-base/player-class.h"
5 #include "player-base/player-race.h"
6 #include "player-info/monk-data-type.h"
7 #include "player-info/samurai-data-type.h"
8 #include "player/player-personality.h"
9 #include "player/race-info-table.h"
10 #include "player/special-defense-types.h"
11 #include "realm/realm-hex-numbers.h"
12 #include "realm/realm-types.h"
13 #include "spell-realm/spells-hex.h"
14 #include "system/player-type-definition.h"
15 #include "util/bit-flags-calculator.h"
16
17 PlayerStrength::PlayerStrength(player_type *player_ptr)
18     : PlayerBasicStatistics(player_ptr)
19 {
20 }
21
22 void PlayerStrength::set_locals()
23 {
24     this->max_value = +99;
25     this->min_value = -99;
26     this->ability_type = A_STR;
27     this->tr_flag = TR_STR;
28     this->tr_bad_flag = TR_STR;
29 }
30
31 /*!
32  * @brief 腕力補正計算 - 種族
33  * @return 腕力補正値
34  */
35 int16_t PlayerStrength::race_value()
36 {
37     int16_t result = PlayerBasicStatistics::race_value();
38
39     result += PlayerRace(this->player_ptr).additional_strength();
40
41     return result;
42 }
43
44 /*!
45  * @brief 腕力補正計算 - 一時効果
46  * @return 腕力補正値
47  * @details
48  * * 一時効果による腕力修正値
49  * * 呪術の腕力強化で加算(+4)
50  * * 呪術の肉体強化で加算(+4)
51  * * ネオ・つよしスペシャル中で加算(+4)
52  */
53 int16_t PlayerStrength::time_effect_value()
54 {
55     int16_t result = 0;
56
57     if (this->player_ptr->realm1 == REALM_HEX) {
58         SpellHex spell_hex(this->player_ptr);
59         if (spell_hex.is_spelling_specific(HEX_XTRA_MIGHT)) {
60             result += 4;
61         }
62         if (spell_hex.is_spelling_specific(HEX_BUILDING)) {
63             result += 4;
64         }
65     }
66
67     if (this->player_ptr->tsuyoshi) {
68         result += 4;
69     }
70
71     return result;
72 }
73
74 /*!
75  * @brief 腕力補正計算 - 型
76  * @return 腕力補正値
77  * @details
78  * * 型による腕力修正値
79  * * 降鬼陣で加算(+5)
80  * * 白虎の構えで加算(+2)
81  * * 朱雀の構えで減算(-2)
82  */
83 int16_t PlayerStrength::stance_value()
84 {
85     int16_t result = 0;
86
87     PlayerClass pc(player_ptr);
88     if (pc.samurai_stance_is(SamuraiStance::KOUKIJIN)) {
89         result += 5;
90     }
91
92     if (pc.monk_stance_is(MonkStance::BYAKKO)) {
93         result += 2;
94     } else if (pc.monk_stance_is(MonkStance::SUZAKU)) {
95         result -= 2;
96     }
97
98     return result;
99 }
100
101 /*!
102  * @brief 腕力補正計算 - 変異
103  * @return 腕力補正値
104  * @details
105  * * 変異による腕力修正値
106  * * 変異MUT3_HYPER_STRで加算(+4)
107  * * 変異MUT3_PUNYで減算(-4)
108  */
109 int16_t PlayerStrength::mutation_value()
110 {
111     int16_t result = 0;
112
113     if (this->player_ptr->muta.any()) {
114         if (this->player_ptr->muta.has(PlayerMutationType::HYPER_STR)) {
115             result += 4;
116         }
117
118         if (this->player_ptr->muta.has(PlayerMutationType::PUNY)) {
119             result -= 4;
120         }
121     }
122
123     return result;
124 }