1 #include "object-hook/hook-expendable.h"
2 #include "artifact/fixed-art-types.h"
3 #include "core/player-update-types.h"
4 #include "core/window-redrawer.h"
5 #include "monster-race/monster-race.h"
6 #include "object-enchant/item-feeling.h"
7 #include "object-enchant/special-object-flags.h"
8 #include "object-hook/hook-checker.h"
9 #include "object-hook/hook-enchant.h"
10 #include "object/object-kind.h"
11 #include "perception/object-perception.h"
12 #include "player/mimic-info-table.h"
13 #include "sv-definition/sv-lite-types.h"
14 #include "sv-definition/sv-other-types.h"
15 #include "system/object-type-definition.h"
16 #include "util/string-processor.h"
19 * @brief オブジェクトをプレイヤーが食べることができるかを判定する /
20 * Hook to determine if an object is eatable
21 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
22 * @return 食べることが可能ならばTRUEを返す
24 bool item_tester_hook_eatable(player_type *player_ptr, object_type *o_ptr)
26 if (o_ptr->tval == TV_FOOD)
29 if (is_specific_player_race(player_ptr, RACE_SKELETON) || is_specific_player_race(player_ptr, RACE_GOLEM)
30 || is_specific_player_race(player_ptr, RACE_ZOMBIE) || is_specific_player_race(player_ptr, RACE_SPECTRE)) {
31 if (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND)
33 } else if (is_specific_player_race(player_ptr, RACE_BALROG) || (mimic_info[player_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) {
34 if (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE && angband_strchr("pht", r_info[o_ptr->pval].d_char))
42 * @brief オブジェクトをプレイヤーが飲むことができるかを判定する /
43 * Hook to determine if an object can be quaffed
44 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
45 * @return 飲むことが可能ならばTRUEを返す
47 bool item_tester_hook_quaff(player_type *player_ptr, object_type *o_ptr)
49 if (o_ptr->tval == TV_POTION)
52 if (is_specific_player_race(player_ptr, RACE_ANDROID) && (o_ptr->tval == TV_FLASK) && (o_ptr->sval == SV_FLASK_OIL))
59 * @brief オブジェクトをプレイヤーが読むことができるかを判定する /
60 * Hook to determine if an object is readable
61 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
62 * @return 読むことが可能ならばTRUEを返す
64 bool item_tester_hook_readable(player_type *player_ptr, object_type *o_ptr)
69 if ((o_ptr->tval == TV_SCROLL) || (o_ptr->tval == TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER))
76 * @brief オブジェクトがランタンの燃料になるかどうかを判定する
77 * An "item_tester_hook" for refilling lanterns
78 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
79 * @return オブジェクトがランタンの燃料になるならばTRUEを返す
81 bool item_tester_refill_lantern(player_type *player_ptr, object_type *o_ptr)
86 if ((o_ptr->tval == TV_FLASK) || ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN)))
93 * @brief オブジェクトが松明に束ねられるかどうかを判定する
94 * An "item_tester_hook" for refilling torches
95 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
96 * @return オブジェクトが松明に束ねられるならばTRUEを返す
98 bool object_can_refill_torch(player_type *player_ptr, object_type *o_ptr)
103 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
110 * @brief 破壊可能なアイテムかを返す /
111 * Determines whether an object can be destroyed, and makes fake inscription.
112 * @param o_ptr 破壊可能かを確認したいオブジェクトの構造体参照ポインタ
113 * @return オブジェクトが破壊可能ならばTRUEを返す
115 bool can_player_destroy_object(player_type *player_ptr, object_type *o_ptr)
117 /* Artifacts cannot be destroyed */
118 if (!object_is_artifact(o_ptr))
121 if (!object_is_known(o_ptr)) {
122 byte feel = FEEL_SPECIAL;
123 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
124 feel = FEEL_TERRIBLE;
126 o_ptr->feeling = feel;
127 o_ptr->ident |= IDENT_SENSE;
128 player_ptr->update |= (PU_COMBINE);
129 player_ptr->window |= (PW_INVEN | PW_EQUIP);
137 * @brief オブジェクトが薬であるかを返す
138 * @param o_ptr 対象のオブジェクト構造体ポインタ
139 * @return オブジェクトが薬ならばTRUEを返す
141 bool object_is_potion(object_type *o_ptr) { return (k_info[o_ptr->k_idx].tval == TV_POTION); }