OSDN Git Service

Random reward artifact can be set in lib/edit/q*.txt. (It is applied in Vault Quest.)
authoriks <iks@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 25 Jan 2013 17:47:00 +0000 (17:47 +0000)
committeriks <iks@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 25 Jan 2013 17:47:00 +0000 (17:47 +0000)
Quest type number can be got by QUEST_TYPE variable in dungeon files.

lib/edit/q0000004.txt
src/init1.c

index 18812c7..82ec034 100644 (file)
@@ -5,11 +5,15 @@ Q:$4:N:The Vault
 Q:4:N:Êõʪ¸Ë
 
 # Definition
-Q:$4:Q:3:0:0:0:30:0:88:0:6
-Q:4:Q:3:0:0:0:30:0:88:0:6
+Q:$4:Q:3:0:0:0:30:0:0:0:6
+Q:4:Q:3:0:0:0:30:0:0:0:6
+
+# Random Reward (can set less than 30 items)
+Q:$4:R:88
+Q:4:R:88
 
 # Description for quest
-?:[LEQ $QUEST4 2]
+?:[AND [LEQ $QUEST4 2] [EQU $QUEST_TYPE4 3]]
 Q:$4:T:The vault was used outside the town as a minor fortress and
 Q:$4:T:stored many valuable items.  It has since been overrun.  Please
 Q:$4:T:find the short sword known as Sting and return it to us!
@@ -19,32 +23,47 @@ Q:$4:T:through one at a time. The monsters here are strong and there are
 Q:$4:T:traps to be concerned with as well.
 Q:4:T:³¹¤Î³°¤Î¢¤Ï¾®µ¬ÌϤÊÍ׺ɤȤ·¤Æ»È¤ï¤ì¤Æ¤¤¤Æ¡¢Â¿¤¯¤Îµ®½Å¤ÊÉÊʪ¤¬
 Q:4:T:Ãߤ¨¤é¤ì¤Æ¤¤¤Þ¤·¤¿¡£¤·¤«¤·º£¤Ç¤Ï¥â¥ó¥¹¥¿¡¼¤É¤â¤ËÀêµò¤µ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤¹¡£
-Q:4:T:¤É¤¦¤«Â¢¤«¤é¡Ø¤Ä¤é¤Ì¤­´Ý¡Ù¤È¸Æ¤Ð¤ì¤ëû·õ¤ò¸«¤Ä¤±½Ð¤·¡¢²æ¡¹¤Î¸µ¤Ë»ý¤Áµ¢¤Ã
-Q:4:T:¤Æ²¼¤µ¤¤¡ª·õ¤ò½¦¤Ã¤¿»þÅÀ¤Ç¥¯¥¨¥¹¥ÈãÀ®¤È¤Ê¤ë¤Ç¤·¤ç¤¦¡£¡Ø¤Ä¤é¤Ì¤­´Ý¡Ù¤Ï¤É
-Q:4:T:¤ÎÉô²°¤Ë¤¢¤ë¤«Ê¬¤«¤é¤Ê¤¤¤Î¤Ç¡¢Éô²°¤ò°ì¤Ä¤º¤Ä¸«¤Æ¤Þ¤ï¤Ã¤Æ²¼¤µ¤¤¡£¤³¤³¤Î¥â
-Q:4:T:¥ó¥¹¥¿¡¼¤Ï¼ê¶¯¤¯¡¢¤Þ¤¿æ«¤â¤·¤«¤±¤é¤ì¤Æ¤¤¤Þ¤¹¡£¤¯¤ì¤°¤ì¤âÃí°Õ¤·¤Æ²¼¤µ¤¤¡£
+Q:4:T:¤Þ¤ÀÃæ¤Ë¤¢¤ë¤Ï¤º¤ÎÅÁÀâ¤ÎÉð¶ñ¤ò¸«¤Ä¤±½Ð¤·¡¢²æ¡¹¤Î¸µ¤Ë»ý¤Áµ¢¤Ã¤Æ²¼¤µ¤¤¡ª
+Q:4:T:Éð¶ñ¤ò½¦¤Ã¤¿»þÅÀ¤Ç¥¯¥¨¥¹¥ÈãÀ®¤È¤Ê¤ë¤Ç¤·¤ç¤¦¡£¤·¤«¤·¡¢¤É¤ÎÉô²°¤Ë¤¢¤ë¤«
+Q:4:T:ʬ¤«¤é¤Ê¤¤¤Î¤Ç¡¢Éô²°¤ò°ì¤Ä¤º¤Ä¸«¤Æ¤Þ¤ï¤Ã¤Æ²¼¤µ¤¤¡£¤³¤³¤Î¥â¥ó¥¹¥¿¡¼¤Ï
+Q:4:T:¼ê¶¯¤¯¡¢¤Þ¤¿æ«¤â¤·¤«¤±¤é¤ì¤Æ¤¤¤Þ¤¹¡£¤¯¤ì¤°¤ì¤âÃí°Õ¤·¤Æ²¼¤µ¤¤¡£
+?:[AND [LEQ $QUEST4 2] [EQU $QUEST_TYPE4 6]]
+Q:$4:T:The vault was used outside the town as a minor fortress and
+Q:$4:T:stored many valuable items.  It is now occupied by many monsters,
+Q:$4:T:and many items are lost. However, we want to get back at least
+Q:$4:T:the vault. Please kill all monsters in the vault.
+Q:4:T:Ä®¤Î³°¤Î¢¤Ï¾®µ¬ÌϤÊÍ׺ɤȤ·¤Æ»È¤ï¤ì¤Æ¤¤¤Æ¡¢Â¿¤¯¤Îµ®½Å¤ÊÉÊʪ¤¬
+Q:4:T:Ãߤ¨¤é¤ì¤Æ¤¤¤Þ¤·¤¿¡£¤·¤«¤·º£¤Ç¤Ï¥â¥ó¥¹¥¿¡¼¤É¤â¤ËÀêµò¤µ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤¹¡£
+Q:4:T:¿¤¯¤ÎÉÊʪ¤¬¼º¤ï¤ì¤Þ¤·¤¿¤¬¡¢¤»¤á¤Æ¢¤À¤±¤Ç¤â¼è¤êÊÖ¤·¤¿¤¤¤Î¤Ç¤¹¡ª
+Q:4:T:¢¤òÀêµò¤¹¤ë¥â¥ó¥¹¥¿¡¼¤òÁ´¤ÆÂǤÁÅݤ·¤Æ¤¯¤À¤µ¤¤¡£
 ?:1
 
 # Description for quest rewarding
