OSDN Git Service

Merge pull request #509 from habu1010/feature/fix-refactor-for-clang-warning
[hengbandforosx/hengbandosx.git] / src / player-status / player-intelligence.cpp
1 #include "player-status/player-intelligence.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 PlayerIntelligence::set_locals()
14 {
15     this->max_value = +99;
16     this->min_value = -99;
17     this->status_type = A_INT;
18     this->tr_flag = TR_INT;
19     this->tr_bad_flag = TR_INT;
20 }
21
22 /*!
23  * @brief 知力補正計算 - 型
24  * @return 知力補正値
25  * @details
26  * * 型による知力修正値
27  * * 降鬼陣で加算(+5)
28  * * 玄武の構えで減算(-1)
29  * * 朱雀の構えで加算(+1)
30  */
31 s16b PlayerIntelligence::battleform_value()
32 {
33     s16b result = 0;
34
35     if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
36         result += 5;
37     }
38
39     if (any_bits(this->owner_ptr->special_defense, KAMAE_GENBU)) {
40         result -= 1;
41     } else if (any_bits(this->owner_ptr->special_defense, KAMAE_SUZAKU)) {
42         result += 1;
43     }
44
45     return result;
46 }
47
48 /*!
49  * @brief 知力補正計算 - 変異
50  * @return 知力補正値
51  * @details
52  * * 変異による知力修正値
53  * * 変異MUT3_HYPER_INTで加算(+4)
54  * * 変異MUT3_MORONICで減算(-4)
55  */
56 s16b PlayerIntelligence::mutation_value()
57 {
58     s16b result = 0;
59     if (this->owner_ptr->muta3) {
60         if (any_bits(this->owner_ptr->muta3, MUT3_HYPER_INT)) {
61             result += 4;
62         }
63
64         if (any_bits(this->owner_ptr->muta3, MUT3_MORONIC)) {
65             result -= 4;
66         }
67     }
68     return result;
69 }