OSDN Git Service

#37353 狂戦士化の効果をberserk()にまとめる。
[hengband/hengband.git] / src / artifact.c
index 9f81dcc..37f82a2 100644 (file)
@@ -1,65 +1,28 @@
-/*!
   @file artifact.c
   @brief ¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÀ¸À®¤È´ÉÍý / Artifact code
   @date 2013/12/11
   @author
   Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
   This software may be copied and distributed for educational, research, and\n
   not for profit purposes provided that this copyright and statement are\n
   included in all such copies.\n
   2013 Deskull rearranged comment for Doxygen.
+/*!
* @file artifact.c
* @brief アーティファクトの生成と管理 / Artifact code
* @date 2013/12/11
* @author
* Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
* This software may be copied and distributed for educational, research, and\n
* not for profit purposes provided that this copyright and statement are\n
* included in all such copies.\n
* 2013 Deskull rearranged comment for Doxygen.
  */
 
 #include "angband.h"
+#include "cmd-activate.h"
 
+static int suppression_evil_dam(object_type *o_ptr);
+static int weakening_artifact(object_type *o_ptr);
 
-/* Chance of using syllables to form the name instead of the "template" files */
-#define SINDARIN_NAME   10 /*!< ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë¥·¥ó¥À¥ê¥óÌäò¤Ä¤±¤ë¾ò·ïʬ´ô */
-#define TABLE_NAME      20 /*!< ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë´Á»úÌäò¤Ä¤±¤ë¾ò·ïʬ´ô */
-#define A_CURSED        13 /*!< 1/n¤Î³ÎΨ¤ÇÀ¸À®¤Î´¬Êª°Ê³°¤Î¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬¼ö¤¤¤Ä¤­¤Ë¤Ê¤ë¡£ */
-#define WEIRD_LUCK      12 /*!< 1/n¤Î³ÎΨ¤Çrandom_resistance()¤Î½èÍýÃæ¥Ð¥¤¥¢¥¹³°¤ÎÂÑÀ­¤¬¤Ä¤­¡¢create_artifact¤Ç4¤òĶ¤¨¤ëpval¤¬µö²Ä¤µ¤ì¤ë¡£*/
-#define BIAS_LUCK       20 /*!< 1/n¤Î³ÎΨ¤Çrandom_resistance()¤ÇÉղ乤븵ÁÇÂÑÀ­¤¬Ìȱ֤ˤʤë */
-#define IM_LUCK         7 /*!< 1/n¤Î³ÎΨ¤Çrandom_resistance()¤ÇÊ£¿ôÌȱ֤νüµî½èÍý¤¬ÌȽü¤µ¤ì¤ë */
-
-/*! @note
- * Bias luck needs to be higher than weird luck,
- * since it is usually tested several times...
- */
-
-#define ACTIVATION_CHANCE 3 /*!< 1/n¤Î³ÎΨ¤Ç¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ëȯư¤¬Éղ䵤ì¤ë¡£¤¿¤À¤·Ëɶñ¤Ï¤µ¤é¤Ë1/2 */
-
-
-/*!
- * ¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î¥Ð¥¤¥¢¥¹ID¤òÊݴɤ¹¤ë¡£ / Use for biased artifact creation
- */
-static int artifact_bias;
-
-
-/*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˥é¥ó¥À¥à¤ÊǽÎÏ°Ý»ý¤ò°ì¤ÄÉղ乤롣/ Choose one random sustain
- * @details ½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
- */
-void one_sustain(object_type *o_ptr)
-{
-       switch (randint0(6))
-       {
-               case 0: add_flag(o_ptr->art_flags, TR_SUST_STR); break;
-               case 1: add_flag(o_ptr->art_flags, TR_SUST_INT); break;
-               case 2: add_flag(o_ptr->art_flags, TR_SUST_WIS); break;
-               case 3: add_flag(o_ptr->art_flags, TR_SUST_DEX); break;
-               case 4: add_flag(o_ptr->art_flags, TR_SUST_CON); break;
-               case 5: add_flag(o_ptr->art_flags, TR_SUST_CHR); break;
-       }
-}
 
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˥é¥ó¥À¥à¤Ê¾å°ÌÂÑÀ­¤ò°ì¤ÄÉղ乤롣/ Choose one random high resistance
- * @details ½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£¸õÊä¤ÏÆÇ¡¢Á®¸÷¡¢°Å¹õ¡¢ÇËÊÒ¡¢ÌÕÌÜ¡¢º®Íð¡¢ÃϹö¡¢°ø²Ìº®Íð¡¢¥«¥ª¥¹¡¢Îô²½¡¢¶²ÉݤΤ¤¤º¤ì¤«¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトにランダムな上位耐性を一つ付加する。/ Choose one random high resistance
+ * @details 重複の抑止はない。候補は毒、閃光、暗黒、破片、盲目、混乱、地獄、因果混乱、カオス、劣化、恐怖のいずれか。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_high_resistance(object_type *o_ptr)
 {
@@ -81,12 +44,12 @@ void one_high_resistance(object_type *o_ptr)
 }
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˲¦¼Ô¤Î»ØÎظþ¤±¤Î¾å°ÌÂÑÀ­¤ò°ì¤ÄÉղ乤롣/ Choose one random high resistance
- * @details ¸õÊä¤ÏÁ®¸÷¡¢°Å¹õ¡¢ÇËÊÒ¡¢ÌÕÌÜ¡¢º®Íð¡¢ÃϹö¡¢°ø²Ìº®Íð¡¢¥«¥ª¥¹¡¢¶²ÉݤǤ¢¤ê
- * ²¦¼Ô¤Î»ØÎؤˤ¢¤é¤«¤¸¤á¤Ä¤¤¤Æ¤¤¤ëÂÑÀ­¤òone_high_resistance()¤«¤é½ü³°¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£
- * ¥é¥ó¥À¥àÉղ佤Τâ¤Î¤Ë½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに王者の指輪向けの上位耐性を一つ付加する。/ Choose one random high resistance
+ * @details 候補は閃光、暗黒、破片、盲目、混乱、地獄、因果混乱、カオス、恐怖であり
+ * 王者の指輪にあらかじめついている耐性をone_high_resistance()から除外したものである。
+ * ランダム付加そのものに重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_lordly_high_resistance(object_type *o_ptr)
 {
@@ -106,10 +69,10 @@ void one_lordly_high_resistance(object_type *o_ptr)
 }
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˸µÁÇÂÑÀ­¤ò°ì¤ÄÉղ乤롣/ Choose one random element resistance
- * @details ¸õÊä¤Ï²Ð±ê¡¢Î䵤¡¢ÅÅ·â¡¢»À¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに元素耐性を一つ付加する。/ Choose one random element resistance
+ * @details 候補は火炎、冷気、電撃、酸のいずれかであり、重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_ele_resistance(object_type *o_ptr)
 {
@@ -123,10 +86,10 @@ void one_ele_resistance(object_type *o_ptr)
 }
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˥ɥ饴¥óÁõÈ÷¸þ¤±¸µÁÇÂÑÀ­¤ò°ì¤ÄÉղ乤롣/ Choose one random element or poison resistance
- * @details ¸õÊä¤Ï1/7¤Î³ÎΨ¤ÇÆÇ¡¢6/7¤Î³ÎΨ¤Ç²Ð±ê¡¢Î䵤¡¢ÅÅ·â¡¢»À¤Î¤¤¤º¤ì¤«(one_ele_resistance()¤Î¥³¡¼¥ë)¤Ç¤¢¤ê¡¢½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトにドラゴン装備向け元素耐性を一つ付加する。/ Choose one random element or poison resistance
+ * @details 候補は1/7の確率で毒、6/7の確率で火炎、冷気、電撃、酸のいずれか(one_ele_resistance()のコール)であり、重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_dragon_ele_resistance(object_type *o_ptr)
 {
@@ -141,36 +104,36 @@ void one_dragon_ele_resistance(object_type *o_ptr)
 }
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤ˼夤ESP¤ò°ì¤ÄÉղ乤롣/ Choose one lower rank esp
- * @details ¸õÊä¤Ïưʪ¡¢¥¢¥ó¥Ç¥Ã¥É¡¢°­Ëâ¡¢¥ª¡¼¥¯¡¢¥È¥í¥ë¡¢µð¿Í¡¢
- * ¥É¥é¥´¥ó¡¢¿Í´Ö¡¢Á±ÎÉ¡¢¥æ¥Ë¡¼¥¯ESP¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに弱いESPを一つ付加する。/ Choose one lower rank esp
+ * @details 候補は動物、アンデッド、悪魔、オーク、トロル、巨人、
+ * ドラゴン、人間、善良、ユニークESPのいずれかであり、重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_low_esp(object_type *o_ptr)
 {
        switch (randint1(10))
        {
-       case 1:  add_flag(o_ptr->art_flags, TR_ESP_ANIMAL);   break;
-       case 2:  add_flag(o_ptr->art_flags, TR_ESP_UNDEAD);   break;
-       case 3:  add_flag(o_ptr->art_flags, TR_ESP_DEMON);   break;
-       case 4:  add_flag(o_ptr->art_flags, TR_ESP_ORC);   break;
-       case 5:  add_flag(o_ptr->art_flags, TR_ESP_TROLL);   break;
-       case 6:  add_flag(o_ptr->art_flags, TR_ESP_GIANT);   break;
-       case 7:  add_flag(o_ptr->art_flags, TR_ESP_DRAGON);   break;
-       case 8:  add_flag(o_ptr->art_flags, TR_ESP_HUMAN);   break;
-       case 9:  add_flag(o_ptr->art_flags, TR_ESP_GOOD);   break;
-       case 10: add_flag(o_ptr->art_flags, TR_ESP_UNIQUE);   break;
+               case 1:  add_flag(o_ptr->art_flags, TR_ESP_ANIMAL);   break;
+               case 2:  add_flag(o_ptr->art_flags, TR_ESP_UNDEAD);   break;
+               case 3:  add_flag(o_ptr->art_flags, TR_ESP_DEMON);   break;
+               case 4:  add_flag(o_ptr->art_flags, TR_ESP_ORC);   break;
+               case 5:  add_flag(o_ptr->art_flags, TR_ESP_TROLL);   break;
+               case 6:  add_flag(o_ptr->art_flags, TR_ESP_GIANT);   break;
+               case 7:  add_flag(o_ptr->art_flags, TR_ESP_DRAGON);   break;
+               case 8:  add_flag(o_ptr->art_flags, TR_ESP_HUMAN);   break;
+               case 9:  add_flag(o_ptr->art_flags, TR_ESP_GOOD);   break;
+               case 10: add_flag(o_ptr->art_flags, TR_ESP_UNIQUE);   break;
        }
 }
 
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤËÂÑÀ­¤ò°ì¤ÄÉղ乤롣/ Choose one random resistance
- * @details 1/3¤Ç¸µÁÇÂÑÀ­(one_ele_resistance())¡¢2/3¤Ç¾å°ÌÂÑÀ­(one_high_resistance)
- * ¤ò¥³¡¼¥ë¤¹¤ë¡£½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに耐性を一つ付加する。/ Choose one random resistance
+ * @details 1/3で元素耐性(one_ele_resistance())、2/3で上位耐性(one_high_resistance)
+ * をコールする。重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_resistance(object_type *o_ptr)
 {
@@ -186,11 +149,11 @@ void one_resistance(object_type *o_ptr)
 
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤËǽÎϤò°ì¤ÄÉղ乤롣/ Choose one random ability
- * @details ¸õÊä¤ÏÉâÍ·¡¢±Êµ×¸÷¸»+1¡¢Æ©ÌÀ»ë¡¢·Ù¹ð¡¢Ãپò½¡¢µÞ²óÉü¡¢ËãáãÃΤ餺¡¢À¸Ì¿ÎÏ°Ý»ý¤Î¤¤¤º¤ì¤«¡£
- * ½ÅÊ£¤ÎÍ޻ߤϤʤ¤¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに能力を一つ付加する。/ Choose one random ability
+ * @details 候補は浮遊、永久光源+1、透明視、警告、遅消化、急回復、麻痺知らず、経験値維持のいずれか。
+ * 重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_ability(object_type *o_ptr)
 {
@@ -203,7 +166,7 @@ void one_ability(object_type *o_ptr)
        case 4: add_flag(o_ptr->art_flags, TR_SLOW_DIGEST); break;
        case 5: add_flag(o_ptr->art_flags, TR_REGEN);       break;
        case 6: add_flag(o_ptr->art_flags, TR_FREE_ACT);    break;
-       case 7: add_flag(o_ptr->art_flags, TR_HOLD_LIFE);   break;
+       case 7: add_flag(o_ptr->art_flags, TR_HOLD_EXP);   break;
        case 8:
        case 9:
                one_low_esp(o_ptr);
@@ -212,11 +175,11 @@ void one_ability(object_type *o_ptr)
 }
 
 /*!
- * @brief ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤËȯư¤ò°ì¤ÄÉղ乤롣/ Choose one random activation
- * @details ¸õÊä¿¿ô¡£¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î¥Ð¥¤¥¢¥¹¤Ë¤Ï°ìÀڰ͸¤»¤º¡¢
- * while¥ë¡¼¥×¤Ë¤è¤ë¹½Â¤¤ÇǽÎÏŪ¤Ë¶¯ÎϤʤâ¤Î¤Û¤É³ÎΨ¤òÍî¤È¤·¤Æ¤¤¤ë¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief 対象のオブジェクトに発動を一つ付加する。/ Choose one random activation
+ * @details 候補多数。ランダムアーティファクトのバイアスには一切依存せず、
+ * whileループによる構造で能力的に強力なものほど確率を落としている。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_activation(object_type *o_ptr)
 {
@@ -251,7 +214,7 @@ void one_activation(object_type *o_ptr)
                                break;
                        case ACT_BA_COLD_1:
                        case ACT_BA_FIRE_1:
-                       case ACT_DRAIN_1:
+                       case ACT_HYPODYNAMIA_1:
                        case ACT_TELE_AWAY:
                        case ACT_ESP:
                        case ACT_RESIST_ALL:
@@ -266,18 +229,18 @@ void one_activation(object_type *o_ptr)
                        case ACT_ID_PLAIN:
                                chance = 75;
                                break;
-                       case ACT_DRAIN_2:
-                       case ACT_VAMPIRE_1:
+                       case ACT_HYPODYNAMIA_2:
+                       case ACT_DRAIN_1:
                        case ACT_BO_MISS_2:
                        case ACT_BA_FIRE_2:
-                       case ACT_REST_LIFE:
+                       case ACT_REST_EXP:
                                chance = 66;
                                break;
                        case ACT_BA_FIRE_3:
                        case ACT_BA_COLD_3:
                        case ACT_BA_ELEC_3:
                        case ACT_WHIRLWIND:
-                       case ACT_VAMPIRE_2:
+                       case ACT_DRAIN_2:
                        case ACT_CHARM_ANIMAL:
                                chance = 50;
                                break;
@@ -327,19 +290,19 @@ void one_activation(object_type *o_ptr)
        }
 
        /* A type was chosen... */
-       o_ptr->xtra2 = type;
+       o_ptr->xtra2 = (byte_hack)type;
        add_flag(o_ptr->art_flags, TR_ACTIVATE);
        o_ptr->timeout = 0;
 }
 
 /*!
- * @brief ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÀ¸À®Ãæ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤò¼ö¤¤¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë¤¹¤ë·Ð²á½èÍý¡£/ generation process of cursed artifact.
- * @details pval¡¢AC¡¢Ì¿Ãæ¡¢¥À¥á¡¼¥¸¤¬Àµ¤Î¾ì¹ç¡¢Éä¹æȿž¤Î¾å1d4¤À¤±°­²½¤µ¤»¡¢½Å¤¤¼ö¤¤¡¢¼ö¤¤¥Õ¥é¥°¤òɬ¤ºÉղá£
- * ½ËÊ¡¤ò̵¸ú¡£³ÎΨ¤Ë±þ¤¸¤Æ¡¢±Ê±ó¤Î¼ö¤¤¡¢ÂÀ¸Å¤Î±åÇ°¡¢·Ð¸³Ã͵ۼý¡¢¼å¤¤¼ö¤¤¤Î·Ñ³ŪÉղᢶ¯¤¤¼ö¤¤¤Î·Ñ³ŪÉղá¢HPµÛ¼ý¤Î¼ö¤¤¡¢
- * MPµÛ¼ý¤Î¼ö¤¤¡¢Íð¥Æ¥ì¥Ý¡¼¥È¡¢È¿¥Æ¥ì¥Ý¡¼¥È¡¢È¿ËâË¡¤ò¤Ä¤±¤ë¡£
- * @attention ¥×¥ì¥¤¥ä¡¼¤Î¿¦¶È°Í¸½èÍý¤¢¤ê¡£
- * @param o_ptr ÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂÎ
- * @return ¤Ê¤·
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトを呪いのアーティファクトにする経過処理。/ generation process of cursed artifact.
+ * @details pval、AC、命中、ダメージが正の場合、符号反転の上1d4だけ悪化させ、重い呪い、呪いフラグを必ず付加。
+ * 祝福を無効。確率に応じて、永遠の呪い、太古の怨念、経験値吸収、弱い呪いの継続的付加、強い呪いの継続的付加、HP吸収の呪い、
+ * MP吸収の呪い、乱テレポート、反テレポート、反魔法をつける。
+ * @attention プレイヤーの職業依存処理あり。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 static void curse_artifact(object_type * o_ptr)
 {
@@ -366,12 +329,19 @@ static void curse_artifact(object_type * o_ptr)
                add_flag(o_ptr->art_flags, TR_NO_MAGIC);
 }
 
-
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトにpval能力を付加する。/ Add one pval on generation of randam artifact.
+ * @details 優先的に付加されるpvalがランダムアーティファクトバイアスに依存して存在する。
+ * 原則的候補は腕力、知力、賢さ、器用さ、耐久、魅力、探索、隠密、赤外線視力、加速。武器のみ採掘、追加攻撃も候補に入る。
+ * @attention オブジェクトのtval、svalに依存したハードコーディング処理がある。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
 static void random_plus(object_type * o_ptr)
 {
        int this_type = (object_is_weapon_ammo(o_ptr) ? 23 : 19);
 
-       switch (artifact_bias)
+       switch (o_ptr->artifact_bias)
        {
        case BIAS_WARRIOR:
                if (!(have_flag(o_ptr->art_flags, TR_STR)))
@@ -496,7 +466,7 @@ static void random_plus(object_type * o_ptr)
                break;
        }
 
-       if ((artifact_bias == BIAS_MAGE || artifact_bias == BIAS_PRIESTLY) && (o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ROBE))
+       if ((o_ptr->artifact_bias == BIAS_MAGE || o_ptr->artifact_bias == BIAS_PRIESTLY) && (o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ROBE))
        {
                if (!(have_flag(o_ptr->art_flags, TR_DEC_MANA)) && one_in_(3))
                {
@@ -509,61 +479,61 @@ static void random_plus(object_type * o_ptr)
        {
        case 1: case 2:
                add_flag(o_ptr->art_flags, TR_STR);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_STR;
-               else if (!artifact_bias && one_in_(7))
-                       artifact_bias = BIAS_WARRIOR;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_STR;
+               else if (!o_ptr->artifact_bias && one_in_(7))
+                       o_ptr->artifact_bias = BIAS_WARRIOR;
                break;
        case 3: case 4:
                add_flag(o_ptr->art_flags, TR_INT);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_INT;
-               else if (!artifact_bias && one_in_(7))
-                       artifact_bias = BIAS_MAGE;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_INT;
+               else if (!o_ptr->artifact_bias && one_in_(7))
+                       o_ptr->artifact_bias = BIAS_MAGE;
                break;
        case 5: case 6:
                add_flag(o_ptr->art_flags, TR_WIS);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_WIS;
-               else if (!artifact_bias && one_in_(7))
-                       artifact_bias = BIAS_PRIESTLY;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_WIS;
+               else if (!o_ptr->artifact_bias && one_in_(7))
+                       o_ptr->artifact_bias = BIAS_PRIESTLY;
                break;
        case 7: case 8:
                add_flag(o_ptr->art_flags, TR_DEX);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_DEX;
-               else if (!artifact_bias && one_in_(7))
-                       artifact_bias = BIAS_ROGUE;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_DEX;
+               else if (!o_ptr->artifact_bias && one_in_(7))
+                       o_ptr->artifact_bias = BIAS_ROGUE;
                break;
        case 9: case 10:
                add_flag(o_ptr->art_flags, TR_CON);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_CON;
-               else if (!artifact_bias && one_in_(9))
-                       artifact_bias = BIAS_RANGER;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_CON;
+               else if (!o_ptr->artifact_bias && one_in_(9))
+                       o_ptr->artifact_bias = BIAS_RANGER;
                break;
        case 11: case 12:
                add_flag(o_ptr->art_flags, TR_CHR);
-               if (!artifact_bias && !one_in_(13))
-                       artifact_bias = BIAS_CHR;
+               if (!o_ptr->artifact_bias && !one_in_(13))
+                       o_ptr->artifact_bias = BIAS_CHR;
                break;
        case 13: case 14:
                add_flag(o_ptr->art_flags, TR_STEALTH);
-               if (!artifact_bias && one_in_(3))
-                       artifact_bias = BIAS_ROGUE;
+               if (!o_ptr->artifact_bias && one_in_(3))
+                       o_ptr->artifact_bias = BIAS_ROGUE;
                break;
        case 15: case 16:
                add_flag(o_ptr->art_flags, TR_SEARCH);
-               if (!artifact_bias && one_in_(9))
-                       artifact_bias = BIAS_RANGER;
+               if (!o_ptr->artifact_bias && one_in_(9))
+                       o_ptr->artifact_bias = BIAS_RANGER;
                break;
        case 17: case 18:
                add_flag(o_ptr->art_flags, TR_INFRA);
                break;
        case 19:
                add_flag(o_ptr->art_flags, TR_SPEED);
-               if (!artifact_bias && one_in_(11))
-                       artifact_bias = BIAS_ROGUE;
+               if (!o_ptr->artifact_bias && one_in_(11))
+                       o_ptr->artifact_bias = BIAS_ROGUE;
                break;
        case 20: case 21:
                add_flag(o_ptr->art_flags, TR_TUNNEL);
@@ -573,17 +543,26 @@ static void random_plus(object_type * o_ptr)
                else
                {
                        add_flag(o_ptr->art_flags, TR_BLOWS);
-                       if (!artifact_bias && one_in_(11))
-                               artifact_bias = BIAS_WARRIOR;
+                       if (!o_ptr->artifact_bias && one_in_(11))
+                               o_ptr->artifact_bias = BIAS_WARRIOR;
                }
                break;
        }
 }
 
-
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトに耐性を付加する。/ Add one resistance on generation of randam artifact.
+ * @details 優先的に付加される耐性がランダムアーティファクトバイアスに依存して存在する。
+ * 原則的候補は火炎、冷気、電撃、酸(以上免疫の可能性もあり)、
+ * 毒、閃光、暗黒、破片、轟音、盲目、混乱、地獄、カオス、劣化、恐怖、火オーラ、冷気オーラ、電撃オーラ、反射。
+ * 戦士系バイアスのみ反魔もつく。
+ * @attention オブジェクトのtval、svalに依存したハードコーディング処理がある。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
 static void random_resistance(object_type * o_ptr)
 {
-       switch (artifact_bias)
+       switch (o_ptr->artifact_bias)
        {
        case BIAS_ACID:
                if (!(have_flag(o_ptr->art_flags, TR_RES_ACID)))
@@ -749,8 +728,8 @@ static void random_resistance(object_type * o_ptr)
                        else
                        {
                                add_flag(o_ptr->art_flags, TR_IM_ACID);
-                               if (!artifact_bias)
-                                       artifact_bias = BIAS_ACID;
+                               if (!o_ptr->artifact_bias)
+                                       o_ptr->artifact_bias = BIAS_ACID;
                        }
                        break;
                case 2:
@@ -759,8 +738,8 @@ static void random_resistance(object_type * o_ptr)
                        else
                        {
                                add_flag(o_ptr->art_flags, TR_IM_ELEC);
-                               if (!artifact_bias)
-                                       artifact_bias = BIAS_ELEC;
+                               if (!o_ptr->artifact_bias)
+                                       o_ptr->artifact_bias = BIAS_ELEC;
                        }
                        break;
                case 3:
@@ -769,8 +748,8 @@ static void random_resistance(object_type * o_ptr)
                        else
                        {
                                add_flag(o_ptr->art_flags, TR_IM_COLD);
-                               if (!artifact_bias)
-                                       artifact_bias = BIAS_COLD;
+                               if (!o_ptr->artifact_bias)
+                                       o_ptr->artifact_bias = BIAS_COLD;
                        }
                        break;
                case 4:
@@ -779,53 +758,53 @@ static void random_resistance(object_type * o_ptr)
                        else
                        {
                                add_flag(o_ptr->art_flags, TR_IM_FIRE);
-                               if (!artifact_bias)
-                                       artifact_bias = BIAS_FIRE;
+                               if (!o_ptr->artifact_bias)
+                                       o_ptr->artifact_bias = BIAS_FIRE;
                        }
                        break;
                case 5:
                case 6:
                case 13:
                        add_flag(o_ptr->art_flags, TR_RES_ACID);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_ACID;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ACID;
                        break;
                case 7:
                case 8:
                case 14:
                        add_flag(o_ptr->art_flags, TR_RES_ELEC);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_ELEC;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ELEC;
                        break;
                case 9:
                case 10:
                case 15:
                        add_flag(o_ptr->art_flags, TR_RES_FIRE);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_FIRE;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_FIRE;
                        break;
                case 11:
                case 12:
                case 16:
                        add_flag(o_ptr->art_flags, TR_RES_COLD);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_COLD;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_COLD;
                        break;
                case 17:
                case 18:
                        add_flag(o_ptr->art_flags, TR_RES_POIS);
-                       if (!artifact_bias && !one_in_(4))
-                               artifact_bias = BIAS_POIS;
-                       else if (!artifact_bias && one_in_(2))
-                               artifact_bias = BIAS_NECROMANTIC;
-                       else if (!artifact_bias && one_in_(2))
-                               artifact_bias = BIAS_ROGUE;
+                       if (!o_ptr->artifact_bias && !one_in_(4))
+                               o_ptr->artifact_bias = BIAS_POIS;
+                       else if (!o_ptr->artifact_bias && one_in_(2))
+                               o_ptr->artifact_bias = BIAS_NECROMANTIC;
+                       else if (!o_ptr->artifact_bias && one_in_(2))
+                               o_ptr->artifact_bias = BIAS_ROGUE;
                        break;
                case 19:
                case 20:
                        add_flag(o_ptr->art_flags, TR_RES_FEAR);
-                       if (!artifact_bias && one_in_(3))
-                               artifact_bias = BIAS_WARRIOR;
+                       if (!o_ptr->artifact_bias && one_in_(3))
+                               o_ptr->artifact_bias = BIAS_WARRIOR;
                        break;
                case 21:
                        add_flag(o_ptr->art_flags, TR_RES_LITE);
@@ -840,8 +819,8 @@ static void random_resistance(object_type * o_ptr)
                case 25:
                case 26:
                        add_flag(o_ptr->art_flags, TR_RES_CONF);
-                       if (!artifact_bias && one_in_(6))
-                               artifact_bias = BIAS_CHAOS;
+                       if (!o_ptr->artifact_bias && one_in_(6))
+                               o_ptr->artifact_bias = BIAS_CHAOS;
                        break;
                case 27:
                case 28:
@@ -854,8 +833,8 @@ static void random_resistance(object_type * o_ptr)
                case 31:
                case 32:
                        add_flag(o_ptr->art_flags, TR_RES_NETHER);
-                       if (!artifact_bias && one_in_(3))
-                               artifact_bias = BIAS_NECROMANTIC;
+                       if (!o_ptr->artifact_bias && one_in_(3))
+                               o_ptr->artifact_bias = BIAS_NECROMANTIC;
                        break;
                case 33:
                case 34:
@@ -864,8 +843,8 @@ static void random_resistance(object_type * o_ptr)
                case 35:
                case 36:
                        add_flag(o_ptr->art_flags, TR_RES_CHAOS);
-                       if (!artifact_bias && one_in_(2))
-                               artifact_bias = BIAS_CHAOS;
+                       if (!o_ptr->artifact_bias && one_in_(2))
+                               o_ptr->artifact_bias = BIAS_CHAOS;
                        break;
                case 37:
                case 38:
@@ -876,16 +855,16 @@ static void random_resistance(object_type * o_ptr)
                                add_flag(o_ptr->art_flags, TR_SH_ELEC);
                        else
                                random_resistance(o_ptr);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_ELEC;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ELEC;
                        break;
                case 40:
                        if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
                                add_flag(o_ptr->art_flags, TR_SH_FIRE);
                        else
                                random_resistance(o_ptr);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_FIRE;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_FIRE;
                        break;
                case 41:
                        if (o_ptr->tval == TV_SHIELD || o_ptr->tval == TV_CLOAK ||
@@ -899,17 +878,25 @@ static void random_resistance(object_type * o_ptr)
                                add_flag(o_ptr->art_flags, TR_SH_COLD);
                        else
                                random_resistance(o_ptr);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_COLD;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_COLD;
                        break;
        }
 }
 
 
-
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトにその他特性を付加する。/ Add one misc flag on generation of randam artifact.
+ * @details 優先的に付加される耐性がランダムアーティファクトバイアスに依存して存在する。
+ * 原則的候補は各種能力維持、永久光源+1、麻痺知らず、経験値維持、浮遊、透明視、急回復、遅消化、
+ * 乱テレポート、反魔法、反テレポート、警告、テレパシー、各種ESP、一部装備に殺戮修正。
+ * @attention オブジェクトのtval、svalに依存したハードコーディング処理がある。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
 static void random_misc(object_type * o_ptr)
 {
-       switch (artifact_bias)
+       switch (o_ptr->artifact_bias)
        {
        case BIAS_RANGER:
                if (!(have_flag(o_ptr->art_flags, TR_SUST_CON)))
@@ -987,33 +974,33 @@ static void random_misc(object_type * o_ptr)
        {
                case 1:
                        add_flag(o_ptr->art_flags, TR_SUST_STR);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_STR;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_STR;
                        break;
                case 2:
                        add_flag(o_ptr->art_flags, TR_SUST_INT);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_INT;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_INT;
                        break;
                case 3:
                        add_flag(o_ptr->art_flags, TR_SUST_WIS);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_WIS;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_WIS;
                        break;
                case 4:
                        add_flag(o_ptr->art_flags, TR_SUST_DEX);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_DEX;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_DEX;
                        break;
                case 5:
                        add_flag(o_ptr->art_flags, TR_SUST_CON);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_CON;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_CON;
                        break;
                case 6:
                        add_flag(o_ptr->art_flags, TR_SUST_CHR);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_CHR;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_CHR;
                        break;
                case 7:
                case 8:
@@ -1021,11 +1008,11 @@ static void random_misc(object_type * o_ptr)
                        add_flag(o_ptr->art_flags, TR_FREE_ACT);
                        break;
                case 9:
-                       add_flag(o_ptr->art_flags, TR_HOLD_LIFE);
-                       if (!artifact_bias && one_in_(5))
-                               artifact_bias = BIAS_PRIESTLY;
-                       else if (!artifact_bias && one_in_(6))
-                               artifact_bias = BIAS_NECROMANTIC;
+                       add_flag(o_ptr->art_flags, TR_HOLD_EXP);
+                       if (!o_ptr->artifact_bias && one_in_(5))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
+                       else if (!o_ptr->artifact_bias && one_in_(6))
+                               o_ptr->artifact_bias = BIAS_NECROMANTIC;
                        break;
                case 10:
                case 11:
@@ -1065,10 +1052,11 @@ static void random_misc(object_type * o_ptr)
                case 28:
                case 29:
                {
-                       int bonus_h, bonus_d;
+                       HIT_PROB bonus_h;
+                       HIT_POINT bonus_d;
                        add_flag(o_ptr->art_flags, TR_SHOW_MODS);
-                       bonus_h = 4 + (randint1(11));
-                       bonus_d = 4 + (randint1(11));
+                       bonus_h = 4 + (HIT_PROB)(randint1(11));
+                       bonus_d = 4 + (HIT_POINT)(randint1(11));
                        if ((o_ptr->tval != TV_SWORD) && (o_ptr->tval != TV_POLEARM) && (o_ptr->tval != TV_HAFTED) && (o_ptr->tval != TV_DIGGING) && (o_ptr->tval != TV_GLOVES) && (o_ptr->tval != TV_RING))
                        {
                                bonus_h /= 2;
@@ -1093,18 +1081,18 @@ static void random_misc(object_type * o_ptr)
                        {
                        case 1:
                                add_flag(o_ptr->art_flags, TR_ESP_EVIL);
-                               if (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_LAW;
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_LAW;
                                break;
                        case 2:
                                add_flag(o_ptr->art_flags, TR_ESP_NONLIVING);
-                               if (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_MAGE;
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_MAGE;
                                break;
                        case 3:
                                add_flag(o_ptr->art_flags, TR_TELEPATHY);
-                               if (!artifact_bias && one_in_(9))
-                                       artifact_bias = BIAS_MAGE;
+                               if (!o_ptr->artifact_bias && one_in_(9))
+                                       o_ptr->artifact_bias = BIAS_MAGE;
                                break;
                        }
                        break;
@@ -1114,12 +1102,12 @@ static void random_misc(object_type * o_ptr)
                        int idx[3];
                        int n = randint1(3);
 
-                       idx[0] = randint1(8);
+                       idx[0] = randint1(10);
 
-                       idx[1] = randint1(7);
+                       idx[1] = randint1(9);
                        if (idx[1] >= idx[0]) idx[1]++;
 
-                       idx[2] = randint1(6);
+                       idx[2] = randint1(8);
                        if (idx[2] >= idx[0]) idx[2]++;
                        if (idx[2] >= idx[1]) idx[2]++;
 
@@ -1127,15 +1115,15 @@ static void random_misc(object_type * o_ptr)
                        {
                        case 1:
                                add_flag(o_ptr->art_flags, TR_ESP_ANIMAL);
-                               if (!artifact_bias && one_in_(4))
-                                       artifact_bias = BIAS_RANGER;
+                               if (!o_ptr->artifact_bias && one_in_(4))
+                                       o_ptr->artifact_bias = BIAS_RANGER;
                                break;
                        case 2:
                                add_flag(o_ptr->art_flags, TR_ESP_UNDEAD);
-                               if (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_PRIESTLY;
-                               else if (!artifact_bias && one_in_(6))
-                                       artifact_bias = BIAS_NECROMANTIC;
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_PRIESTLY;
+                               else if (!o_ptr->artifact_bias && one_in_(6))
+                                       o_ptr->artifact_bias = BIAS_NECROMANTIC;
                                break;
                        case 3:
                                add_flag(o_ptr->art_flags, TR_ESP_DEMON);
@@ -1150,19 +1138,22 @@ static void random_misc(object_type * o_ptr)
                                add_flag(o_ptr->art_flags, TR_ESP_GIANT);
                                break;
                        case 7:
-                               add_flag(o_ptr->art_flags, TR_ESP_HUMAN);
-                               if (!artifact_bias && one_in_(6))
-                                       artifact_bias = BIAS_ROGUE;
+                               add_flag(o_ptr->art_flags, TR_ESP_DRAGON);
                                break;
                        case 8:
-                               add_flag(o_ptr->art_flags, TR_ESP_GOOD);
-                               if (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_LAW;
+                               add_flag(o_ptr->art_flags, TR_ESP_HUMAN);
+                               if (!o_ptr->artifact_bias && one_in_(6))
+                                       o_ptr->artifact_bias = BIAS_ROGUE;
                                break;
                        case 9:
+                               add_flag(o_ptr->art_flags, TR_ESP_GOOD);
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_LAW;
+                               break;
+                       case 10:
                                add_flag(o_ptr->art_flags, TR_ESP_UNIQUE);
-                               if (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_LAW;
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_LAW;
                                break;
                        }
                        break;
@@ -1170,7 +1161,16 @@ static void random_misc(object_type * o_ptr)
        }
 }
 
-
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトにスレイ効果を付加する。/ Add one slaying on generation of randam artifact.
+ * @details 優先的に付加される耐性がランダムアーティファクトバイアスに依存して存在する。
+ * 原則的候補は強力射、高速射、混沌効果、吸血効果、祝福、投擲しやすい、焼棄、凍結、電撃、溶解、毒殺、
+ * 動物スレイ、邪悪スレイ、悪魔スレイ、不死スレイ、オークスレイ、トロルスレイ、巨人スレイ、ドラゴンスレイ、
+ * *ドラゴンスレイ*、人間スレイ、切れ味、地震、理力。
+ * @attention オブジェクトのtval、svalに依存したハードコーディング処理がある。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
 static void random_slay(object_type *o_ptr)
 {
        if (o_ptr->tval == TV_BOW)
@@ -1182,21 +1182,21 @@ static void random_slay(object_type *o_ptr)
                        case 3:
                                add_flag(o_ptr->art_flags, TR_XTRA_MIGHT);
                                if (!one_in_(7)) remove_flag(o_ptr->art_flags, TR_XTRA_SHOTS);
-                               if (!artifact_bias && one_in_(9))
-                                       artifact_bias = BIAS_RANGER;
+                               if (!o_ptr->artifact_bias && one_in_(9))
+                                       o_ptr->artifact_bias = BIAS_RANGER;
                                break;
                        default:
                                add_flag(o_ptr->art_flags, TR_XTRA_SHOTS);
                                if (!one_in_(7)) remove_flag(o_ptr->art_flags, TR_XTRA_MIGHT);
-                               if (!artifact_bias && one_in_(9))
-                                       artifact_bias = BIAS_RANGER;
+                               if (!o_ptr->artifact_bias && one_in_(9))
+                                       o_ptr->artifact_bias = BIAS_RANGER;
                        break;
                }
 
                return;
        }
 
-       switch (artifact_bias)
+       switch (o_ptr->artifact_bias)
        {
        case BIAS_CHAOS:
                if (!(have_flag(o_ptr->art_flags, TR_CHAOTIC)))
@@ -1314,39 +1314,88 @@ static void random_slay(object_type *o_ptr)
        {
                case 1:
                case 2:
-                       add_flag(o_ptr->art_flags, TR_SLAY_ANIMAL);
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_ANIMAL);
+                       }
                        break;
                case 3:
                case 4:
-                       add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
-                       if (!artifact_bias && one_in_(2))
-                               artifact_bias = BIAS_LAW;
-                       else if (!artifact_bias && one_in_(9))
-                               artifact_bias = BIAS_PRIESTLY;
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_EVIL);
+                       }
+                       else
+                       {
+                       add_flag(o_ptr->art_flags, TR_SLAY_EVIL); 
+                       }
+                       if (!o_ptr->artifact_bias && one_in_(2))
+                               o_ptr->artifact_bias = BIAS_LAW;
+                       else if (!o_ptr->artifact_bias && one_in_(9))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                        break;
                case 5:
                case 6:
-                       add_flag(o_ptr->art_flags, TR_SLAY_UNDEAD);
-                       if (!artifact_bias && one_in_(9))
-                               artifact_bias = BIAS_PRIESTLY;
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_UNDEAD);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_UNDEAD);
+                       }
+                       if (!o_ptr->artifact_bias && one_in_(9))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                        break;
                case 7:
                case 8:
-                       add_flag(o_ptr->art_flags, TR_SLAY_DEMON);
-                       if (!artifact_bias && one_in_(9))
-                               artifact_bias = BIAS_PRIESTLY;
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_DEMON);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_DEMON);
+                       }
+                       if (!o_ptr->artifact_bias && one_in_(9))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                        break;
                case 9:
                case 10:
-                       add_flag(o_ptr->art_flags, TR_SLAY_ORC);
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_ORC);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_ORC);
+                       }
                        break;
                case 11:
                case 12:
-                       add_flag(o_ptr->art_flags, TR_SLAY_TROLL);
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_TROLL);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_TROLL);
+                       }
                        break;
                case 13:
                case 14:
-                       add_flag(o_ptr->art_flags, TR_SLAY_GIANT);
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_GIANT);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_GIANT);
+                       }
                        break;
                case 15:
                case 16:
@@ -1360,8 +1409,8 @@ static void random_slay(object_type *o_ptr)
                        if (o_ptr->tval == TV_SWORD)
                        {
                                add_flag(o_ptr->art_flags, TR_VORPAL);
-                               if (!artifact_bias && one_in_(9))
-                                       artifact_bias = BIAS_WARRIOR;
+                               if (!o_ptr->artifact_bias && one_in_(9))
+                                       o_ptr->artifact_bias = BIAS_WARRIOR;
                        }
                        else
                                random_slay(o_ptr);
@@ -1372,65 +1421,77 @@ static void random_slay(object_type *o_ptr)
                case 21:
                case 22:
                        add_flag(o_ptr->art_flags, TR_BRAND_FIRE);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_FIRE;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_FIRE;
                        break;
                case 23:
                case 24:
                        add_flag(o_ptr->art_flags, TR_BRAND_COLD);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_COLD;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_COLD;
                        break;
                case 25:
                case 26:
                        add_flag(o_ptr->art_flags, TR_BRAND_ELEC);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_ELEC;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ELEC;
                        break;
                case 27:
                case 28:
                        add_flag(o_ptr->art_flags, TR_BRAND_ACID);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_ACID;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ACID;
                        break;
                case 29:
                case 30:
                        add_flag(o_ptr->art_flags, TR_BRAND_POIS);
-                       if (!artifact_bias && !one_in_(3))
-                               artifact_bias = BIAS_POIS;
-                       else if (!artifact_bias && one_in_(6))
-                               artifact_bias = BIAS_NECROMANTIC;
-                       else if (!artifact_bias)
-                               artifact_bias = BIAS_ROGUE;
+                       if (!o_ptr->artifact_bias && !one_in_(3))
+                               o_ptr->artifact_bias = BIAS_POIS;
+                       else if (!o_ptr->artifact_bias && one_in_(6))
+                               o_ptr->artifact_bias = BIAS_NECROMANTIC;
+                       else if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_ROGUE;
                        break;
                case 31:
                        add_flag(o_ptr->art_flags, TR_VAMPIRIC);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_NECROMANTIC;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_NECROMANTIC;
                        break;
                case 32:
                        add_flag(o_ptr->art_flags, TR_FORCE_WEAPON);
-                       if (!artifact_bias)
-                               artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
                        break;
                case 33:
                case 34:
-                       add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
+                       if (one_in_(4))
+                       {
+                               add_flag(o_ptr->art_flags, TR_KILL_HUMAN);
+                       }
+                       else
+                       {
+                               add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
+                       }
                        break;
                default:
                        add_flag(o_ptr->art_flags, TR_CHAOTIC);
-                       if (!artifact_bias)
-                               artifact_bias = BIAS_CHAOS;
+                       if (!o_ptr->artifact_bias)
+                               o_ptr->artifact_bias = BIAS_CHAOS;
                        break;
        }
 }
 
-
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトにバイアスに依存した発動を与える。/ Add one activaton of randam artifact depend on bias.
+ * @details バイアスが無い場合、一部のバイアスの確率によっては one_ability() に処理が移行する。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
 static void give_activation_power(object_type *o_ptr)
 {
        int type = 0, chance = 0;
 
-       switch (artifact_bias)
+       switch (o_ptr->artifact_bias)
        {
                case BIAS_ELEC:
                        if (!one_in_(3))
@@ -1507,7 +1568,7 @@ static void give_activation_power(object_type *o_ptr)
                        else if (one_in_(7))
                                type = ACT_REST_ALL;
                        else if (one_in_(6))
-                               type = ACT_REST_LIFE;
+                               type = ACT_REST_EXP;
                        else
                                type = ACT_CURE_MW;
                        break;
@@ -1525,11 +1586,11 @@ static void give_activation_power(object_type *o_ptr)
                        else if (one_in_(13))
                                type = ACT_SUMMON_UNDEAD;
                        else if (one_in_(9))
-                               type = ACT_VAMPIRE_2;
+                               type = ACT_DRAIN_2;
                        else if (one_in_(6))
                                type = ACT_CHARM_UNDEAD;
                        else
-                               type = ACT_VAMPIRE_1;
+                               type = ACT_DRAIN_1;
                        break;
 
                case BIAS_LAW:
@@ -1600,13 +1661,21 @@ static void give_activation_power(object_type *o_ptr)
        }
 
        /* A type was chosen... */
