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/enum-converter.h"
96 #include "util/finalizer.h"
97 #include "util/int-char-converter.h"
98 #include "view/display-messages.h"
99 #include "wizard/spoiler-table.h"
100 #include "wizard/tval-descriptions-table.h"
101 #include "wizard/wizard-messages.h"
102 #include "wizard/wizard-spells.h"
103 #include "wizard/wizard-spoiler.h"
104 #include "world/world.h"
116 * @brief プレイヤーを完全回復する
118 void wiz_cure_all(PlayerType *player_ptr)
120 (void)life_stream(player_ptr, false, false);
121 (void)restore_mana(player_ptr, true);
122 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
123 BadStatusSetter bss(player_ptr);
124 (void)bss.set_fear(0);
125 (void)bss.set_deceleration(0, false);
126 msg_print("You're fully cured by wizard command.");
129 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);
137 prt(format("[%c] %s", ch, tvals[list].desc), row, col);
141 if (!input_command(_("アイテム種別を選んで下さい", "Get what type of object? "), &ch, false)) {
146 for (selection = 0; selection < max_num; selection++) {
147 if (listsym[selection] == ch) {
152 if ((selection < 0) || (selection >= max_num)) {
159 static short wiz_select_sval(const ItemKindType tval, concptr 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);
176 const auto buf = strip_name(baseitem.idx);
177 prt(format("[%c] %s", ch, buf.data()), row, col);
178 choice[num++] = baseitem.idx;
182 if (!input_command(format(_("%s群の具体的なアイテムを選んで下さい", "What Kind of %s? "), tval_description), &ch, false)) {
187 for (selection = 0; selection < max_num; selection++) {
188 if (listsym[selection] == ch) {
193 if ((selection < 0) || (selection >= max_num)) {
197 return choice[selection];
201 * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
202 * Specify tval and sval (type and subtype of object) originally
205 * by RAK, heavily modified by -Bernd-
206 * This function returns the bi_id of an object type, or zero if failed
207 * List up to 50 choices in three columns
209 static short wiz_create_itemtype()
212 auto selection = wiz_select_tval();
213 if (!selection.has_value()) {
217 auto tval = tvals[selection.value()].tval;
218 auto tval_description = tvals[selection.value()].desc;
220 return wiz_select_sval(tval, tval_description);
224 * @brief 任意のベースアイテム生成のメインルーチン /
225 * Wizard routine for creating objects -RAK-
227 * Heavily modified to allow magification and artifactification -Bernd-
229 * Note that wizards cannot create objects on top of other objects.
231 * Hack -- this routine always makes a "dungeon object", and applies
232 * magic to it, and attempts to decline cursed items.
234 void wiz_create_item(PlayerType *player_ptr)
237 const auto bi_id = wiz_create_itemtype();
243 const auto &baseitem = baseitems_info[bi_id];
244 if (baseitem.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
245 for (const auto &[a_idx, artifact] : artifacts_info) {
246 if ((a_idx == FixedArtifactId::NONE) || (artifact.bi_key != baseitem.bi_key)) {
250 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
251 msg_print("Allocated(INSTA_ART).");
258 ItemMagicApplier(player_ptr, &item, player_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART).execute();
259 (void)drop_near(player_ptr, &item, -1, player_ptr->y, player_ptr->x);
260 msg_print("Allocated.");
264 * @brief 指定したIDの固定アーティファクトの名称を取得する
266 * @param a_idx 固定アーティファクトのID
267 * @return 固定アーティファクトの名称(Ex. ★ロング・ソード『リンギル』)を保持する std::string オブジェクト
269 static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
271 const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
273 item.prep(lookup_baseitem_id(artifact.bi_key));
274 item.fixed_artifact_idx = a_idx;
276 return describe_flavor(player_ptr, &item, OD_NAME_ONLY);
280 * @brief 固定アーティファクトをリストから選択する
282 * @param a_idx_list 選択する候補となる固定アーティファクトのIDのリスト
283 * @return 選択した固定アーティファクトのIDを返す。但しキャンセルした場合は std::nullopt を返す。
285 static std::optional<FixedArtifactId> wiz_select_named_artifact(PlayerType *player_ptr, const std::vector<FixedArtifactId> &a_idx_list)
287 constexpr auto MAX_PER_PAGE = 20UL;
288 const auto page_max = (a_idx_list.size() - 1) / MAX_PER_PAGE + 1;
289 auto current_page = 0UL;
293 std::optional<FixedArtifactId> selected_a_idx;
295 while (!selected_a_idx.has_value()) {
296 const auto page_base_idx = current_page * MAX_PER_PAGE;
297 for (auto i = 0U; i < MAX_PER_PAGE + 1; ++i) {
298 term_erase(14, i + 1, 255);
300 const auto page_item_count = std::min(MAX_PER_PAGE, a_idx_list.size() - page_base_idx);
301 for (auto i = 0U; i < page_item_count; ++i) {
302 std::stringstream ss;
303 ss << I2A(i) << ") " << wiz_make_named_artifact_desc(player_ptr, a_idx_list[page_base_idx + i]);
304 put_str(ss.str(), i + 1, 15);
307 put_str(format("-- more (%lu/%lu) --", current_page + 1, page_max), page_item_count + 1, 15);
311 input_command("Which artifact: ", &cmd, false);
315 return selected_a_idx;
318 if (current_page >= page_max) {
323 const auto select_idx = A2I(cmd) + page_base_idx;
324 if (select_idx < a_idx_list.size()) {
325 selected_a_idx = a_idx_list[select_idx];
333 return selected_a_idx;
337 * @brief 指定したカテゴリの固定アーティファクトのIDのリストを得る
339 * @param group_artifact 固定アーティファクトのカテゴリ
340 * @return 該当のカテゴリの固定アーティファクトのIDのリスト
342 static std::vector<FixedArtifactId> wiz_collect_group_a_idx(const grouper &group_artifact)
344 const auto &[tval_list, name] = group_artifact;
345 std::vector<FixedArtifactId> a_idx_list;
346 for (auto tval : tval_list) {
347 for (const auto &[a_idx, artifact] : artifacts_info) {
348 if (artifact.bi_key.tval() == tval) {
349 a_idx_list.push_back(a_idx);
358 * @brief 固定アーティファクトを生成する / Create the artifact
360 void wiz_create_named_art(PlayerType *player_ptr)
363 for (auto i = 0U; i < group_artifact_list.size(); ++i) {
364 const auto &[tval_lit, name] = group_artifact_list[i];
365 std::stringstream ss;
366 ss << I2A(i) << ") " << name;
367 term_erase(14, i + 1, 255);
368 put_str(ss.str(), i + 1, 15);
371 std::optional<FixedArtifactId> create_a_idx;
372 while (!create_a_idx.has_value()) {
374 input_command("Kind of artifact: ", &cmd, false);
380 if (auto idx = A2I(cmd); idx < group_artifact_list.size()) {
381 const auto &a_idx_list = wiz_collect_group_a_idx(group_artifact_list[idx]);
382 create_a_idx = wiz_select_named_artifact(player_ptr, a_idx_list);
390 const auto a_idx = create_a_idx.value();
391 const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
392 if (artifact.is_generated) {
393 msg_print("It's already allocated.");
397 (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
398 msg_print("Allocated.");
401 static void wiz_change_status_max(PlayerType *player_ptr)
403 for (auto i = 0; i < A_MAX; ++i) {
404 player_ptr->stat_cur[i] = player_ptr->stat_max_max[i];
405 player_ptr->stat_max[i] = player_ptr->stat_max_max[i];
408 for (auto tval : TV_WEAPON_RANGE) {
409 for (auto &exp : player_ptr->weapon_exp[tval]) {
410 exp = PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER);
413 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
415 for (auto &[type, exp] : player_ptr->skill_exp) {
416 exp = class_skills_info[enum2i(player_ptr->pclass)].s_max[type];
419 const std::span spells_exp_span(player_ptr->spell_exp);
420 for (auto &exp : spells_exp_span.first(32)) {
421 exp = PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER);
423 for (auto &exp : spells_exp_span.last(32)) {
424 exp = PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT);
427 player_ptr->au = 999999999;
429 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
433 player_ptr->max_exp = 99999999;
434 player_ptr->exp = 99999999;
435 player_ptr->exp_frac = 0;
439 * @brief プレイヤーの現能力値を調整する / Change various "permanent" player variables.
440 * @param player_ptr プレイヤーへの参照ポインタ
442 void wiz_change_status(PlayerType *player_ptr)
444 const auto finalizer = util::make_finalizer([player_ptr]() {
445 check_experience(player_ptr);
446 do_cmd_redraw(player_ptr);
449 constexpr auto msg = _("全てのステータスを最大にしますか?", "Maximize all statuses? ");
450 if (get_check_strict(player_ptr, msg, (CHECK_NO_ESCAPE | CHECK_NO_HISTORY))) {
451 wiz_change_status_max(player_ptr);
455 for (int i = 0; i < A_MAX; i++) {
456 const auto max_max_ability_score = player_ptr->stat_max_max[i];
457 const auto max_ability_score = player_ptr->stat_max[i];
458 const auto new_ability_score = input_numerics(stat_names[i], 3, max_max_ability_score, max_ability_score);
459 if (!new_ability_score.has_value()) {
463 auto stat = new_ability_score.value();
464 player_ptr->stat_cur[i] = stat;
465 player_ptr->stat_max[i] = stat;
468 const auto unskilled = PlayerSkill::weapon_exp_at(PlayerSkillRank::UNSKILLED);
469 const auto master = PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER);
470 const auto proficiency_opt = input_numerics(_("熟練度", "Proficiency"), unskilled, master, static_cast<short>(master));
471 if (!proficiency_opt.has_value()) {
475 const auto proficiency = proficiency_opt.value();
476 for (auto tval : TV_WEAPON_RANGE) {
477 for (int i = 0; i < 64; i++) {
478 player_ptr->weapon_exp[tval][i] = proficiency;
482 PlayerSkill(player_ptr).limit_weapon_skills_by_max_value();
483 for (auto j : PLAYER_SKILL_KIND_TYPE_RANGE) {
484 player_ptr->skill_exp[j] = proficiency;
485 auto short_pclass = enum2i(player_ptr->pclass);
486 if (player_ptr->skill_exp[j] > class_skills_info[short_pclass].s_max[j]) {
487 player_ptr->skill_exp[j] = class_skills_info[short_pclass].s_max[j];
492 for (k = 0; k < 32; k++) {
493 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER), proficiency);
496 for (; k < 64; k++) {
497 player_ptr->spell_exp[k] = std::min(PlayerSkill::spell_exp_at(PlayerSkillRank::EXPERT), proficiency);
500 const auto gold = input_numerics("Gold: ", 0, MAX_INT, player_ptr->au);
501 if (!gold.has_value()) {
505 player_ptr->au = gold.value();
506 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
510 const auto experience_opt = input_numerics("Experience: ", 0, MAX_INT, player_ptr->max_exp);
511 if (!experience_opt.has_value()) {
515 const auto experience = experience_opt.value();
516 player_ptr->max_exp = experience;
517 player_ptr->exp = experience;
518 player_ptr->exp_frac = 0;
522 * @brief 指定された地点の地形IDを変更する /
523 * Create desired feature
524 * @param creaturer_ptr プレイヤーへの参照ポインタ
526 void wiz_create_feature(PlayerType *player_ptr)
529 if (!tgt_pt(player_ptr, &x, &y)) {
533 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
534 const int max = terrains_info.size() - 1;
535 const auto f_val1 = input_numerics(_("実地形ID", "FeatureID"), 0, max, g_ptr->feat);
536 if (!f_val1.has_value()) {
540 const auto f_val2 = input_numerics(_("偽装地形ID", "FeatureID"), 0, max, f_val1.value());
541 if (!f_val2.has_value()) {
545 cave_set_feat(player_ptr, y, x, f_val1.value());
546 g_ptr->mimic = f_val2.value();
547 auto *f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
548 if (f_ptr->flags.has(TerrainCharacteristics::RUNE_PROTECTION) || f_ptr->flags.has(TerrainCharacteristics::RUNE_EXPLOSION)) {
549 g_ptr->info |= CAVE_OBJECT;
550 } else if (f_ptr->flags.has(TerrainCharacteristics::MIRROR)) {
551 g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
554 note_spot(player_ptr, y, x);
555 lite_spot(player_ptr, y, x);
556 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::FLOW);
560 * @brief デバッグ帰還のダンジョンを選ぶ
561 * @param player_ptr プレイヤーへの参照ポインタ
562 * @details 範囲外の値が選択されたら再入力を促す
564 static std::optional<short> select_debugging_dungeon(short initial_dungeon_id)
566 if (command_arg > 0) {
567 return static_cast<short>(std::clamp(static_cast<int>(command_arg), DUNGEON_ANGBAND, DUNGEON_DARKNESS));
571 const auto dungeon_id = input_numerics("Jump which dungeon", DUNGEON_ANGBAND, DUNGEON_DARKNESS, initial_dungeon_id);
572 if (!dungeon_id.has_value()) {
576 return dungeon_id.value();
581 * @brief 選択したダンジョンの任意レベルを選択する
582 * @param player_ptr プレイヤーへの参照ポインタ
583 * @param dungeon_id ダンジョン番号
584 * @return レベルを選択したらその値、キャンセルならnullopt
586 static std::optional<int> select_debugging_floor(const FloorType &floor, int dungeon_id)
588 const auto &dungeon = dungeons_info[dungeon_id];
589 const auto max_depth = dungeon.maxdepth;
590 const auto min_depth = dungeon.mindepth;
591 const auto is_current_dungeon = floor.dungeon_idx == dungeon_id;
592 auto initial_depth = floor.dun_level;
593 if (!is_current_dungeon) {
594 initial_depth = min_depth;
597 return input_numerics("Jump to level", min_depth, max_depth, initial_depth);
601 * @brief 任意のダンジョン及び階層に飛ぶ
604 static void wiz_jump_floor(PlayerType *player_ptr, DUNGEON_IDX dun_idx, DEPTH depth)
606 auto &floor = *player_ptr->current_floor_ptr;
607 floor.set_dungeon_index(dun_idx);
608 floor.dun_level = depth;
609 prepare_change_floor_mode(player_ptr, CFM_RAND_PLACE);
610 if (!floor.is_in_dungeon()) {
611 floor.reset_dungeon_index();
614 floor.inside_arena = false;
615 player_ptr->wild_mode = false;
616 leave_quest_check(player_ptr);
617 auto to = !floor.is_in_dungeon()
618 ? _("地上", "the surface")
619 : format(_("%d階(%s)", "level %d of %s"), floor.dun_level, floor.get_dungeon_definition().name.data());
620 constexpr auto mes = _("%sへとウィザード・テレポートで移動した。\n", "You wizard-teleported to %s.\n");
621 msg_print_wizard(player_ptr, 2, format(mes, to.data()));
622 floor.quest_number = QuestId::NONE;
623 PlayerEnergy(player_ptr).reset_player_turn();
624 player_ptr->energy_need = 0;
625 prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR);
626 player_ptr->leaving = true;
630 * @brief 任意のダンジョン及び階層に飛ぶtための選択処理
633 void wiz_jump_to_dungeon(PlayerType *player_ptr)
635 const auto &floor = *player_ptr->current_floor_ptr;
636 const auto is_in_dungeon = floor.is_in_dungeon();
637 const auto dungeon_idx = is_in_dungeon ? floor.dungeon_idx : static_cast<short>(DUNGEON_ANGBAND);
638 const auto dungeon_id_opt = select_debugging_dungeon(dungeon_idx);
639 if (!dungeon_id_opt.has_value()) {
640 if (!is_in_dungeon) {
644 if (get_check(("Jump to the ground?"))) {
645 wiz_jump_floor(player_ptr, 0, 0);
651 const auto dungeon_id = dungeon_id_opt.value();
652 const auto level_opt = select_debugging_floor(floor, dungeon_id);
653 if (!level_opt.has_value()) {
657 const auto level = level_opt.value();
658 msg_format("You jump to dungeon level %d.", level);
660 do_cmd_save_game(player_ptr, true);
663 wiz_jump_floor(player_ptr, dungeon_id, level);
667 * @brief 全ベースアイテムを鑑定済みにする
668 * @param player_ptr プレイヤーへの参照ポインタ
670 void wiz_learn_items_all(PlayerType *player_ptr)
674 for (const auto &baseitem : baseitems_info) {
675 if (baseitem.idx > 0 && baseitem.level <= command_arg) {
677 q_ptr->prep(baseitem.idx);
678 object_aware(player_ptr, q_ptr);
683 static void change_birth_flags()
685 auto &rfu = RedrawingFlagsUpdater::get_instance();
686 static constexpr auto flags_srf = {
687 StatusRecalculatingFlag::BONUS,
688 StatusRecalculatingFlag::HP,
689 StatusRecalculatingFlag::MP,
690 StatusRecalculatingFlag::SPELLS,
692 rfu.set_flag(SubWindowRedrawingFlag::PLAYER);
693 rfu.set_flags(flags_srf);
694 static constexpr auto flags_mwrf = {
695 MainWindowRedrawingFlag::BASIC,
696 MainWindowRedrawingFlag::HP,
697 MainWindowRedrawingFlag::MP,
698 MainWindowRedrawingFlag::ABILITY_SCORE,
700 rfu.set_flags(flags_mwrf);
704 * @brief プレイヤーの種族を変更する
706 void wiz_reset_race(PlayerType *player_ptr)
708 const auto new_race = input_numerics("RaceID", 0, MAX_RACES - 1, player_ptr->prace);
709 if (!new_race.has_value()) {
713 player_ptr->prace = new_race.value();
714 rp_ptr = &race_info[enum2i(player_ptr->prace)];
715 change_birth_flags();
716 handle_stuff(player_ptr);
720 * @brief プレイヤーの職業を変更する
721 * @todo 魔法領域の再選択などがまだ不完全、要実装。
723 void wiz_reset_class(PlayerType *player_ptr)
725 const auto new_class_opt = input_numerics("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, player_ptr->pclass);
726 if (!new_class_opt.has_value()) {
730 const auto new_class_enum = new_class_opt.value();
731 const auto new_class = enum2i(new_class_enum);
732 player_ptr->pclass = new_class_enum;
733 cp_ptr = &class_info[new_class];
734 mp_ptr = &class_magics_info[new_class];
735 PlayerClass(player_ptr).init_specific_data();
736 change_birth_flags();
737 handle_stuff(player_ptr);
741 * @brief プレイヤーの領域を変更する
742 * @todo 存在有無などは未判定。そのうちすべき。
744 void wiz_reset_realms(PlayerType *player_ptr)
746 const auto new_realm1 = input_numerics("1st Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm1);
747 if (!new_realm1.has_value()) {
751 const auto new_realm2 = input_numerics("2nd Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm2);
752 if (!new_realm2.has_value()) {
756 player_ptr->realm1 = new_realm1.value();
757 player_ptr->realm2 = new_realm2.value();
758 change_birth_flags();
759 handle_stuff(player_ptr);
763 * @brief 現在のオプション設定をダンプ出力する /
764 * @param player_ptr プレイヤーへの参照ポインタ
765 * Hack -- Dump option bits usage
767 void wiz_dump_options(void)
769 const auto &path = path_build(ANGBAND_DIR_USER, "opt_info.txt");
770 const auto &filename = path.string();
771 auto *fff = angband_fopen(path, FileOpenMode::APPEND);
772 if (fff == nullptr) {
773 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename.data());
778 std::vector<std::vector<int>> exist(NUM_O_SET, std::vector<int>(NUM_O_BIT));
780 for (int i = 0; option_info[i].o_desc; i++) {
781 const option_type *ot_ptr = &option_info[i];
783 exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
787 fprintf(fff, "[Option bits usage on %s\n]", get_version().data());
788 fputs("Set - Bit (Page) Option Name\n", fff);
789 fputs("------------------------------------------------\n", fff);
790 for (int i = 0; i < NUM_O_SET; i++) {
791 for (int j = 0; j < NUM_O_BIT; j++) {
793 const option_type *ot_ptr = &option_info[exist[i][j] - 1];
794 fprintf(fff, " %d - %02d (%4d) %s\n", i, j, ot_ptr->o_page, ot_ptr->o_text);
796 fprintf(fff, " %d - %02d\n", i, j);
804 msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), filename.data());
808 * @brief プレイ日数を変更する / Set gametime.
809 * @return 実際に変更を行ったらTRUEを返す
811 void set_gametime(void)
813 const auto game_time = input_integer("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1);
814 if (!game_time.has_value()) {
818 w_ptr->dungeon_turn = w_ptr->game_turn = game_time.value();
822 * @brief プレイヤー近辺の全モンスターを消去する / Delete all nearby monsters
824 void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
826 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
827 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
828 if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_PLAYER_SIGHT)) {
832 if (record_named_pet && m_ptr->is_named_pet()) {
833 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
834 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
837 delete_monster_idx(player_ptr, i);
842 * @brief フロアに存在する全モンスターを消去する / Delete all monsters
843 * @param player_ptr 術者の参照ポインタ
845 void wiz_zap_floor_monsters(PlayerType *player_ptr)
847 for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
848 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
849 if (!m_ptr->is_valid() || (i == player_ptr->riding)) {
853 if (record_named_pet && m_ptr->is_named_pet()) {
854 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
855 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
858 delete_monster_idx(player_ptr, i);
862 void cheat_death(PlayerType *player_ptr)
864 if (player_ptr->sc) {
865 player_ptr->sc = player_ptr->age = 0;
869 w_ptr->noscore |= 0x0001;
870 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
873 player_ptr->is_dead = false;
874 (void)life_stream(player_ptr, false, false);
875 (void)restore_mana(player_ptr, true);
876 (void)recall_player(player_ptr, 0);
877 reserve_alter_reality(player_ptr, 0);
879 player_ptr->died_from = _("死の欺き", "Cheating death");
880 (void)set_food(player_ptr, PY_FOOD_MAX - 1);
882 auto *floor_ptr = player_ptr->current_floor_ptr;
883 floor_ptr->dun_level = 0;
884 floor_ptr->inside_arena = false;
885 player_ptr->phase_out = false;
886 leaving_quest = QuestId::NONE;
887 floor_ptr->quest_number = QuestId::NONE;
888 if (floor_ptr->dungeon_idx) {
889 player_ptr->recall_dungeon = floor_ptr->dungeon_idx;
892 floor_ptr->reset_dungeon_index();
893 if (lite_town || vanilla_town) {
894 player_ptr->wilderness_y = 1;
895 player_ptr->wilderness_x = 1;
897 player_ptr->oldpy = 10;
898 player_ptr->oldpx = 34;
900 player_ptr->oldpy = 33;
901 player_ptr->oldpx = 131;
904 player_ptr->wilderness_y = 48;
905 player_ptr->wilderness_x = 5;
906 player_ptr->oldpy = 33;
907 player_ptr->oldpx = 131;
910 player_ptr->wild_mode = false;
911 player_ptr->leaving = true;
912 constexpr auto note = _(" しかし、生き返った。", " but revived.");
913 exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, note);
914 leave_floor(player_ptr);