From 3fcd0fdc5eef24c1c67af84d3a711a139d1ec7bb Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 12 Sep 2019 19:11:59 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20heroism()=20=E3=81=AB=20pl?= =?utf8?q?ayer=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= =?utf8?q?=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argument=20to=20herois?= =?utf8?q?m().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-activate.c | 4 ++-- src/cmd/cmd-quaff.c | 2 +- src/realm-craft.c | 2 +- src/realm-crusade.c | 2 +- src/realm-daemon.c | 2 +- src/spells-status.c | 8 ++++---- src/spells-status.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cmd/cmd-activate.c b/src/cmd/cmd-activate.c index f29cff21e..54c98189e 100644 --- a/src/cmd/cmd-activate.c +++ b/src/cmd/cmd-activate.c @@ -1362,14 +1362,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_HERO: { - (void)heroism(25); + (void)heroism(p_ptr, 25); break; } case ACT_HERO_SPEED: { (void)set_fast(user_ptr, randint1(50) + 50, FALSE); - (void)heroism(50); + (void)heroism(p_ptr, 50); break; } diff --git a/src/cmd/cmd-quaff.c b/src/cmd/cmd-quaff.c index 4bd806fdb..49d7d0758 100644 --- a/src/cmd/cmd-quaff.c +++ b/src/cmd/cmd-quaff.c @@ -296,7 +296,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item) break; case SV_POTION_HEROISM: - ident = heroism(25); + ident = heroism(p_ptr, 25); break; case SV_POTION_BESERK_STRENGTH: diff --git a/src/realm-craft.c b/src/realm-craft.c index f559dd989..0e880915a 100644 --- a/src/realm-craft.c +++ b/src/realm-craft.c @@ -119,7 +119,7 @@ concptr do_craft_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (cast) { - (void)heroism(base); + (void)heroism(p_ptr, base); } } break; diff --git a/src/realm-crusade.c b/src/realm-crusade.c index 3513c0674..436f11701 100644 --- a/src/realm-crusade.c +++ b/src/realm-crusade.c @@ -427,7 +427,7 @@ concptr do_crusade_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod if (cast) { - (void)heroism(base); + (void)heroism(p_ptr, base); } } break; diff --git a/src/realm-daemon.c b/src/realm-daemon.c index 63277301d..bf7d625bd 100644 --- a/src/realm-daemon.c +++ b/src/realm-daemon.c @@ -468,7 +468,7 @@ concptr do_daemon_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode { int base = 25; if (info) return info_duration(base, base); - if (cast)heroism(base); + if (cast)heroism(p_ptr, base); } break; diff --git a/src/spells-status.c b/src/spells-status.c index 5ef66eddc..a144f007f 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -291,12 +291,12 @@ bool_hack life_stream(player_type *creature_ptr, bool_hack message, bool_hack vi return TRUE; } -bool_hack heroism(int base) +bool_hack heroism(player_type *creature_ptr, int base) { bool_hack ident = FALSE; - if (set_afraid(p_ptr, 0)) ident = TRUE; - if (set_hero(p_ptr, p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE; - if (hp_player(p_ptr, 10)) ident = TRUE; + if (set_afraid(creature_ptr, 0)) ident = TRUE; + if (set_hero(creature_ptr, creature_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE; + if (hp_player(creature_ptr, 10)) ident = TRUE; return ident; } diff --git a/src/spells-status.h b/src/spells-status.h index da37cf123..c826c6db7 100644 --- a/src/spells-status.h +++ b/src/spells-status.h @@ -14,7 +14,7 @@ extern void stop_singing(player_type *creature_ptr); extern bool time_walk(player_type *creature_ptr); extern void roll_hitdice(player_type *creature_ptr, SPOP_FLAGS options); extern bool_hack life_stream(player_type *creature_ptr, bool_hack message, bool_hack virtue_change); -extern bool_hack heroism(int base); +extern bool_hack heroism(player_type *creature_ptr, int base); extern bool_hack berserk(int base); extern bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides); extern bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides); -- 2.11.0