OSDN Git Service

[Refactor] #38997 set_stun(), set_oppose_pois() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Tue, 25 Jun 2019 15:01:39 +0000 (00:01 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 25 Jun 2019 15:09:10 +0000 (00:09 +0900)
23 files changed:
src/chest.c
src/cmd-activate.c
src/cmd-basic.c
src/cmd-mane.c
src/cmd-quaff.c
src/core.c
src/melee1.c
src/mind.c
src/mspells3.c
src/mutation.c
src/player-effects.c
src/player-effects.h
src/realm-craft.c
src/realm-crusade.c
src/realm-death.c
src/realm-life.c
src/realm-nature.c
src/realm-song.c
src/spells-floor.c
src/spells-status.c
src/spells1.c
src/spells2.c
src/spells3.c

index 3ad2462..c75f624 100644 (file)
@@ -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);
index e84a003..b246ce9 100644 (file)
@@ -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;
        }
index 8cf821f..07ae5ea 100644 (file)
@@ -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));
        }
 }
 
index e1029f2..7045874 100644 (file)
@@ -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:
index f0a4eb4..cd39e63 100644 (file)
@@ -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;
 
index 14b5695..4e46503 100644 (file)
@@ -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)
index fb65f52..7c5a0c5 100644 (file)
@@ -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)
index fbb20d1..9000d6d 100644 (file)
@@ -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 */
index 34a79bc..e81de28 100644 (file)
@@ -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:
index 373dae4..dea92f6 100644 (file)
@@ -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--;
                                }
                        }
index 7f968f9..dac0866 100644 (file)
@@ -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();
index 367c880..b709ae2 100644 (file)
@@ -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);
index 2ce72a5..9bbec41 100644 (file)
@@ -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;
index 6e7f84d..6441a38 100644 (file)
@@ -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);
                        }
                }
index 52d8acd..007b0a0 100644 (file)
@@ -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;
index 6a43a4b..b4899e3 100644 (file)
@@ -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);
                        }
                }
index 0d07b4a..cb54010 100644 (file)
@@ -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;
index 78c1a65..3398f2c 100644 (file)
@@ -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);
                        }
                }
index 9615f73..e38be93 100644 (file)
@@ -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;
                        }
                        }
index 4c0eb3f..68b929a 100644 (file)
@@ -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;
index c478349..3a500f1 100644 (file)
@@ -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))
index a7e2780..0ee0122 100644 (file)
@@ -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;
 }
index c8c9f28..675942c 100644 (file)
@@ -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;
 }