OSDN Git Service

character_dungeon == FALSEであってもGLOW地形に対応する処理が必要な場
[hengband/hengband.git] / src / artifact.c
index b7c0d67..eb6db95 100644 (file)
@@ -167,7 +167,7 @@ void one_ability(object_type *o_ptr)
 {
        switch (randint0(10))
        {
-       case 0: add_flag(o_ptr->art_flags, TR_FEATHER);     break;
+       case 0: add_flag(o_ptr->art_flags, TR_LEVITATION);     break;
        case 1: add_flag(o_ptr->art_flags, TR_LITE);        break;
        case 2: add_flag(o_ptr->art_flags, TR_SEE_INVIS);   break;
        case 3: add_flag(o_ptr->art_flags, TR_WARNING);     break;
@@ -207,7 +207,7 @@ static void curse_artifact(object_type * o_ptr)
 
 static void random_plus(object_type * o_ptr)
 {
-       int this_type = (o_ptr->tval <= TV_WEAPON_END ? 23 : 19);
+       int this_type = (object_is_weapon_ammo(o_ptr) ? 23 : 19);
 
        switch (artifact_bias)
        {
@@ -871,7 +871,7 @@ static void random_misc(object_type * o_ptr)
                        break;
                case 12:
                case 13:
-                       add_flag(o_ptr->art_flags, TR_FEATHER);
+                       add_flag(o_ptr->art_flags, TR_LEVITATION);
                        break;
                case 15:
                case 16:
@@ -892,7 +892,7 @@ static void random_misc(object_type * o_ptr)
                case 24:
                case 25:
                case 26:
-                       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
+                       if (object_is_armour(o_ptr))
                                random_misc(o_ptr);
                        else
                        {
@@ -1633,7 +1633,7 @@ 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_type = (o_ptr->tval <= TV_WEAPON_END ? 7 : 5);
+       int     max_type = (object_is_weapon_ammo(o_ptr) ? 7 : 5);
        int     power_level;
        s32b    total_flags;
        bool    a_cursed = FALSE;
@@ -1734,7 +1734,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
        if (!a_scroll && one_in_(A_CURSED))
                a_cursed = TRUE;
-       if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && cursed_p(o_ptr))
+       if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && object_is_cursed(o_ptr))
                a_cursed = TRUE;
 
        while (one_in_(powers) || one_in_(7) || one_in_(10))
@@ -1755,7 +1755,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                                has_pval = TRUE;
                                break;
                        case 3: case 4:
-                               if (one_in_(2) && (o_ptr->tval <= TV_WEAPON_END) && (o_ptr->tval != TV_BOW))
+                               if (one_in_(2) && object_is_weapon_ammo(o_ptr) && (o_ptr->tval != TV_BOW))
                                {
                                        if (a_cursed && !one_in_(13)) break;
                                        if (one_in_(13))
@@ -1812,9 +1812,9 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        }
 
        /* give it some plusses... */
-       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
+       if (object_is_armour(o_ptr))
                o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
-       else if (o_ptr->tval <= TV_SWORD)
+       else if (object_is_weapon_ammo(o_ptr))
        {
                o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
                o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
@@ -1833,14 +1833,13 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        if (a_cursed) curse_artifact(o_ptr);
 
        if (!a_cursed &&
-           (randint1((o_ptr->tval >= TV_ARMOR_BEGIN)
-           ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
+           one_in_(object_is_armour(o_ptr) ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE))
        {
                o_ptr->xtra2 = 0;
                give_activation_power(o_ptr);
        }
 
-       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
+       if (object_is_armour(o_ptr))
        {
                while ((o_ptr->to_d+o_ptr->to_h) > 20)
                {
@@ -1882,7 +1881,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                remove_flag(o_ptr->art_flags, TR_BRAND_COLD);
        }
 
-       if (o_ptr->tval >= TV_ARMOR_BEGIN)
+       if (!object_is_weapon_ammo(o_ptr))
        {
                /* For armors */
                if (a_cursed) power_level = 0;
@@ -1902,7 +1901,13 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
        if (a_scroll)
        {
-               char dummy_name[80];
+               char dummy_name[80] = "";
+#ifdef JP
+               cptr ask_msg = "¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©";
+#else
+               cptr ask_msg = "What do you want to call the artifact? ";
+#endif
+
                /* Identify it fully */
                object_aware(o_ptr);
                object_known(o_ptr);
@@ -1910,60 +1915,47 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                /* Mark the item as fully known */
                o_ptr->ident |= (IDENT_MENTAL);
 
-               strcpy(dummy_name, "");
                (void)screen_object(o_ptr, TRUE);
 
-#ifdef JP
-               if (!(get_string("¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©", dummy_name, 80)))
-#else
-               if (!(get_string("What do you want to call the artifact? ", dummy_name, 80)))
-#endif
-
+               if (!get_string(ask_msg, dummy_name, sizeof dummy_name)
+                   || !dummy_name[0])
                {
-                       get_random_name(new_name, (bool)(o_ptr->tval >= TV_ARMOR_BEGIN), power_level);
-               }
-               else
-               {
-#ifdef JP
-                       strcpy(new_name, "¡Ô");
-#else
-                       strcpy(new_name, "'");
+                       /* Cancelled */
+#if 0
+                       if (one_in_(2))
+                       {
+                               get_table_sindarin(dummy_name);
+                       }
+                       else
 #endif
+                       {
+                               get_table_name_aux(dummy_name);
+                       }
+               }
 
-                       strcat(new_name, dummy_name);
 #ifdef JP
-                       strcat(new_name, "¡Õ¤È¤¤¤¦Ì¾¤Î");
+               sprintf(new_name, "¡Ô%s¡Õ", dummy_name);
 #else
-                       strcat(new_name, "'");
+               sprintf(new_name, "'%s'", dummy_name);
 #endif
 
-               }
-
                chg_virtue(V_INDIVIDUALISM, 2);
                chg_virtue(V_ENCHANT, 5);
-
        }
        else
        {
-               get_random_name(new_name, (bool)(o_ptr->tval >= TV_ARMOR_BEGIN), power_level);
+               get_random_name(new_name, object_is_armour(o_ptr), power_level);
        }
 
        if (cheat_xtra)
        {
-               if (artifact_bias)
 #ifdef JP
-msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
+               if (artifact_bias) msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
+               else msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
 #else
-                       msg_format("Biased artifact: %d.", artifact_bias);
+               if (artifact_bias) msg_format("Biased artifact: %d.", artifact_bias);
+               else msg_print("No bias in artifact.");
 #endif
-
-               else
-#ifdef JP
-msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
-#else
-                       msg_print("No bias in artifact.");
-#endif
-
        }
 
        /* Save the inscription */
@@ -2253,7 +2245,7 @@ bool activate_random_artifact(object_type * o_ptr)
                                        m_ptr = &m_list[c_ptr->m_idx];
 
                                        /* Hack -- attack monsters */
-                                       if (c_ptr->m_idx && (m_ptr->ml || have_flag(f_flags_bold(y, x), FF_PROJECT)))
+                                       if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
                                                py_attack(y, x, 0);
                                }
                        }