OSDN Git Service

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