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->muta3 & MUT3_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;
89 disturb(creature_ptr, FALSE, FALSE);
91 describe_flavor(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
92 if (slot >= INVEN_RARM) {
94 msg_format("%s%s(%c)は%sという感じがする...", describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
96 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(creature_ptr, slot),
97 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
102 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
104 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]);
108 o_ptr->ident |= (IDENT_SENSE);
109 o_ptr->feeling = feel;
111 autopick_alter_item(creature_ptr, slot, destroy_feeling);
112 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
113 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
117 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
120 * Sense the inventory\n
122 * Class 0 = Warrior --> fast and heavy\n
123 * Class 1 = Mage --> slow and light\n
124 * Class 2 = Priest --> fast but light\n
125 * Class 3 = Rogue --> okay and heavy\n
126 * Class 4 = Ranger --> slow but heavy (changed!)\n
127 * Class 5 = Paladin --> slow but heavy\n
129 void sense_inventory1(player_type *creature_ptr)
131 PLAYER_LEVEL plev = creature_ptr->lev;
134 if (creature_ptr->confused)
137 switch (creature_ptr->pclass) {
141 case CLASS_CAVALRY: {
142 if (0 != randint0(9000L / (plev * plev + 40)))
149 if (0 != randint0(6000L / (plev * plev + 50)))
156 case CLASS_HIGH_MAGE:
158 case CLASS_MAGIC_EATER: {
159 if (0 != randint0(240000L / (plev + 5)))
166 if (0 != randint0(10000L / (plev * plev + 40)))
173 if (0 != randint0(20000L / (plev * plev + 40)))
180 if (0 != randint0(95000L / (plev * plev + 40)))
188 if (0 != randint0(77777L / (plev * plev + 40)))
194 case CLASS_WARRIOR_MAGE:
195 case CLASS_RED_MAGE: {
196 if (0 != randint0(75000L / (plev * plev + 40)))
201 case CLASS_MINDCRAFTER:
203 case CLASS_BLUE_MAGE:
204 case CLASS_MIRROR_MASTER: {
205 if (0 != randint0(55000L / (plev * plev + 40)))
210 case CLASS_CHAOS_WARRIOR: {
211 if (0 != randint0(80000L / (plev * plev + 40)))
218 case CLASS_FORCETRAINER: {
219 if (0 != randint0(20000L / (plev * plev + 40)))
224 case CLASS_TOURIST: {
225 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
231 case CLASS_BEASTMASTER: {
232 if (0 != randint0(65000L / (plev * plev + 40)))
237 case CLASS_BERSERKER: {
243 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE))
246 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
249 o_ptr = &creature_ptr->inventory_list[i];
254 switch (o_ptr->tval) {
280 if ((i < INVEN_RARM) && (0 != randint0(5)))
283 if (have_good_luck(creature_ptr) && !randint0(13)) {
287 sense_inventory_aux(creature_ptr, i, heavy);
292 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
295 void sense_inventory2(player_type *creature_ptr)
297 PLAYER_LEVEL plev = creature_ptr->lev;
300 if (creature_ptr->confused)
303 switch (creature_ptr->pclass) {
308 case CLASS_BERSERKER:
314 case CLASS_CHAOS_WARRIOR:
316 case CLASS_BEASTMASTER:
318 if (0 != randint0(240000L / (plev + 5)))
324 case CLASS_WARRIOR_MAGE:
327 if (0 != randint0(95000L / (plev * plev + 40)))
335 case CLASS_FORCETRAINER:
336 case CLASS_MINDCRAFTER: {
337 if (0 != randint0(20000L / (plev * plev + 40)))
343 case CLASS_HIGH_MAGE:
345 case CLASS_MAGIC_EATER:
346 case CLASS_MIRROR_MASTER:
347 case CLASS_BLUE_MAGE: {
348 if (0 != randint0(9000L / (plev * plev + 40)))
353 case CLASS_TOURIST: {
354 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
361 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
363 o_ptr = &creature_ptr->inventory_list[i];
367 switch (o_ptr->tval) {
379 if ((i < INVEN_RARM) && (0 != randint0(5)))
382 sense_inventory_aux(creature_ptr, i, TRUE);
387 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
388 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
389 * @return 擬似鑑定結果のIDを返す。
391 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
393 if (object_is_artifact(o_ptr)) {
394 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
395 return FEEL_TERRIBLE;
400 if (object_is_ego(o_ptr)) {
401 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
402 return FEEL_WORTHLESS;
404 return FEEL_EXCELLENT;
407 if (object_is_cursed(o_ptr))
409 if (object_is_broken(o_ptr))
411 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
415 if (o_ptr->to_h + o_ptr->to_d > 0)
422 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
423 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
424 * @return 擬似鑑定結果のIDを返す。
426 item_feel_type pseudo_value_check_light(object_type *o_ptr)
428 if (object_is_cursed(o_ptr))
430 if (object_is_broken(o_ptr))
432 if (object_is_artifact(o_ptr))
433 return FEEL_UNCURSED;
434 if (object_is_ego(o_ptr))
435 return FEEL_UNCURSED;
437 return FEEL_UNCURSED;
438 if (o_ptr->to_h + o_ptr->to_d > 0)
439 return FEEL_UNCURSED;