OSDN Git Service

#37353 狂戦士化の効果をberserk()にまとめる。
[hengband/hengband.git] / src / artifact.c
index bb28dd0..37f82a2 100644 (file)
@@ -1,56 +1,28 @@
-/* Purpose: Artifact code */
-
-/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
- *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+/*!
+ * @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
-#define WEIRD_LUCK      12
-#define BIAS_LUCK       20
-#define IM_LUCK         7
-
-/*
- * Bias luck needs to be higher than weird luck,
- * since it is usually tested several times...
- */
-#define ACTIVATION_CHANCE 3
-
-
-/*
- * Use for biased artifact creation
- */
-static int artifact_bias;
-
-
-/*
- * Choose one random sustain
- */
-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;
-       }
-}
 
 
-/*
- * Choose one random high resistance
+/*!
+ * @brief 対象のオブジェクトにランダムな上位耐性を一つ付加する。/ Choose one random high resistance
+ * @details 重複の抑止はない。候補は毒、閃光、暗黒、破片、盲目、混乱、地獄、因果混乱、カオス、劣化、恐怖のいずれか。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_high_resistance(object_type *o_ptr)
 {
@@ -71,9 +43,13 @@ void one_high_resistance(object_type *o_ptr)
        }
 }
 
-
-/*
- * Choose one random high resistance ( except poison and disenchantment )
+/*!
+ * @brief 対象のオブジェクトに王者の指輪向けの上位耐性を一つ付加する。/ Choose one random high resistance
+ * @details 候補は閃光、暗黒、破片、盲目、混乱、地獄、因果混乱、カオス、恐怖であり
+ * 王者の指輪にあらかじめついている耐性をone_high_resistance()から除外したものである。
+ * ランダム付加そのものに重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_lordly_high_resistance(object_type *o_ptr)
 {
@@ -92,9 +68,11 @@ void one_lordly_high_resistance(object_type *o_ptr)
        }
 }
 
-
-/*
- * Choose one random element resistance
+/*!
+ * @brief 対象のオブジェクトに元素耐性を一つ付加する。/ Choose one random element resistance
+ * @details 候補は火炎、冷気、電撃、酸のいずれかであり、重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_ele_resistance(object_type *o_ptr)
 {
@@ -107,9 +85,11 @@ void one_ele_resistance(object_type *o_ptr)
        }
 }
 
-
-/*
- * Choose one random element or poison resistance
+/*!
+ * @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)
 {
@@ -123,30 +103,37 @@ void one_dragon_ele_resistance(object_type *o_ptr)
        }
 }
 
-
-/*
- * Choose one lower rank esp
+/*!
+ * @brief 対象のオブジェクトに弱いESPを一つ付加する。/ Choose one lower rank esp
+ * @details 候補は動物、アンデッド、悪魔、オーク、トロル、巨人、
+ * ドラゴン、人間、善良、ユニークESPのいずれかであり、重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_low_esp(object_type *o_ptr)
 {
-       switch (randint1(9))
+       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 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;
        }
 }
 
 
-
-/*
- * Choose one random resistance
+/*!
+ * @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)
 {
@@ -161,21 +148,25 @@ void one_resistance(object_type *o_ptr)
 }
 
 
-/*
- * Choose one random ability
+/*!
+ * @brief 対象のオブジェクトに能力を一つ付加する。/ Choose one random ability
+ * @details 候補は浮遊、永久光源+1、透明視、警告、遅消化、急回復、麻痺知らず、経験値維持のいずれか。
+ * 重複の抑止はない。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
  */
 void one_ability(object_type *o_ptr)
 {
        switch (randint0(10))
        {
-       case 0: add_flag(o_ptr->art_flags, TR_LEVITATION);     break;
-       case 1: add_flag(o_ptr->art_flags, TR_LITE);        break;
+       case 0: add_flag(o_ptr->art_flags, TR_LEVITATION);  break;
+       case 1: add_flag(o_ptr->art_flags, TR_LITE_1);      break;
        case 2: add_flag(o_ptr->art_flags, TR_SEE_INVIS);   break;
        case 3: add_flag(o_ptr->art_flags, TR_WARNING);     break;
        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);
@@ -183,7 +174,136 @@ void one_ability(object_type *o_ptr)
        }
 }
 
