OSDN Git Service

9a07f29d1155d47f5d9343bcaca5a7b00bcffac7
[hengbandforosx/hengbandosx.git] / src / wizard / wizard-special-process.cpp
1 /*!
2  * @brief ウィザードモードの処理(特別処理中心) / Wizard commands
3  * @date 2014/09/07
4  * @author
5  * Copyright (c) 1997 Ben Harrison, and others<br>
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.  Other copyrights may also apply.<br>
9  * 2014 Deskull rearranged comment for Doxygen.<br>
10  */
11
12 #include "wizard/wizard-special-process.h"
13 #include "artifact/fixed-art-generator.h"
14 #include "birth/inventory-initializer.h"
15 #include "cmd-io/cmd-dump.h"
16 #include "cmd-io/cmd-help.h"
17 #include "cmd-io/cmd-save.h"
18 #include "cmd-visual/cmd-draw.h"
19 #include "core/asking-player.h"
20 #include "core/player-redraw-types.h"
21 #include "core/player-update-types.h"
22 #include "core/stuff-handler.h"
23 #include "core/window-redrawer.h"
24 #include "dungeon/dungeon.h"
25 #include "dungeon/quest.h"
26 #include "flavor/object-flavor.h"
27 #include "floor/floor-leaver.h"
28 #include "floor/floor-mode-changer.h"
29 #include "floor/floor-object.h"
30 #include "game-option/birth-options.h"
31 #include "game-option/option-types-table.h"
32 #include "game-option/play-record-options.h"
33 #include "game-option/special-options.h"
34 #include "grid/feature.h"
35 #include "grid/grid.h"
36 #include "info-reader/fixed-map-parser.h"
37 #include "inventory/inventory-object.h"
38 #include "inventory/inventory-slot-types.h"
39 #include "io/files-util.h"
40 #include "io/input-key-requester.h"
41 #include "io/write-diary.h"
42 #include "market/arena.h"
43 #include "monster-floor/monster-remover.h"
44 #include "monster-floor/monster-summon.h"
45 #include "monster/monster-describer.h"
46 #include "monster/monster-description-types.h"
47 #include "monster/monster-info.h"
48 #include "monster/monster-status.h"
49 #include "monster/smart-learn-types.h"
50 #include "mutation/mutation-investor-remover.h"
51 #include "object-enchant/apply-magic.h"
52 #include "object-enchant/item-apply-magic.h"
53 #include "object-enchant/trc-types.h"
54 #include "object-enchant/trg-types.h"
55 #include "object/object-kind.h"
56 #include "perception/object-perception.h"
57 #include "player-info/race-info.h"
58 #include "player-info/race-types.h"
59 #include "player-info/self-info.h"
60 #include "player-status/player-energy.h"
61 #include "player/digestion-processor.h"
62 #include "player/patron.h"
63 #include "player/player-class.h"
64 #include "player/player-skill.h"
65 #include "player/player-status-table.h"
66 #include "player/player-status.h"
67 #include "player/race-info-table.h"
68 #include "spell-kind/spells-detection.h"
69 #include "spell-kind/spells-sight.h"
70 #include "spell-kind/spells-teleport.h"
71 #include "spell-kind/spells-world.h"
72 #include "spell/spells-object.h"
73 #include "spell/spells-status.h"
74 #include "spell/spells-summon.h"
75 #include "status/experience.h"
76 #include "system/angband-version.h"
77 #include "system/artifact-type-definition.h"
78 #include "system/floor-type-definition.h"
79 #include "system/grid-type-definition.h"
80 #include "system/monster-type-definition.h"
81 #include "system/player-type-definition.h"
82 #include "target/grid-selector.h"
83 #include "term/screen-processor.h"
84 #include "util/angband-files.h"
85 #include "util/bit-flags-calculator.h"
86 #include "util/enum-converter.h"
87 #include "util/int-char-converter.h"
88 #include "view/display-messages.h"
89 #include "wizard/tval-descriptions-table.h"
90 #include "wizard/wizard-spells.h"
91 #include "wizard/wizard-spoiler.h"
92 #include "world/world.h"
93 #define NUM_O_SET 8
94 #define NUM_O_BIT 32
95
96 /*!
97  * @brief プレイヤーを完全回復する /
98  * Cure everything instantly
99  */
100 void wiz_cure_all(player_type *creature_ptr)
101 {
102     (void)life_stream(creature_ptr, false, false);
103     (void)restore_mana(creature_ptr, true);
104     (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
105 }
106
107 /*!
108  * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
109  * Specify tval and sval (type and subtype of object) originally
110  * @return ベースアイテムID
111  * @details
112  * by RAK, heavily modified by -Bernd-
113  * This function returns the k_idx of an object type, or zero if failed
114  * List up to 50 choices in three columns
115  */
116 KIND_OBJECT_IDX wiz_create_itemtype(void)
117 {
118     term_clear();
119     int num;
120     TERM_LEN col, row;
121     char ch;
122     for (num = 0; (num < 80) && tvals[num].tval; num++) {
123         row = 2 + (num % 20);
124         col = 20 * (num / 20);
125         ch = listsym[num];
126         prt(format("[%c] %s", ch, tvals[num].desc), row, col);
127     }
128
129     int max_num = num;
130     if (!get_com("Get what type of object? ", &ch, false))
131         return 0;
132
133     for (num = 0; num < max_num; num++)
134         if (listsym[num] == ch)
135             break;
136
137     if ((num < 0) || (num >= max_num))
138         return 0;
139
140     tval_type tval = static_cast<tval_type>(tvals[num].tval);
141     concptr tval_desc = tvals[num].desc;
142     term_clear();
143     num = 0;
144     KIND_OBJECT_IDX choice[80];
145     char buf[160];
146     for (KIND_OBJECT_IDX i = 1; (num < 80) && (i < max_k_idx); i++) {
147         object_kind *k_ptr = &k_info[i];
148         if (k_ptr->tval != tval)
149             continue;
150
151         row = 2 + (num % 20);
152         col = 20 * (num / 20);
153         ch = listsym[num];
154         strcpy(buf, "                    ");
155         strip_name(buf, i);
156         prt(format("[%c] %s", ch, buf), row, col);
157         choice[num++] = i;
158     }
159
160     max_num = num;
161     if (!get_com(format("What Kind of %s? ", tval_desc), &ch, false))
162         return 0;
163
164     for (num = 0; num < max_num; num++)
165         if (listsym[num] == ch)
166             break;
167
168     if ((num < 0) || (num >= max_num))
169         return 0;
170
171     return choice[num];
172 }
173
174 /*!
175  * @brief 任意のベースアイテム生成のメインルーチン /
176  * Wizard routine for creating objects          -RAK-
177  * @details
178  * Heavily modified to allow magification and artifactification  -Bernd-
179  *
180  * Note that wizards cannot create objects on top of other objects.
181  *
182  * Hack -- this routine always makes a "dungeon object", and applies
183  * magic to it, and attempts to decline cursed items.
184  */
185 void wiz_create_item(player_type *caster_ptr)
186 {
187     screen_save();
188     OBJECT_IDX k_idx = wiz_create_itemtype();
189     screen_load();
190     if (!k_idx)
191         return;
192
193     if (k_info[k_idx].gen_flags.has(TRG::INSTA_ART)) {
194         for (ARTIFACT_IDX i = 1; i < max_a_idx; i++) {
195             if ((a_info[i].tval != k_info[k_idx].tval) || (a_info[i].sval != k_info[k_idx].sval))
196                 continue;
197
198             (void)create_named_art(caster_ptr, i, caster_ptr->y, caster_ptr->x);
199             msg_print("Allocated(INSTA_ART).");
200             return;
201         }
202     }
203
204     object_type forge;
205     object_type *q_ptr;
206     q_ptr = &forge;
207     q_ptr->prep(k_idx);
208     apply_magic_to_object(caster_ptr, q_ptr, caster_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART);
209     (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
210     msg_print("Allocated.");
211 }
212
213 /*!
214  * @brief 指定されたIDの固定アーティファクトを生成する / Create the artifact of the specified number
215  * @param caster_ptr プレーヤーへの参照ポインタ
216  */
217 void wiz_create_named_art(player_type *caster_ptr, ARTIFACT_IDX a_idx)
218 {
219     if (a_idx <= 0) {
220         char tmp[80] = "";
221         sprintf(tmp, "Artifact ID (1-%d): ", max_a_idx - 1);
222         char tmp_val[10] = "";
223         if (!get_string(tmp, tmp_val, 3))
224             return;
225
226         a_idx = (ARTIFACT_IDX)atoi(tmp_val);
227     }
228
229     if (a_idx <= 0 || a_idx >= max_a_idx) {
230         msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), max_a_idx - 1);
231         return;
232     }
233
234     (void)create_named_art(caster_ptr, a_idx, caster_ptr->y, caster_ptr->x);
235     msg_print("Allocated.");
236 }
237
238 /*!
239  * @brief プレイヤーの現能力値を調整する / Change various "permanent" player variables.
240  * @param creature_ptr プレーヤーへの参照ポインタ
241  */
242 void wiz_change_status(player_type *creature_ptr)
243 {
244     int tmp_int;
245     char tmp_val[160];
246     char ppp[80];
247     for (int i = 0; i < A_MAX; i++) {
248         sprintf(ppp, "%s (3-%d): ", stat_names[i], creature_ptr->stat_max_max[i]);
249         sprintf(tmp_val, "%d", creature_ptr->stat_max[i]);
250         if (!get_string(ppp, tmp_val, 3))
251             return;
252
253         tmp_int = atoi(tmp_val);
254         if (tmp_int > creature_ptr->stat_max_max[i])
255             tmp_int = creature_ptr->stat_max_max[i];
256         else if (tmp_int < 3)
257             tmp_int = 3;
258
259         creature_ptr->stat_cur[i] = creature_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
260     }
261
262     sprintf(tmp_val, "%d", WEAPON_EXP_MASTER);
263     if (!get_string(_("熟練度: ", "Proficiency: "), tmp_val, 4))
264         return;
265
266     int16_t tmp_s16b = (int16_t)atoi(tmp_val);
267     if (tmp_s16b < WEAPON_EXP_UNSKILLED)
268         tmp_s16b = WEAPON_EXP_UNSKILLED;
269
270     if (tmp_s16b > WEAPON_EXP_MASTER)
271         tmp_s16b = WEAPON_EXP_MASTER;
272
273     for (int j = 0; j <= TV_WEAPON_END - TV_WEAPON_BEGIN; j++) {
274         for (int i = 0; i < 64; i++) {
275             creature_ptr->weapon_exp[j][i] = tmp_s16b;
276             if (creature_ptr->weapon_exp[j][i] > s_info[creature_ptr->pclass].w_max[j][i])
277                 creature_ptr->weapon_exp[j][i] = s_info[creature_ptr->pclass].w_max[j][i];
278         }
279     }
280
281     for (int j = 0; j < 10; j++) {
282         creature_ptr->skill_exp[j] = tmp_s16b;
283         if (creature_ptr->skill_exp[j] > s_info[creature_ptr->pclass].s_max[j])
284             creature_ptr->skill_exp[j] = s_info[creature_ptr->pclass].s_max[j];
285     }
286
287     int k;
288     for (k = 0; k < 32; k++)
289         creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_MASTER ? SPELL_EXP_MASTER : tmp_s16b);
290
291     for (; k < 64; k++)
292         creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_EXPERT ? SPELL_EXP_EXPERT : tmp_s16b);
293
294     sprintf(tmp_val, "%ld", (long)(creature_ptr->au));
295     if (!get_string("Gold: ", tmp_val, 9))
296         return;
297
298     long tmp_long = atol(tmp_val);
299     if (tmp_long < 0)
300         tmp_long = 0L;
301
302     creature_ptr->au = tmp_long;
303     sprintf(tmp_val, "%ld", (long)(creature_ptr->max_exp));
304     if (!get_string("Experience: ", tmp_val, 9))
305         return;
306
307     tmp_long = atol(tmp_val);
308     if (tmp_long < 0)
309         tmp_long = 0L;
310
311     if (creature_ptr->prace == player_race_type::ANDROID)
312         return;
313
314     creature_ptr->max_exp = tmp_long;
315     creature_ptr->exp = tmp_long;
316     check_experience(creature_ptr);
317     do_cmd_redraw(creature_ptr);
318 }
319
320 /*!
321  * @brief 指定された地点の地形IDを変更する /
322  * Create desired feature
323  * @param creaturer_ptr プレーヤーへの参照ポインタ
324  */
325 void wiz_create_feature(player_type *creature_ptr)
326 {
327     POSITION y, x;
328     if (!tgt_pt(creature_ptr, &x, &y))
329         return;
330
331     grid_type *g_ptr;
332     g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
333     static int prev_feat = 0;
334     char tmp_val[160];
335     sprintf(tmp_val, "%d", prev_feat);
336
337     if (!get_string(_("地形: ", "Feature: "), tmp_val, 3))
338         return;
339
340     FEAT_IDX tmp_feat = (FEAT_IDX)atoi(tmp_val);
341     if (tmp_feat < 0)
342         tmp_feat = 0;
343     else if (tmp_feat >= max_f_idx)
344         tmp_feat = max_f_idx - 1;
345
346     static int prev_mimic = 0;
347     sprintf(tmp_val, "%d", prev_mimic);
348
349     if (!get_string(_("地形 (mimic): ", "Feature (mimic): "), tmp_val, 3))
350         return;
351
352     FEAT_IDX tmp_mimic = (FEAT_IDX)atoi(tmp_val);
353     if (tmp_mimic < 0)
354         tmp_mimic = 0;
355     else if (tmp_mimic >= max_f_idx)
356         tmp_mimic = max_f_idx - 1;
357
358     cave_set_feat(creature_ptr, y, x, tmp_feat);
359     g_ptr->mimic = (int16_t)tmp_mimic;
360     feature_type *f_ptr;
361     f_ptr = &f_info[g_ptr->get_feat_mimic()];
362
363     if (f_ptr->flags.has(FF::RUNE_PROTECTION) || f_ptr->flags.has(FF::RUNE_EXPLOSION))
364         g_ptr->info |= CAVE_OBJECT;
365     else if (f_ptr->flags.has(FF::MIRROR))
366         g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
367
368     note_spot(creature_ptr, y, x);
369     lite_spot(creature_ptr, y, x);
370     creature_ptr->update |= PU_FLOW;
371     prev_feat = tmp_feat;
372     prev_mimic = tmp_mimic;
373 }
374
375 /*
376  * @brief 選択したダンジョンの任意フロアを選択する
377  * @param creature_ptr プレーヤーへの参照ポインタ
378  * @param dungeon_type ダンジョン番号
379  * @return フロアを選択したらtrue、キャンセルならfalse
380  * @details 0を指定すると地上に飛ぶが、元いた場所にしか飛ばない
381  * @todo 可能ならダンジョンの入口 (例:ルルイエなら大洋の真ん中)へ飛べるようにしたい
382  */
383 static bool select_debugging_floor(player_type *creature_ptr, int dungeon_type)
384 {
385     auto max_depth = d_info[dungeon_type].maxdepth;
386     if ((max_depth == 0) || (dungeon_type > current_world_ptr->max_d_idx)) {
387         dungeon_type = DUNGEON_ANGBAND;
388     }
389
390     auto min_depth = (int)d_info[dungeon_type].mindepth;
391     while (true) {
392         char ppp[80];
393         char tmp_val[160];
394         sprintf(ppp, "Jump to level (0, %d-%d): ", min_depth, max_depth);
395         sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
396         if (!get_string(ppp, tmp_val, 10)) {
397             return false;
398         }
399
400         auto tmp_command_arg = (COMMAND_ARG)atoi(tmp_val);
401         if (tmp_command_arg == 0) {
402             command_arg = tmp_command_arg;
403             break;
404         }
405
406         auto is_valid_floor = tmp_command_arg > 0;
407         is_valid_floor &= tmp_command_arg >= min_depth;
408         is_valid_floor &= tmp_command_arg <= max_depth;
409         if (is_valid_floor) {
410             command_arg = tmp_command_arg;
411             break;
412         }
413
414         msg_print("Invalid floor. Please re-input.");
415         continue;
416     }
417
418     return true;
419 }
420
421 /*!
422  * @brief デバッグ帰還のダンジョンを選ぶ
423  * @param creature_ptr プレーヤーへの参照ポインタ
424  * @details 範囲外の値が選択されたら再入力を促す
425  */
426 static bool select_debugging_dungeon(player_type *creature_ptr, DUNGEON_IDX *dungeon_type)
427 {
428     if (command_arg > 0) {
429         return true;
430     }
431
432     while (true) {
433         char ppp[80];
434         char tmp_val[160];
435         sprintf(ppp, "Jump which dungeon : ");
436         sprintf(tmp_val, "%d", creature_ptr->dungeon_idx);
437         if (!get_string(ppp, tmp_val, 2)) {
438             return false;
439         }
440
441         *dungeon_type = (DUNGEON_IDX)atoi(tmp_val);
442         if ((*dungeon_type < DUNGEON_ANGBAND) || (*dungeon_type > DUNGEON_MAX)) {
443             msg_print("Invalid dungeon. Please re-input.");
444             continue;
445         }
446
447         return true;
448     }
449 }
450
451 /*!
452  * @brief 任意のダンジョン及び階層に飛ぶtための選択処理
453  * Go to any level
454  */
455 void wiz_jump_to_dungeon(player_type *creature_ptr)
456 {
457     DUNGEON_IDX dungeon_type = 1;
458     if (!select_debugging_dungeon(creature_ptr, &dungeon_type)) {
459         return;
460     }
461
462     if (!select_debugging_floor(creature_ptr, dungeon_type)) {
463         return;
464     }
465
466     if (command_arg < d_info[dungeon_type].mindepth)
467         command_arg = 0;
468
469     if (command_arg > d_info[dungeon_type].maxdepth)
470         command_arg = (COMMAND_ARG)d_info[dungeon_type].maxdepth;
471
472     msg_format("You jump to dungeon level %d.", command_arg);
473     if (autosave_l)
474         do_cmd_save_game(creature_ptr, true);
475
476     jump_floor(creature_ptr, dungeon_type, command_arg);
477 }
478
479 /*!
480  * @brief 全ベースアイテムを鑑定済みにする /
481  * Become aware of a lot of objects
482  * @param caster_ptr プレーヤーへの参照ポインタ
483  */
484 void wiz_learn_items_all(player_type *caster_ptr)
485 {
486     object_type forge;
487     object_type *q_ptr;
488     for (KIND_OBJECT_IDX i = 1; i < max_k_idx; i++) {
489         object_kind *k_ptr = &k_info[i];
490         if (k_ptr->level <= command_arg) {
491             q_ptr = &forge;
492             q_ptr->prep(i);
493             object_aware(caster_ptr, q_ptr);
494         }
495     }
496 }
497
498 /*!
499  * @brief プレイヤーの種族を変更する
500  */
501 void wiz_reset_race(player_type *creature_ptr)
502 {
503     char ppp[80];
504     sprintf(ppp, "Race (0-%d): ", MAX_RACES - 1);
505
506     char tmp_val[160];
507     sprintf(tmp_val, "%d", enum2i(creature_ptr->prace));
508
509     if (!get_string(ppp, tmp_val, 2))
510         return;
511
512     int tmp_int = atoi(tmp_val);
513     if (tmp_int < 0 || tmp_int >= MAX_RACES)
514         return;
515
516     creature_ptr->prace = static_cast<player_race_type>(tmp_int);
517     rp_ptr = &race_info[enum2i(creature_ptr->prace)];
518
519     creature_ptr->window_flags |= PW_PLAYER;
520     creature_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
521     creature_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
522     handle_stuff(creature_ptr);
523 }
524
525 /*!
526  * @brief プレイヤーの職業を変更する
527  * @todo 魔法領域の再選択などがまだ不完全、要実装。
528  */
529 void wiz_reset_class(player_type *creature_ptr)
530 {
531     char ppp[80];
532     sprintf(ppp, "Class (0-%d): ", MAX_CLASS - 1);
533
534     char tmp_val[160];
535     sprintf(tmp_val, "%d", creature_ptr->pclass);
536
537     if (!get_string(ppp, tmp_val, 2))
538         return;
539
540     int tmp_int = atoi(tmp_val);
541     if (tmp_int < 0 || tmp_int >= MAX_CLASS)
542         return;
543
544     creature_ptr->pclass = static_cast<player_class_type>(tmp_int);
545     cp_ptr = &class_info[creature_ptr->pclass];
546     mp_ptr = &m_info[creature_ptr->pclass];
547     creature_ptr->window_flags |= PW_PLAYER;
548     creature_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
549     creature_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
550     handle_stuff(creature_ptr);
551 }
552
553 /*!
554  * @brief プレイヤーの領域を変更する
555  * @todo 存在有無などは未判定。そのうちすべき。
556  */
557 void wiz_reset_realms(player_type *creature_ptr)
558 {
559     char ppp[80];
560     char tmp_val[160];
561
562     sprintf(ppp, "1st Realm (None=0, 1-%d): ", MAX_REALM - 1);
563     sprintf(tmp_val, "%d", creature_ptr->realm1);
564     if (!get_string(ppp, tmp_val, 2))
565         return;
566
567     creature_ptr->realm1 = static_cast<int16_t>(atoi(tmp_val));
568
569     sprintf(ppp, "2st Realm (None=0, 1-%d): ", MAX_REALM - 1);
570     sprintf(tmp_val, "%d", creature_ptr->realm2);
571     if (!get_string(ppp, tmp_val, 2))
572         return;
573
574     creature_ptr->realm2 = static_cast<int16_t>(atoi(tmp_val));
575     creature_ptr->window_flags |= PW_PLAYER;
576     creature_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
577     creature_ptr->redraw |= PR_BASIC;
578     handle_stuff(creature_ptr);
579 }
580
581 /*!
582  * @brief 現在のオプション設定をダンプ出力する /
583  * @param creature_ptr プレーヤーへの参照ポインタ
584  * Hack -- Dump option bits usage
585  */
586 void wiz_dump_options(void)
587 {
588     char buf[1024];
589     path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "opt_info.txt");
590     FILE *fff;
591     fff = angband_fopen(buf, "a");
592     if (fff == nullptr) {
593         msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
594         msg_print(nullptr);
595         return;
596     }
597
598     int **exist;
599     C_MAKE(exist, NUM_O_SET, int *);
600     C_MAKE(*exist, NUM_O_BIT * NUM_O_SET, int);
601     for (int i = 1; i < NUM_O_SET; i++)
602         exist[i] = *exist + i * NUM_O_BIT;
603
604     for (int i = 0; option_info[i].o_desc; i++) {
605         const option_type *ot_ptr = &option_info[i];
606         if (ot_ptr->o_var)
607             exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
608     }
609
610     char title[200];
611     put_version(title);
612     fprintf(fff, "[Option bits usage on %s\n]", title);
613     fputs("Set - Bit (Page) Option Name\n", fff);
614     fputs("------------------------------------------------\n", fff);
615     for (int i = 0; i < NUM_O_SET; i++) {
616         for (int j = 0; j < NUM_O_BIT; j++) {
617             if (exist[i][j]) {
618                 const option_type *ot_ptr = &option_info[exist[i][j] - 1];
619                 fprintf(fff, "  %d -  %02d (%4d) %s\n", i, j, ot_ptr->o_page, ot_ptr->o_text);
620             } else {
621                 fprintf(fff, "  %d -  %02d\n", i, j);
622             }
623         }
624
625         fputc('\n', fff);
626     }
627
628     C_KILL(*exist, NUM_O_BIT * NUM_O_SET, int);
629     C_KILL(exist, NUM_O_SET, int *);
630     angband_fclose(fff);
631     msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
632 }
633
634 /*!
635  * @brief プレイ日数を変更する / Set gametime.
636  * @return 実際に変更を行ったらTRUEを返す
637  */
638 void set_gametime(void)
639 {
640     int tmp_int = 0;
641     char ppp[80], tmp_val[40];
642     sprintf(ppp, "Dungeon Turn (0-%ld): ", (long)current_world_ptr->dungeon_turn_limit);
643     sprintf(tmp_val, "%ld", (long)current_world_ptr->dungeon_turn);
644     if (!get_string(ppp, tmp_val, 10))
645         return;
646
647     tmp_int = atoi(tmp_val);
648     if (tmp_int >= current_world_ptr->dungeon_turn_limit)
649         tmp_int = current_world_ptr->dungeon_turn_limit - 1;
650     else if (tmp_int < 0)
651         tmp_int = 0;
652
653     current_world_ptr->dungeon_turn = current_world_ptr->game_turn = tmp_int;
654 }
655
656 /*!
657  * @brief プレイヤー近辺の全モンスターを消去する / Delete all nearby monsters
658  */
659 void wiz_zap_surrounding_monsters(player_type *caster_ptr)
660 {
661     for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) {
662         monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
663         if (!monster_is_valid(m_ptr) || (i == caster_ptr->riding) || (m_ptr->cdis > MAX_SIGHT))
664             continue;
665
666         if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
667             GAME_TEXT m_name[MAX_NLEN];
668
669             monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
670             exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
671         }
672
673         delete_monster_idx(caster_ptr, i);
674     }
675 }
676
677 /*!
678  * @brief フロアに存在する全モンスターを消去する / Delete all monsters
679  * @param caster_ptr 術者の参照ポインタ
680  */
681 void wiz_zap_floor_monsters(player_type *caster_ptr)
682 {
683     for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) {
684         monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
685         if (!monster_is_valid(m_ptr) || (i == caster_ptr->riding))
686             continue;
687
688         if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
689             GAME_TEXT m_name[MAX_NLEN];
690             monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
691             exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
692         }
693
694         delete_monster_idx(caster_ptr, i);
695     }
696 }
697
698 void cheat_death(player_type *creature_ptr)
699 {
700     if (creature_ptr->sc)
701         creature_ptr->sc = creature_ptr->age = 0;
702     creature_ptr->age++;
703
704     current_world_ptr->noscore |= 0x0001;
705     msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
706     msg_print(nullptr);
707
708     creature_ptr->is_dead = false;
709     (void)life_stream(creature_ptr, false, false);
710     (void)restore_mana(creature_ptr, true);
711     (void)recall_player(creature_ptr, 0);
712     reserve_alter_reality(creature_ptr, 0);
713
714     (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
715     (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
716
717     floor_type *floor_ptr = creature_ptr->current_floor_ptr;
718     floor_ptr->dun_level = 0;
719     floor_ptr->inside_arena = false;
720     creature_ptr->phase_out = false;
721     leaving_quest = 0;
722     floor_ptr->inside_quest = 0;
723     if (creature_ptr->dungeon_idx)
724         creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
725     creature_ptr->dungeon_idx = 0;
726     if (lite_town || vanilla_town) {
727         creature_ptr->wilderness_y = 1;
728         creature_ptr->wilderness_x = 1;
729         if (vanilla_town) {
730             creature_ptr->oldpy = 10;
731             creature_ptr->oldpx = 34;
732         } else {
733             creature_ptr->oldpy = 33;
734             creature_ptr->oldpx = 131;
735         }
736     } else {
737         creature_ptr->wilderness_y = 48;
738         creature_ptr->wilderness_x = 5;
739         creature_ptr->oldpy = 33;
740         creature_ptr->oldpx = 131;
741     }
742
743     creature_ptr->wild_mode = false;
744     creature_ptr->leaving = true;
745
746     exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, _("                            しかし、生き返った。", "                            but revived."));
747     leave_floor(creature_ptr);
748 }