7 #include "perception/simple-perception.h"
8 #include "autopick/autopick.h"
9 #include "game-option/auto-destruction-options.h"
10 #include "game-option/disturbance-options.h"
11 #include "inventory/inventory-describer.h"
12 #include "inventory/inventory-slot-types.h"
13 #include "mutation/mutation-flag-types.h"
14 #include "object-enchant/special-object-flags.h"
15 #include "object-hook/hook-checker.h"
16 #include "object-hook/hook-enchant.h"
17 #include "object/object-flavor.h"
18 #include "object/object-info.h"
19 #include "perception/object-perception.h"
20 #include "player/avatar.h"
21 #include "player/player-move.h"
22 #include "view/display-messages.h"
25 * @brief 擬似鑑定を実際に行い判定を反映する
26 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
27 * @param creature_ptr プレーヤーへの参照ポインタ
28 * @param heavy 重度の擬似鑑定を行うならばTRUE
31 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
33 object_type *o_ptr = &creature_ptr->inventory_list[slot];
34 GAME_TEXT o_name[MAX_NLEN];
35 if (o_ptr->ident & (IDENT_SENSE))
37 if (object_is_known(o_ptr))
40 item_feel_type feel = (heavy ? pseudo_value_check_heavy(o_ptr) : pseudo_value_check_light(o_ptr));
44 if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13)) {
50 case FEEL_WORTHLESS: {
51 feel = FEEL_EXCELLENT;
56 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
62 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
67 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
72 case FEEL_EXCELLENT: {
73 feel = FEEL_WORTHLESS;
84 disturb(creature_ptr, FALSE, FALSE);
86 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
87 if (slot >= INVEN_RARM) {
89 msg_format("%s%s(%c)は%sという感じがする...", describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
91 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(creature_ptr, slot),
92 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
97 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
99 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]);
103 o_ptr->ident |= (IDENT_SENSE);
104 o_ptr->feeling = feel;
106 autopick_alter_item(creature_ptr, slot, destroy_feeling);
107 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
108 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
112 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
115 * Sense the inventory\n
117 * Class 0 = Warrior --> fast and heavy\n
118 * Class 1 = Mage --> slow and light\n
119 * Class 2 = Priest --> fast but light\n
120 * Class 3 = Rogue --> okay and heavy\n
121 * Class 4 = Ranger --> slow but heavy (changed!)\n
122 * Class 5 = Paladin --> slow but heavy\n
124 void sense_inventory1(player_type *creature_ptr)
126 PLAYER_LEVEL plev = creature_ptr->lev;
129 if (creature_ptr->confused)
132 switch (creature_ptr->pclass) {
136 case CLASS_CAVALRY: {
137 if (0 != randint0(9000L / (plev * plev + 40)))
144 if (0 != randint0(6000L / (plev * plev + 50)))
151 case CLASS_HIGH_MAGE:
153 case CLASS_MAGIC_EATER: {
154 if (0 != randint0(240000L / (plev + 5)))
161 if (0 != randint0(10000L / (plev * plev + 40)))
168 if (0 != randint0(20000L / (plev * plev + 40)))
175 if (0 != randint0(95000L / (plev * plev + 40)))
183 if (0 != randint0(77777L / (plev * plev + 40)))
189 case CLASS_WARRIOR_MAGE:
190 case CLASS_RED_MAGE: {
191 if (0 != randint0(75000L / (plev * plev + 40)))
196 case CLASS_MINDCRAFTER:
198 case CLASS_BLUE_MAGE:
199 case CLASS_MIRROR_MASTER: {
200 if (0 != randint0(55000L / (plev * plev + 40)))
205 case CLASS_CHAOS_WARRIOR: {
206 if (0 != randint0(80000L / (plev * plev + 40)))
213 case CLASS_FORCETRAINER: {
214 if (0 != randint0(20000L / (plev * plev + 40)))
219 case CLASS_TOURIST: {
220 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
226 case CLASS_BEASTMASTER: {
227 if (0 != randint0(65000L / (plev * plev + 40)))
232 case CLASS_BERSERKER: {
238 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE))
241 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
244 o_ptr = &creature_ptr->inventory_list[i];
249 switch (o_ptr->tval) {
275 if ((i < INVEN_RARM) && (0 != randint0(5)))
278 if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13)) {
282 sense_inventory_aux(creature_ptr, i, heavy);
287 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
290 void sense_inventory2(player_type *creature_ptr)
292 PLAYER_LEVEL plev = creature_ptr->lev;
295 if (creature_ptr->confused)
298 switch (creature_ptr->pclass) {
303 case CLASS_BERSERKER:
309 case CLASS_CHAOS_WARRIOR:
311 case CLASS_BEASTMASTER:
313 if (0 != randint0(240000L / (plev + 5)))
319 case CLASS_WARRIOR_MAGE:
322 if (0 != randint0(95000L / (plev * plev + 40)))
330 case CLASS_FORCETRAINER:
331 case CLASS_MINDCRAFTER: {
332 if (0 != randint0(20000L / (plev * plev + 40)))
338 case CLASS_HIGH_MAGE:
340 case CLASS_MAGIC_EATER:
341 case CLASS_MIRROR_MASTER:
342 case CLASS_BLUE_MAGE: {
343 if (0 != randint0(9000L / (plev * plev + 40)))
348 case CLASS_TOURIST: {
349 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
356 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
358 o_ptr = &creature_ptr->inventory_list[i];
362 switch (o_ptr->tval) {
374 if ((i < INVEN_RARM) && (0 != randint0(5)))
377 sense_inventory_aux(creature_ptr, i, TRUE);
382 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
383 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
384 * @return 擬似鑑定結果のIDを返す。
386 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
388 if (object_is_artifact(o_ptr)) {
389 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
390 return FEEL_TERRIBLE;
395 if (object_is_ego(o_ptr)) {
396 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
397 return FEEL_WORTHLESS;
399 return FEEL_EXCELLENT;
402 if (object_is_cursed(o_ptr))
404 if (object_is_broken(o_ptr))
406 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
410 if (o_ptr->to_h + o_ptr->to_d > 0)
417 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
418 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
419 * @return 擬似鑑定結果のIDを返す。
421 item_feel_type pseudo_value_check_light(object_type *o_ptr)
423 if (object_is_cursed(o_ptr))
425 if (object_is_broken(o_ptr))
427 if (object_is_artifact(o_ptr))
428 return FEEL_UNCURSED;
429 if (object_is_ego(o_ptr))
430 return FEEL_UNCURSED;
432 return FEEL_UNCURSED;
433 if (o_ptr->to_h + o_ptr->to_d > 0)
434 return FEEL_UNCURSED;