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 "artifact/fixed-art-types.h"
15 #include "birth/inventory-initializer.h"
16 #include "cmd-io/cmd-dump.h"
17 #include "cmd-io/cmd-help.h"
18 #include "cmd-io/cmd-save.h"
19 #include "cmd-visual/cmd-draw.h"
20 #include "core/asking-player.h"
21 #include "core/player-redraw-types.h"
22 #include "core/player-update-types.h"
23 #include "core/stuff-handler.h"
24 #include "core/window-redrawer.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/item-apply-magic.h"
54 #include "object-enchant/item-magic-applier.h"
55 #include "object-enchant/trc-types.h"
56 #include "object-enchant/trg-types.h"
57 #include "object/object-kind-hook.h"
58 #include "perception/object-perception.h"
59 #include "player-base/player-class.h"
60 #include "player-base/player-race.h"
61 #include "player-info/class-info.h"
62 #include "player-info/race-info.h"
63 #include "player-info/race-types.h"
64 #include "player-info/self-info.h"
65 #include "player-status/player-energy.h"
66 #include "player/digestion-processor.h"
67 #include "player/patron.h"
68 #include "player/player-skill.h"
69 #include "player/player-status-table.h"
70 #include "player/player-status.h"
71 #include "player/race-info-table.h"
72 #include "spell-kind/spells-detection.h"
73 #include "spell-kind/spells-sight.h"
74 #include "spell-kind/spells-teleport.h"
75 #include "spell-kind/spells-world.h"
76 #include "spell/spells-object.h"
77 #include "spell/spells-status.h"
78 #include "spell/spells-summon.h"
79 #include "status/bad-status-setter.h"
80 #include "status/experience.h"
81 #include "system/angband-version.h"
82 #include "system/artifact-type-definition.h"
83 #include "system/baseitem-info-definition.h"
84 #include "system/dungeon-info.h"
85 #include "system/floor-type-definition.h"
86 #include "system/grid-type-definition.h"
87 #include "system/monster-type-definition.h"
88 #include "system/object-type-definition.h"
89 #include "system/player-type-definition.h"
90 #include "system/terrain-type-definition.h"
91 #include "target/grid-selector.h"
92 #include "term/screen-processor.h"
93 #include "util/angband-files.h"
94 #include "util/bit-flags-calculator.h"
95 #include "util/enum-converter.h"
96 #include "util/int-char-converter.h"
97 #include "view/display-messages.h"
98 #include "wizard/spoiler-table.h"
99 #include "wizard/tval-descriptions-table.h"
100 #include "wizard/wizard-spells.h"
101 #include "wizard/wizard-spoiler.h"
102 #include "world/world.h"
113 * @brief プレイヤーを完全回復する
115 void wiz_cure_all(PlayerType *player_ptr)
117 (void)life_stream(player_ptr, false, false);
118 (void)restore_mana(player_ptr, true);
119 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
120 BadStatusSetter bss(player_ptr);
121 (void)bss.set_fear(0);
122 (void)bss.set_deceleration(0, false);
123 msg_print("You're fully cured by wizard command.");
126 static std::optional<KIND_OBJECT_IDX> wiz_select_tval()
128 KIND_OBJECT_IDX list;
130 for (list = 0; (list < 80) && (tvals[list].tval > ItemKindType::NONE); list++) {
131 auto row = 2 + (list % 20);
132 auto col = _(32, 24) * (list / 20);
134 prt(format("[%c] %s", ch, tvals[list].desc), row, col);
138 if (!get_com(_("アイテム種別を選んで下さい", "Get what type of object? "), &ch, false)) {
142 KIND_OBJECT_IDX selection;
143 for (selection = 0; selection < max_num; selection++) {
144 if (listsym[selection] == ch) {
149 if ((selection < 0) || (selection >= max_num)) {
156 static KIND_OBJECT_IDX wiz_select_sval(const ItemKindType tval, concptr tval_description)
159 KIND_OBJECT_IDX choice[80]{};
161 for (const auto &k_ref : baseitems_info) {
166 if (k_ref.idx == 0 || k_ref.tval != tval) {
170 auto row = 2 + (num % 20);
171 auto col = _(30, 32) * (num / 20);
173 const auto buf = strip_name(k_ref.idx);
174 prt(format("[%c] %s", ch, buf.data()), row, col);
175 choice[num++] = k_ref.idx;
179 if (!get_com(format(_("%s群の具体的なアイテムを選んで下さい", "What Kind of %s? "), tval_description), &ch, false)) {
183 KIND_OBJECT_IDX selection;
184 for (selection = 0; selection < max_num; selection++) {
185 if (listsym[selection] == ch) {
190 if ((selection < 0) || (selection >= max_num)) {
194 return choice[selection];
198 * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
199 * Specify tval and sval (type and subtype of object) originally
202 * by RAK, heavily modified by -Bernd-
203 * This function returns the k_idx of an object type, or zero if failed
204 * List up to 50 choices in three columns
206 static KIND_OBJECT_IDX wiz_create_itemtype()
209 auto selection = wiz_select_tval();
210 if (!selection.has_value()) {
214 auto tval = tvals[selection.value()].tval;
215 auto tval_description = tvals[selection.value()].desc;
217 return wiz_select_sval(tval, tval_description);
221 * @brief 任意のベースアイテム生成のメインルーチン /
222 * Wizard routine for creating objects -RAK-
224 * Heavily modified to allow magification and artifactification -Bernd-
226 * Note that wizards cannot create objects on top of other objects.
228 * Hack -- this routine always makes a "dungeon object", and applies
229 * magic to it, and attempts to decline cursed items.
231 void wiz_create_item(PlayerType *player_ptr)
234 const auto bi_id = wiz_create_itemtype();
240 const auto &baseitem = baseitems_info[bi_id];
241 if (baseitem.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
242 for (const auto &[a_idx, a_ref] : artifacts_info) {
243 if ((a_idx == FixedArtifactId::NONE) || (a_ref.bi_key.tval() != baseitem.tval) || (a_ref.bi_key.sval() != baseitem.sval)) {
247 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
248 msg_print("Allocated(INSTA_ART).");
255 ItemMagicApplier(player_ptr, &item, player_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART).execute();
256 (void)drop_near(player_ptr, &item, -1, player_ptr->y, player_ptr->x);
257 msg_print("Allocated.");
261 * @brief 指定したIDの固定アーティファクトの名称を取得する
263 * @param a_idx 固定アーティファクトのID
264 * @return 固定アーティファクトの名称(Ex. ★ロング・ソード『リンギル』)を保持する std::string オブジェクト
266 static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
268 const auto &a_ref = artifacts_info.at(a_idx);
270 item.prep(lookup_baseitem_id(a_ref.bi_key));
271 item.fixed_artifact_idx = a_idx;
274 describe_flavor(player_ptr, buf, &item, OD_NAME_ONLY);
279 * @brief 固定アーティファクトをリストから選択する
281 * @param a_idx_list 選択する候補となる固定アーティファクトのIDのリスト
282 * @return 選択した固定アーティファクトのIDを返す。但しキャンセルした場合は std::nullopt を返す。
284 static std::optional<FixedArtifactId> wiz_select_named_artifact(PlayerType *player_ptr, const std::vector<FixedArtifactId> &a_idx_list)
286 constexpr auto MAX_PER_PAGE = 20UL;
287 const auto page_max = (a_idx_list.size() - 1) / MAX_PER_PAGE + 1;
288 auto current_page = 0UL;
292 std::optional<FixedArtifactId> selected_a_idx;
294 while (!selected_a_idx.has_value()) {
295 const auto page_base_idx = current_page * MAX_PER_PAGE;
296 for (auto i = 0U; i < MAX_PER_PAGE + 1; ++i) {
297 term_erase(14, i + 1, 255);
299 const auto page_item_count = std::min(MAX_PER_PAGE, a_idx_list.size() - page_base_idx);
300 for (auto i = 0U; i < page_item_count; ++i) {
301 std::stringstream ss;
302 ss << I2A(i) << ") " << wiz_make_named_artifact_desc(player_ptr, a_idx_list[page_base_idx + i]);
303 put_str(ss.str().data(), i + 1, 15);
306 put_str(format("-- more (%d/%d) --", current_page + 1, page_max), page_item_count + 1, 15);
310 get_com("Which artifact: ", &cmd, false);
314 return selected_a_idx;
317 if (current_page >= page_max) {
322 const auto select_idx = A2I(cmd) + page_base_idx;
323 if (select_idx < a_idx_list.size()) {
324 selected_a_idx = a_idx_list[select_idx];
332 return selected_a_idx;
336 * @brief 指定したカテゴリの固定アーティファクトのIDのリストを得る
338 * @param group_artifact 固定アーティファクトのカテゴリ
339 * @return 該当のカテゴリの固定アーティファクトのIDのリスト
341 static std::vector<FixedArtifactId> wiz_collect_group_a_idx(const grouper &group_artifact)
343 const auto &[tval_list, name] = group_artifact;
344 std::vector<FixedArtifactId> a_idx_list;
345 for (auto tval : tval_list) {
346 for (const auto &[a_idx, a_ref] : artifacts_info) {
347 if (a_ref.bi_key.tval() == tval) {
348 a_idx_list.push_back(a_idx);
357 * @brief 固定アーティファクトを生成する / Create the artifact
359 void wiz_create_named_art(PlayerType *player_ptr)
362 for (auto i = 0U; i < group_artifact_list.size(); ++i) {
363 const auto &[tval_lit, name] = group_artifact_list[i];
364 std::stringstream ss;
365 ss << I2A(i) << ") " << name;
366 term_erase(14, i + 1, 255);
367 put_str(ss.str().data(), i + 1, 15);
370 std::optional<FixedArtifactId> create_a_idx;
371 while (!create_a_idx.has_value()) {
373 get_com("Kind of artifact: ", &cmd, false);
379 if (auto idx = A2I(cmd); idx < group_artifact_list.size()) {
380 const auto &a_idx_list = wiz_collect_group_a_idx(group_artifact_list[idx]);
381 create_a_idx = wiz_select_named_artifact(player_ptr, a_idx_list);
389 const auto a_idx = create_a_idx.value();
390 const auto it = artifacts_info.find(a_idx);
391 if (it == artifacts_info.end()) {
392 msg_print("The specified artifact is obsoleted for now.");
396 auto &a_ref = it->second;
397 if (a_ref.is_generated) {
398 msg_print("It's already allocated.");
402 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
403 msg_print("Allocated.");
407 * @brief プレイヤーの現能力値を調整する / Change various "permanent" player variables.
408 * @param player_ptr プレイヤーへの参照ポインタ
410 void wiz_change_status(PlayerType *player_ptr)
415 for (int i = 0; i < A_MAX; i++) {
416 sprintf(ppp, "%s (3-%d): ", stat_names[i], player_ptr->stat_max_max[i]);
417 sprintf(tmp_val, "%d", player_ptr->stat_max[i]);
418 if (!get_string(ppp, tmp_val, 3)) {
422 tmp_int = atoi(tmp_val);
423 if (tmp_int > player_ptr->stat_max_max[i]) {
424 tmp_int = player_ptr->stat_max_max[i];
425 } else if (tmp_int < 3) {
429 player_ptr->stat_cur[i] = player_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
432 sprintf(tmp_val, "%d", PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER));
433 if (!get_string(_("熟練度: ", "Proficiency: "), tmp_val, 4)) {
437 auto tmp_s16b = std::clamp(static_cast<SUB_EXP>(atoi(tmp_val)),
438 PlayerSkill::weapon_exp_at(PlayerSkillRank::UNSKILLED),
439 PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER));
441 for (auto tval : TV_WEAPON_RANGE) {
442 for (int i = 0; i < 64; i++) {
443 player_ptr->weapon_exp[tval][i] = tmp_s16b;
446 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
448 for (auto j : PLAYER_SKILL_KIND_TYPE_RANGE) {
449 player_ptr->skill_exp[j] = tmp_s16b;
450 auto short_pclass = enum2i(player_ptr->pclass);
451 if (player_ptr->skill_exp[j] > class_skills_info[short_pclass].s_max[j]) {
452 player_ptr->skill_exp[j] = class_skills_info[short_pclass].s_max[j];
457 for (k = 0; k < 32; k++) {
458 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER), tmp_s16b);
461 for (; k < 64; k++) {
462 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT), tmp_s16b);
465 sprintf(tmp_val, "%ld", (long)(player_ptr->au));
466 if (!get_string("Gold: ", tmp_val, 9)) {
470 long tmp_long = atol(tmp_val);
475 player_ptr->au = tmp_long;
476 sprintf(tmp_val, "%ld", (long)(player_ptr->max_exp));
477 if (!get_string("Experience: ", tmp_val, 9)) {
481 tmp_long = atol(tmp_val);
486 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
490 player_ptr->max_exp = tmp_long;
491 player_ptr->exp = tmp_long;
492 check_experience(player_ptr);
493 do_cmd_redraw(player_ptr);
497 * @brief 指定された地点の地形IDを変更する /
498 * Create desired feature
499 * @param creaturer_ptr プレイヤーへの参照ポインタ
501 void wiz_create_feature(PlayerType *player_ptr)
505 if (!tgt_pt(player_ptr, &x, &y)) {
510 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
512 f_val1 = g_ptr->feat;
513 if (!get_value(_("実地形ID", "FeatureID"), 0, terrains_info.size() - 1, &f_val1)) {
518 if (!get_value(_("偽装地形ID", "FeatureID"), 0, terrains_info.size() - 1, &f_val2)) {
522 cave_set_feat(player_ptr, y, x, static_cast<FEAT_IDX>(f_val1));
523 g_ptr->mimic = (int16_t)f_val2;
525 f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
527 if (f_ptr->flags.has(TerrainCharacteristics::RUNE_PROTECTION) || f_ptr->flags.has(TerrainCharacteristics::RUNE_EXPLOSION)) {
528 g_ptr->info |= CAVE_OBJECT;
529 } else if (f_ptr->flags.has(TerrainCharacteristics::MIRROR)) {
530 g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
533 note_spot(player_ptr, y, x);
534 lite_spot(player_ptr, y, x);
535 player_ptr->update |= PU_FLOW;
539 * @brief デバッグ帰還のダンジョンを選ぶ
540 * @param player_ptr プレイヤーへの参照ポインタ
541 * @details 範囲外の値が選択されたら再入力を促す
543 static bool select_debugging_dungeon(PlayerType *player_ptr, DUNGEON_IDX *dungeon_type)
545 if (command_arg > 0) {
552 sprintf(ppp, "Jump which dungeon : ");
553 sprintf(tmp_val, "%d", player_ptr->dungeon_idx);
554 if (!get_string(ppp, tmp_val, 2)) {
558 *dungeon_type = (DUNGEON_IDX)atoi(tmp_val);
559 if ((*dungeon_type < DUNGEON_ANGBAND) || (*dungeon_type > DUNGEON_MAX)) {
560 msg_print("Invalid dungeon. Please re-input.");
569 * @brief 選択したダンジョンの任意フロアを選択する
570 * @param player_ptr プレイヤーへの参照ポインタ
571 * @param dungeon_type ダンジョン番号
572 * @return フロアを選択したらtrue、キャンセルならfalse
573 * @details 0を指定すると地上に飛ぶが、元いた場所にしか飛ばない
574 * @todo 可能ならダンジョンの入口 (例:ルルイエなら大洋の真ん中)へ飛べるようにしたい
576 static bool select_debugging_floor(PlayerType *player_ptr, int dungeon_type)
578 auto max_depth = dungeons_info[dungeon_type].maxdepth;
579 if ((max_depth == 0) || (dungeon_type > static_cast<int>(dungeons_info.size()))) {
580 dungeon_type = DUNGEON_ANGBAND;
583 auto min_depth = (int)dungeons_info[dungeon_type].mindepth;
587 sprintf(ppp, "Jump to level (0, %d-%d): ", min_depth, max_depth);
588 sprintf(tmp_val, "%d", (int)player_ptr->current_floor_ptr->dun_level);
589 if (!get_string(ppp, tmp_val, 10)) {
593 auto tmp_command_arg = (COMMAND_ARG)atoi(tmp_val);
594 if (tmp_command_arg == 0) {
595 command_arg = tmp_command_arg;
599 auto is_valid_floor = tmp_command_arg > 0;
600 is_valid_floor &= tmp_command_arg >= min_depth;
601 is_valid_floor &= tmp_command_arg <= max_depth;
602 if (is_valid_floor) {
603 command_arg = tmp_command_arg;
607 msg_print("Invalid floor. Please re-input.");
615 * @brief 任意のダンジョン及び階層に飛ぶ
618 static void wiz_jump_floor(PlayerType *player_ptr, DUNGEON_IDX dun_idx, DEPTH depth)
620 player_ptr->dungeon_idx = dun_idx;
621 auto &floor_ref = *player_ptr->current_floor_ptr;
622 floor_ref.dun_level = depth;
623 prepare_change_floor_mode(player_ptr, CFM_RAND_PLACE);
624 if (!floor_ref.is_in_dungeon()) {
625 player_ptr->dungeon_idx = 0;
628 floor_ref.inside_arena = false;
629 player_ptr->wild_mode = false;
630 leave_quest_check(player_ptr);
632 exe_write_diary(player_ptr, DIARY_WIZ_TELE, 0, nullptr);
635 floor_ref.quest_number = QuestId::NONE;
636 PlayerEnergy(player_ptr).reset_player_turn();
637 player_ptr->energy_need = 0;
638 prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR);
639 player_ptr->leaving = true;
643 * @brief 任意のダンジョン及び階層に飛ぶtための選択処理
646 void wiz_jump_to_dungeon(PlayerType *player_ptr)
648 DUNGEON_IDX dungeon_type = 1;
649 if (!select_debugging_dungeon(player_ptr, &dungeon_type)) {
653 if (!select_debugging_floor(player_ptr, dungeon_type)) {
657 if (command_arg < dungeons_info[dungeon_type].mindepth) {
661 if (command_arg > dungeons_info[dungeon_type].maxdepth) {
662 command_arg = (COMMAND_ARG)dungeons_info[dungeon_type].maxdepth;
665 msg_format("You jump to dungeon level %d.", command_arg);
667 do_cmd_save_game(player_ptr, true);
670 wiz_jump_floor(player_ptr, dungeon_type, command_arg);
674 * @brief 全ベースアイテムを鑑定済みにする /
675 * Become aware of a lot of objects
676 * @param player_ptr プレイヤーへの参照ポインタ
678 void wiz_learn_items_all(PlayerType *player_ptr)
682 for (const auto &k_ref : baseitems_info) {
683 if (k_ref.idx > 0 && k_ref.level <= command_arg) {
685 q_ptr->prep(k_ref.idx);
686 object_aware(player_ptr, q_ptr);
692 * @brief プレイヤーの種族を変更する
694 void wiz_reset_race(PlayerType *player_ptr)
696 int val = enum2i<PlayerRaceType>(player_ptr->prace);
697 if (!get_value("RaceID", 0, MAX_RACES - 1, &val)) {
701 player_ptr->prace = i2enum<PlayerRaceType>(val);
702 rp_ptr = &race_info[enum2i(player_ptr->prace)];
704 player_ptr->window_flags |= PW_PLAYER;
705 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
706 player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
707 handle_stuff(player_ptr);
711 * @brief プレイヤーの職業を変更する
712 * @todo 魔法領域の再選択などがまだ不完全、要実装。
714 void wiz_reset_class(PlayerType *player_ptr)
716 int val = enum2i<PlayerClassType>(player_ptr->pclass);
717 if (!get_value("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, &val)) {
721 player_ptr->pclass = i2enum<PlayerClassType>(val);
722 cp_ptr = &class_info[val];
723 mp_ptr = &class_magics_info[val];
724 PlayerClass(player_ptr).init_specific_data();
725 player_ptr->window_flags |= PW_PLAYER;
726 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
727 player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
728 handle_stuff(player_ptr);
732 * @brief プレイヤーの領域を変更する
733 * @todo 存在有無などは未判定。そのうちすべき。
735 void wiz_reset_realms(PlayerType *player_ptr)
737 int val1 = player_ptr->realm1;
738 if (!get_value("1st Realm (None=0)", 0, MAX_REALM - 1, &val1)) {
742 int val2 = player_ptr->realm2;
743 if (!get_value("2nd Realm (None=0)", 0, MAX_REALM - 1, &val2)) {
747 player_ptr->realm1 = static_cast<int16_t>(val1);
748 player_ptr->realm2 = static_cast<int16_t>(val2);
749 player_ptr->window_flags |= PW_PLAYER;
750 player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
751 player_ptr->redraw |= PR_BASIC;
752 handle_stuff(player_ptr);
756 * @brief 現在のオプション設定をダンプ出力する /
757 * @param player_ptr プレイヤーへの参照ポインタ
758 * Hack -- Dump option bits usage
760 void wiz_dump_options(void)
763 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "opt_info.txt");
765 fff = angband_fopen(buf, "a");
766 if (fff == nullptr) {
767 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
772 std::vector<std::vector<int>> exist(NUM_O_SET, std::vector<int>(NUM_O_BIT));
774 for (int i = 0; option_info[i].o_desc; i++) {
775 const option_type *ot_ptr = &option_info[i];
777 exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
783 fprintf(fff, "[Option bits usage on %s\n]", title);
784 fputs("Set - Bit (Page) Option Name\n", fff);
785 fputs("------------------------------------------------\n", fff);
786 for (int i = 0; i < NUM_O_SET; i++) {
787 for (int j = 0; j < NUM_O_BIT; j++) {
789 const option_type *ot_ptr = &option_info[exist[i][j] - 1];
790 fprintf(fff, " %d - %02d (%4d) %s\n", i, j, ot_ptr->o_page, ot_ptr->o_text);
792 fprintf(fff, " %d - %02d\n", i, j);
800 msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
804 * @brief プレイ日数を変更する / Set gametime.
805 * @return 実際に変更を行ったらTRUEを返す
807 void set_gametime(void)
810 if (!get_value("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1, &game_time)) {
814 w_ptr->dungeon_turn = w_ptr->game_turn = game_time;
818 * @brief プレイヤー近辺の全モンスターを消去する / Delete all nearby monsters
820 void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
822 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
823 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
824 if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_PLAYER_SIGHT)) {
828 if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
829 GAME_TEXT m_name[MAX_NLEN];
831 monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
832 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
835 delete_monster_idx(player_ptr, i);
840 * @brief フロアに存在する全モンスターを消去する / Delete all monsters
841 * @param player_ptr 術者の参照ポインタ
843 void wiz_zap_floor_monsters(PlayerType *player_ptr)
845 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
846 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
847 if (!m_ptr->is_valid() || (i == player_ptr->riding)) {
851 if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
852 GAME_TEXT m_name[MAX_NLEN];
853 monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
854 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
857 delete_monster_idx(player_ptr, i);
861 void cheat_death(PlayerType *player_ptr)
863 if (player_ptr->sc) {
864 player_ptr->sc = player_ptr->age = 0;
868 w_ptr->noscore |= 0x0001;
869 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
872 player_ptr->is_dead = false;
873 (void)life_stream(player_ptr, false, false);
874 (void)restore_mana(player_ptr, true);
875 (void)recall_player(player_ptr, 0);
876 reserve_alter_reality(player_ptr, 0);
878 player_ptr->died_from = _("死の欺き", "Cheating death");
879 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
881 auto *floor_ptr = player_ptr->current_floor_ptr;
882 floor_ptr->dun_level = 0;
883 floor_ptr->inside_arena = false;
884 player_ptr->phase_out = false;
885 leaving_quest = QuestId::NONE;
886 floor_ptr->quest_number = QuestId::NONE;
887 if (player_ptr->dungeon_idx) {
888 player_ptr->recall_dungeon = player_ptr->dungeon_idx;
890 player_ptr->dungeon_idx = 0;
891 if (lite_town || vanilla_town) {
892 player_ptr->wilderness_y = 1;
893 player_ptr->wilderness_x = 1;
895 player_ptr->oldpy = 10;
896 player_ptr->oldpx = 34;
898 player_ptr->oldpy = 33;
899 player_ptr->oldpx = 131;
902 player_ptr->wilderness_y = 48;
903 player_ptr->wilderness_x = 5;
904 player_ptr->oldpy = 33;
905 player_ptr->oldpx = 131;
908 player_ptr->wild_mode = false;
909 player_ptr->leaving = true;
911 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 1, _(" しかし、生き返った。", " but revived."));
912 leave_floor(player_ptr);