OSDN Git Service

[Refactor] #40236 Removed dependency from cmd-process-screen to core
[hengband/hengband.git] / src / player-damage.c
1 #include "angband.h"
2 #include "core.h"
3 #include "util.h"
4 #include "main/music-definitions-table.h"
5 #include "main/sound-definitions-table.h"
6 #include "gameterm.h"
7
8 #include "avatar.h"
9 #include "market/building.h"
10 #include "io/write-diary.h"
11 #include "cmd/cmd-process-screen.h"
12 #include "market/arena-info-table.h"
13 #include "realm-song.h"
14 #include "floor.h"
15 #include "artifact.h"
16 #include "object-flavor.h"
17 #include "object-hook.h"
18 #include "object-broken.h"
19 #include "player-move.h"
20 #include "player-damage.h"
21 #include "player-personality.h"
22 #include "player-status.h"
23 #include "player-effects.h"
24 #include "player-class.h"
25 #include "player-race.h"
26 #include "monster-spell.h"
27 #include "world.h"
28 #include "view-mainwindow.h"
29 #include "quest.h"
30 #include "report.h"
31 #include "wild.h"
32 #include "save.h"
33 #include "files.h"
34
35 /*!
36  * @brief アイテムを指定確率で破損させる /
37  * Destroys a type of item on a given percent chance
38  * @param player_ptr プレーヤーへの参照ポインタ
39  * @param typ 破損判定関数ポインタ
40  * @param perc 基本確率
41  * @return なし
42  * @details
43  * Note that missiles are no longer necessarily all destroyed
44  * Destruction taken from "melee.c" code for "stealing".
45  * New-style wands and rods handled correctly. -LM-
46  */
47 void inventory_damage(player_type *player_ptr, inven_func typ, int perc)
48 {
49         INVENTORY_IDX i;
50         int j, amt;
51         object_type *o_ptr;
52         GAME_TEXT o_name[MAX_NLEN];
53
54         if (CHECK_MULTISHADOW(player_ptr) || player_ptr->current_floor_ptr->inside_arena) return;
55
56         /* Scan through the slots backwards */
57         for (i = 0; i < INVEN_PACK; i++)
58         {
59                 o_ptr = &player_ptr->inventory_list[i];
60                 if (!o_ptr->k_idx) continue;
61
62                 /* Hack -- for now, skip artifacts */
63                 if (object_is_artifact(o_ptr)) continue;
64
65                 /* Give this item slot a shot at death */
66                 if (!(*typ)(o_ptr)) continue;
67                 
68                 /* Count the casualties */
69                 for (amt = j = 0; j < o_ptr->number; ++j)
70                 {
71                         if (randint0(100) < perc) amt++;
72                 }
73
74                 /* Some casualities */
75                 if (!amt) continue;
76                 
77                 object_desc(player_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
78
79                 msg_format(_("%s(%c)が%s壊れてしまった!", "%sour %s (%c) %s destroyed!"),
80 #ifdef JP
81                         o_name, index_to_label(i), ((o_ptr->number > 1) ?
82                         ((amt == o_ptr->number) ? "全部" : (amt > 1 ? "何個か" : "一個")) : ""));
83 #else
84                         ((o_ptr->number > 1) ? ((amt == o_ptr->number) ? "All of y" :
85                         (amt > 1 ? "Some of y" : "One of y")) : "Y"), o_name, index_to_label(i), ((amt > 1) ? "were" : "was"));
86 #endif
87
88 #ifdef JP
89                 if (IS_ECHIZEN(player_ptr))
90                         msg_print("やりやがったな!");
91                 else if ((player_ptr->pseikaku == SEIKAKU_CHARGEMAN))
92                 {
93                         if (randint0(2) == 0) msg_print(_("ジュラル星人め!", ""));
94                         else msg_print(_("弱い者いじめは止めるんだ!", ""));
95                 }
96 #endif
97
98                 /* Potions smash open */
99                 if (object_is_potion(o_ptr))
100                 {
101                         (void)potion_smash_effect(player_ptr, 0, player_ptr->y, player_ptr->x, o_ptr->k_idx);
102                 }
103
104                 /* Reduce the charges of rods/wands */
105                 reduce_charges(o_ptr, amt);
106
107                 /* Destroy "amt" items */
108                 inven_item_increase(player_ptr, i, -amt);
109                 inven_item_optimize(player_ptr, i);
110         }
111 }
112
113
114 /*!
115 * @brief 酸攻撃による装備のAC劣化処理 /
116 * Acid has hit the player, attempt to affect some armor.
117 * @param 酸を浴びたキャラクタへの参照ポインタ
118 * @return 装備による軽減があったならTRUEを返す
119 * @details
120 * Note that the "base armor" of an object never changes.
121 * If any armor is damaged (or resists), the player takes less damage.
122 */
123 static bool acid_minus_ac(player_type *creature_ptr)
124 {
125         object_type *o_ptr = NULL;
126         BIT_FLAGS flgs[TR_FLAG_SIZE];
127         GAME_TEXT o_name[MAX_NLEN];
128
129         /* Pick a (possibly empty) creature_ptr->inventory_list slot */
130         switch (randint1(7))
131         {
132         case 1: o_ptr = &creature_ptr->inventory_list[INVEN_RARM]; break;
133         case 2: o_ptr = &creature_ptr->inventory_list[INVEN_LARM]; break;
134         case 3: o_ptr = &creature_ptr->inventory_list[INVEN_BODY]; break;
135         case 4: o_ptr = &creature_ptr->inventory_list[INVEN_OUTER]; break;
136         case 5: o_ptr = &creature_ptr->inventory_list[INVEN_HANDS]; break;
137         case 6: o_ptr = &creature_ptr->inventory_list[INVEN_HEAD]; break;
138         case 7: o_ptr = &creature_ptr->inventory_list[INVEN_FEET]; break;
139         }
140
141         if (!o_ptr->k_idx) return FALSE;
142         if (!object_is_armour(o_ptr)) return FALSE;
143
144         object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
145         object_flags(o_ptr, flgs);
146         /* No damage left to be done */
147         if (o_ptr->ac + o_ptr->to_a <= 0)
148         {
149                 msg_format(_("%sは既にボロボロだ!", "Your %s is already fully corroded!"), o_name);
150                 return FALSE;
151         }
152
153         /* Object resists */
154         if (have_flag(flgs, TR_IGNORE_ACID))
155         {
156                 msg_format(_("しかし%sには効果がなかった!", "Your %s is unaffected!"), o_name);
157                 return TRUE;
158         }
159
160         msg_format(_("%sが酸で腐食した!", "Your %s is corroded!"), o_name);
161
162         /* Damage the item */
163         o_ptr->to_a--;
164
165         /* Calculate bonuses */
166         creature_ptr->update |= (PU_BONUS);
167         creature_ptr->window |= (PW_EQUIP | PW_PLAYER);
168
169         calc_android_exp(creature_ptr);
170
171         /* Item was damaged */
172         return TRUE;
173 }
174
175
176 /*!
177 * @brief 酸属性によるプレイヤー損害処理 /
178 * Hurt the player with Acid
179 * @param creature_ptr 酸を浴びたキャラクタへの参照ポインタ
180 * @param dam 基本ダメージ量
181 * @param kb_str ダメージ原因記述
182 * @param monspell 原因となったモンスター特殊攻撃ID
183 * @param aura オーラよるダメージが原因ならばTRUE
184 * @return 修正HPダメージ量
185 */
186 HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
187 {
188         HIT_POINT get_damage;
189         int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
190         bool double_resist = is_oppose_acid(creature_ptr);
191
192         /* Total Immunity */
193         if (creature_ptr->immune_acid || (dam <= 0))
194         {
195                 learn_spell(creature_ptr, monspell);
196                 return 0;
197         }
198
199         /* Vulnerability (Ouch!) */
200         if (creature_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
201         if (creature_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
202
203         /* Resist the damage */
204         if (creature_ptr->resist_acid) dam = (dam + 2) / 3;
205         if (double_resist) dam = (dam + 2) / 3;
206
207         if (aura || !CHECK_MULTISHADOW(creature_ptr))
208         {
209                 if ((!(double_resist || creature_ptr->resist_acid)) &&
210                         one_in_(HURT_CHANCE))
211                         (void)do_dec_stat(creature_ptr, A_CHR);
212
213                 /* If any armor gets hit, defend the player */
214                 if (acid_minus_ac(creature_ptr)) dam = (dam + 1) / 2;
215         }
216
217         get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
218
219         /* Inventory damage */
220         if (!aura && !(double_resist && creature_ptr->resist_acid))
221                 inventory_damage(creature_ptr, set_acid_destroy, inv);
222         return get_damage;
223 }
224
225
226 /*!
227 * @brief 電撃属性によるプレイヤー損害処理 /
228 * Hurt the player with electricity
229 * @param creature_ptr 電撃を浴びたキャラクタへの参照ポインタ
230 * @param dam 基本ダメージ量
231 * @param kb_str ダメージ原因記述
232 * @param monspell 原因となったモンスター特殊攻撃ID
233 * @param aura オーラよるダメージが原因ならばTRUE
234 * @return 修正HPダメージ量
235 */
236 HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
237 {
238         HIT_POINT get_damage;
239         int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
240         bool double_resist = is_oppose_elec(creature_ptr);
241
242         /* Total immunity */
243         if (creature_ptr->immune_elec || (dam <= 0))
244         {
245                 learn_spell(creature_ptr, monspell);
246                 return 0;
247         }
248
249         /* Vulnerability (Ouch!) */
250         if (creature_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
251         if (creature_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
252         if (PRACE_IS_(creature_ptr, RACE_ANDROID)) dam += dam / 3;
253
254         /* Resist the damage */
255         if (creature_ptr->resist_elec) dam = (dam + 2) / 3;
256         if (double_resist) dam = (dam + 2) / 3;
257
258         if (aura || !CHECK_MULTISHADOW(creature_ptr))
259         {
260                 if ((!(double_resist || creature_ptr->resist_elec)) &&
261                         one_in_(HURT_CHANCE))
262                         (void)do_dec_stat(creature_ptr, A_DEX);
263         }
264
265         get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
266
267         /* Inventory damage */
268         if (!aura && !(double_resist && creature_ptr->resist_elec))
269                 inventory_damage(creature_ptr, set_elec_destroy, inv);
270
271         return get_damage;
272 }
273
274
275 /*!
276 * @brief 火炎属性によるプレイヤー損害処理 /
277 * Hurt the player with Fire
278 * @param creature_ptr 火炎を浴びたキャラクタへの参照ポインタ
279 * @param dam 基本ダメージ量
280 * @param kb_str ダメージ原因記述
281 * @param monspell 原因となったモンスター特殊攻撃ID
282 * @param aura オーラよるダメージが原因ならばTRUE
283 * @return 修正HPダメージ量
284 */
285 HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
286 {
287         HIT_POINT get_damage;
288         int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
289         bool double_resist = is_oppose_fire(creature_ptr);
290
291         /* Totally immune */
292         if (creature_ptr->immune_fire || (dam <= 0))
293         {
294                 learn_spell(creature_ptr, monspell);
295                 return 0;
296         }
297
298         /* Vulnerability (Ouch!) */
299         if (creature_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
300         if (PRACE_IS_(creature_ptr, RACE_ENT)) dam += dam / 3;
301         if (creature_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
302
303         /* Resist the damage */
304         if (creature_ptr->resist_fire) dam = (dam + 2) / 3;
305         if (double_resist) dam = (dam + 2) / 3;
306
307         if (aura || !CHECK_MULTISHADOW(creature_ptr))
308         {
309                 if ((!(double_resist || creature_ptr->resist_fire)) &&
310                         one_in_(HURT_CHANCE))
311                         (void)do_dec_stat(creature_ptr, A_STR);
312         }
313
314         get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
315
316         /* Inventory damage */
317         if (!aura && !(double_resist && creature_ptr->resist_fire))
318                 inventory_damage(creature_ptr, set_fire_destroy, inv);
319
320         return get_damage;
321 }
322
323
324 /*!
325 * @brief 冷気属性によるプレイヤー損害処理 /
326 * Hurt the player with Cold
327 * @param creature_ptr 冷気を浴びたキャラクタへの参照ポインタ
328 * @param dam 基本ダメージ量
329 * @param kb_str ダメージ原因記述
330 * @param monspell 原因となったモンスター特殊攻撃ID
331 * @param aura オーラよるダメージが原因ならばTRUE
332 * @return 修正HPダメージ量
333 */
334 HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int monspell, bool aura)
335 {
336         HIT_POINT get_damage;
337         int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
338         bool double_resist = is_oppose_cold(creature_ptr);
339
340         /* Total immunity */
341         if (creature_ptr->immune_cold || (dam <= 0))
342         {
343                 learn_spell(creature_ptr, monspell);
344                 return 0;
345         }
346
347         /* Vulnerability (Ouch!) */
348         if (creature_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
349         if (creature_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
350
351         /* Resist the damage */
352         if (creature_ptr->resist_cold) dam = (dam + 2) / 3;
353         if (double_resist) dam = (dam + 2) / 3;
354
355         if (aura || !CHECK_MULTISHADOW(creature_ptr))
356         {
357                 if ((!(double_resist || creature_ptr->resist_cold)) &&
358                         one_in_(HURT_CHANCE))
359                         (void)do_dec_stat(creature_ptr, A_STR);
360         }
361
362         get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
363
364         /* Inventory damage */
365         if (!aura && !(double_resist && creature_ptr->resist_cold))
366                 inventory_damage(creature_ptr, set_cold_destroy, inv);
367
368         return get_damage;
369 }
370
371
372 /*
373  * Decreases players hit points and sets death flag if necessary
374  *
375  * Invulnerability needs to be changed into a "shield"
376  *
377  * Hack -- this function allows the user to save (or quit)
378  * the game when he dies, since the "You die." message is shown before
379  * setting the player to "dead".
380  */
381 int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
382 {
383         int old_chp = creature_ptr->chp;
384
385         char death_message[1024];
386         char tmp[1024];
387
388         int warning = (creature_ptr->mhp * hitpoint_warn / 10);
389         if (creature_ptr->is_dead) return 0;
390
391         if (creature_ptr->sutemi) damage *= 2;
392         if (creature_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
393
394         if (easy_band) damage = (damage + 1) / 2;
395
396         if (damage_type != DAMAGE_USELIFE)
397         {
398                 disturb(creature_ptr, TRUE, TRUE);
399                 if (auto_more)
400                 {
401                         creature_ptr->now_damaged = TRUE;
402                 }
403         }
404
405         if (monspell >= 0) learn_spell(creature_ptr, monspell);
406
407         /* Mega-Hack -- Apply "invulnerability" */
408         if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
409         {
410                 if (IS_INVULN(creature_ptr) && (damage < 9000))
411                 {
412                         if (damage_type == DAMAGE_FORCE)
413                         {
414                                 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
415                         }
416                         else if (one_in_(PENETRATE_INVULNERABILITY))
417                         {
418                                 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
419                         }
420                         else
421                         {
422                                 return 0;
423                         }
424                 }
425
426                 if (CHECK_MULTISHADOW(creature_ptr))
427                 {
428                         if (damage_type == DAMAGE_FORCE)
429                         {
430                                 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
431                         }
432                         else if (damage_type == DAMAGE_ATTACK)
433                         {
434                                 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
435                                 return 0;
436                         }
437                 }
438
439                 if (creature_ptr->wraith_form)
440                 {
441                         if (damage_type == DAMAGE_FORCE)
442                         {
443                                 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
444                         }
445                         else
446                         {
447                                 damage /= 2;
448                                 if ((damage == 0) && one_in_(2)) damage = 1;
449                         }
450                 }
451
452                 if (creature_ptr->special_defense & KATA_MUSOU)
453                 {
454                         damage /= 2;
455                         if ((damage == 0) && one_in_(2)) damage = 1;
456                 }
457         } /* not if LOSELIFE USELIFE */
458
459         /* Hurt the player */
460         creature_ptr->chp -= damage;
461         if (damage_type == DAMAGE_GENO && creature_ptr->chp < 0)
462         {
463                 damage += creature_ptr->chp;
464                 creature_ptr->chp = 0;
465         }
466
467         /* Display the hitpoints */
468         creature_ptr->redraw |= (PR_HP);
469
470         creature_ptr->window |= (PW_PLAYER);
471
472         if (damage_type != DAMAGE_GENO && creature_ptr->chp == 0)
473         {
474                 chg_virtue(creature_ptr, V_SACRIFICE, 1);
475                 chg_virtue(creature_ptr, V_CHANCE, 2);
476         }
477
478         /* Dead player */
479         if (creature_ptr->chp < 0)
480         {
481                 bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
482
483 #ifdef JP
484                 /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
485                 if (!cheat_save)
486                         if (!save_player(creature_ptr)) msg_print("セーブ失敗!");
487 #endif
488
489                 sound(SOUND_DEATH);
490
491                 chg_virtue(creature_ptr, V_SACRIFICE, 10);
492
493                 handle_stuff(creature_ptr);
494                 creature_ptr->leaving = TRUE;
495
496                 /* Note death */
497                 creature_ptr->is_dead = TRUE;
498
499                 if (creature_ptr->current_floor_ptr->inside_arena)
500                 {
501                         concptr m_name = r_name + r_info[arena_info[creature_ptr->arena_number].r_idx].name;
502                         msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
503                         msg_print(NULL);
504                         if (record_arena) exe_write_diary(creature_ptr, DIARY_ARENA, -1 - creature_ptr->arena_number, m_name);
505                 }
506                 else
507                 {
508                         QUEST_IDX q_idx = quest_number(creature_ptr, creature_ptr->current_floor_ptr->dun_level);
509                         bool seppuku = streq(hit_from, "Seppuku");
510                         bool winning_seppuku = current_world_ptr->total_winner && seppuku;
511
512                         play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
513
514 #ifdef WORLD_SCORE
515                         /* Make screen dump */
516                         screen_dump = make_screen_dump(creature_ptr);
517 #endif
518
519                         /* Note cause of death */
520                         if (seppuku)
521                         {
522                                 strcpy(creature_ptr->died_from, hit_from);
523 #ifdef JP
524                                 if (!winning_seppuku) strcpy(creature_ptr->died_from, "切腹");
525 #endif
526                         }
527                         else
528                         {
529                                 char dummy[1024];
530 #ifdef JP
531                                 sprintf(dummy, "%s%s%s", !creature_ptr->paralyzed ? "" : creature_ptr->free_act ? "彫像状態で" : "麻痺状態で", creature_ptr->image ? "幻覚に歪んだ" : "", hit_from);
532 #else
533                                 sprintf(dummy, "%s%s", hit_from, !creature_ptr->paralyzed ? "" : " while helpless");
534 #endif
535                                 my_strcpy(creature_ptr->died_from, dummy, sizeof creature_ptr->died_from);
536                         }
537
538                         /* No longer a winner */
539                         current_world_ptr->total_winner = FALSE;
540
541                         if (winning_seppuku)
542                         {
543                                 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
544                         }
545                         else
546                         {
547                                 char buf[20];
548
549                                 if (creature_ptr->current_floor_ptr->inside_arena)
550                                         strcpy(buf, _("アリーナ", "in the Arena"));
551                                 else if (!creature_ptr->current_floor_ptr->dun_level)
552                                         strcpy(buf, _("地上", "on the surface"));
553                                 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
554                                         !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
555                                         strcpy(buf, _("クエスト", "in a quest"));
556                                 else
557                                         sprintf(buf, _("%d階", "level %d"), (int)creature_ptr->current_floor_ptr->dun_level);
558
559                                 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, creature_ptr->died_from);
560                                 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, tmp);
561                         }
562
563                         exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
564                         exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
565
566                         flush();
567
568                         if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
569                         {
570                                 do_cmd_save_screen(creature_ptr, handle_stuff);
571                         }
572
573                         flush();
574
575                         /* Initialize "last message" buffer */
576                         if (creature_ptr->last_message) string_free(creature_ptr->last_message);
577                         creature_ptr->last_message = NULL;
578
579                         /* Hack -- Note death */
580                         if (!last_words)
581                         {
582 #ifdef JP
583                                 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
584 #else
585                                 msg_print(android ? "You are broken." : "You die.");
586 #endif
587
588                                 msg_print(NULL);
589                         }
590                         else
591                         {
592                                 if (winning_seppuku)
593                                 {
594                                         get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
595                                 }
596                                 else
597                                 {
598                                         get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
599                                 }
600
601                                 do
602                                 {
603 #ifdef JP
604                                         while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024));
605 #else
606                                         while (!get_string("Last word: ", death_message, 1024));
607 #endif
608                                 } while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
609
610                                 if (death_message[0] == '\0')
611                                 {
612 #ifdef JP
613                                         strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
614 #else
615                                         strcpy(death_message, android ? "You are broken." : "You die.");
616 #endif
617                                 }
618                                 else creature_ptr->last_message = string_make(death_message);
619
620 #ifdef JP
621                                 if (winning_seppuku)
622                                 {
623                                         int i, len;
624                                         int w = Term->wid;
625                                         int h = Term->hgt;
626                                         int msg_pos_x[9] = { 5,  7,  9, 12,  14,  17,  19,  21, 23 };
627                                         int msg_pos_y[9] = { 3,  4,  5,  4,   5,   4,   5,   6,  4 };
628                                         concptr str;
629                                         char* str2;
630
631                                         Term_clear();
632
633                                         /* 桜散る */
634                                         for (i = 0; i < 40; i++)
635                                                 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
636
637                                         str = death_message;
638                                         if (strncmp(str, "「", 2) == 0) str += 2;
639
640                                         str2 = my_strstr(str, "」");
641                                         if (str2 != NULL) *str2 = '\0';
642
643                                         i = 0;
644                                         while (i < 9)
645                                         {
646                                                 str2 = my_strstr(str, " ");
647                                                 if (str2 == NULL) len = strlen(str);
648                                                 else len = str2 - str;
649
650                                                 if (len != 0)
651                                                 {
652                                                         Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
653                                                                 TERM_WHITE, str);
654                                                         if (str2 == NULL) break;
655                                                         i++;
656                                                 }
657                                                 str = str2 + 1;
658                                                 if (*str == 0) break;
659                                         }
660
661                                         /* Hide cursor */
662                                         Term_putstr(w - 1, h - 1, 1, TERM_WHITE, " ");
663
664                                         flush();
665 #ifdef WORLD_SCORE
666                                         /* Make screen dump */
667                                         screen_dump = make_screen_dump(creature_ptr);
668 #endif
669
670                                         /* Wait a key press */
671                                         (void)inkey();
672                                 }
673                                 else
674 #endif
675                                         msg_print(death_message);
676                         }
677                 }
678
679                 /* Dead */
680                 return damage;
681         }
682
683         handle_stuff(creature_ptr);
684
685         /* Hitpoint warning */
686         if (creature_ptr->chp < warning)
687         {
688                 /* Hack -- bell on first notice */
689                 if (old_chp > warning) bell();
690
691                 sound(SOUND_WARN);
692
693                 if (record_danger && (old_chp > warning))
694                 {
695                         if (creature_ptr->image && damage_type == DAMAGE_ATTACK)
696                                 hit_from = _("何か", "something");
697
698                         sprintf(tmp, _("%sによってピンチに陥った。", "was in a critical situation because of %s."), hit_from);
699                         exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, tmp);
700                 }
701
702                 if (auto_more)
703                 {
704                         /* stop auto_more even if DAMAGE_USELIFE */
705                         creature_ptr->now_damaged = TRUE;
706                 }
707
708                 msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
709                 msg_print(NULL);
710                 flush();
711         }
712         if (creature_ptr->wild_mode && !creature_ptr->leaving && (creature_ptr->chp < MAX(warning, creature_ptr->mhp / 5)))
713         {
714                 change_wild_mode(creature_ptr, FALSE);
715         }
716         return damage;
717 }