-       o_ptr->xtra2 = type;
+       o_ptr->xtra2 = (byte_hack)type;
        add_flag(o_ptr->art_flags, TR_ACTIVATE);
        o_ptr->timeout = 0;
 }
 
-
-static void get_random_name(char *return_name, bool armour, int power)
+/*!
+ * @brief ランダムアーティファクト生成中、対象のオブジェクトに名前を与える。/ Set name of randomartifact.
+ * @details 確率によって、シンダリン銘、漢字銘、固定名のいずれか一つが与えられる。
+ * @param o_ptr 処理中のアイテム参照ポインタ
+ * @param return_name 名前を返すための文字列参照ポインタ
+ * @param armour 対象のオブジェクトが防具が否か
+ * @param power 銘の基準となるオブジェクトの価値レベル(0=呪い、1=低位、2=中位、3以上=高位)
+ * @return なし
+ */
+static void get_random_name(object_type *o_ptr, char *return_name, bool armour, int power)
 {
        int prob = randint1(100);
 
@@ -1628,75 +1697,49 @@ static void get_random_name(char *return_name, bool armour, int power)
                                switch (power)
                                {
                                        case 0:
-#ifdef JP
-                                               filename = "a_cursed_j.txt";
-#else
-                                               filename = "a_cursed.txt";
-#endif
+                                               filename = _("a_cursed_j.txt", "a_cursed.txt");
                                                break;
                                        case 1:
-#ifdef JP
-                                               filename = "a_low_j.txt";
-#else
-                                               filename = "a_low.txt";
-#endif
+                                               filename = _("a_low_j.txt", "a_low.txt");
                                                break;
                                        case 2:
-#ifdef JP
-                                               filename = "a_med_j.txt";
-#else
-                                               filename = "a_med.txt";
-#endif
+                                               filename = _("a_med_j.txt", "a_med.txt");
                                                break;
                                        default:
-#ifdef JP
-                                               filename = "a_high_j.txt";
-#else
-                                               filename = "a_high.txt";
-#endif
+                                               filename = _("a_high_j.txt", "a_high.txt");
                                }
                                break;
                        default:
                                switch (power)
                                {
                                        case 0:
-#ifdef JP
-                                               filename = "w_cursed_j.txt";
-#else
-                                               filename = "w_cursed.txt";
-#endif
+                                               filename = _("w_cursed_j.txt", "w_cursed.txt");
                                                break;
                                        case 1:
-#ifdef JP
-                                               filename = "w_low_j.txt";
-#else
-                                               filename = "w_low.txt";
-#endif
+                                               filename = _("w_low_j.txt", "w_low.txt");
                                                break;
                                        case 2:
-#ifdef JP
-                                               filename = "w_med_j.txt";
-#else
-                                               filename = "w_med.txt";
-#endif
+                                               filename = _("w_med_j.txt", "w_med.txt");
                                                break;
                                        default:
-#ifdef JP
-                                               filename = "w_high_j.txt";
-#else
-                                               filename = "w_high.txt";
-#endif
+                                               filename = _("w_high_j.txt", "w_high.txt");
                                }
                }
 
