1 #include "spell-kind/spells-perception.h"
2 #include "autopick/autopick.h"
3 #include "core/player-update-types.h"
4 #include "core/stuff-handler.h"
5 #include "core/window-redrawer.h"
6 #include "flavor/flavor-describer.h"
7 #include "flavor/object-flavor-types.h"
8 #include "floor/floor-object.h"
9 #include "game-option/auto-destruction-options.h"
10 #include "game-option/play-record-options.h"
11 #include "inventory/inventory-describer.h"
12 #include "inventory/inventory-slot-types.h"
13 #include "inventory/player-inventory.h"
14 #include "io/write-diary.h"
15 #include "object-enchant/special-object-flags.h"
16 #include "object-hook/hook-enchant.h"
17 #include "object-hook/hook-perception.h"
18 #include "object-hook/hook-weapon.h"
19 #include "object/item-tester-hooker.h"
20 #include "object/item-use-flags.h"
21 #include "object/object-info.h"
22 #include "object/object-mark-types.h"
23 #include "perception/identification.h"
24 #include "perception/object-perception.h"
25 #include "player-info/avatar.h"
26 #include "system/object-type-definition.h"
27 #include "view/display-messages.h"
28 #include "world/world.h"
31 * @brief 全所持アイテム鑑定処理 /
32 * Identify everything being carried.
33 * Done by a potion of "self knowledge".
34 * @param target_ptr プレーヤーへの参照ポインタ
37 void identify_pack(player_type *target_ptr)
39 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
40 object_type *o_ptr = &target_ptr->inventory_list[i];
44 identify_item(target_ptr, o_ptr);
45 autopick_alter_item(target_ptr, i, FALSE);
52 * @param owner_ptr プレーヤーへの参照ポインタ
53 * @param o_ptr 鑑定されるアイテムの情報参照ポインタ
54 * @return 実際に鑑定できたらTRUEを返す
56 bool identify_item(player_type *owner_ptr, object_type *o_ptr)
58 GAME_TEXT o_name[MAX_NLEN];
59 describe_flavor(owner_ptr, o_name, o_ptr, 0);
61 bool old_known = FALSE;
62 if (o_ptr->ident & IDENT_KNOWN)
65 if (!object_is_fully_known(o_ptr)) {
66 if (object_is_artifact(o_ptr) || one_in_(5))
67 chg_virtue(owner_ptr, V_KNOWLEDGE, 1);
70 object_aware(owner_ptr, o_ptr);
72 o_ptr->marked |= OM_TOUCHED;
74 owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
75 owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
77 strcpy(record_o_name, o_name);
78 record_turn = current_world_ptr->game_turn;
80 describe_flavor(owner_ptr, o_name, o_ptr, OD_NAME_ONLY);
82 if (record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
83 exe_write_diary(owner_ptr, DIARY_ART, 0, o_name);
84 if (record_rand_art && !old_known && o_ptr->art_name)
85 exe_write_diary(owner_ptr, DIARY_ART, 0, o_name);
91 * @brief アイテム鑑定のメインルーチン処理 /
92 * Identify an object in the inventory (or on the floor)
93 * @param caster_ptr プレーヤーへの参照ポインタ
94 * @param only_equip 装備品のみを対象とするならばTRUEを返す
95 * @return 実際に鑑定を行ったならばTRUEを返す
97 * This routine does *not* automatically combine objects.
98 * Returns TRUE if something was identified, else FALSE.
100 bool ident_spell(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval)
103 item_tester_hook = item_tester_hook_identify_weapon_armour;
105 item_tester_hook = item_tester_hook_identify;
108 if (can_get_item(caster_ptr, item_tester_tval)) {
109 q = _("どのアイテムを鑑定しますか? ", "Identify which item? ");
112 item_tester_hook = object_is_weapon_armour_ammo;
114 item_tester_hook = NULL;
116 q = _("すべて鑑定済みです。 ", "All items are identified. ");
119 concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
122 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
126 bool old_known = identify_item(caster_ptr, o_ptr);
128 GAME_TEXT o_name[MAX_NLEN];
129 describe_flavor(caster_ptr, o_name, o_ptr, 0);
130 if (item >= INVEN_RARM) {
131 msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item));
132 } else if (item >= 0) {
133 msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item));
135 msg_format(_("床上: %s。", "On the ground: %s."), o_name);
138 autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known));
143 * @brief アイテム*鑑定*のメインルーチン処理 /
144 * Identify an object in the inventory (or on the floor)
145 * @param caster_ptr プレーヤーへの参照ポインタ
146 * @param only_equip 装備品のみを対象とするならばTRUEを返す
147 * @return 実際に鑑定を行ったならばTRUEを返す
149 * Fully "identify" an object in the inventory -BEN-
150 * This routine returns TRUE if an item was identified.
152 bool identify_fully(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval)
155 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
157 item_tester_hook = item_tester_hook_identify_fully;
160 if (can_get_item(caster_ptr, item_tester_tval)) {
161 q = _("どのアイテムを*鑑定*しますか? ", "*Identify* which item? ");
164 item_tester_hook = object_is_weapon_armour_ammo;
166 item_tester_hook = NULL;
168 q = _("すべて*鑑定*済みです。 ", "All items are *identified*. ");
171 concptr s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*.");
175 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
179 bool old_known = identify_item(caster_ptr, o_ptr);
181 o_ptr->ident |= (IDENT_FULL_KNOWN);
182 handle_stuff(caster_ptr);
184 GAME_TEXT o_name[MAX_NLEN];
185 describe_flavor(caster_ptr, o_name, o_ptr, 0);
186 if (item >= INVEN_RARM) {
187 msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item));
188 } else if (item >= 0) {
189 msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item));
191 msg_format(_("床上: %s。", "On the ground: %s."), o_name);
194 (void)screen_object(caster_ptr, o_ptr, 0L);
195 autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known));