OSDN Git Service

[Refactor] #37353 chest_traps を trap.c へ移動。
[hengband/hengband.git] / src / chest.c
index eb64820..b2cacba 100644 (file)
-\r
-#include "angband.h"\r
-\r
-/*!\r
-* @brief \94 \82©\82ç\83A\83C\83e\83\80\82ð\88ø\82«\8fo\82· /\r
-* Allocates objects upon opening a chest    -BEN-\r
-* @param scatter TRUE\82È\82ç\82Î\83g\83\89\83b\83v\82É\82æ\82é\83A\83C\83e\83\80\82Ì\8ag\8eU\8f\88\97\9d\r
-* @param y \94 \82Ì\91\8dÝ\82·\82é\83}\83X\82ÌY\8dÀ\95W\r
-* @param x \94 \82Ì\91\8dÝ\82·\82é\83}\83X\82ÌX\8dÀ\95W\r
-* @param o_idx \94 \82Ì\83I\83u\83W\83F\83N\83gID\r
-* @return \82È\82µ\r
-* @details\r
-* <pre>\r
-* Disperse treasures from the given chest, centered at (x,y).\r
-*\r
-* Small chests often contain "gold", while Large chests always contain\r
-* items.  Wooden chests contain 2 items, Iron chests contain 4 items,\r
-* and Steel chests contain 6 items.  The "value" of the items in a\r
-* chest is based on the "power" of the chest, which is in turn based\r
-* on the level on which the chest is generated.\r
-* </pre>\r
-*/\r
-void chest_death(bool scatter, int y, int x, s16b o_idx)\r
-{\r
-       int number;\r
-\r
-       bool small;\r
-       BIT_FLAGS mode = AM_GOOD;\r
-\r
-       object_type forge;\r
-       object_type *q_ptr;\r
-\r
-       object_type *o_ptr = &o_list[o_idx];\r
-\r
-\r
-       /* Small chests often hold "gold" */\r
-       small = (o_ptr->sval < SV_CHEST_MIN_LARGE);\r
-\r
-       /* Determine how much to drop (see above) */\r
-       number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;\r
-\r
-       if (o_ptr->sval == SV_CHEST_KANDUME)\r
-       {\r
-               number = 5;\r
-               small = FALSE;\r
-               mode |= AM_GREAT;\r
-               object_level = o_ptr->xtra3;\r
-       }\r
-       else\r
-       {\r
-               /* Determine the "value" of the items */\r
-               object_level = ABS(o_ptr->pval) + 10;\r
-       }\r
-\r
-       /* Zero pval means empty chest */\r
-       if (!o_ptr->pval) number = 0;\r
-\r
-       /* Opening a chest */\r
-       opening_chest = TRUE;\r
-\r
-       /* Drop some objects (non-chests) */\r
-       for (; number > 0; --number)\r
-       {\r
-               /* Get local object */\r
-               q_ptr = &forge;\r
-\r
-               /* Wipe the object */\r
-               object_wipe(q_ptr);\r
-\r
-               /* Small chests often drop gold */\r
-               if (small && (randint0(100) < 25))\r
-               {\r
-                       /* Make some gold */\r
-                       if (!make_gold(q_ptr)) continue;\r
-               }\r
-\r
-               /* Otherwise drop an item */\r
-               else\r
-               {\r
-                       /* Make a good object */\r
-                       if (!make_object(q_ptr, mode)) continue;\r
-               }\r
-\r
-               /* If chest scatters its contents, pick any floor square. */\r
-               if (scatter)\r
-               {\r
-                       int i;\r
-                       for (i = 0; i < 200; i++)\r
-                       {\r
-                               /* Pick a totally random spot. */\r
-                               y = randint0(MAX_HGT);\r
-                               x = randint0(MAX_WID);\r
-\r
-                               /* Must be an empty floor. */\r
-                               if (!cave_empty_bold(y, x)) continue;\r
-\r
-                               /* Place the object there. */\r
-                               drop_near(q_ptr, -1, y, x);\r
-\r
-                               /* Done. */\r
-                               break;\r
-                       }\r
-               }\r
-               /* Normally, drop object near the chest. */\r
-               else drop_near(q_ptr, -1, y, x);\r
-       }\r
-\r
-       /* Reset the object level */\r
-       object_level = base_level;\r
-\r
-       /* No longer opening a chest */\r
-       opening_chest = FALSE;\r
-\r
-       /* Empty */\r
-       o_ptr->pval = 0;\r
-\r
-       /* Known */\r
-       object_known(o_ptr);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \94 \82Ì\83g\83\89\83b\83v\8f\88\97\9d /\r
-* Chests have traps too.\r
-* @param y \94 \82Ì\91\8dÝ\82·\82é\83}\83X\82ÌY\8dÀ\95W\r
-* @param x \94 \82Ì\91\8dÝ\82·\82é\83}\83X\82ÌX\8dÀ\95W\r
-* @param o_idx \94 \82Ì\83I\83u\83W\83F\83N\83gID\r
-* @return \82È\82µ\r
-* @details\r
-* <pre>\r
-* Exploding chest destroys contents (and traps).\r
-* Note that the chest itself is never destroyed.\r
-* </pre>\r
-*/\r
-void chest_trap(POSITION y, POSITION x, KIND_OBJECT_IDX o_idx)\r
-{\r
-       int  i, trap;\r
-\r
-       object_type *o_ptr = &o_list[o_idx];\r
-\r
-       int mon_level = o_ptr->xtra3;\r
-\r
-       /* Ignore disarmed chests */\r
-       if (o_ptr->pval <= 0) return;\r
-\r
-       /* Obtain the traps */\r
-       trap = chest_traps[o_ptr->pval];\r
-\r
-       /* Lose strength */\r
-       if (trap & (CHEST_LOSE_STR))\r
-       {\r
-#ifdef JP\r
-               msg_print("\8ed\8a|\82¯\82ç\82ê\82Ä\82¢\82½\8f¬\82³\82È\90j\82É\8eh\82³\82ê\82Ä\82µ\82Ü\82Á\82½\81I");\r
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "\93Å\90j", -1);\r
-#else\r
-               msg_print("A small needle has pricked you!");\r
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);\r
-#endif\r
-\r
-               (void)do_dec_stat(A_STR);\r
-       }\r
-\r
-       /* Lose constitution */\r
-       if (trap & (CHEST_LOSE_CON))\r
-       {\r
-#ifdef JP\r
-               msg_print("\8ed\8a|\82¯\82ç\82ê\82Ä\82¢\82½\8f¬\82³\82È\90j\82É\8eh\82³\82ê\82Ä\82µ\82Ü\82Á\82½\81I");\r
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "\93Å\90j", -1);\r
-#else\r
-               msg_print("A small needle has pricked you!");\r
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);\r
-#endif\r
-\r
-               (void)do_dec_stat(A_CON);\r
-       }\r
-\r
-       /* Poison */\r
-       if (trap & (CHEST_POISON))\r
-       {\r
-               msg_print(_("\93Ë\94@\90\81\82«\8fo\82µ\82½\97Î\90F\82Ì\83K\83X\82É\95ï\82Ý\8d\9e\82Ü\82ê\82½\81I", "A puff of green gas surrounds you!"));\r
-               if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))\r
-               {\r
-                       (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));\r
-               }\r
-       }\r
-\r
-       /* Paralyze */\r
-       if (trap & (CHEST_PARALYZE))\r
-       {\r
-               msg_print(_("\93Ë\94@\90\81\82«\8fo\82µ\82½\89©\90F\82¢\83K\83X\82É\95ï\82Ý\8d\9e\82Ü\82ê\82½\81I", "A puff of yellow gas surrounds you!"));\r
-               if (!p_ptr->free_act)\r
-               {\r
-                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));\r
-               }\r
-       }\r
-\r
-       /* Summon monsters */\r
-       if (trap & (CHEST_SUMMON))\r
-       {\r
-               int num = 2 + randint1(3);\r
-               msg_print(_("\93Ë\94@\90\81\82«\8fo\82µ\82½\89\8c\82É\95ï\82Ý\8d\9e\82Ü\82ê\82½\81I", "You are enveloped in a cloud of smoke!"));\r
-               for (i = 0; i < num; i++)\r
-               {\r
-                       if (randint1(100)<dun_level)\r
-                               activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);\r
-                       else\r
-                               (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-               }\r
-       }\r
-\r
-       /* Elemental summon. */\r
-       if (trap & (CHEST_E_SUMMON))\r
-       {\r
-               msg_print(_("\95ó\82ð\8eç\82é\82½\82ß\82É\83G\83\8c\83\81\83\93\83^\83\8b\82ª\8c»\82ê\82½\81I", "Elemental beings appear to protect their treasures!"));\r
-               for (i = 0; i < randint1(3) + 5; i++)\r
-               {\r
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-               }\r
-       }\r
-\r
-       /* Force clouds, then summon birds. */\r
-       if (trap & (CHEST_BIRD_STORM))\r
-       {\r
-               msg_print(_("\92¹\82Ì\8cQ\82ê\82ª\82 \82È\82½\82ð\8eæ\82è\8aª\82¢\82½\81I", "A storm of birds swirls around you!"));\r
-\r
-               for (i = 0; i < randint1(3) + 3; i++)\r
-                       (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);\r
-\r
-               for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)\r
-               {\r
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-               }\r
-       }\r
-\r
-       /* Various colorful summonings. */\r
-       if (trap & (CHEST_H_SUMMON))\r
-       {\r
-               /* Summon demons. */\r
-               if (one_in_(4))\r
-               {\r
-                       msg_print(_("\89\8a\82Æ\97°\89©\82Ì\89_\82Ì\92\86\82É\88«\96\82\82ª\8ep\82ð\8c»\82µ\82½\81I", "Demons materialize in clouds of fire and brimstone!"));\r
-                       for (i = 0; i < randint1(3) + 2; i++)\r
-                       {\r
-                               (void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);\r
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-                       }\r
-               }\r
-\r
-               /* Summon dragons. */\r
-               else if (one_in_(3))\r
-               {\r
-                       msg_print(_("\88Ã\88Å\82É\83h\83\89\83S\83\93\82Ì\89e\82ª\82Ú\82ñ\82â\82è\82Æ\8c»\82ê\82½\81I", "Draconic forms loom out of the darkness!"));\r
-                       for (i = 0; i < randint1(3) + 2; i++)\r
-                       {\r
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-                       }\r
-               }\r
-\r
-               /* Summon hybrids. */\r
-               else if (one_in_(2))\r
-               {\r
-                       msg_print(_("\8aï\96­\82È\8ep\82Ì\89ö\95¨\82ª\8fP\82Á\82Ä\97\88\82½\81I", "Creatures strange and twisted assault you!"));\r
-                       for (i = 0; i < randint1(5) + 3; i++)\r
-                       {\r
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-                       }\r
-               }\r
-\r
-               /* Summon vortices (scattered) */\r
-               else\r
-               {\r
-                       msg_print(_("\89Q\8aª\82ª\8d\87\91Ì\82µ\81A\94j\97ô\82µ\82½\81I", "Vortices coalesce and wreak destruction!"));\r
-                       for (i = 0; i < randint1(3) + 2; i++)\r
-                       {\r
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Dispel player. */\r
-       if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)\r
-       {\r
-               /* Determine how many nasty tricks can be played. */\r
-               int nasty_tricks_count = 4 + randint0(3);\r
-\r
-               /* Message. */\r
-               msg_print(_("\8b°\82ë\82µ\82¢\90º\82ª\8b¿\82¢\82½:  \81u\88Ã\88Å\82ª\93ð\82ð\82Â\82Â\82Ü\82ñ\81I\81v", "Hideous voices bid:  'Let the darkness have thee!'"));\r
-               /* This is gonna hurt... */\r
-               for (; nasty_tricks_count > 0; nasty_tricks_count--)\r
-               {\r
-                       /* ...but a high saving throw does help a little. */\r
-                       if (randint1(100 + o_ptr->pval * 2) > p_ptr->skill_sav)\r
-                       {\r
-                               if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), _("\94j\96Å\82Ì\83g\83\89\83b\83v\82Ì\95ó\94 ", "a chest dispel-player trap"), -1);\r
-                               else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);\r
-                               else if (one_in_(4))\r
-                               {\r
-                                       if (!p_ptr->free_act)\r
-                                               (void)set_paralyzed(p_ptr->paralyzed + 2 +\r
-                                                       randint0(6));\r
-                                       else\r
-                                               (void)set_stun(p_ptr->stun + 10 +\r
-                                                       randint0(100));\r
-                               }\r
-                               else if (one_in_(3)) apply_disenchant(0);\r
-                               else if (one_in_(2))\r
-                               {\r
-                                       (void)do_dec_stat(A_STR);\r
-                                       (void)do_dec_stat(A_DEX);\r
-                                       (void)do_dec_stat(A_CON);\r
-                                       (void)do_dec_stat(A_INT);\r
-                                       (void)do_dec_stat(A_WIS);\r
-                                       (void)do_dec_stat(A_CHR);\r
-                               }\r
-                               else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Aggravate monsters. */\r
-       if (trap & (CHEST_ALARM))\r
-       {\r
-               msg_print(_("\82¯\82½\82½\82Ü\82µ\82¢\89¹\82ª\96Â\82è\8b¿\82¢\82½\81I", "An alarm sounds!"));\r
-               aggravate_monsters(0);\r
-       }\r
-\r
-       /* Explode */\r
-       if ((trap & (CHEST_EXPLODE)) && o_ptr->k_idx)\r
-       {\r
-               msg_print(_("\93Ë\91R\81A\94 \82ª\94\9a\94­\82µ\82½\81I", "There is a sudden explosion!"));\r
-               msg_print(_("\94 \82Ì\92\86\82Ì\95¨\82Í\82·\82×\82Ä\95²\81X\82É\8dÓ\82¯\8eU\82Á\82½\81I", "Everything inside the chest is destroyed!"));\r
-               o_ptr->pval = 0;\r
-               sound(SOUND_EXPLODE);\r
-               take_hit(DAMAGE_ATTACK, damroll(5, 8), _("\94\9a\94­\82·\82é\94 ", "an exploding chest"), -1);\r
-       }\r
-       /* Scatter contents. */\r
-       if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx)\r
-       {\r
-               msg_print(_("\95ó\94 \82Ì\92\86\90g\82Í\83_\83\93\83W\83\87\83\93\82\82ã\82¤\82É\8eU\97\90\82µ\82½\81I", "The contents of the chest scatter all over the dungeon!"));\r
-               chest_death(TRUE, y, x, o_idx);\r
-               o_ptr->pval = 0;\r
-       }\r
-}\r
-\r
+
+#include "angband.h"
+#include "spells-summon.h"
+#include "trap.h"
+#include "player-status.h"
+
+/*!
+* @brief 箱からアイテムを引き出す /
+* Allocates objects upon opening a chest    -BEN-
+* @param scatter TRUEならばトラップによるアイテムの拡散処理
+* @param y 箱の存在するマスのY座標
+* @param x 箱の存在するマスのX座標
+* @param o_idx 箱のオブジェクトID
+* @return なし
+* @details
+* <pre>
+* Disperse treasures from the given chest, centered at (x,y).
+*
+* 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 current_world_ptr->game_turn based
+* on the level on which the chest is generated.
+* </pre>
+*/
+void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
+{
+       int number;
+
+       bool small;
+       BIT_FLAGS mode = AM_GOOD;
+
+       object_type forge;
+       object_type *q_ptr;
+
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
+
+
+       /* Small chests often hold "gold" */
+       small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
+
+       /* Determine how much to drop (see above) */
+       number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;
+
+       if (o_ptr->sval == SV_CHEST_KANDUME)
+       {
+               number = 5;
+               small = FALSE;
+               mode |= AM_GREAT;
+               current_floor_ptr->object_level = o_ptr->xtra3;
+       }
+       else
+       {
+               /* Determine the "value" of the items */
+               current_floor_ptr->object_level = ABS(o_ptr->pval) + 10;
+       }
+
+       /* Zero pval means empty chest */
+       if (!o_ptr->pval) number = 0;
+
+       /* Opening a chest */
+       opening_chest = TRUE;
+
+       /* Drop some objects (non-chests) */
+       for (; number > 0; --number)
+       {
+               q_ptr = &forge;
+               object_wipe(q_ptr);
+
+               /* Small chests often drop gold */
+               if (small && (randint0(100) < 25))
+               {
+                       /* Make some gold */
+                       if (!make_gold(q_ptr)) continue;
+               }
+
+               /* Otherwise drop an item */
+               else
+               {
+                       /* Make a good object */
+                       if (!make_object(q_ptr, mode)) continue;
+               }
+
+               /* If chest scatters its contents, pick any floor square. */
+               if (scatter)
+               {
+                       int i;
+                       for (i = 0; i < 200; i++)
+                       {
+                               /* Pick a totally random spot. */
+                               y = randint0(MAX_HGT);
+                               x = randint0(MAX_WID);
+
+                               /* Must be an empty floor. */
+                               if (!cave_empty_bold(y, x)) continue;
+
+                               /* Place the object there. */
+                               (void)drop_near(q_ptr, -1, y, x);
+
+                               /* Done. */
+                               break;
+                       }
+               }
+               /* Normally, drop object near the chest. */
+               else (void)drop_near(q_ptr, -1, y, x);
+       }
+
+       /* Reset the object level */
+       current_floor_ptr->object_level = current_floor_ptr->base_level;
+
+       /* No longer opening a chest */
+       opening_chest = FALSE;
+
+       /* Empty */
+       o_ptr->pval = 0;
+
+       /* Known */
+       object_known(o_ptr);
+}
+
+
+/*!
+* @brief 箱のトラップ処理 /
+* Chests have traps too.
+* @param y 箱の存在するマスのY座標
+* @param x 箱の存在するマスのX座標
+* @param o_idx 箱のオブジェクトID
+* @return なし
+* @details
+* <pre>
+* Exploding chest destroys contents (and traps).
+* Note that the chest itself is never destroyed.
+* </pre>
+*/
+void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
+{
+       int i, trap;
+
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
+
+       int mon_level = o_ptr->xtra3;
+
+       /* Ignore disarmed chests */
+       if (o_ptr->pval <= 0) return;
+
+       /* Obtain the traps */
+       trap = chest_traps[o_ptr->pval];
+
+       /* Lose strength */
+       if (trap & (CHEST_LOSE_STR))
+       {
+               msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!"));
+               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1);
+               (void)do_dec_stat(A_STR);
+       }
+
+       /* Lose constitution */
+       if (trap & (CHEST_LOSE_CON))
+       {
+               msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!"));
+               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1);
+               (void)do_dec_stat(A_CON);
+       }
+
+       /* Poison */
+       if (trap & (CHEST_POISON))
+       {
+               msg_print(_("突如吹き出した緑色のガスに包み込まれた!", "A puff of green gas surrounds you!"));
+               if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
+               {
+                       (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
+               }
+       }
+
+       /* Paralyze */
+       if (trap & (CHEST_PARALYZE))
+       {
+               msg_print(_("突如吹き出した黄色いガスに包み込まれた!", "A puff of yellow gas surrounds you!"));
+               if (!p_ptr->free_act)
+               {
+                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
+               }
+       }
+
+       /* Summon monsters */
+       if (trap & (CHEST_SUMMON))
+       {
+               int num = 2 + randint1(3);
+               msg_print(_("突如吹き出した煙に包み込まれた!", "You are enveloped in a cloud of smoke!"));
+               for (i = 0; i < num; i++)
+               {
+                       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), '\0');
+               }
+       }
+
+       /* Elemental summon. */
+       if (trap & (CHEST_E_SUMMON))
+       {
+               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), '\0');
+               }
+       }
+
+       /* Force clouds, then summon birds. */
+       if (trap & (CHEST_BIRD_STORM))
+       {
+               msg_print(_("鳥の群れがあなたを取り巻いた!", "A storm of birds swirls around you!"));
+
+               for (i = 0; i < randint1(3) + 3; i++)
+                       (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
+
+               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), '\0');
+               }
+       }
+
+       /* Various colorful summonings. */
+       if (trap & (CHEST_H_SUMMON))
+       {
+               /* Summon demons. */
+               if (one_in_(4))
+               {
+                       msg_print(_("炎と硫黄の雲の中に悪魔が姿を現した!", "Demons materialize in clouds of fire and brimstone!"));
+                       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), '\0');
+                       }
+               }
+
+               /* Summon dragons. */
+               else if (one_in_(3))
+               {
+                       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), '\0');
+                       }
+               }
+
+               /* Summon hybrids. */
+               else if (one_in_(2))
+               {
+                       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), '\0');
+                       }
+               }
+
+               /* Summon vortices (scattered) */
+               else
+               {
+                       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), '\0');
+                       }
+               }
+       }
+
+       /* Dispel player. */
+       if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
+       {
+               /* Determine how many nasty tricks can be played. */
+               int nasty_tricks_count = 4 + randint0(3);
+
+               msg_print(_("恐ろしい声が響いた:  「暗闇が汝をつつまん!」", "Hideous voices bid:  'Let the darkness have thee!'"));
+               /* This is gonna hurt... */
+               for (; nasty_tricks_count > 0; nasty_tricks_count--)
+               {
+                       /* ...but a high saving throw does help a little. */
+                       if (randint1(100 + o_ptr->pval * 2) > p_ptr->skill_sav)
+                       {
+                               if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), _("破滅のトラップの宝箱", "a chest dispel-player trap"), -1);
+                               else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);
+                               else if (one_in_(4))
+                               {
+                                       if (!p_ptr->free_act)
+                                               (void)set_paralyzed(p_ptr->paralyzed + 2 +
+                                                       randint0(6));
+                                       else
+                                               (void)set_stun(p_ptr->stun + 10 +
+                                                       randint0(100));
+                               }
+                               else if (one_in_(3)) apply_disenchant(0);
+                               else if (one_in_(2))
+                               {
+                                       (void)do_dec_stat(A_STR);
+                                       (void)do_dec_stat(A_DEX);
+                                       (void)do_dec_stat(A_CON);
+                                       (void)do_dec_stat(A_INT);
+                                       (void)do_dec_stat(A_WIS);
+                                       (void)do_dec_stat(A_CHR);
+                               }
+                               else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);
+                       }
+               }
+       }
+
+       /* Aggravate monsters. */
+       if (trap & (CHEST_ALARM))
+       {
+               msg_print(_("けたたましい音が鳴り響いた!", "An alarm sounds!"));
+               aggravate_monsters(0);
+       }
+
+       /* Explode */
+       if ((trap & (CHEST_EXPLODE)) && o_ptr->k_idx)
+       {
+               msg_print(_("突然、箱が爆発した!", "There is a sudden explosion!"));
+               msg_print(_("箱の中の物はすべて粉々に砕け散った!", "Everything inside the chest is destroyed!"));
+               o_ptr->pval = 0;
+               sound(SOUND_EXPLODE);
+               take_hit(DAMAGE_ATTACK, damroll(5, 8), _("爆発する箱", "an exploding chest"), -1);
+       }
+       /* Scatter contents. */
+       if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx)
+       {
+               msg_print(_("宝箱の中身はダンジョンじゅうに散乱した!", "The contents of the chest scatter all over the dungeon!"));
+               chest_death(TRUE, y, x, o_idx);
+               o_ptr->pval = 0;
+       }
+}
+