OSDN Git Service

[Refactor] #38997 drain_exp() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Fri, 28 Jun 2019 15:55:00 +0000 (00:55 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 28 Jun 2019 15:55:00 +0000 (00:55 +0900)
src/melee1.c
src/player-effects.c
src/player-effects.h
src/spells1.c

index 1dfa8ef..abb5b0e 100644 (file)
@@ -3396,7 +3396,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
                                        if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
 
-                                       (void)drain_exp(d, d / 10, 95);
+                                       (void)drain_exp(p_ptr, d, d / 10, 95);
                                        break;
                                }
 
@@ -3410,7 +3410,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
                                        if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
 
-                                       (void)drain_exp(d, d / 10, 90);
+                                       (void)drain_exp(p_ptr, d, d / 10, 90);
                                        break;
                                }
 
@@ -3424,7 +3424,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
                                        if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
 
-                                       (void)drain_exp(d, d / 10, 75);
+                                       (void)drain_exp(p_ptr, d, d / 10, 75);
                                        break;
                                }
 
@@ -3438,7 +3438,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
                                        if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
 
-                                       (void)drain_exp(d, d / 10, 50);
+                                       (void)drain_exp(p_ptr, d, d / 10, 50);
                                        break;
                                }
 
@@ -3546,7 +3546,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
                                        if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
 
-                                       resist_drain = !drain_exp(d, d / 10, 50);
+                                       resist_drain = !drain_exp(p_ptr, d, d / 10, 50);
 
                                        /* Heal the attacker? */
                                        if (p_ptr->mimic_form)
index 9d89bab..c21f5b0 100644 (file)
@@ -4053,12 +4053,12 @@ void lose_exp(s32b amount)
  * Drain experience
  * If resisted to draining, return FALSE
  */
-bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
+bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_prob)
 {
        /* Androids and their mimics are never drained */
-       if (p_ptr->prace == RACE_ANDROID) return FALSE;
+       if (creature_ptr->prace == RACE_ANDROID) return FALSE;
 
-       if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
+       if (creature_ptr->hold_exp && (randint0(100) < hold_exp_prob))
        {
                /* Hold experience */
                msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
@@ -4066,7 +4066,7 @@ bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
        }
 
        /* Hold experience failed */
-       if (p_ptr->hold_exp)
+       if (creature_ptr->hold_exp)
        {
                msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
                lose_exp(slip);
index af3cd30..39fe744 100644 (file)
@@ -70,7 +70,7 @@ extern void gain_exp_64(s32b amount, u32b amount_frac);
 extern void gain_exp(s32b amount);
 extern void calc_android_exp(player_type *creature_ptr);
 extern void lose_exp(s32b amount);
-extern bool drain_exp(s32b drain, s32b slip, int hold_exp_prob);
+extern bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_prob);
 extern void do_poly_self(player_type *creature_ptr);
 extern bool set_ultimate_res(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
index 26543e0..273d711 100644 (file)
@@ -4278,7 +4278,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                                        dam *= 6; dam /= (randint1(4) + 7);
                                }
                        }
-                       else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
+                       else if (!CHECK_MULTISHADOW()) drain_exp(p_ptr, 200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
 
                        if (PRACE_IS_(p_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW())
                        {
@@ -4347,7 +4347,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                                }
                                if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
                                {
-                                       drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
+                                       drain_exp(p_ptr, 5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
                                }
 
                                if (!p_ptr->resist_chaos || one_in_(9))