OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / artifact.c
index b63b8cc..c8cbb37 100644 (file)
 
 #include "angband.h"
 #include "cmd-activate.h"
+#include "object-curse.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 /*!< ランダムアーティファクトに漢字銘をつける確率(正確には TABLE_NAME - SINDARIN_NAME %)となる */
-#define A_CURSED        13 /*!< 1/nの確率で生成の巻物以外のランダムアーティファクトが呪いつきになる。 */
-#define WEIRD_LUCK      12 /*!< 1/nの確率でrandom_resistance()の処理中バイアス外の耐性がつき、create_artifactで4を超えるpvalが許可される。*/
-#define BIAS_LUCK       20 /*!< 1/nの確率でrandom_resistance()で付加する元素耐性が免疫になる */
-#define IM_LUCK         7 /*!< 1/nの確率でrandom_resistance()で複数免疫の除去処理が免除される */
-
-/*! @note
- * Bias luck needs to be higher than weird luck,
- * since it is usually tested several times...
- */
-
-#define ACTIVATION_CHANCE 3 /*!< 1/nの確率でランダムアーティファクトに発動が付加される。ただし防具はさらに1/2 */
-
 
 /*!
  * @brief 対象のオブジェクトにランダムな上位耐性を一つ付加する。/ Choose one random high resistance
@@ -1692,7 +1678,7 @@ static void give_activation_power(object_type *o_ptr)
  */
 static void get_random_name(object_type *o_ptr, char *return_name, bool armour, int power)
 {
-       int prob = randint1(100);
+       PERCENTAGE prob = randint1(100);
 
        if (prob <= SINDARIN_NAME)
        {
@@ -1758,7 +1744,7 @@ static void get_random_name(object_type *o_ptr, char *return_name, bool armour,
 bool create_artifact(object_type *o_ptr, bool a_scroll)
 {
        char    new_name[1024];
-       int     has_pval = 0;
+       PARAMETER_VALUE has_pval = 0;
        int     powers = randint1(5) + 1;
        int     max_powers;
        int     max_type = (object_is_weapon_ammo(o_ptr) ? 7 : 5);
@@ -2084,7 +2070,6 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        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;
@@ -2273,7 +2258,7 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
  * 仮に2個以上存在可能かつ装備品以外の固定アーティファクトが作成されれば
  * drop_near()関数の返り値は信用できなくなる.
  */
-bool create_named_art(int a_idx, int y, int x)
+bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
 {
        object_type forge;
        object_type *q_ptr;
@@ -2290,7 +2275,6 @@ bool create_named_art(int a_idx, int y, int x)
        /* Acquire the "kind" index */
        i = lookup_kind(a_ptr->tval, a_ptr->sval);
 
-       /* Oops */
        if (!i) return FALSE;
 
        /* Create the artifact */
@@ -2322,10 +2306,11 @@ bool create_named_art(int a_idx, int y, int x)
        /* 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];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
 
        HIT_POINT dam, base, s_evil, forced, vorpal;
@@ -2366,7 +2351,7 @@ int calc_arm_avgdamage(object_type *o_ptr)
 static int suppression_evil_dam(object_type *o_ptr)
 {
        int num = FALSE;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
 
        if (have_flag(flgs, TR_VAMPIRIC))
@@ -2417,8 +2402,8 @@ static int weakening_artifact(object_type *o_ptr)
 
         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;
+               DICE_NUMBER pre_dd = o_ptr->dd;
+               DICE_SID pre_ds = o_ptr->ds;
 
                if (o_ptr->dd > o_ptr->ds)
                {
@@ -2437,7 +2422,7 @@ static int weakening_artifact(object_type *o_ptr)
        
        if (o_ptr->to_d > 10)
        {
-               int pre_damage = o_ptr->to_d;
+               HIT_POINT pre_damage = o_ptr->to_d;
 
                o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
                if (o_ptr->to_d < 10)