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/stuff-handler.h"
22 #include "core/window-redrawer.h"
23 #include "dungeon/quest.h"
24 #include "flavor/flavor-describer.h"
25 #include "flavor/object-flavor-types.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/item-apply-magic.h"
52 #include "object-enchant/item-magic-applier.h"
53 #include "object-enchant/trc-types.h"
54 #include "object-enchant/trg-types.h"
55 #include "object/object-kind-hook.h"
56 #include "perception/object-perception.h"
57 #include "player-base/player-class.h"
58 #include "player-base/player-race.h"
59 #include "player-info/class-info.h"
60 #include "player-info/race-info.h"
61 #include "player-info/race-types.h"
62 #include "player-info/self-info.h"
63 #include "player-status/player-energy.h"
64 #include "player/digestion-processor.h"
65 #include "player/patron.h"
66 #include "player/player-skill.h"
67 #include "player/player-status-table.h"
68 #include "player/player-status.h"
69 #include "player/race-info-table.h"
70 #include "spell-kind/spells-detection.h"
71 #include "spell-kind/spells-sight.h"
72 #include "spell-kind/spells-teleport.h"
73 #include "spell-kind/spells-world.h"
74 #include "spell/spells-object.h"
75 #include "spell/spells-status.h"
76 #include "spell/spells-summon.h"
77 #include "status/bad-status-setter.h"
78 #include "status/experience.h"
79 #include "system/angband-version.h"
80 #include "system/artifact-type-definition.h"
81 #include "system/baseitem-info.h"
82 #include "system/dungeon-info.h"
83 #include "system/floor-type-definition.h"
84 #include "system/grid-type-definition.h"
85 #include "system/item-entity.h"
86 #include "system/monster-entity.h"
87 #include "system/player-type-definition.h"
88 #include "system/redrawing-flags-updater.h"
89 #include "system/terrain-type-definition.h"
90 #include "target/grid-selector.h"
91 #include "term/screen-processor.h"
92 #include "term/z-form.h"
93 #include "util/angband-files.h"
94 #include "util/bit-flags-calculator.h"
95 #include "util/candidate-selector.h"
96 #include "util/enum-converter.h"
97 #include "util/finalizer.h"
98 #include "util/int-char-converter.h"
99 #include "view/display-messages.h"
100 #include "wizard/spoiler-table.h"
101 #include "wizard/tval-descriptions-table.h"
102 #include "wizard/wizard-messages.h"
103 #include "wizard/wizard-spells.h"
104 #include "wizard/wizard-spoiler.h"
105 #include "world/world.h"
117 * @brief プレイヤーを完全回復する
119 void wiz_cure_all(PlayerType *player_ptr)
121 (void)life_stream(player_ptr, false, false);
122 (void)restore_mana(player_ptr, true);
123 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
124 BadStatusSetter bss(player_ptr);
125 (void)bss.set_fear(0);
126 (void)bss.set_deceleration(0, false);
127 msg_print("You're fully cured by wizard command.");
130 static std::optional<short> wiz_select_tval()
133 for (list = 0; (list < 80) && (tvals[list].tval > ItemKindType::NONE); list++) {
134 auto row = 2 + (list % 20);
135 auto col = _(32, 24) * (list / 20);
136 prt(format("[%c] %s", listsym[list], tvals[list].desc), row, col);
139 const auto item_type_opt = input_command(_("アイテム種別を選んで下さい", "Get what type of object? "));
140 if (!item_type_opt.has_value()) {
144 const auto item_type = item_type_opt.value();
147 for (selection = 0; selection < max_num; selection++) {
148 if (listsym[selection] == item_type) {
153 if ((selection < 0) || (selection >= max_num)) {
160 static short wiz_select_sval(const ItemKindType tval, std::string_view tval_description)
164 for (const auto &baseitem : baseitems_info) {
169 if ((baseitem.idx == 0) || baseitem.bi_key.tval() != tval) {
173 auto row = 2 + (num % 20);
174 auto col = _(30, 32) * (num / 20);
175 const auto buf = strip_name(baseitem.idx);
176 prt(format("[%c] %s", listsym[num], buf.data()), row, col);
177 choice[num++] = baseitem.idx;
181 const auto prompt = format(_("%s群の具体的なアイテムを選んで下さい", "What Kind of %s? "), tval_description.data());
182 const auto command = input_command(prompt);
183 if (!command.has_value()) {
187 const auto ch = command.value();
189 for (selection = 0; selection < max_num; selection++) {
190 if (listsym[selection] == ch) {
195 if ((selection < 0) || (selection >= max_num)) {
199 return choice[selection];
203 * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
204 * Specify tval and sval (type and subtype of object) originally
207 * by RAK, heavily modified by -Bernd-
208 * This function returns the bi_id of an object type, or zero if failed
209 * List up to 50 choices in three columns
211 static short wiz_create_itemtype()
214 auto selection = wiz_select_tval();
215 if (!selection.has_value()) {
219 auto tval = tvals[selection.value()].tval;
220 auto tval_description = tvals[selection.value()].desc;
222 return wiz_select_sval(tval, tval_description);
226 * @brief 任意のベースアイテム生成のメインルーチン /
227 * Wizard routine for creating objects -RAK-
229 * Heavily modified to allow magification and artifactification -Bernd-
231 * Note that wizards cannot create objects on top of other objects.
233 * Hack -- this routine always makes a "dungeon object", and applies
234 * magic to it, and attempts to decline cursed items.
236 void wiz_create_item(PlayerType *player_ptr)
239 const auto bi_id = wiz_create_itemtype();
245 const auto &baseitem = baseitems_info[bi_id];
246 if (baseitem.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
247 for (const auto &[a_idx, artifact] : artifacts_info) {
248 if ((a_idx == FixedArtifactId::NONE) || (artifact.bi_key != baseitem.bi_key)) {
252 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
253 msg_print("Allocated(INSTA_ART).");
260 ItemMagicApplier(player_ptr, &item, player_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART).execute();
261 (void)drop_near(player_ptr, &item, -1, player_ptr->y, player_ptr->x);
262 msg_print("Allocated.");
266 * @brief 指定したIDの固定アーティファクトの名称を取得する
268 * @param a_idx 固定アーティファクトのID
269 * @return 固定アーティファクトの名称(Ex. ★ロング・ソード『リンギル』)を保持する std::string オブジェクト
271 static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
273 const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
275 item.prep(lookup_baseitem_id(artifact.bi_key));
276 item.fixed_artifact_idx = a_idx;
278 return describe_flavor(player_ptr, &item, OD_NAME_ONLY);
282 * @brief 固定アーティファクトをリストから選択する
284 * @param a_idx_list 選択する候補となる固定アーティファクトのIDのリスト
285 * @return 選択した固定アーティファクトのIDを返す。但しキャンセルした場合は std::nullopt を返す。
287 static std::optional<FixedArtifactId> wiz_select_named_artifact(PlayerType *player_ptr, const std::vector<FixedArtifactId> &a_idx_list)
289 CandidateSelector cs("Which artifact: ", 15);
291 auto describe_artifact = [player_ptr](FixedArtifactId a_idx) { return wiz_make_named_artifact_desc(player_ptr, a_idx); };
292 const auto it = cs.select(a_idx_list, describe_artifact);
293 return (it != a_idx_list.end()) ? std::make_optional(*it) : std::nullopt;
297 * @brief 指定したカテゴリの固定アーティファクトのIDのリストを得る
299 * @param group_artifact 固定アーティファクトのカテゴリ
300 * @return 該当のカテゴリの固定アーティファクトのIDのリスト
302 static std::vector<FixedArtifactId> wiz_collect_group_a_idx(const grouper &group_artifact)
304 const auto &[tval_list, name] = group_artifact;
305 std::vector<FixedArtifactId> a_idx_list;
306 for (auto tval : tval_list) {
307 for (const auto &[a_idx, artifact] : artifacts_info) {
308 if (artifact.bi_key.tval() == tval) {
309 a_idx_list.push_back(a_idx);
318 * @brief 固定アーティファクトを生成する / Create the artifact
320 void wiz_create_named_art(PlayerType *player_ptr)
323 for (auto i = 0U; i < group_artifact_list.size(); ++i) {
324 const auto &[tval_lit, name] = group_artifact_list[i];
325 std::stringstream ss;
326 ss << I2A(i) << ") " << name;
327 term_erase(14, i + 1);
328 put_str(ss.str(), i + 1, 15);
331 std::optional<FixedArtifactId> create_a_idx;
332 while (!create_a_idx) {
333 const auto command = input_command("Kind of artifact: ");
339 const auto idx = A2I(*command);
340 if (idx >= group_artifact_list.size()) {
344 const auto a_idx_list = wiz_collect_group_a_idx(group_artifact_list[idx]);
345 create_a_idx = wiz_select_named_artifact(player_ptr, a_idx_list);
349 const auto a_idx = create_a_idx.value();
350 const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
351 if (artifact.is_generated) {
352 msg_print("It's already allocated.");
356 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
357 msg_print("Allocated.");
360 static void wiz_change_status_max(PlayerType *player_ptr)
362 for (auto i = 0; i < A_MAX; ++i) {
363 player_ptr->stat_cur[i] = player_ptr->stat_max_max[i];
364 player_ptr->stat_max[i] = player_ptr->stat_max_max[i];
367 for (auto tval : TV_WEAPON_RANGE) {
368 for (auto &exp : player_ptr->weapon_exp[tval]) {
369 exp = PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER);
372 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
374 for (auto &[type, exp] : player_ptr->skill_exp) {
375 exp = class_skills_info[enum2i(player_ptr->pclass)].s_max[type];
378 const std::span spells_exp_span(player_ptr->spell_exp);
379 for (auto &exp : spells_exp_span.first(32)) {
380 exp = PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER);
382 for (auto &exp : spells_exp_span.last(32)) {
383 exp = PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT);
386 player_ptr->au = 999999999;
388 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
392 player_ptr->max_exp = 99999999;
393 player_ptr->exp = 99999999;
394 player_ptr->exp_frac = 0;
398 * @brief プレイヤーの現能力値を調整する / Change various "permanent" player variables.
399 * @param player_ptr プレイヤーへの参照ポインタ
401 void wiz_change_status(PlayerType *player_ptr)
403 const auto finalizer = util::make_finalizer([player_ptr]() {
404 check_experience(player_ptr);
405 do_cmd_redraw(player_ptr);
408 constexpr auto msg = _("全てのステータスを最大にしますか?", "Maximize all statuses? ");
409 if (input_check_strict(player_ptr, msg, { UserCheck::NO_ESCAPE, UserCheck::NO_HISTORY })) {
410 wiz_change_status_max(player_ptr);
414 for (int i = 0; i < A_MAX; i++) {
415 const auto max_max_ability_score = player_ptr->stat_max_max[i];
416 const auto max_ability_score = player_ptr->stat_max[i];
417 const auto new_ability_score = input_numerics(stat_names[i], 3, max_max_ability_score, max_ability_score);
418 if (!new_ability_score.has_value()) {
422 auto stat = new_ability_score.value();
423 player_ptr->stat_cur[i] = stat;
424 player_ptr->stat_max[i] = stat;
427 const auto unskilled = PlayerSkill::weapon_exp_at(PlayerSkillRank::UNSKILLED);
428 const auto master = PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER);
429 const auto proficiency_opt = input_numerics(_("熟練度", "Proficiency"), unskilled, master, static_cast<short>(master));
430 if (!proficiency_opt.has_value()) {
434 const auto proficiency = proficiency_opt.value();
435 for (auto tval : TV_WEAPON_RANGE) {
436 for (int i = 0; i < 64; i++) {
437 player_ptr->weapon_exp[tval][i] = proficiency;
441 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
442 for (auto j : PLAYER_SKILL_KIND_TYPE_RANGE) {
443 player_ptr->skill_exp[j] = proficiency;
444 auto short_pclass = enum2i(player_ptr->pclass);
445 if (player_ptr->skill_exp[j] > class_skills_info[short_pclass].s_max[j]) {
446 player_ptr->skill_exp[j] = class_skills_info[short_pclass].s_max[j];
451 for (k = 0; k < 32; k++) {
452 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER), proficiency);
455 for (; k < 64; k++) {
456 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT), proficiency);
459 const auto gold = input_numerics("Gold: ", 0, MAX_INT, player_ptr->au);
460 if (!gold.has_value()) {
464 player_ptr->au = gold.value();
465 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
469 const auto experience_opt = input_numerics("Experience: ", 0, MAX_INT, player_ptr->max_exp);
470 if (!experience_opt.has_value()) {
474 const auto experience = experience_opt.value();
475 player_ptr->max_exp = experience;
476 player_ptr->exp = experience;
477 player_ptr->exp_frac = 0;
481 * @brief 指定された地点の地形IDを変更する /
482 * Create desired feature
483 * @param creaturer_ptr プレイヤーへの参照ポインタ
485 void wiz_create_feature(PlayerType *player_ptr)
488 if (!tgt_pt(player_ptr, &x, &y)) {
492 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
493 const int max = terrains_info.size() - 1;
494 const auto f_val1 = input_numerics(_("実地形ID", "FeatureID"), 0, max, g_ptr->feat);
495 if (!f_val1.has_value()) {
499 const auto f_val2 = input_numerics(_("偽装地形ID", "FeatureID"), 0, max, f_val1.value());
500 if (!f_val2.has_value()) {
504 cave_set_feat(player_ptr, y, x, f_val1.value());
505 g_ptr->mimic = f_val2.value();
506 auto *f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
507 if (f_ptr->flags.has(TerrainCharacteristics::RUNE_PROTECTION) || f_ptr->flags.has(TerrainCharacteristics::RUNE_EXPLOSION)) {
508 g_ptr->info |= CAVE_OBJECT;
509 } else if (f_ptr->flags.has(TerrainCharacteristics::MIRROR)) {
510 g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
513 note_spot(player_ptr, y, x);
514 lite_spot(player_ptr, y, x);
515 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::FLOW);
519 * @brief デバッグ帰還のダンジョンを選ぶ
520 * @param player_ptr プレイヤーへの参照ポインタ
521 * @details 範囲外の値が選択されたら再入力を促す
523 static std::optional<short> select_debugging_dungeon(short initial_dungeon_id)
525 if (command_arg > 0) {
526 return static_cast<short>(std::clamp(static_cast<int>(command_arg), DUNGEON_ANGBAND, DUNGEON_DARKNESS));
530 const auto dungeon_id = input_numerics("Jump which dungeon", DUNGEON_ANGBAND, DUNGEON_DARKNESS, initial_dungeon_id);
531 if (!dungeon_id.has_value()) {
535 return dungeon_id.value();
540 * @brief 選択したダンジョンの任意レベルを選択する
541 * @param player_ptr プレイヤーへの参照ポインタ
542 * @param dungeon_id ダンジョン番号
543 * @return レベルを選択したらその値、キャンセルならnullopt
545 static std::optional<int> select_debugging_floor(const FloorType &floor, int dungeon_id)
547 const auto &dungeon = dungeons_info[dungeon_id];
548 const auto max_depth = dungeon.maxdepth;
549 const auto min_depth = dungeon.mindepth;
550 const auto is_current_dungeon = floor.dungeon_idx == dungeon_id;
551 auto initial_depth = floor.dun_level;
552 if (!is_current_dungeon) {
553 initial_depth = min_depth;
556 return input_numerics("Jump to level", min_depth, max_depth, initial_depth);
560 * @brief 任意のダンジョン及び階層に飛ぶ
563 static void wiz_jump_floor(PlayerType *player_ptr, DUNGEON_IDX dun_idx, DEPTH depth)
565 auto &floor = *player_ptr->current_floor_ptr;
566 floor.set_dungeon_index(dun_idx);
567 floor.dun_level = depth;
568 prepare_change_floor_mode(player_ptr, CFM_RAND_PLACE);
569 if (!floor.is_in_dungeon()) {
570 floor.reset_dungeon_index();
573 floor.inside_arena = false;
574 player_ptr->wild_mode = false;
575 leave_quest_check(player_ptr);
576 auto to = !floor.is_in_dungeon()
577 ? _("地上", "the surface")
578 : format(_("%d階(%s)", "level %d of %s"), floor.dun_level, floor.get_dungeon_definition().name.data());
579 constexpr auto mes = _("%sへとウィザード・テレポートで移動した。\n", "You wizard-teleported to %s.\n");
580 msg_print_wizard(player_ptr, 2, format(mes, to.data()));
581 floor.quest_number = QuestId::NONE;
582 PlayerEnergy(player_ptr).reset_player_turn();
583 player_ptr->energy_need = 0;
584 prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR);
585 player_ptr->leaving = true;
589 * @brief 任意のダンジョン及び階層に飛ぶtための選択処理
592 void wiz_jump_to_dungeon(PlayerType *player_ptr)
594 const auto &floor = *player_ptr->current_floor_ptr;
595 const auto is_in_dungeon = floor.is_in_dungeon();
596 const auto dungeon_idx = is_in_dungeon ? floor.dungeon_idx : static_cast<short>(DUNGEON_ANGBAND);
597 const auto dungeon_id_opt = select_debugging_dungeon(dungeon_idx);
598 if (!dungeon_id_opt.has_value()) {
599 if (!is_in_dungeon) {
603 if (input_check(("Jump to the ground?"))) {
604 wiz_jump_floor(player_ptr, 0, 0);
610 const auto dungeon_id = dungeon_id_opt.value();
611 const auto level_opt = select_debugging_floor(floor, dungeon_id);
612 if (!level_opt.has_value()) {
616 const auto level = level_opt.value();
617 msg_format("You jump to dungeon level %d.", level);
619 do_cmd_save_game(player_ptr, true);
622 wiz_jump_floor(player_ptr, dungeon_id, level);
626 * @brief 全ベースアイテムを鑑定済みにする
627 * @param player_ptr プレイヤーへの参照ポインタ
629 void wiz_learn_items_all(PlayerType *player_ptr)
633 for (const auto &baseitem : baseitems_info) {
634 if (baseitem.idx > 0 && baseitem.level <= command_arg) {
636 q_ptr->prep(baseitem.idx);
637 object_aware(player_ptr, q_ptr);
642 static void change_birth_flags()
644 auto &rfu = RedrawingFlagsUpdater::get_instance();
645 static constexpr auto flags_srf = {
646 StatusRecalculatingFlag::BONUS,
647 StatusRecalculatingFlag::HP,
648 StatusRecalculatingFlag::MP,
649 StatusRecalculatingFlag::SPELLS,
651 rfu.set_flag(SubWindowRedrawingFlag::PLAYER);
652 rfu.set_flags(flags_srf);
653 static constexpr auto flags_mwrf = {
654 MainWindowRedrawingFlag::BASIC,
655 MainWindowRedrawingFlag::HP,
656 MainWindowRedrawingFlag::MP,
657 MainWindowRedrawingFlag::ABILITY_SCORE,
659 rfu.set_flags(flags_mwrf);
663 * @brief プレイヤーの種族を変更する
665 void wiz_reset_race(PlayerType *player_ptr)
667 const auto new_race = input_numerics("RaceID", 0, MAX_RACES - 1, player_ptr->prace);
668 if (!new_race.has_value()) {
672 player_ptr->prace = new_race.value();
673 rp_ptr = &race_info[enum2i(player_ptr->prace)];
674 change_birth_flags();
675 handle_stuff(player_ptr);
679 * @brief プレイヤーの職業を変更する
680 * @todo 魔法領域の再選択などがまだ不完全、要実装。
682 void wiz_reset_class(PlayerType *player_ptr)
684 const auto new_class_opt = input_numerics("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, player_ptr->pclass);
685 if (!new_class_opt.has_value()) {
689 const auto new_class_enum = new_class_opt.value();
690 const auto new_class = enum2i(new_class_enum);
691 player_ptr->pclass = new_class_enum;
692 cp_ptr = &class_info[new_class];
693 mp_ptr = &class_magics_info[new_class];
694 PlayerClass(player_ptr).init_specific_data();
695 change_birth_flags();
696 handle_stuff(player_ptr);
700 * @brief プレイヤーの領域を変更する
701 * @todo 存在有無などは未判定。そのうちすべき。
703 void wiz_reset_realms(PlayerType *player_ptr)
705 const auto new_realm1 = input_numerics("1st Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm1);
706 if (!new_realm1.has_value()) {
710 const auto new_realm2 = input_numerics("2nd Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm2);
711 if (!new_realm2.has_value()) {
715 player_ptr->realm1 = new_realm1.value();
716 player_ptr->realm2 = new_realm2.value();
717 change_birth_flags();
718 handle_stuff(player_ptr);
722 * @brief 現在のオプション設定をダンプ出力する /
723 * @param player_ptr プレイヤーへの参照ポインタ
724 * Hack -- Dump option bits usage
726 void wiz_dump_options(void)
728 const auto &path = path_build(ANGBAND_DIR_USER, "opt_info.txt");
729 const auto &filename = path.string();
730 auto *fff = angband_fopen(path, FileOpenMode::APPEND);
731 if (fff == nullptr) {
732 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename.data());
737 std::vector<std::vector<int>> exist(NUM_O_SET, std::vector<int>(NUM_O_BIT));
739 for (int i = 0; option_info[i].o_desc; i++) {
740 const option_type *ot_ptr = &option_info[i];
742 exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
746 fprintf(fff, "[Option bits usage on %s\n]", get_version().data());
747 fputs("Set - Bit (Page) Option Name\n", fff);
748 fputs("------------------------------------------------\n", fff);
749 for (int i = 0; i < NUM_O_SET; i++) {
750 for (int j = 0; j < NUM_O_BIT; j++) {
752 const option_type *ot_ptr = &option_info[exist[i][j] - 1];
753 fprintf(fff, " %d - %02d (%4d) %s\n", i, j, ot_ptr->o_page, ot_ptr->o_text);
755 fprintf(fff, " %d - %02d\n", i, j);
763 msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), filename.data());
767 * @brief プレイ日数を変更する / Set gametime.
768 * @return 実際に変更を行ったらTRUEを返す
770 void set_gametime(void)
772 const auto game_time = input_integer("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1);
773 if (!game_time.has_value()) {
777 w_ptr->dungeon_turn = w_ptr->game_turn = game_time.value();
781 * @brief プレイヤー近辺の全モンスターを消去する / Delete all nearby monsters
783 void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
785 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
786 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
787 if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_PLAYER_SIGHT)) {
791 if (record_named_pet && m_ptr->is_named_pet()) {
792 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
793 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
796 delete_monster_idx(player_ptr, i);
801 * @brief フロアに存在する全モンスターを消去する / Delete all monsters
802 * @param player_ptr 術者の参照ポインタ
804 void wiz_zap_floor_monsters(PlayerType *player_ptr)
806 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
807 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
808 if (!m_ptr->is_valid() || (i == player_ptr->riding)) {
812 if (record_named_pet && m_ptr->is_named_pet()) {
813 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
814 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
817 delete_monster_idx(player_ptr, i);
821 void cheat_death(PlayerType *player_ptr)
823 if (player_ptr->sc) {
824 player_ptr->sc = player_ptr->age = 0;
828 w_ptr->noscore |= 0x0001;
829 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
832 player_ptr->is_dead = false;
833 (void)life_stream(player_ptr, false, false);
834 (void)restore_mana(player_ptr, true);
835 (void)recall_player(player_ptr, 0);
836 reserve_alter_reality(player_ptr, 0);
838 player_ptr->died_from = _("死の欺き", "Cheating death");
839 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
841 auto *floor_ptr = player_ptr->current_floor_ptr;
842 floor_ptr->dun_level = 0;
843 floor_ptr->inside_arena = false;
844 player_ptr->phase_out = false;
845 leaving_quest = QuestId::NONE;
846 floor_ptr->quest_number = QuestId::NONE;
847 if (floor_ptr->dungeon_idx) {
848 player_ptr->recall_dungeon = floor_ptr->dungeon_idx;
851 floor_ptr->reset_dungeon_index();
852 if (lite_town || vanilla_town) {
853 player_ptr->wilderness_y = 1;
854 player_ptr->wilderness_x = 1;
856 player_ptr->oldpy = 10;
857 player_ptr->oldpx = 34;
859 player_ptr->oldpy = 33;
860 player_ptr->oldpx = 131;
863 player_ptr->wilderness_y = 48;
864 player_ptr->wilderness_x = 5;
865 player_ptr->oldpy = 33;
866 player_ptr->oldpx = 131;
869 player_ptr->wild_mode = false;
870 player_ptr->leaving = true;
871 constexpr auto note = _(" しかし、生き返った。", " but revived.");
872 exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, note);
873 leave_floor(player_ptr);