OSDN Git Service

Merge pull request #3569 from sikabane-works/release/3.0.0.88-alpha
[hengbandforosx/hengbandosx.git] / src / object-hook / hook-perception.cpp
1 #include "object-hook/hook-perception.h"
2 #include "object-hook/hook-weapon.h"
3 #include "perception/object-perception.h"
4 #include "system/item-entity.h"
5 #include "system/player-type-definition.h"
6
7 /*!
8  * @brief アイテムが並の価値のアイテムかどうか判定する /
9  * Check if an object is nameless weapon or armour
10  * @param o_ptr 判定するアイテムの情報参照ポインタ
11  * @return 並ならばTRUEを返す
12  */
13 bool object_is_nameless_weapon_armour(const ItemEntity *o_ptr)
14 {
15     /* Require weapon or armour */
16     if (!o_ptr->is_weapon_armour_ammo()) {
17         return false;
18     }
19
20     /* Require nameless object if the object is well known */
21     if (o_ptr->is_known() && !o_ptr->is_nameless()) {
22         return false;
23     }
24
25     return true;
26 }
27
28 /*!
29  * @brief アイテムが未鑑定かを判定する /
30  * @param o_ptr 判定するアイテムの情報参照ポインタ
31  * @return 実際に未鑑定ならばTRUEを返す
32  */
33 bool object_is_not_identified(const ItemEntity *o_ptr)
34 {
35     return !o_ptr->is_known();
36 }
37
38 /*!
39  * @brief アイテムが未鑑定の武器防具かを判定する /
40  * @param o_ptr 判定するアイテムの情報参照ポインタ
41  * @return 実際に未鑑定の武器防具ならばTRUEを返す
42  */
43 bool object_is_not_identified_weapon_armor(const ItemEntity *o_ptr)
44 {
45     if (!object_is_not_identified(o_ptr)) {
46         return false;
47     }
48
49     return o_ptr->is_weapon_armour_ammo();
50 }
51
52 /*!
53  * @brief アイテムが未*鑑定*かを判定する /
54  * @param o_ptr 判定するアイテムの情報参照ポインタ
55  * @return 実際に未*鑑定*ならばTRUEを返す
56  */
57 bool object_is_not_fully_identified(const ItemEntity *o_ptr)
58 {
59     return !o_ptr->is_known() || !o_ptr->is_fully_known();
60 }
61
62 /*!
63  * @brief アイテムが未*鑑定*の武器防具かを判定する /
64  * @param o_ptr 判定するアイテムの情報参照ポインタ
65  * @return 実際に未*鑑定*の武器防具ならばTRUEを返す
66  */
67 bool object_is_not_fully_identified_weapon_armour(const ItemEntity *o_ptr)
68 {
69     if (!object_is_not_fully_identified(o_ptr)) {
70         return false;
71     }
72
73     return o_ptr->is_weapon_armour_ammo();
74 }