-               (void)get_rnd_line(filename, artifact_bias, return_name);
+               (void)get_rnd_line(filename, o_ptr->artifact_bias, return_name);
 #ifdef JP
                 if (return_name[0] == 0) get_table_name(return_name);
 #endif
        }
 }
 
-
+/*!
+ * @brief ランダムアーティファクト生成のメインルーチン
+ * @details 既に生成が済んでいるオブジェクトの構造体を、アーティファクトとして強化する。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @param a_scroll アーティファクト生成の巻物上の処理。呪いのアーティファクトが生成対象外となる。
+ * @return 常にTRUE(1)を返す
+ */
 bool create_artifact(object_type *o_ptr, bool a_scroll)
 {
        char    new_name[1024];
@@ -1711,7 +1754,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        int i;
 
        /* Reset artifact bias */
-       artifact_bias = 0;
+       o_ptr->artifact_bias = 0;
 
        /* Nuke enchantments */
        o_ptr->name1 = 0;
@@ -1732,74 +1775,74 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                        case CLASS_SAMURAI:
                        case CLASS_CAVALRY:
                        case CLASS_SMITH:
-                               artifact_bias = BIAS_WARRIOR;
+                               o_ptr->artifact_bias = BIAS_WARRIOR;
                                break;
                        case CLASS_MAGE:
                        case CLASS_HIGH_MAGE:
                        case CLASS_SORCERER:
                        case CLASS_MAGIC_EATER:
                        case CLASS_BLUE_MAGE:
-                               artifact_bias = BIAS_MAGE;
+                               o_ptr->artifact_bias = BIAS_MAGE;
                                break;
                        case CLASS_PRIEST:
-                               artifact_bias = BIAS_PRIESTLY;
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                                break;
                        case CLASS_ROGUE:
                        case CLASS_NINJA:
-                               artifact_bias = BIAS_ROGUE;
+                               o_ptr->artifact_bias = BIAS_ROGUE;
                                warrior_artifact_bias = 25;
                                break;
                        case CLASS_RANGER:
                        case CLASS_SNIPER:
-                               artifact_bias = BIAS_RANGER;
+                               o_ptr->artifact_bias = BIAS_RANGER;
                                warrior_artifact_bias = 30;
                                break;
                        case CLASS_PALADIN:
-                               artifact_bias = BIAS_PRIESTLY;
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                                warrior_artifact_bias = 40;
                                break;
                        case CLASS_WARRIOR_MAGE:
                        case CLASS_RED_MAGE:
-                               artifact_bias = BIAS_MAGE;
+                               o_ptr->artifact_bias = BIAS_MAGE;
                                warrior_artifact_bias = 40;
                                break;
                        case CLASS_CHAOS_WARRIOR:
-                               artifact_bias = BIAS_CHAOS;
+                               o_ptr->artifact_bias = BIAS_CHAOS;
                                warrior_artifact_bias = 40;
                                break;
                        case CLASS_MONK:
                        case CLASS_FORCETRAINER:
-                               artifact_bias = BIAS_PRIESTLY;
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                                break;
                        case CLASS_MINDCRAFTER:
                        case CLASS_BARD:
-                               if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
+                               if (randint1(5) > 2) o_ptr->artifact_bias = BIAS_PRIESTLY;
                                break;
                        case CLASS_TOURIST:
-                               if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
+                               if (randint1(5) > 2) o_ptr->artifact_bias = BIAS_WARRIOR;
                                break;
                        case CLASS_IMITATOR:
-                               if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
+                               if (randint1(2) > 1) o_ptr->artifact_bias = BIAS_RANGER;
                                break;
                        case CLASS_BEASTMASTER:
-                               artifact_bias = BIAS_CHR;
+                               o_ptr->artifact_bias = BIAS_CHR;
                                warrior_artifact_bias = 50;
                                break;
                        case CLASS_MIRROR_MASTER:
                                if (randint1(4) > 1) 
                                {
-                                   artifact_bias = BIAS_MAGE;
+                                   o_ptr->artifact_bias = BIAS_MAGE;
                                }
                                else
                                {
-                                   artifact_bias = BIAS_ROGUE;
+                                   o_ptr->artifact_bias = BIAS_ROGUE;
                                }
                                break;
                }
        }
 
        if (a_scroll && (randint1(100) <= warrior_artifact_bias))
