OSDN Git Service

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