OSDN Git Service

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