OSDN Git Service

Merge pull request #1718 from habu1010/feature/monk-class-specific-data
[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 void PlayerDexterity::set_locals()
18 {
19     this->max_value = +99;
20     this->min_value = -99;
21     this->ability_type = A_DEX;
22     this->tr_flag = TR_DEX;
23     this->tr_bad_flag = TR_DEX;
24 }
25
26 /*!
27  * @brief 器用さ補正計算 - 種族
28  * @return 器用さ補正値
29  * @details
30  * * 種族による器用さ修正値。
31  * * エントは別途レベル26,41,46到達ごとに減算(-1)
32  */
33 int16_t PlayerDexterity::race_value()
34 {
35     int16_t result = PlayerBasicStatistics::race_value();
36
37     if (PlayerRace(this->player_ptr).equals(player_race_type::ENT)) {
38         if (this->player_ptr->lev > 25)
39             result--;
40         if (this->player_ptr->lev > 40)
41             result--;
42         if (this->player_ptr->lev > 45)
43             result--;
44     }
45
46     return result;
47 }
48
49 /*!
50  * @brief 器用さ補正計算 - 一時効果
51  * @return 器用さ補正値
52  * @details
53  * * 一時効果による器用さ修正値
54  * * 呪術の肉体強化で加算(+4)
55  */
56 int16_t PlayerDexterity::time_effect_value()
57 {
58     int16_t result = 0;
59
60     if (this->player_ptr->realm1 == REALM_HEX) {
61         if (SpellHex(this->player_ptr).is_spelling_specific(HEX_BUILDING)) {
62             result += 4;
63         }
64     }
65
66     return result;
67 }
68
69 /*!
70  * @brief 器用さ補正計算 - 型
71  * @return 器用さ補正値
72  * @details
73  * * 型による器用さ修正値
74  * * 降鬼陣で加算(+5)
75  * * 白虎の構えで加算(+2)
76  * * 玄武の構えで減算(-2)
77  * * 朱雀の構えで加算(+2)
78  */
79 int16_t PlayerDexterity::battleform_value()
80 {
81     int16_t result = 0;
82
83     PlayerClass pc(player_ptr);
84     if (pc.samurai_stance_is(SamuraiStance::KOUKIJIN)) {
85         result += 5;
86     }
87
88     if (pc.monk_stance_is(MonkStance::BYAKKO)) {
89         result += 2;
90     } else if (pc.monk_stance_is(MonkStance::GENBU)) {
91         result -= 2;
92     } else if (pc.monk_stance_is(MonkStance::SUZAKU)) {
93         result += 2;
94     }
95
96     return result;
97 }
98
99 /*!
100  * @brief 器用さ腕力補正計算 - 変異
101  * @return 器用さ補正値
102  * @details
103  * * 変異による器用さ修正値
104  * * 変異MUT3_IRON_SKINで減算(-1)
105  * * 変異MUT3_LIMBERで加算(+3)
106  * * 変異MUT3_ARTHRITISで減算(-3)
107  */
108 int16_t PlayerDexterity::mutation_value()
109 {
110     int16_t result = 0;
111
112     if (this->player_ptr->muta.has(MUTA::IRON_SKIN)) {
113         result -= 1;
114     }
115
116     if (this->player_ptr->muta.has(MUTA::LIMBER)) {
117         result += 3;
118     }
119
120     if (this->player_ptr->muta.has(MUTA::ARTHRITIS)) {
121         result -= 3;
122     }
123
124     return result;
125 }