+/*!
+ * @brief 対象のオブジェクトに発動を一つ付加する。/ Choose one random activation
+ * @details 候補多数。ランダムアーティファクトのバイアスには一切依存せず、
+ * whileループによる構造で能力的に強力なものほど確率を落としている。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return なし
+ */
+void one_activation(object_type *o_ptr)
+{
+       int type = 0;
+       int chance = 0;
+
+       while (randint1(100) >= chance)
+       {
+               type = randint1(255);
+               switch (type)
+               {
+                       case ACT_SUNLIGHT:
+                       case ACT_BO_MISS_1:
+                       case ACT_BA_POIS_1:
+                       case ACT_BO_ELEC_1:
+                       case ACT_BO_ACID_1:
+                       case ACT_BO_COLD_1:
+                       case ACT_BO_FIRE_1:
+                       case ACT_CONFUSE:
+                       case ACT_SLEEP:
+                       case ACT_QUAKE:
+                       case ACT_CURE_LW:
+                       case ACT_CURE_MW:
+                       case ACT_CURE_POISON:
+                       case ACT_BERSERK:
+                       case ACT_LIGHT:
+                       case ACT_MAP_LIGHT:
+                       case ACT_DEST_DOOR:
+                       case ACT_STONE_MUD:
+                       case ACT_TELEPORT:
+                               chance = 101;
+                               break;
+                       case ACT_BA_COLD_1:
+                       case ACT_BA_FIRE_1:
+                       case ACT_HYPODYNAMIA_1:
+                       case ACT_TELE_AWAY:
+                       case ACT_ESP:
+                       case ACT_RESIST_ALL:
+                       case ACT_DETECT_ALL:
+                       case ACT_RECALL:
+                       case ACT_SATIATE:
+                       case ACT_RECHARGE:
+                               chance = 85;
+                               break;
+                       case ACT_TERROR:
+                       case ACT_PROT_EVIL:
+                       case ACT_ID_PLAIN:
+                               chance = 75;
+                               break;
+                       case ACT_HYPODYNAMIA_2:
+                       case ACT_DRAIN_1:
+                       case ACT_BO_MISS_2:
+                       case ACT_BA_FIRE_2:
+                       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_DRAIN_2:
+                       case ACT_CHARM_ANIMAL:
+                               chance = 50;
+                               break;
+                       case ACT_SUMMON_ANIMAL:
+                               chance = 40;
+                               break;
+                       case ACT_DISP_EVIL:
+                       case ACT_BA_MISS_3:
+                       case ACT_DISP_GOOD:
+                       case ACT_BANISH_EVIL:
+                       case ACT_GENOCIDE:
+                       case ACT_MASS_GENO:
+                       case ACT_CHARM_UNDEAD:
+                       case ACT_CHARM_OTHER:
+                       case ACT_SUMMON_PHANTOM:
+                       case ACT_REST_ALL:
+                       case ACT_RUNE_EXPLO:
+                               chance = 33;
+                               break;
+                       case ACT_CALL_CHAOS:
+                       case ACT_ROCKET:
+                       case ACT_CHARM_ANIMALS:
+                       case ACT_CHARM_OTHERS:
+                       case ACT_SUMMON_ELEMENTAL:
+                       case ACT_CURE_700:
+                       case ACT_SPEED:
+                       case ACT_ID_FULL:
+                       case ACT_RUNE_PROT:
+                               chance = 25;
+                               break;
+                       case ACT_CURE_1000:
+                       case ACT_XTRA_SPEED:
+                       case ACT_DETECT_XTRA:
+                       case ACT_DIM_DOOR:
+                               chance = 10;
+                               break;
+                       case ACT_SUMMON_UNDEAD:
+                       case ACT_SUMMON_DEMON:
+                       case ACT_WRAITH:
+                       case ACT_INVULN:
+                       case ACT_ALCHEMY:
+                               chance = 5;
+                               break;
+                       default:
+                               chance = 0;
+               }
+       }
+
+       /* A type was chosen... */
+       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 なし
+ */
 static void curse_artifact(object_type * o_ptr)
 {
        if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint1(4));
@@ -198,6 +318,10 @@ static void curse_artifact(object_type * o_ptr)
        if (one_in_(3)) add_flag(o_ptr->art_flags, TR_TY_CURSE);
        if (one_in_(2)) add_flag(o_ptr->art_flags, TR_AGGRAVATE);
        if (one_in_(3)) add_flag(o_ptr->art_flags, TR_DRAIN_EXP);
+       if (one_in_(6)) add_flag(o_ptr->art_flags, TR_ADD_L_CURSE);
+       if (one_in_(9)) add_flag(o_ptr->art_flags, TR_ADD_H_CURSE);
+       if (one_in_(9)) add_flag(o_ptr->art_flags, TR_DRAIN_HP);
+       if (one_in_(9)) add_flag(o_ptr->art_flags, TR_DRAIN_MANA);
        if (one_in_(2)) add_flag(o_ptr->art_flags, TR_TELEPORT);
        else if (one_in_(3)) add_flag(o_ptr->art_flags, TR_NO_TELE);
 
@@ -205,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)))
@@ -335,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))
                {
@@ -348,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);
@@ -412,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)))
@@ -588,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:
@@ -598,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:
@@ -608,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:
@@ -618,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);
@@ -679,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:
@@ -693,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:
@@ -703,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:
@@ -715,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 ||
@@ -738,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)))
@@ -815,9 +963,9 @@ static void random_misc(object_type * o_ptr)
                break;
 
        case BIAS_FIRE:
-               if (!(have_flag(o_ptr->art_flags, TR_LITE)))
+               if (!(have_flag(o_ptr->art_flags, TR_LITE_1)))
                {
-                       add_flag(o_ptr->art_flags, TR_LITE); /* Freebie */
+                       add_flag(o_ptr->art_flags, TR_LITE_1); /* Freebie */
                }
                break;
        }
@@ -826,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:
@@ -860,15 +1008,15 @@ 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:
-                       add_flag(o_ptr->art_flags, TR_LITE);
+                       add_flag(o_ptr->art_flags, TR_LITE_1);
                        break;
                case 12:
                case 13:
@@ -904,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;
@@ -932,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;
@@ -953,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]++;
 
@@ -966,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);
@@ -989,14 +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_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 (!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 10:
+                               add_flag(o_ptr->art_flags, TR_ESP_UNIQUE);
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_LAW;
                                break;
                        }
                        break;
@@ -1004,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)
@@ -1016,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)))
@@ -1148,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:
@@ -1194,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);
@@ -1206,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))
@@ -1341,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;
@@ -1359,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:
@@ -1427,211 +1654,98 @@ static void give_activation_power(object_type *o_ptr)
                        break;
        }
 
