OSDN Git Service

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