OSDN Git Service

./bootstrap 実行時に warning が出ないよう修正。
[hengband/hengband.git] / src / artifact.c
index eb6db95..88d9e37 100644 (file)
@@ -12,6 +12,7 @@
 
 
 /* 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
@@ -1537,7 +1538,13 @@ static void give_activation_power(object_type *o_ptr)
 
 static void get_random_name(char *return_name, bool armour, int power)
 {
-       if (randint1(100) <= TABLE_NAME)
+       int prob = randint1(100);
+
+       if (prob <= SINDARIN_NAME)
+       {
+               get_table_sindarin(return_name);
+       }
+       else if (prob <= TABLE_NAME)
        {
                get_table_name(return_name);
        }
@@ -1552,35 +1559,31 @@ static void get_random_name(char *return_name, bool armour, int power)
                                {
                                        case 0:
 #ifdef JP
-filename = "a_cursed_j.txt";
+                                               filename = "a_cursed_j.txt";
 #else
                                                filename = "a_cursed.txt";
 #endif
-
                                                break;
                                        case 1:
 #ifdef JP
-filename = "a_low_j.txt";
+                                               filename = "a_low_j.txt";
 #else
                                                filename = "a_low.txt";
 #endif
-
                                                break;
                                        case 2:
 #ifdef JP
-filename = "a_med_j.txt";
+                                               filename = "a_med_j.txt";
 #else
                                                filename = "a_med.txt";
 #endif
-
                                                break;
                                        default:
 #ifdef JP
-filename = "a_high_j.txt";
+                                               filename = "a_high_j.txt";
 #else
                                                filename = "a_high.txt";
 #endif
-
                                }
                                break;
                        default:
@@ -1588,41 +1591,37 @@ filename = "a_high_j.txt";
                                {
                                        case 0:
 #ifdef JP
-filename = "w_cursed_j.txt";
+                                               filename = "w_cursed_j.txt";
 #else
                                                filename = "w_cursed.txt";
 #endif
-
                                                break;
                                        case 1:
 #ifdef JP
-filename = "w_low_j.txt";
+                                               filename = "w_low_j.txt";
 #else
                                                filename = "w_low.txt";
 #endif
-
                                                break;
                                        case 2:
 #ifdef JP
-filename = "w_med_j.txt";
+                                               filename = "w_med_j.txt";
 #else
                                                filename = "w_med.txt";
 #endif
-
                                                break;
                                        default:
 #ifdef JP
-filename = "w_high_j.txt";
+                                               filename = "w_high_j.txt";
 #else
                                                filename = "w_high.txt";
 #endif
-
                                }
                }
 
                (void)get_rnd_line(filename, artifact_bias, return_name);
 #ifdef JP
if(return_name[0]==0)get_table_name(return_name);
               if (return_name[0] == 0) get_table_name(return_name);
 #endif
        }
 }
@@ -1680,6 +1679,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                                warrior_artifact_bias = 25;
                                break;
                        case CLASS_RANGER:
+                       case CLASS_SNIPER:
                                artifact_bias = BIAS_RANGER;
                                warrior_artifact_bias = 30;
                                break;
@@ -1915,19 +1915,17 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                /* Mark the item as fully known */
                o_ptr->ident |= (IDENT_MENTAL);
 
-               (void)screen_object(o_ptr, TRUE);
+               (void)screen_object(o_ptr, 0L);
 
                if (!get_string(ask_msg, dummy_name, sizeof dummy_name)
                    || !dummy_name[0])
                {
                        /* Cancelled */
-#if 0
                        if (one_in_(2))
                        {
-                               get_table_sindarin(dummy_name);
+                               get_table_sindarin_aux(dummy_name);
                        }
                        else
-#endif
                        {
                                get_table_name_aux(dummy_name);
                        }
@@ -2722,6 +2720,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                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);
@@ -2984,7 +2983,7 @@ bool activate_random_artifact(object_type * o_ptr)
                        msg_print("It twists space around you...");
 #endif
 
-                       teleport_player(100, FALSE);
+                       teleport_player(100, 0L);
                        o_ptr->timeout = 45;
                        break;
                }
@@ -3017,6 +3016,35 @@ bool activate_random_artifact(object_type * o_ptr)
 }
 
 
+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;
@@ -3038,6 +3066,7 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
                        return;
                }
        }
+
        if (o_ptr->name1 == ART_MURAMASA)
        {
                if (p_ptr->pclass != CLASS_SAMURAI)
@@ -3055,23 +3084,14 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
 
        if (o_ptr->name1 == ART_BLOOD)
        {
-               int dummy, i;
-               dummy = randint1(2)+randint1(2);
-               for (i = 0; i < dummy; i++)
-               {
-                       int flag = randint0(19);
-                       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);
-               dummy = 2;
-               for (i = 0; i < dummy; i++)
+               get_bloody_moon_flags(o_ptr);
+       }
+
+       if (o_ptr->name1 == ART_HEAVENLY_MAIDEN)
+       {
+               if (p_ptr->psex != SEX_FEMALE)
                {
-                       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);
+                       add_flag(o_ptr->art_flags, TR_AGGRAVATE);
                }
        }
 
@@ -3099,7 +3119,7 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
 /*
  * Create the artifact of the specified number
  */
-void create_named_art(int a_idx, int y, int x)
+bool create_named_art(int a_idx, int y, int x)
 {
        object_type forge;
        object_type *q_ptr;
@@ -3111,13 +3131,13 @@ void create_named_art(int a_idx, int y, int x)
        q_ptr = &forge;
 
        /* Ignore "empty" artifacts */
-       if (!a_ptr->name) return;
+       if (!a_ptr->name) return FALSE;
 
        /* Acquire the "kind" index */
        i = lookup_kind(a_ptr->tval, a_ptr->sval);
 
        /* Oops */
-       if (!i) return;
+       if (!i) return FALSE;
 
        /* Create the artifact */
        object_prep(q_ptr, i);
@@ -3145,6 +3165,12 @@ void 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 */
-       (void)drop_near(q_ptr, -1, y, x);
+       return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE;
 }