OSDN Git Service

[Refactor] #38997 hp_player() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Thu, 20 Jun 2019 14:40:13 +0000 (23:40 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 20 Jun 2019 14:40:13 +0000 (23:40 +0900)
16 files changed:
src/cmd-activate.c
src/cmd-eat.c
src/cmd-mane.c
src/core.c
src/melee1.c
src/mind.c
src/mspells3.c
src/player-effects.c
src/player-effects.h
src/realm-crusade.c
src/realm-death.c
src/realm-nature.c
src/realm-song.c
src/spells-status.c
src/spells1.c
src/spells2.c

index 0d85ee6..6f4a750 100644 (file)
@@ -881,7 +881,7 @@ bool activate_artifact(object_type *o_ptr)
                for (dummy = 0; dummy < 3; dummy++)
                {
                        if (hypodynamic_bolt(dir, 50))
-                               hp_player(50);
+                               hp_player(p_ptr, 50);
                }
                break;
        }
@@ -906,7 +906,7 @@ bool activate_artifact(object_type *o_ptr)
                for (dummy = 0; dummy < 3; dummy++)
                {
                        if (hypodynamic_bolt(dir, 100))
-                               hp_player(100);
+                               hp_player(p_ptr, 100);
                }
                break;
        }
@@ -1036,7 +1036,7 @@ bool activate_artifact(object_type *o_ptr)
                msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
                (void)set_afraid(0);
                (void)set_hero(randint1(50) + 50, FALSE);
-               (void)hp_player(10);
+               (void)hp_player(p_ptr, 10);
                (void)set_blessed(randint1(50) + 50, FALSE);
                (void)set_oppose_acid(randint1(50) + 50, FALSE);
                (void)set_oppose_elec(randint1(50) + 50, FALSE);
@@ -1246,7 +1246,7 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_CURE_LW:
        {
                (void)set_afraid(0);
-               (void)hp_player(30);
+               (void)hp_player(p_ptr, 30);
                break;
        }
 
@@ -1686,7 +1686,7 @@ bool activate_artifact(object_type *o_ptr)
                TIME_EFFECT v = randint1(25) + 25;
                (void)set_afraid(0);
                (void)set_hero(v, FALSE);
-               (void)hp_player(10);
+               (void)hp_player(p_ptr, 10);
                (void)set_blessed(v, FALSE);
                (void)set_oppose_acid(v, FALSE);
                (void)set_oppose_elec(v, FALSE);
index 03b9f52..0eb1bb8 100644 (file)
@@ -281,7 +281,7 @@ void exe_eat_food(INVENTORY_IDX item)
                {
                        msg_print(_("これはひじょうに美味だ。", "That tastes good."));
                        (void)set_poisoned(0);
-                       (void)hp_player(damroll(4, 8));
+                       (void)hp_player(p_ptr, damroll(4, 8));
                        ident = TRUE;
                        break;
                }
index 0d8c004..3e5075b 100644 (file)
@@ -657,7 +657,7 @@ static bool use_mane(int spell)
        }
        case MS_HEAL:
                msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
-               (void)hp_player(plev*6);
+               (void)hp_player(p_ptr, plev*6);
                (void)set_stun(0);
                (void)set_cut(0);
                break;
index 4744268..1bd68ee 100644 (file)
@@ -2333,7 +2333,7 @@ static void process_world_aux_mutation(void)
                /* Absorb light from the current possition */
                if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
                {
-                       hp_player(10);
+                       hp_player(p_ptr, 10);
                }
 
                o_ptr = &p_ptr->inventory_list[INVEN_LITE];
@@ -2345,7 +2345,7 @@ static void process_world_aux_mutation(void)
                        if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
                        {
                                /* Heal the player a bit */
-                               hp_player(o_ptr->xtra4 / 20);
+                               hp_player(p_ptr, o_ptr->xtra4 / 20);
 
                                /* Decrease life-span of lite */
                                o_ptr->xtra4 /= 2;
@@ -2531,7 +2531,7 @@ static void process_world_aux_mutation(void)
                        HIT_POINT healing = p_ptr->csp;
                        if (healing > wounds) healing = wounds;
 
-                       hp_player(healing);
+                       hp_player(p_ptr, healing);
                        p_ptr->csp -= healing;
                        p_ptr->redraw |= (PR_HP | PR_MANA);
                }
index fa912a3..b56ca90 100644 (file)
@@ -1910,7 +1910,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
 
                                                        drain_heal = (drain_heal * p_ptr->mutant_regenerate_mod) / 100;
 
-                                                       hp_player(drain_heal);
+                                                       hp_player(p_ptr, drain_heal);
                                                        /* We get to keep some of it! */
                                                }
                                        }
index be0ff79..02070b7 100644 (file)
@@ -1140,7 +1140,7 @@ static bool cast_mindcrafter_spell(int spell)
                 */
                if (!IS_FAST() || !IS_HERO())
                {
-                       hp_player(plev);
+                       hp_player(p_ptr, plev);
                }
 
                t = 10 + randint1((plev * 3) / 2);
