OSDN Git Service

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