-               artifact_bias = BIAS_WARRIOR;
+               o_ptr->artifact_bias = BIAS_WARRIOR;
 
        strcpy(new_name, "");
 
@@ -1883,6 +1926,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                        o_ptr->pval = 4;
        }
 
+
        /* give it some plusses... */
        if (object_is_armour(o_ptr))
                o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
@@ -1926,7 +1970,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                }
        }
 
-       if (((artifact_bias == BIAS_MAGE) || (artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES)) add_flag(o_ptr->art_flags, TR_FREE_ACT);
+       if (((o_ptr->artifact_bias == BIAS_MAGE) || (o_ptr->artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES)) add_flag(o_ptr->art_flags, TR_FREE_ACT);
 
        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
        {
@@ -1970,14 +2014,20 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                else power_level = 3;
        }
 
+       /* 平均対邪ダメージが一定以上なら11/12(WEIRD_LUCK)でダメージ抑制処理を行う */
+       if(suppression_evil_dam(o_ptr) && !one_in_(WEIRD_LUCK) && object_is_weapon(o_ptr))
+       {
+               msg_format_wizard(CHEAT_OBJECT, "アーティファクトの抑制処理を行います。");
+               do
+               {
+                       if (weakening_artifact(o_ptr) == 0) break;
+               } while (suppression_evil_dam(o_ptr));
+       }
+
        if (a_scroll)
        {
                char dummy_name[80] = "";
-#ifdef JP
-               cptr ask_msg = "¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©";
-#else
-               cptr ask_msg = "What do you want to call the artifact? ";
-#endif
+               cptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
 
                /* Identify it fully */
                object_aware(o_ptr);
@@ -2004,44 +2054,20 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                                get_table_name_aux(dummy_name);
                        }
                }
-
-#ifdef JP
-               sprintf(new_name, "¡Ô%s¡Õ", dummy_name);
-#else
-               sprintf(new_name, "'%s'", dummy_name);
-#endif
-
+               sprintf(new_name, _("《%s》", "'%s'"), dummy_name);
                chg_virtue(V_INDIVIDUALISM, 2);
                chg_virtue(V_ENCHANT, 5);
        }
        else
        {
-               get_random_name(new_name, object_is_armour(o_ptr), power_level);
+               get_random_name(o_ptr, new_name, object_is_armour(o_ptr), power_level);
        }
 
        /* Save the inscription */
        o_ptr->art_name = quark_add(new_name);
 
-       if (cheat_xtra)
-       {
-               char o_name[MAX_NLEN];
-
-               object_aware(o_ptr);
-               object_known(o_ptr);
-
-               /* Mark the item as fully known */
-               o_ptr->ident |= (IDENT_MENTAL);
-
-               /* Description */
-               object_desc(o_name, o_ptr, 0);
-
-#ifdef JP
-               msg_format("¥Ñ¥ï¡¼ %d ¤Ç ²ÁÃÍ%ld ¤Î¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÀ¸À® ¥Ð¥¤¥¢¥¹¤Ï¡Ö%s¡×:", max_powers, total_flags, artifact_bias_name[artifact_bias]);
-#else
-               msg_format("Random artifact generated '%s'. (Power:%d, Value:%ld) :", artifact_bias_name[artifact_bias], max_powers, total_flags);
-#endif
-               msg_format("%s", o_name);
-       }
+       msg_format_wizard(CHEAT_OBJECT, _("パワー %d で 価値%ld のランダムアーティファクト生成 バイアスは「%s」",
+               "Random artifact generated - Power:%d Value:%d Bias:%s."), max_powers, total_flags, artifact_bias_name[o_ptr->artifact_bias]);
 
        /* Window stuff */
        p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -2049,13 +2075,19 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        return TRUE;
 }
 
