OSDN Git Service

[Refactor] #40413 Separated bit-flags-calculator.h from util.h
[hengbandforosx/hengbandosx.git] / src / object / warning.c
1 #include "object/warning.h"
2 #include "art-definition/art-sword-types.h"
3 #include "core/asking-player.h"
4 #include "dungeon/dungeon.h"
5 #include "floor/floor.h"
6 #include "game-option/input-options.h"
7 #include "grid/feature.h"
8 #include "monster-attack/monster-attack-effect.h"
9 #include "monster-attack/monster-attack-types.h"
10 #include "monster-race/race-flags-ability1.h"
11 #include "monster-race/race-flags-ability2.h"
12 #include "monster-race/race-flags1.h"
13 #include "monster-race/race-flags4.h"
14 #include "monster-race/race-indice-types.h"
15 #include "monster/monster-info.h"
16 #include "monster/monster-status.h"
17 #include "mspell/monster-spell.h"
18 #include "mspell/mspell-damage-calculator.h"
19 #include "mspell/mspell-type.h"
20 #include "object-enchant/tr-types.h"
21 #include "object/object-flags.h"
22 #include "object/object-flavor.h"
23 #include "player/mimic-info-table.h"
24 #include "player/player-class.h"
25 #include "player/player-move.h"
26 #include "player/player-race-types.h"
27 #include "player/player-status.h"
28 #include "spell/spell-types.h"
29 #include "util/bit-flags-calculator.h"
30 #include "view/display-messages.h"
31
32 /*!
33  * @brief 警告を放つアイテムを選択する /
34  * Choose one of items that have warning flag
35  * Calculate spell damages
36  * @return 警告を行う
37  */
38 object_type *choose_warning_item(player_type *creature_ptr)
39 {
40         int choices[INVEN_TOTAL - INVEN_RARM];
41
42         /* Paranoia -- Player has no warning ability */
43         if (!creature_ptr->warning) return NULL;
44
45         /* Search Inventory */
46         int number = 0;
47         for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
48         {
49                 BIT_FLAGS flgs[TR_FLAG_SIZE];
50                 object_type *o_ptr = &creature_ptr->inventory_list[i];
51
52                 object_flags(o_ptr, flgs);
53                 if (have_flag(flgs, TR_WARNING))
54                 {
55                         choices[number] = i;
56                         number++;
57                 }
58         }
59
60         /* Choice one of them */
61         return number ? &creature_ptr->inventory_list[choices[randint0(number)]] : NULL;
62 }
63
64 /*!
65  * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する /
66  * Calculate spell damages
67  * @param m_ptr 魔法を行使するモンスターの構造体参照ポインタ
68  * @param typ 効果属性のID
69  * @param dam 基本ダメージ
70  * @param max 算出した最大ダメージを返すポインタ
71  * @return なし
72  */
73 static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_ID typ, HIT_POINT dam, int *max)
74 {
75         monster_race *r_ptr = &r_info[m_ptr->r_idx];
76         int rlev = r_ptr->level;
77         bool ignore_wraith_form = FALSE;
78
79         /* Vulnerability, resistance and immunity */
80         switch (typ)
81         {
82         case GF_ELEC:
83                 if (target_ptr->immune_elec)
84                 {
85                         dam = 0;
86                         ignore_wraith_form = TRUE;
87                         break;
88                 }
89
90                 if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
91                 if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
92                 if (is_specific_player_race(target_ptr, RACE_ANDROID)) dam += dam / 3;
93                 if (target_ptr->resist_elec) dam = (dam + 2) / 3;
94                 if (is_oppose_elec(target_ptr)) dam = (dam + 2) / 3;
95                 break;
96
97         case GF_POIS:
98                 if (target_ptr->resist_pois) dam = (dam + 2) / 3;
99                 if (is_oppose_pois(target_ptr)) dam = (dam + 2) / 3;
100                 break;
101
102         case GF_ACID:
103                 if (target_ptr->immune_acid)
104                 {
105                         dam = 0;
106                         ignore_wraith_form = TRUE;
107                         break;
108                 }
109
110                 if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
111                 if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
112                 if (target_ptr->resist_acid) dam = (dam + 2) / 3;
113                 if (is_oppose_acid(target_ptr)) dam = (dam + 2) / 3;
114                 break;
115
116         case GF_COLD:
117         case GF_ICE:
118                 if (target_ptr->immune_cold)
119                 {
120                         dam = 0;
121                         ignore_wraith_form = TRUE;
122                         break;
123                 }
124
125                 if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
126                 if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
127                 if (target_ptr->resist_cold) dam = (dam + 2) / 3;
128                 if (is_oppose_cold(target_ptr)) dam = (dam + 2) / 3;
129                 break;
130
131         case GF_FIRE:
132                 if (target_ptr->immune_fire)
133                 {
134                         dam = 0;
135                         ignore_wraith_form = TRUE;
136                         break;
137                 }
138
139                 if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
140                 if (is_specific_player_race(target_ptr, RACE_ENT)) dam += dam / 3;
141                 if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
142                 if (target_ptr->resist_fire) dam = (dam + 2) / 3;
143                 if (is_oppose_fire(target_ptr)) dam = (dam + 2) / 3;
144                 break;
145
146         case GF_PSY_SPEAR:
147                 ignore_wraith_form = TRUE;
148                 break;
149
150         case GF_ARROW:
151                 if (!target_ptr->blind &&
152                         ((target_ptr->inventory_list[INVEN_RARM].k_idx && (target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU)) ||
153                         (target_ptr->inventory_list[INVEN_LARM].k_idx && (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))))
154                 {
155                         dam = 0;
156                         ignore_wraith_form = TRUE;
157                 }
158
159                 break;
160
161         case GF_LITE:
162                 if (target_ptr->resist_lite) dam /= 2; /* Worst case of 4 / (d4 + 7) */
163                 if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE)) dam *= 2;
164                 else if (is_specific_player_race(target_ptr, RACE_S_FAIRY)) dam = dam * 4 / 3;
165
166                 if (target_ptr->wraith_form) dam *= 2;
167                 break;
168
169         case GF_DARK:
170                 if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form)
171                 {
172                         dam = 0;
173                         ignore_wraith_form = TRUE;
174                 }
175                 else if (target_ptr->resist_dark) dam /= 2; /* Worst case of 4 / (d4 + 7) */
176                 break;
177
178         case GF_SHARDS:
179                 if (target_ptr->resist_shard) dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
180                 break;
181
182         case GF_SOUND:
183                 if (target_ptr->resist_sound) dam = dam * 5 / 8; /* Worst case of 5 / (d4 + 7) */
184                 break;
185
186         case GF_CONFUSION:
187                 if (target_ptr->resist_conf) dam = dam * 5 / 8; /* Worst case of 5 / (d4 + 7) */
188                 break;
189
190         case GF_CHAOS:
191                 if (target_ptr->resist_chaos) dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
192                 break;
193
194         case GF_NETHER:
195                 if (is_specific_player_race(target_ptr, RACE_SPECTRE))
196                 {
197                         dam = 0;
198                         ignore_wraith_form = TRUE;
199                 }
200                 else if (target_ptr->resist_neth) dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
201                 break;
202
203         case GF_DISENCHANT:
204                 if (target_ptr->resist_disen) dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
205                 break;
206
207         case GF_NEXUS:
208                 if (target_ptr->resist_nexus) dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
209                 break;
210
211         case GF_TIME:
212                 if (target_ptr->resist_time) dam /= 2; /* Worst case of 4 / (d4 + 7) */
213                 break;
214
215         case GF_GRAVITY:
216                 if (target_ptr->levitation) dam = (dam * 2) / 3;
217                 break;
218
219         case GF_ROCKET:
220                 if (target_ptr->resist_shard) dam /= 2;
221                 break;
222
223         case GF_NUKE:
224                 if (target_ptr->resist_pois) dam = (2 * dam + 2) / 5;
225                 if (is_oppose_pois(target_ptr)) dam = (2 * dam + 2) / 5;
226                 break;
227
228         case GF_DEATH_RAY:
229                 if (target_ptr->mimic_form)
230                 {
231                         if (mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
232                         {
233                                 dam = 0;
234                                 ignore_wraith_form = TRUE;
235                         }
236
237                         break;
238                 }
239
240                 switch (target_ptr->prace)
241                 {
242                 case RACE_GOLEM:
243                 case RACE_SKELETON:
244                 case RACE_ZOMBIE:
245                 case RACE_VAMPIRE:
246                 case RACE_BALROG:
247                 case RACE_SPECTRE:
248                         dam = 0;
249                         ignore_wraith_form = TRUE;
250                         break;
251                 }
252
253                 break;
254
255         case GF_HOLY_FIRE:
256                 if (target_ptr->align > 10) dam /= 2;
257                 else if (target_ptr->align < -10) dam *= 2;
258                 break;
259
260         case GF_HELL_FIRE:
261                 if (target_ptr->align > 10) dam *= 2;
262                 break;
263
264         case GF_MIND_BLAST:
265         case GF_BRAIN_SMASH:
266                 if (100 + rlev / 2 <= MAX(5, target_ptr->skill_sav))
267                 {
268                         dam = 0;
269                         ignore_wraith_form = TRUE;
270                 }
271
272                 break;
273
274         case GF_CAUSE_1:
275         case GF_CAUSE_2:
276         case GF_CAUSE_3:
277         case GF_HAND_DOOM:
278                 if (100 + rlev / 2 <= target_ptr->skill_sav)
279                 {
280                         dam = 0;
281                         ignore_wraith_form = TRUE;
282                 }
283
284                 break;
285
286         case GF_CAUSE_4:
287                 if ((100 + rlev / 2 <= target_ptr->skill_sav) && (m_ptr->r_idx != MON_KENSHIROU))
288                 {
289                         dam = 0;
290                         ignore_wraith_form = TRUE;
291                 }
292
293                 break;
294         }
295
296         if (target_ptr->wraith_form && !ignore_wraith_form)
297         {
298                 dam /= 2;
299                 if (!dam) dam = 1;
300         }
301
302         if (dam > *max) *max = dam;
303 }
304
305 /*!
306 * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する。 /
307 * Calculate spell damages
308 * @param spell_num RF4ならRF4_SPELL_STARTのように32区切りのベースとなる数値
309 * @param typ 効果属性のID
310 * @param m_idx 魔法を行使するモンスターのID
311 * @param max 算出した最大ダメージを返すポインタ
312 * @return なし
313 */
314 void spell_damcalc_by_spellnum(player_type *creature_ptr, monster_spell_type ms_type, EFFECT_ID typ, MONSTER_IDX m_idx, int *max)
315 {
316         monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
317         HIT_POINT dam = monspell_damage(creature_ptr, ms_type, m_idx, DAM_MAX);
318         spell_damcalc(creature_ptr, m_ptr, typ, dam, max);
319 }
320
321 /*!
322  * @brief 警告基準を定めるためにモンスターの打撃最大ダメージを算出する /
323  * Calculate blow damages
324  * @param m_ptr 打撃を行使するモンスターの構造体参照ポインタ
325  * @param blow_ptr モンスターの打撃能力の構造体参照ポインタ
326  * @return 算出された最大ダメージを返す。
327  */
328 static int blow_damcalc(monster_type *m_ptr, player_type *target_ptr, monster_blow *blow_ptr)
329 {
330         int dam = blow_ptr->d_dice * blow_ptr->d_side;
331         int dummy_max = 0;
332
333         if (blow_ptr->method == RBM_EXPLODE)
334         {
335                 dam = (dam + 1) / 2;
336                 spell_damcalc(target_ptr, m_ptr, mbe_info[blow_ptr->effect].explode_type, dam, &dummy_max);
337                 dam = dummy_max;
338                 return dam;
339         }
340
341         ARMOUR_CLASS ac = target_ptr->ac + target_ptr->to_a;
342         bool check_wraith_form = TRUE;
343         switch (blow_ptr->effect)
344         {
345         case RBE_SUPERHURT:
346         {
347                 int tmp_dam = dam - (dam * ((ac < 150) ? ac : 150) / 250);
348                 dam = MAX(dam, tmp_dam * 2);
349                 break;
350         }
351
352         case RBE_HURT:
353         case RBE_SHATTER:
354                 dam -= (dam * ((ac < 150) ? ac : 150) / 250);
355                 break;
356
357         case RBE_ACID:
358                 spell_damcalc(target_ptr, m_ptr, GF_ACID, dam, &dummy_max);
359                 dam = dummy_max;
360                 check_wraith_form = FALSE;
361                 break;
362
363         case RBE_ELEC:
364                 spell_damcalc(target_ptr, m_ptr, GF_ELEC, dam, &dummy_max);
365                 dam = dummy_max;
366                 check_wraith_form = FALSE;
367                 break;
368
369         case RBE_FIRE:
370                 spell_damcalc(target_ptr, m_ptr, GF_FIRE, dam, &dummy_max);
371                 dam = dummy_max;
372                 check_wraith_form = FALSE;
373                 break;
374
375         case RBE_COLD:
376                 spell_damcalc(target_ptr, m_ptr, GF_COLD, dam, &dummy_max);
377                 dam = dummy_max;
378                 check_wraith_form = FALSE;
379                 break;
380
381         case RBE_DR_MANA:
382                 dam = 0;
383                 check_wraith_form = FALSE;
384                 break;
385         }
386
387         if (check_wraith_form && target_ptr->wraith_form)
388         {
389                 dam /= 2;
390                 if (!dam) dam = 1;
391         }
392
393         return dam;
394 }
395
396
397 /*!
398  * @brief プレイヤーが特定地点へ移動した場合に警告を発する処理 /
399  * Examine the grid (xx,yy) and warn the player if there are any danger
400  * @param xx 危険性を調査するマスのX座標
401  * @param yy 危険性を調査するマスのY座標
402  * @return 警告を無視して進むことを選択するかか問題が無ければTRUE、警告に従ったならFALSEを返す。
403  */
404 bool process_warning(player_type *creature_ptr, POSITION xx, POSITION yy)
405 {
406         POSITION mx, my;
407         grid_type *g_ptr;
408         GAME_TEXT o_name[MAX_NLEN];
409
410 #define WARNING_AWARE_RANGE 12
411         int dam_max = 0;
412         static int old_damage = 0;
413
414         for (mx = xx - WARNING_AWARE_RANGE; mx < xx + WARNING_AWARE_RANGE + 1; mx++)
415         {
416                 for (my = yy - WARNING_AWARE_RANGE; my < yy + WARNING_AWARE_RANGE + 1; my++)
417                 {
418                         int dam_max0 = 0;
419                         monster_type *m_ptr;
420                         monster_race *r_ptr;
421
422                         if (!in_bounds(creature_ptr->current_floor_ptr, my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue;
423
424                         g_ptr = &creature_ptr->current_floor_ptr->grid_array[my][mx];
425
426                         if (!g_ptr->m_idx) continue;
427
428                         m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
429
430                         if (monster_csleep_remaining(m_ptr)) continue;
431                         if (!is_hostile(m_ptr)) continue;
432
433                         r_ptr = &r_info[m_ptr->r_idx];
434
435                         /* Monster spells (only powerful ones)*/
436                         if (projectable(creature_ptr, my, mx, yy, xx))
437                         {
438                                 BIT_FLAGS f4 = r_ptr->flags4;
439                                 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
440                                 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
441
442                                 if (!(d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
443                                 {
444                                         if (f4 & RF4_BA_CHAO) spell_damcalc_by_spellnum(creature_ptr, MS_BALL_CHAOS, GF_CHAOS, g_ptr->m_idx, &dam_max0);
445                                         if (f5 & RF5_BA_MANA) spell_damcalc_by_spellnum(creature_ptr, MS_BALL_MANA, GF_MANA, g_ptr->m_idx, &dam_max0);
446                                         if (f5 & RF5_BA_DARK) spell_damcalc_by_spellnum(creature_ptr, MS_BALL_DARK, GF_DARK, g_ptr->m_idx, &dam_max0);
447                                         if (f5 & RF5_BA_LITE) spell_damcalc_by_spellnum(creature_ptr, MS_STARBURST, GF_LITE, g_ptr->m_idx, &dam_max0);
448                                         if (f6 & RF6_HAND_DOOM) spell_damcalc_by_spellnum(creature_ptr, MS_HAND_DOOM, GF_HAND_DOOM, g_ptr->m_idx, &dam_max0);
449                                         if (f6 & RF6_PSY_SPEAR) spell_damcalc_by_spellnum(creature_ptr, MS_PSY_SPEAR, GF_PSY_SPEAR, g_ptr->m_idx, &dam_max0);
450                                 }
451
452                                 if (f4 & RF4_ROCKET) spell_damcalc_by_spellnum(creature_ptr, MS_ROCKET, GF_ROCKET, g_ptr->m_idx, &dam_max0);
453                                 if (f4 & RF4_BR_ACID) spell_damcalc_by_spellnum(creature_ptr, MS_BR_ACID, GF_ACID, g_ptr->m_idx, &dam_max0);
454                                 if (f4 & RF4_BR_ELEC) spell_damcalc_by_spellnum(creature_ptr, MS_BR_ELEC, GF_ELEC, g_ptr->m_idx, &dam_max0);
455                                 if (f4 & RF4_BR_FIRE) spell_damcalc_by_spellnum(creature_ptr, MS_BR_FIRE, GF_FIRE, g_ptr->m_idx, &dam_max0);
456                                 if (f4 & RF4_BR_COLD) spell_damcalc_by_spellnum(creature_ptr, MS_BR_COLD, GF_COLD, g_ptr->m_idx, &dam_max0);
457                                 if (f4 & RF4_BR_POIS) spell_damcalc_by_spellnum(creature_ptr, MS_BR_POIS, GF_POIS, g_ptr->m_idx, &dam_max0);
458                                 if (f4 & RF4_BR_NETH) spell_damcalc_by_spellnum(creature_ptr, MS_BR_NETHER, GF_NETHER, g_ptr->m_idx, &dam_max0);
459                                 if (f4 & RF4_BR_LITE) spell_damcalc_by_spellnum(creature_ptr, MS_BR_LITE, GF_LITE, g_ptr->m_idx, &dam_max0);
460                                 if (f4 & RF4_BR_DARK) spell_damcalc_by_spellnum(creature_ptr, MS_BR_DARK, GF_DARK, g_ptr->m_idx, &dam_max0);
461                                 if (f4 & RF4_BR_CONF) spell_damcalc_by_spellnum(creature_ptr, MS_BR_CONF, GF_CONFUSION, g_ptr->m_idx, &dam_max0);
462                                 if (f4 & RF4_BR_SOUN) spell_damcalc_by_spellnum(creature_ptr, MS_BR_SOUND, GF_SOUND, g_ptr->m_idx, &dam_max0);
463                                 if (f4 & RF4_BR_CHAO) spell_damcalc_by_spellnum(creature_ptr, MS_BR_CHAOS, GF_CHAOS, g_ptr->m_idx, &dam_max0);
464                                 if (f4 & RF4_BR_DISE) spell_damcalc_by_spellnum(creature_ptr, MS_BR_DISEN, GF_DISENCHANT, g_ptr->m_idx, &dam_max0);
465                                 if (f4 & RF4_BR_NEXU) spell_damcalc_by_spellnum(creature_ptr, MS_BR_NEXUS, GF_NEXUS, g_ptr->m_idx, &dam_max0);
466                                 if (f4 & RF4_BR_TIME) spell_damcalc_by_spellnum(creature_ptr, MS_BR_TIME, GF_TIME, g_ptr->m_idx, &dam_max0);
467                                 if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(creature_ptr, MS_BR_INERTIA, GF_INERTIAL, g_ptr->m_idx, &dam_max0);
468                                 if (f4 & RF4_BR_GRAV) spell_damcalc_by_spellnum(creature_ptr, MS_BR_GRAVITY, GF_GRAVITY, g_ptr->m_idx, &dam_max0);
469                                 if (f4 & RF4_BR_SHAR) spell_damcalc_by_spellnum(creature_ptr, MS_BR_SHARDS, GF_SHARDS, g_ptr->m_idx, &dam_max0);
470                                 if (f4 & RF4_BR_PLAS) spell_damcalc_by_spellnum(creature_ptr, MS_BR_PLASMA, GF_PLASMA, g_ptr->m_idx, &dam_max0);
471                                 if (f4 & RF4_BR_WALL) spell_damcalc_by_spellnum(creature_ptr, MS_BR_FORCE, GF_FORCE, g_ptr->m_idx, &dam_max0);
472                                 if (f4 & RF4_BR_MANA) spell_damcalc_by_spellnum(creature_ptr, MS_BR_MANA, GF_MANA, g_ptr->m_idx, &dam_max0);
473                                 if (f4 & RF4_BR_NUKE) spell_damcalc_by_spellnum(creature_ptr, MS_BR_NUKE, GF_NUKE, g_ptr->m_idx, &dam_max0);
474                                 if (f4 & RF4_BR_DISI) spell_damcalc_by_spellnum(creature_ptr, MS_BR_DISI, GF_DISINTEGRATE, g_ptr->m_idx, &dam_max0);
475                         }
476
477                         /* Monster melee attacks */
478                         if ((r_ptr->flags1 & RF1_NEVER_BLOW) || (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MELEE))
479                         {
480                                 dam_max += dam_max0;
481                                 continue;
482                         }
483
484                         if (!(mx <= xx + 1 && mx >= xx - 1 && my <= yy + 1 && my >= yy - 1))
485                         {
486                                 dam_max += dam_max0;
487                                 continue;
488                         }
489
490                         int dam_melee = 0;
491                         for (int m = 0; m < 4; m++)
492                         {
493                                 /* Skip non-attacks */
494                                 if (!r_ptr->blow[m].method || (r_ptr->blow[m].method == RBM_SHOOT)) continue;
495
496                                 /* Extract the attack info */
497                                 dam_melee += blow_damcalc(m_ptr, creature_ptr, &r_ptr->blow[m]);
498                                 if (r_ptr->blow[m].method == RBM_EXPLODE) break;
499                         }
500
501                         if (dam_melee > dam_max0) dam_max0 = dam_melee;
502                         dam_max += dam_max0;
503                 }
504         }
505
506         /* Prevent excessive warning */
507         if (dam_max > old_damage)
508         {
509                 old_damage = dam_max * 3 / 2;
510
511                 if (dam_max > creature_ptr->chp / 2)
512                 {
513                         object_type *o_ptr = choose_warning_item(creature_ptr);
514
515                         if (o_ptr)
516                                 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
517                         else
518                                 strcpy(o_name, _("体", "body")); /* Warning ability without item */
519                         msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), o_name);
520
521                         disturb(creature_ptr, FALSE, TRUE);
522                         return get_check(_("本当にこのまま進むか?", "Really want to go ahead? "));
523                 }
524         }
525         else old_damage = old_damage / 2;
526
527         g_ptr = &creature_ptr->current_floor_ptr->grid_array[yy][xx];
528         bool is_warning = (!easy_disarm && is_trap(creature_ptr, g_ptr->feat)) || (g_ptr->mimic && is_trap(creature_ptr, g_ptr->feat));
529         is_warning &= !one_in_(13);
530         if (!is_warning) return TRUE;
531
532         object_type *o_ptr = choose_warning_item(creature_ptr);
533         if (o_ptr != NULL)
534                 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
535         else
536                 strcpy(o_name, _("体", "body")); /* Warning ability without item */
537         msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), o_name);
538         disturb(creature_ptr, FALSE, TRUE);
539         return get_check(_("本当にこのまま進むか?", "Really want to go ahead? "));
540 }