From: deskull Date: Fri, 21 Jun 2019 14:39:48 +0000 (+0900) Subject: [Refactor] #38997 set_confused() に player_type * 引数を追加. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=48921f3155e0eab811111fdaa470d6a682ee6735;p=hengband%2Fhengband.git [Refactor] #38997 set_confused() に player_type * 引数を追加. --- diff --git a/src/bldg.c b/src/bldg.c index e9a89a238..9e7b2af49 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -2066,7 +2066,7 @@ static bool inn_comm(int cmd) else { set_blind(p_ptr, 0); - set_confused(0); + set_confused(p_ptr, 0); p_ptr->stun = 0; p_ptr->chp = p_ptr->mhp; p_ptr->csp = p_ptr->msp; diff --git a/src/cmd-eat.c b/src/cmd-eat.c index 1192dc7f8..e3d354ab7 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -106,7 +106,7 @@ void exe_eat_food(INVENTORY_IDX item) { if (!p_ptr->resist_conf) { - if (set_confused(p_ptr->confused + randint0(10) + 10)) + if (set_confused(p_ptr, p_ptr->confused + randint0(10) + 10)) { ident = TRUE; } @@ -206,7 +206,7 @@ void exe_eat_food(INVENTORY_IDX item) case SV_FOOD_CURE_CONFUSION: { - if (set_confused(0)) ident = TRUE; + if (set_confused(p_ptr, 0)) ident = TRUE; break; } diff --git a/src/core.c b/src/core.c index bb5607897..c83a10584 100644 --- a/src/core.c +++ b/src/core.c @@ -1959,7 +1959,7 @@ static void process_world_aux_timeout(void) /* Confusion */ if (p_ptr->confused) { - (void)set_confused(p_ptr->confused - dec_count); + (void)set_confused(p_ptr, p_ptr->confused - dec_count); } /* Afraid */ @@ -2196,7 +2196,7 @@ static void process_world_aux_mutation(void) if (!p_ptr->resist_conf) { - (void)set_confused(p_ptr->confused + randint0(20) + 15); + (void)set_confused(p_ptr, p_ptr->confused + randint0(20) + 15); } if (!p_ptr->resist_chaos) diff --git a/src/melee1.c b/src/melee1.c index 1f34aa634..ff2df20b7 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -3206,7 +3206,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) /* Increase "confused" */ if (!p_ptr->resist_conf && !CHECK_MULTISHADOW()) { - if (set_confused(p_ptr->confused + 3 + randint1(rlev))) + if (set_confused(p_ptr, p_ptr->confused + 3 + randint1(rlev))) { obvious = TRUE; } diff --git a/src/mind.c b/src/mind.c index 02070b761..c1371f0b1 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1915,7 +1915,7 @@ void do_cmd_mind(void) else if (b < 45) { msg_print(_("あなたの頭は混乱した!", "Your brain is addled!")); - set_confused(p_ptr->confused + randint1(8)); + set_confused(p_ptr, p_ptr->confused + randint1(8)); } else if (b < 90) { diff --git a/src/mspells4.c b/src/mspells4.c index e3d96962e..70d7f56e5 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -1568,7 +1568,7 @@ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) if (!resist && !saving_throw) { - (void)set_confused(p_ptr->confused + randint0(4) + 4); + (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4); } learn_spell(MS_CONF); update_smart_learn(m_idx, DRS_CONF); diff --git a/src/player-effects.c b/src/player-effects.c index 06850e130..8d43f4578 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -487,55 +487,55 @@ bool set_blind(player_type *creature_ptr, TIME_EFFECT v) * @param v 継続時間 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 */ -bool set_confused(TIME_EFFECT v) +bool set_confused(player_type *creature_ptr, TIME_EFFECT v) { bool notice = FALSE; v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (p_ptr->is_dead) return FALSE; + if (creature_ptr->is_dead) return FALSE; /* Open */ if (v) { - if (!p_ptr->confused) + if (!creature_ptr->confused) { msg_print(_("あなたは混乱した!", "You are confused!")); - if (p_ptr->action == ACTION_LEARN) + if (creature_ptr->action == ACTION_LEARN) { msg_print(_("学習が続けられない!", "You cannot continue Learning!")); - p_ptr->new_mane = FALSE; + creature_ptr->new_mane = FALSE; - p_ptr->redraw |= (PR_STATE); - p_ptr->action = ACTION_NONE; + creature_ptr->redraw |= (PR_STATE); + creature_ptr->action = ACTION_NONE; } - if (p_ptr->action == ACTION_KAMAE) + if (creature_ptr->action == ACTION_KAMAE) { msg_print(_("構えがとけた。", "Your posture gets loose.")); - p_ptr->special_defense &= ~(KAMAE_MASK); - p_ptr->update |= (PU_BONUS); - p_ptr->redraw |= (PR_STATE); - p_ptr->action = ACTION_NONE; + creature_ptr->special_defense &= ~(KAMAE_MASK); + creature_ptr->update |= (PU_BONUS); + creature_ptr->redraw |= (PR_STATE); + creature_ptr->action = ACTION_NONE; } - else if (p_ptr->action == ACTION_KATA) + else if (creature_ptr->action == ACTION_KATA) { msg_print(_("型が崩れた。", "Your posture gets loose.")); - p_ptr->special_defense &= ~(KATA_MASK); - p_ptr->update |= (PU_BONUS); - p_ptr->update |= (PU_MONSTERS); - p_ptr->redraw |= (PR_STATE); - p_ptr->redraw |= (PR_STATUS); - p_ptr->action = ACTION_NONE; + creature_ptr->special_defense &= ~(KATA_MASK); + creature_ptr->update |= (PU_BONUS); + creature_ptr->update |= (PU_MONSTERS); + creature_ptr->redraw |= (PR_STATE); + creature_ptr->redraw |= (PR_STATUS); + creature_ptr->action = ACTION_NONE; } /* Sniper */ - if (p_ptr->concent) reset_concentration(TRUE); + if (creature_ptr->concent) reset_concentration(TRUE); /* Hex */ if (hex_spelling_any()) stop_hex_spell_all(); notice = TRUE; - p_ptr->counter = FALSE; + creature_ptr->counter = FALSE; chg_virtue(V_HARMONY, -1); } } @@ -543,17 +543,17 @@ bool set_confused(TIME_EFFECT v) /* Shut */ else { - if (p_ptr->confused) + if (creature_ptr->confused) { msg_print(_("やっと混乱がおさまった。", "You feel less confused now.")); - p_ptr->special_attack &= ~(ATTACK_SUIKEN); + creature_ptr->special_attack &= ~(ATTACK_SUIKEN); notice = TRUE; } } /* Use the value */ - p_ptr->confused = v; - p_ptr->redraw |= (PR_STATUS); + creature_ptr->confused = v; + creature_ptr->redraw |= (PR_STATUS); /* Nothing to notice */ if (!notice) return (FALSE); diff --git a/src/player-effects.h b/src/player-effects.h index abcb72bc1..23d07415b 100644 --- a/src/player-effects.h +++ b/src/player-effects.h @@ -16,7 +16,7 @@ extern void reset_tim_flags(void); extern void dispel_player(void); extern bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec); extern bool set_blind(player_type *creature_ptr, TIME_EFFECT v); -extern bool set_confused(TIME_EFFECT v); +extern bool set_confused(player_type *creature_ptr, TIME_EFFECT v); extern bool set_poisoned(TIME_EFFECT v); extern bool set_afraid(TIME_EFFECT v); extern bool set_paralyzed(TIME_EFFECT v); diff --git a/src/player-status.c b/src/player-status.c index e5c37fbf4..c764d2ab7 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -5447,7 +5447,7 @@ void sanity_blast(monster_type *m_ptr, bool necro) /* Brain smash */ if (!p_ptr->resist_conf) { - (void)set_confused(p_ptr->confused + randint0(4) + 4); + (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4); } if (!p_ptr->free_act) { diff --git a/src/spells-object.c b/src/spells-object.c index 2cc9575d9..38d8ebd9a 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -846,13 +846,13 @@ bool perilous_secrets(player_type *creature_ptr) (void)set_paralyzed(creature_ptr->paralyzed + randint1(5 * oops + 1)); /* Confusing. */ - (void)set_confused(creature_ptr->confused + randint1(5 * oops + 1)); + (void)set_confused(p_ptr, creature_ptr->confused + randint1(5 * oops + 1)); } creature_ptr->redraw |= (PR_MANA); } take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1); /* Confusing. */ - if (one_in_(5)) (void)set_confused(creature_ptr->confused + randint1(10)); + if (one_in_(5)) (void)set_confused(p_ptr, creature_ptr->confused + randint1(10)); /* Exercise a little care... */ if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1); diff --git a/src/spells-status.c b/src/spells-status.c index 76623df27..1b0335afd 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -279,7 +279,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change) restore_level(); (void)set_poisoned(0); (void)set_blind(p_ptr, 0); - (void)set_confused(0); + (void)set_confused(p_ptr, 0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); @@ -324,7 +324,7 @@ bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides) bool_hack ident = FALSE; if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE; if (set_blind(p_ptr, 0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; + if (set_confused(p_ptr, 0)) ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE; if (set_shero(0, TRUE)) ident = TRUE; return ident; @@ -335,7 +335,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow) bool_hack ident = FALSE; if (hp_player(p_ptr, pow)) ident = TRUE; if (set_blind(p_ptr, 0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; + if (set_confused(p_ptr, 0)) ident = TRUE; if (set_poisoned(0)) ident = TRUE; if (set_stun(0)) ident = TRUE; if (set_cut(0)) ident = TRUE; @@ -348,7 +348,7 @@ bool_hack true_healing(HIT_POINT pow) bool_hack ident = FALSE; if (hp_player(p_ptr, pow)) ident = TRUE; if (set_blind(p_ptr, 0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; + if (set_confused(p_ptr, 0)) ident = TRUE; if (set_poisoned(0)) ident = TRUE; if (set_stun(0)) ident = TRUE; if (set_cut(0)) ident = TRUE; diff --git a/src/spells1.c b/src/spells1.c index 2df6a678a..5385811d8 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -1744,7 +1744,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P switch (randint1(4)) { case 1: - set_confused(p_ptr->confused + 3 + randint1(dam)); + set_confused(p_ptr, p_ptr->confused + 3 + randint1(dam)); break; case 2: set_stun(p_ptr->stun + randint1(dam)); @@ -1942,7 +1942,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P set_stun(p_ptr->stun + dam / 2); break; case 2: - set_confused(p_ptr->confused + dam / 2); + set_confused(p_ptr, p_ptr->confused + dam / 2); break; default: { @@ -4306,7 +4306,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } if (!p_ptr->resist_conf && !p_ptr->resist_water) { - set_confused(p_ptr->confused + randint1(5) + 5); + set_confused(p_ptr, p_ptr->confused + randint1(5) + 5); } if (one_in_(5) && !p_ptr->resist_water) @@ -4334,7 +4334,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { if (!p_ptr->resist_conf) { - (void)set_confused(p_ptr->confused + randint0(20) + 10); + (void)set_confused(p_ptr, p_ptr->confused + randint0(20) + 10); } if (!p_ptr->resist_chaos) { @@ -4416,7 +4416,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } else if (!CHECK_MULTISHADOW()) { - (void)set_confused(p_ptr->confused + randint1(20) + 10); + (void)set_confused(p_ptr, p_ptr->confused + randint1(20) + 10); } get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); break; @@ -4876,7 +4876,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (!p_ptr->resist_conf) { - (void)set_confused(p_ptr->confused + randint0(4) + 4); + (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4); } if (!p_ptr->resist_chaos && one_in_(3)) @@ -4930,7 +4930,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } if (!p_ptr->resist_conf) { - (void)set_confused(p_ptr->confused + randint0(4) + 4); + (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4); } if (!p_ptr->free_act) { diff --git a/src/spells2.c b/src/spells2.c index 24d10e3b6..7dad38055 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3563,7 +3563,7 @@ void cast_invoke_spirits(DIRECTION dir) msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...", "Your head is invaded by a horde of gibbering spectral voices...")); - set_confused(p_ptr->confused + randint1(4) + 4); + set_confused(p_ptr, p_ptr->confused + randint1(4) + 4); } else if (die < 31) { diff --git a/src/spells3.c b/src/spells3.c index 66936a199..359f52b9e 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -3434,7 +3434,7 @@ bool booze(player_type *creature_ptr) else if (!creature_ptr->resist_conf) creature_ptr->special_attack |= ATTACK_SUIKEN; if (!creature_ptr->resist_conf) { - if (set_confused(randint0(20) + 15)) + if (set_confused(p_ptr, randint0(20) + 15)) { ident = TRUE; } diff --git a/src/trap.c b/src/trap.c index 6ad01a464..479d3ac70 100644 --- a/src/trap.c +++ b/src/trap.c @@ -538,7 +538,7 @@ void hit_trap(bool break_trap) case TRAP_CONFUSE: { - hit_trap_set_abnormal_status( + hit_trap_set_abnormal_status_p( _("きらめくガスに包み込まれた!", "A gas of scintillating colors surrounds you!"), p_ptr->resist_conf, set_confused, p_ptr->confused + (TIME_EFFECT)randint0(20) + 10);