OSDN Git Service

Integrate initial flag, level and value settings of activations for random artifacts...
[hengband/hengband.git] / src / init1.c
index 584cc53..ba9accb 100644 (file)
@@ -123,6 +123,8 @@ static cptr r_info_blow_effect[] =
        "EXP_VAMP",
        "DR_MANA",
        "SUPERHURT",
+       "INERTIA",
+       "STUN",
        NULL
 };
 
@@ -811,7 +813,6 @@ static cptr k_info_gen_flags[] =
        "XXX",
 };
 
-
 /*
  * Dungeon flags
  */
@@ -2136,7 +2137,39 @@ static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
        return (1);
 }
 
+/*
+ * Grab one activation index flag
+ */
+static byte grab_one_activation_flag(cptr what)
+{
+       int i;
 
+       for (i = 0; ; i++)
+       {
+               if (activation_info[i].flag == NULL) break;
+
+               if (streq(what, activation_info[i].flag))
+               {
+                       return activation_info[i].index;
+               }
+       }
+
+       i = atoi(what);
+        if (i > 0)
+        {
+                return ((byte) i);
+        }
+
+       /* Oops */
+#ifdef JP
+       msg_format("̤ÃΤÎȯư¡¦¥Õ¥é¥° '%s'¡£", what);
+#else
+       msg_format("Unknown activation flag '%s'.", what);
+#endif
+
+       /* Error */
+       return (0);
+}
 
 
 /*
@@ -2284,6 +2317,21 @@ errr parse_a_info(char *buf, header *head)
                a_ptr->to_a =  ta;
        }
 
+       /* Hack -- Process 'U' for activation index */
+       else if (buf[0] == 'U')
+       {
+               byte n;
+               n = grab_one_activation_flag(buf + 2);
+               if (n > 0)
+               {
+                       a_ptr->act_idx = n;
+               }
+               else
+               {
+                       return (5);
+               }
+       }
+
        /* Hack -- Process 'F' for flags */
        else if (buf[0] == 'F')
        {
@@ -3409,10 +3457,14 @@ static errr parse_line_feature(char *buf)
                                {
                                        if (p_ptr->inside_quest)
                                        {
-                                               artifact_type *a_ptr = &a_info[quest[p_ptr->inside_quest].k_idx];
-                                               if (!(a_ptr->gen_flags & TRG_INSTA_ART))
+                                               int a_idx = quest[p_ptr->inside_quest].k_idx;
+                                               if (a_idx)
                                                {
-                                                       letter[index].object = lookup_kind(a_ptr->tval, a_ptr->sval);
+                                                       artifact_type *a_ptr = &a_info[a_idx];
+                                                       if (!(a_ptr->gen_flags & TRG_INSTA_ART))
+                                                       {
+                                                               letter[index].object = lookup_kind(a_ptr->tval, a_ptr->sval);
+                                                       }
                                                }
                                        }
                                }
@@ -3921,6 +3973,38 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        return (0);
                }
 
+               else if (zz[1][0] == 'R')
+               {
+                       if (init_flags & INIT_ASSIGN)
+                       {
+                               int idx, count = 0;
+                               int reward_idx = 0;
+
+                               for (idx = 2; idx < num; idx++)
+                               {
+                                       int a_idx = atoi(zz[idx]);
+                                       if (a_idx < 1) continue;
+                                       if (a_info[a_idx].cur_num > 0) continue;
+                                       count++;
+                                       if (one_in_(count)) reward_idx = a_idx;
+                               }
+
+                               if (reward_idx)
+                               {
+                                       /* Set quest's rewarding artifact */
+                                       q_ptr->k_idx = reward_idx;
+                                       a_info[reward_idx].gen_flags |= TRG_QUESTITEM;
+                               }
+                               else
+                               {
+                                       /* Change a quest type to KILL_ALL when all artifact of reward list are got */
+                                       q_ptr->type = QUEST_TYPE_KILL_ALL;
+                               }
+                       }
+
+                       return (0);
+               }
+
                /* Process "Q:<q_index>:N:<name>" -- quest name */
                else if (zz[1][0] == 'N')
                {
@@ -4373,6 +4457,14 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
                                v = tmp;
                        }
 
+                       /* Quest type */
+                       else if (prefix(b+1, "QUEST_TYPE"))
+                       {
+                               /* "QUEST_TYPE" uses a special parameter to determine the type of the quest */
+                               sprintf(tmp, "%d", quest[atoi(b+11)].type);
+                               v = tmp;
+                       }
+
                        /* Quest status */
                        else if (prefix(b+1, "QUEST"))
                        {