OSDN Git Service

96c0f9c297d470efa2b65cea68675752a27f4ca2
[hengbandforosx/hengbandosx.git] / src / player-ability / player-intelligence.cpp
1 #include "player-ability/player-intelligence.h"
2 #include "mutation/mutation-flag-types.h"
3 #include "object/object-flags.h"
4 #include "player-base/player-class.h"
5 #include "player-info/class-info.h"
6 #include "player-info/mimic-info-table.h"
7 #include "player-info/monk-data-type.h"
8 #include "player-info/samurai-data-type.h"
9 #include "player/player-personality.h"
10 #include "player/race-info-table.h"
11 #include "player/special-defense-types.h"
12 #include "realm/realm-hex-numbers.h"
13 #include "spell-realm/spells-hex.h"
14 #include "system/player-type-definition.h"
15 #include "util/bit-flags-calculator.h"
16
17 PlayerIntelligence::PlayerIntelligence(player_type *player_ptr)
18     : PlayerBasicStatistics(player_ptr)
19 {
20 }
21
22 void PlayerIntelligence::set_locals()
23 {
24     this->max_value = +99;
25     this->min_value = -99;
26     this->ability_type = A_INT;
27     this->tr_flag = TR_INT;
28     this->tr_bad_flag = TR_INT;
29 }
30
31 /*!
32  * @brief 知力補正計算 - 型
33  * @return 知力補正値
34  * @details
35  * * 型による知力修正値
36  * * 降鬼陣で加算(+5)
37  * * 玄武の構えで減算(-1)
38  * * 朱雀の構えで加算(+1)
39  */
40 int16_t PlayerIntelligence::stance_value()
41 {
42     int16_t result = 0;
43
44     PlayerClass pc(player_ptr);
45     if (pc.samurai_stance_is(SamuraiStance::KOUKIJIN)) {
46         result += 5;
47     }
48
49     if (pc.monk_stance_is(MonkStance::GENBU)) {
50         result -= 1;
51     } else if (pc.monk_stance_is(MonkStance::SUZAKU)) {
52         result += 1;
53     }
54
55     return result;
56 }
57
58 /*!
59  * @brief 知力補正計算 - 変異
60  * @return 知力補正値
61  * @details
62  * * 変異による知力修正値
63  * * 変異MUT3_HYPER_INTで加算(+4)
64  * * 変異MUT3_MORONICで減算(-4)
65  */
66 int16_t PlayerIntelligence::mutation_value()
67 {
68     int16_t result = 0;
69     if (this->player_ptr->muta.any()) {
70         if (this->player_ptr->muta.has(MUTA::HYPER_INT)) {
71             result += 4;
72         }
73
74         if (this->player_ptr->muta.has(MUTA::MORONIC)) {
75             result -= 4;
76         }
77     }
78     return result;
79 }