OSDN Git Service

[Refactor] #38997 cure_critical_wounds() に player_type * 引数を追加. / Add player_type...
[hengband/hengband.git] / src / spells-status.c
index 68b929a..8bdcf6f 100644 (file)
@@ -123,7 +123,7 @@ bool poly_monster(DIRECTION dir, int power)
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
        bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
        if (tester)
-               chg_virtue(V_CHANCE, 1);
+               chg_virtue(p_ptr, V_CHANCE, 1);
        return(tester);
 }
 
@@ -169,11 +169,11 @@ void stop_singing(player_type *creature_ptr)
        /* The player is singing? */
        if (!SINGING_SONG_EFFECT(creature_ptr)) return;
 
-       /* Hack -- if called from set_action(), avoid recursive loop */
-       if (creature_ptr->action == ACTION_SING) set_action(ACTION_NONE);
+       /* Hack -- if called from set_action(p_ptr), avoid recursive loop */
+       if (creature_ptr->action == ACTION_SING) set_action(p_ptr, ACTION_NONE);
 
        /* Message text of each song or etc. */
-       do_spell(REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
+       exe_spell(p_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
 
        SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
        SINGING_SONG_ID(creature_ptr) = 0;
@@ -265,127 +265,127 @@ void roll_hitdice(player_type *creature_ptr, SPOP_FLAGS options)
        }
 }
 
-bool_hack life_stream(bool_hack message, bool_hack virtue_change)
+bool_hack life_stream(player_type *creature_ptr, bool_hack message, bool_hack virtue_change)
 {
        if (virtue_change)
        {
-               chg_virtue(V_VITALITY, 1);
-               chg_virtue(V_UNLIFE, -5);
+               chg_virtue(creature_ptr, V_VITALITY, 1);
+               chg_virtue(creature_ptr, V_UNLIFE, -5);
        }
        if (message)
        {
                msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
        }
-       restore_level();
-       (void)set_poisoned(p_ptr, 0);
-       (void)set_blind(p_ptr, 0);
-       (void)set_confused(p_ptr, 0);
-       (void)set_image(p_ptr, 0);
-       (void)set_stun(p_ptr, 0);
-       (void)set_cut(0);
+       restore_level(creature_ptr);
+       (void)set_poisoned(creature_ptr, 0);
+       (void)set_blind(creature_ptr, 0);
+       (void)set_confused(creature_ptr, 0);
+       (void)set_image(creature_ptr, 0);
+       (void)set_stun(creature_ptr, 0);
+       (void)set_cut(creature_ptr,0);
        (void)restore_all_status();
-       (void)set_shero(p_ptr, 0, TRUE);
+       (void)set_shero(creature_ptr, 0, TRUE);
        handle_stuff();
-       hp_player(p_ptr, 5000);
+       hp_player(creature_ptr, 5000);
 
        return TRUE;
 }
 
