OSDN Git Service

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