-       while (!type || (randint1(100) >= chance))
+       if (!type || (randint1(100) >= chance))
        {
-               type = randint1(255);
-               switch (type)
+               one_activation(o_ptr);
+               return;
+       }
+
+       /* A type was chosen... */
+       o_ptr->xtra2 = (byte_hack)type;
+       add_flag(o_ptr->art_flags, TR_ACTIVATE);
+       o_ptr->timeout = 0;
+}
+
+/*!
+ * @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);
+
+       if (prob <= SINDARIN_NAME)
+       {
+               get_table_sindarin(return_name);
+       }
+       else if (prob <= TABLE_NAME)
+       {
+               get_table_name(return_name);
+       }
+       else
+       {
+               cptr filename;
+
+               switch (armour)
                {
-                       case ACT_SUNLIGHT:
-                       case ACT_BO_MISS_1:
-                       case ACT_BA_POIS_1:
-                       case ACT_BO_ELEC_1:
-                       case ACT_BO_ACID_1:
-                       case ACT_BO_COLD_1:
-                       case ACT_BO_FIRE_1:
-                       case ACT_CONFUSE:
-                       case ACT_SLEEP:
-                       case ACT_QUAKE:
-                       case ACT_CURE_LW:
-                       case ACT_CURE_MW:
-                       case ACT_CURE_POISON:
-                       case ACT_BERSERK:
-                       case ACT_LIGHT:
-                       case ACT_MAP_LIGHT:
-                       case ACT_DEST_DOOR:
-                       case ACT_STONE_MUD:
-                       case ACT_TELEPORT:
-                               chance = 101;
-                               break;
-                       case ACT_BA_COLD_1:
-                       case ACT_BA_FIRE_1:
-                       case ACT_DRAIN_1:
-                       case ACT_TELE_AWAY:
-                       case ACT_ESP:
-                       case ACT_RESIST_ALL:
-                       case ACT_DETECT_ALL:
-                       case ACT_RECALL:
-                       case ACT_SATIATE:
-                       case ACT_RECHARGE:
-                               chance = 85;
-                               break;
-                       case ACT_TERROR:
-                       case ACT_PROT_EVIL:
-                       case ACT_ID_PLAIN:
-                               chance = 75;
-                               break;
-                       case ACT_DRAIN_2:
-                       case ACT_VAMPIRE_1:
-                       case ACT_BO_MISS_2:
-                       case ACT_BA_FIRE_2:
-                       case ACT_REST_LIFE:
-                               chance = 66;
-                               break;
-                       case ACT_BA_COLD_3:
-                       case ACT_BA_ELEC_3:
-                       case ACT_WHIRLWIND:
-                       case ACT_VAMPIRE_2:
-                       case ACT_CHARM_ANIMAL:
-                               chance = 50;
-                               break;
-                       case ACT_SUMMON_ANIMAL:
-                               chance = 40;
-                               break;
-                       case ACT_DISP_EVIL:
-                       case ACT_BA_MISS_3:
-                       case ACT_DISP_GOOD:
-                       case ACT_BANISH_EVIL:
-                       case ACT_GENOCIDE:
-                       case ACT_MASS_GENO:
-                       case ACT_CHARM_UNDEAD:
-                       case ACT_CHARM_OTHER:
-                       case ACT_SUMMON_PHANTOM:
-                       case ACT_REST_ALL:
-                       case ACT_RUNE_EXPLO:
-                               chance = 33;
-                               break;
-                       case ACT_CALL_CHAOS:
-                       case ACT_ROCKET:
-                       case ACT_CHARM_ANIMALS:
-                       case ACT_CHARM_OTHERS:
-                       case ACT_SUMMON_ELEMENTAL:
-                       case ACT_CURE_700:
-                       case ACT_SPEED:
-                       case ACT_ID_FULL:
-                       case ACT_RUNE_PROT:
-                               chance = 25;
-                               break;
-                       case ACT_CURE_1000:
-                       case ACT_XTRA_SPEED:
-                       case ACT_DETECT_XTRA:
-                       case ACT_DIM_DOOR:
-                               chance = 10;
-                               break;
-                       case ACT_SUMMON_UNDEAD:
-                       case ACT_SUMMON_DEMON:
-                       case ACT_WRAITH:
-                       case ACT_INVULN:
-                       case ACT_ALCHEMY:
-                               chance = 5;
-                               break;
-                       default:
-                               chance = 0;
-               }
-       }
-
-       /* A type was chosen... */
-       o_ptr->xtra2 = 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)
-{
-       int prob = randint1(100);
-
-       if (prob <= SINDARIN_NAME)
-       {
-               get_table_sindarin(return_name);
-       }
-       else if (prob <= TABLE_NAME)
-       {
-               get_table_name(return_name);
-       }
-       else
-       {
-               cptr filename;
-
-               switch (armour)
-               {
-                       case 1:
-                               switch (power)
-                               {
-                                       case 0:
-#ifdef JP
-                                               filename = "a_cursed_j.txt";
-#else
-                                               filename = "a_cursed.txt";
-#endif
-                                               break;
-                                       case 1:
-#ifdef JP
-                                               filename = "a_low_j.txt";
-#else
-                                               filename = "a_low.txt";
-#endif
-                                               break;
-                                       case 2:
-#ifdef JP
-                                               filename = "a_med_j.txt";
-#else
-                                               filename = "a_med.txt";
-#endif
-                                               break;
-                                       default:
-#ifdef JP
-                                               filename = "a_high_j.txt";
-#else
-                                               filename = "a_high.txt";
-#endif
-                               }
+                       case 1:
+                               switch (power)
+                               {
+                                       case 0:
+                                               filename = _("a_cursed_j.txt", "a_cursed.txt");
+                                               break;
+                                       case 1:
+                                               filename = _("a_low_j.txt", "a_low.txt");
+                                               break;
+                                       case 2:
+                                               filename = _("a_med_j.txt", "a_med.txt");
+                                               break;
+                                       default:
+                                               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];
        int     has_pval = 0;
        int     powers = randint1(5) + 1;
+       int     max_powers;
        int     max_type = (object_is_weapon_ammo(o_ptr) ? 7 : 5);
        int     power_level;
        s32b    total_flags;
@@ -1640,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;
@@ -1661,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, "");
 
@@ -1745,6 +1859,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
        if (a_cursed) powers /= 2;
 
+       max_powers = powers;
        /* Main loop */
        while (powers--)
        {
@@ -1811,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);
@@ -1828,7 +1944,6 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        add_flag(o_ptr->art_flags, TR_IGNORE_COLD);
 
        total_flags = flag_cost(o_ptr, o_ptr->pval);
-       if (cheat_peek) msg_format("%ld", total_flags);
 
        if (a_cursed) curse_artifact(o_ptr);
 
@@ -1855,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))
        {
@@ -1899,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);
@@ -1915,6 +2036,9 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                /* Mark the item as fully known */
                o_ptr->ident |= (IDENT_MENTAL);
 
