OSDN Git Service

[Refactor] #38995 world_type 構造体に turn を game_turn に改名して取り込む。 / Rename turn to game_t...
[hengbandforosx/hengbandosx.git] / src / chest.c
index b017db3..6f7fa97 100644 (file)
@@ -1,5 +1,6 @@
 
 #include "angband.h"
+#include "spells-summon.h"
 
 /*!
 * @brief 箱からアイテムを引き出す /
@@ -16,7 +17,7 @@
 * Small chests often contain "gold", while Large chests always contain
 * items.  Wooden chests contain 2 items, Iron chests contain 4 items,
 * and Steel chests contain 6 items.  The "value" of the items in a
-* chest is based on the "power" of the chest, which is in turn based
+* chest is based on the "power" of the chest, which is in current_world_ptr->game_turn based
 * on the level on which the chest is generated.
 * </pre>
 */
@@ -30,7 +31,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
        object_type forge;
        object_type *q_ptr;
 
-       object_type *o_ptr = &o_list[o_idx];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
 
        /* Small chests often hold "gold" */
@@ -44,12 +45,12 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
                number = 5;
                small = FALSE;
                mode |= AM_GREAT;
-               object_level = o_ptr->xtra3;
+               current_floor_ptr->object_level = o_ptr->xtra3;
        }
        else
        {
                /* Determine the "value" of the items */
-               object_level = ABS(o_ptr->pval) + 10;
+               current_floor_ptr->object_level = ABS(o_ptr->pval) + 10;
        }
 
        /* Zero pval means empty chest */
@@ -61,10 +62,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
        /* Drop some objects (non-chests) */
        for (; number > 0; --number)
        {
-               /* Get local object */
                q_ptr = &forge;
-
-               /* Wipe the object */
                object_wipe(q_ptr);
 
                /* Small chests often drop gold */
@@ -106,7 +104,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
        }
 
        /* Reset the object level */
-       object_level = base_level;
+       current_floor_ptr->object_level = current_floor_ptr->base_level;
 
        /* No longer opening a chest */
        opening_chest = FALSE;
@@ -136,7 +134,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, trap;
 
-       object_type *o_ptr = &o_list[o_idx];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
        int mon_level = o_ptr->xtra3;
 
@@ -189,10 +187,10 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                msg_print(_("突如吹き出した煙に包み込まれた!", "You are enveloped in a cloud of smoke!"));
                for (i = 0; i < num; i++)
                {
-                       if (randint1(100)<dun_level)
+                       if (randint1(100)<current_floor_ptr->dun_level)
                                activate_hi_summon(p_ptr->y, p_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(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                }
        }
 
@@ -202,7 +200,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                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(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                }
        }
 
@@ -216,7 +214,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
 
                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(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                }
        }
 
@@ -230,7 +228,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                        for (i = 0; i < randint1(3) + 2; i++)
                        {
                                (void)fire_meteor(-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(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        }
                }
 
@@ -240,7 +238,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                        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(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        }
                }
 
@@ -250,7 +248,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                        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(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        }
                }
 
@@ -260,7 +258,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                        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(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        }
                }
        }
@@ -271,7 +269,6 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
                /* Determine how many nasty tricks can be played. */
                int nasty_tricks_count = 4 + randint0(3);
 
-               /* Message. */
                msg_print(_("恐ろしい声が響いた:  「暗闇が汝をつつまん!」", "Hideous voices bid:  'Let the darkness have thee!'"));
                /* This is gonna hurt... */
                for (; nasty_tricks_count > 0; nasty_tricks_count--)