OSDN Git Service

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