OSDN Git Service

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