OSDN Git Service

Merge branch 'feature/music-debug-files' into develop
[hengband/hengband.git] / src / wizard / cmd-wizard.c
1 /*!
2  * @brief デバッグコマンドの分岐実装
3  * @date 2020/08/01
4  * @author Hourier
5  * @details 通常のコマンドではないのでcmd-xxx/ ではなくwizard/ 以下に置く
6  */
7
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 "dungeon/quest.h"
13 #include "grid/grid.h"
14 #include "info-reader/fixed-map-parser.h"
15 #include "inventory/inventory-object.h"
16 #include "inventory/inventory-slot-types.h"
17 #include "io/input-key-requester.h"
18 #include "market/arena.h"
19 #include "mutation/mutation-investor-remover.h"
20 #include "player-info/self-info.h"
21 #include "player/patron.h"
22 #include "spell-kind/spells-detection.h"
23 #include "spell-kind/spells-perception.h"
24 #include "spell-kind/spells-floor.h"
25 #include "spell-kind/spells-sight.h"
26 #include "spell-kind/spells-teleport.h"
27 #include "spell/spells-object.h"
28 #include "spell/spells-status.h"
29 #include "status/experience.h"
30 #include "system/floor-type-definition.h"
31 #include "util/int-char-converter.h"
32 #include "view/display-messages.h"
33 #include "wizard/wizard-item-modifier.h"
34 #include "wizard/wizard-special-process.h"
35 #include "wizard/wizard-spells.h"
36 #include "wizard/wizard-spoiler.h"
37
38 /*!
39  * @brief デバッグコマンドを選択する処理のメインルーチン /
40  * Ask for and parse a "debug command"
41  * The "command_arg" may have been set.
42  * @param creature_ptr プレーヤーへの参照ポインタ
43  * @return なし
44  * @details
45  * 番号を指定するには、それをN及びデバッグコマンドをXとしてとして「0N^aX」とする
46  * a:全状態回復 / Cure all maladies
47  * A:善悪の属性表示 / Know alignment
48  * b:相手をテレポバック / Teleport to target
49  * B:モンスター闘技場のモンスターを更新する / Update gambling monster
50  * c:アイテム生成 / Create any object
51  * C:指定番号の固定アーティファクトを生成する / Create a named artifact
52  * d:全感知 / Detect everything
53  * D:次元の扉 / Dimension_door
54  * e:能力変更 / Edit character
55  * E:全てのスペルをラーニング状態にする / Blue Mage Only
56  * f:*鑑定* / Fully identification
57  * F:地形ID変更 / Create desired feature
58  * g:上質なアイテムを生成 / Good Objects
59  * G:なし / Nothing
60  * h:新生 / Hitpoint rerating
61  * H:モンスターの群れ生成 / Generate monster group
62  * i:鑑定 / Identification
63  * I:なし / Nothing
64  * j:ダンジョンの指定フロアへテレポート (ウィザードあり) / Jump to dungeon
65  * J:なし / Nothing
66  * k:自己分析 / Self info
67  * K:なし / Nothing
68  * l:番号指定したアイテムまで鑑定済にする / Learn about objects
69  * L:なし / Nothing
70  * m:魔法の地図 / Magic Mapping
71  * M:突然変異 / Mutation / TODO: 指定した突然変異の除外機能を追加したい
72  * n:番号指定したモンスターを生成 / Generate a monster
73  * N:番号指定したペットを生成 / Generate a pet
74  * o:アイテムのtval等を編集する / Edit object
75  * O:現在のオプション設定をダンプ出力 / Output option settings
76  * p:ショートテレポ / Blink
77  * P:なし / Nothing
78  * q:クエストを完了させる / Finish quest
79  * Q:クエストに突入する (ウィザードあり) / Jump to quest
80  * r:カオスパトロンから報酬を貰う / Gain reward from chaos patron
81  * R:クラス変更 / Change class
82  * s:フロア相応のモンスター召喚 / Summon a monster
83  * S:高級品獲得ドロップ / Get a great item
84  * t:テレポート / Teleport
85  * T:プレイ日時変更 / Change time
86  * u:啓蒙 (強制的に忍者以外) / Lite floor without ninja classified
87  * U:なし / Nothing
88  * v:特別品獲得ドロップ / Get a special item
89  * V:クラス変更 / Change class / TODO: Rと同じなので何か変えたい
90  * w:啓蒙 (忍者かどうか考慮) / Lite floor with ninja classified
91  * W:なし / Nothing
92  * x:経験値を得る / Gain experience
93  * X:アイテムを初期状態に戻す / Return items to the initial ones
94  * y:なし / Nothing
95  * Y:なし / Nothing
96  * z:近隣のモンスター消去 / Zap monsters around
97  * Z:フロア中のモンスター消去 / Zap all monsters in the floor
98  * @:特殊スペルの発動 / Special spell
99  * ":スポイラーのダンプ / Dump spoiler
100  * ?:ヘルプ表示 (通常の?と同じ) / Show help (same as normal help)
101  */
102 void do_cmd_debug(player_type *creature_ptr)
103 {
104     char cmd;
105     get_com("Debug Command: ", &cmd, FALSE);
106     switch (cmd) {
107     case ESCAPE:
108     case ' ':
109     case '\n':
110     case '\r':
111         break;
112     case 'a':
113         wiz_cure_all(creature_ptr);
114         break;
115     case 'A':
116         msg_format("Your alignment is %d.", creature_ptr->align);
117         break;
118     case 'b':
119         wiz_teleport_back(creature_ptr);
120         break;
121     case 'B':
122         update_gambling_monsters(creature_ptr);
123         break;
124     case 'c':
125         wiz_create_item(creature_ptr);
126         break;
127     case 'C':
128         wiz_create_named_art(creature_ptr);
129         break;
130     case 'd':
131         detect_all(creature_ptr, DETECT_RAD_ALL * 3);
132         break;
133     case 'D':
134         wiz_dimension_door(creature_ptr);
135         break;
136     case 'e':
137         wiz_change_status(creature_ptr);
138         break;
139     case 'E':
140         if (creature_ptr->pclass == CLASS_BLUE_MAGE)
141             wiz_learn_blue_magic_all(creature_ptr);
142
143         break;
144     case 'f':
145         identify_fully(creature_ptr, FALSE, 0);
146         break;
147     case 'F':
148         wiz_create_feature(creature_ptr);
149         break;
150     case 'g':
151         if (command_arg <= 0)
152             command_arg = 1;
153
154         acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, FALSE, FALSE, TRUE);
155         break;
156     case 'h':
157         roll_hitdice(creature_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
158         break;
159     case 'H':
160         wiz_summon_horde(creature_ptr);
161         break;
162     case 'i':
163         (void)ident_spell(creature_ptr, FALSE, 0);
164         break;
165     case 'j':
166         wiz_jump_to_dungeon(creature_ptr);
167         break;
168     case 'k':
169         self_knowledge(creature_ptr);
170         break;
171     case 'l':
172         wiz_learn_items_all(creature_ptr);
173         break;
174     case 'm':
175         map_area(creature_ptr, DETECT_RAD_ALL * 3);
176         break;
177     case 'M':
178         (void)gain_mutation(creature_ptr, command_arg);
179         break;
180     case 'R':
181         wiz_reset_class(creature_ptr);
182         break;
183     case 'r':
184         gain_level_reward(creature_ptr, command_arg);
185         break;
186     case 'N':
187         wiz_summon_pet(creature_ptr, command_arg);
188         break;
189     case 'n':
190         wiz_summon_specific_enemy(creature_ptr, command_arg);
191         break;
192     case 'O':
193         wiz_dump_options();
194         break;
195     case 'o':
196         wiz_modify_item(creature_ptr);
197         break;
198     case 'p':
199         teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS);
200         break;
201     case 'Q': {
202         char ppp[30];
203         char tmp_val[5];
204         int tmp_int;
205         sprintf(ppp, "QuestID (0-%d):", max_q_idx - 1);
206         sprintf(tmp_val, "%d", 0);
207
208         if (!get_string(ppp, tmp_val, 3))
209             return;
210
211         tmp_int = atoi(tmp_val);
212         if ((tmp_int < 0) || (tmp_int >= max_q_idx))
213             break;
214
215         creature_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)tmp_int;
216         parse_fixed_map(creature_ptr, "q_info.txt", 0, 0, 0, 0);
217         quest[tmp_int].status = QUEST_STATUS_TAKEN;
218         creature_ptr->current_floor_ptr->inside_quest = 0;
219         break;
220     }
221     case 'q':
222         if (!creature_ptr->current_floor_ptr->inside_quest) {
223             msg_print("No current quest");
224             msg_print(NULL);
225             break;
226         }
227
228         if (quest[creature_ptr->current_floor_ptr->inside_quest].status == QUEST_STATUS_TAKEN)
229             complete_quest(creature_ptr, creature_ptr->current_floor_ptr->inside_quest);
230
231         break;
232     case 's':
233         if (command_arg <= 0)
234             command_arg = 1;
235
236         wiz_summon_random_enemy(creature_ptr, command_arg);
237         break;
238     case 'S':
239         if (command_arg <= 0)
240             command_arg = 1;
241
242         acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, TRUE, TRUE);
243         break;
244     case 't':
245         teleport_player(creature_ptr, 100, TELEPORT_SPONTANEOUS);
246         break;
247     case 'T':
248         set_gametime();
249         break;
250     case 'u':
251         for (int y = 0; y < creature_ptr->current_floor_ptr->height; y++)
252             for (int x = 0; x < creature_ptr->current_floor_ptr->width; x++)
253                 creature_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_GLOW | CAVE_MARK;
254
255         wiz_lite(creature_ptr, FALSE);
256         break;
257     case 'v':
258         if (command_arg <= 0)
259             command_arg = 1;
260
261         acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, FALSE, TRUE);
262         break;
263     case 'V':
264         wiz_reset_class(creature_ptr);
265         break;
266     case 'w':
267         wiz_lite(creature_ptr, (bool)(creature_ptr->pclass == CLASS_NINJA));
268         break;
269     case 'x':
270         gain_exp(creature_ptr, command_arg ? command_arg : (creature_ptr->exp + 1));
271         break;
272     case 'X':
273         for (INVENTORY_IDX i = INVEN_TOTAL - 1; i >= 0; i--)
274             if (creature_ptr->inventory_list[i].k_idx)
275                 drop_from_inventory(creature_ptr, i, 999);
276
277         player_outfit(creature_ptr);
278         break;
279     case 'z':
280         wiz_zap_surrounding_monsters(creature_ptr);
281         break;
282     case 'Z':
283         wiz_zap_floor_monsters(creature_ptr);
284         break;
285     case '_':
286         probing(creature_ptr);
287         break;
288     case '@':
289         wiz_debug_spell(creature_ptr);
290         break;
291     case '"':
292         exe_output_spoilers(creature_ptr);
293         break;
294     case '?':
295         do_cmd_help(creature_ptr);
296         break;
297     default:
298         msg_print("That is not a valid debug command.");
299         break;
300     }
301 }