From 2b2fa4b1856713b776c1f05fe3db9eae7ee93742 Mon Sep 17 00:00:00 2001 From: Deskull Date: Wed, 26 Sep 2018 19:37:40 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20=E9=87=8D=E5=82=B7?= =?utf8?q?=E3=81=AE=E6=B2=BB=E7=99=92=E3=81=AE=E5=8A=B9=E6=9E=9C=E3=82=92c?= =?utf8?q?ure=5Fserious=5Fwounds()=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81?= =?utf8?q?=E3=82=8B=E3=80=82=20Integrate=20some=20effects=20to=20cure=5Fse?= =?utf8?q?rious=5Fwounds().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd-activate.c | 3 +-- src/cmd-eat.c | 2 +- src/cmd-quaff.c | 6 +----- src/externs.h | 1 + src/realm-arcane.c | 7 +------ src/realm-hex.c | 6 +----- src/realm-life.c | 7 +------ src/spells2.c | 13 ++++++++++++- 8 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/cmd-activate.c b/src/cmd-activate.c index 9341126c2..5e5ddebf5 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -1106,8 +1106,7 @@ bool activate_artifact(object_type *o_ptr) case ACT_CURE_MW: { msg_print(_("深紫色の光を発している...", "It radiates deep purple...")); - hp_player(damroll(4, 8)); - (void)set_cut((p_ptr->cut / 2) - 50); + (void)cure_serious_wound(4, 8); break; } diff --git a/src/cmd-eat.c b/src/cmd-eat.c index ff6195987..cdb861adc 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -198,7 +198,7 @@ void do_cmd_eat_food_aux(int item) case SV_FOOD_CURE_SERIOUS: { - if (hp_player(damroll(4, 8))) ident = TRUE; + ident = cure_serious_wound(4, 8); break; } diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index fa03adb35..df0be2582 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -339,11 +339,7 @@ void do_cmd_quaff_potion_aux(int item) break; case SV_POTION_CURE_SERIOUS: - if (hp_player(damroll(4, 8))) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE; - if (set_shero(0, TRUE)) ident = TRUE; + ident = cure_light_wound(4, 8); break; case SV_POTION_CURE_CRITICAL: diff --git a/src/externs.h b/src/externs.h index 54874dd5f..a8a90ff5a 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1174,6 +1174,7 @@ extern void cast_shuffle(void); extern bool_hack life_stream(bool_hack message, bool_hack virtue); extern bool_hack heroism(int base); extern bool_hack cure_light_wound(int dice, int sides); +extern bool_hack cure_serious_wound(int dice, int sides); /* spells3.c */ extern bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode); diff --git a/src/realm-arcane.c b/src/realm-arcane.c index 30ee0c109..6cc65acc7 100644 --- a/src/realm-arcane.c +++ b/src/realm-arcane.c @@ -312,12 +312,7 @@ cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode) int sides = 8; if (info) return info_heal(dice, sides, 0); - - if (cast) - { - hp_player(damroll(dice, sides)); - set_cut((p_ptr->cut / 2) - 50); - } + if (cast) (void)cure_serious_wound(4, 8); } break; diff --git a/src/realm-hex.c b/src/realm-hex.c index 74d1891c0..a354308b8 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -590,11 +590,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode) { msg_print(_("気分が良くなってくる。", "You feel better and better.")); } - if (cast || cont) - { - hp_player(damroll(2, 10)); - set_cut((p_ptr->cut / 2) - 10); - } + if (cast || cont) (void)cure_serious_wound(2, 10); break; case 10: diff --git a/src/realm-life.c b/src/realm-life.c index 2caf13571..37d237da0 100644 --- a/src/realm-life.c +++ b/src/realm-life.c @@ -104,12 +104,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode) int sides = 10; if (info) return info_heal(dice, sides, 0); - - if (cast) - { - hp_player(damroll(dice, sides)); - set_cut((p_ptr->cut / 2) - 20); - } + if (cast) (void)cure_serious_wound(dice, sides); } break; diff --git a/src/spells2.c b/src/spells2.c index 766af0a2c..7d0cbfbe5 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -5023,4 +5023,15 @@ bool_hack cure_light_wound(int dice, int sides) if (set_cut(p_ptr->cut - 10)) ident = TRUE; if (set_shero(0, TRUE)) ident = TRUE; return ident; -} \ No newline at end of file +} + +bool_hack cure_serious_wound(int dice, int sides) +{ + bool_hack ident = FALSE; + if (hp_player(damroll(dice, sides))) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE; + if (set_shero(0, TRUE)) ident = TRUE; + return ident; +} -- 2.11.0