index 861afb7..28c6ae1 100644 (file)
@@ -1280,7 +1280,7 @@ static bool cast_learned_spell(int spell, bool success)
        }
        case MS_HEAL:
         msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
-               (void)hp_player(plev*4);
+               (void)hp_player(p_ptr, plev*4);
                (void)set_stun(0);
                (void)set_cut(0);
                break;
index 98dba22..b64b498 100644 (file)
@@ -3419,7 +3419,7 @@ bool res_stat(player_type *creature_ptr, int stat)
 /*
  * Increase players hit points, notice effects
  */
-bool hp_player(int num)
+bool hp_player(player_type *creature_ptr, int num)
 {
        int vir;
        vir = virtue_number(V_VITALITY);
@@ -3428,26 +3428,26 @@ bool hp_player(int num)
 
        if(vir)
        {
-               num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
+               num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250;
        }
        /* Healing needed */
-       if (p_ptr->chp < p_ptr->mhp)
+       if (creature_ptr->chp < creature_ptr->mhp)
        {
-               if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
+               if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp/3)))
                        chg_virtue(V_TEMPERANCE, 1);
                /* Gain hitpoints */
-               p_ptr->chp += num;
+               creature_ptr->chp += num;
 
                /* Enforce maximum */
-               if (p_ptr->chp >= p_ptr->mhp)
+               if (creature_ptr->chp >= creature_ptr->mhp)
                {
-                       p_ptr->chp = p_ptr->mhp;
-                       p_ptr->chp_frac = 0;
+                       creature_ptr->chp = creature_ptr->mhp;
+                       creature_ptr->chp_frac = 0;
                }
 
-               p_ptr->redraw |= (PR_HP);
+               creature_ptr->redraw |= (PR_HP);
 
-               p_ptr->window |= (PW_PLAYER);
+               creature_ptr->window |= (PW_PLAYER);
 
                /* Heal 0-4 */
                if (num < 5)
@@ -3691,7 +3691,7 @@ void do_poly_wounds(void)
        if (!(wounds || hit_p || Nasty_effect)) return;
 
        msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
-       hp_player(change);
+       hp_player(p_ptr, change);
        if (Nasty_effect)
        {
                msg_print(_("新たな傷ができた!", "A new wound was created!"));
index 2610a26..ea543f9 100644 (file)
@@ -60,7 +60,7 @@ extern bool set_food(TIME_EFFECT v);
 extern bool inc_stat(player_type *creature_ptr, int stat);
 extern bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
 extern bool res_stat(player_type *creature_ptr, int stat);
-extern bool hp_player(int num);
+extern bool hp_player(player_type *creature_ptr, int num);
 extern bool do_dec_stat(player_type *creature_ptr, int stat);
 extern bool do_res_stat(player_type *creature_ptr, int stat);
 extern bool do_inc_stat(int stat);
index 6fba76d..77ce142 100644 (file)
@@ -266,7 +266,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                dispel_evil(randint1(dam_sides));
-                               hp_player(heal);
+                               hp_player(p_ptr, heal);
                                set_afraid(0);
                                set_poisoned(0);
                                set_stun(0);
@@ -531,7 +531,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                confuse_monsters(power);
                                turn_monsters(power);
                                stasis_monsters(power);
-                               hp_player(heal);
+                               hp_player(p_ptr, heal);
                        }
                }
                break;
index 3cbf10b..a29d060 100644 (file)
@@ -313,7 +313,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                        chg_virtue(V_SACRIFICE, -1);
                                        chg_virtue(V_VITALITY, -1);
 
-                                       hp_player(dam);
+                                       hp_player(p_ptr, dam);
 
                                        /*
                                        * Gain nutritional sustenance:
@@ -469,7 +469,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                for (i = 0; i < 3; i++)
                                {
                                        if (hypodynamic_bolt(dir, dam))
-                                               hp_player(dam);
+                                               hp_player(p_ptr, dam);
                                }
                        }
                }
index 0fa2e46..95bd6d3 100644 (file)
@@ -180,7 +180,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               hp_player(damroll(dice, sides));
+                               hp_player(p_ptr, damroll(dice, sides));
                                set_cut(0);
                                set_poisoned(0);
                        }
index 3366502..6452312 100644 (file)
@@ -172,7 +172,7 @@ concptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cont)
                        {
-                               hp_player(damroll(dice, sides));
+                               hp_player(p_ptr, damroll(dice, sides));
                        }
                }
 
@@ -237,7 +237,7 @@ concptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        msg_print(_("激しい戦いの歌を歌った...", "You start singing a song of intense fighting..."));
 
-                       (void)hp_player(10);
+                       (void)hp_player(p_ptr, 10);
                        (void)set_afraid(0);
 
                        /* Recalculate hitpoints */
@@ -789,7 +789,7 @@ concptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        msg_print(_("英雄の歌を口ずさんだ...", "You chant a powerful, heroic call to arms..."));
-                       (void)hp_player(10);
+                       (void)hp_player(p_ptr, 10);
                        (void)set_afraid(0);
 
                        /* Recalculate hitpoints */
