OSDN Git Service

[modify] #37914 (2.2.1.3) ブレス処理をfire_ball()からfire_breath()に分離。 / Separate fire_breath...
[hengband/hengband.git] / src / artifact.c
index 8acacfb..54b6c7a 100644 (file)
@@ -33,32 +33,6 @@ static int weakening_artifact(object_type *o_ptr);
 
 
 /*!
- * アーティファクトのバイアスIDを保管する。 / Use for biased artifact creation
- */
-static int artifact_bias;
-
-
-/*!
- * @brief 対象のオブジェクトにランダムな能力維持を一つ付加する。/ Choose one random sustain
- * @details 重複の抑止はない。
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return なし
- */
-void one_sustain(object_type *o_ptr)
-{
-       switch (randint0(6))
-       {
-               case 0: add_flag(o_ptr->art_flags, TR_SUST_STR); break;
-               case 1: add_flag(o_ptr->art_flags, TR_SUST_INT); break;
-               case 2: add_flag(o_ptr->art_flags, TR_SUST_WIS); break;
-               case 3: add_flag(o_ptr->art_flags, TR_SUST_DEX); break;
-               case 4: add_flag(o_ptr->art_flags, TR_SUST_CON); break;
-               case 5: add_flag(o_ptr->art_flags, TR_SUST_CHR); break;
-       }
-}
-
-
-/*!
  * @brief 対象のオブジェクトにランダムな上位耐性を一つ付加する。/ Choose one random high resistance
  * @details 重複の抑止はない。候補は毒、閃光、暗黒、破片、盲目、混乱、地獄、因果混乱、カオス、劣化、恐怖のいずれか。
  * @param o_ptr 対象のオブジェクト構造体ポインタ
@@ -254,7 +228,7 @@ void one_activation(object_type *o_ptr)
                                break;
                        case ACT_BA_COLD_1:
                        case ACT_BA_FIRE_1:
-                       case ACT_DRAIN_1:
+                       case ACT_HYPODYNAMIA_1:
                        case ACT_TELE_AWAY:
                        case ACT_ESP:
                        case ACT_RESIST_ALL:
@@ -269,8 +243,8 @@ void one_activation(object_type *o_ptr)
                        case ACT_ID_PLAIN:
                                chance = 75;
                                break;
-                       case ACT_DRAIN_2:
-                       case ACT_VAMPIRE_1:
+                       case ACT_HYPODYNAMIA_2:
+                       case ACT_DRAIN_1:
                        case ACT_BO_MISS_2:
                        case ACT_BA_FIRE_2:
                        case ACT_REST_EXP:
@@ -280,7 +254,7 @@ void one_activation(object_type *o_ptr)
                        case ACT_BA_COLD_3:
                        case ACT_BA_ELEC_3:
                        case ACT_WHIRLWIND:
-                       case ACT_VAMPIRE_2:
+                       case ACT_DRAIN_2:
                        case ACT_CHARM_ANIMAL:
                                chance = 50;
                                break;
@@ -381,7 +355,7 @@ 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)))
@@ -506,7 +480,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))
                {
@@ -519,61 +493,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);
@@ -583,8 +557,8 @@ 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;
        }
@@ -602,7 +576,7 @@ static void random_plus(object_type * o_ptr)
  */
 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)))
@@ -768,8 +742,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:
@@ -778,8 +752,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:
@@ -788,8 +762,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:
@@ -798,53 +772,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);
@@ -859,8 +833,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:
@@ -873,8 +847,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:
@@ -883,8 +857,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:
@@ -895,16 +869,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 ||
@@ -918,8 +892,8 @@ 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;
        }
 }
@@ -936,7 +910,7 @@ static void random_resistance(object_type * o_ptr)
  */
 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)))
@@ -1014,33 +988,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:
@@ -1049,10 +1023,10 @@ static void random_misc(object_type * o_ptr)
                        break;
                case 9:
                        add_flag(o_ptr->art_flags, TR_HOLD_EXP);
-                       if (!artifact_bias && one_in_(5))
-                               artifact_bias = BIAS_PRIESTLY;
-                       else if (!artifact_bias && one_in_(6))
-                               artifact_bias = BIAS_NECROMANTIC;
+                       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:
@@ -1121,18 +1095,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;
@@ -1155,15 +1129,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);
@@ -1182,18 +1156,18 @@ static void random_misc(object_type * o_ptr)
                                break;
                        case 8:
                                add_flag(o_ptr->art_flags, TR_ESP_HUMAN);
