7 #include "perception/simple-perception.h"
8 #include "autopick/autopick.h"
9 #include "avatar/avatar.h"
10 #include "core/disturbance.h"
11 #include "core/player-update-types.h"
12 #include "core/window-redrawer.h"
13 #include "flavor/flag-inscriptions-table.h"
14 #include "flavor/flavor-describer.h"
15 #include "flavor/object-flavor-types.h"
16 #include "game-option/auto-destruction-options.h"
17 #include "game-option/disturbance-options.h"
18 #include "inventory/inventory-describer.h"
19 #include "inventory/inventory-slot-types.h"
20 #include "mutation/mutation-flag-types.h"
21 #include "object-enchant/special-object-flags.h"
22 #include "object/object-info.h"
23 #include "perception/object-perception.h"
24 #include "player/player-status-flags.h"
25 #include "system/object-type-definition.h"
26 #include "system/player-type-definition.h"
27 #include "view/display-messages.h"
30 * @brief 擬似鑑定を実際に行い判定を反映する
31 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
32 * @param player_ptr プレーヤーへの参照ポインタ
33 * @param heavy 重度の擬似鑑定を行うならばTRUE
35 static void sense_inventory_aux(player_type *player_ptr, INVENTORY_IDX slot, bool heavy)
37 object_type *o_ptr = &player_ptr->inventory_list[slot];
38 GAME_TEXT o_name[MAX_NLEN];
39 if (o_ptr->ident & (IDENT_SENSE))
41 if (o_ptr->is_known())
44 item_feel_type feel = (heavy ? pseudo_value_check_heavy(o_ptr) : pseudo_value_check_light(o_ptr));
48 if ((player_ptr->muta.has(MUTA::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;
91 disturb(player_ptr, false, false);
93 describe_flavor(player_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
94 if (slot >= INVEN_MAIN_HAND) {
96 msg_format("%s%s(%c)は%sという感じがする...", describe_use(player_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
98 msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(player_ptr, slot),
99 ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
104 msg_format("ザックの中の%s(%c)は%sという感じがする...", o_name, index_to_label(slot), game_inscriptions[feel]);
106 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]);
110 o_ptr->ident |= (IDENT_SENSE);
111 o_ptr->feeling = feel;
113 autopick_alter_item(player_ptr, slot, destroy_feeling);
114 player_ptr->update |= (PU_COMBINE | PU_REORDER);
115 player_ptr->window_flags |= (PW_INVEN | PW_EQUIP);
119 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
121 * Sense the inventory\n
123 * Class 0 = Warrior --> fast and heavy\n
124 * Class 1 = Mage --> slow and light\n
125 * Class 2 = Priest --> fast but light\n
126 * Class 3 = Rogue --> okay and heavy\n
127 * Class 4 = Ranger --> slow but heavy (changed!)\n
128 * Class 5 = Paladin --> slow but heavy\n
130 void sense_inventory1(player_type *player_ptr)
132 PLAYER_LEVEL plev = player_ptr->lev;
135 if (player_ptr->confused)
138 switch (player_ptr->pclass) {
142 case CLASS_CAVALRY: {
143 if (0 != randint0(9000L / (plev * plev + 40)))
150 if (0 != randint0(6000L / (plev * plev + 50)))
157 case CLASS_HIGH_MAGE:
159 case CLASS_MAGIC_EATER:
160 case CLASS_ELEMENTALIST: {
161 if (0 != randint0(240000L / (plev + 5)))
168 if (0 != randint0(10000L / (plev * plev + 40)))
175 if (0 != randint0(20000L / (plev * plev + 40)))
182 if (0 != randint0(95000L / (plev * plev + 40)))
190 if (0 != randint0(77777L / (plev * plev + 40)))
196 case CLASS_WARRIOR_MAGE:
197 case CLASS_RED_MAGE: {
198 if (0 != randint0(75000L / (plev * plev + 40)))
203 case CLASS_MINDCRAFTER:
205 case CLASS_BLUE_MAGE:
206 case CLASS_MIRROR_MASTER: {
207 if (0 != randint0(55000L / (plev * plev + 40)))
212 case CLASS_CHAOS_WARRIOR: {
213 if (0 != randint0(80000L / (plev * plev + 40)))
220 case CLASS_FORCETRAINER: {
221 if (0 != randint0(20000L / (plev * plev + 40)))
226 case CLASS_TOURIST: {
227 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
233 case CLASS_BEASTMASTER: {
234 if (0 != randint0(65000L / (plev * plev + 40)))
239 case CLASS_BERSERKER: {
248 if (compare_virtue(player_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE))
251 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
254 o_ptr = &player_ptr->inventory_list[i];
259 switch (o_ptr->tval) {
288 if ((i < INVEN_MAIN_HAND) && (0 != randint0(5)))
291 if (has_good_luck(player_ptr) && !randint0(13)) {
295 sense_inventory_aux(player_ptr, i, heavy);
300 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
302 void sense_inventory2(player_type *player_ptr)
304 PLAYER_LEVEL plev = player_ptr->lev;
307 if (player_ptr->confused)
310 switch (player_ptr->pclass) {
315 case CLASS_BERSERKER:
321 case CLASS_CHAOS_WARRIOR:
323 case CLASS_BEASTMASTER:
325 if (0 != randint0(240000L / (plev + 5)))
331 case CLASS_WARRIOR_MAGE:
334 if (0 != randint0(95000L / (plev * plev + 40)))
342 case CLASS_FORCETRAINER:
343 case CLASS_MINDCRAFTER: {
344 if (0 != randint0(20000L / (plev * plev + 40)))
350 case CLASS_HIGH_MAGE:
352 case CLASS_MAGIC_EATER:
353 case CLASS_MIRROR_MASTER:
354 case CLASS_BLUE_MAGE:
355 case CLASS_ELEMENTALIST: {
356 if (0 != randint0(9000L / (plev * plev + 40)))
361 case CLASS_TOURIST: {
362 if (0 != randint0(20000L / ((plev + 50) * (plev + 50))))
372 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) {
374 o_ptr = &player_ptr->inventory_list[i];
378 switch (o_ptr->tval) {
393 if ((i < INVEN_MAIN_HAND) && (0 != randint0(5)))
396 sense_inventory_aux(player_ptr, i, true);
401 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or nullptr) about an item. Method 1 (Heavy).
402 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
403 * @return 擬似鑑定結果のIDを返す。
405 item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
407 if (o_ptr->is_artifact()) {
408 if (o_ptr->is_cursed() || o_ptr->is_broken())
409 return FEEL_TERRIBLE;
414 if (o_ptr->is_ego()) {
415 if (o_ptr->is_cursed() || o_ptr->is_broken())
416 return FEEL_WORTHLESS;
418 return FEEL_EXCELLENT;
421 if (o_ptr->is_cursed())
423 if (o_ptr->is_broken())
425 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
429 if (o_ptr->to_h + o_ptr->to_d > 0)
436 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or nullptr) about an item. Method 2 (Light).
437 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
438 * @return 擬似鑑定結果のIDを返す。
440 item_feel_type pseudo_value_check_light(object_type *o_ptr)
442 if (o_ptr->is_cursed())
444 if (o_ptr->is_broken())
446 if (o_ptr->is_artifact())
447 return FEEL_UNCURSED;
449 return FEEL_UNCURSED;
451 return FEEL_UNCURSED;
452 if (o_ptr->to_h + o_ptr->to_d > 0)
453 return FEEL_UNCURSED;