-
+/*!
+ * @brief オブジェクトから能力発動IDを取得する。
+ * @details いくつかのケースで定義されている発動効果から、
+ * 鍛冶師による付与>固定アーティファクト>エゴ>ランダムアーティファクト>ベースアイテムの優先順位で走査していく。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return 発動効果のIDを返す
+ */
 int activation_index(object_type *o_ptr)
 {
        /* Give priority to weaponsmith's essential activations */
        if (object_is_smith(o_ptr))
        {
-               switch (o_ptr->xtra3-1)
+               switch (o_ptr->xtra3 - 1)
                {
                case ESSENCE_TMP_RES_ACID: return ACT_RESIST_ACID;
                case ESSENCE_TMP_RES_ELEC: return ACT_RESIST_ELEC;
@@ -2090,6 +2122,12 @@ int activation_index(object_type *o_ptr)
        return o_ptr->xtra2;
 }
 
+/*!
+ * @brief オブジェクトから発動効果構造体のポインタを取得する。
+ * @details activation_index() 関数の結果から参照する。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return 発動効果構造体のポインタを返す
+ */
 const activation_type* find_activation_info(object_type *o_ptr)
 {
        const int index = activation_index(o_ptr);
@@ -2105,1860 +2143,299 @@ const activation_type* find_activation_info(object_type *o_ptr)
        return NULL;
 }
 
-
-/* Dragon breath activation */
-static bool activate_dragon_breath(object_type *o_ptr)
+/*!
+ * @brief 固定アーティファクト生成時の特別なハードコーディング処理を行う。.
+ * @details random_artifact_resistance()とあるが実際は固定アーティファクトである。
+ * 対象は恐怖の仮面、村正、ロビントンのハープ、龍争虎鬪、ブラッディムーン、羽衣、天女の羽衣、ミリム、
+ * その他追加耐性、特性追加処理。
+ * @attention プレイヤーの各種ステータスに依存した処理がある。
+ * @todo 折を見て関数名を変更すること。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @param a_ptr 生成する固定アーティファクト構造体ポインタ
+ * @return なし
+ */
+void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
 {
-       u32b flgs[TR_FLAG_SIZE]; /* for resistance flags */
-       int type[20];
-       cptr name[20];
-       int i, dir, t, n = 0;
-
-       if (!get_aim_dir(&dir)) return FALSE;
-
-       object_flags(o_ptr, flgs);
+       bool give_resistance = FALSE, give_power = FALSE;
 
-       for (i = 0; dragonbreath_info[i].flag != 0; i++)
+       if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
        {
-               if (have_flag(flgs, dragonbreath_info[i].flag))
+               if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
                {
-                       type[n] = dragonbreath_info[i].type;
-                       name[n] = dragonbreath_info[i].name;
-                       n++;
+                       give_power = TRUE;
+                       give_resistance = TRUE;
+               }
+               else
+               {
+                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
+                       add_flag(o_ptr->art_flags, TR_TY_CURSE);
+                       o_ptr->curse_flags |=
+                           (TRC_CURSED | TRC_HEAVY_CURSE);
+                       o_ptr->curse_flags |= get_curse(2, o_ptr);
+                       return;
                }
        }
 
-       /* Paranoia */
-       if (n == 0) return FALSE;
-
-       /* Stop speaking */
-       if (music_singing_any()) stop_singing();
-       if (hex_spelling_any()) stop_hex_spell_all();
-
-       t = randint0(n);
-       msg_format(_("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe %s."), name[t]);
-       fire_ball(type[t], dir, 250, -4);
+       if (o_ptr->name1 == ART_MURAMASA)
+       {
+               if (p_ptr->pclass != CLASS_SAMURAI)
+               {
+                       add_flag(o_ptr->art_flags, TR_NO_MAGIC);
+                       o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
+               }
+       }
 
-       return TRUE;
-}
+       if (o_ptr->name1 == ART_ROBINTON)
+       {
+               if (p_ptr->pclass == CLASS_BARD)
+               {
+                       add_flag(o_ptr->art_flags, TR_DEC_MANA);
+               }
+       }
 
+       if (o_ptr->name1 == ART_XIAOLONG)
+       {
+               if (p_ptr->pclass == CLASS_MONK)
+                       add_flag(o_ptr->art_flags, TR_BLOWS);
+       }
 
-bool activate_random_artifact(object_type *o_ptr)
-{
-       int plev = p_ptr->lev;
-       int k, dir, dummy = 0;
-       cptr name = k_name + k_info[o_ptr->k_idx].name;
-       const activation_type* const act_ptr = find_activation_info(o_ptr);
-
-       /* Paranoia */
-       if (!act_ptr) {
-               /* Maybe forgot adding information to activation_info table ? */
-               msg_print("Activation information is not found.");
-               return FALSE;
+       if (o_ptr->name1 == ART_BLOOD)
+       {
+               get_bloody_moon_flags(o_ptr);
        }
 
-       /* Activate for attack */
-       switch (act_ptr->index)
+       if (o_ptr->name1 == ART_HEAVENLY_MAIDEN)
        {
-               case ACT_SUNLIGHT:
+               if (p_ptr->psex != SEX_FEMALE)
                {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       msg_print(_("ÂÀÍÛ¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£", "A line of sunlight appears."));
-                       (void)lite_line(dir, damroll(6, 8));
-                       break;
+                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
                }
+       }
 
-               case ACT_BO_MISS_1:
+       if (o_ptr->name1 == ART_MILIM)
+       {
+               if (p_ptr->pseikaku == SEIKAKU_SEXY)
                {
-                       msg_print(_("¤½¤ì¤ÏâÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...", "It glows extremely brightly..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_MISSILE, dir, damroll(2, 6));
-                       break;
+                       o_ptr->pval = 3;
+                       add_flag(o_ptr->art_flags, TR_STR);
+                       add_flag(o_ptr->art_flags, TR_INT);
+                       add_flag(o_ptr->art_flags, TR_WIS);
+                       add_flag(o_ptr->art_flags, TR_DEX);
+                       add_flag(o_ptr->art_flags, TR_CON);
+                       add_flag(o_ptr->art_flags, TR_CHR);
                }
+       }
 
-               case ACT_BA_POIS_1:
-               {
-                       msg_print(_("¤½¤ì¤ÏÇ»Î理Ë̮ư¤·¤Æ¤¤¤ë...","It throbs deep green..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_POIS, dir, 12, 3);
-                       break;
-               }
+       if (a_ptr->gen_flags & (TRG_XTRA_POWER)) give_power = TRUE;
+       if (a_ptr->gen_flags & (TRG_XTRA_H_RES)) give_resistance = TRUE;
+       if (a_ptr->gen_flags & (TRG_XTRA_RES_OR_POWER))
+       {
+               /* Give a resistance OR a power */
+               if (one_in_(2)) give_resistance = TRUE;
+               else give_power = TRUE;
+       }
 
-               case ACT_BO_ELEC_1:
-               {
-                       msg_print(_("¤½¤ì¤Ï²Ð²Ö¤Ëʤ¤ï¤ì¤¿...", "It is covered in sparks..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                       break;
-               }
+       if (give_power)
+       {
+               one_ability(o_ptr);
+       }
 
-               case ACT_BO_ACID_1:
-               {
-                       msg_print(_("¤½¤ì¤Ï»À¤Ëʤ¤ï¤ì¤¿...","It is covered in acid..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ACID, dir, damroll(5, 8));
-                       break;
-               }
+       if (give_resistance)
+       {
+               one_high_resistance(o_ptr);
+       }
+}
 
-               case ACT_BO_COLD_1:
-               {
-                       msg_print(_("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...","It is covered in frost..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_COLD, dir, damroll(6, 8));
-                       break;
-               }
 
-               case ACT_BO_FIRE_1:
-               {
-                       msg_print(_("¤½¤ì¤Ï±ê¤Ëʤ¤ï¤ì¤¿...","It is covered in fire..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                       break;
-               }
+/*!
+ * @brief フロアの指定された位置に固定アーティファクトを生成する。 / Create the artifact of the specified number
+ * @details 固定アーティファクト構造体から基本ステータスをコピーした後、所定の座標でdrop_item()で落とす。
+ * @param a_idx 生成する固定アーティファクト構造体のID
+ * @param y アイテムを落とす地点のy座標
+ * @param x アイテムを落とす地点のx座標
+ * @return 生成が成功したか否か、失敗はIDの不全、ベースアイテムの不全、drop_item()の失敗時に起こる。
+ * @attention この処理はdrop_near()内で普通の固定アーティファクトが重ならない性質に依存する.
+ * 仮に2個以上存在可能かつ装備品以外の固定アーティファクトが作成されれば
+ * drop_near()関数の返り値は信用できなくなる.
+ */
+bool create_named_art(int a_idx, int y, int x)
+{
+       object_type forge;
+       object_type *q_ptr;
+       IDX i;
 
-               case ACT_BA_COLD_1:
-               {
-                       msg_print(_("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...","It is covered in frost..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 48, 2);
-                       break;
-               }
-               
-               case ACT_BA_COLD_2:
-               {
-                       msg_print(_("¤½¤ì¤ÏÀĤ¯·ã¤·¤¯µ±¤¤¤¿...", "It glows an intense blue..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 100, 2);
-                       break;
-               }
-               
-               case ACT_BA_COLD_3:
-               {
-                       msg_print(_("ÌÀ¤ë¤¯Çò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows bright white..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 400, 3);
-                       break;
-               }
+       artifact_type *a_ptr = &a_info[a_idx];
 
-               case ACT_BA_FIRE_1:
-               {
-                       msg_print(_("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...","It glows an intense red..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 72, 2);
-                       break;
-               }
-               
-               case ACT_BA_FIRE_2:
-               {
-                       msg_format(_("%s¤«¤é±ê¤¬¿á¤­½Ð¤·¤¿...", "The %s rages in fire..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 120, 3);
-                       break;
-               }
-               
-               case ACT_BA_FIRE_3:
-               {
-                       msg_print(_("¿¼ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows deep red..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 300, 3);
-                       break;
-               }
-               
-               case ACT_BA_FIRE_4:
-               {
-                       msg_print(_("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...","It glows an intense red..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 100, 2);
-                       break;
-               }
-               
-               case ACT_BA_ELEC_2:
-               {
-                       msg_print(_("Åŵ¤¤¬¥Ñ¥Á¥Ñ¥Á²»¤òΩ¤Æ¤¿...","It crackles with electricity..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ELEC, dir, 100, 3);
-                       break;
-               }
-               
-               case ACT_BA_ELEC_3:
-               {
-                       msg_print(_("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows deep blue..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ELEC, dir, 500, 3);
-                       break;
-               }
-               
-               case ACT_BA_ACID_1:
-               {
-                       msg_print(_("¤½¤ì¤Ï¹õ¤¯·ã¤·¤¯µ±¤¤¤¿...","It glows an intense black..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ACID, dir, 100, 2);
-                       break;
-               }
-               
-               case ACT_BA_NUKE_1:
-               {
-                       msg_print(_("¤½¤ì¤ÏÎФ˷㤷¤¯µ±¤¤¤¿...","It glows an intense green..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_NUKE, dir, 100, 2);
-                       break;
-               }
-               
-               case ACT_DRAIN_1:
-               {
-                       msg_format(_("¤¢¤Ê¤¿¤Ï%s¤ËŨ¤òÄù¤á»¦¤¹¤è¤¦Ì¿¤¸¤¿¡£", "You order the %s to strangle your opponent."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       if (drain_life(dir, 100))
-                       break;
-               }
-
-               case ACT_DRAIN_2:
-               {
-                       msg_print(_("¹õ¤¯µ±¤¤¤Æ¤¤¤ë...", "It glows black..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       drain_life(dir, 120);
-                       break;
-               }
-
-               case ACT_VAMPIRE_1:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       for (dummy = 0; dummy < 3; dummy++)
-                       {
-                               if (drain_life(dir, 50))
-                               hp_player(50);
-                       }
-                       break;
-               }
-
-               case ACT_BO_MISS_2:
-               {
-                       msg_print(_("ËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...", "It grows magical spikes..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ARROW, dir, 150);
-                       break;
-               }
-
-               case ACT_WHIRLWIND:
-               {
-                       {
-                               int y = 0, x = 0;
-                               cave_type       *c_ptr;
-                               monster_type    *m_ptr;
-
-                               for (dir = 0; dir <= 9; dir++)
-                               {
-                                       y = py + ddy[dir];
-                                       x = px + ddx[dir];
-                                       c_ptr = &cave[y][x];
-
-                                       /* Get the monster */
-                                       m_ptr = &m_list[c_ptr->m_idx];
-
-                                       /* Hack -- attack monsters */
-                                       if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
-                                               py_attack(y, x, 0);
-                               }
-                       }
-                       break;
-               }
-
-               case ACT_VAMPIRE_2:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       for (dummy = 0; dummy < 3; dummy++)
-                       {
-                               if (drain_life(dir, 100))
-                               hp_player(100);
-                       }
-                       break;
-               }
-
-
-               case ACT_CALL_CHAOS:
-               {
-                       msg_print(_("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...","It glows in scintillating colours..."));
-                       call_chaos();
-                       break;
-               }
-
-               case ACT_ROCKET:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       msg_print(_("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª", "You launch a rocket!"));
-                       fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
-                       break;
-               }
-
-               case ACT_DISP_EVIL:
-               {
-                       msg_print(_("¿ÀÀ»¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...", "It floods the area with goodness..."));
-                       dispel_evil(p_ptr->lev * 5);
-                       break;
-               }
-
-               case ACT_BA_MISS_3:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       msg_print(_("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe the elements."));
-                       fire_ball(GF_MISSILE, dir, 300, -4);
-                       break;
-               }
-
-               case ACT_DISP_GOOD:
-               {
-                       msg_print(_("¼Ù°­¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...", "It floods the area with evil..."));
-                       dispel_good(p_ptr->lev * 5);
-                       break;
-               }
-
-               case ACT_BO_MANA:
-               {
-                       msg_format(_("%s¤ËËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...", "The %s grows magical spikes..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ARROW, dir, 150);
-                       break;
-               }
-
-               case ACT_BA_WATER:
-               {
-                       msg_format(_("%s¤¬¿¼¤¤ÀÄ¿§¤Ë¸ÝÆ°¤·¤Æ¤¤¤ë...", "The %s throbs deep blue..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_WATER, dir, 200, 3);
-                       break;
-               }
-
-               case ACT_BA_DARK:
-               {
-                       msg_format(_("%s¤¬¿¼¤¤°Ç¤Ëʤ¤ï¤ì¤¿...","The %s is coverd in pitch-darkness..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_DARK, dir, 250, 4);
-                       break;
-               }
-
-               case ACT_BA_MANA:
-               {
-                       msg_format(_("%s¤¬ÀÄÇò¤¯¸÷¤Ã¤¿¡¥¡¥¡¥", "The %s glows pale..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_MANA, dir, 250, 4);
-                       break;
-               }
-
-               case ACT_PESTICIDE:
-               {
-                       msg_print(_("¤¢¤Ê¤¿¤Ï³²Ãî¤ò°ìÁݤ·¤¿¡£","You exterminate small life."));
-                       (void)dispel_monsters(4);
-                       break;
-               }
-
-               case ACT_BLINDING_LIGHT:
-               {
-                       msg_format(_("%s¤¬âÁ¤·¤¤¸÷¤Çµ±¤¤¤¿...", "The %s gleams with blinding light..."), name);
-                       fire_ball(GF_LITE, 0, 300, 6);
-                       confuse_monsters(3 * p_ptr->lev / 2);
-                       break;
-               }
-
-               case ACT_BIZARRE:
-               {
-                       msg_format(_("%s¤Ï¼¿¹õ¤Ëµ±¤¤¤¿...", "The %s glows intensely black..."), name);
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       ring_of_power(dir);
-                       break;
-               }
-
-               case ACT_CAST_BA_STAR:
-               {
-                       int num = damroll(5, 3);
-                       int y, x;
-                       int attempts;
-                       msg_format(_("%s¤¬°ðºÊ¤Çʤ¤ï¤ì¤¿...","The %s is surrounded by lightning..."), name);
-                       for (k = 0; k < num; k++)
-                       {
-                               attempts = 1000;
-
-                               while (attempts--)
-                               {
-                                       scatter(&y, &x, py, px, 4, 0);
-
-                                       if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
-
-                                       if (!player_bold(y, x)) break;
-                               }
-
-                               project(0, 3, y, x, 150, GF_ELEC,
-                                                       (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
-                       }
-
-                       break;
-               }
-
-               case ACT_BLADETURNER:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       msg_print(_("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe the elements."));
-                       fire_ball(GF_MISSILE, dir, 300, -4);
-                       msg_print(_("³»¤¬ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤¿...", "Your armor glows many colours..."));
-                       (void)set_afraid(0);
-                       (void)set_hero(randint1(50) + 50, FALSE);
-                       (void)hp_player(10);
-                       (void)set_blessed(randint1(50) + 50, FALSE);
-                       (void)set_oppose_acid(randint1(50) + 50, FALSE);
-                       (void)set_oppose_elec(randint1(50) + 50, FALSE);
-                       (void)set_oppose_fire(randint1(50) + 50, FALSE);
-                       (void)set_oppose_cold(randint1(50) + 50, FALSE);
-                       (void)set_oppose_pois(randint1(50) + 50, FALSE);
-                       break;
-               }
-
-               case ACT_BR_FIRE:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 200, -2);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
-                       {
-                               (void)set_oppose_fire(randint1(20) + 20, FALSE);
-                       }
-                       break;
-               }
-               case ACT_BR_COLD:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 200, -2);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
-                       {
-                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
-                       }
-                       break;
-               }
-               case ACT_BR_DRAGON:
-               {
-                       if (!activate_dragon_breath(o_ptr)) return FALSE;
-                       break;
-               }
-
-               /* Activate for other offensive action */
-
-               case ACT_CONFUSE:
-               {
-                       msg_print(_("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...", "It glows in scintillating colours..."));
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       confuse_monster(dir, 20);
-                       break;
-               }
-
-               case ACT_SLEEP:
-               {
-                       msg_print(_("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows deep blue..."));
-                       sleep_monsters_touch();
-                       break;
-               }
-
-               case ACT_QUAKE:
-               {
-                       earthquake(py, px, 5);
-                       break;
-               }
-
-               case ACT_TERROR:
-               {
-                       turn_monsters(40 + p_ptr->lev);
-                       break;
-               }
-
-               case ACT_TELE_AWAY:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)fire_beam(GF_AWAY_ALL, dir, plev);
-                       break;
-               }
-
-               case ACT_BANISH_EVIL:
-               {
-                       if (banish_evil(100))
-                       {
-                               msg_print(_("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÎϤ¬¼Ù°­¤òÂǤÁʧ¤Ã¤¿¡ª", "The power of the artifact banishes evil!"));
-                       }
-                       break;
-               }
-
-               case ACT_GENOCIDE:
-               {
-                       msg_print(_("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows deep blue..."));
-                       (void)symbol_genocide(200, TRUE);
-                       break;
-               }
-
-               case ACT_MASS_GENO:
-               {
-                       msg_print(_("¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...", "It lets out a long, shrill note..."));
-                       (void)mass_genocide(200, TRUE);
-                       break;
-               }
-
-               case ACT_SCARE_AREA:
-               {
-                       if (music_singing_any()) stop_singing();
-                       if (hex_spelling_any()) stop_hex_spell_all();
-                       msg_print(_("¤¢¤Ê¤¿¤ÏÎ϶¯¤¤ÆÍÉ÷¤ò¿á¤­ÌĤ餷¤¿¡£¼þ°Ï¤ÎŨ¤¬¿Ì¤¨¾å¤Ã¤Æ¤¤¤ë!",
-                                       "You wind a mighty blast; your enemies tremble!"));
-                       (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
-                       break;
-               }
-
-               case ACT_AGGRAVATE:
-               {
-                       if (o_ptr->name1 == ART_HYOUSIGI)
-                       {
-                               msg_print(_("Çï»ÒÌÚ¤òÂǤä¿¡£", "You beat Your wooden clappers."));
-                       }
-                       else
-                       {
-                               msg_format(_("%s¤ÏÉÔ²÷¤Êʪ²»¤òΩ¤Æ¤¿¡£","The %s sounds an unpleasant noise."), name);
-                       }
-                       aggravate_monsters(0);
-                       break;
-               }
-
-               /* Activate for summoning / charming */
-
-               case ACT_CHARM_ANIMAL:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)charm_animal(dir, plev * 2);
-                       break;
-               }
-
-               case ACT_CHARM_UNDEAD:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)control_one_undead(dir, plev * 2);
-                       break;
-               }
-
-               case ACT_CHARM_OTHER:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)charm_monster(dir, plev * 2);
-                       break;
-               }
-
-               case ACT_CHARM_ANIMALS:
-               {
-                       (void)charm_animals(plev * 2);
-                       break;
-               }
-
-               case ACT_CHARM_OTHERS:
-               {
-                       charm_monsters(plev * 2);
-                       break;
-               }
-
-               case ACT_SUMMON_ANIMAL:
-               {
-                       (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       break;
-               }
-
-               case ACT_SUMMON_PHANTOM:
-               {
-                       msg_print(_("¸¸Îî¤ò¾¤´­¤·¤¿¡£", "You summon a phantasmal servant."));
-                       (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       break;
-               }
-
-               case ACT_SUMMON_ELEMENTAL:
-               {
-                       bool pet = one_in_(3);
-                       u32b mode = 0L;
-
-                       if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-                       if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode))
-                       {
-                               msg_print(_("¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿...", "An elemental materializes..."));
-                               if (pet)
-                                       msg_print(_("¤¢¤Ê¤¿¤ËÉþ½¾¤·¤Æ¤¤¤ë¤è¤¦¤À¡£", "It seems obedient to you."));
-                               else
-                                       msg_print(_("¤½¤ì¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤­¤Ê¤«¤Ã¤¿¡ª", "You fail to control it!"));
-                       }
-
-                       break;
-               }
-
-               case ACT_SUMMON_DEMON:
-               {
-                       bool pet = one_in_(3);
-                       u32b mode = 0L;
-
-                       if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-                       if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, mode))
-                       {
-                               msg_print(_("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£", "The area fills with a stench of sulphur and brimstone."));
-                               if (pet)
-                                       msg_print(_("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×", "'What is thy bidding... Master?'"));
-                               else
-                                       msg_print(_("¡ÖNON SERVIAM! Wretch! ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×", "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
-                       }
-
-                       break;
-               }
-
-               case ACT_SUMMON_UNDEAD:
-               {
-                       bool pet = one_in_(3);
-                       int type;
-                       u32b mode = 0L;
-
-                       type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
-                       if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
-                       if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), type, mode))
-                       {
-                               msg_print(_("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤­»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½­¤ò±¿¤ó¤Ç¤¤¤ë...",
-                                               "Cold winds begin to blow around you, carrying with them the stench of decay..."));
-                               if (pet)
-                               msg_print(_("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª",
-                                               "Ancient, long-dead forms arise from the ground to serve you!"));
-                               else
-                               msg_print(_("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª",
-                                               "'The dead arise... to punish you for disturbing them!'"));
-                       }
-
-                       break;
-               }
-
-               case ACT_SUMMON_HOUND:
-               {
-                       u32b mode = PM_ALLOW_GROUP;
-                       bool pet = !one_in_(5);
-                       if (pet) mode |= PM_FORCE_PET;
-                       else mode |= PM_NO_PET;
-
-                       if (summon_specific((pet ? -1 : 0), py, px, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode))
-                       {
-
-                               if (pet)
-                                       msg_print(_("¥Ï¥¦¥ó¥É¤¬¤¢¤Ê¤¿¤Î²¼ËͤȤ·¤Æ½Ð¸½¤·¤¿¡£",
-                                               "A group of hounds appear as your servant."));
-                               else
-                                       msg_print(_("¥Ï¥¦¥ó¥É¤Ï¤¢¤Ê¤¿¤Ë²ç¤ò¸þ¤±¤Æ¤¤¤ë¡ª",
-                                               "A group of hounds appear as your enemy!"));
-                       }
-
-                       break;
-               }
-
-               case ACT_SUMMON_DAWN:
-               {
-                       msg_print(_("¶Ç¤Î»ÕÃĤò¾¤´­¤·¤¿¡£","You summon the Legion of the Dawn."));
-                       (void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       break;
-               }
-
-               case ACT_SUMMON_OCTOPUS:
-               {
-                       u32b mode = PM_ALLOW_GROUP;
-                       bool pet = !one_in_(5);
-                       if (pet) mode |= PM_FORCE_PET;
-
-                       if (summon_named_creature(0, py, px, MON_JIZOTAKO, mode))
-                       {
-                               if (pet)
-                                       msg_print(_("Âý¤¬¤¢¤Ê¤¿¤Î²¼ËͤȤ·¤Æ½Ð¸½¤·¤¿¡£", "A group of octopuses appear as your servant."));
-                               else
-                                       msg_print(_("Âý¤Ï¤¢¤Ê¤¿¤òâˤó¤Ç¤¤¤ë¡ª", "A group of octopuses appear as your enemy!"));
-                       }
-
-                       break;
-               }
-
-               /* Activate for healing */
-
-               case ACT_CHOIR_SINGS:
-               {
-                       msg_print(_("Å·¹ñ¤Î²Î¤¬Ê¹¤³¤¨¤ë...", "A heavenly choir sings..."));
-                       (void)set_poisoned(0);
-                       (void)set_cut(0);
-                       (void)set_stun(0);
-                       (void)set_confused(0);
-                       (void)set_blind(0);
-                       (void)set_afraid(0);
-                       (void)set_hero(randint1(25) + 25, FALSE);
-                       (void)hp_player(777);
-                       break;
-               }
-
-               case ACT_CURE_LW:
-               {
-                       (void)set_afraid(0);
-                       (void)hp_player(30);
-                       break;
-               }
-
-               case ACT_CURE_MW:
-               {
-                       msg_print(_("¿¼»ç¿§¤Î¸÷¤òȯ¤·¤Æ¤¤¤ë...", "It radiates deep purple..."));
-                       hp_player(damroll(4, 8));
-                       (void)set_cut((p_ptr->cut / 2) - 50);
-                       break;
-               }
-
-               case ACT_CURE_POISON:
-               {
-                       msg_print(_("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows deep blue..."));
-                       (void)set_afraid(0);
-                       (void)set_poisoned(0);
-                       break;
-               }
-
-               case ACT_REST_LIFE:
-               {
-                       msg_print(_("¿¼¹È¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows a deep red..."));
-                       restore_level();
-                       break;
-               }
-
-               case ACT_REST_ALL:
-               {
-                       msg_print(_("Ç»Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows a deep green..."));
-                       (void)do_res_stat(A_STR);
-                       (void)do_res_stat(A_INT);
-                       (void)do_res_stat(A_WIS);
-                       (void)do_res_stat(A_DEX);
-                       (void)do_res_stat(A_CON);
-                       (void)do_res_stat(A_CHR);
-                       (void)restore_level();
-                       break;
-               }
-
-               case ACT_CURE_700:
-               {
-                       msg_print(_("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...","It glows deep blue..."));
-                       msg_print(_("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...","You feel a warm tingling inside..."));
-                       (void)hp_player(700);
-                       (void)set_cut(0);
-                       break;
-               }
-
-               case ACT_CURE_1000:
-               {
-                       msg_print(_("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...","It glows a bright white..."));
-                       msg_print(_("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...","You feel much better..."));
-                       (void)hp_player(1000);
-                       (void)set_cut(0);
-                       break;
-               }
-
-               case ACT_CURING:
-               {
-                       msg_format(_("%s¤ÎÍ¥¤·¤µ¤ËÌþ¤µ¤ì¤ë...", "the %s cures you affectionately ..."), name);
-                       (void)set_poisoned(0);
-                       (void)set_confused(0);
-                       (void)set_blind(0);
-                       (void)set_stun(0);
-                       (void)set_cut(0);
-                       (void)set_image(0);
-
-                       break;
-               }
-
-               case ACT_CURE_MANA_FULL:
-               {
-                       msg_format(_("%s¤¬ÀÄÇò¤¯¸÷¤Ã¤¿¡¥¡¥¡¥","The %s glows pale..."), name);
-                       if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                       {
-                               int i;
-                               for (i = 0; i < EATER_EXT*2; i++)
-                               {
-                                       p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
-                                       if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
-                               }
-                               for (; i < EATER_EXT*3; i++)
-                               {
-                                       int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
-                                       p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval;
-                                       if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
-                               }
-                               msg_print(_("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£", "You feel your head clear."));
-                               p_ptr->window |= (PW_PLAYER);
-                       }
-                       else if (p_ptr->csp < p_ptr->msp)
-                       {
-                               p_ptr->csp = p_ptr->msp;
-                               p_ptr->csp_frac = 0;
-                               msg_print(_("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£", "You feel your head clear."));
-                               p_ptr->redraw |= (PR_MANA);
-                               p_ptr->window |= (PW_PLAYER);
-                               p_ptr->window |= (PW_SPELL);
-                       }
-                       break;
-               }
-
-               /* Activate for timed effect */
-
-               case ACT_ESP:
-               {
-                       (void)set_tim_esp(randint1(30) + 25, FALSE);
-                       break;
-               }
-
-               case ACT_BERSERK:
-               {
-                       (void)set_afraid(0);
-                       (void)set_shero(randint1(25) + 25, FALSE);
-                       /* (void)set_afraid(0);
-                       (void)set_hero(randint1(50) + 50, FALSE);
-                       (void)set_blessed(randint1(50) + 50, FALSE);
-                       o_ptr->timeout = 100 + randint1(100); */
-                       break;
-               }
-
-               case ACT_PROT_EVIL:
-               {
-                       msg_format(_("%s¤«¤é±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...", "The %s lets out a shrill wail..."), name);
-                       k = 3 * p_ptr->lev;
-                       (void)set_protevil(randint1(25) + k, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_ALL:
-               {
-                       msg_print(_("ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows many colours..."));
-                       (void)set_oppose_acid(randint1(40) + 40, FALSE);
-                       (void)set_oppose_elec(randint1(40) + 40, FALSE);
-                       (void)set_oppose_fire(randint1(40) + 40, FALSE);
-                       (void)set_oppose_cold(randint1(40) + 40, FALSE);
-                       (void)set_oppose_pois(randint1(40) + 40, FALSE);
-                       break;
-               }
-
-               case ACT_SPEED:
-               {
-                       msg_print(_("ÌÀ¤ë¤¯Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...", "It glows bright green..."));
-                       (void)set_fast(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               case ACT_XTRA_SPEED:
-               {
-                       msg_print(_("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...", "It glows brightly..."));
-                       (void)set_fast(randint1(75) + 75, FALSE);
-                       break;
-               }
-
-               case ACT_WRAITH:
-               {
-                       set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
-                       break;
-               }
-
-               case ACT_INVULN:
-               {
-                       (void)set_invuln(randint1(8) + 8, FALSE);
-                       break;
-               }
-
-               case ACT_HELO:
-               {
-                       (void)set_afraid(0);
-                       set_hero(randint1(25)+25, FALSE);
-                       hp_player(10);
-                       break;
-               }
-
-               case ACT_HELO_SPEED:
-               {
-                       (void)set_fast(randint1(50) + 50, FALSE);
-                       hp_player(10);
-                       set_afraid(0);
-                       set_hero(randint1(50) + 50, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_ACID:
-               {
-                       msg_format(_("%s¤¬¹õ¤¯µ±¤¤¤¿...", "The %s grows black."), name);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               fire_ball(GF_ACID, dir, 100, 2);
-                       }
-                       (void)set_oppose_acid(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_FIRE:
-               {
-                       msg_format(_("%s¤¬ÀÖ¤¯µ±¤¤¤¿...","The %s grows red."), name);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               fire_ball(GF_FIRE, dir, 100, 2);
-                       }
-                       (void)set_oppose_fire(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_COLD:
-               {
-                       msg_format(_("%s¤¬Çò¤¯µ±¤¤¤¿...","The %s grows white.") , name);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               fire_ball(GF_COLD, dir, 100, 2);
-                       }
-                       (void)set_oppose_cold(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_ELEC:
-               {
-                       msg_format(_("%s¤¬ÀĤ¯µ±¤¤¤¿...", "The %s grows blue."), name);
-                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
-                       {
-                               if (!get_aim_dir(&dir)) return FALSE;
-                               fire_ball(GF_ELEC, dir, 100, 2);
-                       }
-                       (void)set_oppose_elec(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               case ACT_RESIST_POIS:
-               {
-                       msg_format(_("%s¤¬ÎФ˵±¤¤¤¿...", "The %s grows green."), name);
-                       (void)set_oppose_pois(randint1(20) + 20, FALSE);
-                       break;
-               }
-
-               /* Activate for general purpose effect (detection etc.) */
-
-               case ACT_LIGHT:
-               {
-#ifdef JP
-                       msg_format("%s¤«¤éÀ¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...", name);
-#else
-                       msg_format("The %s wells with clear light...", name);
-#endif
-                       lite_area(damroll(2, 15), 3);
-                       break;
-               }
-
-               case ACT_MAP_LIGHT:
-               {
-#ifdef JP
-                       msg_print("âÁ¤·¤¯µ±¤¤¤¿...");
-#else
-                       msg_print("It shines brightly...");
-#endif
-                       map_area(DETECT_RAD_MAP);
-                       lite_area(damroll(2, 15), 3);
-                       break;
-               }
-
-               case ACT_DETECT_ALL:
-               {
-#ifdef JP
-                       msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-                       msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤­¤¿...");
-#else
-                       msg_print("It glows bright white...");
-                       msg_print("An image forms in your mind...");
-#endif
-                       detect_all(DETECT_RAD_DEFAULT);
-                       break;
-               }
-
-               case ACT_DETECT_XTRA:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows brightly...");
-#endif
-                       detect_all(DETECT_RAD_DEFAULT);
-                       probing();
-                       identify_fully(FALSE);
-                       break;
-               }
-
-               case ACT_ID_FULL:
-               {
-#ifdef JP
-                       msg_print("²«¿§¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows yellow...");
-#endif
-                       identify_fully(FALSE);
-                       break;
-               }
-
-               case ACT_ID_PLAIN:
-               {
-                       if (!ident_spell(FALSE)) return FALSE;
-                       break;
-               }
-
-               case ACT_RUNE_EXPLO:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright red...");
-#endif
-                       explosive_rune();
-                       break;
-               }
-
-               case ACT_RUNE_PROT:
-               {
-#ifdef JP
-                       msg_print("¥Ö¥ë¡¼¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows light blue...");
-#endif
-                       warding_glyph();
-                       break;
-               }
-
-               case ACT_SATIATE:
-               {
-                       (void)set_food(PY_FOOD_MAX - 1);
-                       break;
-               }
-
-               case ACT_DEST_DOOR:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright red...");
-#endif
-                       destroy_doors_touch();
-                       break;
-               }
-
-               case ACT_STONE_MUD:
-               {
-#ifdef JP
-                       msg_print("¸ÝÆ°¤·¤Æ¤¤¤ë...");
-#else
-                       msg_print("It pulsates...");
-#endif
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       wall_to_mud(dir, 20 + randint1(30));
-                       break;
-               }
-
-               case ACT_RECHARGE:
-               {
-                       recharge(130);
-                       break;
-               }
-
-               case ACT_ALCHEMY:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤²«¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright yellow...");
-#endif
-                       (void)alchemy();
-                       break;
-               }
-
-               case ACT_DIM_DOOR:
-               {
-#ifdef JP
-                       msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
-#else
-                       msg_print("You open a dimensional gate. Choose a destination.");
-#endif
-                       if (!dimension_door()) return FALSE;
-                       break;
-               }
-
-
-               case ACT_TELEPORT:
-               {
-#ifdef JP
-                       msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ë...");
-#else
-                       msg_print("It twists space around you...");
-#endif
-                       teleport_player(100, 0L);
-                       break;
-               }
-
-               case ACT_RECALL:
-               {
-#ifdef JP
-                       msg_print("¤ä¤ï¤é¤«¤ÊÇò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows soft white...");
-#endif
-                       if (!word_of_recall()) return FALSE;
-                       break;
-               }
-
-               case ACT_JUDGE:
-               {
-#ifdef JP
-                       msg_format("%s¤ÏÀÖ¤¯ÌÀ¤ë¤¯¸÷¤Ã¤¿¡ª", name);
-#else
-                       msg_format("The %s flashes bright red!", name);
-#endif
-                       chg_virtue(V_KNOWLEDGE, 1);
-                       chg_virtue(V_ENLIGHTEN, 1);
-                       wiz_lite(FALSE);
-#ifdef JP
-                       msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòÃ¥¤Ã¤¿...", name);
-                       take_hit(DAMAGE_LOSELIFE, damroll(3,8), "¿³È½¤ÎÊõÀÐ", -1);
-#else
-                       msg_format("The %s drains your vitality...", name);
-                       take_hit(DAMAGE_LOSELIFE, damroll(3, 8), "the Jewel of Judgement", -1);
-#endif
-                       (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-                       (void)detect_doors(DETECT_RAD_DEFAULT);
-                       (void)detect_stairs(DETECT_RAD_DEFAULT);
-#ifdef JP
-                       if (get_check("µ¢´Ô¤ÎÎϤò»È¤¤¤Þ¤¹¤«¡©"))
-#else
-                       if (get_check("Activate recall? "))
-#endif
-                       {
-                               (void)word_of_recall();
-                       }
-
-                       break;
-               }
-
-               case ACT_TELEKINESIS:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-                       msg_format("%s¤ò¿­¤Ð¤·¤¿¡£", name);
-#else
-                       msg_format("You stretched your %s.", name);
-#endif
-                       fetch(dir, 500, TRUE);
-                       break;
-               }
-
-               case ACT_DETECT_UNIQUE:
-               {
-                       int i;
-                       monster_type *m_ptr;
-                       monster_race *r_ptr;
-#ifdef JP
-                       msg_print("´ñ̯¤Ê¾ì½ê¤¬Æ¬¤ÎÃæ¤ËÉ⤫¤ó¤À¡¥¡¥¡¥");
-#else
-                       msg_print("Some strange places show up in your mind. And you see ...");
-#endif
-                       /* Process the monsters (backwards) */
-                       for (i = m_max - 1; i >= 1; i--)
-                       {
-                               /* Access the monster */
-                               m_ptr = &m_list[i];
-
-                               /* Ignore "dead" monsters */
-                               if (!m_ptr->r_idx) continue;
-
-                               r_ptr = &r_info[m_ptr->r_idx];
-
-                               if(r_ptr->flags1 & RF1_UNIQUE)
-                               {
-#ifdef JP
-                                       msg_format("%s¡¥ ",r_name + r_ptr->name);
-#else
-                                       msg_format("%s. ",r_name + r_ptr->name);
-#endif
-                               }
-                       }
-                       break;
-               }
-
-               case ACT_ESCAPE:
-               {
-                       switch (randint1(13))
-                       {
-                       case 1: case 2: case 3: case 4: case 5:
-                               teleport_player(10, 0L);
-                               break;
-                       case 6: case 7: case 8: case 9: case 10:
-                               teleport_player(222, 0L);
-                               break;
-                       case 11: case 12:
-                               (void)stair_creation();
-                               break;
-                       default:
-#ifdef JP
-                               if (get_check("¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©"))
-#else
-                               if (get_check("Leave this level? "))
-#endif
-                               {
-                                       if (autosave_l) do_cmd_save_game(TRUE);
-
-                                       /* Leaving */
-                                       p_ptr->leaving = TRUE;
-                               }
-                       }
-                       break;
-               }
-
-               case ACT_DISP_CURSE_XTRA:
-               {
-#ifdef JP
-                       msg_format("%s¤¬¿¿¼Â¤ò¾È¤é¤·½Ð¤¹...", name);
-#else
-                       msg_format("The %s exhibits the truth...", name);
-#endif
-                       if (remove_all_curse())
-                       {
-#ifdef JP
-                               msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("You feel as if someone is watching over you.");
-#endif
-                       }
-                       (void)probing();
-                       break;
-               }
-
-               case ACT_BRAND_FIRE_BOLTS:
-               {
-#ifdef JP
-                       msg_format("%s¤¬¿¼¹È¤Ëµ±¤¤¤¿...", name);
-#else
-                       msg_format("Your %s glows deep red...", name);
-#endif
-                       (void)brand_bolts();
-                       break;
-               }
-
-               case ACT_RECHARGE_XTRA:
-               {
-#ifdef JP
-                       msg_format("%s¤¬Çò¤¯µ±¤¤¤¿¡¥¡¥¡¥", name);
-#else
-                       msg_format("The %s gleams with blinding light...", name);
-#endif
-                       if (!recharge(1000)) return FALSE;
-                       break;
-               }
-
-               case ACT_LORE:
-               {
-#ifdef JP
-                       msg_print("ÀФ¬±£¤µ¤ì¤¿ÈëÌ©¤ò¼Ì¤·½Ð¤·¤¿¡¥¡¥¡¥");
-#else
-                       msg_print("The stone reveals hidden mysteries...");
-#endif
-                       if (!ident_spell(FALSE)) return FALSE;
-
-                       if (mp_ptr->spell_book)
-                       {
-                               /* Sufficient mana */
-                               if (20 <= p_ptr->csp)
-                               {
-                                       /* Use some mana */
-                                       p_ptr->csp -= 20;
-                               }
-
-                               /* Over-exert the player */
-                               else
-                               {
-                                       int oops = 20 - p_ptr->csp;
-
-                                       /* No mana left */
-                                       p_ptr->csp = 0;
-                                       p_ptr->csp_frac = 0;
-
-                                       /* Message */
-#ifdef JP
-                                       msg_print("ÀФòÀ©¸æ¤Ç¤­¤Ê¤¤¡ª");
-#else
-                                       msg_print("You are too weak to control the stone!");
-#endif
-                                       /* Hack -- Bypass free action */
-                                       (void)set_paralyzed(p_ptr->paralyzed +
-                                               randint1(5 * oops + 1));
-
-                                       /* Confusing. */
-                                       (void)set_confused(p_ptr->confused +
-                                               randint1(5 * oops + 1));
-                               }
-
-                               /* Redraw mana */
-                               p_ptr->redraw |= (PR_MANA);
-                       }
-#ifdef JP
-                       take_hit(DAMAGE_LOSELIFE, damroll(1, 12), "´í¸±¤ÊÈëÌ©", -1);
-#else
-                       take_hit(DAMAGE_LOSELIFE, damroll(1, 12), "perilous secrets", -1);
-#endif
-                       /* Confusing. */
-                       if (one_in_(5)) (void)set_confused(p_ptr->confused +
-                               randint1(10));
-
-                       /* Exercise a little care... */
-                       if (one_in_(20))
-#ifdef JP
-                               take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "´í¸±¤ÊÈëÌ©", -1);
-#else
-                               take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "perilous secrets", -1);
-#endif
-                       break;
-               }
-
-               case ACT_SHIKOFUMI:
-               {
-#ifdef JP
-                       msg_print("Î϶¯¤¯»Í¸Ô¤òƧ¤ó¤À¡£");
-#else
-                       msg_print("You stamp. (as if you are in a ring.)");
-#endif
-                       (void)set_afraid(0);
-                       (void)set_hero(randint1(20) + 20, FALSE);
-                       dispel_evil(p_ptr->lev * 3);
-                       break;
-               }
-
-               case ACT_PHASE_DOOR:
-               {
-                       teleport_player(10, 0L);
-                       break;
-               }
-
-               case ACT_DETECT_ALL_MONS:
-               {
-                       (void)detect_monsters_invis(255);
-                       (void)detect_monsters_normal(255);
-                       break;
-               }
-
-               case ACT_ULTIMATE_RESIST:
-               {
-                       int v = randint1(25)+25;
-                       (void)set_afraid(0);
-                       (void)set_hero(v, FALSE);
-                       (void)hp_player(10);
-                       (void)set_blessed(v, FALSE);
-                       (void)set_oppose_acid(v, FALSE);
-                       (void)set_oppose_elec(v, FALSE);
-                       (void)set_oppose_fire(v, FALSE);
-                       (void)set_oppose_cold(v, FALSE);
-                       (void)set_oppose_pois(v, FALSE);
-                       (void)set_ultimate_res(v, FALSE);
-                       break;
-               }
-
-
-               /* Unique activation */
-               case ACT_CAST_OFF:
-               {
-                       int inv, o_idx, t;
-                       char o_name[MAX_NLEN];
-                       object_type forge;
-
-                       /* Cast off activated item */
-                       for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
-                       {
-                               if (o_ptr == &inventory[inv]) break;
-                       }
-
-                       /* Paranoia */
-                       if (inv > INVEN_FEET) return FALSE;
-
-                       object_copy(&forge, o_ptr);
-                       inven_item_increase(inv, (0 - o_ptr->number));
-                       inven_item_optimize(inv);
-                       o_idx = drop_near(&forge, 0, py, px);
-                       o_ptr = &o_list[o_idx];
-
-                       object_desc(o_name, o_ptr, OD_NAME_ONLY);
-                       msg_format(_("%s¤ò椮¼Î¤Æ¤¿¡£", "You cast off %s."), o_name);
-
-                       /* Get effects */
-                       msg_print(_("¡Ödz¤¨¾å¤¬¤ì²¶¤Î¾®±§Ã衪¡×", "You say, 'Burn up my cosmo!"));
-                       t = 20 + randint1(20);
-                       (void)set_blind(p_ptr->blind + t);
-                       (void)set_afraid(0);
-                       (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
-                       (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
-                       (void)set_hero(p_ptr->hero + t, FALSE);
-                       (void)set_blessed(p_ptr->blessed + t, FALSE);
-                       (void)set_fast(p_ptr->fast + t, FALSE);
-                       (void)set_shero(p_ptr->shero + t, FALSE);
-                       if (p_ptr->pclass == CLASS_FORCETRAINER)
-                       {
-                               p_ptr->magic_num1[0] = plev * 5 + 190;
-                               msg_print(_("µ¤¤¬ÇúȯÀ£Á°¤Ë¤Ê¤Ã¤¿¡£", "Your force are immediatly before explosion."));
-                       }
-
-                       break;
-               }
-
-               case ACT_FALLING_STAR:
-               {
-                       msg_print(_("¤¢¤Ê¤¿¤ÏÍÅÅá¤ËÌ¥Æþ¤é¤ì¤¿¡Ä", "You are enchanted by cursed blade..."));
-                       msg_print(_("¡Ö¶¸¤Û¤·¤¯ ·ì¤Î¤´¤È¤­ ·î¤Ï¤Î¤Ü¤ì¤ê Èë¤á¤ª¤­¤· Ëâ·õ ¤¤¤º¤³¤¾¤ä¡×", "'Behold the blade arts.'"));
-                       massacre(py, px);
-                       break;
-               }
-
-               case ACT_GRAND_CROSS:
-               {
-                       msg_print(_("¡Ö°Ç¤Ë´Ô¤ì¡ª¡×", "You say, 'Return to darkness!'"));
-                       project(0, 8, py, px, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
-                       break;
-               }
-
-               case ACT_TELEPORT_LEVEL:
-               {
-#ifdef JP
-                       if (!get_check("ËÜÅö¤Ë¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©")) return FALSE;
-#else
-                       if (!get_check("Are you sure? (Teleport Level)")) return FALSE;
-#endif
-                       teleport_level(0);
-                       break;
-               }
-
-               case ACT_STRAIN_HASTE:
-               {
-                       int t;
-#ifdef JP
-                       msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòÃ¥¤Ã¤¿...", name);
-                       take_hit(DAMAGE_LOSELIFE, damroll(3, 8), "²Ã®¤·¤¿ÈèÏ«", -1);
-#else
-                       msg_format("The %s drains your vitality...", name);
-                       take_hit(DAMAGE_LOSELIFE, damroll(3, 8), "the strain of haste", -1);
-#endif
-                       t = 25 + randint1(25);
-                       (void)set_fast(p_ptr->fast + t, FALSE);
-                       break;
-               }
-
-               case ACT_FISHING:
-               {
-                       int x, y;
-
-                       if (!get_rep_dir2(&dir)) return FALSE;
-                       y = py+ddy[dir];
-                       x = px+ddx[dir];
-                       tsuri_dir = dir;
-                       if (!cave_have_flag_bold(y, x, FF_WATER))
-                       {
-#ifdef JP
-                               msg_print("¤½¤³¤Ï¿åÊդǤϤʤ¤¡£");
-#else
-                               msg_print("There is no fishing place.");
-#endif
-                               return FALSE;
-                       }
-                       else if (cave[y][x].m_idx)
-                       {
-                               char m_name[80];
-                               monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
-#ifdef JP
-                               msg_format("%s¤¬¼ÙËâ¤À¡ª", m_name);
-#else
-                               msg_format("%^s is stand in your way.", m_name);
-#endif
-                               energy_use = 0;
-                               return FALSE;
-                       }
-                       set_action(ACTION_FISH);
-                       p_ptr->redraw |= (PR_STATE);
-                       break;
-               }
-
-               case ACT_INROU:
-               {
-                       int count = 0, i;
-                       monster_type *m_ptr;
-#ifndef JP
-                       cptr kakusan = "";
-#endif
-                       if (summon_named_creature(0, py, px, MON_SUKE, PM_FORCE_PET))
-                       {
-#ifdef JP
-                               msg_print("¡Ø½õ¤µ¤ó¡Ù¤¬¸½¤ì¤¿¡£");
-#else
-                               msg_print("Suke-san apperars.");
-                               kakusan = "Suke-san";
-#endif
-                               count++;
-                       }
-                       if (summon_named_creature(0, py, px, MON_KAKU, PM_FORCE_PET))
-                       {
-#ifdef JP
-                               msg_print("¡Ø³Ê¤µ¤ó¡Ù¤¬¸½¤ì¤¿¡£");
-#else
-                               msg_print("Kaku-san appears.");
-                               kakusan = "Kaku-san";
-#endif
-                               count++;
-                       }
-                       if (!count)
-                       {
-                               for (i = m_max - 1; i > 0; i--)
-                               {
-                                       m_ptr = &m_list[i];
-                                       if (!m_ptr->r_idx) continue;
-                                       if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
-                                       if (!los(m_ptr->fy, m_ptr->fx, py, px)) continue;
-                                       if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) continue;
-                                       count++;
-                                       break;
-                               }
-                       }
-
-                       if (count)
-                       {
-#ifdef JP
-                               msg_print("¡Ö¼Ô¤É¤â¡¢¤Ò¤«¤¨¤ª¤í¤¦¡ª¡ª¡ª¤³¤Î¤ªÊý¤ò¤É¤Ê¤¿¤È¤³¤³¤í¤¨¤ë¡£¡×");
-#else
-                               msg_format("%^s says 'WHO do you think this person is! Bow your head, down your knees!'", kakusan);
-#endif
-                               sukekaku = TRUE;
-                               stun_monsters(120);
-                               confuse_monsters(120);
-                               turn_monsters(120);
-                               stasis_monsters(120);
-                               sukekaku = FALSE;
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¤·¤«¤·¡¢²¿¤âµ¯¤­¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("Nothing happen.");
-#endif
-                       }
-                       break;
-               }
+       /* Get local object */
+       q_ptr = &forge;
 
-               case ACT_MURAMASA:
-               {
-                       /* Only for Muramasa */
-                       if (o_ptr->name1 != ART_MURAMASA) return FALSE;
-#ifdef JP
-                       if (get_check("ËÜÅö¤Ë»È¤¤¤Þ¤¹¤«¡©"))
-#else
-                       if (get_check("Are you sure?!"))
-#endif
-                       {
-#ifdef JP
-                               msg_print("¼Àµ¤¬¿Ì¤¨¤¿¡¥¡¥¡¥");
-#else
-                               msg_print("The Muramasa pulsates...");
-#endif
-                               do_inc_stat(A_STR);
-                               if (one_in_(2))
-                               {
-#ifdef JP
-                                       msg_print("¼Àµ¤Ï²õ¤ì¤¿¡ª");
-#else
-                                       msg_print("The Muramasa is destroyed!");
-#endif
-                                       curse_weapon_object(TRUE, o_ptr);
-                               }
-                       }
-                       break;
-               }
+       /* Ignore "empty" artifacts */
+       if (!a_ptr->name) return FALSE;
 
-               case ACT_BLOODY_MOON:
-               {
-                       /* Only for Bloody Moon */
-                       if (o_ptr->name1 != ART_BLOOD) return FALSE;
-#ifdef JP
-                       msg_print("³ù¤¬ÌÀ¤ë¤¯µ±¤¤¤¿...");
-#else
-                       msg_print("Your scythe glows brightly!");
-#endif
-                       get_bloody_moon_flags(o_ptr);
-                       if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
-                       p_ptr->update |= (PU_BONUS | PU_HP);
-                       break;
-               }
+       /* Acquire the "kind" index */
+       i = lookup_kind(a_ptr->tval, a_ptr->sval);
 
-               case ACT_CRIMSON:
-               {
-                       int num = 1;
-                       int i;
-                       int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-                       int tx, ty;
+       /* Oops */
+       if (!i) return FALSE;
 
-                       /* Only for Crimson */
-                       if (o_ptr->name1 != ART_CRIMSON) return FALSE;
+       /* Create the artifact */
+       object_prep(q_ptr, i);
 
-#ifdef JP
-                       msg_print("¤»¤Ã¤«¤¯¤À¤«¤é¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¤Ö¤Ã¤Ñ¤Ê¤¹¤¼¡ª");
-#else
-                       msg_print("I'll fire CRIMSON! SEKKAKUDAKARA!");
-#endif
+       /* Save the name */
+       q_ptr->name1 = (byte_hack)a_idx;
 
-                       if (!get_aim_dir(&dir)) return FALSE;
+       /* Extract the fields */
+       q_ptr->pval = a_ptr->pval;
+       q_ptr->ac = a_ptr->ac;
+       q_ptr->dd = a_ptr->dd;
+       q_ptr->ds = a_ptr->ds;
+       q_ptr->to_a = a_ptr->to_a;
+       q_ptr->to_h = a_ptr->to_h;
+       q_ptr->to_d = a_ptr->to_d;
+       q_ptr->weight = a_ptr->weight;
 
-                       /* Use the given direction */
-                       tx = px + 99 * ddx[dir];
-                       ty = py + 99 * ddy[dir];
+       /* Hack -- extract the "cursed" flag */
+       if (a_ptr->gen_flags & TRG_CURSED) q_ptr->curse_flags |= (TRC_CURSED);
+       if (a_ptr->gen_flags & TRG_HEAVY_CURSE) q_ptr->curse_flags |= (TRC_HEAVY_CURSE);
+       if (a_ptr->gen_flags & TRG_PERMA_CURSE) q_ptr->curse_flags |= (TRC_PERMA_CURSE);
+       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE0)) q_ptr->curse_flags |= get_curse(0, q_ptr);
+       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) q_ptr->curse_flags |= get_curse(1, q_ptr);
+       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) q_ptr->curse_flags |= get_curse(2, q_ptr);
 
-                       /* Hack -- Use an actual "target" */
-                       if ((dir == 5) && target_okay())
-                       {
-                               tx = target_col;
-                               ty = target_row;
-                       }
+       random_artifact_resistance(q_ptr, a_ptr);
 
-                       if (p_ptr->pclass == CLASS_ARCHER)
-                       {
-                               /* Extra shot at level 10 */
-                               if (p_ptr->lev >= 10) num++;
+       /* Drop the artifact from heaven */
+       return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
+}
 
-                               /* Extra shot at level 30 */
-                               if (p_ptr->lev >= 30) num++;
+/*対邪平均ダメージの計算処理*/
+int calc_arm_avgdamage(object_type *o_ptr)
+{
+       u32b flgs[TR_FLAG_SIZE];
+       object_flags(o_ptr, flgs);
 
-                               /* Extra shot at level 45 */
-                               if (p_ptr->lev >= 45) num++;
-                       }
+       HIT_POINT dam, base, s_evil, forced, vorpal;
+       dam = base = s_evil = forced = vorpal = 0;
 
-                       for (i = 0; i < num; i++)
-                               project(0, p_ptr->lev/20+1, ty, tx, p_ptr->lev*p_ptr->lev*6/50, GF_ROCKET, flg, -1);
-                       break;
-               }
+       dam = base = (o_ptr->dd * o_ptr->ds + o_ptr->dd) / 2;
 
-               default:
-               {
-#ifdef JP
-                       msg_format("Unknown activation effect: %d.", act_ptr->index);
-#else
-                       msg_format("Unknown activation effect: %d.", act_ptr->index);
-#endif
-                       return FALSE;
-               }
+       if(have_flag(flgs, TR_KILL_EVIL))
+       {
+               dam = s_evil = dam * 7 / 2;
        }
-
-       /* Set activation timeout */
-       if (act_ptr->timeout.constant >= 0) {
-               o_ptr->timeout = act_ptr->timeout.constant;
-               if (act_ptr->timeout.dice > 0) {
-                       o_ptr->timeout += randint1(act_ptr->timeout.dice);
-               }
-       } else {
-               /* Activations that have special timeout */
-               switch (act_ptr->index) {
-               case ACT_BR_FIRE:
-                       o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
-                       break;
-               case ACT_BR_COLD:
-                       o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
-                       break;
-               case ACT_TERROR:
-                       o_ptr->timeout = 3 * (p_ptr->lev + 10);
-                       break;
-               case ACT_MURAMASA:
-                       /* Nothing to do */
-                       break;
-               default:
-                       msg_format("Special timeout is not implemented: %d.", act_ptr->index);
-                       return FALSE;
-               }
+       else if(!have_flag(flgs, TR_KILL_EVIL) && have_flag(flgs, TR_SLAY_EVIL))
+       {       
+               dam = s_evil = dam * 2;
        }
+       else s_evil = dam;
 
-       return TRUE;
-}
-
-
-void get_bloody_moon_flags(object_type *o_ptr)
-{
-       int dummy, i;
-
-       for (i = 0; i < TR_FLAG_SIZE; i++)
-               o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
-
-       dummy = randint1(2) + randint1(2);
-       for (i = 0; i < dummy; i++)
+       if (have_flag(flgs, TR_FORCE_WEAPON))
        {
-               int flag = randint0(26);
-               if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
-               else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
-               else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
-               else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
+               dam = forced = dam * 3 / 2 + (o_ptr->dd * o_ptr->ds + o_ptr->dd);
        }
+       else forced = dam;
 
-       dummy = randint1(2);
-       for (i = 0; i < dummy; i++) one_resistance(o_ptr);
-
-       for (i = 0; i < 2; i++)
+       if(have_flag(flgs, TR_VORPAL))
        {
-               int tmp = randint0(11);
-               if (tmp < 6) add_flag(o_ptr->art_flags, TR_STR + tmp);
-               else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
+               dam = vorpal = dam * 11 / 9;
        }
-}
+       else vorpal = dam;
 
+       dam = dam + o_ptr->to_d;
 
-void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
+       msg_format_wizard(CHEAT_OBJECT,"素:%d> 対邪:%d> 理力:%d> 切:%d> 最終:%d",
+               base, s_evil, forced, vorpal, dam);
+
+       return(dam);
+}
+
+static int suppression_evil_dam(object_type *o_ptr)
 {
-       bool give_resistance = FALSE, give_power = FALSE;
+       int num = FALSE;
+       u32b flgs[TR_FLAG_SIZE];
+       object_flags(o_ptr, flgs);
 
-       if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
+       if (have_flag(flgs, TR_VAMPIRIC))
        {
-               if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
+               if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 52))
                {
-                       give_power = TRUE;
-                       give_resistance = TRUE;
+                       num = TRUE;
                }
-               else
+               else if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 43))
                {
-                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
-                       add_flag(o_ptr->art_flags, TR_TY_CURSE);
-                       o_ptr->curse_flags |=
-                           (TRC_CURSED | TRC_HEAVY_CURSE);
-                       o_ptr->curse_flags |= get_curse(2, o_ptr);
-                       return;
+                       num = TRUE;
                }
-       }
-
-       if (o_ptr->name1 == ART_MURAMASA)
-       {
-               if (p_ptr->pclass != CLASS_SAMURAI)
+               else if( have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 33))
                {
-                       add_flag(o_ptr->art_flags, TR_NO_MAGIC);
-                       o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
+                       num = TRUE;
                }
-       }
-
-       if (o_ptr->name1 == ART_ROBINTON)
-       {
-               if (p_ptr->pclass == CLASS_BARD)
+               else if (calc_arm_avgdamage(o_ptr) > 63)
                {
-                       add_flag(o_ptr->art_flags, TR_DEC_MANA);
+                       num = TRUE;
                }
        }
-
-       if (o_ptr->name1 == ART_XIAOLONG)
-       {
-               if (p_ptr->pclass == CLASS_MONK)
-                       add_flag(o_ptr->art_flags, TR_BLOWS);
-       }
-
-       if (o_ptr->name1 == ART_BLOOD)
-       {
-               get_bloody_moon_flags(o_ptr);
-       }
-
-       if (o_ptr->name1 == ART_HEAVENLY_MAIDEN)
+       else
        {
-               if (p_ptr->psex != SEX_FEMALE)
+               if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 65))
                {
-                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
+                       num = TRUE;
                }
-       }
-
-       if (o_ptr->name1 == ART_MILIM)
-       {
-               if (p_ptr->pseikaku == SEIKAKU_SEXY)
+               else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 52))
                {
-                       o_ptr->pval = 3;
-                       add_flag(o_ptr->art_flags, TR_STR);
-                       add_flag(o_ptr->art_flags, TR_INT);
-                       add_flag(o_ptr->art_flags, TR_WIS);
-                       add_flag(o_ptr->art_flags, TR_DEX);
-                       add_flag(o_ptr->art_flags, TR_CON);
-                       add_flag(o_ptr->art_flags, TR_CHR);
+                       num = TRUE;
+               }
+               else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 40))
+               {
+                       num = TRUE;
+               }
+               else if (calc_arm_avgdamage(o_ptr) > 75)
+               {
+                       num = TRUE;
                }
        }
-
-       if (a_ptr->gen_flags & (TRG_XTRA_POWER)) give_power = TRUE;
-       if (a_ptr->gen_flags & (TRG_XTRA_H_RES)) give_resistance = TRUE;
-       if (a_ptr->gen_flags & (TRG_XTRA_RES_OR_POWER))
-       {
-               /* Give a resistance OR a power */
-               if (one_in_(2)) give_resistance = TRUE;
-               else give_power = TRUE;
-       }
-
-       if (give_power)
-       {
-               one_ability(o_ptr);
-       }
-
-       if (give_resistance)
-       {
-               one_high_resistance(o_ptr);
-       }
+       return(num);
 }
 
-
-/*
- * Create the artifact of the specified number
- */
-bool create_named_art(int a_idx, int y, int x)
+static int weakening_artifact(object_type *o_ptr)
 {
-       object_type forge;
-       object_type *q_ptr;
-       int i;
-
-       artifact_type *a_ptr = &a_info[a_idx];
-
-       /* Get local object */
-       q_ptr = &forge;
-
-       /* Ignore "empty" artifacts */
-       if (!a_ptr->name) return FALSE;
-
-       /* Acquire the "kind" index */
-       i = lookup_kind(a_ptr->tval, a_ptr->sval);
-
-       /* Oops */
-       if (!i) return FALSE;
-
-       /* Create the artifact */
-       object_prep(q_ptr, i);
+        KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
+        object_kind *k_ptr = &k_info[k_idx];
 
-       /* Save the name */
-       q_ptr->name1 = a_idx;
+        if ((k_ptr->dd < o_ptr->dd) || (k_ptr->ds < o_ptr->ds))
+        {
+               int pre_dd = o_ptr->dd;
+               int pre_ds = o_ptr->ds;
 
-       /* Extract the fields */
-       q_ptr->pval = a_ptr->pval;
-       q_ptr->ac = a_ptr->ac;
-       q_ptr->dd = a_ptr->dd;
-       q_ptr->ds = a_ptr->ds;
-       q_ptr->to_a = a_ptr->to_a;
-       q_ptr->to_h = a_ptr->to_h;
-       q_ptr->to_d = a_ptr->to_d;
-       q_ptr->weight = a_ptr->weight;
+               if (o_ptr->dd > o_ptr->ds)
+               {
+                       o_ptr->dd--;
+               }
+               else
+               {
+                       o_ptr->ds--;
+               }
 
-       /* Hack -- extract the "cursed" flag */
-       if (a_ptr->gen_flags & TRG_CURSED) q_ptr->curse_flags |= (TRC_CURSED);
-       if (a_ptr->gen_flags & TRG_HEAVY_CURSE) q_ptr->curse_flags |= (TRC_HEAVY_CURSE);
-       if (a_ptr->gen_flags & TRG_PERMA_CURSE) q_ptr->curse_flags |= (TRC_PERMA_CURSE);
-       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE0)) q_ptr->curse_flags |= get_curse(0, q_ptr);
-       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) q_ptr->curse_flags |= get_curse(1, q_ptr);
-       if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) q_ptr->curse_flags |= get_curse(2, q_ptr);
+               msg_format_wizard(CHEAT_OBJECT, 
+                       _("ダイスが抑制されました。%dd%d -> %dd%d", "Dice Supress %dd%d -> %dd%d"),
+                       pre_dd, pre_ds, o_ptr->dd, o_ptr->ds);
+               return 1;
+       }
+       
+       if (o_ptr->to_d > 10)
+       {
+               int pre_damage = o_ptr->to_d;
 
-       random_artifact_resistance(q_ptr, a_ptr);
+               o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
+               if (o_ptr->to_d < 10)
+               {
+                       o_ptr->to_d = 10;
+               }
 
-       /*
-        * drop_near()Æâ¤ÇÉáÄ̤θÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬½Å¤Ê¤é¤Ê¤¤À­¼Á¤Ë°Í¸¤¹¤ë.
-        * ²¾¤Ë2¸Ä°Ê¾å¸ºß²Äǽ¤«¤ÄÁõÈ÷Éʰʳ°¤Î¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬ºîÀ®¤µ¤ì¤ì¤Ð
-        * ¤³¤Î´Ø¿ô¤ÎÊÖ¤êÃͤϿ®ÍѤǤ­¤Ê¤¯¤Ê¤ë.
-        */
+               msg_format_wizard(CHEAT_OBJECT,
+                       _("ダメージ修正が抑制されました。 %d -> %d", "Plus-Damage Supress %d -> %d"),
+                       pre_damage, o_ptr->to_d);
 
-       /* Drop the artifact from heaven */
-       return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
-}
+               return 1;
+        }
+        return 0;
+}
\ No newline at end of file