-                               if (!artifact_bias && one_in_(6))
-                                       artifact_bias = BIAS_ROGUE;
+                               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 (!artifact_bias && one_in_(3))
-                                       artifact_bias = BIAS_LAW;
+                               if (!o_ptr->artifact_bias && one_in_(3))
+                                       o_ptr->artifact_bias = BIAS_LAW;
                                break;
                        }
                        break;
@@ -1222,21 +1196,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)))
@@ -1373,10 +1347,10 @@ static void random_slay(object_type *o_ptr)
                        {
                        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 (!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:
@@ -1388,8 +1362,8 @@ static void random_slay(object_type *o_ptr)
                        {
                                add_flag(o_ptr->art_flags, TR_SLAY_UNDEAD);
                        }
-                       if (!artifact_bias && one_in_(9))
-                               artifact_bias = BIAS_PRIESTLY;
+                       if (!o_ptr->artifact_bias && one_in_(9))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                        break;
                case 7:
                case 8:
@@ -1401,8 +1375,8 @@ static void random_slay(object_type *o_ptr)
                        {
                                add_flag(o_ptr->art_flags, TR_SLAY_DEMON);
                        }
-                       if (!artifact_bias && one_in_(9))
-                               artifact_bias = BIAS_PRIESTLY;
+                       if (!o_ptr->artifact_bias && one_in_(9))
+                               o_ptr->artifact_bias = BIAS_PRIESTLY;
                        break;
                case 9:
                case 10:
@@ -1449,8 +1423,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);
@@ -1461,46 +1435,46 @@ 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:
@@ -1515,8 +1489,8 @@ static void random_slay(object_type *o_ptr)
                        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;
        }
 }
@@ -1531,7 +1505,7 @@ 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))
@@ -1626,11 +1600,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:
@@ -1709,12 +1683,13 @@ static void give_activation_power(object_type *o_ptr)
 /*!
  * @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(char *return_name, bool armour, int power)
+static void get_random_name(object_type *o_ptr, char *return_name, bool armour, int power)
 {
        int prob = randint1(100);
 
@@ -1765,7 +1740,7 @@ static void get_random_name(char *return_name, bool armour, int power)
                                }
                }
 
-               (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
@@ -1793,7 +1768,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;
@@ -1814,74 +1789,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, "");
 
@@ -2009,7 +1984,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))
        {
@@ -2099,14 +2074,14 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        }
        else
        {
-               get_random_name(new_name, object_is_armour(o_ptr), power_level);
+               get_random_name(o_ptr, new_name, object_is_armour(o_ptr), power_level);
        }
 
        /* Save the inscription */
        o_ptr->art_name = quark_add(new_name);
 
        msg_format_wizard(CHEAT_OBJECT, _("パワー %d で 価値%ld のランダムアーティファクト生成 バイアスは「%s」",
-               "Random artifact generated - Power:%d Value:%d Bias:%s."), max_powers, total_flags, artifact_bias_name[artifact_bias]);
+               "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);
@@ -2218,7 +2193,7 @@ static bool activate_dragon_breath(object_type *o_ptr)
 
        t = randint0(n);
        msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
-       fire_ball(type[t], dir, 250, -4);
+       fire_breath(type[t], dir, 250, 4);
 
        return TRUE;
 }
@@ -2232,8 +2207,9 @@ static bool activate_dragon_breath(object_type *o_ptr)
  */
 bool activate_random_artifact(object_type *o_ptr)
 {
-       int plev = p_ptr->lev;
-       int k, dir, dummy = 0;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       int k, dummy = 0;
+       DIRECTION dir;
        cptr name = k_name + k_info[o_ptr->k_idx].name;
        const activation_type* const act_ptr = find_activation_info(o_ptr);
 
@@ -2391,28 +2367,28 @@ bool activate_random_artifact(object_type *o_ptr)
                        break;
                }
                
-               case ACT_DRAIN_1:
+               case ACT_HYPODYNAMIA_1:
                {
                        msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
                        if (!get_aim_dir(&dir)) return FALSE;
-                       if (drain_life(dir, 100))
+                       if (hypodynamic_bolt(dir, 100))
                        break;
                }
 
-               case ACT_DRAIN_2:
+               case ACT_HYPODYNAMIA_2:
                {
                        msg_print(_("黒く輝いている...", "It glows black..."));
                        if (!get_aim_dir(&dir)) return FALSE;
-                       drain_life(dir, 120);
+                       hypodynamic_bolt(dir, 120);
                        break;
                }
 
-               case ACT_VAMPIRE_1:
+               case ACT_DRAIN_1:
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        for (dummy = 0; dummy < 3; dummy++)
                        {
-                               if (drain_life(dir, 50))
+                               if (hypodynamic_bolt(dir, 50))
                                hp_player(50);
                        }
                        break;
