OSDN Git Service

[Refactor] #37353 重傷の治癒の効果をcure_serious_wounds()にまとめる。
authorDeskull <deskull@users.sourceforge.jp>
Wed, 26 Sep 2018 10:37:40 +0000 (19:37 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Wed, 26 Sep 2018 10:37:40 +0000 (19:37 +0900)
Integrate some effects to cure_serious_wounds().

src/cmd-activate.c
src/cmd-eat.c
src/cmd-quaff.c
src/externs.h
src/realm-arcane.c
src/realm-hex.c
src/realm-life.c
src/spells2.c

index 9341126..5e5ddeb 100644 (file)
@@ -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;
        }
 
index ff61959..cdb861a 100644 (file)
@@ -198,7 +198,7 @@ void do_cmd_eat_food_aux(int item)
 \r
                case SV_FOOD_CURE_SERIOUS:\r
                {\r
-                       if (hp_player(damroll(4, 8))) ident = TRUE;\r
+                       ident = cure_serious_wound(4, 8);\r
                        break;\r
                }\r
 \r
index fa03adb..df0be25 100644 (file)
@@ -339,11 +339,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_CURE_SERIOUS:\r
-                       if (hp_player(damroll(4, 8))) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;\r
-                       if (set_shero(0, TRUE)) ident = TRUE;\r
+                       ident = cure_light_wound(4, 8);\r
                        break;\r
 \r
                case SV_POTION_CURE_CRITICAL:\r
index 54874dd..a8a90ff 100644 (file)
@@ -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);
index 30ee0c1..6cc65ac 100644 (file)
@@ -312,12 +312,7 @@ cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        int sides = 8;\r
 \r
                        if (info) return info_heal(dice, sides, 0);\r
-\r
-                       if (cast)\r
-                       {\r
-                               hp_player(damroll(dice, sides));\r
-                               set_cut((p_ptr->cut / 2) - 50);\r
-                       }\r
+                       if (cast) (void)cure_serious_wound(4, 8);\r
                }\r
                break;\r
 \r
index 74d1891..a354308 100644 (file)
@@ -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:
index 2caf135..37d237d 100644 (file)
@@ -104,12 +104,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        int sides = 10;\r
 \r
                        if (info) return info_heal(dice, sides, 0);\r
-\r
-                       if (cast)\r
-                       {\r
-                               hp_player(damroll(dice, sides));\r
-                               set_cut((p_ptr->cut / 2) - 20);\r
-                       }\r
+                       if (cast) (void)cure_serious_wound(dice, sides);\r
                }\r
                break;\r
 \r
index 766af0a..7d0cbfb 100644 (file)
@@ -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;
+}