OSDN Git Service

[Refactor] #38997 set_ele_attack() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Mon, 24 Jun 2019 14:19:52 +0000 (23:19 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 24 Jun 2019 14:19:52 +0000 (23:19 +0900)
src/core.c
src/object2.c
src/player-effects.c
src/player-effects.h

index ea78a4d..6d987f9 100644 (file)
@@ -1848,7 +1848,7 @@ static void process_world_aux_timeout(void)
                p_ptr->ele_attack--;
 
                /* Clear all temporary elemental brands. */
-               if (!p_ptr->ele_attack) set_ele_attack(0, 0);
+               if (!p_ptr->ele_attack) set_ele_attack(p_ptr, 0, 0);
        }
 
        /* Timed temporary elemental immune. -LM- */
index c35009d..c34786d 100644 (file)
@@ -4991,7 +4991,7 @@ void inven_item_increase(INVENTORY_IDX item, ITEM_NUMBER num)
                                if (!has_melee_weapon(INVEN_RARM + INVEN_LARM - item))
                                {
                                        /* Clear all temporary elemental brands */
-                                       set_ele_attack(0, 0);
+                                       set_ele_attack(p_ptr, 0, 0);
                                }
                        }
                }
index 3ccb8bf..765190c 100644 (file)
@@ -328,7 +328,7 @@ void dispel_player(void)
        (void)set_oppose_pois(0, TRUE);
        (void)set_ultimate_res(0, TRUE);
        (void)set_mimic(p_ptr, 0, 0, TRUE);
-       (void)set_ele_attack(0, 0);
+       (void)set_ele_attack(p_ptr, 0, 0);
        (void)set_ele_immune(0, 0);
 
        /* Cancel glowing hands */
@@ -2295,44 +2295,44 @@ bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
  * @param v 継続時間
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
+bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v)
 {
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
        /* Clear all elemental attacks (only one is allowed at a time). */
-       if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
+       if ((creature_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
        {
-               p_ptr->special_attack &= ~(ATTACK_ACID);
+               creature_ptr->special_attack &= ~(ATTACK_ACID);
                msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
        }
-       if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
+       if ((creature_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
        {
-               p_ptr->special_attack &= ~(ATTACK_ELEC);
+               creature_ptr->special_attack &= ~(ATTACK_ELEC);
                msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
        }
-       if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
+       if ((creature_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
        {
-               p_ptr->special_attack &= ~(ATTACK_FIRE);
+               creature_ptr->special_attack &= ~(ATTACK_FIRE);
                msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
        }
-       if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
+       if ((creature_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
        {
-               p_ptr->special_attack &= ~(ATTACK_COLD);
+               creature_ptr->special_attack &= ~(ATTACK_COLD);
                msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
        }
-       if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
+       if ((creature_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
        {
-               p_ptr->special_attack &= ~(ATTACK_POIS);
+               creature_ptr->special_attack &= ~(ATTACK_POIS);
                msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
        }
 
        if ((v) && (attack_type))
        {
                /* Set attack type. */
-               p_ptr->special_attack |= (attack_type);
+               creature_ptr->special_attack |= (attack_type);
 
                /* Set duration. */
-               p_ptr->ele_attack = v;
+               creature_ptr->ele_attack = v;
 
 #ifdef JP
                msg_format("%sで攻撃できるようになった!",
@@ -2354,9 +2354,9 @@ bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
        }
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->redraw |= (PR_STATUS);
 
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
        handle_stuff();
 
        return (TRUE);
@@ -4263,15 +4263,15 @@ bool choose_ele_attack(void)
        choice = inkey();
 
        if ((choice == 'a') || (choice == 'A')) 
-               set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
+               set_ele_attack(p_ptr, ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
-               set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
+               set_ele_attack(p_ptr, ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
-               set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
+               set_ele_attack(p_ptr, ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
-               set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
+               set_ele_attack(p_ptr, ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
-               set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
+               set_ele_attack(p_ptr, ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else
        {
                msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
index e387768..1089fd8 100644 (file)
@@ -47,7 +47,7 @@ extern bool set_multishadow(player_type *creature_ptr, TIME_EFFECT v, bool do_de
 extern bool set_dustrobe(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_kabenuke(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-extern bool set_ele_attack(u32b attack_type, TIME_EFFECT v);
+extern bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v);
 extern bool set_ele_immune(u32b immune_type, TIME_EFFECT v);
 extern bool set_oppose_acid(TIME_EFFECT v, bool do_dec);
 extern bool set_oppose_elec(TIME_EFFECT v, bool do_dec);