OSDN Git Service

[Refactor] #38997 set_oppose_elec() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Mon, 24 Jun 2019 14:29:30 +0000 (23:29 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 24 Jun 2019 14:29:30 +0000 (23:29 +0900)
src/cmd-activate.c
src/cmd-quaff.c
src/core.c
src/mind.c
src/mutation.c
src/player-effects.c
src/player-effects.h
src/realm-arcane.c
src/realm-craft.c
src/realm-life.c
src/realm-nature.c

index ac12b85..467f192 100644 (file)
@@ -1039,7 +1039,7 @@ bool activate_artifact(object_type *o_ptr)
                (void)hp_player(p_ptr, 10);
                (void)set_blessed(p_ptr, randint1(50) + 50, FALSE);
                (void)set_oppose_acid(p_ptr, randint1(50) + 50, FALSE);
-               (void)set_oppose_elec(randint1(50) + 50, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(50) + 50, FALSE);
                (void)set_oppose_fire(randint1(50) + 50, FALSE);
                (void)set_oppose_cold(randint1(50) + 50, FALSE);
                (void)set_oppose_pois(randint1(50) + 50, FALSE);
@@ -1336,7 +1336,7 @@ bool activate_artifact(object_type *o_ptr)
        {
                msg_print(_("様々な色に輝いている...", "It glows many colours..."));
                (void)set_oppose_acid(p_ptr, randint1(40) + 40, FALSE);
-               (void)set_oppose_elec(randint1(40) + 40, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(40) + 40, FALSE);
                (void)set_oppose_fire(randint1(40) + 40, FALSE);
                (void)set_oppose_cold(randint1(40) + 40, FALSE);
                (void)set_oppose_pois(randint1(40) + 40, FALSE);
@@ -1426,7 +1426,7 @@ bool activate_artifact(object_type *o_ptr)
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ELEC, dir, 100, 2);
                }
-               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+               (void)set_oppose_elec(p_ptr, randint1(20) + 20, FALSE);
                break;
        }
 
@@ -1689,7 +1689,7 @@ bool activate_artifact(object_type *o_ptr)
                (void)hp_player(p_ptr, 10);
                (void)set_blessed(p_ptr, v, FALSE);
                (void)set_oppose_acid(p_ptr, v, FALSE);
-               (void)set_oppose_elec(v, FALSE);
+               (void)set_oppose_elec(p_ptr, v, FALSE);
                (void)set_oppose_fire(v, FALSE);
                (void)set_oppose_cold(v, FALSE);
                (void)set_oppose_pois(v, FALSE);
index c4b637b..6724e2d 100644 (file)
@@ -450,7 +450,7 @@ void exe_quaff_potion(INVENTORY_IDX item)
 
                case SV_POTION_RESISTANCE:
                        (void)set_oppose_acid(p_ptr, p_ptr->oppose_acid + randint1(20) + 20, FALSE);