+               /* For being treated as random artifact in screen_object() */
+               o_ptr->art_name = quark_add("");
+
                (void)screen_object(o_ptr, 0L);
 
                if (!get_string(ask_msg, dummy_name, sizeof dummy_name)
@@ -1930,1162 +2054,177 @@ 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);
-       }
-
-       if (cheat_xtra)
-       {
-#ifdef JP
-               if (artifact_bias) msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
-               else msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
-#else
-               if (artifact_bias) msg_format("Biased artifact: %d.", artifact_bias);
-               else msg_print("No bias in artifact.");
-#endif
+               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);
 
+       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);
 
        return TRUE;
 }
 
-
-bool activate_random_artifact(object_type * o_ptr)
+/*!
+ * @brief オブジェクトから能力発動IDを取得する。
+ * @details いくつかのケースで定義されている発動効果から、
+ * 鍛冶師による付与>固定アーティファクト>エゴ>ランダムアーティファクト>ベースアイテムの優先順位で走査していく。
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return 発動効果のIDを返す
+ */
+int activation_index(object_type *o_ptr)
 {
-       int plev = p_ptr->lev;
-       int k, dir, dummy = 0;
-
-       if (!o_ptr->art_name) return FALSE; /* oops? */
-
-       /* Activate for attack */
-       switch (o_ptr->xtra2)
+       /* Give priority to weaponsmith's essential activations */
+       if (object_is_smith(o_ptr))
        {
-               case ACT_SUNLIGHT:
+               switch (o_ptr->xtra3 - 1)
                {
-                       if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-                       msg_print("ÂÀÍÛ¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
-#else
-                       msg_print("A line of sunlight appears.");
-#endif
-
-                       (void)lite_line(dir);
-                       o_ptr->timeout = 10;
-                       break;
+               case ESSENCE_TMP_RES_ACID: return ACT_RESIST_ACID;
+               case ESSENCE_TMP_RES_ELEC: return ACT_RESIST_ELEC;
+               case ESSENCE_TMP_RES_FIRE: return ACT_RESIST_FIRE;
+               case ESSENCE_TMP_RES_COLD: return ACT_RESIST_COLD;
+               case TR_IMPACT: return ACT_QUAKE;
                }
+       }
 
-               case ACT_BO_MISS_1:
+       if (object_is_fixed_artifact(o_ptr))
+       {
+               if (have_flag(a_info[o_ptr->name1].flags, TR_ACTIVATE))
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏâÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows extremely brightly...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_MISSILE, dir, damroll(2, 6));
-                       o_ptr->timeout = 2;
-                       break;
+                       return a_info[o_ptr->name1].act_idx;
                }
-
-               case ACT_BA_POIS_1:
+       }
+       if (object_is_ego(o_ptr))
+       {
+               if (have_flag(e_info[o_ptr->name2].flags, TR_ACTIVATE))
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏÇ»Î理Ë̮ư¤·¤Æ¤¤¤ë...");
-#else
-                       msg_print("It throbs deep green...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_POIS, dir, 12, 3);
-                       o_ptr->timeout = randint0(4) + 4;
-                       break;
+                       return e_info[o_ptr->name2].act_idx;
                }
-
-               case ACT_BO_ELEC_1:
+       }
+       if (!object_is_random_artifact(o_ptr))
+       {
+               if (have_flag(k_info[o_ptr->k_idx].flags, TR_ACTIVATE))
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤Ï²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
-#else
-                       msg_print("It is covered in sparks...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                       o_ptr->timeout = randint0(5) + 5;
-                       break;
+                       return k_info[o_ptr->k_idx].act_idx;
                }
+       }
 
