5 * @details 通常のコマンドではないのでcmd-xxx/ ではなくwizard/ 以下に置く
8 #include "wizard/cmd-wizard.h"
9 #include "birth/inventory-initializer.h"
10 #include "cmd-io/cmd-help.h"
11 #include "core/asking-player.h"
12 #include "inventory/inventory-object.h"
13 #include "inventory/inventory-slot-types.h"
14 #include "io/input-key-requester.h"
15 #include "mutation/mutation-investor-remover.h"
16 #include "player/patron.h"
17 #include "spell-kind/spells-detection.h"
18 #include "spell-kind/spells-floor.h"
19 #include "spell-kind/spells-perception.h"
20 #include "spell-kind/spells-sight.h"
21 #include "spell-kind/spells-teleport.h"
22 #include "spell/spells-status.h"
23 #include "status/experience.h"
24 #include "system/floor-type-definition.h"
25 #include "system/grid-type-definition.h"
26 #include "system/object-type-definition.h"
27 #include "system/player-type-definition.h"
28 #include "term/screen-processor.h"
29 #include "util/int-char-converter.h"
30 #include "view/display-messages.h"
31 #include "wizard/wizard-game-modifier.h"
32 #include "wizard/wizard-item-modifier.h"
33 #include "wizard/wizard-player-modifier.h"
34 #include "wizard/wizard-special-process.h"
35 #include "wizard/wizard-spells.h"
36 #include "wizard/wizard-spoiler.h"
45 * 空き: A,B,E,I,J,k,K,L,M,q,Q,R,T,U,V,W,y,Y
47 constexpr std::array debug_menu_table = {
48 std::make_tuple('a', _("全状態回復", "Restore all status")),
49 std::make_tuple('b', _("現在のターゲットを引き寄せる", "Teleport target back")),
50 std::make_tuple('c', _("オブジェクト生成", "Create object")),
51 std::make_tuple('C', _("固定アーティファクト生成", "Create fixed artifact")),
52 std::make_tuple('d', _("全感知", "Detection all")),
53 std::make_tuple('D', _("次元の扉", "Dimension door")),
54 std::make_tuple('e', _("能力値変更", "Modify player status")),
55 std::make_tuple('E', _("青魔法を全取得/エッセンスを全取得", "Learn all blue magics / Obtain all essences")),
56 std::make_tuple('f', _("*鑑定*", "*Idenfity*")),
57 std::make_tuple('F', _("地形ID変更", "Modify feature type under player")),
58 std::make_tuple('G', _("ゲーム設定コマンドメニュー", "Modify game configurations")),
59 std::make_tuple('H', _("モンスターの群れ生成", "Summon monsters")),
60 std::make_tuple('i', _("鑑定", "Idenfity")),
61 std::make_tuple('I', _("アイテム設定コマンドメニュー", "Modify item configurations")),
62 std::make_tuple('j', _("指定ダンジョン階にワープ", "Jump to floor depth of target dungeon")),
63 std::make_tuple('k', _("指定ダメージ・半径0の指定属性のボールを自分に放つ", "Fire a zero ball to self")),
64 std::make_tuple('m', _("魔法の地図", "Magic mapping")),
65 std::make_tuple('n', _("指定モンスター生成", "Summon target monster")),
66 std::make_tuple('N', _("指定モンスターをペットとして生成", "Summon target monster as pet")),
67 std::make_tuple('o', _("オブジェクトの能力変更", "Modift object abilities")),
68 std::make_tuple('O', _("オプション設定をダンプ", "Dump current options")),
69 std::make_tuple('p', _("ショート・テレポート", "Phase door")),
70 std::make_tuple('P', _("プレイヤー設定変更メニュー", "Modify player configurations")),
71 std::make_tuple('r', _("カオスパトロンの報酬", "Get reward of chaos patron")),
72 std::make_tuple('s', _("フロア相当のモンスター召喚", "Summon monster which be in target depth")),
73 std::make_tuple('t', _("テレポート", "Teleport self")),
74 std::make_tuple('u', _("啓蒙(忍者以外)", "Wiz-lite all floor except Ninja")),
75 std::make_tuple('w', _("啓蒙(忍者配慮)", "Wiz-lite all floor")),
76 std::make_tuple('x', _("経験値を得る(指定可)", "Get experience")),
77 std::make_tuple('X', _("所持品を初期状態に戻す", "Return inventory to initial")),
78 std::make_tuple('y', _("ダメージ100万・半径0の射撃のボールを放つ", "Cast missile ball had power a million")),
79 std::make_tuple('Y', _("指定ダメージ・半径0の指定属性のボールを放つ", "Cast zero ball had power a thousand")),
80 std::make_tuple('z', _("近隣のモンスター消去", "Terminate near monsters")),
81 std::make_tuple('Z', _("フロアの全モンスター消去", "Terminate all monsters in floor")),
82 std::make_tuple('@', _("特殊スペルの発動", "Activate specified spells")),
83 std::make_tuple('"', _("スポイラーのダンプ", "Dump spoiler")),
84 std::make_tuple('?', _("ヘルプ表示", "Help")),
88 * @brief デバグコマンドの一覧を表示する
90 * @param max_page ページ数
91 * @param page_size 1ページ行数
92 * @param max_line コマンド数
94 void display_debug_menu(int page, int max_page, int page_size, int max_line)
96 for (int y = 1; y < page_size + 3; y++)
97 term_erase(14, y, 64);
101 for (int i = 0; i < page_size; i++) {
102 int pos = page * page_size + i;
106 std::stringstream ss;
107 const auto &[symbol, desc] = debug_menu_table[pos];
108 ss << symbol << ") " << desc;
109 put_str(ss.str().c_str(), r++, c);
112 put_str("-- more --", r++, c);
116 * @brief デバッグコマンド選択処理への分岐
117 * @param player_ptr プレイヤーへの参照ポインタ
119 * @return コマンド終了ならTRUE、ページ送りならFALSE
121 bool exe_cmd_debug(player_type *player_ptr, char cmd)
134 wiz_cure_all(player_ptr);
137 wiz_teleport_back(player_ptr);
140 wiz_create_item(player_ptr);
143 wiz_create_named_art(player_ptr);
146 detect_all(player_ptr, DETECT_RAD_ALL * 3);
149 wiz_dimension_door(player_ptr);
152 wiz_change_status(player_ptr);
155 switch (player_ptr->pclass) {
156 case CLASS_BLUE_MAGE:
157 wiz_learn_blue_magic_all(player_ptr);
160 wiz_fillup_all_smith_essences(player_ptr);
167 identify_fully(player_ptr, false);
170 wiz_create_feature(player_ptr);
173 wizard_game_modifier(player_ptr);
176 wiz_summon_horde(player_ptr);
179 (void)ident_spell(player_ptr, false);
182 wizard_item_modifier(player_ptr);
185 wiz_jump_to_dungeon(player_ptr);
188 wiz_kill_me(player_ptr, 0, command_arg);
191 map_area(player_ptr, DETECT_RAD_ALL * 3);
194 patron_list[player_ptr->chaos_patron].gain_level_reward(player_ptr, command_arg);
197 wiz_summon_pet(player_ptr, command_arg);
200 wiz_summon_specific_enemy(player_ptr, command_arg);
206 wiz_modify_item(player_ptr);
209 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
212 wizard_player_modifier(player_ptr);
215 if (command_arg <= 0)
218 wiz_summon_random_enemy(player_ptr, command_arg);
221 teleport_player(player_ptr, 100, TELEPORT_SPONTANEOUS);
224 for (int y = 0; y < player_ptr->current_floor_ptr->height; y++)
225 for (int x = 0; x < player_ptr->current_floor_ptr->width; x++)
226 player_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_GLOW | CAVE_MARK;
228 wiz_lite(player_ptr, false);
231 wiz_lite(player_ptr, (bool)(player_ptr->pclass == CLASS_NINJA));
234 gain_exp(player_ptr, command_arg ? command_arg : (player_ptr->exp + 1));
237 for (INVENTORY_IDX i = INVEN_TOTAL - 1; i >= 0; i--)
238 if (player_ptr->inventory_list[i].k_idx)
239 drop_from_inventory(player_ptr, i, 999);
241 player_outfit(player_ptr);
244 wiz_kill_enemy(player_ptr);
247 wiz_kill_enemy(player_ptr, 0, command_arg);
250 wiz_zap_surrounding_monsters(player_ptr);
253 wiz_zap_floor_monsters(player_ptr);
259 wiz_debug_spell(player_ptr);
262 exe_output_spoilers();
265 do_cmd_help(player_ptr);
268 msg_print("That is not a valid debug command.");
276 * @brief デバッグコマンドを選択する処理のメインルーチン /
277 * Ask for and parse a "debug command"
278 * The "command_arg" may have been set.
279 * @param player_ptr プレイヤーへの参照ポインタ
281 * 番号を指定するには、それをN及びデバッグコマンドをXとしてとして「0N^aX」とする
283 void do_cmd_debug(player_type *player_ptr)
286 term_get_size(&wid, &hgt);
288 size_t max_line = debug_menu_table.size();
289 int page_size = hgt - 5;
290 int max_page = max_line / page_size + 1;
296 display_debug_menu(page, max_page, page_size, max_line);
297 get_com("Debug Command: ", &cmd, false);
300 if (exe_cmd_debug(player_ptr, cmd))
303 page = (page + 1) % max_page;