7 #include "perception/simple-perception.h"
8 #include "autopick/autopick.h"
9 #include "core/disturbance.h"
10 #include "core/player-update-types.h"
11 #include "core/window-redrawer.h"
12 #include "flavor/flag-inscriptions-table.h"
13 #include "flavor/flavor-describer.h"
14 #include "flavor/object-flavor-types.h"
15 #include "game-option/auto-destruction-options.h"
16 #include "game-option/disturbance-options.h"
17 #include "inventory/inventory-describer.h"
18 #include "inventory/inventory-slot-types.h"
19 #include "mutation/mutation-flag-types.h"
20 #include "object-enchant/special-object-flags.h"
21 #include "object-hook/hook-checker.h"
22 #include "object-hook/hook-enchant.h"
23 #include "object/object-info.h"
24 #include "perception/object-perception.h"
25 #include "player/avatar.h"
26 #include "view/display-messages.h"
29 * @brief 擬似鑑定を実際に行い判定を反映する
30 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
31 * @param creature_ptr プレーヤーへの参照ポインタ
32 * @param heavy 重度の擬似鑑定を行うならばTRUE
35 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
37 object_type *o_ptr = &creature_ptr->inventory_list[slot];
38 GAME_TEXT o_name[MAX_NLEN];
39 if (o_ptr->ident & (IDENT_SENSE))
41 if (object_is_known(o_ptr))
44 item_feel_type feel = (heavy ? pseudo_value_check_heavy(o_ptr) : pseudo_value_check_light(o_ptr));
48 if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13)) {
54 case FEEL_WORTHLESS: {
55 feel = FEEL_EXCELLENT;
60 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
66 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
71 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
76 case FEEL_EXCELLENT: {
77 feel = FEEL_WORTHLESS;
88 disturb(creature_ptr, FALSE, FALSE);
90 describe_flavor(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
91 if (slot >= INVEN_RARM) {
93 msg_format("%s%s(%c)は%sという感じがする...", describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
95 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(creature_ptr, slot),
96 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
101 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
103 msg_format("You feel the %s (%c) in your pack %s %s...", o_name, index_to_label(slot), ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
107 o_ptr->ident |= (IDENT_SENSE);
108 o_ptr->feeling = feel;
110 autopick_alter_item(creature_ptr, slot, destroy_feeling);
111 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
112 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
116 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
119 * Sense the inventory\n
121 * Class 0 = Warrior --> fast and heavy\n
122 * Class 1 = Mage --> slow and light\n
123 * Class 2 = Priest --> fast but light\n
124 * Class 3 = Rogue --> okay and heavy\n
125 * Class 4 = Ranger --> slow but heavy (changed!)\n
126 * Class 5 = Paladin --> slow but heavy\n
128 void sense_inventory1(player_type *creature_ptr)
130 PLAYER_LEVEL plev = creature_ptr->lev;
133 if (creature_ptr->confused)
136 switch (creature_ptr->pclass) {
140 case CLASS_CAVALRY: {
141 if (0 != randint0(9000L / (plev * plev + 40)))
148 if (0 != randint0(6000L / (plev * plev + 50)))
155 case CLASS_HIGH_MAGE:
157 case CLASS_MAGIC_EATER: {
158 if (0 != randint0(240000L / (plev + 5)))
165 if (0 != randint0(10000L / (plev * plev + 40)))
172 if (0 != randint0(20000L / (plev * plev + 40)))
179 if (0 != randint0(95000L / (plev * plev + 40)))
187 if (0 != randint0(77777L / (plev * plev + 40)))
193 case CLASS_WARRIOR_MAGE:
194 case CLASS_RED_MAGE: {
195 if (0 != randint0(75000L / (plev * plev + 40)))
200 case CLASS_MINDCRAFTER:
202 case CLASS_BLUE_MAGE:
203 case CLASS_MIRROR_MASTER: {
204 if (0 != randint0(55000L / (plev * plev + 40)))
209 case CLASS_CHAOS_WARRIOR: {
210 if (0 != randint0(80000L / (plev * plev + 40)))
217 case CLASS_FORCETRAINER: {
218 if (0 != randint0(20000L / (plev * plev + 40)))
223 case CLASS_TOURIST: {
224 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
230 case CLASS_BEASTMASTER: {
231 if (0 != randint0(65000L / (plev * plev + 40)))
236 case CLASS_BERSERKER: {
242 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE))
245 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
248 o_ptr = &creature_ptr->inventory_list[i];
253 switch (o_ptr->tval) {
279 if ((i < INVEN_RARM) && (0 != randint0(5)))
282 if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13)) {
286 sense_inventory_aux(creature_ptr, i, heavy);
291 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
294 void sense_inventory2(player_type *creature_ptr)
296 PLAYER_LEVEL plev = creature_ptr->lev;
299 if (creature_ptr->confused)
302 switch (creature_ptr->pclass) {
307 case CLASS_BERSERKER:
313 case CLASS_CHAOS_WARRIOR:
315 case CLASS_BEASTMASTER:
317 if (0 != randint0(240000L / (plev + 5)))
323 case CLASS_WARRIOR_MAGE:
326 if (0 != randint0(95000L / (plev * plev + 40)))
334 case CLASS_FORCETRAINER:
335 case CLASS_MINDCRAFTER: {
336 if (0 != randint0(20000L / (plev * plev + 40)))
342 case CLASS_HIGH_MAGE:
344 case CLASS_MAGIC_EATER:
345 case CLASS_MIRROR_MASTER:
346 case CLASS_BLUE_MAGE: {
347 if (0 != randint0(9000L / (plev * plev + 40)))
352 case CLASS_TOURIST: {
353 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
360 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
362 o_ptr = &creature_ptr->inventory_list[i];
366 switch (o_ptr->tval) {
378 if ((i < INVEN_RARM) && (0 != randint0(5)))
381 sense_inventory_aux(creature_ptr, i, TRUE);
386 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
387 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
388 * @return 擬似鑑定結果のIDを返す。
390 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
392 if (object_is_artifact(o_ptr)) {
393 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
394 return FEEL_TERRIBLE;
399 if (object_is_ego(o_ptr)) {
400 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
401 return FEEL_WORTHLESS;
403 return FEEL_EXCELLENT;
406 if (object_is_cursed(o_ptr))
408 if (object_is_broken(o_ptr))
410 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
414 if (o_ptr->to_h + o_ptr->to_d > 0)
421 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
422 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
423 * @return 擬似鑑定結果のIDを返す。
425 item_feel_type pseudo_value_check_light(object_type *o_ptr)
427 if (object_is_cursed(o_ptr))
429 if (object_is_broken(o_ptr))
431 if (object_is_artifact(o_ptr))
432 return FEEL_UNCURSED;
433 if (object_is_ego(o_ptr))
434 return FEEL_UNCURSED;
436 return FEEL_UNCURSED;
437 if (o_ptr->to_h + o_ptr->to_d > 0)
438 return FEEL_UNCURSED;