OSDN Git Service

[Refactor] #38997 apply_disenchant() に player_type * 引数を追加. / Add player_type * argum...
authordeskull <deskull@users.sourceforge.jp>
Tue, 5 Nov 2019 15:42:11 +0000 (00:42 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 5 Nov 2019 15:42:11 +0000 (00:42 +0900)
src/chest.c
src/combat/melee1.c
src/spells.h
src/spells1.c
src/spells2.c
src/spells3.c

index 0915a5c..a2eb47d 100644 (file)
@@ -293,7 +293,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                                                (void)set_stun(p_ptr, p_ptr->stun + 10 +
                                                        randint0(100));
                                }
-                               else if (one_in_(3)) apply_disenchant(0);
+                               else if (one_in_(3)) apply_disenchant(p_ptr, 0);
                                else if (one_in_(2))
                                {
                                        (void)do_dec_stat(p_ptr, A_STR);
index bb328e9..68af2ad 100644 (file)
@@ -2840,7 +2840,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                                        if (!target_ptr->resist_disen && !CHECK_MULTISHADOW(target_ptr))
                                        {
                                                /* Apply disenchantment */
-                                               if (apply_disenchant(0))
+                                               if (apply_disenchant(target_ptr, 0))
                                                {
                                                        /* Hack -- Update AC */
                                                        update_creature(target_ptr);
index 8e5fe1e..1ebaf76 100644 (file)
@@ -294,7 +294,7 @@ extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx);
 extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
 extern bool free_level_recall(player_type *creature_ptr);
 extern bool reset_recall(void);
-extern bool apply_disenchant(BIT_FLAGS mode);
+extern bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode);
 extern void call_the_(void);
 extern void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los);
 extern void alter_reality(void);
index 367a015..4a1aec3 100644 (file)
@@ -4430,7 +4430,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name
                }
                else if (!CHECK_MULTISHADOW(target_ptr))
                {
-                       (void)apply_disenchant(0);
+                       (void)apply_disenchant(target_ptr, 0);
                }
                get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
                break;
index d0c1e4f..3b909e1 100644 (file)
@@ -3254,7 +3254,7 @@ void wild_magic(int spell)
                break;
        case 29:
        case 30:
-               apply_disenchant(1);
+               apply_disenchant(p_ptr, 1);
                break;
        case 31:
                lose_all_info(p_ptr);
index bfa7f65..3db5aaa 100644 (file)
@@ -930,9 +930,9 @@ bool reset_recall(void)
  * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す /
  * Return "TRUE" if the player notices anything
  */
-bool apply_disenchant(BIT_FLAGS mode)
+bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode)
 {
-       int             t = 0;
+       int t = 0;
        object_type *o_ptr;
        GAME_TEXT o_name[MAX_NLEN];
        int to_h, to_d, to_a, pval;
@@ -950,7 +950,7 @@ bool apply_disenchant(BIT_FLAGS mode)
                case 8: t = INVEN_FEET; break;
        }
 
-       o_ptr = &p_ptr->inventory_list[t];
+       o_ptr = &target_ptr->inventory_list[t];
 
        /* No item, nothing happens */
        if (!o_ptr->k_idx) return (FALSE);
@@ -1013,12 +1013,12 @@ bool apply_disenchant(BIT_FLAGS mode)
                        ((o_ptr->number != 1) ? "were" : "was"));
 #endif
 
-               chg_virtue(p_ptr, V_HARMONY, 1);
-               chg_virtue(p_ptr, V_ENCHANT, -2);
-               p_ptr->update |= (PU_BONUS);
-               p_ptr->window |= (PW_EQUIP | PW_PLAYER);
+               chg_virtue(target_ptr, V_HARMONY, 1);
+               chg_virtue(target_ptr, V_ENCHANT, -2);
+               target_ptr->update |= (PU_BONUS);
+               target_ptr->window |= (PW_EQUIP | PW_PLAYER);
 
-               calc_android_exp(p_ptr);
+               calc_android_exp(target_ptr);
        }
 
        return (TRUE);