OSDN Git Service

Merge pull request #3814 from Slimebreath6078/feature/Add_Laffey_II
[hengbandforosx/hengbandosx.git] / src / object / warning.cpp
1 #include "object/warning.h"
2 #include "artifact/fixed-art-types.h"
3 #include "core/asking-player.h"
4 #include "core/disturbance.h"
5 #include "dungeon/dungeon-flag-types.h"
6 #include "flavor/flavor-describer.h"
7 #include "flavor/object-flavor-types.h"
8 #include "floor/cave.h"
9 #include "floor/geometry.h"
10 #include "game-option/input-options.h"
11 #include "grid/feature.h"
12 #include "inventory/inventory-slot-types.h"
13 #include "monster-attack/monster-attack-effect.h"
14 #include "monster-attack/monster-attack-table.h"
15 #include "monster-race/monster-race.h"
16 #include "monster-race/race-ability-flags.h"
17 #include "monster-race/race-indice-types.h"
18 #include "monster/monster-info.h"
19 #include "monster/monster-status.h"
20 #include "mspell/mspell-damage-calculator.h"
21 #include "mutation/mutation-flag-types.h"
22 #include "object-enchant/tr-types.h"
23 #include "player-base/player-race.h"
24 #include "player/player-status-flags.h"
25 #include "player/player-status-resist.h"
26 #include "player/special-defense-types.h"
27 #include "status/element-resistance.h"
28 #include "system/dungeon-info.h"
29 #include "system/floor-type-definition.h"
30 #include "system/grid-type-definition.h"
31 #include "system/item-entity.h"
32 #include "system/monster-entity.h"
33 #include "system/monster-race-info.h"
34 #include "system/player-type-definition.h"
35 #include "target/projection-path-calculator.h"
36 #include "timed-effect/player-blindness.h"
37 #include "timed-effect/timed-effects.h"
38 #include "util/bit-flags-calculator.h"
39 #include "view/display-messages.h"
40 #include <vector>
41
42 /*!
43  * @brief 警告を放つアイテムを選択する /
44  * Choose one of items that have warning flag
45  * Calculate spell damages
46  * @return 警告を行う
47  */
48 ItemEntity *choose_warning_item(PlayerType *player_ptr)
49 {
50     /* Paranoia -- Player has no warning ability */
51     if (!player_ptr->warning) {
52         return nullptr;
53     }
54
55     /* Search Inventory */
56     std::vector<int> candidates;
57     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
58         const auto *o_ptr = &player_ptr->inventory_list[i];
59         if (o_ptr->get_flags().has(TR_WARNING)) {
60             candidates.push_back(i);
61         }
62     }
63
64     /* Choice one of them */
65     return candidates.empty() ? nullptr : &player_ptr->inventory_list[rand_choice(candidates)];
66 }
67
68 /*!
69  * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する /
70  * Calculate spell damages
71  * @param m_ptr 魔法を行使するモンスターの構造体参照ポインタ
72  * @param typ 効果属性のID
73  * @param dam 基本ダメージ
74  * @param max 算出した最大ダメージを返すポインタ
75  */
76 static void spell_damcalc(PlayerType *player_ptr, MonsterEntity *m_ptr, AttributeType typ, int dam, int *max)
77 {
78     auto *r_ptr = &m_ptr->get_monrace();
79     int rlev = r_ptr->level;
80     bool ignore_wraith_form = false;
81
82     /* Vulnerability, resistance and immunity */
83     switch (typ) {
84     case AttributeType::ELEC:
85         if (has_immune_elec(player_ptr)) {
86             ignore_wraith_form = true;
87         }
88         dam = dam * calc_elec_damage_rate(player_ptr) / 100;
89         break;
90
91     case AttributeType::POIS:
92         dam = dam * calc_pois_damage_rate(player_ptr) / 100;
93         break;
94
95     case AttributeType::ACID:
96         if (has_immune_acid(player_ptr)) {
97             ignore_wraith_form = true;
98         }
99         dam = dam * calc_acid_damage_rate(player_ptr) / 100;
100         break;
101
102     case AttributeType::COLD:
103     case AttributeType::ICE:
104         if (has_immune_cold(player_ptr)) {
105             ignore_wraith_form = true;
106         }
107         dam = dam * calc_cold_damage_rate(player_ptr) / 100;
108         break;
109
110     case AttributeType::FIRE:
111         if (has_immune_fire(player_ptr)) {
112             ignore_wraith_form = true;
113         }
114         dam = dam * calc_fire_damage_rate(player_ptr) / 100;
115         break;
116
117     case AttributeType::PSY_SPEAR:
118         ignore_wraith_form = true;
119         break;
120
121     case AttributeType::MONSTER_SHOOT:
122         if (!player_ptr->effects()->blindness()->is_blind() && (has_invuln_arrow(player_ptr))) {
123             dam = 0;
124             ignore_wraith_form = true;
125         }
126         break;
127
128     case AttributeType::LITE:
129         dam = dam * calc_lite_damage_rate(player_ptr, CALC_MAX) / 100;
130         break;
131
132     case AttributeType::DARK:
133         dam = dam * calc_dark_damage_rate(player_ptr, CALC_MAX) / 100;
134         if (has_immune_dark(player_ptr) || player_ptr->wraith_form) {
135             ignore_wraith_form = true;
136         }
137         break;
138
139     case AttributeType::SHARDS:
140         dam = dam * calc_shards_damage_rate(player_ptr, CALC_MAX) / 100;
141         break;
142
143     case AttributeType::SOUND:
144         dam = dam * calc_sound_damage_rate(player_ptr, CALC_MAX) / 100;
145         break;
146
147     case AttributeType::CONFUSION:
148         dam = dam * calc_conf_damage_rate(player_ptr, CALC_MAX) / 100;
149         break;
150
151     case AttributeType::CHAOS:
152         dam = dam * calc_chaos_damage_rate(player_ptr, CALC_MAX) / 100;
153         break;
154
155     case AttributeType::NETHER:
156         dam = dam * calc_nether_damage_rate(player_ptr, CALC_MAX) / 100;
157         if (PlayerRace(player_ptr).equals(PlayerRaceType::SPECTRE)) {
158             ignore_wraith_form = true;
159             dam = 0;
160         }
161         break;
162
163     case AttributeType::DISENCHANT:
164         dam = dam * calc_disenchant_damage_rate(player_ptr, CALC_MAX) / 100;
165         break;
166
167     case AttributeType::NEXUS:
168         dam = dam * calc_nexus_damage_rate(player_ptr, CALC_MAX) / 100;
169         break;
170
171     case AttributeType::TIME:
172         dam = dam * calc_time_damage_rate(player_ptr, CALC_MAX) / 100;
173         break;
174
175     case AttributeType::GRAVITY:
176         dam = dam * calc_gravity_damage_rate(player_ptr, CALC_MAX) / 100;
177         break;
178
179     case AttributeType::ROCKET:
180         dam = dam * calc_rocket_damage_rate(player_ptr, CALC_MAX) / 100;
181         break;
182
183     case AttributeType::NUKE:
184         dam = dam * calc_nuke_damage_rate(player_ptr) / 100;
185         break;
186
187     case AttributeType::DEATH_RAY:
188         dam = dam * calc_deathray_damage_rate(player_ptr, CALC_MAX) / 100;
189         if (dam == 0) {
190             ignore_wraith_form = true;
191         }
192         break;
193
194     case AttributeType::HOLY_FIRE:
195         dam = dam * calc_holy_fire_damage_rate(player_ptr, CALC_MAX) / 100;
196         break;
197
198     case AttributeType::HELL_FIRE:
199         dam = dam * calc_hell_fire_damage_rate(player_ptr, CALC_MAX) / 100;
200         break;
201
202     case AttributeType::ABYSS:
203         dam = dam * calc_abyss_damage_rate(player_ptr, CALC_MAX) / 100;
204         break;
205
206     case AttributeType::VOID_MAGIC:
207         dam = dam * calc_void_damage_rate(player_ptr, CALC_MAX) / 100;
208         break;
209
210     case AttributeType::MIND_BLAST:
211     case AttributeType::BRAIN_SMASH:
212         if (100 + rlev / 2 <= std::max<short>(5, player_ptr->skill_sav)) {
213             dam = 0;
214             ignore_wraith_form = true;
215         }
216
217         break;
218
219     case AttributeType::CAUSE_1:
220     case AttributeType::CAUSE_2:
221     case AttributeType::CAUSE_3:
222     case AttributeType::HAND_DOOM:
223         if (100 + rlev / 2 <= player_ptr->skill_sav) {
224             dam = 0;
225             ignore_wraith_form = true;
226         }
227
228         break;
229
230     case AttributeType::CAUSE_4:
231         if ((100 + rlev / 2 <= player_ptr->skill_sav) && (m_ptr->r_idx != MonsterRaceId::KENSHIROU)) {
232             dam = 0;
233             ignore_wraith_form = true;
234         }
235
236         break;
237     default:
238         break;
239     }
240
241     if (player_ptr->wraith_form && !ignore_wraith_form) {
242         dam /= 2;
243         if (!dam) {
244             dam = 1;
245         }
246     }
247
248     if (dam > *max) {
249         *max = dam;
250     }
251 }
252
253 /*!
254  * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する。 /
255  * Calculate spell damages
256  * @param spell_num RF4ならRF_ABILITY::SPELL_STARTのように32区切りのベースとなる数値
257  * @param typ 効果属性のID
258  * @param m_idx 魔法を行使するモンスターのID
259  * @param max 算出した最大ダメージを返すポインタ
260  */
261 static void spell_damcalc_by_spellnum(PlayerType *player_ptr, MonsterAbilityType ms_type, AttributeType typ, MONSTER_IDX m_idx, int *max)
262 {
263     auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
264     int dam = monspell_damage(player_ptr, ms_type, m_idx, DAM_MAX);
265     spell_damcalc(player_ptr, m_ptr, typ, dam, max);
266 }
267
268 /*!
269  * @brief 警告基準を定めるためにモンスターの打撃最大ダメージを算出する /
270  * Calculate blow damages
271  * @param m_ptr 打撃を行使するモンスターの構造体参照ポインタ
272  * @param blow モンスターの打撃能力の構造体参照
273  * @return 算出された最大ダメージを返す。
274  */
275 static int blow_damcalc(MonsterEntity *m_ptr, PlayerType *player_ptr, const MonsterBlow &blow)
276 {
277     int dam = blow.d_dice * blow.d_side;
278     int dummy_max = 0;
279
280     if (blow.method == RaceBlowMethodType::EXPLODE) {
281         dam = (dam + 1) / 2;
282         spell_damcalc(player_ptr, m_ptr, mbe_info[enum2i(blow.effect)].explode_type, dam, &dummy_max);
283         dam = dummy_max;
284         return dam;
285     }
286
287     ARMOUR_CLASS ac = player_ptr->ac + player_ptr->to_a;
288     bool check_wraith_form = true;
289     switch (blow.effect) {
290     case RaceBlowEffectType::SUPERHURT: {
291         int tmp_dam = dam - (dam * ((ac < 150) ? ac : 150) / 250);
292         dam = std::max(dam, tmp_dam * 2);
293         break;
294     }
295
296     case RaceBlowEffectType::HURT:
297     case RaceBlowEffectType::SHATTER:
298         dam -= (dam * ((ac < 150) ? ac : 150) / 250);
299         break;
300
301     case RaceBlowEffectType::ACID:
302         spell_damcalc(player_ptr, m_ptr, AttributeType::ACID, dam, &dummy_max);
303         dam = dummy_max;
304         check_wraith_form = false;
305         break;
306
307     case RaceBlowEffectType::ELEC:
308         spell_damcalc(player_ptr, m_ptr, AttributeType::ELEC, dam, &dummy_max);
309         dam = dummy_max;
310         check_wraith_form = false;
311         break;
312
313     case RaceBlowEffectType::FIRE:
314         spell_damcalc(player_ptr, m_ptr, AttributeType::FIRE, dam, &dummy_max);
315         dam = dummy_max;
316         check_wraith_form = false;
317         break;
318
319     case RaceBlowEffectType::COLD:
320         spell_damcalc(player_ptr, m_ptr, AttributeType::COLD, dam, &dummy_max);
321         dam = dummy_max;
322         check_wraith_form = false;
323         break;
324
325     case RaceBlowEffectType::DR_MANA:
326         dam = 0;
327         check_wraith_form = false;
328         break;
329
330     default:
331         break;
332     }
333
334     if (check_wraith_form && player_ptr->wraith_form) {
335         dam /= 2;
336         if (!dam) {
337             dam = 1;
338         }
339     }
340
341     return dam;
342 }
343
344 /*!
345  * @brief プレイヤーが特定地点へ移動した場合に警告を発する処理 /
346  * Examine the grid (xx,yy) and warn the player if there are any danger
347  * @param xx 危険性を調査するマスのX座標
348  * @param yy 危険性を調査するマスのY座標
349  * @return 警告を無視して進むことを選択するかか問題が無ければTRUE、警告に従ったならFALSEを返す。
350  */
351 bool process_warning(PlayerType *player_ptr, POSITION xx, POSITION yy)
352 {
353     POSITION mx, my;
354 #define WARNING_AWARE_RANGE 12
355     int dam_max = 0;
356     static int old_damage = 0;
357
358     auto &floor = *player_ptr->current_floor_ptr;
359     const auto &dungeon = floor.get_dungeon_definition();
360     for (mx = xx - WARNING_AWARE_RANGE; mx < xx + WARNING_AWARE_RANGE + 1; mx++) {
361         for (my = yy - WARNING_AWARE_RANGE; my < yy + WARNING_AWARE_RANGE + 1; my++) {
362             int dam_max0 = 0;
363             if (!in_bounds(&floor, my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) {
364                 continue;
365             }
366
367             const auto *g_ptr = &floor.grid_array[my][mx];
368
369             if (!g_ptr->has_monster()) {
370                 continue;
371             }
372
373             auto *m_ptr = &floor.m_list[g_ptr->m_idx];
374
375             if (m_ptr->is_asleep()) {
376                 continue;
377             }
378             if (!m_ptr->is_hostile()) {
379                 continue;
380             }
381
382             auto *r_ptr = &m_ptr->get_monrace();
383
384             /* Monster spells (only powerful ones)*/
385             if (projectable(player_ptr, my, mx, yy, xx)) {
386                 const auto flags = r_ptr->ability_flags;
387
388                 if (dungeon.flags.has_not(DungeonFeatureType::NO_MAGIC)) {
389                     if (flags.has(MonsterAbilityType::BA_CHAO)) {
390                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_CHAO, AttributeType::CHAOS, g_ptr->m_idx, &dam_max0);
391                     }
392                     if (flags.has(MonsterAbilityType::BA_MANA)) {
393                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_MANA, AttributeType::MANA, g_ptr->m_idx, &dam_max0);
394                     }
395                     if (flags.has(MonsterAbilityType::BA_DARK)) {
396                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_DARK, AttributeType::DARK, g_ptr->m_idx, &dam_max0);
397                     }
398                     if (flags.has(MonsterAbilityType::BA_LITE)) {
399                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_LITE, AttributeType::LITE, g_ptr->m_idx, &dam_max0);
400                     }
401                     if (flags.has(MonsterAbilityType::HAND_DOOM)) {
402                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::HAND_DOOM, AttributeType::HAND_DOOM, g_ptr->m_idx, &dam_max0);
403                     }
404                     if (flags.has(MonsterAbilityType::PSY_SPEAR)) {
405                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::PSY_SPEAR, AttributeType::PSY_SPEAR, g_ptr->m_idx, &dam_max0);
406                     }
407                     if (flags.has(MonsterAbilityType::BA_VOID)) {
408                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_VOID, AttributeType::VOID_MAGIC, g_ptr->m_idx, &dam_max0);
409                     }
410                     if (flags.has(MonsterAbilityType::BA_ABYSS)) {
411                         spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BA_ABYSS, AttributeType::ABYSS, g_ptr->m_idx, &dam_max0);
412                     }
413                 }
414
415                 if (flags.has(MonsterAbilityType::ROCKET)) {
416                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::ROCKET, AttributeType::ROCKET, g_ptr->m_idx, &dam_max0);
417                 }
418                 if (flags.has(MonsterAbilityType::BR_ACID)) {
419                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_ACID, AttributeType::ACID, g_ptr->m_idx, &dam_max0);
420                 }
421                 if (flags.has(MonsterAbilityType::BR_ELEC)) {
422                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_ELEC, AttributeType::ELEC, g_ptr->m_idx, &dam_max0);
423                 }
424                 if (flags.has(MonsterAbilityType::BR_FIRE)) {
425                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_FIRE, AttributeType::FIRE, g_ptr->m_idx, &dam_max0);
426                 }
427                 if (flags.has(MonsterAbilityType::BR_COLD)) {
428                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_COLD, AttributeType::COLD, g_ptr->m_idx, &dam_max0);
429                 }
430                 if (flags.has(MonsterAbilityType::BR_POIS)) {
431                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_POIS, AttributeType::POIS, g_ptr->m_idx, &dam_max0);
432                 }
433                 if (flags.has(MonsterAbilityType::BR_NETH)) {
434                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_NETH, AttributeType::NETHER, g_ptr->m_idx, &dam_max0);
435                 }
436                 if (flags.has(MonsterAbilityType::BR_LITE)) {
437                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_LITE, AttributeType::LITE, g_ptr->m_idx, &dam_max0);
438                 }
439                 if (flags.has(MonsterAbilityType::BR_DARK)) {
440                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_DARK, AttributeType::DARK, g_ptr->m_idx, &dam_max0);
441                 }
442                 if (flags.has(MonsterAbilityType::BR_CONF)) {
443                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_CONF, AttributeType::CONFUSION, g_ptr->m_idx, &dam_max0);
444                 }
445                 if (flags.has(MonsterAbilityType::BR_SOUN)) {
446                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_SOUN, AttributeType::SOUND, g_ptr->m_idx, &dam_max0);
447                 }
448                 if (flags.has(MonsterAbilityType::BR_CHAO)) {
449                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_CHAO, AttributeType::CHAOS, g_ptr->m_idx, &dam_max0);
450                 }
451                 if (flags.has(MonsterAbilityType::BR_DISE)) {
452                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_DISE, AttributeType::DISENCHANT, g_ptr->m_idx, &dam_max0);
453                 }
454                 if (flags.has(MonsterAbilityType::BR_NEXU)) {
455                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_NEXU, AttributeType::NEXUS, g_ptr->m_idx, &dam_max0);
456                 }
457                 if (flags.has(MonsterAbilityType::BR_TIME)) {
458                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_TIME, AttributeType::TIME, g_ptr->m_idx, &dam_max0);
459                 }
460                 if (flags.has(MonsterAbilityType::BR_INER)) {
461                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_INER, AttributeType::INERTIAL, g_ptr->m_idx, &dam_max0);
462                 }
463                 if (flags.has(MonsterAbilityType::BR_GRAV)) {
464                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_GRAV, AttributeType::GRAVITY, g_ptr->m_idx, &dam_max0);
465                 }
466                 if (flags.has(MonsterAbilityType::BR_SHAR)) {
467                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_SHAR, AttributeType::SHARDS, g_ptr->m_idx, &dam_max0);
468                 }
469                 if (flags.has(MonsterAbilityType::BR_PLAS)) {
470                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_PLAS, AttributeType::PLASMA, g_ptr->m_idx, &dam_max0);
471                 }
472                 if (flags.has(MonsterAbilityType::BR_FORC)) {
473                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_FORC, AttributeType::FORCE, g_ptr->m_idx, &dam_max0);
474                 }
475                 if (flags.has(MonsterAbilityType::BR_MANA)) {
476                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_MANA, AttributeType::MANA, g_ptr->m_idx, &dam_max0);
477                 }
478                 if (flags.has(MonsterAbilityType::BR_NUKE)) {
479                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_NUKE, AttributeType::NUKE, g_ptr->m_idx, &dam_max0);
480                 }
481                 if (flags.has(MonsterAbilityType::BR_DISI)) {
482                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_DISI, AttributeType::DISINTEGRATE, g_ptr->m_idx, &dam_max0);
483                 }
484                 if (flags.has(MonsterAbilityType::BR_VOID)) {
485                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_VOID, AttributeType::VOID_MAGIC, g_ptr->m_idx, &dam_max0);
486                 }
487                 if (flags.has(MonsterAbilityType::BR_ABYSS)) {
488                     spell_damcalc_by_spellnum(player_ptr, MonsterAbilityType::BR_ABYSS, AttributeType::ABYSS, g_ptr->m_idx, &dam_max0);
489                 }
490             }
491             /* Monster melee attacks */
492             if (r_ptr->behavior_flags.has(MonsterBehaviorType::NEVER_BLOW) || dungeon.flags.has(DungeonFeatureType::NO_MELEE)) {
493                 dam_max += dam_max0;
494                 continue;
495             }
496
497             if (!(mx <= xx + 1 && mx >= xx - 1 && my <= yy + 1 && my >= yy - 1)) {
498                 dam_max += dam_max0;
499                 continue;
500             }
501
502             int dam_melee = 0;
503             for (const auto &blow : r_ptr->blows) {
504                 /* Skip non-attacks */
505                 if (blow.method == RaceBlowMethodType::NONE || (blow.method == RaceBlowMethodType::SHOOT)) {
506                     continue;
507                 }
508
509                 /* Extract the attack info */
510                 dam_melee += blow_damcalc(m_ptr, player_ptr, blow);
511                 if (blow.method == RaceBlowMethodType::EXPLODE) {
512                     break;
513                 }
514             }
515
516             if (dam_melee > dam_max0) {
517                 dam_max0 = dam_melee;
518             }
519             dam_max += dam_max0;
520         }
521     }
522
523     /* Prevent excessive warning */
524     if (dam_max > old_damage) {
525         old_damage = dam_max * 3 / 2;
526
527         if (dam_max > player_ptr->chp / 2) {
528             auto *o_ptr = choose_warning_item(player_ptr);
529             std::string item_name;
530             if (o_ptr != nullptr) {
531                 item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
532             } else {
533                 item_name = _("体", "body");
534             }
535
536             msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), item_name.data());
537
538             disturb(player_ptr, false, true);
539             return input_check(_("本当にこのまま進むか?", "Really want to go ahead? "));
540         }
541     } else {
542         old_damage = old_damage / 2;
543     }
544
545     auto *g_ptr = &floor.grid_array[yy][xx];
546     bool is_warning = (!easy_disarm && is_trap(player_ptr, g_ptr->feat)) || (g_ptr->mimic && is_trap(player_ptr, g_ptr->feat));
547     is_warning &= !one_in_(13);
548     if (!is_warning) {
549         return true;
550     }
551
552     auto *o_ptr = choose_warning_item(player_ptr);
553     std::string item_name;
554     if (o_ptr != nullptr) {
555         item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
556     } else {
557         item_name = _("体", "body");
558     }
559
560     msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), item_name.data());
561     disturb(player_ptr, false, true);
562     return input_check(_("本当にこのまま進むか?", "Really want to go ahead? "));
563 }