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-base/player-class.h"
17 #include "player/patron.h"
18 #include "spell-kind/spells-detection.h"
19 #include "spell-kind/spells-floor.h"
20 #include "spell-kind/spells-perception.h"
21 #include "spell-kind/spells-sight.h"
22 #include "spell-kind/spells-teleport.h"
23 #include "spell/spells-status.h"
24 #include "status/experience.h"
25 #include "system/floor-type-definition.h"
26 #include "system/grid-type-definition.h"
27 #include "system/object-type-definition.h"
28 #include "system/player-type-definition.h"
29 #include "term/screen-processor.h"
30 #include "util/int-char-converter.h"
31 #include "view/display-messages.h"
32 #include "wizard/wizard-game-modifier.h"
33 #include "wizard/wizard-item-modifier.h"
34 #include "wizard/wizard-player-modifier.h"
35 #include "wizard/wizard-special-process.h"
36 #include "wizard/wizard-spells.h"
37 #include "wizard/wizard-spoiler.h"
46 * 空き: A,B,E,I,J,k,K,L,M,q,Q,R,T,U,V,W,y,Y
48 constexpr std::array debug_menu_table = {
49 std::make_tuple('a', _("全状態回復", "Restore all status")),
50 std::make_tuple('b', _("現在のターゲットを引き寄せる", "Teleport target back")),
51 std::make_tuple('c', _("オブジェクト生成", "Create object")),
52 std::make_tuple('C', _("固定アーティファクト生成", "Create fixed artifact")),
53 std::make_tuple('d', _("全感知", "Detection all")),
54 std::make_tuple('D', _("次元の扉", "Dimension door")),
55 std::make_tuple('e', _("能力値変更", "Modify player status")),
56 std::make_tuple('E', _("青魔法を全取得/エッセンスを全取得", "Learn all blue magics / Obtain all essences")),
57 std::make_tuple('f', _("*鑑定*", "*Idenfity*")),
58 std::make_tuple('F', _("地形ID変更", "Modify feature type under player")),
59 std::make_tuple('G', _("ゲーム設定コマンドメニュー", "Modify game configurations")),
60 std::make_tuple('H', _("モンスターの群れ生成", "Summon monsters")),
61 std::make_tuple('i', _("鑑定", "Idenfity")),
62 std::make_tuple('I', _("アイテム設定コマンドメニュー", "Modify item configurations")),
63 std::make_tuple('j', _("指定ダンジョン階にワープ", "Jump to floor depth of target dungeon")),
64 std::make_tuple('k', _("指定ダメージ・半径0の指定属性のボールを自分に放つ", "Fire a zero ball to self")),
65 std::make_tuple('m', _("魔法の地図", "Magic mapping")),
66 std::make_tuple('n', _("指定モンスター生成", "Summon target monster")),
67 std::make_tuple('N', _("指定モンスターをペットとして生成", "Summon target monster as pet")),
68 std::make_tuple('o', _("オブジェクトの能力変更", "Modift object abilities")),
69 std::make_tuple('O', _("オプション設定をダンプ", "Dump current options")),
70 std::make_tuple('p', _("ショート・テレポート", "Phase door")),
71 std::make_tuple('P', _("プレイヤー設定変更メニュー", "Modify player configurations")),
72 std::make_tuple('r', _("カオスパトロンの報酬", "Get reward of chaos patron")),
73 std::make_tuple('s', _("フロア相当のモンスター召喚", "Summon monster which be in target depth")),
74 std::make_tuple('t', _("テレポート", "Teleport self")),
75 std::make_tuple('u', _("啓蒙(忍者以外)", "Wiz-lite all floor except Ninja")),
76 std::make_tuple('w', _("啓蒙(忍者配慮)", "Wiz-lite all floor")),
77 std::make_tuple('x', _("経験値を得る(指定可)", "Get experience")),
78 std::make_tuple('X', _("所持品を初期状態に戻す", "Return inventory to initial")),
79 std::make_tuple('y', _("ダメージ100万・半径0の射撃のボールを放つ", "Cast missile ball had power a million")),
80 std::make_tuple('Y', _("指定ダメージ・半径0の指定属性のボールを放つ", "Cast zero ball had power a thousand")),
81 std::make_tuple('z', _("近隣のモンスター消去", "Terminate near monsters")),
82 std::make_tuple('Z', _("フロアの全モンスター消去", "Terminate all monsters in floor")),
83 std::make_tuple('@', _("特殊スペルの発動", "Activate specified spells")),
84 std::make_tuple('"', _("スポイラーのダンプ", "Dump spoiler")),
85 std::make_tuple('?', _("ヘルプ表示", "Help")),
89 * @brief デバグコマンドの一覧を表示する
91 * @param max_page ページ数
92 * @param page_size 1ページ行数
93 * @param max_line コマンド数
95 void display_debug_menu(int page, int max_page, int page_size, int max_line)
97 for (int y = 1; y < page_size + 3; y++) {
98 term_erase(14, y, 64);
103 for (int i = 0; i < page_size; i++) {
104 int pos = page * page_size + i;
105 if (pos >= max_line) {
109 std::stringstream ss;
110 const auto &[symbol, desc] = debug_menu_table[pos];
111 ss << symbol << ") " << desc;
112 put_str(ss.str().data(), r++, c);
115 put_str("-- more --", r++, c);
120 * @brief デバッグコマンド選択処理への分岐
121 * @param player_ptr プレイヤーへの参照ポインタ
123 * @return コマンド終了ならTRUE、ページ送りならFALSE
125 bool exe_cmd_debug(PlayerType *player_ptr, char cmd)
138 wiz_cure_all(player_ptr);
141 wiz_teleport_back(player_ptr);
144 wiz_create_item(player_ptr);
147 wiz_create_named_art(player_ptr);
150 detect_all(player_ptr, DETECT_RAD_ALL * 3);
153 wiz_dimension_door(player_ptr);
156 wiz_change_status(player_ptr);
159 switch (player_ptr->pclass) {
160 case PlayerClassType::BLUE_MAGE:
161 wiz_learn_blue_magic_all(player_ptr);
163 case PlayerClassType::SMITH:
164 wiz_fillup_all_smith_essences(player_ptr);
171 identify_fully(player_ptr, false);
174 wiz_create_feature(player_ptr);
177 wizard_game_modifier(player_ptr);
180 wiz_summon_horde(player_ptr);
183 (void)ident_spell(player_ptr, false);
186 wizard_item_modifier(player_ptr);
189 wiz_jump_to_dungeon(player_ptr);
192 wiz_kill_target(player_ptr, 0, (AttributeType)command_arg, true);
195 map_area(player_ptr, DETECT_RAD_ALL * 3);
198 patron_list[player_ptr->chaos_patron].gain_level_reward(player_ptr, command_arg);
201 wiz_summon_pet(player_ptr, i2enum<MonsterRaceId>(command_arg));
204 wiz_summon_specific_enemy(player_ptr, i2enum<MonsterRaceId>(command_arg));
210 wiz_modify_item(player_ptr);
213 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
216 wizard_player_modifier(player_ptr);
219 if (command_arg <= 0) {
223 wiz_summon_random_enemy(player_ptr, command_arg);
226 teleport_player(player_ptr, 100, TELEPORT_SPONTANEOUS);
229 for (int y = 0; y < player_ptr->current_floor_ptr->height; y++) {
230 for (int x = 0; x < player_ptr->current_floor_ptr->width; x++) {
231 player_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_GLOW | CAVE_MARK;
235 wiz_lite(player_ptr, false);
238 wiz_lite(player_ptr, PlayerClass(player_ptr).equals(PlayerClassType::NINJA));
241 gain_exp(player_ptr, command_arg ? command_arg : (player_ptr->exp + 1));
244 for (INVENTORY_IDX i = INVEN_TOTAL - 1; i >= 0; i--) {
245 if (player_ptr->inventory_list[i].k_idx) {
246 drop_from_inventory(player_ptr, i, 999);
250 player_outfit(player_ptr);
253 wiz_kill_target(player_ptr);
256 wiz_kill_target(player_ptr, 0, (AttributeType)command_arg);
259 wiz_zap_surrounding_monsters(player_ptr);
262 wiz_zap_floor_monsters(player_ptr);
268 wiz_debug_spell(player_ptr);
271 exe_output_spoilers();
274 do_cmd_help(player_ptr);
277 msg_print("That is not a valid debug command.");
285 * @brief デバッグコマンドを選択する処理のメインルーチン /
286 * Ask for and parse a "debug command"
287 * The "command_arg" may have been set.
288 * @param player_ptr プレイヤーへの参照ポインタ
290 * 番号を指定するには、それをN及びデバッグコマンドをXとしてとして「0N^aX」とする
292 void do_cmd_debug(PlayerType *player_ptr)
295 term_get_size(&wid, &hgt);
297 size_t max_line = debug_menu_table.size();
298 int page_size = hgt - 5;
299 int max_page = max_line / page_size + 1;
305 display_debug_menu(page, max_page, page_size, max_line);
306 get_com("Debug Command: ", &cmd, false);
309 if (exe_cmd_debug(player_ptr, cmd)) {
313 page = (page + 1) % max_page;