-               case ACT_BO_ACID_1:
-               {
-#ifdef JP
-                       msg_print("¤½¤ì¤Ï»À¤Ëʤ¤ï¤ì¤¿...");
-#else
-                       msg_print("It is covered in acid...");
-#endif
+       return o_ptr->xtra2;
+}
 
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ACID, dir, damroll(5, 8));
-                       o_ptr->timeout = randint0(6) + 6;
-                       break;
-               }
+/*!
+ * @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);
+       const activation_type* p;
 
-               case ACT_BO_COLD_1:
+       for (p = activation_info; p->flag != NULL; ++ p) {
+               if (p->index == index)
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
-#else
-                       msg_print("It is covered in frost...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_COLD, dir, damroll(6, 8));
-                       o_ptr->timeout = randint0(7) + 7;
-                       break;
+                       return p;
                }
+       }
 
-               case ACT_BO_FIRE_1:
-               {
-#ifdef JP
-                       msg_print("¤½¤ì¤Ï±ê¤Ëʤ¤ï¤ì¤¿...");
-#else
-                       msg_print("It is covered in fire...");
-#endif
+       return NULL;
+}
 
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                       o_ptr->timeout = randint0(8) + 8;
-                       break;
-               }
+/*!
+ * @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)
+{
+       bool give_resistance = FALSE, give_power = FALSE;
 
-               case ACT_BA_COLD_1:
+       if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
+       {
+               if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
-#else
-                       msg_print("It is covered in frost...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 48, 2);
-                       o_ptr->timeout = 400;
-                       break;
+                       give_power = TRUE;
+                       give_resistance = TRUE;
                }
-
-               case ACT_BA_FIRE_1:
+               else
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...");
-#else
-                       msg_print("It glows an intense red...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 72, 2);
-                       o_ptr->timeout = 400;
-                       break;
+                       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;
                }
+       }
 
-               case ACT_DRAIN_1:
+       if (o_ptr->name1 == ART_MURAMASA)
+       {
+               if (p_ptr->pclass != CLASS_SAMURAI)
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤Ï¹õ¤¯µ±¤¤¤¿...");
-#else
-                       msg_print("It glows black...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       if (drain_life(dir, 100))
-                       o_ptr->timeout = randint0(100) + 100;
-                       break;
+                       add_flag(o_ptr->art_flags, TR_NO_MAGIC);
+                       o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
                }
+       }
 
-               case ACT_BA_COLD_2:
+       if (o_ptr->name1 == ART_ROBINTON)
+       {
+               if (p_ptr->pclass == CLASS_BARD)
                {
-#ifdef JP
-                       msg_print("¤½¤ì¤ÏÀĤ¯·ã¤·¤¯µ±¤¤¤¿...");
-#else
-                       msg_print("It glows an intense blue...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 100, 2);
-                       o_ptr->timeout = 300;
-                       break;
+                       add_flag(o_ptr->art_flags, TR_DEC_MANA);
                }
+       }
 
-               case ACT_BA_ELEC_2:
-               {
-#ifdef JP
-                       msg_print("Åŵ¤¤¬¥Ñ¥Á¥Ñ¥Á²»¤òΩ¤Æ¤¿...");
-#else
-                       msg_print("It crackles with electricity...");
-#endif
+       if (o_ptr->name1 == ART_XIAOLONG)
+       {
+               if (p_ptr->pclass == CLASS_MONK)
+                       add_flag(o_ptr->art_flags, TR_BLOWS);
+       }
 
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ELEC, dir, 100, 3);
-                       o_ptr->timeout = 500;
-                       break;
-               }
+       if (o_ptr->name1 == ART_BLOOD)
+       {
+               get_bloody_moon_flags(o_ptr);
+       }
 
-               case ACT_DRAIN_2:
+       if (o_ptr->name1 == ART_HEAVENLY_MAIDEN)
+       {
+               if (p_ptr->psex != SEX_FEMALE)
                {
-#ifdef JP
-                       msg_print("¹õ¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows black...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       drain_life(dir, 120);
-                       o_ptr->timeout = 400;
-                       break;
+                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
                }
+       }
 
-               case ACT_VAMPIRE_1:
+       if (o_ptr->name1 == ART_MILIM)
+       {
+               if (p_ptr->pseikaku == SEIKAKU_SEXY)
                {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       for (dummy = 0; dummy < 3; dummy++)
-                       {
-                               if (drain_life(dir, 50))
-                               hp_player(50);
-                       }
-                       o_ptr->timeout = 400;
-                       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_BO_MISS_2:
-               {
-#ifdef JP
-                       msg_print("ËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...");
-#else
-                       msg_print("It grows magical spikes...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_bolt(GF_ARROW, dir, 150);
-                       o_ptr->timeout = randint0(90) + 90;
-                       break;
-               }
-
-               case ACT_BA_FIRE_2:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep red...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 120, 3);
-                       o_ptr->timeout = randint0(225) + 225;
-                       break;
-               }
-
-               case ACT_BA_COLD_3:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¯Çò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright white...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 200, 3);
-                       o_ptr->timeout = randint0(325) + 325;
-                       break;
-               }
-
-               case ACT_BA_ELEC_3:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep blue...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ELEC, dir, 250, 3);
-                       o_ptr->timeout = randint0(425) + 425;
-                       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);
-                               }
-                       }
-                       o_ptr->timeout = 250;
-                       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);
-                       }
-
-                       o_ptr->timeout = 400;
-                       break;
-               }
-
-
-               case ACT_CALL_CHAOS:
-               {
-#ifdef JP
-                       msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows in scintillating colours...");
-#endif
-
-                       call_chaos();
-                       o_ptr->timeout = 350;
-                       break;
-               }
-
-               case ACT_ROCKET:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-                       msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
-#else
-                       msg_print("You launch a rocket!");
-#endif
-
-                       fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
-                       o_ptr->timeout = 400;
-                       break;
-               }
-
-               case ACT_DISP_EVIL:
-               {
-#ifdef JP
-                       msg_print("¿ÀÀ»¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
-#else
-                       msg_print("It floods the area with goodness...");
-#endif
-
-                       dispel_evil(p_ptr->lev * 5);
-                       o_ptr->timeout = randint0(300) + 300;
-                       break;
-               }
-
-               case ACT_DISP_GOOD:
-               {
-#ifdef JP
-                       msg_print("¼Ù°­¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
-#else
-                       msg_print("It floods the area with evil...");
-#endif
-
-                       dispel_good(p_ptr->lev * 5);
-                       o_ptr->timeout = randint0(300) + 300;
-                       break;
-               }
-
-               case ACT_BA_MISS_3:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-#ifdef JP
-                       msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
-#else
-                       msg_print("You breathe the elements.");
-#endif
-
-                       fire_ball(GF_MISSILE, dir, 300, 4);
-                       o_ptr->timeout = 500;
-                       break;
-               }
-
-               /* Activate for other offensive action */
-
-               case ACT_CONFUSE:
-               {
-#ifdef JP
-                       msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows in scintillating colours...");
-#endif
-
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       confuse_monster(dir, 20);
-                       o_ptr->timeout = 15;
-                       break;
-               }
-
-               case ACT_SLEEP:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep blue...");
-#endif
-
-                       sleep_monsters_touch();
-                       o_ptr->timeout = 55;
-                       break;
-               }
-
-               case ACT_QUAKE:
-               {
-                       earthquake(py, px, 10);
-                       o_ptr->timeout = 50;
-                       break;
-               }
-
-               case ACT_TERROR:
-               {
-                       turn_monsters(40 + p_ptr->lev);
-                       o_ptr->timeout = 3 * (p_ptr->lev + 10);
-                       break;
-               }
-
-               case ACT_TELE_AWAY:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)fire_beam(GF_AWAY_ALL, dir, plev);
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               case ACT_BANISH_EVIL:
-               {
-                       if (banish_evil(100))
-                       {
-#ifdef JP
-                               msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÎϤ¬¼Ù°­¤òÂǤÁʧ¤Ã¤¿¡ª");
-#else
-                               msg_print("The power of the artifact banishes evil!");
-#endif
-
-                       }
-                       o_ptr->timeout = 250 + randint1(250);
-                       break;
-               }
-
-               case ACT_GENOCIDE:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep blue...");
-#endif
-
-                       (void)symbol_genocide(200, TRUE);
-                       o_ptr->timeout = 500;
-                       break;
-               }
-
-               case ACT_MASS_GENO:
-               {
-#ifdef JP
-                       msg_print("¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
-#else
-                       msg_print("It lets out a long, shrill note...");
-#endif
-
-                       (void)mass_genocide(200, TRUE);
-                       o_ptr->timeout = 1000;
-                       break;
-               }
-
-               /* Activate for summoning / charming */
-
-               case ACT_CHARM_ANIMAL:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)charm_animal(dir, plev);
-                       o_ptr->timeout = 300;
-                       break;
-               }
-
-               case ACT_CHARM_UNDEAD:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)control_one_undead(dir, plev);
-                       o_ptr->timeout = 333;
-                       break;
-               }
-
-               case ACT_CHARM_OTHER:
-               {
-                       if (!get_aim_dir(&dir)) return FALSE;
-                       (void)charm_monster(dir, plev);
-                       o_ptr->timeout = 400;
-                       break;
-               }
-
-               case ACT_CHARM_ANIMALS:
-               {
-                       (void)charm_animals(plev * 2);
-                       o_ptr->timeout = 500;
-                       break;
-               }
-
-               case ACT_CHARM_OTHERS:
-               {
-                       charm_monsters(plev * 2);
-                       o_ptr->timeout = 750;
-                       break;
-               }
-
-               case ACT_SUMMON_ANIMAL:
-               {
-                       (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       o_ptr->timeout = 200 + randint1(300);
-                       break;
-               }
-
-               case ACT_SUMMON_PHANTOM:
-               {
-#ifdef JP
-                       msg_print("¸¸Îî¤ò¾¤´­¤·¤¿¡£");
-#else
-                       msg_print("You summon a phantasmal servant.");
-#endif
-
-                       (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       o_ptr->timeout = 200 + randint1(200);
-                       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))
-                       {
-#ifdef JP
-                               msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿...");
-#else
-                               msg_print("An elemental materializes...");
-#endif
-
-
-                               if (pet)
-#ifdef JP
-                                       msg_print("¤¢¤Ê¤¿¤ËÉþ½¾¤·¤Æ¤¤¤ë¤è¤¦¤À¡£");
-#else
-                                       msg_print("It seems obedient to you.");
-#endif
-
-                               else
-#ifdef JP
-                                       msg_print("¤½¤ì¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤­¤Ê¤«¤Ã¤¿¡ª");
-#else
-                                       msg_print("You fail to control it!");
-#endif
-
-                       }
-
-                       o_ptr->timeout = 750;
-                       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))
-                       {
-#ifdef JP
-                               msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
-#else
-                               msg_print("The area fills with a stench of sulphur and brimstone.");
-#endif
-
-                               if (pet)
-#ifdef JP
-                                       msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
-#else
-                                       msg_print("'What is thy bidding... Master?'");
-#endif
-
-                               else
-#ifdef JP
-                                       msg_print("¡ÖNON SERVIAM! Wretch! ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
-#else
-                                       msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
-#endif
-
-                       }
-
-                       o_ptr->timeout = 666 + randint1(333);
-                       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))
-                       {
-#ifdef JP
-                               msg_print("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤­»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½­¤ò±¿¤ó¤Ç¤¤¤ë...");
-#else
-                               msg_print("Cold winds begin to blow around you, carrying with them the stench of decay...");
-#endif
-
-                               if (pet)
-#ifdef JP
-                                       msg_print("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª");
-#else
-                                       msg_print("Ancient, long-dead forms arise from the ground to serve you!");
-#endif
-
-                               else
-#ifdef JP
-                                       msg_print("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª");
-#else
-                                       msg_print("'The dead arise... to punish you for disturbing them!'");
-#endif
-
-                       }
-
-                       o_ptr->timeout = 666 + randint1(333);
-                       break;
-               }
-
-               /* Activate for healing */
-
-               case ACT_CURE_LW:
-               {
-                       (void)set_afraid(0);
-                       (void)hp_player(30);
-                       o_ptr->timeout = 10;
-                       break;
-               }
-
-               case ACT_CURE_MW:
-               {
-#ifdef JP
-                       msg_print("¿¼»ç¿§¤Î¸÷¤òȯ¤·¤Æ¤¤¤ë...");
-#else
-                       msg_print("It radiates deep purple...");
-#endif
-
-                       hp_player(damroll(4, 8));
-                       (void)set_cut((p_ptr->cut / 2) - 50);
-                       o_ptr->timeout = randint0(3) + 3;
-                       break;
-               }
-
-               case ACT_CURE_POISON:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep blue...");
-#endif
-
-                       (void)set_afraid(0);
-                       (void)set_poisoned(0);
-                       o_ptr->timeout = 5;
-                       break;
-               }
-
-               case ACT_REST_LIFE:
-               {
-#ifdef JP
-                       msg_print("¿¼¹È¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows a deep red...");
-#endif
-
-                       restore_level();
-                       o_ptr->timeout = 450;
-                       break;
-               }
-
-               case ACT_REST_ALL:
-               {
-#ifdef JP
-                       msg_print("Ç»Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows a deep green...");
-#endif
-
-                       (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();
-                       o_ptr->timeout = 750;
-                       break;
-               }
-
-               case ACT_CURE_700:
-               {
-#ifdef JP
-                       msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows deep blue...");
-#endif
-
-#ifdef JP
-                       msg_print("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...");
-#else
-                       msg_print("You feel a warm tingling inside...");
-#endif
-
-                       (void)hp_player(700);
-                       (void)set_cut(0);
-                       o_ptr->timeout = 250;
-                       break;
-               }
-
-               case ACT_CURE_1000:
-               {
-#ifdef JP
-                       msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows a bright white...");
-#endif
-
-#ifdef JP
-                       msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...");
-#else
-                       msg_print("You feel much better...");
-#endif
-
-                       (void)hp_player(1000);
-                       (void)set_cut(0);
-                       o_ptr->timeout = 888;
-                       break;
-               }
-
-               /* Activate for timed effect */
-
-               case ACT_ESP:
-               {
-                       (void)set_tim_esp(randint1(30) + 25, FALSE);
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               case ACT_BERSERK:
-               {
-                       (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:
-               {
-#ifdef JP
-                       msg_print("±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
-#else
-                       msg_print("It lets out a shrill wail...");
-#endif
-
-                       k = 3 * p_ptr->lev;
-                       (void)set_protevil(randint1(25) + k, FALSE);
-                       o_ptr->timeout = randint0(225) + 225;
-                       break;
-               }
-
-               case ACT_RESIST_ALL:
-               {
-#ifdef JP
-                       msg_print("ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows many colours...");
-#endif
-
-                       (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);
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               case ACT_SPEED:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¯Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright green...");
-#endif
-
-                       (void)set_fast(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 250;
-                       break;
-               }
-
-               case ACT_XTRA_SPEED:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows brightly...");
-#endif
-
-                       (void)set_fast(randint1(75) + 75, FALSE);
-                       o_ptr->timeout = randint0(200) + 200;
-                       break;
-               }
-
-               case ACT_WRAITH:
-               {
-                       set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
-                       o_ptr->timeout = 1000;
-                       break;
-               }
-
-               case ACT_INVULN:
-               {
-                       (void)set_invuln(randint1(8) + 8, FALSE);
-                       o_ptr->timeout = 1000;
-                       break;
-               }
-
-               /* Activate for general purpose effect (detection etc.) */
-
-               case ACT_LIGHT:
-               {
-#ifdef JP
-                       msg_print("À¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
-#else
-                       msg_print("It wells with clear light...");
-#endif
-
-                       lite_area(damroll(2, 15), 3);
-                       o_ptr->timeout = randint0(10) + 10;
-                       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);
-                       o_ptr->timeout = randint0(50) + 50;
-                       break;
-               }
-
-               case ACT_DETECT_ALL:
-               {
-#ifdef JP
-                       msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright white...");
-#endif
-
-#ifdef JP
-                       msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤­¤¿...");
-#else
-                       msg_print("An image forms in your mind...");
-#endif
-
-                       detect_all(DETECT_RAD_DEFAULT);
-                       o_ptr->timeout = randint0(55) + 55;
-                       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);
-                       o_ptr->timeout = 1000;
-                       break;
-               }
-
-               case ACT_ID_FULL:
-               {
-#ifdef JP
-                       msg_print("²«¿§¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows yellow...");
-#endif
-
-                       identify_fully(FALSE);
-                       o_ptr->timeout = 750;
-                       break;
-               }
-
-               case ACT_ID_PLAIN:
-               {
-                       if (!ident_spell(FALSE)) return FALSE;
-                       o_ptr->timeout = 10;
-                       break;
-               }
-
-               case ACT_RUNE_EXPLO:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright red...");
-#endif
-
-                       explosive_rune();
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               case ACT_RUNE_PROT:
-               {
-#ifdef JP
-                       msg_print("¥Ö¥ë¡¼¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows light blue...");
-#endif
-
-                       warding_glyph();
-                       o_ptr->timeout = 400;
-                       break;
-               }
-
-               case ACT_SATIATE:
-               {
-                       (void)set_food(PY_FOOD_MAX - 1);
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               case ACT_DEST_DOOR:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright red...");
-#endif
-
-                       destroy_doors_touch();
-                       o_ptr->timeout = 10;
-                       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);
-                       o_ptr->timeout = 5;
-                       break;
-               }
-
-               case ACT_RECHARGE:
-               {
-                       recharge(130);
-                       o_ptr->timeout = 70;
-                       break;
-               }
-
-               case ACT_ALCHEMY:
-               {
-#ifdef JP
-                       msg_print("ÌÀ¤ë¤¤²«¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows bright yellow...");
-#endif
-
-                       (void)alchemy();
-                       o_ptr->timeout = 500;
-                       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;
-                       o_ptr->timeout = 100;
-                       break;
-               }
-
-
-               case ACT_TELEPORT:
-               {
-#ifdef JP
-                       msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ë...");
-#else
-                       msg_print("It twists space around you...");
-#endif
-
-                       teleport_player(100, 0L);
-                       o_ptr->timeout = 45;
-                       break;
-               }
-
-               case ACT_RECALL:
-               {
-#ifdef JP
-                       msg_print("¤ä¤ï¤é¤«¤ÊÇò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
-#else
-                       msg_print("It glows soft white...");
-#endif
-                       if (!word_of_recall()) return FALSE;
-                       o_ptr->timeout = 200;
-                       break;
-               }
-
-               default:
-               {
-#ifdef JP
-                       msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
-#else
-                       msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
-#endif
-
-                       return FALSE;
-               }
-       }
-
-       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++)
-       {
-               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);
-       }
-
-       dummy = randint1(2);
-       for (i = 0; i < dummy; i++) one_resistance(o_ptr);
-
-       for (i = 0; i < 2; i++)
-       {
-               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);
-       }
-}
-
-
-void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
-{
-       bool give_resistance = FALSE, give_power = FALSE;
-
-       if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
-       {
-               if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
-               {
-                       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;
-               }
-       }
-
-       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);
-               }
-       }
-
-       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 (a_ptr->gen_flags & (TRG_XTRA_POWER)) give_power = TRUE;
        if (a_ptr->gen_flags & (TRG_XTRA_H_RES)) give_resistance = TRUE;
