OSDN Git Service

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