-?:[EQU $QUEST4 3]
-Q:$4:T:Please keep the sword, it will aid you in your future quests.
-Q:4:T:¤½¤Î·õ¤Ï¤ª»ý¤Á²¼¤µ¤¤¡£¤³¤ì¤«¤é¤ÎËÁ¸±¤Î½õ¤±¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
+?:[AND [EQU $QUEST4 3] [EQU $QUEST_TYPE4 3]]
+Q:$4:T:Please keep the weapon, it will aid you in your future quests.
+Q:4:T:¤½¤ÎÉð´ï¤Ï¤ª»ý¤Á²¼¤µ¤¤¡£¤³¤ì¤«¤é¤ÎËÁ¸±¤Î½õ¤±¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
+?:[AND [EQU $QUEST4 3] [EQU $QUEST_TYPE4 6]]
+Q:$4:T:Please keep the items, it will aid you in your future quests.
+Q:4:T:¢¤ÎʪÉʤϤªÎé¤Ë¤ª»ý¤Á¤¯¤À¤µ¤¤¡£¶õ¤¤¤¿Â¢¤Ï±é·à¾ì¤Ë¤·¤è¤¦¤È»×¤¤¤Þ¤¹¡£
 ?:1
 
 # Description for quest failed
-?:[EQU $QUEST4 5]
-Q:$4:T:You didn't find the sword?  Well, the monsters have probably
-Q:$4:T:carried it away.  Too bad, Sting would have been quiet helpful
+?:[AND [EQU $QUEST4 5] [EQU $QUEST_TYPE4 3]]
+Q:$4:T:You didn't find the weapon? Well, the monsters have probably
+Q:$4:T:carried it away.  Too bad, it would have been quiet helpful
 Q:$4:T:in driving the evil out of our town.
-Q:4:T:¤¢¤Î·õ¤ò¸«¤Ä¤±¤é¤ì¤Ê¤«¤Ã¤¿¤Î¤Ç¤¹¤«¡©¤ª¤½¤é¤¯¡¢¥â¥ó¥¹¥¿¡¼¤É¤â¤¬»ý¤Ã¤Æ¤¤¤Ã¤Æ
-Q:4:T:¤·¤Þ¤Ã¤¿¤ó¤Ç¤·¤ç¤¦¤Ê¡£¤È¤Æ¤â»ÄÇ°¤Ç¤¹¡£¡Ø¤Ä¤é¤Ì¤­´Ý¡Ù¤Ï¤³¤Î³¹¤«¤é°­¤ò°ìÁݤ¹¤ë
+Q:4:T:¤¢¤ÎÉð´ï¤ò¸«¤Ä¤±¤é¤ì¤Ê¤«¤Ã¤¿¤Î¤Ç¤¹¤«¡©¤ª¤½¤é¤¯¡¢¥â¥ó¥¹¥¿¡¼¤É¤â¤¬»ý¤Ã¤Æ¤¤¤Ã¤Æ
+Q:4:T:¤·¤Þ¤Ã¤¿¤ó¤Ç¤·¤ç¤¦¤Ê¡£¤È¤Æ¤â»ÄÇ°¤Ç¤¹¡£¥¢¥ì¤Ï¤³¤Î³¹¤«¤é°­¤ò°ìÁݤ¹¤ë
 Q:4:T:¤Î¤Ë¤È¤Æ¤âÌò¤ËΩ¤Ã¤¿¤Ç¤·¤ç¤¦¤Ë¡£
+?:[AND [EQU $QUEST4 5] [EQU $QUEST_TYPE4 6]]
+Q:$4:T:Too bad, we can not get back the vault forever......?
+Q:$4:T:¤Ê¤ó¤Æ¤³¤È¤À¡Ä¤â¤¦Â¢¤ò¼è¤êÌ᤹½Ñ¤Ï¤Ê¤¤¤Î¤«¡Ä¡©
 ?:1
 
-# Floor with "Sting"
+# Floor with rewarding artifact e.g."Sting"
 F:a:FLOOR:8:0:0:0:!
 
-# Floor with "Small sword"
+# Floor with base object of artifact e.g."Small sword"
 F:b:FLOOR:8:0:!
 
 # Random monster 7 levels out of depth and on no Teleportation grid
index 584cc53..8c8bce4 100644 (file)
@@ -3409,10 +3409,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 +3925,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 +4409,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"))
                        {