OSDN Git Service

[WIP] [Refactor] #39963 Separated spells2.h from spells1.h
[hengband/hengband.git] / src / chest.c
index 0a80e13..45c4dd8 100644 (file)
@@ -1,8 +1,8 @@
-
-#include "angband.h"
+#include "angband.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
-#include "spells.h"
+#include "spell/spells-type.h"
 #include "spells-summon.h"
 #include "floor.h"
 #include "trap.h"
@@ -11,7 +11,7 @@
 #include "player-class.h"
 #include "player-effects.h"
 #include "grid.h"
-#include "realm-song.h"
+#include "spell/spells2.h"
 
 /*!
 * @brief 箱からアイテムを引き出す /
@@ -42,8 +42,8 @@ void chest_death(player_type *owner_ptr, bool scatter, POSITION y, POSITION x, O
        object_type forge;
        object_type *q_ptr;
 
-       object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[o_idx];
-
+       floor_type *floor_ptr = owner_ptr->current_floor_ptr;
+       object_type *o_ptr = &floor_ptr->o_list[o_idx];
 
        /* Small chests often hold "gold" */
        small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
@@ -56,12 +56,12 @@ void chest_death(player_type *owner_ptr, bool scatter, POSITION y, POSITION x, O
                number = 5;
                small = FALSE;
                mode |= AM_GREAT;
-               owner_ptr->current_floor_ptr->object_level = o_ptr->xtra3;
+               floor_ptr->object_level = o_ptr->xtra3;
        }
        else
        {
                /* Determine the "value" of the items */
-               owner_ptr->current_floor_ptr->object_level = ABS(o_ptr->pval) + 10;
+               floor_ptr->object_level = ABS(o_ptr->pval) + 10;
        }
 
        /* Zero pval means empty chest */
@@ -78,14 +78,14 @@ void chest_death(player_type *owner_ptr, bool scatter, POSITION y, POSITION x, O
                if (small && (randint0(100) < 25))
                {
                        /* Make some gold */
-                       if (!make_gold(q_ptr)) continue;
+                       if (!make_gold(floor_ptr, q_ptr)) continue;
                }
 
                /* Otherwise drop an item */
                else
                {
                        /* Make a good object */
-                       if (!make_object(q_ptr, mode)) continue;
+                       if (!make_object(owner_ptr, q_ptr, mode)) continue;
                }
 
                /* If chest scatters its contents, pick any floor square. */
@@ -99,7 +99,7 @@ void chest_death(player_type *owner_ptr, bool scatter, POSITION y, POSITION x, O
                                x = randint0(MAX_WID);
 
                                /* Must be an empty floor. */
-                               if (!cave_empty_bold(owner_ptr->current_floor_ptr, y, x)) continue;
+                               if (!is_cave_empty_bold(owner_ptr, y, x)) continue;
 
                                /* Place the object there. */
                                (void)drop_near(owner_ptr, q_ptr, -1, y, x);
@@ -113,7 +113,7 @@ void chest_death(player_type *owner_ptr, bool scatter, POSITION y, POSITION x, O
        }
 
        /* Reset the object level */
-       owner_ptr->current_floor_ptr->object_level = owner_ptr->current_floor_ptr->base_level;
+       floor_ptr->object_level = floor_ptr->base_level;
 
        /* Empty */
        o_ptr->pval = 0;
@@ -170,7 +170,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
        if (trap & (CHEST_POISON))
        {
                msg_print(_("突如吹き出した緑色のガスに包み込まれた!", "A puff of green gas surrounds you!"));
-               if (!(target_ptr->resist_pois || IS_OPPOSE_POIS()))
+               if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)))
                {
                        (void)set_poisoned(target_ptr, target_ptr->poisoned + 10 + randint1(20));
                }
@@ -196,7 +196,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                        if (randint1(100)<target_ptr->current_floor_ptr->dun_level)
                                activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                        else
-                               (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(target_ptr, 0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                }
        }
 
@@ -206,7 +206,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                msg_print(_("宝を守るためにエレメンタルが現れた!", "Elemental beings appear to protect their treasures!"));
                for (i = 0; i < randint1(3) + 5; i++)
                {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                       (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                }
        }
 
@@ -220,7 +220,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
 
                for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
                {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                       (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                }
        }
 
@@ -234,7 +234,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                        for (i = 0; i < randint1(3) + 2; i++)
                        {
                                (void)fire_meteor(target_ptr, -1, GF_FIRE, y, x, 10, 5);
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        }
                }
 
@@ -244,7 +244,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                        msg_print(_("暗闇にドラゴンの影がぼんやりと現れた!", "Draconic forms loom out of the darkness!"));
                        for (i = 0; i < randint1(3) + 2; i++)
                        {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        }
                }
 
@@ -254,7 +254,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                        msg_print(_("奇妙な姿の怪物が襲って来た!", "Creatures strange and twisted assault you!"));
                        for (i = 0; i < randint1(5) + 3; i++)
                        {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        }
                }
 
@@ -264,7 +264,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
                        msg_print(_("渦巻が合体し、破裂した!", "Vortices coalesce and wreak destruction!"));
                        for (i = 0; i < randint1(3) + 2; i++)
                        {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        }
                }
        }