-                       (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
+                       (void)set_oppose_elec(p_ptr, p_ptr->oppose_elec + randint1(20) + 20, FALSE);
                        (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
                        (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
                        (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
index 16e74f0..43250df 100644 (file)
@@ -2049,7 +2049,7 @@ static void process_world_aux_timeout(void)
        /* Oppose Lightning */
        if (p_ptr->oppose_elec)
        {
-               (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
+               (void)set_oppose_elec(p_ptr, p_ptr->oppose_elec - 1, TRUE);
        }
 
        /* Oppose Fire */
index 1746196..729f440 100644 (file)
@@ -1110,7 +1110,7 @@ static bool cast_mindcrafter_spell(int spell)
                if (plev > 14) set_oppose_acid(p_ptr, (TIME_EFFECT)plev, FALSE);
                if (plev > 19) set_oppose_fire((TIME_EFFECT)plev, FALSE);
                if (plev > 24) set_oppose_cold((TIME_EFFECT)plev, FALSE);
-               if (plev > 29) set_oppose_elec((TIME_EFFECT)plev, FALSE);
+               if (plev > 29) set_oppose_elec(p_ptr, (TIME_EFFECT)plev, FALSE);
                if (plev > 34) set_oppose_pois((TIME_EFFECT)plev, FALSE);
                break;
        case 7:
index 4bbd1fa..e91809b 100644 (file)
@@ -2234,7 +2234,7 @@ bool mutation_power_aux(int power)
                                }
                                if (randint0(4) < num)
                                {
-                                       (void)set_oppose_elec(dur, FALSE);
+                                       (void)set_oppose_elec(p_ptr, dur, FALSE);
                                        num--;
                                }
                                if (randint0(3) < num)
index 0cfcd69..1912245 100644 (file)
@@ -322,7 +322,7 @@ void dispel_player(void)
        (void)set_magicdef(p_ptr, 0, TRUE);
        (void)set_resist_magic(p_ptr, 0, TRUE);
        (void)set_oppose_acid(p_ptr, 0, TRUE);
-       (void)set_oppose_elec(0, TRUE);
+       (void)set_oppose_elec(p_ptr, 0, TRUE);
        (void)set_oppose_fire(0, TRUE);
        (void)set_oppose_cold(0, TRUE);
        (void)set_oppose_pois(0, TRUE);
@@ -2479,19 +2479,19 @@ bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
+bool set_oppose_elec(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->oppose_elec && !do_dec)
+               if (creature_ptr->oppose_elec && !do_dec)
                {
-                       if (p_ptr->oppose_elec > v) return FALSE;
+                       if (creature_ptr->oppose_elec > v) return FALSE;
                }
                else if (!IS_OPPOSE_ELEC())
                {
@@ -2503,7 +2503,7 @@ bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
+               if (creature_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
                {
                        msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
                        notice = TRUE;
@@ -2511,11 +2511,11 @@ bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->oppose_elec = v;
+       creature_ptr->oppose_elec = v;
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
        handle_stuff();
index 010bd5c..39de1f0 100644 (file)
@@ -50,7 +50,7 @@ extern bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v);
 extern bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v);
 extern bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-extern bool set_oppose_elec(TIME_EFFECT v, bool do_dec);
+extern bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_oppose_fire(TIME_EFFECT v, bool do_dec);
 extern bool set_oppose_cold(TIME_EFFECT v, bool do_dec);
 extern bool set_oppose_pois(TIME_EFFECT v, bool do_dec);
index b8b9ae6..e2ce53d 100644 (file)
@@ -293,7 +293,7 @@ concptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_oppose_elec(randint1(base) + base, FALSE);
+                               set_oppose_elec(p_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
index 1dd61d3..44fc70b 100644 (file)
@@ -136,7 +136,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_oppose_elec(randint1(base) + base, FALSE);
+                               set_oppose_elec(p_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -322,7 +322,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                set_oppose_acid(p_ptr, randint1(base) + base, FALSE);
-                               set_oppose_elec(randint1(base) + base, FALSE);
+                               set_oppose_elec(p_ptr, randint1(base) + base, FALSE);
                                set_oppose_fire(randint1(base) + base, FALSE);
                                set_oppose_cold(randint1(base) + base, FALSE);
                                set_oppose_pois(randint1(base) + base, FALSE);
index 9c95bb1..bd01ab9 100644 (file)
@@ -473,7 +473,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                TIME_EFFECT v = randint1(base) + base;
                                set_fast(p_ptr, v, FALSE);
                                set_oppose_acid(p_ptr, v, FALSE);
-                               set_oppose_elec(v, FALSE);
+                               set_oppose_elec(p_ptr, v, FALSE);
                                set_oppose_fire(v, FALSE);
                                set_oppose_cold(v, FALSE);
                                set_oppose_pois(v, FALSE);
index 16748b8..a5323f4 100644 (file)
@@ -163,7 +163,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        {
                                set_oppose_cold(randint1(base) + base, FALSE);
                                set_oppose_fire(randint1(base) + base, FALSE);
-                               set_oppose_elec(randint1(base) + base, FALSE);
+                               set_oppose_elec(p_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -362,7 +362,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                set_oppose_acid(p_ptr, randint1(base) + base, FALSE);
-                               set_oppose_elec(randint1(base) + base, FALSE);
+                               set_oppose_elec(p_ptr, randint1(base) + base, FALSE);
                                set_oppose_fire(randint1(base) + base, FALSE);
                                set_oppose_cold(randint1(base) + base, FALSE);
                                set_oppose_pois(randint1(base) + base, FALSE);