OSDN Git Service

[Refactor] #37353 生命の薬の効果をlife_stream()に分離。
authorDeskull <deskull@users.sourceforge.jp>
Mon, 24 Sep 2018 06:58:25 +0000 (15:58 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Mon, 24 Sep 2018 06:58:25 +0000 (15:58 +0900)
Separate effect of Potion of Life to life_stream().

src/cmd-quaff.c
src/dungeon.c
src/externs.h
src/spells2.c

index ed60311..2b5bd57 100644 (file)
@@ -382,26 +382,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_LIFE:\r
-                       chg_virtue(V_VITALITY, 1);\r
-                       chg_virtue(V_UNLIFE, -5);\r
-                       msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));\r
-                       restore_level();\r
-                       (void)set_poisoned(0);\r
-                       (void)set_blind(0);\r
-                       (void)set_confused(0);\r
-                       (void)set_image(0);\r
-                       (void)set_stun(0);\r
-                       (void)set_cut(0);\r
-                       (void)do_res_stat(A_STR);\r
-                       (void)do_res_stat(A_CON);\r
-                       (void)do_res_stat(A_DEX);\r
-                       (void)do_res_stat(A_WIS);\r
-                       (void)do_res_stat(A_INT);\r
-                       (void)do_res_stat(A_CHR);\r
-                       (void)set_shero(0,TRUE);\r
-                       update_stuff();\r
-                       hp_player(5000);\r
-                       ident = TRUE;\r
+                       ident = life_stream(TRUE, TRUE);\r
                        break;\r
 \r
                case SV_POTION_RESTORE_MANA:\r
index ad0075b..a9b0b3b 100644 (file)
@@ -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);
 
index e242331..52d5d74 100644 (file)
@@ -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);
index df0cc85..2d46fd5 100644 (file)
@@ -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;
+}
+