OSDN Git Service

[Refactor] #40414 Renamed class-related racials from racial-* to mind-*
[hengbandforosx/hengbandosx.git] / src / mind / mind-mindcrafter.c
1 #include "mind/mind-mindcrafter.h"
2 #include "autopick/autopick.h"
3 #include "inventory/player-inventory.h"
4 #include "object-enchant/item-feeling.h"
5 #include "object-enchant/special-object-flags.h"
6 #include "object/item-use-flags.h"
7 #include "object/object-flavor.h"
8 #include "object/object-mark-types.h"
9 #include "perception/object-perception.h"
10 #include "perception/simple-perception.h"
11
12 /*!
13  * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
14  * @param caster_ptr プレーヤーへの参照ポインタ
15  * @return なし
16  * @note
17  * currently this function allows pseudo-id of any object,
18  * including silly ones like potions & scrolls, which always
19  * get '{average}'. This should be changed, either to stop such
20  * items from being pseudo-id'd, or to allow psychometry to
21  * detect whether the unidentified potion/scroll/etc is
22  * good (Cure Light Wounds, Restore Strength, etc) or
23  * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
24  */
25 bool psychometry(player_type *caster_ptr)
26 {
27     concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
28     concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
29     object_type *o_ptr;
30     OBJECT_IDX item;
31     o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
32     if (!o_ptr)
33         return FALSE;
34
35     if (object_is_known(o_ptr)) {
36         msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
37         return TRUE;
38     }
39
40     item_feel_type feel = pseudo_value_check_heavy(o_ptr);
41     GAME_TEXT o_name[MAX_NLEN];
42     object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
43
44     if (!feel) {
45         msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
46         return TRUE;
47     }
48
49 #ifdef JP
50     msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
51 #else
52     msg_format("You feel that the %s %s %s...", o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
53 #endif
54
55     o_ptr->ident |= (IDENT_SENSE);
56     o_ptr->feeling = feel;
57     o_ptr->marked |= OM_TOUCHED;
58
59     caster_ptr->update |= (PU_COMBINE | PU_REORDER);
60     caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
61
62     bool okay = FALSE;
63     switch (o_ptr->tval) {
64     case TV_SHOT:
65     case TV_ARROW:
66     case TV_BOLT:
67     case TV_BOW:
68     case TV_DIGGING:
69     case TV_HAFTED:
70     case TV_POLEARM:
71     case TV_SWORD:
72     case TV_BOOTS:
73     case TV_GLOVES:
74     case TV_HELM:
75     case TV_CROWN:
76     case TV_SHIELD:
77     case TV_CLOAK:
78     case TV_SOFT_ARMOR:
79     case TV_HARD_ARMOR:
80     case TV_DRAG_ARMOR:
81     case TV_CARD:
82     case TV_RING:
83     case TV_AMULET:
84     case TV_LITE:
85     case TV_FIGURINE:
86         okay = TRUE;
87         break;
88     }
89
90     autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
91     return TRUE;
92 }