OSDN Git Service

[Refactor] #37359 suppression_evil_dam()修正。 / Refactor suppression_evil_dam().
[hengband/hengband.git] / src / artifact.c
index bae071c..d6576f4 100644 (file)
@@ -12,8 +12,9 @@
 
 #include "angband.h"
 #include "cmd-activate.h"
+#include "object-curse.h"
 
-static int suppression_evil_dam(object_type *o_ptr);
+static bool suppression_evil_dam(object_type *o_ptr);
 static int weakening_artifact(object_type *o_ptr);
 
 
@@ -1742,8 +1743,8 @@ 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;
+       GAME_TEXT new_name[1024];
+       PARAMETER_VALUE has_pval = 0;
        int     powers = randint1(5) + 1;
        int     max_powers;
        int     max_type = (object_is_weapon_ammo(o_ptr) ? 7 : 5);
@@ -2026,7 +2027,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
        if (a_scroll)
        {
-               char dummy_name[80] = "";
+               GAME_TEXT dummy_name[MAX_NLEN] = "";
                cptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
 
                /* Identify it fully */
@@ -2069,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;
@@ -2265,8 +2265,6 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
        IDX i;
 
        artifact_type *a_ptr = &a_info[a_idx];
-
-       /* Get local object */
        q_ptr = &forge;
 
        /* Ignore "empty" artifacts */
@@ -2275,7 +2273,6 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
        /* Acquire the "kind" index */
        i = lookup_kind(a_ptr->tval, a_ptr->sval);
 
-       /* Oops */
        if (!i) return FALSE;
 
        /* Create the artifact */
@@ -2311,7 +2308,7 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x)
 /*対邪平均ダメージの計算処理*/
 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;
@@ -2343,57 +2340,55 @@ int calc_arm_avgdamage(object_type *o_ptr)
 
        dam = dam + o_ptr->to_d;
 
-       msg_format_wizard(CHEAT_OBJECT,"素:%d> 対邪:%d> 理力:%d> 切:%d> 最終:%d",
-               base, s_evil, forced, vorpal, dam);
+       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)
+static bool 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))
        {
                if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 52))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if(have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 43))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if( have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 33))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if (calc_arm_avgdamage(o_ptr) > 63)
                {
-                       num = TRUE;
+                       return TRUE;
                }
        }
        else
        {
                if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(o_ptr) > 65))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 2) && (calc_arm_avgdamage(o_ptr) > 52))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if (have_flag(flgs, TR_BLOWS) && (o_ptr->pval == 3) && (calc_arm_avgdamage(o_ptr) > 40))
                {
-                       num = TRUE;
+                       return TRUE;
                }
                else if (calc_arm_avgdamage(o_ptr) > 75)
                {
-                       num = TRUE;
+                       return TRUE;
                }
        }
-       return(num);
+       return FALSE;
 }
 
 static int weakening_artifact(object_type *o_ptr)
@@ -2403,8 +2398,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)
                {
@@ -2423,7 +2418,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)