@@ -3108,14 +2247,22 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
 }
 
 
-/*
- * Create the artifact of the specified number
+/*!
+ * @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;
-       int i;
+       IDX i;
 
        artifact_type *a_ptr = &a_info[a_idx];
 
@@ -3135,7 +2282,7 @@ bool create_named_art(int a_idx, int y, int x)
        object_prep(q_ptr, i);
 
        /* Save the name */
-       q_ptr->name1 = a_idx;
+       q_ptr->name1 = (byte_hack)a_idx;
 
        /* Extract the fields */
        q_ptr->pval = a_ptr->pval;
@@ -3157,12 +2304,138 @@ bool create_named_art(int a_idx, int y, int x)
 
        random_artifact_resistance(q_ptr, a_ptr);
 
-       /*
-        * drop_near()Æâ¤ÇÉáÄ̤θÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬½Å¤Ê¤é¤Ê¤¤À­¼Á¤Ë°Í¸¤¹¤ë.
-        * ²¾¤Ë2¸Ä°Ê¾å¸ºß²Äǽ¤«¤ÄÁõÈ÷Éʰʳ°¤Î¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬ºîÀ®¤µ¤ì¤ì¤Ð
-        * ¤³¤Î´Ø¿ô¤ÎÊÖ¤êÃͤϿ®ÍѤǤ­¤Ê¤¯¤Ê¤ë.
-        */
-
        /* Drop the artifact from heaven */
        return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
 }
