OSDN Git Service

[Refactor] #37353 癒し系の効果をtrue_healing()にまとめる。
authorDeskull <deskull@users.sourceforge.jp>
Thu, 27 Sep 2018 13:23:58 +0000 (22:23 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Thu, 27 Sep 2018 13:23:58 +0000 (22:23 +0900)
Integrate some effects to true_healing().

src/cmd-activate.c
src/cmd-quaff.c
src/cmd-usestaff.c
src/cmd-zaprod.c
src/effects.c
src/externs.h
src/racial.c
src/realm-craft.c
src/spells2.c
src/wizard2.c
src/xtra2.c

index 2a68100..f6b8476 100644 (file)
@@ -1146,13 +1146,7 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_CURING:
        {
                msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
-               (void)set_poisoned(0);
-               (void)set_confused(0);
-               (void)set_blind(0);
-               (void)set_stun(0);
-               (void)set_cut(0);
-               (void)set_image(0);
-
+               true_healing(0);
                break;
        }
 
index bec5d35..f4fb7da 100644 (file)
@@ -480,13 +480,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_CURING:\r
-                       if (hp_player(50)) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_poisoned(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_stun(0)) ident = TRUE;\r
-                       if (set_cut(0)) ident = TRUE;\r
-                       if (set_image(0)) ident = TRUE;\r
+                       if (true_healing(50)) ident = TRUE;\r
                        break;\r
 \r
                case SV_POTION_INVULNERABILITY:\r
index 69a39bb..202e404 100644 (file)
@@ -181,22 +181,14 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
 \r
        case SV_STAFF_CURING:\r
        {\r
-               if (set_blind(0)) ident = TRUE;\r
-               if (set_poisoned(0)) ident = TRUE;\r
-               if (set_confused(0)) ident = TRUE;\r
-               if (set_stun(0)) ident = TRUE;\r
-               if (set_cut(0)) ident = TRUE;\r
-               if (set_image(0)) ident = TRUE;\r
+               ident = true_healing(0);\r
                if (set_shero(0, TRUE)) ident = TRUE;\r
                break;\r
        }\r
 \r
        case SV_STAFF_HEALING:\r
        {\r
-               if (hp_player(powerful ? 500 : 300)) ident = TRUE;\r
-               if (set_stun(0)) ident = TRUE;\r
-               if (set_cut(0)) ident = TRUE;\r
-               if (set_shero(0, TRUE)) ident = TRUE;\r
+               if (cure_critical_wounds(powerful ? 500 : 300)) ident = TRUE;\r
                break;\r
        }\r
 \r
index fc9a955..ae1bc7b 100644 (file)
@@ -83,12 +83,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
 
        case SV_ROD_CURING:
        {
-               if (set_blind(0)) ident = TRUE;
-               if (set_poisoned(0)) ident = TRUE;
-               if (set_confused(0)) ident = TRUE;
-               if (set_stun(0)) ident = TRUE;
-               if (set_cut(0)) ident = TRUE;
-               if (set_image(0)) ident = TRUE;
+               if (true_healing(0)) ident = TRUE;
                if (set_shero(0, TRUE)) ident = TRUE;
                break;
        }
index fff6e77..8bb17b8 100644 (file)
@@ -3876,7 +3876,10 @@ bool hp_player(int num)
 {
        int vir;
        vir = virtue_number(V_VITALITY);
-       if (vir)
+
+       if(num <= 0) return (FALSE);
+
+       if(vir)
        {
                num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
        }
index 1b75df4..bebb593 100644 (file)
@@ -1176,6 +1176,7 @@ extern bool_hack heroism(int base);
 extern bool_hack cure_light_wounds(int dice, int sides);
 extern bool_hack cure_serious_wounds(int dice, int sides);
 extern bool_hack cure_critical_wounds(HIT_POINT pow);
+extern bool_hack true_healing(HIT_POINT pow);
 extern bool_hack restore_mana(bool_hack magic_eater);
 extern bool restore_all_status(void);
 
index 158b773..46f7511 100644 (file)
@@ -1332,12 +1332,7 @@ static bool cmd_racial_power_aux(s32b command)
                        {
                                msg_print(_("あなたは「パターン」を心に描いてその上を歩いた...", "You picture the Pattern in your mind and walk it..."));
 
-                               (void)set_poisoned(0);
-                               (void)set_image(0);
-                               (void)set_stun(0);
-                               (void)set_cut(0);
-                               (void)set_blind(0);
-                               (void)set_afraid(0);
+                               (void)true_healing(0);
                                (void)restore_all_status();
                                (void)restore_level();
                        }
index 9ab59a2..c768d91 100644 (file)
@@ -252,10 +252,7 @@ cptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {\r
                        if (cast)\r
                        {\r
-                               set_poisoned(0);\r
-                               set_stun(0);\r
-                               set_cut(0);\r
-                               set_image(0);\r
+                               (void)true_healing(0);\r
                        }\r
                }\r
                break;\r
index 589093d..43f710d 100644 (file)
@@ -5044,6 +5044,19 @@ bool_hack cure_critical_wounds(HIT_POINT pow)
        return ident;
 }
 
+bool_hack true_healing(HIT_POINT pow)
+{
+       bool_hack ident = FALSE;
+       if (hp_player(pow)) ident = TRUE;
+       if (set_blind(0)) ident = TRUE;
+       if (set_confused(0)) ident = TRUE;
+       if (set_poisoned(0)) ident = TRUE;
+       if (set_stun(0)) ident = TRUE;
+       if (set_cut(0)) ident = TRUE;
+       if (set_image(0)) ident = TRUE;
+       return ident;
+}
+
 bool_hack restore_mana(bool_hack magic_eater)
 {
        bool_hack ident = FALSE;
index c90730c..e9838fd 100644 (file)
@@ -1478,53 +1478,7 @@ static void wiz_create_item(void)
  */
 static void do_cmd_wiz_cure_all(void)
 {
-       /* Restore stats */
-       (void)res_stat(A_STR);
-       (void)res_stat(A_INT);
-       (void)res_stat(A_WIS);
-       (void)res_stat(A_CON);
-       (void)res_stat(A_DEX);
-       (void)res_stat(A_CHR);
-
-       /* Restore the level */
-       (void)restore_level();
-
-       /* Heal the player */
-       if (p_ptr->chp < p_ptr->mhp)
-       {
-               p_ptr->chp = p_ptr->mhp;
-               p_ptr->chp_frac = 0;
-
-               /* Redraw */
-               p_ptr->redraw |= (PR_HP);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_PLAYER);
-       }
-
-       /* Restore mana */
-       if (p_ptr->csp < p_ptr->msp)
-       {
-               p_ptr->csp = p_ptr->msp;
-               p_ptr->csp_frac = 0;
-
-               p_ptr->redraw |= (PR_MANA);
-               p_ptr->window |= (PW_PLAYER);
-               p_ptr->window |= (PW_SPELL);
-       }
-
-       /* Cure stuff */
-       (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);
-       (void)set_slow(0, TRUE);
-
-       /* No longer hungry */
+       (void)life_stream(FALSE, FALSE);
        (void)set_food(PY_FOOD_MAX - 1);
 }
 
index 2a42800..68e4584 100644 (file)
@@ -4851,18 +4851,9 @@ void gain_level_reward(int chosen_reward)
                case REW_HEAL_FUL:
 
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[p_ptr->chaos_patron]);
-                       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);
-                       hp_player(5000);
-                       for (dummy = 0; dummy < 6; dummy++)
-                       {
-                               (void)do_res_stat(dummy);
-                       }
+                       (void)restore_level();
+                       (void)restore_all_status();
+                       (void)true_healing(5000);
                        reward = _("体力が回復した。", "healing");
                        break;