From 3b65081ae2b68cc2b687f0a708436105650f14bf Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 26 Jun 2019 00:01:39 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20set=5Fstun(),=20set=5Foppo?= =?utf8?q?se=5Fpois()=20=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=EF=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/chest.c | 2 +- src/cmd-activate.c | 8 ++++---- src/cmd-basic.c | 2 +- src/cmd-mane.c | 2 +- src/cmd-quaff.c | 2 +- src/core.c | 2 +- src/melee1.c | 4 ++-- src/mind.c | 2 +- src/mspells3.c | 2 +- src/mutation.c | 2 +- src/player-effects.c | 18 +++++++++--------- src/player-effects.h | 4 ++-- src/realm-craft.c | 4 ++-- src/realm-crusade.c | 4 ++-- src/realm-death.c | 2 +- src/realm-life.c | 2 +- src/realm-nature.c | 2 +- src/realm-song.c | 2 +- src/spells-floor.c | 4 ++-- src/spells-status.c | 6 +++--- src/spells1.c | 18 +++++++++--------- src/spells2.c | 2 +- src/spells3.c | 2 +- 23 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/chest.c b/src/chest.c index 3ad2462da..c75f62413 100644 --- a/src/chest.c +++ b/src/chest.c @@ -290,7 +290,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 2 + randint0(6)); else - (void)set_stun(p_ptr->stun + 10 + + (void)set_stun(p_ptr, p_ptr->stun + 10 + randint0(100)); } else if (one_in_(3)) apply_disenchant(0); diff --git a/src/cmd-activate.c b/src/cmd-activate.c index e84a0031f..b246ce990 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -1042,7 +1042,7 @@ bool activate_artifact(object_type *o_ptr) (void)set_oppose_elec(p_ptr, randint1(50) + 50, FALSE); (void)set_oppose_fire(p_ptr, randint1(50) + 50, FALSE); (void)set_oppose_cold(p_ptr, randint1(50) + 50, FALSE); - (void)set_oppose_pois(randint1(50) + 50, FALSE); + (void)set_oppose_pois(p_ptr, randint1(50) + 50, FALSE); break; } @@ -1339,7 +1339,7 @@ bool activate_artifact(object_type *o_ptr) (void)set_oppose_elec(p_ptr, randint1(40) + 40, FALSE); (void)set_oppose_fire(p_ptr, randint1(40) + 40, FALSE); (void)set_oppose_cold(p_ptr, randint1(40) + 40, FALSE); - (void)set_oppose_pois(randint1(40) + 40, FALSE); + (void)set_oppose_pois(p_ptr, randint1(40) + 40, FALSE); break; } @@ -1433,7 +1433,7 @@ bool activate_artifact(object_type *o_ptr) case ACT_RESIST_POIS: { msg_format(_("%sが緑に輝いた...", "The %s grows green."), name); - (void)set_oppose_pois(randint1(20) + 20, FALSE); + (void)set_oppose_pois(p_ptr, randint1(20) + 20, FALSE); break; } @@ -1692,7 +1692,7 @@ bool activate_artifact(object_type *o_ptr) (void)set_oppose_elec(p_ptr, v, FALSE); (void)set_oppose_fire(p_ptr, v, FALSE); (void)set_oppose_cold(p_ptr, v, FALSE); - (void)set_oppose_pois(v, FALSE); + (void)set_oppose_pois(p_ptr, v, FALSE); (void)set_ultimate_res(v, FALSE); break; } diff --git a/src/cmd-basic.c b/src/cmd-basic.c index 8cf821fb5..07ae5ead1 100644 --- a/src/cmd-basic.c +++ b/src/cmd-basic.c @@ -2309,7 +2309,7 @@ void do_cmd_fire(SPELL_IDX snipe_type) { msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. ")); (void)set_slow(p_ptr, p_ptr->slow + randint0(7) + 7, FALSE); - (void)set_stun(p_ptr->stun + randint1(25)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(25)); } } diff --git a/src/cmd-mane.c b/src/cmd-mane.c index e1029f222..7045874e8 100644 --- a/src/cmd-mane.c +++ b/src/cmd-mane.c @@ -658,7 +658,7 @@ static bool use_mane(int spell) case MS_HEAL: msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!")); (void)hp_player(p_ptr, plev*6); - (void)set_stun(0); + (void)set_stun(p_ptr, 0); (void)set_cut(0); break; case MS_INVULNER: diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index f0a4eb4d1..cd39e63ef 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -453,7 +453,7 @@ void exe_quaff_potion(INVENTORY_IDX item) (void)set_oppose_elec(p_ptr, p_ptr->oppose_elec + randint1(20) + 20, FALSE); (void)set_oppose_fire(p_ptr, p_ptr->oppose_fire + randint1(20) + 20, FALSE); (void)set_oppose_cold(p_ptr, p_ptr->oppose_cold + randint1(20) + 20, FALSE); - (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE); + (void)set_oppose_pois(p_ptr, p_ptr->oppose_pois + randint1(20) + 20, FALSE); ident = TRUE; break; diff --git a/src/core.c b/src/core.c index 14b56951a..4e465035c 100644 --- a/src/core.c +++ b/src/core.c @@ -2067,7 +2067,7 @@ static void process_world_aux_timeout(void) /* Oppose Poison */ if (p_ptr->oppose_pois) { - (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE); + (void)set_oppose_pois(p_ptr, p_ptr->oppose_pois - 1, TRUE); } if (p_ptr->ult_res) diff --git a/src/melee1.c b/src/melee1.c index fb65f5254..7c5a0c519 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -3654,7 +3654,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } else { - if (set_stun(p_ptr->stun + 10 + randint1(r_ptr->level / 4))) + if (set_stun(p_ptr, p_ptr->stun + 10 + randint1(r_ptr->level / 4))) { obvious = TRUE; } @@ -3727,7 +3727,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) } /* Apply the stun */ - if (stun_plus) (void)set_stun(p_ptr->stun + stun_plus); + if (stun_plus) (void)set_stun(p_ptr, p_ptr->stun + stun_plus); } if (explode) diff --git a/src/mind.c b/src/mind.c index fbb20d17b..9000d6d92 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1111,7 +1111,7 @@ static bool cast_mindcrafter_spell(int spell) if (plev > 19) set_oppose_fire(p_ptr, (TIME_EFFECT)plev, FALSE); if (plev > 24) set_oppose_cold(p_ptr, (TIME_EFFECT)plev, FALSE); if (plev > 29) set_oppose_elec(p_ptr, (TIME_EFFECT)plev, FALSE); - if (plev > 34) set_oppose_pois((TIME_EFFECT)plev, FALSE); + if (plev > 34) set_oppose_pois(p_ptr, (TIME_EFFECT)plev, FALSE); break; case 7: /* Psychometry */ diff --git a/src/mspells3.c b/src/mspells3.c index 34a79bc32..e81de2843 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -1281,7 +1281,7 @@ static bool cast_learned_spell(int spell, bool success) case MS_HEAL: msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!")); (void)hp_player(p_ptr, plev*4); - (void)set_stun(0); + (void)set_stun(p_ptr, 0); (void)set_cut(0); break; case MS_INVULNER: diff --git a/src/mutation.c b/src/mutation.c index 373dae43a..dea92f609 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2249,7 +2249,7 @@ bool mutation_power_aux(int power) } if (num) { - (void)set_oppose_pois(dur, FALSE); + (void)set_oppose_pois(p_ptr, dur, FALSE); num--; } } diff --git a/src/player-effects.c b/src/player-effects.c index 7f968f9cd..dac08662c 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -325,7 +325,7 @@ void dispel_player(void) (void)set_oppose_elec(p_ptr, 0, TRUE); (void)set_oppose_fire(p_ptr, 0, TRUE); (void)set_oppose_cold(p_ptr, 0, TRUE); - (void)set_oppose_pois(0, TRUE); + (void)set_oppose_pois(p_ptr, 0, TRUE); (void)set_ultimate_res(0, TRUE); (void)set_mimic(p_ptr, 0, 0, TRUE); (void)set_ele_attack(p_ptr, 0, 0); @@ -2627,20 +2627,20 @@ bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_dec) * @param do_dec 現在の継続時間より長い値のみ上書きする * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 */ -bool set_oppose_pois(TIME_EFFECT v, bool do_dec) +bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec) { bool notice = FALSE; v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1; - if (p_ptr->is_dead) return FALSE; + if ((creature_ptr->pclass == CLASS_NINJA) && (creature_ptr->lev > 44)) v = 1; + if (creature_ptr->is_dead) return FALSE; /* Open */ if (v) { - if (p_ptr->oppose_pois && !do_dec) + if (creature_ptr->oppose_pois && !do_dec) { - if (p_ptr->oppose_pois > v) return FALSE; + if (creature_ptr->oppose_pois > v) return FALSE; } else if (!IS_OPPOSE_POIS()) { @@ -2652,7 +2652,7 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec) /* Shut */ else { - if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU)) + if (creature_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) { msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison.")); notice = TRUE; @@ -2660,11 +2660,11 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec) } /* Use the value */ - p_ptr->oppose_pois = v; + creature_ptr->oppose_pois = v; /* Nothing to notice */ if (!notice) return (FALSE); - p_ptr->redraw |= (PR_STATUS); + creature_ptr->redraw |= (PR_STATUS); if (disturb_state) disturb(FALSE, FALSE); handle_stuff(); diff --git a/src/player-effects.h b/src/player-effects.h index 367c88082..b709ae230 100644 --- a/src/player-effects.h +++ b/src/player-effects.h @@ -53,8 +53,8 @@ extern bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_de extern bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); extern bool set_oppose_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); extern bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); -extern bool set_oppose_pois(TIME_EFFECT v, bool do_dec); -extern bool set_stun(TIME_EFFECT v); +extern bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); +extern bool set_stun(player_type *creature_ptr, TIME_EFFECT v); extern bool set_cut(TIME_EFFECT v); extern bool set_food(TIME_EFFECT v); extern bool inc_stat(player_type *creature_ptr, int stat); diff --git a/src/realm-craft.c b/src/realm-craft.c index 2ce72a536..9bbec41fc 100644 --- a/src/realm-craft.c +++ b/src/realm-craft.c @@ -195,7 +195,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode) if (cast) { - set_oppose_pois(randint1(base) + base, FALSE); + set_oppose_pois(p_ptr, randint1(base) + base, FALSE); } } break; @@ -325,7 +325,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode) set_oppose_elec(p_ptr, randint1(base) + base, FALSE); set_oppose_fire(p_ptr, randint1(base) + base, FALSE); set_oppose_cold(p_ptr, randint1(base) + base, FALSE); - set_oppose_pois(randint1(base) + base, FALSE); + set_oppose_pois(p_ptr, randint1(base) + base, FALSE); } } break; diff --git a/src/realm-crusade.c b/src/realm-crusade.c index 6e7f84dda..6441a383b 100644 --- a/src/realm-crusade.c +++ b/src/realm-crusade.c @@ -129,7 +129,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode) { set_cut(0); set_poisoned(p_ptr, 0); - set_stun(0); + set_stun(p_ptr, 0); } } break; @@ -269,7 +269,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode) hp_player(p_ptr, heal); set_afraid(p_ptr, 0); set_poisoned(p_ptr, 0); - set_stun(0); + set_stun(p_ptr, 0); set_cut(0); } } diff --git a/src/realm-death.c b/src/realm-death.c index 52d8acd22..007b0a0b3 100644 --- a/src/realm-death.c +++ b/src/realm-death.c @@ -155,7 +155,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode) if (cast) { - set_oppose_pois(randint1(base) + base, FALSE); + set_oppose_pois(p_ptr, randint1(base) + base, FALSE); } } break; diff --git a/src/realm-life.c b/src/realm-life.c index 6a43a4b00..b4899e3c0 100644 --- a/src/realm-life.c +++ b/src/realm-life.c @@ -476,7 +476,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode) set_oppose_elec(p_ptr, v, FALSE); set_oppose_fire(p_ptr, v, FALSE); set_oppose_cold(p_ptr, v, FALSE); - set_oppose_pois(v, FALSE); + set_oppose_pois(p_ptr, v, FALSE); set_ultimate_res(v, FALSE); } } diff --git a/src/realm-nature.c b/src/realm-nature.c index 0d07b4a17..cb5401012 100644 --- a/src/realm-nature.c +++ b/src/realm-nature.c @@ -365,7 +365,7 @@ concptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode) set_oppose_elec(p_ptr, randint1(base) + base, FALSE); set_oppose_fire(p_ptr, randint1(base) + base, FALSE); set_oppose_cold(p_ptr, randint1(base) + base, FALSE); - set_oppose_pois(randint1(base) + base, FALSE); + set_oppose_pois(p_ptr, randint1(base) + base, FALSE); } } break; diff --git a/src/realm-song.c b/src/realm-song.c index 78c1a654d..3398f2c8f 100644 --- a/src/realm-song.c +++ b/src/realm-song.c @@ -848,7 +848,7 @@ concptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode) if (cont) { hp_player(p_ptr, damroll(dice, sides)); - set_stun(0); + set_stun(p_ptr, 0); set_cut(0); } } diff --git a/src/spells-floor.c b/src/spells-floor.c index 9615f73b7..e38be938a 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -875,14 +875,14 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) { msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!")); damage = damroll(10, 4); - (void)set_stun(p_ptr->stun + randint1(50)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(50)); break; } case 3: { msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!")); damage = damroll(10, 4); - (void)set_stun(p_ptr->stun + randint1(50)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(50)); break; } } diff --git a/src/spells-status.c b/src/spells-status.c index 4c0eb3f57..68b929a8b 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -281,7 +281,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change) (void)set_blind(p_ptr, 0); (void)set_confused(p_ptr, 0); (void)set_image(p_ptr, 0); - (void)set_stun(0); + (void)set_stun(p_ptr, 0); (void)set_cut(0); (void)restore_all_status(); (void)set_shero(p_ptr, 0, TRUE); @@ -337,7 +337,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow) if (set_blind(p_ptr, 0)) ident = TRUE; if (set_confused(p_ptr, 0)) ident = TRUE; if (set_poisoned(p_ptr, 0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; + if (set_stun(p_ptr, 0)) ident = TRUE; if (set_cut(0)) ident = TRUE; if (set_shero(p_ptr, 0, TRUE)) ident = TRUE; return ident; @@ -350,7 +350,7 @@ bool_hack true_healing(HIT_POINT pow) if (set_blind(p_ptr, 0)) ident = TRUE; if (set_confused(p_ptr, 0)) ident = TRUE; if (set_poisoned(p_ptr, 0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; + if (set_stun(p_ptr, 0)) ident = TRUE; if (set_cut(0)) ident = TRUE; if (set_image(p_ptr, 0)) ident = TRUE; return ident; diff --git a/src/spells1.c b/src/spells1.c index c4783497d..3a500f143 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -1747,7 +1747,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P set_confused(p_ptr, p_ptr->confused + 3 + randint1(dam)); break; case 2: - set_stun(p_ptr->stun + randint1(dam)); + set_stun(p_ptr, p_ptr->stun + randint1(dam)); break; case 3: { @@ -1939,7 +1939,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P switch (randint1(4)) { case 1: - set_stun(p_ptr->stun + dam / 2); + set_stun(p_ptr, p_ptr->stun + dam / 2); break; case 2: set_confused(p_ptr, p_ptr->confused + dam / 2); @@ -4256,7 +4256,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (!p_ptr->resist_sound && !CHECK_MULTISHADOW()) { int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5))); - (void)set_stun(p_ptr->stun + plus_stun); + (void)set_stun(p_ptr, p_ptr->stun + plus_stun); } if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire)) @@ -4302,7 +4302,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { if (!p_ptr->resist_sound && !p_ptr->resist_water) { - set_stun(p_ptr->stun + randint1(40)); + set_stun(p_ptr, p_ptr->stun + randint1(40)); } if (!p_ptr->resist_conf && !p_ptr->resist_water) { @@ -4394,7 +4394,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI else if (!CHECK_MULTISHADOW()) { int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5))); - (void)set_stun(p_ptr->stun + plus_stun); + (void)set_stun(p_ptr, p_ptr->stun + plus_stun); } if (!p_ptr->resist_sound || one_in_(13)) @@ -4460,7 +4460,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!")); if (!p_ptr->resist_sound && !CHECK_MULTISHADOW()) { - (void)set_stun(p_ptr->stun + randint1(20)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(20)); } get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell); break; @@ -4473,7 +4473,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!")); if (!p_ptr->resist_sound && !CHECK_MULTISHADOW()) { - (void)set_stun(p_ptr->stun + randint1(20)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(20)); } if (p_ptr->resist_shard) @@ -4638,7 +4638,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (!(p_ptr->resist_sound || p_ptr->levitation)) { int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5))); - (void)set_stun(p_ptr->stun + plus_stun); + (void)set_stun(p_ptr, p_ptr->stun + plus_stun); } } if (p_ptr->levitation) @@ -4751,7 +4751,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI } if (!p_ptr->resist_sound) { - (void)set_stun(p_ptr->stun + randint1(15)); + (void)set_stun(p_ptr, p_ptr->stun + randint1(15)); } if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12)) diff --git a/src/spells2.c b/src/spells2.c index a7e278019..0ee0122c3 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -918,7 +918,7 @@ bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful) if (set_poisoned(p_ptr, 0)) ident = TRUE; if (set_afraid(p_ptr, 0)) ident = TRUE; if (hp_player(p_ptr, 50)) ident = TRUE; - if (set_stun(0)) ident = TRUE; + if (set_stun(p_ptr, 0)) ident = TRUE; if (set_cut(0)) ident = TRUE; return ident; } diff --git a/src/spells3.c b/src/spells3.c index c8c9f2817..675942cab 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -3467,7 +3467,7 @@ bool detonation(player_type *creature_ptr) { msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!")); take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1); - (void)set_stun(creature_ptr->stun + 75); + (void)set_stun(p_ptr, creature_ptr->stun + 75); (void)set_cut(creature_ptr->cut + 5000); return TRUE; } -- 2.11.0