@@ -847,7 +847,7 @@ concptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cont)
                        {
-                               hp_player(damroll(dice, sides));
+                               hp_player(p_ptr, damroll(dice, sides));
                                set_stun(0);
                                set_cut(0);
                        }
index ba37074..3d6cbcd 100644 (file)
@@ -286,7 +286,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change)
        (void)restore_all_status();
        (void)set_shero(0, TRUE);
        handle_stuff();
-       hp_player(5000);
+       hp_player(p_ptr, 5000);
 
        return TRUE;
 }
@@ -296,7 +296,7 @@ bool_hack heroism(int base)
        bool_hack ident = FALSE;
        if (set_afraid(0)) ident = TRUE;
        if (set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
-       if (hp_player(10)) ident = TRUE;
+       if (hp_player(p_ptr, 10)) ident = TRUE;
        return ident;
 }
 
@@ -305,14 +305,14 @@ bool_hack berserk(int base)
        bool_hack ident = FALSE;
        if (set_afraid(0)) ident = TRUE;
        if (set_shero(p_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
-       if (hp_player(30)) ident = TRUE;
+       if (hp_player(p_ptr, 30)) ident = TRUE;
        return ident;
 }
 
 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
 {
        bool_hack ident = FALSE;
-       if (hp_player(damroll(dice, sides))) ident = TRUE;
+       if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
        if (set_blind(0)) ident = TRUE;
        if (set_cut(p_ptr->cut - 10)) ident = TRUE;
        if (set_shero(0, TRUE)) ident = TRUE;
@@ -322,7 +322,7 @@ bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
 {
        bool_hack ident = FALSE;
-       if (hp_player(damroll(dice, sides))) ident = TRUE;
+       if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
        if (set_blind(0)) ident = TRUE;
        if (set_confused(0)) ident = TRUE;
        if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
@@ -333,7 +333,7 @@ bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
 bool_hack cure_critical_wounds(HIT_POINT pow)
 {
        bool_hack ident = FALSE;
-       if (hp_player(pow)) ident = TRUE;
+       if (hp_player(p_ptr, pow)) ident = TRUE;
        if (set_blind(0)) ident = TRUE;
        if (set_confused(0)) ident = TRUE;
        if (set_poisoned(0)) ident = TRUE;
@@ -346,7 +346,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow)
 bool_hack true_healing(HIT_POINT pow)
 {
        bool_hack ident = FALSE;
-       if (hp_player(pow)) ident = TRUE;
+       if (hp_player(p_ptr, pow)) ident = TRUE;
        if (set_blind(0)) ident = TRUE;
        if (set_confused(0)) ident = TRUE;
        if (set_poisoned(0)) ident = TRUE;
index 04495a1..3249731 100644 (file)
@@ -3122,7 +3122,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
                                        else
                                        {
                                                msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
-                                               (void)hp_player(dam);
+                                               (void)hp_player(p_ptr, dam);
                                        }
                                }
                                else
@@ -4283,7 +4283,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                        if (PRACE_IS_(p_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW())
                        {
                                msg_print(_("気分がよくなった。", "You feel invigorated!"));
-                               hp_player(dam / 4);
+                               hp_player(p_ptr, dam / 4);
                                learn_spell(monspell);
                        }
                        else
@@ -4668,7 +4668,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                {
                        if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
 
-                       (void)hp_player(dam);
+                       (void)hp_player(p_ptr, dam);
                        dam = 0;
                        break;
                }
index b64a546..24d10e3 100644 (file)
@@ -917,7 +917,7 @@ bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
        if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
        if (set_poisoned(0)) ident = TRUE;
        if (set_afraid(0)) ident = TRUE;
-       if (hp_player(50)) ident = TRUE;
+       if (hp_player(p_ptr, 50)) ident = TRUE;
        if (set_stun(0)) ident = TRUE;
        if (set_cut(0)) ident = TRUE;
        return ident;
@@ -3507,7 +3507,7 @@ void cast_wonder(DIRECTION dir)
                dispel_monsters(150);
                slow_monsters(plev);
                sleep_monsters(plev);
-               hp_player(300);
+               hp_player(p_ptr, 300);
        }
 }
 
@@ -3651,7 +3651,7 @@ void cast_invoke_spirits(DIRECTION dir)
                dispel_monsters(150);
                slow_monsters(plev);
                sleep_monsters(plev);
-               hp_player(300);
+               hp_player(p_ptr, 300);
        }
 
        if (die < 31)
@@ -3883,7 +3883,7 @@ bool_hack vampirism(void)
        {
                if (p_ptr->food < PY_FOOD_FULL)
                        /* No heal if we are "full" */
-                       (void)hp_player(dummy);
+                       (void)hp_player(p_ptr, dummy);
                else
                        msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
 
@@ -4292,7 +4292,7 @@ bool comvert_mp_to_hp(player_type *creature_ptr)
        if (creature_ptr->csp >= creature_ptr->lev / 5)
        {
                creature_ptr->csp -= creature_ptr->lev / 5;
-               hp_player(creature_ptr->lev);
+               hp_player(p_ptr, creature_ptr->lev);
        }
        else
        {