OSDN Git Service

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