OSDN Git Service

[Refactor] #38997 set_shero() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Sat, 22 Jun 2019 03:18:02 +0000 (12:18 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 22 Jun 2019 03:18:02 +0000 (12:18 +0900)
src/cmd-usestaff.c
src/cmd-zaprod.c
src/core.c
src/player-effects.c
src/player-effects.h
src/spells-status.c

index 73b2ec8..3157362 100644 (file)
@@ -165,7 +165,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                case SV_STAFF_CURING:
                {
                        ident = true_healing(0);
-                       if (set_shero(0, TRUE)) ident = TRUE;
+                       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
                        break;
                }
 
@@ -179,7 +179,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                {
                        if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
                        ident |= restore_mana(FALSE);
-                       if (set_shero(0, TRUE)) ident = TRUE;
+                       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
                        break;
                }
 
index cd09292..d711a1b 100644 (file)
@@ -99,7 +99,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
        case SV_ROD_CURING:
        {
                if (true_healing(0)) ident = TRUE;
-               if (set_shero(0, TRUE)) ident = TRUE;
+               if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
                break;
        }
 
index 52d5d80..d154a70 100644 (file)
@@ -2007,7 +2007,7 @@ static void process_world_aux_timeout(void)
        /* Super Heroism */
        if (p_ptr->shero)
        {
-               (void)set_shero(p_ptr->shero - 1, TRUE);
+               (void)set_shero(p_ptr, p_ptr->shero - 1, TRUE);
        }
 
        /* Blessed */
@@ -2160,7 +2160,7 @@ static void process_world_aux_mutation(void)
                disturb(FALSE, TRUE);
                msg_print(_("ウガァァア!", "RAAAAGHH!"));
                msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
-               (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
+               (void)set_shero(p_ptr, 10 + randint1(p_ptr->lev), FALSE);
                (void)set_afraid(p_ptr, 0);
        }
 
index 3d3e14c..d38114d 100644 (file)
@@ -297,7 +297,7 @@ void dispel_player(void)
        (void)set_blessed(p_ptr, 0, TRUE);
        (void)set_tsuyoshi(0, TRUE);
        (void)set_hero(p_ptr, 0, TRUE);
-       (void)set_shero(0, TRUE);
+       (void)set_shero(p_ptr, 0, TRUE);
        (void)set_protevil(0, TRUE);
        (void)set_invuln(0, TRUE);
        (void)set_wraith_form(0, TRUE);
@@ -1191,22 +1191,22 @@ bool set_hero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
  * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_shero(TIME_EFFECT v, bool do_dec)
+bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 {
        bool notice = FALSE;
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (p_ptr->is_dead) return FALSE;
+       if (creature_ptr->is_dead) return FALSE;
 
-       if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
+       if (creature_ptr->pclass == CLASS_BERSERKER) v = 1;
        /* Open */
        if (v)
        {
-               if (p_ptr->shero && !do_dec)
+               if (creature_ptr->shero && !do_dec)
                {
-                       if (p_ptr->shero > v) return FALSE;
+                       if (creature_ptr->shero > v) return FALSE;
                }
-               else if (!p_ptr->shero)
+               else if (!creature_ptr->shero)
                {
                        msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
                        notice = TRUE;
@@ -1216,7 +1216,7 @@ bool set_shero(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->shero)
+               if (creature_ptr->shero)
                {
                        msg_print(_("野蛮な気持ちが消え失せた。", "You feel less Berserk."));
                        notice = TRUE;
@@ -1224,17 +1224,17 @@ bool set_shero(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->shero = v;
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->shero = v;
+       creature_ptr->redraw |= (PR_STATUS);
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
 
        /* Recalculate hitpoints */
-       p_ptr->update |= (PU_HP);
+       creature_ptr->update |= (PU_HP);
        handle_stuff();
        return (TRUE);
 }
index 771b0f5..2e18c15 100644 (file)
@@ -28,7 +28,7 @@ extern bool set_tsubureru(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 extern bool set_magicdef(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_blessed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_hero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-extern bool set_shero(TIME_EFFECT v, bool do_dec);
+extern bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_protevil(TIME_EFFECT v, bool do_dec);
 extern bool set_invuln(TIME_EFFECT v, bool do_dec);
 extern bool set_tim_invis(TIME_EFFECT v, bool do_dec);
index 45d1ec2..c0101d1 100644 (file)
@@ -284,7 +284,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change)
        (void)set_stun(0);
        (void)set_cut(0);
        (void)restore_all_status();
-       (void)set_shero(0, TRUE);
+       (void)set_shero(p_ptr, 0, TRUE);
        handle_stuff();
        hp_player(p_ptr, 5000);
 
@@ -304,7 +304,7 @@ bool_hack berserk(int base)
 {
        bool_hack ident = FALSE;
        if (set_afraid(p_ptr, 0)) ident = TRUE;
-       if (set_shero(p_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
+       if (set_shero(p_ptr, p_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
        if (hp_player(p_ptr, 30)) ident = TRUE;
        return ident;
 }
@@ -315,7 +315,7 @@ bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
        if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
        if (set_blind(p_ptr, 0)) ident = TRUE;
        if (set_cut(p_ptr->cut - 10)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
+       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
@@ -326,7 +326,7 @@ bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
        if (set_blind(p_ptr, 0)) ident = TRUE;
        if (set_confused(p_ptr, 0)) ident = TRUE;
        if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
+       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
@@ -339,7 +339,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow)
        if (set_poisoned(p_ptr, 0)) ident = TRUE;
        if (set_stun(0)) ident = TRUE;
        if (set_cut(0)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
+       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
@@ -466,7 +466,7 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
        (void)set_hero(p_ptr, creature_ptr->hero + t, FALSE);
        (void)set_blessed(p_ptr, creature_ptr->blessed + t, FALSE);
        (void)set_fast(p_ptr, creature_ptr->fast + t, FALSE);
-       (void)set_shero(creature_ptr->shero + t, FALSE);
+       (void)set_shero(p_ptr, creature_ptr->shero + t, FALSE);
        if (creature_ptr->pclass == CLASS_FORCETRAINER)
        {
                P_PTR_KI = creature_ptr->lev * 5 + 190;