OSDN Git Service

[Refactor] #38997 do_poly_self() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Wed, 26 Jun 2019 15:23:08 +0000 (00:23 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 26 Jun 2019 15:23:08 +0000 (00:23 +0900)
src/mutation.c
src/patron.c
src/player-effects.c
src/player-effects.h
src/realm-chaos.c
src/spells1.c

index dea92f6..797b034 100644 (file)
@@ -2204,7 +2204,7 @@ bool mutation_power_aux(int power)
 
                case MUT1_POLYMORPH:
                        if (!get_check(_("変身します。よろしいですか?", "You will polymorph your self. Are you sure? "))) return FALSE;
-                       do_poly_self();
+                       do_poly_self(p_ptr);
                        break;
 
                case MUT1_MIDAS_TCH:
index f095844..53e9649 100644 (file)
@@ -290,7 +290,7 @@ void gain_level_reward(int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[p_ptr->chaos_patron]);
                        msg_print(_("「汝、新たなる姿を必要とせり!」", "'Thou needst a new form, mortal!'"));
 
-                       do_poly_self();
+                       do_poly_self(p_ptr);
                        reward = _("変異した。", "polymorphing");
                        break;
 
index e399170..c2b8503 100644 (file)
@@ -3769,14 +3769,14 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
 }
 
 
-void do_poly_self(void)
+void do_poly_self(player_type *creature_ptr)
 {
-       int power = p_ptr->lev;
+       int power = creature_ptr->lev;
 
        msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
        chg_virtue(V_CHANCE, 1);
 
-       if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
+       if ((power > randint0(20)) && one_in_(3) && (creature_ptr->prace != RACE_ANDROID))
        {
                char effect_msg[80] = "";
                CHARACTER_IDX new_race;
@@ -3789,16 +3789,16 @@ void do_poly_self(void)
                        /* sex change */
                        power -= 2;
 
-                       if (p_ptr->psex == SEX_MALE)
+                       if (creature_ptr->psex == SEX_MALE)
                        {
-                               p_ptr->psex = SEX_FEMALE;
-                               sp_ptr = &sex_info[p_ptr->psex];
+                               creature_ptr->psex = SEX_FEMALE;
+                               sp_ptr = &sex_info[creature_ptr->psex];
                                sprintf(effect_msg, _("女性の", "female "));
                        }
                        else
                        {
-                               p_ptr->psex = SEX_MALE;
-                               sp_ptr = &sex_info[p_ptr->psex];
+                               creature_ptr->psex = SEX_MALE;
+                               sp_ptr = &sex_info[creature_ptr->psex];
                                sprintf(effect_msg, _("男性の", "male "));
                        }
                }
@@ -3814,14 +3814,14 @@ void do_poly_self(void)
                        {
                                if (one_in_(2))
                                {
-                                       (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
+                                       (void)dec_stat(creature_ptr, tmp, randint1(6) + 6, one_in_(3));
                                        power -= 1;
                                }
                                tmp++;
                        }
 
                        /* Deformities are discriminated against! */
-                       (void)dec_stat(p_ptr, A_CHR, randint1(6), TRUE);
+                       (void)dec_stat(creature_ptr, A_CHR, randint1(6), TRUE);
 
                        if (effect_msg[0])
                        {
@@ -3848,7 +3848,7 @@ void do_poly_self(void)
                {
                        new_race = (CHARACTER_IDX)randint0(MAX_RACES);
                }
-               while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
+               while ((new_race == creature_ptr->prace) || (new_race == RACE_ANDROID));
 
                change_race(new_race, effect_msg);
        }
@@ -3859,17 +3859,17 @@ void do_poly_self(void)
 
                /* Abomination! */
                power -= 20;
-               msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), p_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
+               msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), creature_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
 
                while (tmp < A_MAX)
                {
-                       (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
+                       (void)dec_stat(creature_ptr, tmp, randint1(6) + 6, one_in_(3));
                        tmp++;
                }
                if (one_in_(6))
                {
                        msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
-                       take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
+                       take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), creature_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
 
                        power -= 10;
                }
@@ -3880,13 +3880,13 @@ void do_poly_self(void)
                power -= 10;
 
                get_max_stats();
-               roll_hitdice(p_ptr, 0L);
+               roll_hitdice(creature_ptr, 0L);
        }
 
        while ((power > randint0(15)) && one_in_(3))
        {
                power -= 7;
-               (void)gain_mutation(p_ptr, 0);
+               (void)gain_mutation(creature_ptr, 0);
        }
 
        if (power > randint0(5))
index d9ba47d..68aad94 100644 (file)
@@ -71,7 +71,7 @@ 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 void do_poly_self(void);
+extern void do_poly_self(player_type *creature_ptr);
 extern bool set_ultimate_res(TIME_EFFECT v, bool do_dec);
 extern bool set_tim_res_nether(TIME_EFFECT v, bool do_dec);
 extern bool set_tim_res_time(TIME_EFFECT v, bool do_dec);
index 16ad29e..843a94c 100644 (file)
@@ -536,7 +536,7 @@ concptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                if (!get_check(_("変身します。よろしいですか?", "You will polymorph yourself. Are you sure? "))) return NULL;
-                               do_poly_self();
+                               do_poly_self(p_ptr);
                        }
                }
                break;
index 2410990..a720744 100644 (file)
@@ -4189,7 +4189,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                                {
                                        msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
                                        if (one_in_(4)) /* 4 */
-                                               do_poly_self();
+                                               do_poly_self(p_ptr);
                                        else
                                                status_shuffle();
                                }