OSDN Git Service

[Refactor] #38997 activate_hi_summon() にplayer_type * 引数を追加 / Added player_type ...
authorHourier <hourier@users.sourceforge.jp>
Tue, 7 Jan 2020 11:38:13 +0000 (20:38 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 7 Jan 2020 11:38:13 +0000 (20:38 +0900)
src/chest.c
src/patron.c
src/spells.h
src/spells2.c
src/spells3.c

index 48a9b35..ce47b3c 100644 (file)
@@ -194,7 +194,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                for (i = 0; i < num; i++)
                {
                        if (randint1(100)<target_ptr->current_floor_ptr->dun_level)
-                               activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
+                               activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                        else
                                (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                }
index b784f15..8bd1fb9 100644 (file)
@@ -398,7 +398,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「汝、より強き敵を必要とせり!」", "'Thou needst worthier opponents!'"));
 
-                       activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
+                       activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
                        reward = _("モンスターを召喚された。", "summoning many hostile monsters");
                        break;
 
@@ -529,7 +529,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                                reward = _("禍々しい呪いをかけられた。", "cursing");
                                break;
                        case 2:
-                               activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
+                               activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
                                reward = _("モンスターを召喚された。", "summoning hostile monsters");
                                break;
                        case 3:
@@ -574,7 +574,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        {
                                (void)dec_stat(creature_ptr, dummy, 10 + randint1(15), FALSE);
                        }
-                       activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
+                       activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
                        (void)activate_ty_curse(creature_ptr, FALSE, &count);
                        if (one_in_(2))
                        {
index a1a950d..f7a6469 100644 (file)
@@ -223,7 +223,7 @@ extern bool disarm_traps_touch(player_type *caster_ptr);
 extern bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x);
 extern bool sleep_monsters_touch(player_type *caster_ptr);
 extern bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count);
-extern int activate_hi_summon(POSITION y, POSITION x, bool can_pet);
+extern int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet);
 extern void wall_breaker(player_type *caster_ptr);
 extern bool confuse_monsters(HIT_POINT dam);
 extern bool charm_monsters(HIT_POINT dam);
index 679d745..47986b5 100644 (file)
@@ -2719,7 +2719,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                        {
                                msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
                                teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
-                               if (randint0(13)) (*count) += activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
+                               if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                                if (!one_in_(6)) break;
                        }
                case 34:
@@ -2736,7 +2736,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                        aggravate_monsters(target_ptr, 0);
                        if (!one_in_(6)) break;
                case 4: case 5: case 6:
-                       (*count) += activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
+                       (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                        if (!one_in_(6)) break;
                case 7: case 8: case 9: case 18:
                        (*count) += summon_specific(0, target_ptr->y, target_ptr->x, target_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
@@ -2798,6 +2798,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
 
 
 /*!
+ * todo 引数にPOSITION x/yは必要か? 要調査
  * @brief HI_SUMMON(上級召喚)処理発動
  * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 召喚位置Y座標
@@ -2805,9 +2806,8 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
  * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
  * @return 作用が実際にあった場合TRUEを返す
  */
-int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
+int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
 {
-       int i;
        int count = 0;
        DEPTH summon_lev;
        BIT_FLAGS mode = PM_ALLOW_GROUP;
@@ -2828,11 +2828,11 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
 
        if (!pet) mode |= PM_NO_PET;
 
-       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level);
+       summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level);
 
-       for (i = 0; i < (randint1(7) + (p_ptr->current_floor_ptr->dun_level / 40)); i++)
+       for (int i = 0; i < (randint1(7) + (caster_ptr->current_floor_ptr->dun_level / 40)); i++)
        {
-               switch (randint1(25) + (p_ptr->current_floor_ptr->dun_level / 20))
+               switch (randint1(25) + (caster_ptr->current_floor_ptr->dun_level / 20))
                {
                        case 1: case 2:
                                count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
@@ -3448,7 +3448,7 @@ void wild_magic(player_type *caster_ptr, int spell)
                break;
        case 36:
        case 37:
-               activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE);
+               activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
                break;
        case 38:
                (void)summon_cyber(-1, caster_ptr->y, caster_ptr->x);
@@ -3886,7 +3886,7 @@ void cast_shuffle(player_type *caster_ptr)
                msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
 
                for (i = 0; i < randint1(3); i++)
-                       activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE);
+                       activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
        }
        else if (die < 14)
        {
index f8fd717..e0c898c 100644 (file)
@@ -3433,7 +3433,7 @@ void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx)
                                msg_print(_("空間が歪んだ!", "Space warps about you!"));
 
                                if (m_ptr->r_idx) teleport_away(caster_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
-                               if (one_in_(13)) count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
+                               if (one_in_(13)) count += activate_hi_summon(caster_ptr, m_ptr->fy, m_ptr->fx, TRUE);
                                if (!one_in_(6)) break;
                        }
                case 9: case 10: case 11:
@@ -3444,7 +3444,7 @@ void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx)
                        aggravate_monsters(caster_ptr, 0);
                        if (!one_in_(6)) break;
                case 17: case 18:
-                       count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
+                       count += activate_hi_summon(caster_ptr, m_ptr->fy, m_ptr->fx, TRUE);
                        if (!one_in_(6)) break;
                case 19: case 20: case 21: case 22:
                {