• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisiona1d329d72d3b98b8f8f7d20db0a05c007de50a62 (tree)
Time2019-06-02 21:27:52
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 CHECK_MULTISHADOW() と take_hit() を player-damage.c/h へ移動.

Change Summary

Incremental Difference

--- a/src/chest.c
+++ b/src/chest.c
@@ -7,8 +7,9 @@
77 #include "floor.h"
88 #include "trap.h"
99 #include "player-status.h"
10-#include "player-effects.h"
10+#include "player-damage.h"
1111 #include "player-class.h"
12+#include "player-effects.h"
1213 #include "grid.h"
1314 #include "realm-song.h"
1415
--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -21,9 +21,10 @@
2121 #include "spells-status.h"
2222 #include "spells-object.h"
2323 #include "spells-floor.h"
24+#include "player-effects.h"
2425 #include "realm-hex.h"
2526 #include "player-status.h"
26-#include "player-effects.h"
27+#include "player-damage.h"
2728 #include "monster-status.h"
2829 #include "files.h"
2930 #include "objectkind.h"
--- a/src/cmd-eat.c
+++ b/src/cmd-eat.c
@@ -17,6 +17,7 @@
1717 #include "realm-hex.h"
1818 #include "player-status.h"
1919 #include "player-effects.h"
20+#include "player-damage.h"
2021 #include "player-race.h"
2122 #include "player-class.h"
2223 #include "floor.h"
--- a/src/cmd-pet.c
+++ b/src/cmd-pet.c
@@ -12,6 +12,7 @@
1212 #include "player-effects.h"
1313 #include "player-skill.h"
1414 #include "player-class.h"
15+#include "player-damage.h"
1516 #include "object-hook.h"
1617 #include "monster.h"
1718 #include "monster-status.h"
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -16,8 +16,9 @@
1616 #include "avatar.h"
1717 #include "spells.h"
1818 #include "spells-status.h"
19-#include "player-status.h"
2019 #include "player-effects.h"
20+#include "player-status.h"
21+#include "player-damage.h"
2122 #include "player-race.h"
2223 #include "realm-hex.h"
2324 #include "realm-song.h"
--- a/src/cmd-read.c
+++ b/src/cmd-read.c
@@ -14,8 +14,9 @@
1414 #include "artifact.h"
1515 #include "avatar.h"
1616 #include "player-status.h"
17-#include "player-effects.h"
17+#include "player-damage.h"
1818 #include "player-class.h"
19+#include "player-effects.h"
1920 #include "rumor.h"
2021 #include "realm-hex.h"
2122
--- a/src/cmd-spell.c
+++ b/src/cmd-spell.c
@@ -31,6 +31,7 @@
3131 #include "realm-trump.h"
3232 #include "mind.h"
3333 #include "avatar.h"
34+#include "player-damage.h"
3435 #include "player-status.h"
3536 #include "player-effects.h"
3637 #include "player-skill.h"
--- a/src/core.c
+++ b/src/core.c
@@ -63,6 +63,8 @@
6363 #include "player-class.h"
6464 #include "player-race.h"
6565 #include "player-personality.h"
66+#include "player-damage.h"
67+#include "player-effects.h"
6668 #include "cmd-spell.h"
6769 #include "realm-hex.h"
6870 #include "objectkind.h"
@@ -78,7 +80,6 @@
7880 #include "view-mainwindow.h"
7981 #include "dungeon-file.h"
8082 #include "files.h"
81-#include "player-effects.h"
8283 #include "scores.h"
8384 #include "autopick.h"
8485 #include "save.h"
--- a/src/defines.h
+++ b/src/defines.h
@@ -380,9 +380,6 @@
380380 #define SUB_ALIGN_EVIL 0x0001
381381 #define SUB_ALIGN_GOOD 0x0002
382382
383-/* Multishadow effects is determined by current_world_ptr->game_turn */
384-#define CHECK_MULTISHADOW() (p_ptr->multishadow && (current_world_ptr->game_turn & 1))
385-
386383 /* Is "teleport level" ineffective to this target? */
387384 #define TELE_LEVEL_IS_INEFF(TARGET) \
388385 (p_ptr->inside_arena || p_ptr->inside_battle || \
--- a/src/mind.c
+++ b/src/mind.c
@@ -36,6 +36,7 @@
3636 #include "cmd-basic.h"
3737 #include "monster-status.h"
3838 #include "player-effects.h"
39+#include "player-damage.h"
3940 #include "view-mainwindow.h"
4041 #include "targeting.h"
4142 #include "realm-song.h"
--- a/src/mspells4.c
+++ b/src/mspells4.c
@@ -16,6 +16,7 @@
1616 #include "player-status.h"
1717 #include "player-class.h"
1818 #include "player-personality.h"
19+#include "player-damage.h"
1920 #include "realm-hex.h"
2021 #include "player-move.h"
2122 #include "monster-spell.h"
--- a/src/mutation.c
+++ b/src/mutation.c
@@ -25,6 +25,7 @@
2525 #include "player-effects.h"
2626 #include "player-personality.h"
2727 #include "player-class.h"
28+#include "player-damage.h"
2829 #include "spells-status.h"
2930 #include "object-hook.h"
3031 #include "spells.h"
--- a/src/patron.c
+++ b/src/patron.c
@@ -15,6 +15,7 @@
1515 #include "player-effects.h"
1616 #include "player-race.h"
1717 #include "player-class.h"
18+#include "player-damage.h"
1819
1920 #include "spells.h"
2021 #include "spells-summon.h"
--- a/src/player-damage.c
+++ b/src/player-damage.c
@@ -1,19 +1,30 @@
11 #include "angband.h"
2+#include "core.h"
23 #include "util.h"
4+#include "term.h"
35
6+#include "avatar.h"
7+#include "cmd-dump.h"
48 #include "realm-song.h"
5-#include "player-damage.h"
6-#include "player-personality.h"
9+#include "floor.h"
710 #include "artifact.h"
811 #include "object-flavor.h"
912 #include "object-hook.h"
1013 #include "object-broken.h"
14+#include "player-move.h"
15+#include "player-damage.h"
16+#include "player-personality.h"
1117 #include "player-status.h"
1218 #include "player-effects.h"
1319 #include "player-class.h"
1420 #include "monster-spell.h"
1521 #include "world.h"
1622 #include "view-mainwindow.h"
23+#include "quest.h"
24+#include "report.h"
25+#include "wild.h"
26+#include "save.h"
27+#include "files.h"
1728
1829
1930 /*!
@@ -594,3 +605,351 @@ HIT_POINT cold_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura)
594605
595606 return get_damage;
596607 }
608+
609+
610+/*
611+ * Decreases players hit points and sets death flag if necessary
612+ *
613+ * Invulnerability needs to be changed into a "shield"
614+ *
615+ * Hack -- this function allows the user to save (or quit)
616+ * the game when he dies, since the "You die." message is shown before
617+ * setting the player to "dead".
618+ */
619+
620+int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
621+{
622+ int old_chp = p_ptr->chp;
623+
624+ char death_message[1024];
625+ char tmp[1024];
626+
627+ int warning = (p_ptr->mhp * hitpoint_warn / 10);
628+ if (p_ptr->is_dead) return 0;
629+
630+ if (p_ptr->sutemi) damage *= 2;
631+ if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
632+
633+ if (easy_band) damage = (damage + 1) / 2;
634+
635+ if (damage_type != DAMAGE_USELIFE)
636+ {
637+ disturb(TRUE, TRUE);
638+ if (auto_more)
639+ {
640+ p_ptr->now_damaged = TRUE;
641+ }
642+ }
643+
644+ if (monspell >= 0) learn_spell(monspell);
645+
646+ /* Mega-Hack -- Apply "invulnerability" */
647+ if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
648+ {
649+ if (IS_INVULN() && (damage < 9000))
650+ {
651+ if (damage_type == DAMAGE_FORCE)
652+ {
653+ msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
654+ }
655+ else if (one_in_(PENETRATE_INVULNERABILITY))
656+ {
657+ msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
658+ }
659+ else
660+ {
661+ return 0;
662+ }
663+ }
664+
665+ if (CHECK_MULTISHADOW())
666+ {
667+ if (damage_type == DAMAGE_FORCE)
668+ {
669+ msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
670+ }
671+ else if (damage_type == DAMAGE_ATTACK)
672+ {
673+ msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
674+ return 0;
675+ }
676+ }
677+
678+ if (p_ptr->wraith_form)
679+ {
680+ if (damage_type == DAMAGE_FORCE)
681+ {
682+ msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
683+ }
684+ else
685+ {
686+ damage /= 2;
687+ if ((damage == 0) && one_in_(2)) damage = 1;
688+ }
689+ }
690+
691+ if (p_ptr->special_defense & KATA_MUSOU)
692+ {
693+ damage /= 2;
694+ if ((damage == 0) && one_in_(2)) damage = 1;
695+ }
696+ } /* not if LOSELIFE USELIFE */
697+
698+ /* Hurt the player */
699+ p_ptr->chp -= damage;
700+ if (damage_type == DAMAGE_GENO && p_ptr->chp < 0)
701+ {
702+ damage += p_ptr->chp;
703+ p_ptr->chp = 0;
704+ }
705+
706+ /* Display the hitpoints */
707+ p_ptr->redraw |= (PR_HP);
708+
709+ p_ptr->window |= (PW_PLAYER);
710+
711+ if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
712+ {
713+ chg_virtue(V_SACRIFICE, 1);
714+ chg_virtue(V_CHANCE, 2);
715+ }
716+
717+ /* Dead player */
718+ if (p_ptr->chp < 0)
719+ {
720+ bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
721+
722+#ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
723+ if (!cheat_save)
724+ if (!save_player()) msg_print("セーブ失敗!");
725+#endif
726+
727+ sound(SOUND_DEATH);
728+
729+ chg_virtue(V_SACRIFICE, 10);
730+
731+ handle_stuff();
732+ p_ptr->leaving = TRUE;
733+
734+ /* Note death */
735+ p_ptr->is_dead = TRUE;
736+
737+ if (p_ptr->inside_arena)
738+ {
739+ concptr m_name = r_name + r_info[arena_info[p_ptr->arena_number].r_idx].name;
740+ msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
741+ msg_print(NULL);
742+ if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
743+ }
744+ else
745+ {
746+ QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level);
747+ bool seppuku = streq(hit_from, "Seppuku");
748+ bool winning_seppuku = p_ptr->total_winner && seppuku;
749+
750+ play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
751+
752+#ifdef WORLD_SCORE
753+ /* Make screen dump */
754+ screen_dump = make_screen_dump();
755+#endif
756+
757+ /* Note cause of death */
758+ if (seppuku)
759+ {
760+ strcpy(p_ptr->died_from, hit_from);
761+#ifdef JP
762+ if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
763+#endif
764+ }
765+ else
766+ {
767+ char dummy[1024];
768+#ifdef JP
769+ sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
770+#else
771+ sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
772+#endif
773+ my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
774+ }
775+
776+ /* No longer a winner */
777+ p_ptr->total_winner = FALSE;
778+
779+ if (winning_seppuku)
780+ {
781+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
782+ }
783+ else
784+ {
785+ char buf[20];
786+
787+ if (p_ptr->inside_arena)
788+ strcpy(buf, _("アリーナ", "in the Arena"));
789+ else if (!current_floor_ptr->dun_level)
790+ strcpy(buf, _("地上", "on the surface"));
791+ else if (q_idx && (is_fixed_quest_idx(q_idx) &&
792+ !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
793+ strcpy(buf, _("クエスト", "in a quest"));
794+ else
795+ sprintf(buf, _("%d階", "level %d"), (int)current_floor_ptr->dun_level);
796+
797+ sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
798+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
799+ }
800+
801+ do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
802+ do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
803+
804+ flush();
805+
806+ if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
807+ {
808+ do_cmd_save_screen();
809+ }
810+
811+ flush();
812+
813+ /* Initialize "last message" buffer */
814+ if (p_ptr->last_message) string_free(p_ptr->last_message);
815+ p_ptr->last_message = NULL;
816+
817+ /* Hack -- Note death */
818+ if (!last_words)
819+ {
820+#ifdef JP
821+ msg_format("あなたは%sました。", android ? "壊れ" : "死に");
822+#else
823+ msg_print(android ? "You are broken." : "You die.");
824+#endif
825+
826+ msg_print(NULL);
827+ }
828+ else
829+ {
830+ if (winning_seppuku)
831+ {
832+ get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
833+ }
834+ else
835+ {
836+ get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
837+ }
838+
839+ do
840+ {
841+#ifdef JP
842+ while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024));
843+#else
844+ while (!get_string("Last word: ", death_message, 1024));
845+#endif
846+ } while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
847+
848+ if (death_message[0] == '\0')
849+ {
850+#ifdef JP
851+ strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
852+#else
853+ strcpy(death_message, android ? "You are broken." : "You die.");
854+#endif
855+ }
856+ else p_ptr->last_message = string_make(death_message);
857+
858+#ifdef JP
859+ if (winning_seppuku)
860+ {
861+ int i, len;
862+ int w = Term->wid;
863+ int h = Term->hgt;
864+ int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23 };
865+ int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4 };
866+ concptr str;
867+ char* str2;
868+
869+ Term_clear();
870+
871+ /* 桜散る */
872+ for (i = 0; i < 40; i++)
873+ Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
874+
875+ str = death_message;
876+ if (strncmp(str, "「", 2) == 0) str += 2;
877+
878+ str2 = my_strstr(str, "」");
879+ if (str2 != NULL) *str2 = '\0';
880+
881+ i = 0;
882+ while (i < 9)
883+ {
884+ str2 = my_strstr(str, " ");
885+ if (str2 == NULL) len = strlen(str);
886+ else len = str2 - str;
887+
888+ if (len != 0)
889+ {
890+ Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
891+ TERM_WHITE, str);
892+ if (str2 == NULL) break;
893+ i++;
894+ }
895+ str = str2 + 1;
896+ if (*str == 0) break;
897+ }
898+
899+ /* Hide cursor */
900+ Term_putstr(w - 1, h - 1, 1, TERM_WHITE, " ");
901+
902+ flush();
903+#ifdef WORLD_SCORE
904+ /* Make screen dump */
905+ screen_dump = make_screen_dump();
906+#endif
907+
908+ /* Wait a key press */
909+ (void)inkey();
910+ }
911+ else
912+#endif
913+ msg_print(death_message);
914+ }
915+ }
916+
917+ /* Dead */
918+ return damage;
919+ }
920+
921+ handle_stuff();
922+
923+ /* Hitpoint warning */
924+ if (p_ptr->chp < warning)
925+ {
926+ /* Hack -- bell on first notice */
927+ if (old_chp > warning) bell();
928+
929+ sound(SOUND_WARN);
930+
931+ if (record_danger && (old_chp > warning))
932+ {
933+ if (p_ptr->image && damage_type == DAMAGE_ATTACK)
934+ hit_from = _("何か", "something");
935+
936+ sprintf(tmp, _("%sによってピンチに陥った。", "A critical situation because of %s."), hit_from);
937+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
938+ }
939+
940+ if (auto_more)
941+ {
942+ /* stop auto_more even if DAMAGE_USELIFE */
943+ p_ptr->now_damaged = TRUE;
944+ }
945+
946+ msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
947+ msg_print(NULL);
948+ flush();
949+ }
950+ if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp / 5)))
951+ {
952+ change_wild_mode(FALSE);
953+ }
954+ return damage;
955+}
--- a/src/player-damage.h
+++ b/src/player-damage.h
@@ -1,5 +1,16 @@
11 #pragma once
22
3+/* Multishadow effects is determined by current_world_ptr->game_turn */
4+#define CHECK_MULTISHADOW() (p_ptr->multishadow && (current_world_ptr->game_turn & 1))
5+
6+#define DAMAGE_FORCE 1
7+#define DAMAGE_GENO 2
8+#define DAMAGE_LOSELIFE 3
9+#define DAMAGE_ATTACK 4
10+#define DAMAGE_NOESCAPE 5
11+#define DAMAGE_USELIFE 6
12+extern int take_hit(int damage_type, HIT_POINT damage, concptr kb_str, int monspell);
13+
314 /*
415 * This seems like a pretty standard "typedef"
516 */
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -43,6 +43,7 @@
4343 #include "player-class.h"
4444 #include "player-personality.h"
4545 #include "player-sex.h"
46+#include "player-damage.h"
4647 #include "monster-status.h"
4748 #include "snipe.h"
4849 #include "files.h"
@@ -3905,356 +3906,6 @@ void do_poly_self(void)
39053906 }
39063907 }
39073908
3908-
3909-/*
3910- * Decreases players hit points and sets death flag if necessary
3911- *
3912- * Invulnerability needs to be changed into a "shield"
3913- *
3914- * Hack -- this function allows the user to save (or quit)
3915- * the game when he dies, since the "You die." message is shown before
3916- * setting the player to "dead".
3917- */
3918-
3919-int take_hit(int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
3920-{
3921- int old_chp = p_ptr->chp;
3922-
3923- char death_message[1024];
3924- char tmp[1024];
3925-
3926- int warning = (p_ptr->mhp * hitpoint_warn / 10);
3927- if (p_ptr->is_dead) return 0;
3928-
3929- if (p_ptr->sutemi) damage *= 2;
3930- if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
3931-
3932- if (easy_band) damage = (damage+1)/2;
3933-
3934- if (damage_type != DAMAGE_USELIFE)
3935- {
3936- disturb(TRUE, TRUE);
3937- if (auto_more)
3938- {
3939- p_ptr->now_damaged = TRUE;
3940- }
3941- }
3942-
3943- if (monspell >= 0) learn_spell(monspell);
3944-
3945- /* Mega-Hack -- Apply "invulnerability" */
3946- if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
3947- {
3948- if (IS_INVULN() && (damage < 9000))
3949- {
3950- if (damage_type == DAMAGE_FORCE)
3951- {
3952- msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
3953- }
3954- else if (one_in_(PENETRATE_INVULNERABILITY))
3955- {
3956- msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
3957- }
3958- else
3959- {
3960- return 0;
3961- }
3962- }
3963-
3964- if (CHECK_MULTISHADOW())
3965- {
3966- if (damage_type == DAMAGE_FORCE)
3967- {
3968- msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
3969- }
3970- else if (damage_type == DAMAGE_ATTACK)
3971- {
3972- msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
3973- return 0;
3974- }
3975- }
3976-
3977- if (p_ptr->wraith_form)
3978- {
3979- if (damage_type == DAMAGE_FORCE)
3980- {
3981- msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
3982- }
3983- else
3984- {
3985- damage /= 2;
3986- if ((damage == 0) && one_in_(2)) damage = 1;
3987- }
3988- }
3989-
3990- if (p_ptr->special_defense & KATA_MUSOU)
3991- {
3992- damage /= 2;
3993- if ((damage == 0) && one_in_(2)) damage = 1;
3994- }
3995- } /* not if LOSELIFE USELIFE */
3996-
3997- /* Hurt the player */
3998- p_ptr->chp -= damage;
3999- if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
4000- {
4001- damage += p_ptr->chp;
4002- p_ptr->chp = 0;
4003- }
4004-
4005- /* Display the hitpoints */
4006- p_ptr->redraw |= (PR_HP);
4007-
4008- p_ptr->window |= (PW_PLAYER);
4009-
4010- if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
4011- {
4012- chg_virtue(V_SACRIFICE, 1);
4013- chg_virtue(V_CHANCE, 2);
4014- }
4015-
4016- /* Dead player */
4017- if (p_ptr->chp < 0)
4018- {
4019- bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
4020-
4021-#ifdef JP /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
4022- if (!cheat_save)
4023- if(!save_player()) msg_print("セーブ失敗!");
4024-#endif
4025-
4026- sound(SOUND_DEATH);
4027-
4028- chg_virtue(V_SACRIFICE, 10);
4029-
4030- handle_stuff();
4031- p_ptr->leaving = TRUE;
4032-
4033- /* Note death */
4034- p_ptr->is_dead = TRUE;
4035-
4036- if (p_ptr->inside_arena)
4037- {
4038- concptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
4039- msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
4040- msg_print(NULL);
4041- if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
4042- }
4043- else
4044- {
4045- QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level);
4046- bool seppuku = streq(hit_from, "Seppuku");
4047- bool winning_seppuku = p_ptr->total_winner && seppuku;
4048-
4049- play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
4050-
4051-#ifdef WORLD_SCORE
4052- /* Make screen dump */
4053- screen_dump = make_screen_dump();
4054-#endif
4055-
4056- /* Note cause of death */
4057- if (seppuku)
4058- {
4059- strcpy(p_ptr->died_from, hit_from);
4060-#ifdef JP
4061- if (!winning_seppuku) strcpy(p_ptr->died_from, "切腹");
4062-#endif
4063- }
4064- else
4065- {
4066- char dummy[1024];
4067-#ifdef JP
4068- sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "彫像状態で" : "麻痺状態で", p_ptr->image ? "幻覚に歪んだ" : "", hit_from);
4069-#else
4070- sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
4071-#endif
4072- my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
4073- }
4074-
4075- /* No longer a winner */
4076- p_ptr->total_winner = FALSE;
4077-
4078- if (winning_seppuku)
4079- {
4080- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
4081- }
4082- else
4083- {
4084- char buf[20];
4085-
4086- if (p_ptr->inside_arena)
4087- strcpy(buf,_("アリーナ", "in the Arena"));
4088- else if (!current_floor_ptr->dun_level)
4089- strcpy(buf,_("地上", "on the surface"));
4090- else if (q_idx && (is_fixed_quest_idx(q_idx) &&
4091- !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
4092- strcpy(buf,_("クエスト", "in a quest"));
4093- else
4094- sprintf(buf,_("%d階", "level %d"), (int)current_floor_ptr->dun_level);
4095-
4096- sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, p_ptr->died_from);
4097- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4098- }
4099-
4100- do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
4101- do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
4102-
4103- flush();
4104-
4105- if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
4106- {
4107- do_cmd_save_screen();
4108- }
4109-
4110- flush();
4111-
4112- /* Initialize "last message" buffer */
4113- if (p_ptr->last_message) string_free(p_ptr->last_message);
4114- p_ptr->last_message = NULL;
4115-
4116- /* Hack -- Note death */
4117- if (!last_words)
4118- {
4119-#ifdef JP
4120- msg_format("あなたは%sました。", android ? "壊れ" : "死に");
4121-#else
4122- msg_print(android ? "You are broken." : "You die.");
4123-#endif
4124-
4125- msg_print(NULL);
4126- }
4127- else
4128- {
4129- if (winning_seppuku)
4130- {
4131- get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
4132- }
4133- else
4134- {
4135- get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
4136- }
4137-
4138- do
4139- {
4140-#ifdef JP
4141- while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, 1024)) ;
4142-#else
4143- while (!get_string("Last word: ", death_message, 1024)) ;
4144-#endif
4145- }
4146- while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
4147-
4148- if (death_message[0] == '\0')
4149- {
4150-#ifdef JP
4151- strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
4152-#else
4153- strcpy(death_message, android ? "You are broken." : "You die.");
4154-#endif
4155- }
4156- else p_ptr->last_message = string_make(death_message);
4157-
4158-#ifdef JP
4159- if (winning_seppuku)
4160- {
4161- int i, len;
4162- int w = Term->wid;
4163- int h = Term->hgt;
4164- int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23};
4165- int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4};
4166- concptr str;
4167- char* str2;
4168-
4169- Term_clear();
4170-
4171- /* 桜散る */
4172- for (i = 0; i < 40; i++)
4173- Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
4174-
4175- str = death_message;
4176- if (strncmp(str, "「", 2) == 0) str += 2;
4177-
4178- str2 = my_strstr(str, "」");
4179- if (str2 != NULL) *str2 = '\0';
4180-
4181- i = 0;
4182- while (i < 9)
4183- {
4184- str2 = my_strstr(str, " ");
4185- if (str2 == NULL) len = strlen(str);
4186- else len = str2 - str;
4187-
4188- if (len != 0)
4189- {
4190- Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
4191- TERM_WHITE, str);
4192- if (str2 == NULL) break;
4193- i++;
4194- }
4195- str = str2 + 1;
4196- if (*str == 0) break;
4197- }
4198-
4199- /* Hide cursor */
4200- Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
4201-
4202- flush();
4203-#ifdef WORLD_SCORE
4204- /* Make screen dump */
4205- screen_dump = make_screen_dump();
4206-#endif
4207-
4208- /* Wait a key press */
4209- (void)inkey();
4210- }
4211- else
4212-#endif
4213- msg_print(death_message);
4214- }
4215- }
4216-
4217- /* Dead */
4218- return damage;
4219- }
4220-
4221- handle_stuff();
4222-
4223- /* Hitpoint warning */
4224- if (p_ptr->chp < warning)
4225- {
4226- /* Hack -- bell on first notice */
4227- if (old_chp > warning) bell();
4228-
4229- sound(SOUND_WARN);
4230-
4231- if (record_danger && (old_chp > warning))
4232- {
4233- if (p_ptr->image && damage_type == DAMAGE_ATTACK)
4234- hit_from = _("何か", "something");
4235-
4236- sprintf(tmp,_("%sによってピンチに陥った。", "A critical situation because of %s."),hit_from);
4237- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
4238- }
4239-
4240- if (auto_more)
4241- {
4242- /* stop auto_more even if DAMAGE_USELIFE */
4243- p_ptr->now_damaged = TRUE;
4244- }
4245-
4246- msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
4247- msg_print(NULL);
4248- flush();
4249- }
4250- if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
4251- {
4252- change_wild_mode(FALSE);
4253- }
4254- return damage;
4255-}
4256-
4257-
42583909 /*
42593910 * Gain experience
42603911 */
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -11,14 +11,6 @@ struct kamae
1111
1212 /* effects.c */
1313
14-#define DAMAGE_FORCE 1
15-#define DAMAGE_GENO 2
16-#define DAMAGE_LOSELIFE 3
17-#define DAMAGE_ATTACK 4
18-#define DAMAGE_NOESCAPE 5
19-#define DAMAGE_USELIFE 6
20-extern int take_hit(int damage_type, HIT_POINT damage, concptr kb_str, int monspell);
21-
2214 extern void set_action(ACTION_IDX typ);
2315 extern void reset_tim_flags(void);
2416 extern void dispel_player(void);
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -11,6 +11,7 @@
1111 #include "player-race.h"
1212 #include "player-class.h"
1313 #include "player-personality.h"
14+#include "player-damage.h"
1415 #include "floor.h"
1516 #include "floor-events.h"
1617 #include "feature.h"
@@ -38,6 +39,7 @@
3839 #include "melee.h"
3940 #include "world.h"
4041 #include "view-mainwindow.h"
42+#include "files.h"
4143
4244 /*!
4345 * @brief 能力値テーブル / Abbreviations of healthy stats
--- a/src/racial.c
+++ b/src/racial.c
@@ -27,6 +27,7 @@
2727 #include "player-race.h"
2828 #include "player-effects.h"
2929 #include "player-status.h"
30+#include "player-damage.h"
3031 #include "spells-status.h"
3132 #include "spells-object.h"
3233 #include "spells-floor.h"
--- a/src/realm-daemon.c
+++ b/src/realm-daemon.c
@@ -10,6 +10,7 @@
1010 #include "spells-status.h"
1111 #include "player-effects.h"
1212 #include "player-race.h"
13+#include "player-damage.h"
1314 #include "targeting.h"
1415
1516 /*!
--- a/src/realm-death.c
+++ b/src/realm-death.c
@@ -8,6 +8,7 @@
88 #include "player-effects.h"
99 #include "targeting.h"
1010 #include "player-class.h"
11+#include "player-damage.h"
1112 #include "player-race.h"
1213
1314 /*!
--- a/src/realm-hissatsu.c
+++ b/src/realm-hissatsu.c
@@ -13,6 +13,7 @@
1313 #include "player-move.h"
1414 #include "player-status.h"
1515 #include "player-effects.h"
16+#include "player-damage.h"
1617 #include "feature.h"
1718 #include "spells.h"
1819 #include "grid.h"
--- a/src/realm-nature.c
+++ b/src/realm-nature.c
@@ -10,6 +10,7 @@
1010 #include "spells-floor.h"
1111 #include "player-race.h"
1212 #include "player-effects.h"
13+#include "player-damage.h"
1314 #include "targeting.h"
1415
1516
--- a/src/spells-object.c
+++ b/src/spells-object.c
@@ -11,6 +11,7 @@
1111 #include "object-hook.h"
1212 #include "object-flavor.h"
1313 #include "object-ego.h"
14+#include "player-damage.h"
1415 #include "player-status.h"
1516 #include "avatar.h"
1617 #include "player-effects.h"
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -44,6 +44,7 @@
4444 #include "player-effects.h"
4545 #include "player-skill.h"
4646 #include "player-class.h"
47+#include "player-damage.h"
4748
4849 #include "dungeon.h"
4950 #include "floor-events.h"
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -30,6 +30,7 @@
3030 #include "player-move.h"
3131 #include "player-status.h"
3232 #include "player-class.h"
33+#include "player-damage.h"
3334 #include "spells-summon.h"
3435 #include "quest.h"
3536 #include "artifact.h"
Show on old repository browser