From aa9dc428ba1822e320ae5f3750cc8d6c2f6551c7 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 14 Dec 2019 13:35:53 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20wild=5Fmagic()=20=E3=81=AB?= =?utf8?q?=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argument=20to?= =?utf8?q?=20wild=5Fmagic().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-spell.c | 2 +- src/spells.h | 2 +- src/spells2.c | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/cmd/cmd-spell.c b/src/cmd/cmd-spell.c index 69642a223..901e06177 100644 --- a/src/cmd/cmd-spell.c +++ b/src/cmd/cmd-spell.c @@ -1233,7 +1233,7 @@ void do_cmd_cast(player_type *caster_ptr) if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell)) { msg_print(_("カオス的な効果を発生した!", "You produce a chaotic effect!")); - wild_magic(spell); + wild_magic(caster_ptr, spell); } else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint1(100) < spell)) { diff --git a/src/spells.h b/src/spells.h index c5c1ef325..f0e03ae9c 100644 --- a/src/spells.h +++ b/src/spells.h @@ -249,7 +249,7 @@ extern bool kawarimi(bool success); extern bool rush_attack(player_type *attacker_ptr, bool *mdeath); extern void remove_all_mirrors(bool explode); extern void ring_of_power(player_type *caster_ptr, DIRECTION dir); -extern void wild_magic(int spell); +extern void wild_magic(player_type *caster_ptr, int spell); extern void cast_meteor(HIT_POINT dam, POSITION rad); extern bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad); extern void cast_wonder(DIRECTION dir); diff --git a/src/spells2.c b/src/spells2.c index f8e12e39c..3930f2fe7 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3190,7 +3190,7 @@ void ring_of_power(player_type *caster_ptr, DIRECTION dir) * @param spell ランダムな効果を選択するための基準ID * @return なし */ -void wild_magic(int spell) +void wild_magic(player_type *caster_ptr, int spell) { int counter = 0; int type = SUMMON_MOLD + randint0(6); @@ -3203,16 +3203,16 @@ void wild_magic(int spell) case 1: case 2: case 3: - teleport_player(p_ptr, 10, TELEPORT_PASSIVE); + teleport_player(caster_ptr, 10, TELEPORT_PASSIVE); break; case 4: case 5: case 6: - teleport_player(p_ptr, 100, TELEPORT_PASSIVE); + teleport_player(caster_ptr, 100, TELEPORT_PASSIVE); break; case 7: case 8: - teleport_player(p_ptr, 200, TELEPORT_PASSIVE); + teleport_player(caster_ptr, 200, TELEPORT_PASSIVE); break; case 9: case 10: @@ -3234,7 +3234,7 @@ void wild_magic(int spell) break; case 19: case 20: - trap_creation(p_ptr->y, p_ptr->x); + trap_creation(caster_ptr->y, caster_ptr->x); break; case 21: case 22: @@ -3246,18 +3246,18 @@ void wild_magic(int spell) aggravate_monsters(0); break; case 26: - earthquake(p_ptr, p_ptr->y, p_ptr->x, 5, 0); + earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0); break; case 27: case 28: - (void)gain_mutation(p_ptr, 0); + (void)gain_mutation(caster_ptr, 0); break; case 29: case 30: - apply_disenchant(p_ptr, 1); + apply_disenchant(caster_ptr, 1); break; case 31: - lose_all_info(p_ptr); + lose_all_info(caster_ptr); break; case 32: fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10)); @@ -3269,15 +3269,15 @@ void wild_magic(int spell) case 35: while (counter++ < 8) { - (void)summon_specific(0, p_ptr->y, p_ptr->x, (p_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, (caster_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); } break; case 36: case 37: - activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); + activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE); break; case 38: - (void)summon_cyber(-1, p_ptr->y, p_ptr->x); + (void)summon_cyber(-1, caster_ptr->y, caster_ptr->x); break; default: { @@ -3742,7 +3742,7 @@ void cast_shuffle(player_type *caster_ptr) else if (die < 38) { msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune.")); - wild_magic(randint0(32)); + wild_magic(caster_ptr, randint0(32)); } else if (die < 40) { -- 2.11.0