OSDN Git Service

[Refactor] #38997 calc_android_exp() に player_type * 引数を追加.
[hengband/hengband.git] / src / player-effects.c
index 765190c..e399170 100644 (file)
@@ -321,15 +321,15 @@ void dispel_player(void)
        (void)set_tim_eyeeye(p_ptr, 0, TRUE);
        (void)set_magicdef(p_ptr, 0, TRUE);
        (void)set_resist_magic(p_ptr, 0, TRUE);
-       (void)set_oppose_acid(0, TRUE);
-       (void)set_oppose_elec(0, TRUE);
-       (void)set_oppose_fire(0, TRUE);
-       (void)set_oppose_cold(0, TRUE);
-       (void)set_oppose_pois(0, TRUE);
+       (void)set_oppose_acid(p_ptr, 0, TRUE);
+       (void)set_oppose_elec(p_ptr, 0, TRUE);
+       (void)set_oppose_fire(p_ptr, 0, TRUE);
+       (void)set_oppose_cold(p_ptr, 0, TRUE);
+       (void)set_oppose_pois(p_ptr, 0, TRUE);
        (void)set_ultimate_res(0, TRUE);
        (void)set_mimic(p_ptr, 0, 0, TRUE);
        (void)set_ele_attack(p_ptr, 0, 0);
-       (void)set_ele_immune(0, 0);
+       (void)set_ele_immune(p_ptr, 0, 0);
 
        /* Cancel glowing hands */
        if (p_ptr->special_attack & ATTACK_CONFUSE)
