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 "view/display-messages.h"
27 #include "player/player-status-flags.h"
30 * @brief 擬似鑑定を実際に行い判定を反映する
31 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
32 * @param creature_ptr プレーヤーへの参照ポインタ
33 * @param heavy 重度の擬似鑑定を行うならばTRUE
36 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
38 object_type *o_ptr = &creature_ptr->inventory_list[slot];
39 GAME_TEXT o_name[MAX_NLEN];
40 if (o_ptr->ident & (IDENT_SENSE))
42 if (object_is_known(o_ptr))
45 item_feel_type feel = (heavy ? pseudo_value_check_heavy(o_ptr) : pseudo_value_check_light(o_ptr));
49 if ((creature_ptr->muta.has(MUTA::BAD_LUCK)) && !randint0(13)) {
55 case FEEL_WORTHLESS: {
56 feel = FEEL_EXCELLENT;
61 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
67 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
72 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
77 case FEEL_EXCELLENT: {
78 feel = FEEL_WORTHLESS;
92 disturb(creature_ptr, FALSE, FALSE);
94 describe_flavor(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
95 if (slot >= INVEN_MAIN_HAND) {
97 msg_format("%s%s(%c)は%sという感じがする...", describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
99 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(creature_ptr, slot),
100 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
105 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
107 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]);
111 o_ptr->ident |= (IDENT_SENSE);
112 o_ptr->feeling = feel;
114 autopick_alter_item(creature_ptr, slot, destroy_feeling);
115 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
116 creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP);
120 * @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プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
305 void sense_inventory2(player_type *creature_ptr)
307 PLAYER_LEVEL plev = creature_ptr->lev;
310 if (creature_ptr->confused)
313 switch (creature_ptr->pclass) {
318 case CLASS_BERSERKER:
324 case CLASS_CHAOS_WARRIOR:
326 case CLASS_BEASTMASTER:
328 if (0 != randint0(240000L / (plev + 5)))
334 case CLASS_WARRIOR_MAGE:
337 if (0 != randint0(95000L / (plev * plev + 40)))
345 case CLASS_FORCETRAINER:
346 case CLASS_MINDCRAFTER: {
347 if (0 != randint0(20000L / (plev * plev + 40)))
353 case CLASS_HIGH_MAGE:
355 case CLASS_MAGIC_EATER:
356 case CLASS_MIRROR_MASTER:
357 case CLASS_BLUE_MAGE:
358 case CLASS_ELEMENTALIST: {
359 if (0 != randint0(9000L / (plev * plev + 40)))
364 case CLASS_TOURIST: {
365 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
375 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
377 o_ptr = &creature_ptr->inventory_list[i];
381 switch (o_ptr->tval) {
396 if ((i < INVEN_MAIN_HAND) && (0 != randint0(5)))
399 sense_inventory_aux(creature_ptr, i, TRUE);
404 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
405 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
406 * @return 擬似鑑定結果のIDを返す。
408 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
410 if (object_is_artifact(o_ptr)) {
411 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
412 return FEEL_TERRIBLE;
417 if (object_is_ego(o_ptr)) {
418 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
419 return FEEL_WORTHLESS;
421 return FEEL_EXCELLENT;
424 if (object_is_cursed(o_ptr))
426 if (object_is_broken(o_ptr))
428 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
432 if (o_ptr->to_h + o_ptr->to_d > 0)
439 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
440 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
441 * @return 擬似鑑定結果のIDを返す。
443 item_feel_type pseudo_value_check_light(object_type *o_ptr)
445 if (object_is_cursed(o_ptr))
447 if (object_is_broken(o_ptr))
449 if (object_is_artifact(o_ptr))
450 return FEEL_UNCURSED;
451 if (object_is_ego(o_ptr))
452 return FEEL_UNCURSED;
454 return FEEL_UNCURSED;
455 if (o_ptr->to_h + o_ptr->to_d > 0)
456 return FEEL_UNCURSED;