OSDN Git Service

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