OSDN Git Service

Merge pull request #513 from iks3/fix-sub-window-item-on-floor
[hengbandforosx/hengbandosx.git] / src / player-status / player-constitution.cpp
1 #include "player-status/player-constitution.h"
2 #include "mutation/mutation-flag-types.h"
3 #include "object/object-flags.h"
4 #include "player/mimic-info-table.h"
5 #include "player/player-class.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 "util/bit-flags-calculator.h"
12
13 void PlayerConstitution::set_locals()
14 {
15     this->max_value = +99;
16     this->min_value = -99;
17     this->status_type = A_CON;
18     this->tr_flag = TR_CON;
19     this->tr_bad_flag = TR_CON;
20 }
21
22 /*!
23  * @brief 耐久力補正計算 - 種族
24  * @return 耐久力補正値
25  * @details
26  * * 種族による耐久力修正値。
27  * * エントは別途レベル26,41,46到達ごとに加算(+1)
28  */
29 s16b PlayerConstitution::race_value()
30 {
31     s16b result = PlayerBasicStatistics::race_value();
32
33     if (is_specific_player_race(this->owner_ptr, RACE_ENT)) {
34         if (this->owner_ptr->lev > 25)
35             result++;
36         if (this->owner_ptr->lev > 40)
37             result++;
38         if (this->owner_ptr->lev > 45)
39             result++;
40     }
41
42     return result;
43 }
44
45 /*!
46  * @brief 耐久力補正計算 - 一時効果
47  * @return 耐久力補正値
48  * @details
49  * * 一時効果による耐久力修正値
50  * * 呪術の肉体強化で加算(+4)
51  */
52 s16b PlayerConstitution::time_effect_value()
53 {
54     s16b result = 0;
55
56     if (this->owner_ptr->realm1 == REALM_HEX) {
57         if (hex_spelling(this->owner_ptr, HEX_BUILDING)) {
58             result += 4;
59         }
60     }
61
62     return result;
63 }
64
65
66 /*!
67  * @brief 耐久力補正計算 - 型
68  * @return 耐久力補正値
69  * @details
70  * * 型による耐久力修正値
71  * * 降鬼陣で加算(+5)
72  * * 白虎の構えで減算(-3)
73  * * 玄武の構えで加算(+3)
74  * * 朱雀の構えで減算(-2)
75  * * ネオ・つよしスペシャル中で加算(+4)
76  */
77 s16b PlayerConstitution::battleform_value()
78 {
79     s16b 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 s16b PlayerConstitution::mutation_value()
110 {
111     s16b result = 0;
112
113     if (this->owner_ptr->muta3) {
114         if (any_bits(this->owner_ptr->muta3, MUT3_RESILIENT)) {
115             result += 4;
116         }
117
118         if (any_bits(this->owner_ptr->muta3, MUT3_ALBINO)) {
119             result -= 4;
120         }
121
122         if (any_bits(this->owner_ptr->muta3, MUT3_XTRA_FAT)) {
123             result += 2;
124         }
125
126         if (any_bits(this->owner_ptr->muta3, MUT3_FLESH_ROT)) {
127             result -= 2;
128         }
129     }
130
131     return result;
132 }