OSDN Git Service

[Refactor] #38997 set_protevil() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Sat, 22 Jun 2019 03:23:18 +0000 (12:23 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 22 Jun 2019 03:23:18 +0000 (12:23 +0900)
src/cmd-activate.c
src/cmd-read.c
src/core.c
src/player-effects.c
src/player-effects.h
src/realm-craft.c
src/realm-crusade.c
src/spells2.c

index c7ebfa9..e9daf6b 100644 (file)
@@ -1328,7 +1328,7 @@ bool activate_artifact(object_type *o_ptr)
        {
                msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
                k = 3 * p_ptr->lev;
-               (void)set_protevil(randint1(25) + k, FALSE);
+               (void)set_protevil(p_ptr, randint1(25) + k, FALSE);
                break;
        }
 
index c333e32..c205f1b 100644 (file)
@@ -370,7 +370,7 @@ void exe_read(INVENTORY_IDX item, bool known)
                case SV_SCROLL_PROTECTION_FROM_EVIL:
                {
                        k = 3 * p_ptr->lev;
-                       if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
+                       if (set_protevil(p_ptr, p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
                        break;
                }
 
index d154a70..55bbeb1 100644 (file)
@@ -1983,7 +1983,7 @@ static void process_world_aux_timeout(void)
        /* Protection from evil */
        if (p_ptr->protevil)
        {
-               (void)set_protevil(p_ptr->protevil - 1, TRUE);
+               (void)set_protevil(p_ptr, p_ptr->protevil - 1, TRUE);
        }
 
        /* Invulnerability */
index d38114d..9a93e53 100644 (file)
@@ -298,7 +298,7 @@ void dispel_player(void)
        (void)set_tsuyoshi(0, TRUE);
        (void)set_hero(p_ptr, 0, TRUE);
        (void)set_shero(p_ptr, 0, TRUE);
-       (void)set_protevil(0, TRUE);
+       (void)set_protevil(p_ptr, 0, TRUE);
        (void)set_invuln(0, TRUE);
        (void)set_wraith_form(0, TRUE);
        (void)set_kabenuke(0, TRUE);
@@ -1245,21 +1245,21 @@ bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_protevil(TIME_EFFECT v, bool do_dec)
+bool set_protevil(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;
 
        /* Open */
        if (v)
        {
-               if (p_ptr->protevil && !do_dec)
+               if (creature_ptr->protevil && !do_dec)
                {
-                       if (p_ptr->protevil > v) return FALSE;
+                       if (creature_ptr->protevil > v) return FALSE;
                }
-               else if (!p_ptr->protevil)
+               else if (!creature_ptr->protevil)
                {
                        msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
                        notice = TRUE;
@@ -1269,7 +1269,7 @@ bool set_protevil(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->protevil)
+               if (creature_ptr->protevil)
                {
                        msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
                        notice = TRUE;
@@ -1277,8 +1277,8 @@ bool set_protevil(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->protevil = v;
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->protevil = v;
+       creature_ptr->redraw |= (PR_STATUS);
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
index 2e18c15..ba7b870 100644 (file)
@@ -29,7 +29,7 @@ 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(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-extern bool set_protevil(TIME_EFFECT v, bool do_dec);
+extern bool set_protevil(player_type *creature_ptr, 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);
 extern bool set_tim_infra(TIME_EFFECT v, bool do_dec);
index 1e78dc0..31e07bd 100644 (file)
@@ -241,7 +241,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_protevil(randint1(sides) + base, FALSE);
+                               set_protevil(p_ptr, randint1(sides) + base, FALSE);
                        }
                }
                break;
index bcece72..83339a4 100644 (file)
@@ -231,7 +231,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_protevil(randint1(sides) + base, FALSE);
+                               set_protevil(p_ptr, randint1(sides) + base, FALSE);
                        }
                }
                break;
@@ -568,7 +568,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                set_hero(p_ptr, randint1(base) + base, FALSE);
                                set_blessed(p_ptr, randint1(base) + base, FALSE);
                                set_fast(p_ptr, randint1(sp_sides) + sp_base, FALSE);
-                               set_protevil(randint1(base) + base, FALSE);
+                               set_protevil(p_ptr, randint1(base) + base, FALSE);
                                set_afraid(p_ptr, 0);
                        }
                }
index aed46b7..a7e2780 100644 (file)
@@ -914,7 +914,7 @@ bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
        bool ident = FALSE;
        if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
        int k = 3 * creature_ptr->lev;
-       if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
+       if (set_protevil(p_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
        if (set_poisoned(p_ptr, 0)) ident = TRUE;
        if (set_afraid(p_ptr, 0)) ident = TRUE;
        if (hp_player(p_ptr, 50)) ident = TRUE;