+
+/*対邪平均ダメージの計算処理*/
+int calc_arm_avgdamage(object_type *o_ptr)
+{
+       u32b flgs[TR_FLAG_SIZE];
+       object_flags(o_ptr, flgs);
+
+       HIT_POINT dam, base, s_evil, forced, vorpal;
+       dam = base = s_evil = forced = vorpal = 0;
+
+       dam = base = (o_ptr->dd * o_ptr->ds + o_ptr->dd) / 2;
+
+       if(have_flag(flgs, TR_KILL_EVIL))
+       {
+               dam = s_evil = dam * 7 / 2;
+       }
+       else if(!have_flag(flgs, TR_KILL_EVIL) && have_flag(flgs, TR_SLAY_EVIL))
+       {       
+               dam = s_evil = dam * 2;
+       }
+       else s_evil = dam;
+
+       if (have_flag(flgs, TR_FORCE_WEAPON))
+       {
+               dam = forced = dam * 3 / 2 + (o_ptr->dd * o_ptr->ds + o_ptr->dd);
+       }
+       else forced = dam;
+
+       if(have_flag(flgs, TR_VORPAL))
+       {
+               dam = vorpal = dam * 11 / 9;
+       }
+       else vorpal = dam;
+
+       dam = dam + o_ptr->to_d;
+
+       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)
+{
+       int num = FALSE;
+       u32b flgs[TR_FLAG_SIZE];
+       object_flags(o_ptr, flgs);
+
+       if (have_flag(flgs, TR_VAMPIRIC))
+       {
+               if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 52))
+               {
+                       num = TRUE;
+               }
+               else if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 43))
+               {
+                       num = TRUE;
+               }
+               else if( have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 33))
+               {
+                       num = TRUE;
+               }
+               else if (calc_arm_avgdamage(o_ptr) > 63)
+               {
+                       num = TRUE;
+               }
+       }
+       else
+       {
+               if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 65))
+               {
+                       num = TRUE;
+               }
+               else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 52))
+               {
+                       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;
+               }
+       }
+       return(num);
+}
+
+static int weakening_artifact(object_type *o_ptr)
+{
+        KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
+        object_kind *k_ptr = &k_info[k_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;
+
+               if (o_ptr->dd > o_ptr->ds)
+               {
+                       o_ptr->dd--;
+               }
+               else
+               {
+                       o_ptr->ds--;
+               }
+
+               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;
+
+               o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
+               if (o_ptr->to_d < 10)
+               {
+                       o_ptr->to_d = 10;
+               }
+
+               msg_format_wizard(CHEAT_OBJECT,
+                       _("ダメージ修正が抑制されました。 %d -> %d", "Plus-Damage Supress %d -> %d"),
+                       pre_damage, o_ptr->to_d);
+
+               return 1;
+        }
+        return 0;
+}
\ No newline at end of file