2 * @brief ウィザードモードの処理(特別処理中心) / Wizard commands
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>
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/flavor-describer.h"
27 #include "flavor/object-flavor-types.h"
28 #include "flavor/object-flavor.h"
29 #include "floor/floor-leaver.h"
30 #include "floor/floor-mode-changer.h"
31 #include "floor/floor-object.h"
32 #include "game-option/birth-options.h"
33 #include "game-option/option-types-table.h"
34 #include "game-option/play-record-options.h"
35 #include "game-option/special-options.h"
36 #include "grid/feature.h"
37 #include "grid/grid.h"
38 #include "info-reader/fixed-map-parser.h"
39 #include "inventory/inventory-object.h"
40 #include "inventory/inventory-slot-types.h"
41 #include "io/files-util.h"
42 #include "io/input-key-requester.h"
43 #include "io/write-diary.h"
44 #include "market/arena.h"
45 #include "monster-floor/monster-remover.h"
46 #include "monster-floor/monster-summon.h"
47 #include "monster/monster-describer.h"
48 #include "monster/monster-description-types.h"
49 #include "monster/monster-info.h"
50 #include "monster/monster-status.h"
51 #include "monster/smart-learn-types.h"
52 #include "mutation/mutation-investor-remover.h"
53 #include "object-enchant/apply-magic.h"
54 #include "object-enchant/item-apply-magic.h"
55 #include "object-enchant/trc-types.h"
56 #include "object-enchant/trg-types.h"
57 #include "object/object-kind-hook.h"
58 #include "object/object-kind.h"
59 #include "perception/object-perception.h"
60 #include "player-base/player-class.h"
61 #include "player-base/player-race.h"
62 #include "player-info/class-info.h"
63 #include "player-info/race-info.h"
64 #include "player-info/race-types.h"
65 #include "player-info/self-info.h"
66 #include "player-status/player-energy.h"
67 #include "player/digestion-processor.h"
68 #include "player/patron.h"
69 #include "player/player-skill.h"
70 #include "player/player-status-table.h"
71 #include "player/player-status.h"
72 #include "player/race-info-table.h"
73 #include "spell-kind/spells-detection.h"
74 #include "spell-kind/spells-sight.h"
75 #include "spell-kind/spells-teleport.h"
76 #include "spell-kind/spells-world.h"
77 #include "spell/spells-object.h"
78 #include "spell/spells-status.h"
79 #include "spell/spells-summon.h"
80 #include "status/experience.h"
81 #include "system/angband-version.h"
82 #include "system/artifact-type-definition.h"
83 #include "system/floor-type-definition.h"
84 #include "system/grid-type-definition.h"
85 #include "system/monster-type-definition.h"
86 #include "system/object-type-definition.h"
87 #include "system/player-type-definition.h"
88 #include "target/grid-selector.h"
89 #include "term/screen-processor.h"
90 #include "util/angband-files.h"
91 #include "util/bit-flags-calculator.h"
92 #include "util/enum-converter.h"
93 #include "util/int-char-converter.h"
94 #include "view/display-messages.h"
95 #include "wizard/spoiler-table.h"
96 #include "wizard/tval-descriptions-table.h"
97 #include "wizard/wizard-spells.h"
98 #include "wizard/wizard-spoiler.h"
99 #include "world/world.h"
111 * @brief プレイヤーを完全回復する /
112 * Cure everything instantly
114 void wiz_cure_all(PlayerType *player_ptr)
116 (void)life_stream(player_ptr, false, false);
117 (void)restore_mana(player_ptr, true);
118 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
121 static std::optional<KIND_OBJECT_IDX> wiz_select_tval()
123 KIND_OBJECT_IDX list;
125 for (list = 0; (list < 80) && (tvals[list].tval > ItemKindType::NONE); list++) {
126 auto row = 2 + (list % 20);
127 auto col = _(32, 24) * (list / 20);
129 prt(format("[%c] %s", ch, tvals[list].desc), row, col);
133 if (!get_com(_("アイテム種別を選んで下さい", "Get what type of object? "), &ch, false)) {
137 KIND_OBJECT_IDX selection;
138 for (selection = 0; selection < max_num; selection++) {
139 if (listsym[selection] == ch) {
144 if ((selection < 0) || (selection >= max_num)) {
151 static KIND_OBJECT_IDX wiz_select_sval(const ItemKindType tval, concptr tval_description)
154 KIND_OBJECT_IDX choice[80]{};
157 for (const auto &k_ref : k_info) {
162 if (k_ref.idx == 0 || k_ref.tval != tval) {
166 auto row = 2 + (num % 20);
167 auto col = _(30, 32) * (num / 20);
170 strip_name(buf, k_ref.idx);
171 prt(format("[%c] %s", ch, buf), row, col);
172 choice[num++] = k_ref.idx;
176 if (!get_com(format(_("%s群の具体的なアイテムを選んで下さい", "What Kind of %s? "), tval_description), &ch, false)) {
180 KIND_OBJECT_IDX selection;
181 for (selection = 0; selection < max_num; selection++) {
182 if (listsym[selection] == ch) {
187 if ((selection < 0) || (selection >= max_num)) {
191 return choice[selection];
195 * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
196 * Specify tval and sval (type and subtype of object) originally
199 * by RAK, heavily modified by -Bernd-
200 * This function returns the k_idx of an object type, or zero if failed
201 * List up to 50 choices in three columns
203 static KIND_OBJECT_IDX wiz_create_itemtype()
206 auto selection = wiz_select_tval();
207 if (!selection.has_value()) {
211 auto tval = tvals[selection.value()].tval;
212 auto tval_description = tvals[selection.value()].desc;
214 return wiz_select_sval(tval, tval_description);
218 * @brief 任意のベースアイテム生成のメインルーチン /
219 * Wizard routine for creating objects -RAK-
221 * Heavily modified to allow magification and artifactification -Bernd-
223 * Note that wizards cannot create objects on top of other objects.
225 * Hack -- this routine always makes a "dungeon object", and applies
226 * magic to it, and attempts to decline cursed items.
228 void wiz_create_item(PlayerType *player_ptr)
231 OBJECT_IDX k_idx = wiz_create_itemtype();
236 if (k_info[k_idx].gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
237 for (const auto &a_ref : a_info) {
238 if ((a_ref.idx == 0) || (a_ref.tval != k_info[k_idx].tval) || (a_ref.sval != k_info[k_idx].sval))
241 (void)create_named_art(player_ptr, a_ref.idx, player_ptr->y, player_ptr->x);
242 msg_print("Allocated(INSTA_ART).");
251 apply_magic_to_object(player_ptr, q_ptr, player_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART);
252 (void)drop_near(player_ptr, q_ptr, -1, player_ptr->y, player_ptr->x);
253 msg_print("Allocated.");
257 * @brief 指定したIDの固定アーティファクトの名称を取得する
259 * @param a_idx 固定アーティファクトのID
260 * @return 固定アーティファクトの名称(Ex. ★ロング・ソード『リンギル』)を保持する std::string オブジェクト
262 static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, ARTIFACT_IDX a_idx)
264 const auto &a_ref = a_info[a_idx];
266 obj.prep(lookup_kind(a_ref.tval, a_ref.sval));
270 describe_flavor(player_ptr, buf, &obj, OD_NAME_ONLY);
276 * @brief 固定アーティファクトをリストから選択する
278 * @param a_idx_list 選択する候補となる固定アーティファクトのIDのリスト
279 * @return 選択した固定アーティファクトのIDを返す。但しキャンセルした場合は std::nullopt を返す。
281 static std::optional<ARTIFACT_IDX> wiz_select_named_artifact(PlayerType *player_ptr, const std::vector<ARTIFACT_IDX> &a_idx_list)
283 constexpr auto MAX_PER_PAGE = 20UL;
284 const auto page_max = (a_idx_list.size() - 1) / MAX_PER_PAGE + 1;
285 auto current_page = 0UL;
289 std::optional<ARTIFACT_IDX> selected_a_idx;
291 while (!selected_a_idx.has_value()) {
292 const auto page_base_idx = current_page * MAX_PER_PAGE;
293 for (auto i = 0U; i < MAX_PER_PAGE + 1; ++i) {
294 term_erase(14, i + 1, 255);
296 const auto page_item_count = std::min(MAX_PER_PAGE, a_idx_list.size() - page_base_idx);
297 for (auto i = 0U; i < page_item_count; ++i) {
298 std::stringstream ss;
299 ss << I2A(i) << ") " << wiz_make_named_artifact_desc(player_ptr, a_idx_list[page_base_idx + i]);
300 put_str(ss.str().c_str(), i + 1, 15);
303 put_str(format("-- more (%d/%d) --", current_page + 1, page_max), page_item_count + 1, 15);
307 get_com("Which artifact: ", &cmd, false);
311 return selected_a_idx;
314 if (current_page >= page_max) {
319 const auto select_idx = A2I(cmd) + page_base_idx;
320 if (select_idx < a_idx_list.size()) {
321 selected_a_idx = a_idx_list[select_idx];
329 return selected_a_idx;
333 * @brief 指定したカテゴリの固定アーティファクトのIDのリストを得る
335 * @param group_artifact 固定アーティファクトのカテゴリ
336 * @return 該当のカテゴリの固定アーティファクトのIDのリスト
338 static std::vector<ARTIFACT_IDX> wiz_collect_group_a_idx(const grouper &group_artifact)
340 const auto &[tval_list, name] = group_artifact;
341 std::vector<ARTIFACT_IDX> a_idx_list;
342 for (auto tval : tval_list) {
343 for (const auto &a_ref : a_info) {
344 if (a_ref.tval == tval) {
345 a_idx_list.push_back(a_ref.idx);
353 * @brief 固定アーティファクトを生成する / Create the artifact
355 void wiz_create_named_art(PlayerType *player_ptr)
359 for (auto i = 0U; i < group_artifact_list.size(); ++i) {
360 const auto &[tval_lit, name] = group_artifact_list[i];
361 std::stringstream ss;
362 ss << I2A(i) << ") " << name;
363 term_erase(14, i + 1, 255);
364 put_str(ss.str().c_str(), i + 1, 15);
367 std::optional<ARTIFACT_IDX> create_a_idx;
369 while (!create_a_idx.has_value()) {
371 get_com("Kind of artifact: ", &cmd, false);
377 if (auto idx = A2I(cmd); idx < group_artifact_list.size()) {
378 const auto a_idx_list = wiz_collect_group_a_idx(group_artifact_list[idx]);
379 create_a_idx = wiz_select_named_artifact(player_ptr, a_idx_list);
386 create_named_art(player_ptr, create_a_idx.value(), player_ptr->y, player_ptr->x);
387 msg_print("Allocated.");
391 * @brief プレイヤーの現能力値を調整する / Change various "permanent" player variables.
392 * @param player_ptr プレイヤーへの参照ポインタ
394 void wiz_change_status(PlayerType *player_ptr)
399 for (int i = 0; i < A_MAX; i++) {
400 sprintf(ppp, "%s (3-%d): ", stat_names[i], player_ptr->stat_max_max[i]);
401 sprintf(tmp_val, "%d", player_ptr->stat_max[i]);
402 if (!get_string(ppp, tmp_val, 3))
405 tmp_int = atoi(tmp_val);
406 if (tmp_int > player_ptr->stat_max_max[i])
407 tmp_int = player_ptr->stat_max_max[i];
408 else if (tmp_int < 3)
411 player_ptr->stat_cur[i] = player_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
414 sprintf(tmp_val, "%d", PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER));
415 if (!get_string(_("熟練度: ", "Proficiency: "), tmp_val, 4))
418 auto tmp_s16b = std::clamp(static_cast<SUB_EXP>(atoi(tmp_val)),
419 PlayerSkill::weapon_exp_at(PlayerSkillRank::UNSKILLED),
420 PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER));
422 for (auto tval : TV_WEAPON_RANGE) {
423 for (int i = 0; i < 64; i++) {
424 player_ptr->weapon_exp[tval][i] = tmp_s16b;
427 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
429 for (auto j : PLAYER_SKILL_KIND_TYPE_RANGE) {
430 player_ptr->skill_exp[j] = tmp_s16b;
431 auto short_pclass = enum2i(player_ptr->pclass);
432 if (player_ptr->skill_exp[j] > s_info[short_pclass].s_max[j])
433 player_ptr->skill_exp[j] = s_info[short_pclass].s_max[j];
437 for (k = 0; k < 32; k++)
438 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER), tmp_s16b);
441 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT), tmp_s16b);
443 sprintf(tmp_val, "%ld", (long)(player_ptr->au));
444 if (!get_string("Gold: ", tmp_val, 9))
447 long tmp_long = atol(tmp_val);
451 player_ptr->au = tmp_long;
452 sprintf(tmp_val, "%ld", (long)(player_ptr->max_exp));
453 if (!get_string("Experience: ", tmp_val, 9))
456 tmp_long = atol(tmp_val);
460 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID))
463 player_ptr->max_exp = tmp_long;
464 player_ptr->exp = tmp_long;
465 check_experience(player_ptr);
466 do_cmd_redraw(player_ptr);
470 * @brief 指定された地点の地形IDを変更する /
471 * Create desired feature
472 * @param creaturer_ptr プレイヤーへの参照ポインタ
474 void wiz_create_feature(PlayerType *player_ptr)
478 if (!tgt_pt(player_ptr, &x, &y))
482 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
484 f_val1 = g_ptr->feat;
485 if (!get_value(_("実地形ID", "FeatureID"), 0, f_info.size() - 1, &f_val1)) {
490 if (!get_value(_("偽装地形ID", "FeatureID"), 0, f_info.size() - 1, &f_val2)) {
494 cave_set_feat(player_ptr, y, x, static_cast<FEAT_IDX>(f_val1));
495 g_ptr->mimic = (int16_t)f_val2;
497 f_ptr = &f_info[g_ptr->get_feat_mimic()];
499 if (f_ptr->flags.has(FloorFeatureType::RUNE_PROTECTION) || f_ptr->flags.has(FloorFeatureType::RUNE_EXPLOSION))
500 g_ptr->info |= CAVE_OBJECT;
501 else if (f_ptr->flags.has(FloorFeatureType::MIRROR))
502 g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
504 note_spot(player_ptr, y, x);
505 lite_spot(player_ptr, y, x);
506 player_ptr->update |= PU_FLOW;
510 * @brief 選択したダンジョンの任意フロアを選択する
511 * @param player_ptr プレイヤーへの参照ポインタ
512 * @param dungeon_type ダンジョン番号
513 * @return フロアを選択したらtrue、キャンセルならfalse
514 * @details 0を指定すると地上に飛ぶが、元いた場所にしか飛ばない
515 * @todo 可能ならダンジョンの入口 (例:ルルイエなら大洋の真ん中)へ飛べるようにしたい
517 static bool select_debugging_floor(PlayerType *player_ptr, int dungeon_type)
519 auto max_depth = d_info[dungeon_type].maxdepth;
520 if ((max_depth == 0) || (dungeon_type > static_cast<int>(d_info.size()))) {
521 dungeon_type = DUNGEON_ANGBAND;
524 auto min_depth = (int)d_info[dungeon_type].mindepth;
528 sprintf(ppp, "Jump to level (0, %d-%d): ", min_depth, max_depth);
529 sprintf(tmp_val, "%d", (int)player_ptr->current_floor_ptr->dun_level);
530 if (!get_string(ppp, tmp_val, 10)) {
534 auto tmp_command_arg = (COMMAND_ARG)atoi(tmp_val);
535 if (tmp_command_arg == 0) {
536 command_arg = tmp_command_arg;
540 auto is_valid_floor = tmp_command_arg > 0;
541 is_valid_floor &= tmp_command_arg >= min_depth;
542 is_valid_floor &= tmp_command_arg <= max_depth;
543 if (is_valid_floor) {
544 command_arg = tmp_command_arg;
548 msg_print("Invalid floor. Please re-input.");
556 * @brief デバッグ帰還のダンジョンを選ぶ
557 * @param player_ptr プレイヤーへの参照ポインタ
558 * @details 範囲外の値が選択されたら再入力を促す
560 static bool select_debugging_dungeon(PlayerType *player_ptr, DUNGEON_IDX *dungeon_type)
562 if (command_arg > 0) {
569 sprintf(ppp, "Jump which dungeon : ");
570 sprintf(tmp_val, "%d", player_ptr->dungeon_idx);
571 if (!get_string(ppp, tmp_val, 2)) {
575 *dungeon_type = (DUNGEON_IDX)atoi(tmp_val);
576 if ((*dungeon_type < DUNGEON_ANGBAND) || (*dungeon_type > DUNGEON_MAX)) {
577 msg_print("Invalid dungeon. Please re-input.");
586 * @brief 任意のダンジョン及び階層に飛ぶtための選択処理
589 void wiz_jump_to_dungeon(PlayerType *player_ptr)
591 DUNGEON_IDX dungeon_type = 1;
592 if (!select_debugging_dungeon(player_ptr, &dungeon_type)) {
596 if (!select_debugging_floor(player_ptr, dungeon_type)) {
600 if (command_arg < d_info[dungeon_type].mindepth)
603 if (command_arg > d_info[dungeon_type].maxdepth)
604 command_arg = (COMMAND_ARG)d_info[dungeon_type].maxdepth;
606 msg_format("You jump to dungeon level %d.", command_arg);
608 do_cmd_save_game(player_ptr, true);
610 jump_floor(player_ptr, dungeon_type, command_arg);
614 * @brief 全ベースアイテムを鑑定済みにする /
615 * Become aware of a lot of objects
616 * @param player_ptr プレイヤーへの参照ポインタ
618 void wiz_learn_items_all(PlayerType *player_ptr)
622 for (const auto &k_ref : k_info) {
623 if (k_ref.idx > 0 && k_ref.level <= command_arg) {
625 q_ptr->prep(k_ref.idx);
626 object_aware(player_ptr, q_ptr);
632 * @brief プレイヤーの種族を変更する
634 void wiz_reset_race(PlayerType *player_ptr)
636 int val = enum2i<PlayerRaceType>(player_ptr->prace);
637 if (!get_value("RaceID", 0, MAX_RACES - 1, &val)) {
641 player_ptr->prace = i2enum<PlayerRaceType>(val);
642 rp_ptr = &race_info[enum2i(player_ptr->prace)];
644 player_ptr->window_flags |= PW_PLAYER;
645 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
646 player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
647 handle_stuff(player_ptr);
651 * @brief プレイヤーの職業を変更する
652 * @todo 魔法領域の再選択などがまだ不完全、要実装。
654 void wiz_reset_class(PlayerType *player_ptr)
656 int val = enum2i<PlayerClassType>(player_ptr->pclass);
657 if (!get_value("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, &val)) {
661 player_ptr->pclass = i2enum<PlayerClassType>(val);
662 cp_ptr = &class_info[val];
663 mp_ptr = &m_info[val];
664 PlayerClass(player_ptr).init_specific_data();
665 player_ptr->window_flags |= PW_PLAYER;
666 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
667 player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
668 handle_stuff(player_ptr);
672 * @brief プレイヤーの領域を変更する
673 * @todo 存在有無などは未判定。そのうちすべき。
675 void wiz_reset_realms(PlayerType *player_ptr)
677 int val1 = player_ptr->realm1;
678 if (!get_value("1st Realm (None=0)", 0, MAX_REALM - 1, &val1)) {
682 int val2 = player_ptr->realm2;
683 if (!get_value("2nd Realm (None=0)", 0, MAX_REALM - 1, &val2)) {
687 player_ptr->realm1 = static_cast<int16_t>(val1);
688 player_ptr->realm2 = static_cast<int16_t>(val2);
689 player_ptr->window_flags |= PW_PLAYER;
690 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
691 player_ptr->redraw |= PR_BASIC;
692 handle_stuff(player_ptr);
696 * @brief 現在のオプション設定をダンプ出力する /
697 * @param player_ptr プレイヤーへの参照ポインタ
698 * Hack -- Dump option bits usage
700 void wiz_dump_options(void)
703 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "opt_info.txt");
705 fff = angband_fopen(buf, "a");
706 if (fff == nullptr) {
707 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
712 std::vector<std::vector<int>> exist(NUM_O_SET, std::vector<int>(NUM_O_BIT));
714 for (int i = 0; option_info[i].o_desc; i++) {
715 const option_type *ot_ptr = &option_info[i];
717 exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
722 fprintf(fff, "[Option bits usage on %s\n]", title);
723 fputs("Set - Bit (Page) Option Name\n", fff);
724 fputs("------------------------------------------------\n", fff);
725 for (int i = 0; i < NUM_O_SET; i++) {
726 for (int j = 0; j < NUM_O_BIT; j++) {
728 const option_type *ot_ptr = &option_info[exist[i][j] - 1];
729 fprintf(fff, " %d - %02d (%4d) %s\n", i, j, ot_ptr->o_page, ot_ptr->o_text);
731 fprintf(fff, " %d - %02d\n", i, j);
739 msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
743 * @brief プレイ日数を変更する / Set gametime.
744 * @return 実際に変更を行ったらTRUEを返す
746 void set_gametime(void)
749 char ppp[80], tmp_val[40];
750 sprintf(ppp, "Dungeon Turn (0-%ld): ", (long)w_ptr->dungeon_turn_limit);
751 sprintf(tmp_val, "%ld", (long)w_ptr->dungeon_turn);
752 if (!get_string(ppp, tmp_val, 10))
755 tmp_int = atoi(tmp_val);
756 if (tmp_int >= w_ptr->dungeon_turn_limit)
757 tmp_int = w_ptr->dungeon_turn_limit - 1;
758 else if (tmp_int < 0)
761 w_ptr->dungeon_turn = w_ptr->game_turn = tmp_int;
765 * @brief プレイヤー近辺の全モンスターを消去する / Delete all nearby monsters
767 void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
769 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
770 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
771 if (!monster_is_valid(m_ptr) || (i == player_ptr->riding) || (m_ptr->cdis > MAX_SIGHT))
774 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
775 GAME_TEXT m_name[MAX_NLEN];
777 monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
778 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
781 delete_monster_idx(player_ptr, i);
786 * @brief フロアに存在する全モンスターを消去する / Delete all monsters
787 * @param player_ptr 術者の参照ポインタ
789 void wiz_zap_floor_monsters(PlayerType *player_ptr)
791 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
792 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
793 if (!monster_is_valid(m_ptr) || (i == player_ptr->riding))
796 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
797 GAME_TEXT m_name[MAX_NLEN];
798 monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
799 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
802 delete_monster_idx(player_ptr, i);
806 void cheat_death(PlayerType *player_ptr)
809 player_ptr->sc = player_ptr->age = 0;
812 w_ptr->noscore |= 0x0001;
813 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
816 player_ptr->is_dead = false;
817 (void)life_stream(player_ptr, false, false);
818 (void)restore_mana(player_ptr, true);
819 (void)recall_player(player_ptr, 0);
820 reserve_alter_reality(player_ptr, 0);
822 (void)strcpy(player_ptr->died_from, _("死の欺き", "Cheating death"));
823 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
825 auto *floor_ptr = player_ptr->current_floor_ptr;
826 floor_ptr->dun_level = 0;
827 floor_ptr->inside_arena = false;
828 player_ptr->phase_out = false;
829 leaving_quest = QuestId::NONE;
830 floor_ptr->quest_number = QuestId::NONE;
831 if (player_ptr->dungeon_idx)
832 player_ptr->recall_dungeon = player_ptr->dungeon_idx;
833 player_ptr->dungeon_idx = 0;
834 if (lite_town || vanilla_town) {
835 player_ptr->wilderness_y = 1;
836 player_ptr->wilderness_x = 1;
838 player_ptr->oldpy = 10;
839 player_ptr->oldpx = 34;
841 player_ptr->oldpy = 33;
842 player_ptr->oldpx = 131;
845 player_ptr->wilderness_y = 48;
846 player_ptr->wilderness_x = 5;
847 player_ptr->oldpy = 33;
848 player_ptr->oldpx = 131;
851 player_ptr->wild_mode = false;
852 player_ptr->leaving = true;
854 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 1, _(" しかし、生き返った。", " but revived."));
855 leave_floor(player_ptr);