-bool_hack heroism(int base)
+bool_hack heroism(player_type *creature_ptr, int base)
 {
        bool_hack ident = FALSE;
-       if (set_afraid(p_ptr, 0)) ident = TRUE;
-       if (set_hero(p_ptr, p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
-       if (hp_player(p_ptr, 10)) ident = TRUE;
+       if (set_afraid(creature_ptr, 0)) ident = TRUE;
+       if (set_hero(creature_ptr, creature_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
+       if (hp_player(creature_ptr, 10)) ident = TRUE;
        return ident;
 }
 
-bool_hack berserk(int base)
+bool_hack berserk(player_type *creature_ptr, int base)
 {
        bool_hack ident = FALSE;
-       if (set_afraid(p_ptr, 0)) ident = TRUE;
-       if (set_shero(p_ptr, p_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
-       if (hp_player(p_ptr, 30)) ident = TRUE;
+       if (set_afraid(creature_ptr, 0)) ident = TRUE;
+       if (set_shero(creature_ptr, creature_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
+       if (hp_player(creature_ptr, 30)) ident = TRUE;
        return ident;
 }
 
-bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
+bool_hack cure_light_wounds(player_type *creature_ptr, DICE_NUMBER dice, DICE_SID sides)
 {
        bool_hack ident = FALSE;
-       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(p_ptr, 0, TRUE)) ident = TRUE;
+       if (hp_player(creature_ptr, damroll(dice, sides))) ident = TRUE;
+       if (set_blind(creature_ptr, 0)) ident = TRUE;
+       if (set_cut(creature_ptr,creature_ptr->cut - 10)) ident = TRUE;
+       if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
-bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
+bool_hack cure_serious_wounds(player_type *creature_ptr, DICE_NUMBER dice, DICE_SID sides)
 {
        bool_hack ident = FALSE;
-       if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
-       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(p_ptr, 0, TRUE)) ident = TRUE;
+       if (hp_player(creature_ptr, damroll(dice, sides))) ident = TRUE;
+       if (set_blind(creature_ptr, 0)) ident = TRUE;
+       if (set_confused(creature_ptr, 0)) ident = TRUE;
+       if (set_cut(creature_ptr,(creature_ptr->cut / 2) - 50)) ident = TRUE;
+       if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
-bool_hack cure_critical_wounds(HIT_POINT pow)
+bool_hack cure_critical_wounds(player_type *creature_ptr, HIT_POINT pow)
 {
        bool_hack ident = FALSE;
-       if (hp_player(p_ptr, pow)) ident = TRUE;
-       if (set_blind(p_ptr, 0)) ident = TRUE;
-       if (set_confused(p_ptr, 0)) ident = TRUE;
-       if (set_poisoned(p_ptr, 0)) ident = TRUE;
-       if (set_stun(p_ptr, 0)) ident = TRUE;
-       if (set_cut(0)) ident = TRUE;
-       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
+       if (hp_player(creature_ptr, pow)) ident = TRUE;
+       if (set_blind(creature_ptr, 0)) ident = TRUE;
+       if (set_confused(creature_ptr, 0)) ident = TRUE;
+       if (set_poisoned(creature_ptr, 0)) ident = TRUE;
+       if (set_stun(creature_ptr, 0)) ident = TRUE;
+       if (set_cut(creature_ptr,0)) ident = TRUE;
+       if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
        return ident;
 }
 
-bool_hack true_healing(HIT_POINT pow)
+bool_hack true_healing(player_type *creature_ptr, HIT_POINT pow)
 {
        bool_hack ident = FALSE;
-       if (hp_player(p_ptr, pow)) ident = TRUE;
-       if (set_blind(p_ptr, 0)) ident = TRUE;
-       if (set_confused(p_ptr, 0)) ident = TRUE;
-       if (set_poisoned(p_ptr, 0)) ident = TRUE;
-       if (set_stun(p_ptr, 0)) ident = TRUE;
-       if (set_cut(0)) ident = TRUE;
-       if (set_image(p_ptr, 0)) ident = TRUE;
+       if (hp_player(creature_ptr, pow)) ident = TRUE;
+       if (set_blind(creature_ptr, 0)) ident = TRUE;
+       if (set_confused(creature_ptr, 0)) ident = TRUE;
+       if (set_poisoned(creature_ptr, 0)) ident = TRUE;
+       if (set_stun(creature_ptr, 0)) ident = TRUE;
+       if (set_cut(creature_ptr,0)) ident = TRUE;
+       if (set_image(creature_ptr, 0)) ident = TRUE;
        return ident;
 }
 
-bool_hack restore_mana(bool_hack magic_eater)
+bool_hack restore_mana(player_type *creature_ptr, bool_hack magic_eater)
 {
        bool_hack ident = FALSE;
 
-       if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
+       if (creature_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
        {
                int i;
                for (i = 0; i < EATER_EXT * 2; i++)
                {
-                       p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
-                       if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
+                       creature_ptr->magic_num1[i] += (creature_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : creature_ptr->magic_num2[i] * EATER_CHARGE / 3;
+                       if (creature_ptr->magic_num1[i] > creature_ptr->magic_num2[i] * EATER_CHARGE) creature_ptr->magic_num1[i] = creature_ptr->magic_num2[i] * EATER_CHARGE;
                }
                for (; i < EATER_EXT * 3; i++)
                {
                        KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
-                       p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
-                       if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
+                       creature_ptr->magic_num1[i] -= ((creature_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : creature_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
+                       if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
                }
                msg_print(_("頭がハッキリとした。", "You feel your head clear."));
-               p_ptr->window |= (PW_PLAYER);
+               creature_ptr->window |= (PW_PLAYER);
                ident = TRUE;
        }
-       else if (p_ptr->csp < p_ptr->msp)
+       else if (creature_ptr->csp < creature_ptr->msp)
        {
-               p_ptr->csp = p_ptr->msp;
-               p_ptr->csp_frac = 0;
+               creature_ptr->csp = creature_ptr->msp;
+               creature_ptr->csp_frac = 0;
                msg_print(_("頭がハッキリとした。", "You feel your head clear."));
-               p_ptr->redraw |= (PR_MANA);
-               p_ptr->window |= (PW_PLAYER);
-               p_ptr->window |= (PW_SPELL);
+               creature_ptr->redraw |= (PR_MANA);
+               creature_ptr->window |= (PW_PLAYER);
+               creature_ptr->window |= (PW_SPELL);
                ident = TRUE;
        }
 
@@ -426,7 +426,7 @@ bool fishing(player_type *creature_ptr)
                free_turn(creature_ptr);
                return FALSE;
        }
-       set_action(ACTION_FISH);
+       set_action(p_ptr, ACTION_FISH);
        creature_ptr->redraw |= (PR_STATE);
        return TRUE;
 }
@@ -461,7 +461,7 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
        t = 20 + randint1(20);
        (void)set_blind(p_ptr, creature_ptr->blind + t);
        (void)set_afraid(p_ptr, 0);
-       (void)set_tim_esp(creature_ptr->tim_esp + t, FALSE);
+       (void)set_tim_esp(p_ptr, creature_ptr->tim_esp + t, FALSE);
        (void)set_tim_regen(p_ptr, creature_ptr->tim_regen + t, FALSE);
        (void)set_hero(p_ptr, creature_ptr->hero + t, FALSE);
        (void)set_blessed(p_ptr, creature_ptr->blessed + t, FALSE);
@@ -518,7 +518,7 @@ void apply_nexus(monster_type *m_ptr)
                }
 
                msg_print(_("体がねじれ始めた...", "Your body starts to scramble..."));
-               status_shuffle();
+               status_shuffle(p_ptr);
                break;
        }
        }
@@ -528,7 +528,7 @@ void apply_nexus(monster_type *m_ptr)
  * @brief プレイヤーのステータスシャッフル処理
  * @return なし
  */
-void status_shuffle(void)
+void status_shuffle(player_type *creature_ptr)
 {
        BASE_STATUS max1, cur1, max2, cur2;
        int ii, jj, i;
@@ -537,21 +537,21 @@ void status_shuffle(void)
        ii = randint0(A_MAX);
        for (jj = ii; jj == ii; jj = randint0(A_MAX)) /* loop */;
 
-       max1 = p_ptr->stat_max[ii];
-       cur1 = p_ptr->stat_cur[ii];
-       max2 = p_ptr->stat_max[jj];
-       cur2 = p_ptr->stat_cur[jj];
+       max1 = creature_ptr->stat_max[ii];
+       cur1 = creature_ptr->stat_cur[ii];
+       max2 = creature_ptr->stat_max[jj];
+       cur2 = creature_ptr->stat_cur[jj];
 
-       p_ptr->stat_max[ii] = max2;
-       p_ptr->stat_cur[ii] = cur2;
-       p_ptr->stat_max[jj] = max1;
-       p_ptr->stat_cur[jj] = cur1;
+       creature_ptr->stat_max[ii] = max2;
+       creature_ptr->stat_cur[ii] = cur2;
+       creature_ptr->stat_max[jj] = max1;
+       creature_ptr->stat_cur[jj] = cur1;
 
        for (i = 0; i < A_MAX; i++)
        {
-               if (p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
-               if (p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
+               if (creature_ptr->stat_max[i] > creature_ptr->stat_max_max[i]) creature_ptr->stat_max[i] = creature_ptr->stat_max_max[i];
+               if (creature_ptr->stat_cur[i] > creature_ptr->stat_max_max[i]) creature_ptr->stat_cur[i] = creature_ptr->stat_max_max[i];
        }
 
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
 }