From 809f285c4a153afcad25d9462cd24f996ed54e6b Mon Sep 17 00:00:00 2001 From: Deskull Date: Mon, 24 Sep 2018 15:58:25 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20=E7=94=9F=E5=91=BD?= =?utf8?q?=E3=81=AE=E8=96=AC=E3=81=AE=E5=8A=B9=E6=9E=9C=E3=82=92life=5Fstr?= =?utf8?q?eam()=E3=81=AB=E5=88=86=E9=9B=A2=E3=80=82=20Separate=20effect=20?= =?utf8?q?of=20Potion=20of=20Life=20to=20life=5Fstream().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd-quaff.c | 21 +-------------------- src/dungeon.c | 15 ++------------- src/externs.h | 1 + src/spells2.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index ed6031160..2b5bd57fe 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -382,26 +382,7 @@ void do_cmd_quaff_potion_aux(int item) break; case SV_POTION_LIFE: - chg_virtue(V_VITALITY, 1); - chg_virtue(V_UNLIFE, -5); - msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!")); - restore_level(); - (void)set_poisoned(0); - (void)set_blind(0); - (void)set_confused(0); - (void)set_image(0); - (void)set_stun(0); - (void)set_cut(0); - (void)do_res_stat(A_STR); - (void)do_res_stat(A_CON); - (void)do_res_stat(A_DEX); - (void)do_res_stat(A_WIS); - (void)do_res_stat(A_INT); - (void)do_res_stat(A_CHR); - (void)set_shero(0,TRUE); - update_stuff(); - hp_player(5000); - ident = TRUE; + ident = life_stream(TRUE, TRUE); break; case SV_POTION_RESTORE_MANA: diff --git a/src/dungeon.c b/src/dungeon.c index ad0075b14..a9b0b3b66 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -6620,9 +6620,7 @@ void play_game(bool new_game) msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death.")); msg_print(NULL); - /* Restore hit points */ - p_ptr->chp = p_ptr->mhp; - p_ptr->chp_frac = 0; + (void)life_stream(FALSE, FALSE); if (p_ptr->pclass == CLASS_MAGIC_EATER) { @@ -6636,6 +6634,7 @@ void play_game(bool new_game) p_ptr->magic_num1[magic_idx] = 0; } } + /* Restore spell points */ p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; @@ -6666,16 +6665,6 @@ void play_game(bool new_game) /* Do not die */ p_ptr->is_dead = FALSE; - /* Hack -- Healing */ - (void)set_blind(0); - (void)set_confused(0); - (void)set_poisoned(0); - (void)set_afraid(0); - (void)set_paralyzed(0); - (void)set_image(0); - (void)set_stun(0); - (void)set_cut(0); - /* Hack -- Prevent starvation */ (void)set_food(PY_FOOD_MAX - 1); diff --git a/src/externs.h b/src/externs.h index e24233141..52d5d74d8 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1171,6 +1171,7 @@ extern bool cast_wrath_of_the_god(HIT_POINT dam, int rad); extern void cast_wonder(int dir); extern void cast_invoke_spirits(int dir); extern void cast_shuffle(void); +extern bool_hack life_stream(bool_hack message, bool_hack virtue); /* spells3.c */ extern bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode); diff --git a/src/spells2.c b/src/spells2.c index df0cc85da..2d46fd58f 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -4975,3 +4975,34 @@ void cast_shuffle(void) } } +bool_hack life_stream(bool_hack message, bool_hack virtue) +{ + if(virtue) + { + chg_virtue(V_VITALITY, 1); + chg_virtue(V_UNLIFE, -5); + } + if(message) + { + msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!")); + } + restore_level(); + (void)set_poisoned(0); + (void)set_blind(0); + (void)set_confused(0); + (void)set_image(0); + (void)set_stun(0); + (void)set_cut(0); + (void)do_res_stat(A_STR); + (void)do_res_stat(A_CON); + (void)do_res_stat(A_DEX); + (void)do_res_stat(A_WIS); + (void)do_res_stat(A_INT); + (void)do_res_stat(A_CHR); + (void)set_shero(0, TRUE); + update_stuff(); + hp_player(5000); + + return TRUE; +} + -- 2.11.0