OSDN Git Service

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