OSDN Git Service

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