@@ -2450,12 +2426,12 @@ bool activate_random_artifact(object_type *o_ptr)
                        break;
                }
 
-               case ACT_VAMPIRE_2:
+               case ACT_DRAIN_2:
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        for (dummy = 0; dummy < 3; dummy++)
                        {
-                               if (drain_life(dir, 100))
+                               if (hypodynamic_bolt(dir, 100))
                                hp_player(100);
                        }
                        break;
@@ -2488,7 +2464,7 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-                       fire_ball(GF_MISSILE, dir, 300, -4);
+                       fire_breath(GF_MISSILE, dir, 300, 4);
                        break;
                }
 
@@ -2584,7 +2560,7 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-                       fire_ball(GF_MISSILE, dir, 300, -4);
+                       fire_breath(GF_MISSILE, dir, 300, 4);
                        msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
                        (void)set_afraid(0);
                        (void)set_hero(randint1(50) + 50, FALSE);
@@ -2601,7 +2577,7 @@ bool activate_random_artifact(object_type *o_ptr)
                case ACT_BR_FIRE:
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 200, -2);
+                       fire_breath(GF_FIRE, dir, 200, 2);
                        if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
                        {
                                (void)set_oppose_fire(randint1(20) + 20, FALSE);
@@ -2611,7 +2587,7 @@ bool activate_random_artifact(object_type *o_ptr)
                case ACT_BR_COLD:
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 200, -2);
+                       fire_breath(GF_COLD, dir, 200, 2);
                        if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
                        {
                                (void)set_oppose_cold(randint1(20) + 20, FALSE);
@@ -2758,7 +2734,7 @@ bool activate_random_artifact(object_type *o_ptr)
                case ACT_SUMMON_ELEMENTAL:
                {
                        bool pet = one_in_(3);
-                       u32b mode = 0L;
+                       BIT_FLAGS mode = 0L;
 
                        if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
                        if (pet) mode |= PM_FORCE_PET;
@@ -2779,7 +2755,7 @@ bool activate_random_artifact(object_type *o_ptr)
                case ACT_SUMMON_DEMON:
                {
                        bool pet = one_in_(3);
-                       u32b mode = 0L;
+                       BIT_FLAGS mode = 0L;
 
                        if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
                        if (pet) mode |= PM_FORCE_PET;
@@ -2801,7 +2777,7 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        bool pet = one_in_(3);
                        int type;
-                       u32b mode = 0L;
+                       BIT_FLAGS mode = 0L;
 
                        type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
 
@@ -2826,7 +2802,7 @@ bool activate_random_artifact(object_type *o_ptr)
 
                case ACT_SUMMON_HOUND:
                {
-                       u32b mode = PM_ALLOW_GROUP;
+                       BIT_FLAGS mode = PM_ALLOW_GROUP;
                        bool pet = !one_in_(5);
                        if (pet) mode |= PM_FORCE_PET;
                        else mode |= PM_NO_PET;
@@ -2854,7 +2830,7 @@ bool activate_random_artifact(object_type *o_ptr)
 
                case ACT_SUMMON_OCTOPUS:
                {
-                       u32b mode = PM_ALLOW_GROUP;
+                       BIT_FLAGS mode = PM_ALLOW_GROUP;
                        bool pet = !one_in_(5);
                        if (pet) mode |= PM_FORCE_PET;
 
@@ -2972,7 +2948,7 @@ bool activate_random_artifact(object_type *o_ptr)
                                }
                                for (; i < EATER_EXT*3; i++)
                                {
-                                       int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
+                                       KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
                                        p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval;
                                        if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
                                }
@@ -3439,7 +3415,8 @@ bool activate_random_artifact(object_type *o_ptr)
                /* Unique activation */
                case ACT_CAST_OFF:
                {
-                       int inv, o_idx, t;
+                       int inv, t;
+                       OBJECT_IDX o_idx;
                        char o_name[MAX_NLEN];
                        object_type forge;
 
@@ -3621,7 +3598,7 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        int num = 1;
                        int i;
-                       int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
+                       BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
                        int tx, ty;
 
                        /* Only for Crimson */
@@ -3900,7 +3877,7 @@ int calc_arm_avgdamage(object_type *o_ptr)
        u32b flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
 
-       int dam, base, s_evil, forced, vorpal;
+       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;
@@ -3984,7 +3961,7 @@ static int suppression_evil_dam(object_type *o_ptr)
 
 static int weakening_artifact(object_type *o_ptr)
 {
-        int k_idx = lookup_kind(o_ptr->sval, o_ptr->tval);
+        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))