OSDN Git Service

[Refactor] #1489 Moved player-class.* and player-class-types.h to player-info/
[hengbandforosx/hengbandosx.git] / src / player-ability / player-constitution.cpp
1 #include "player-ability/player-constitution.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 PlayerConstitution::set_locals()
15 {
16     this->max_value = +99;
17     this->min_value = -99;
18     this->ability_type = A_CON;
19     this->tr_flag = TR_CON;
20     this->tr_bad_flag = TR_CON;
21 }
22
23 /*!
24  * @brief 耐久力補正計算 - 種族
25  * @return 耐久力補正値
26  * @details
27  * * 種族による耐久力修正値。
28  * * エントは別途レベル26,41,46到達ごとに加算(+1)
29  */
30 int16_t PlayerConstitution::race_value()
31 {
32     int16_t result = PlayerBasicStatistics::race_value();
33
34     if (PlayerRace(this->owner_ptr).equals(player_race_type::ENT)) {
35         if (this->owner_ptr->lev > 25)
36             result++;
37         if (this->owner_ptr->lev > 40)
38             result++;
39         if (this->owner_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 PlayerConstitution::time_effect_value()
54 {
55     int16_t result = 0;
56
57     if (this->owner_ptr->realm1 == REALM_HEX) {
58         if (RealmHex(this->owner_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  * * 白虎の構えで減算(-3)
73  * * 玄武の構えで加算(+3)
74  * * 朱雀の構えで減算(-2)
75  * * ネオ・つよしスペシャル中で加算(+4)
76  */
77 int16_t PlayerConstitution::battleform_value()
78 {
79     int16_t result = 0;
80
81     if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
82         result += 5;
83     }
84
85     if (any_bits(this->owner_ptr->special_defense, KAMAE_BYAKKO)) {
86         result -= 3;
87     } else if (any_bits(this->owner_ptr->special_defense, KAMAE_GENBU)) {
88         result += 3;
89     } else if (any_bits(this->owner_ptr->special_defense, KAMAE_SUZAKU)) {
90         result -= 2;
91     }
92     if (this->owner_ptr->tsuyoshi) {
93         result += 4;
94     }
95
96     return result;
97 }
98
99 /*!
100  * @brief 耐久力補正計算 - 変異
101  * @return 耐久力補正値
102  * @details
103  * * 変異による耐久力修正値
104  * * 変異MUT3_RESILIENTで加算(+4)
105  * * 変異MUT3_ALBINOで減算(-4)
106  * * 変異MUT3_XTRA_FATで加算(+2)
107  * * 変異MUT3_FLESH_ROTで減算(-2)
108  */
109 int16_t PlayerConstitution::mutation_value()
110 {
111     int16_t result = 0;
112
113     if (this->owner_ptr->muta.any()) {
114         if (this->owner_ptr->muta.has(MUTA::RESILIENT)) {
115             result += 4;
116         }
117
118         if (this->owner_ptr->muta.has(MUTA::ALBINO)) {
119             result -= 4;
120         }
121
122         if (this->owner_ptr->muta.has(MUTA::XTRA_FAT)) {
123             result += 2;
124         }
125
126         if (this->owner_ptr->muta.has(MUTA::FLESH_ROT)) {
127             result -= 2;
128         }
129     }
130
131     return result;
132 }