OSDN Git Service

[Refactor] #37353 鏡使いのレイシャル「静水」を mirror_concentration() に分離。 / Separate Mirror master...
[hengband/hengband.git] / src / quest.c
index 1bfb55a..e6d79c0 100644 (file)
@@ -5,6 +5,18 @@
 
 
 /*!
+ * @brief クエスト突入時のメッセージテーブル / Array of places to find an inscription
+ */
+static concptr find_quest[] =
+{
+       _("床にメッセージが刻まれている:", "You find the following inscription in the floor"),
+       _("壁にメッセージが刻まれている:", "You see a message inscribed in the wall"),
+       _("メッセージを見つけた:", "There is a sign saying"),
+       _("何かが階段の上に書いてある:", "Something is written on the staircase"),
+       _("巻物を見つけた。メッセージが書いてある:", "You find a scroll with the following message"),
+};
+
+/*!
  * @brief ランダムクエストの討伐ユニークを決める / Determine the random quest uniques
  * @param q_ptr クエスト構造体の参照ポインタ
  * @return なし
@@ -310,3 +322,107 @@ void check_find_art_quest_completion(object_type *o_ptr)
        }
 }
 
+
+/*!
+ * @brief クエストの導入メッセージを表示する / Discover quest
+ * @param q_idx 開始されたクエストのID
+ */
+void quest_discovery(QUEST_IDX q_idx)
+{
+       quest_type *q_ptr = &quest[q_idx];
+       monster_race *r_ptr = &r_info[q_ptr->r_idx];
+       MONSTER_NUMBER q_num = q_ptr->max_num;
+       GAME_TEXT name[MAX_NLEN];
+
+       /* No quest index */
+       if (!q_idx) return;
+
+       strcpy(name, (r_name + r_ptr->name));
+
+       msg_print(find_quest[rand_range(0, 4)]);
+       msg_print(NULL);
+
+       if (q_num == 1)
+       {
+               /* Unique */
+
+               /* Hack -- "unique" monsters must be "unique" */
+               if ((r_ptr->flags1 & RF1_UNIQUE) && (0 == r_ptr->max_num))
+               {
+                       msg_print(_("この階は以前は誰かによって守られていたようだ…。", "It seems that this level was protected by someone before..."));
+                       /* The unique is already dead */
+                       quest[q_idx].status = QUEST_STATUS_FINISHED;
+                       q_ptr->complev = 0;
+                       update_playtime();
+                       q_ptr->comptime = playtime;
+               }
+               else
+               {
+                       msg_format(_("注意せよ!この階は%sによって守られている!", "Beware, this level is protected by %s!"), name);
+               }
+       }
+       else
+       {
+               /* Normal monsters */
+#ifndef JP
+               plural_aux(name);
+#endif
+               msg_format(_("注意しろ!この階は%d体の%sによって守られている!", "Be warned, this level is guarded by %d %s!"), q_num, name);
+
+       }
+}
+
+
+/*!
+ * @brief 新しく入ったダンジョンの階層に固定されている一般のクエストを探し出しIDを返す。
+ * / Hack -- Check if a level is a "quest" level
+ * @param level 検索対象になる階
+ * @return クエストIDを返す。該当がない場合0を返す。
+ */
+QUEST_IDX quest_number(DEPTH level)
+{
+       QUEST_IDX i;
+
+       /* Check quests */
+       if (p_ptr->inside_quest)
+               return (p_ptr->inside_quest);
+
+       for (i = 0; i < max_q_idx; i++)
+       {
+               if (quest[i].status != QUEST_STATUS_TAKEN) continue;
+
+               if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
+                       !(quest[i].flags & QUEST_FLAG_PRESET) &&
+                       (quest[i].level == level) &&
+                       (quest[i].dungeon == dungeon_type))
+                       return (i);
+       }
+
+       /* Check for random quest */
+       return (random_quest_number(level));
+}
+
+/*!
+ * @brief 新しく入ったダンジョンの階層に固定されているランダムクエストを探し出しIDを返す。
+ * @param level 検索対象になる階
+ * @return クエストIDを返す。該当がない場合0を返す。
+ */
+QUEST_IDX random_quest_number(DEPTH level)
+{
+       QUEST_IDX i;
+
+       if (dungeon_type != DUNGEON_ANGBAND) return 0;
+
+       for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
+       {
+               if ((quest[i].type == QUEST_TYPE_RANDOM) &&
+                       (quest[i].status == QUEST_STATUS_TAKEN) &&
+                       (quest[i].level == level) &&
+                       (quest[i].dungeon == DUNGEON_ANGBAND))
+               {
+                       return i;
+               }
+       }
+
+       return 0;
+}