@@ -389,7 +389,7 @@ bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec)
                if (creature_ptr->tim_mimic)
                {
                        msg_print(_("変身が解けた。", "You are no longer transformed."));
-                       if (creature_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
+                       if (creature_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(p_ptr, 0, TRUE);
                        creature_ptr->mimic_form=0;
                        notice = TRUE;
                        p = 0;
@@ -2368,44 +2368,44 @@ bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v)
  * @param v 継続時間
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
+bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v)
 {
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
        /* Clear all elemental attacks (only one is allowed at a time). */
-       if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
+       if ((creature_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
        {
-               p_ptr->special_defense &= ~(DEFENSE_ACID);
+               creature_ptr->special_defense &= ~(DEFENSE_ACID);
                msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
        }
-       if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
+       if ((creature_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
        {
-               p_ptr->special_defense &= ~(DEFENSE_ELEC);
+               creature_ptr->special_defense &= ~(DEFENSE_ELEC);
                msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
        }
-       if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
+       if ((creature_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
        {
-               p_ptr->special_defense &= ~(DEFENSE_FIRE);
+               creature_ptr->special_defense &= ~(DEFENSE_FIRE);
                msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
        }
-       if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
+       if ((creature_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
        {
-               p_ptr->special_defense &= ~(DEFENSE_COLD);
+               creature_ptr->special_defense &= ~(DEFENSE_COLD);
                msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
        }
-       if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
+       if ((creature_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
        {
-               p_ptr->special_defense &= ~(DEFENSE_POIS);
+               creature_ptr->special_defense &= ~(DEFENSE_POIS);
                msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
        }
 
        if ((v) && (immune_type))
        {
                /* Set attack type. */
-               p_ptr->special_defense |= (immune_type);
+               creature_ptr->special_defense |= (immune_type);
 
                /* Set duration. */
-               p_ptr->ele_immune = v;
+               creature_ptr->ele_immune = v;
 
                msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
                             ((immune_type == DEFENSE_ACID) ? _("酸", "acid!") :
@@ -2417,8 +2417,8 @@ bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
        }
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->redraw |= (PR_STATUS);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->redraw |= (PR_STATUS);
+       creature_ptr->update |= (PU_BONUS);
        handle_stuff();
 
        return (TRUE);
@@ -2430,19 +2430,19 @@ bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
+bool set_oppose_acid(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_acid && !do_dec)
+               if (creature_ptr->oppose_acid && !do_dec)
                {
-                       if (p_ptr->oppose_acid > v) return FALSE;
+                       if (creature_ptr->oppose_acid > v) return FALSE;
                }
                else if (!IS_OPPOSE_ACID())
                {
@@ -2454,7 +2454,7 @@ bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
+               if (creature_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
                {
                        msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
                        notice = TRUE;
@@ -2462,11 +2462,11 @@ bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->oppose_acid = v;
+       creature_ptr->oppose_acid = 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();
@@ -2479,19 +2479,19 @@ bool set_oppose_acid(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();
@@ -2528,20 +2528,20 @@ bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
+bool set_oppose_fire(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 ((PRACE_IS_(p_ptr, RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
+       if ((PRACE_IS_(creature_ptr, RACE_DEMON) && (creature_ptr->lev > 44)) || (creature_ptr->mimic_form == MIMIC_DEMON)) v = 1;
        /* Open */
        if (v)
        {
-               if (p_ptr->oppose_fire && !do_dec)
+               if (creature_ptr->oppose_fire && !do_dec)
                {
-                       if (p_ptr->oppose_fire > v) return FALSE;
+                       if (creature_ptr->oppose_fire > v) return FALSE;
                }
                else if (!IS_OPPOSE_FIRE())
                {
@@ -2553,7 +2553,7 @@ bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
+               if (creature_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
                {
                        msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
                        notice = TRUE;
@@ -2561,11 +2561,11 @@ bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->oppose_fire = v;
+       creature_ptr->oppose_fire = 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();
@@ -2578,19 +2578,19 @@ bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
+bool set_oppose_cold(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_cold && !do_dec)
+               if (creature_ptr->oppose_cold && !do_dec)
                {
-                       if (p_ptr->oppose_cold > v) return FALSE;
+                       if (creature_ptr->oppose_cold > v) return FALSE;
                }
                else if (!IS_OPPOSE_COLD())
                {
@@ -2602,7 +2602,7 @@ bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
+               if (creature_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
                {
                        msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
                        notice = TRUE;
@@ -2610,11 +2610,11 @@ bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->oppose_cold = v;
+       creature_ptr->oppose_cold = 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();
@@ -2627,20 +2627,20 @@ bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
+bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 {
        bool notice = FALSE;
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
-       if (p_ptr->is_dead) return FALSE;
+       if ((creature_ptr->pclass == CLASS_NINJA) && (creature_ptr->lev > 44)) v = 1;
+       if (creature_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
        {
-               if (p_ptr->oppose_pois && !do_dec)
+               if (creature_ptr->oppose_pois && !do_dec)
                {
-                       if (p_ptr->oppose_pois > v) return FALSE;
+                       if (creature_ptr->oppose_pois > v) return FALSE;
                }
                else if (!IS_OPPOSE_POIS())
                {
@@ -2652,7 +2652,7 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
+               if (creature_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
                {
                        msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
                        notice = TRUE;
@@ -2660,11 +2660,11 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->oppose_pois = v;
+       creature_ptr->oppose_pois = 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();
@@ -2678,29 +2678,29 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
  * @details
  * Note the special code to only notice "range" changes.
  */
-bool set_stun(TIME_EFFECT v)
+bool set_stun(player_type *creature_ptr, TIME_EFFECT v)
 {
        int old_aux, new_aux;
        bool notice = FALSE;
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (p_ptr->is_dead) return FALSE;
-       if (PRACE_IS_(p_ptr, RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
+       if (creature_ptr->is_dead) return FALSE;
+       if (PRACE_IS_(creature_ptr, RACE_GOLEM) || ((creature_ptr->pclass == CLASS_BERSERKER) && (creature_ptr->lev > 34))) v = 0;
 
        /* Knocked out */
-       if (p_ptr->stun > 100)
+       if (creature_ptr->stun > 100)
        {
                old_aux = 3;
        }
 
        /* Heavy stun */
-       else if (p_ptr->stun > 50)
+       else if (creature_ptr->stun > 50)
        {
                old_aux = 2;
        }
 
        /* Stun */
-       else if (p_ptr->stun > 0)
+       else if (creature_ptr->stun > 0)
        {
                old_aux = 1;
        }
@@ -2757,31 +2757,31 @@ bool set_stun(TIME_EFFECT v)
 
                        if (one_in_(3))
                        {
-                               if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
-                               if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
+                               if (!creature_ptr->sustain_int) (void)do_dec_stat(creature_ptr, A_INT);
+                               if (!creature_ptr->sustain_wis) (void)do_dec_stat(creature_ptr, A_WIS);
                        }
                        else if (one_in_(2))
                        {
-                               if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
+                               if (!creature_ptr->sustain_int) (void)do_dec_stat(creature_ptr, A_INT);
                        }
                        else
                        {
-                               if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
+                               if (!creature_ptr->sustain_wis) (void)do_dec_stat(creature_ptr, A_WIS);
                        }
                }
-               if (p_ptr->special_defense & KATA_MASK)
+               if (creature_ptr->special_defense & KATA_MASK)
                {
                        msg_print(_("型が崩れた。", "Your posture gets loose."));
-                       p_ptr->special_defense &= ~(KATA_MASK);
-                       p_ptr->update |= (PU_BONUS);
-                       p_ptr->update |= (PU_MONSTERS);
-                       p_ptr->redraw |= (PR_STATE);
-                       p_ptr->redraw |= (PR_STATUS);
-                       p_ptr->action = ACTION_NONE;
+                       creature_ptr->special_defense &= ~(KATA_MASK);
+                       creature_ptr->update |= (PU_BONUS);
+                       creature_ptr->update |= (PU_MONSTERS);
+                       creature_ptr->redraw |= (PR_STATE);
+                       creature_ptr->redraw |= (PR_STATUS);
+                       creature_ptr->action = ACTION_NONE;
                }
 
                /* Sniper */
-               if (p_ptr->concent) reset_concentration(TRUE);
+               if (creature_ptr->concent) reset_concentration(TRUE);
 
                /* Hex */
                if (hex_spelling_any()) stop_hex_spell_all();
@@ -2807,16 +2807,16 @@ bool set_stun(TIME_EFFECT v)
        }
 
        /* Use the value */
-       p_ptr->stun = v;
+       creature_ptr->stun = v;
 
        /* No change */
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
 
        /* Redraw the "stun" */
-       p_ptr->redraw |= (PR_STUN);
+       creature_ptr->redraw |= (PR_STUN);
        handle_stuff();
        return (TRUE);
 }
@@ -2829,59 +2829,59 @@ bool set_stun(TIME_EFFECT v)
  * @details
  * Note the special code to only notice "range" changes.
  */
-bool set_cut(TIME_EFFECT v)
+bool set_cut(player_type *creature_ptr, TIME_EFFECT v)
 {
        int old_aux, new_aux;
        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->prace == RACE_GOLEM ||
-           p_ptr->prace == RACE_SKELETON ||
-           p_ptr->prace == RACE_SPECTRE ||
-               (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
-           !p_ptr->mimic_form)
+       if ((creature_ptr->prace == RACE_GOLEM ||
+           creature_ptr->prace == RACE_SKELETON ||
+           creature_ptr->prace == RACE_SPECTRE ||
+               (creature_ptr->prace == RACE_ZOMBIE && creature_ptr->lev > 11)) &&
+           !creature_ptr->mimic_form)
                v = 0;
 
        /* Mortal wound */
-       if (p_ptr->cut > 1000)
+       if (creature_ptr->cut > 1000)
        {
                old_aux = 7;
        }
 
        /* Deep gash */
-       else if (p_ptr->cut > 200)
+       else if (creature_ptr->cut > 200)
        {
                old_aux = 6;
        }
 
        /* Severe cut */
-       else if (p_ptr->cut > 100)
+       else if (creature_ptr->cut > 100)
        {
                old_aux = 5;
        }
 
        /* Nasty cut */
-       else if (p_ptr->cut > 50)
+       else if (creature_ptr->cut > 50)
        {
                old_aux = 4;
        }
 
        /* Bad cut */
-       else if (p_ptr->cut > 25)
+       else if (creature_ptr->cut > 25)
        {
                old_aux = 3;
        }
 
        /* Light cut */
-       else if (p_ptr->cut > 10)
+       else if (creature_ptr->cut > 10)
        {
                old_aux = 2;
        }
 
        /* Graze */
-       else if (p_ptr->cut > 0)
+       else if (creature_ptr->cut > 0)
        {
                old_aux = 1;
        }
@@ -2972,10 +2972,10 @@ bool set_cut(TIME_EFFECT v)
 
                if (randint1(1000) < v || one_in_(16))
                {
-                       if (!p_ptr->sustain_chr)
+                       if (!creature_ptr->sustain_chr)
                        {
                                msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
-                               do_dec_stat(p_ptr, A_CHR);
+                               do_dec_stat(creature_ptr, A_CHR);
                        }
                }
        }
@@ -2988,7 +2988,7 @@ bool set_cut(TIME_EFFECT v)
                {
                        /* None */
                        case 0:
-                       msg_format(_("やっと%s。", "You are no longer bleeding."), p_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
+                       msg_format(_("やっと%s。", "You are no longer bleeding."), creature_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
 
                        if (disturb_state) disturb(FALSE, FALSE);
                        break;
@@ -2998,16 +2998,16 @@ bool set_cut(TIME_EFFECT v)
        }
 
        /* Use the value */
-       p_ptr->cut = v;
+       creature_ptr->cut = v;
 
        /* No change */
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
 
        /* Redraw the "cut" */
-       p_ptr->redraw |= (PR_CUT);
+       creature_ptr->redraw |= (PR_CUT);
        handle_stuff();
        return (TRUE);
 }
@@ -3038,7 +3038,7 @@ bool set_cut(TIME_EFFECT v)
  * game turns, or 500/(100/5) = 25 player turns (if nothing else is
  * affecting the player speed).\n
  */
-bool set_food(TIME_EFFECT v)
+bool set_food(player_type *creature_ptr, TIME_EFFECT v)
 {
        int old_aux, new_aux;
 
@@ -3046,31 +3046,31 @@ bool set_food(TIME_EFFECT v)
        v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
 
        /* Fainting / Starving */
-       if (p_ptr->food < PY_FOOD_FAINT)
+       if (creature_ptr->food < PY_FOOD_FAINT)
        {
                old_aux = 0;
        }
 
        /* Weak */
-       else if (p_ptr->food < PY_FOOD_WEAK)
+       else if (creature_ptr->food < PY_FOOD_WEAK)
        {
                old_aux = 1;
        }
 
        /* Hungry */
-       else if (p_ptr->food < PY_FOOD_ALERT)
+       else if (creature_ptr->food < PY_FOOD_ALERT)
        {
                old_aux = 2;
        }
 
        /* Normal */
-       else if (p_ptr->food < PY_FOOD_FULL)
+       else if (creature_ptr->food < PY_FOOD_FULL)
        {
                old_aux = 3;
        }
 
        /* Full */
-       else if (p_ptr->food < PY_FOOD_MAX)
+       else if (creature_ptr->food < PY_FOOD_MAX)
        {
                old_aux = 4;
        }
@@ -3180,7 +3180,7 @@ bool set_food(TIME_EFFECT v)
                        case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
                }
 
-               if (p_ptr->wild_mode && (new_aux < 2))
+               if (creature_ptr->wild_mode && (new_aux < 2))
                {
                        change_wild_mode(FALSE);
                }
@@ -3190,16 +3190,16 @@ bool set_food(TIME_EFFECT v)
        }
 
        /* Use the value */
-       p_ptr->food = v;
+       creature_ptr->food = v;
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
 
        /* Redraw hunger */
-       p_ptr->redraw |= (PR_HUNGER);
+       creature_ptr->redraw |= (PR_HUNGER);
        handle_stuff();
        return (TRUE);
 }
@@ -3570,15 +3570,15 @@ bool do_res_stat(player_type *creature_ptr, int stat)
 /*
  * Gain a "point" in a stat
  */
-bool do_inc_stat(int stat)
+bool do_inc_stat(player_type *creature_ptr, int stat)
 {
        bool res;
 
        /* Restore strength */
-       res = res_stat(p_ptr, stat);
+       res = res_stat(creature_ptr, stat);
 
        /* Attempt to increase */
-       if (inc_stat(p_ptr, stat))
+       if (inc_stat(creature_ptr, stat))
        {
                if (stat == A_WIS)
                {
@@ -3614,15 +3614,15 @@ bool do_inc_stat(int stat)
 /*
  * Restores any drained experience
  */
-bool restore_level(void)
+bool restore_level(player_type *creature_ptr)
 {
        /* Restore experience */
-       if (p_ptr->exp < p_ptr->max_exp)
+       if (creature_ptr->exp < creature_ptr->max_exp)
        {
                msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
 
                /* Restore the experience */
-               p_ptr->exp = p_ptr->max_exp;
+               creature_ptr->exp = creature_ptr->max_exp;
 
                /* Check the experience */
                check_experience();
@@ -3638,7 +3638,7 @@ bool restore_level(void)
 /*
  * Forget everything
  */
-bool lose_all_info(void)
+bool lose_all_info(player_type *creature_ptr)
 {
        int i;
 
@@ -3648,7 +3648,7 @@ bool lose_all_info(void)
        /* Forget info about objects */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Allow "protection" by the MENTAL flag */
@@ -3666,10 +3666,10 @@ bool lose_all_info(void)
                /* Hack -- Clear the "felt" flag */
                o_ptr->ident &= ~(IDENT_SENSE);
        }
-       p_ptr->update |= (PU_BONUS);
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
+       creature_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_COMBINE | PU_REORDER);
 
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        /* Mega-Hack -- Forget the map */
        wiz_dark();
@@ -3695,11 +3695,11 @@ void do_poly_wounds(void)
        {
                msg_print(_("新たな傷ができた!", "A new wound was created!"));
                take_hit(DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
-               set_cut(change);
+               set_cut(p_ptr,change);
        }
        else
        {
-               set_cut(p_ptr->cut - (change / 2));
+               set_cut(p_ptr,p_ptr->cut - (change / 2));
        }
 }
 
@@ -3936,17 +3936,17 @@ void gain_exp(s32b amount)
 }
 
 
-void calc_android_exp(void)
+void calc_android_exp(player_type *creature_ptr)
 {
        int i;
        u32b total_exp = 0;
-       if (p_ptr->is_dead) return;
+       if (creature_ptr->is_dead) return;
 
-       if (p_ptr->prace != RACE_ANDROID) return;
+       if (creature_ptr->prace != RACE_ANDROID) return;
 
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
                object_type forge;
                object_type *q_ptr = &forge;
                u32b value, exp;
@@ -3995,7 +3995,7 @@ void calc_android_exp(void)
                value = object_value_real(q_ptr);
 
                if (value <= 0) continue;
-               if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
+               if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (creature_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
                if (value > 5000000L) value = 5000000L;
                if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
 
@@ -4024,7 +4024,7 @@ void calc_android_exp(void)
                else total_exp += exp / 16;
                if (i == INVEN_BODY) total_exp += exp / 32;
        }
-       p_ptr->exp = p_ptr->max_exp = total_exp;
+       creature_ptr->exp = creature_ptr->max_exp = total_exp;
 
        /* Check Experience */
        check_experience();
@@ -4307,13 +4307,13 @@ bool choose_ele_immune(TIME_EFFECT immune_turn)
        choice = inkey();
 
        if ((choice == 'a') || (choice == 'A')) 
-               set_ele_immune(DEFENSE_FIRE, immune_turn);
+               set_ele_immune(p_ptr, DEFENSE_FIRE, immune_turn);
        else if ((choice == 'b') || (choice == 'B'))
-               set_ele_immune(DEFENSE_COLD, immune_turn);
+               set_ele_immune(p_ptr, DEFENSE_COLD, immune_turn);
        else if ((choice == 'c') || (choice == 'C'))
-               set_ele_immune(DEFENSE_ACID, immune_turn);
+               set_ele_immune(p_ptr, DEFENSE_ACID, immune_turn);
        else if ((choice == 'd') || (choice == 'D'))
-               set_ele_immune(DEFENSE_ELEC, immune_turn);
+               set_ele_immune(p_ptr, DEFENSE_ELEC, immune_turn);
        else
        {
                msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immune."));