From a598e1da70abe302ce49f6834df9885609f78b74 Mon Sep 17 00:00:00 2001 From: Hourier Date: Mon, 13 Jan 2020 19:31:35 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20summon=5Fcyber()=20?= =?utf8?q?=E3=81=ABplayer=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=20/=20Added=20player=5Ftype=20*=20argument=20?= =?utf8?q?to=20summon=5Fcyber()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/mspells4.c | 2 +- src/spells-summon.c | 6 +++--- src/spells-summon.h | 3 +-- src/spells2.c | 12 +++++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/mspells4.c b/src/mspells4.c index 62f869293..fee1dd609 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -2976,7 +2976,7 @@ void spell_RF6_S_CYBER(player_type *target_ptr, POSITION y, POSITION x, MONSTER_ } else { - count += summon_cyber(m_idx, y, x); + count += summon_cyber(floor_ptr, m_idx, y, x); } if (target_ptr->blind && count && mon_to_player) diff --git a/src/spells-summon.c b/src/spells-summon.c index a110451bf..e75d52f8b 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -250,17 +250,17 @@ bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode) * @param x 召喚位置X座標 * @return 作用が実際にあった場合TRUEを返す */ -int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x) +int summon_cyber(floor_type *floor_ptr, MONSTER_IDX who, POSITION y, POSITION x) { int i; - int max_cyber = (easy_band ? 1 : (p_ptr->current_floor_ptr->dun_level / 50) + randint1(2)); + int max_cyber = (easy_band ? 1 : (floor_ptr->dun_level / 50) + randint1(2)); int count = 0; BIT_FLAGS mode = PM_ALLOW_GROUP; /* Summoned by a monster */ if (who > 0) { - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[who]; + monster_type *m_ptr = &floor_ptr->m_list[who]; if (is_pet(m_ptr)) mode |= PM_FORCE_PET; } diff --git a/src/spells-summon.h b/src/spells-summon.h index 8873a2ecd..235f949f9 100644 --- a/src/spells-summon.h +++ b/src/spells-summon.h @@ -65,7 +65,6 @@ extern bool cast_summon_octopus(player_type *creature_ptr); extern bool item_tester_offer(object_type *o_ptr); extern bool cast_summon_greater_demon(player_type *caster_ptr); extern bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode); -extern int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x); +extern int summon_cyber(floor_type *floor_ptr, MONSTER_IDX who, POSITION y, POSITION x); extern void mitokohmon(player_type *kohmon_ptr); - diff --git a/src/spells2.c b/src/spells2.c index 6019e60d4..dc9cdb868 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -2598,6 +2598,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count) { BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP); bool is_first_curse = TRUE; + floor_type *floor_ptr = target_ptr->current_floor_ptr; while (is_first_curse || one_in_(3) && !stop_ty) { is_first_curse = FALSE; @@ -2644,7 +2645,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count) (*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)); + (*count) += summon_specific(0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); if (!one_in_(6)) break; case 10: case 11: case 12: msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away...")); @@ -2674,9 +2675,9 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count) lose_all_info(target_ptr); if (!one_in_(6)) break; case 25: - if ((target_ptr->current_floor_ptr->dun_level > 65) && !stop_ty) + if ((floor_ptr->dun_level > 65) && !stop_ty) { - (*count) += summon_cyber(-1, target_ptr->y, target_ptr->x); + (*count) += summon_cyber(floor_ptr, -1, target_ptr->y, target_ptr->x); stop_ty = TRUE; break; } @@ -3263,6 +3264,7 @@ void wild_magic(player_type *caster_ptr, int spell) if (type < SUMMON_MOLD) type = SUMMON_MOLD; else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC; + floor_type *floor_ptr = caster_ptr->current_floor_ptr; switch (randint1(spell) + randint1(8) + 1) { case 1: @@ -3334,7 +3336,7 @@ void wild_magic(player_type *caster_ptr, int spell) case 35: for (int counter = 0; counter < 8; counter++) { - (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); } break; @@ -3343,7 +3345,7 @@ void wild_magic(player_type *caster_ptr, int spell) 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); + (void)summon_cyber(floor_ptr, -1, caster_ptr->y, caster_ptr->x); break; default: { -- 2.11.0