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-info/avatar.h"
26 #include "system/object-type-definition.h"
27 #include "system/player-type-definition.h"
28 #include "view/display-messages.h"
29 #include "player/player-status-flags.h"
32 * @brief 擬似鑑定を実際に行い判定を反映する
33 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
34 * @param creature_ptr プレーヤーへの参照ポインタ
35 * @param heavy 重度の擬似鑑定を行うならばTRUE
37 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
39 object_type *o_ptr = &creature_ptr->inventory_list[slot];
40 GAME_TEXT o_name[MAX_NLEN];
41 if (o_ptr->ident & (IDENT_SENSE))
43 if (object_is_known(o_ptr))
46 item_feel_type feel = (heavy ? pseudo_value_check_heavy(o_ptr) : pseudo_value_check_light(o_ptr));
50 if ((creature_ptr->muta.has(MUTA::BAD_LUCK)) && !randint0(13)) {
56 case FEEL_WORTHLESS: {
57 feel = FEEL_EXCELLENT;
62 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
68 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
73 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
78 case FEEL_EXCELLENT: {
79 feel = FEEL_WORTHLESS;
93 disturb(creature_ptr, false, false);
95 describe_flavor(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
96 if (slot >= INVEN_MAIN_HAND) {
98 msg_format("%s%s(%c)は%sという感じがする...", describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
100 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(creature_ptr, slot),
101 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
106 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
108 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]);
112 o_ptr->ident |= (IDENT_SENSE);
113 o_ptr->feeling = feel;
115 autopick_alter_item(creature_ptr, slot, destroy_feeling);
116 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
117 creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP);
121 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
123 * Sense the inventory\n
125 * Class 0 = Warrior --> fast and heavy\n
126 * Class 1 = Mage --> slow and light\n
127 * Class 2 = Priest --> fast but light\n
128 * Class 3 = Rogue --> okay and heavy\n
129 * Class 4 = Ranger --> slow but heavy (changed!)\n
130 * Class 5 = Paladin --> slow but heavy\n
132 void sense_inventory1(player_type *creature_ptr)
134 PLAYER_LEVEL plev = creature_ptr->lev;
137 if (creature_ptr->confused)
140 switch (creature_ptr->pclass) {
144 case CLASS_CAVALRY: {
145 if (0 != randint0(9000L / (plev * plev + 40)))
152 if (0 != randint0(6000L / (plev * plev + 50)))
159 case CLASS_HIGH_MAGE:
161 case CLASS_MAGIC_EATER:
162 case CLASS_ELEMENTALIST: {
163 if (0 != randint0(240000L / (plev + 5)))
170 if (0 != randint0(10000L / (plev * plev + 40)))
177 if (0 != randint0(20000L / (plev * plev + 40)))
184 if (0 != randint0(95000L / (plev * plev + 40)))
192 if (0 != randint0(77777L / (plev * plev + 40)))
198 case CLASS_WARRIOR_MAGE:
199 case CLASS_RED_MAGE: {
200 if (0 != randint0(75000L / (plev * plev + 40)))
205 case CLASS_MINDCRAFTER:
207 case CLASS_BLUE_MAGE:
208 case CLASS_MIRROR_MASTER: {
209 if (0 != randint0(55000L / (plev * plev + 40)))
214 case CLASS_CHAOS_WARRIOR: {
215 if (0 != randint0(80000L / (plev * plev + 40)))
222 case CLASS_FORCETRAINER: {
223 if (0 != randint0(20000L / (plev * plev + 40)))
228 case CLASS_TOURIST: {
229 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
235 case CLASS_BEASTMASTER: {
236 if (0 != randint0(65000L / (plev * plev + 40)))
241 case CLASS_BERSERKER: {
250 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE))
253 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
256 o_ptr = &creature_ptr->inventory_list[i];
261 switch (o_ptr->tval) {
290 if ((i < INVEN_MAIN_HAND) && (0 != randint0(5)))
293 if (has_good_luck(creature_ptr) && !randint0(13)) {
297 sense_inventory_aux(creature_ptr, i, heavy);
302 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
304 void sense_inventory2(player_type *creature_ptr)
306 PLAYER_LEVEL plev = creature_ptr->lev;
309 if (creature_ptr->confused)
312 switch (creature_ptr->pclass) {
317 case CLASS_BERSERKER:
323 case CLASS_CHAOS_WARRIOR:
325 case CLASS_BEASTMASTER:
327 if (0 != randint0(240000L / (plev + 5)))
333 case CLASS_WARRIOR_MAGE:
336 if (0 != randint0(95000L / (plev * plev + 40)))
344 case CLASS_FORCETRAINER:
345 case CLASS_MINDCRAFTER: {
346 if (0 != randint0(20000L / (plev * plev + 40)))
352 case CLASS_HIGH_MAGE:
354 case CLASS_MAGIC_EATER:
355 case CLASS_MIRROR_MASTER:
356 case CLASS_BLUE_MAGE:
357 case CLASS_ELEMENTALIST: {
358 if (0 != randint0(9000L / (plev * plev + 40)))
363 case CLASS_TOURIST: {
364 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
374 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
376 o_ptr = &creature_ptr->inventory_list[i];
380 switch (o_ptr->tval) {
395 if ((i < INVEN_MAIN_HAND) && (0 != randint0(5)))
398 sense_inventory_aux(creature_ptr, i, true);
403 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
404 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
405 * @return 擬似鑑定結果のIDを返す。
407 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
409 if (object_is_artifact(o_ptr)) {
410 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
411 return FEEL_TERRIBLE;
416 if (object_is_ego(o_ptr)) {
417 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
418 return FEEL_WORTHLESS;
420 return FEEL_EXCELLENT;
423 if (object_is_cursed(o_ptr))
425 if (object_is_broken(o_ptr))
427 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
431 if (o_ptr->to_h + o_ptr->to_d > 0)
438 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
439 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
440 * @return 擬似鑑定結果のIDを返す。
442 item_feel_type pseudo_value_check_light(object_type *o_ptr)
444 if (object_is_cursed(o_ptr))
446 if (object_is_broken(o_ptr))
448 if (object_is_artifact(o_ptr))
449 return FEEL_UNCURSED;
450 if (object_is_ego(o_ptr))
451 return FEEL_UNCURSED;
453 return FEEL_UNCURSED;
454 if (o_ptr->to_h + o_ptr->to_d > 0)
455 return FEEL_UNCURSED;