1 #include "cmd-io/cmd-lore.h"
2 #include "core/asking-player.h"
3 #include "core/stuff-handler.h"
4 #include "game-option/cheat-options.h"
5 #include "game-option/game-play-options.h"
6 #include "io/input-key-acceptor.h"
7 #include "lore/lore-util.h"
8 #include "monster-race/monster-race.h"
9 #include "monster-race/race-flags1.h"
10 #include "monster-race/race-flags7.h"
11 #include "system/monster-race-info.h"
12 #include "system/player-type-definition.h"
13 #include "term/gameterm.h"
14 #include "term/screen-processor.h"
15 #include "term/term-color-types.h"
16 #include "term/z-form.h"
17 #include "util/int-char-converter.h"
18 #include "util/sort.h"
19 #include "util/string-processor.h"
20 #include "view/display-lore.h"
23 * @brief モンスターの思い出を見るコマンドのメインルーチン
24 * Identify a character, allow recall of monsters
25 * @param player_ptr プレイヤーへの参照ポインタ
28 * Several "special" responses recall "multiple" monsters:
30 * ^U (all unique monsters)
31 * ^N (all non-unique monsters)
33 * The responses may be sorted in several ways, see below.
35 * Note that the player ghosts are ignored.
38 void do_cmd_query_symbol(PlayerType *player_ptr)
48 constexpr auto prompt = _("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
49 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ");
50 const auto sym_opt = input_command(prompt);
51 if (!sym_opt.has_value()) {
55 const auto sym = sym_opt.value();
57 for (ident_i = 0; ident_info[ident_i]; ++ident_i) {
58 if (sym == ident_info[ident_i][0]) {
64 std::string monster_name("");
65 if (sym == KTRL('A')) {
67 buf = _("全モンスターのリスト", "Full monster list.");
68 } else if (sym == KTRL('U')) {
70 buf = _("ユニーク・モンスターのリスト", "Unique monster list.");
71 } else if (sym == KTRL('N')) {
73 buf = _("ユニーク外モンスターのリスト", "Non-unique monster list.");
74 } else if (sym == KTRL('R')) {
76 buf = _("乗馬可能モンスターのリスト", "Ridable monster list.");
77 } else if (sym == KTRL('M')) {
79 const auto monster_name_opt = input_string(_("名前(英語の場合小文字で可)", "Enter name:"), MAX_MONSTER_NAME);
80 if (!monster_name_opt.has_value()) {
84 monster_name = monster_name_opt.value();
85 buf = format(_("名前:%sにマッチ", "Monsters' names with \"%s\""), monster_name.data());
86 } else if (ident_info[ident_i]) {
87 buf = format("%c - %s.", sym, ident_info[ident_i] + 2);
89 buf = format("%c - %s", sym, _("無効な文字", "Unknown Symbol"));
93 std::vector<MonsterRaceId> monraces;
94 for (const auto &[monrace_id, monrace] : monraces_info) {
95 if (!cheat_know && !monrace.r_sights) {
99 if (norm && monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
103 if (uniq && monrace.kind_flags.has_not(MonsterKindType::UNIQUE)) {
107 if (ride && !(monrace.flags7 & (RF7_RIDING))) {
111 if (!monster_name.empty()) {
112 for (size_t xx = 0; xx < monster_name.length(); xx++) {
114 if (iskanji(monster_name[xx])) {
119 if (isupper(monster_name[xx])) {
120 monster_name[xx] = (char)tolower(monster_name[xx]);
125 auto temp2(monrace.E_name);
127 auto temp2(monrace.name);
129 for (size_t xx = 0; xx < temp2.length(); xx++) {
130 if (isupper(temp2[xx])) {
131 temp2[xx] = (char)tolower(temp2[xx]);
136 if (str_find(temp2, monster_name) || str_find(monrace.name, monster_name))
138 if (str_find(temp2, monster_name))
140 monraces.push_back(monrace_id);
143 else if (all || (monrace.d_char == sym)) {
144 monraces.push_back(monrace_id);
148 if (monraces.empty()) {
152 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
153 auto query = inkey();
156 ang_sort(player_ptr, monraces.data(), &why, monraces.size(), ang_sort_comp_hook, ang_sort_swap_hook);
167 ang_sort(player_ptr, monraces.data(), &why, monraces.size(), ang_sort_comp_hook, ang_sort_swap_hook);
170 auto i = monraces.size() - 1;
172 auto r_idx = monraces[i];
173 monster_race_track(player_ptr, r_idx);
174 handle_stuff(player_ptr);
178 screen_roff(player_ptr, monraces[i], MONSTER_LORE_NORMAL);
182 term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
194 if (query == ESCAPE) {
199 if (++i == monraces.size()) {
207 i = monraces.size() - 1;