2 * @brief プレイヤーのコマンド処理2 / Movement commands (part 2)
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7 * This software may be copied and distributed for educational, research,
8 * and not for profit purposes provided that this copyright and statement
9 * are included in all such copies. Other copyrights may also apply.
12 #include "cmd/cmd-basic.h"
13 #include "action/action-limited.h"
14 #include "action/movement-execution.h"
15 #include "action/open-close-execution.h"
16 #include "action/tunnel-execution.h"
17 #include "action/open-util.h"
18 #include "art-definition/art-weapon-types.h"
19 #include "cmd-action/cmd-attack.h"
20 #include "cmd-io/cmd-dump.h"
21 #include "cmd-io/cmd-save.h"
22 #include "combat/attack-power-table.h"
23 #include "combat/shoot.h"
24 #include "combat/slaying.h"
25 #include "core/asking-player.h"
26 #include "core/output-updater.h"
27 #include "core/player-redraw-types.h"
28 #include "core/player-update-types.h"
29 #include "core/stuff-handler.h"
30 #include "core/window-redrawer.h"
31 #include "dungeon/dungeon.h"
32 #include "dungeon/quest.h"
33 #include "effect/spells-effect-util.h"
34 #include "flavor/flavor-describer.h"
35 #include "flavor/object-flavor-types.h"
36 #include "floor/floor-object.h"
37 #include "floor/geometry.h"
38 #include "floor/wild.h"
39 #include "game-option/birth-options.h"
40 #include "game-option/cheat-types.h"
41 #include "game-option/disturbance-options.h"
42 #include "game-option/game-play-options.h"
43 #include "game-option/input-options.h"
44 #include "game-option/play-record-options.h"
45 #include "game-option/special-options.h"
46 #include "grid/grid.h"
47 #include "grid/trap.h"
48 #include "info-reader/fixed-map-parser.h"
49 #include "inventory/inventory-object.h"
50 #include "inventory/inventory-slot-types.h"
51 #include "inventory/player-inventory.h"
52 #include "io/cursor.h"
53 #include "io/input-key-acceptor.h"
54 #include "io/input-key-requester.h"
55 #include "io/screen-util.h"
56 #include "io/targeting.h"
57 #include "io/write-diary.h"
58 #include "main/music-definitions-table.h"
59 #include "main/sound-definitions-table.h"
60 #include "main/sound-of-music.h"
61 #include "mind/mind-ninja.h"
62 #include "mind/racial-android.h"
63 #include "mind/snipe-types.h"
64 #include "monster-floor/monster-death.h"
65 #include "monster-floor/monster-summon.h"
66 #include "monster-floor/place-monster-types.h"
67 #include "monster/monster-describer.h"
68 #include "monster/monster-info.h"
69 #include "monster/monster-status.h"
70 #include "object-enchant/special-object-flags.h"
71 #include "object-enchant/tr-types.h"
72 #include "object-hook/hook-checker.h"
73 #include "object-hook/hook-expendable.h"
74 #include "object-hook/hook-weapon.h"
75 #include "object/item-tester-hooker.h"
76 #include "object/item-use-flags.h"
77 #include "object/object-broken.h"
78 #include "object/object-flags.h"
79 #include "object/object-generator.h"
80 #include "object/object-info.h"
81 #include "object/object-kind.h"
82 #include "object/object-stack.h"
83 #include "perception/object-perception.h"
84 #include "player/attack-defense-types.h"
85 #include "player/avatar.h"
86 #include "player/player-move.h"
87 #include "player/player-personalities-types.h"
88 #include "player/player-status.h"
89 #include "player/special-defense-types.h"
90 #include "specific-object/chest.h"
91 #include "specific-object/torch.h"
92 #include "spell-kind/spells-teleport.h"
93 #include "spell-realm/spells-hex.h"
94 #include "status/action-setter.h"
95 #include "status/bad-status-setter.h"
96 #include "status/experience.h"
97 #include "sv-definition/sv-bow-types.h"
98 #include "system/system-variables.h"
99 #include "term/screen-processor.h"
100 #include "util/bit-flags-calculator.h"
101 #include "view/display-messages.h"
102 #include "view/object-describer.h"
103 #include "wizard/wizard-messages.h"
104 #include "world/world.h"
107 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
110 void do_cmd_search(player_type *creature_ptr)
113 command_rep = command_arg - 1;
114 creature_ptr->redraw |= (PR_STATE);
118 take_turn(creature_ptr, 100);
119 search(creature_ptr);
123 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
127 * Manipulate an adjacent grid in some way
129 * Attack monsters, tunnel through walls, disarm traps, open doors.
133 * This command must always take a turn, to prevent free detection
134 * of invisible monsters.
137 void do_cmd_alter(player_type *creature_ptr)
143 if (creature_ptr->special_defense & KATA_MUSOU)
144 set_action(creature_ptr, ACTION_NONE);
147 command_rep = command_arg - 1;
148 creature_ptr->redraw |= (PR_STATE);
152 if (get_rep_dir(creature_ptr, &dir, TRUE)) {
155 y = creature_ptr->y + ddy[dir];
156 x = creature_ptr->x + ddx[dir];
157 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
158 feat = get_feat_mimic(g_ptr);
159 f_ptr = &f_info[feat];
160 take_turn(creature_ptr, 100);
162 do_cmd_attack(creature_ptr, y, x, 0);
163 } else if (have_flag(f_ptr->flags, FF_OPEN)) {
164 more = exe_open(creature_ptr, y, x);
165 } else if (have_flag(f_ptr->flags, FF_BASH)) {
166 more = exe_bash(creature_ptr, y, x, dir);
167 } else if (have_flag(f_ptr->flags, FF_TUNNEL)) {
168 more = exe_tunnel(creature_ptr, y, x);
169 } else if (have_flag(f_ptr->flags, FF_CLOSE)) {
170 more = exe_close(creature_ptr, y, x);
171 } else if (have_flag(f_ptr->flags, FF_DISARM)) {
172 more = exe_disarm(creature_ptr, y, x, dir);
174 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
179 disturb(creature_ptr, FALSE, FALSE);
183 * @brief 自殺するコマンドのメインルーチン
188 void do_cmd_suicide(player_type *creature_ptr)
191 if (current_world_ptr->total_winner) {
192 if (!get_check_strict(creature_ptr, _("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY))
195 if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? ")))
199 if (!current_world_ptr->noscore) {
200 prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
207 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
210 if (creature_ptr->last_message)
211 string_free(creature_ptr->last_message);
213 creature_ptr->last_message = NULL;
214 if (current_world_ptr->total_winner && last_words) {
216 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
218 while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf))
220 } while (!get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
223 creature_ptr->last_message = string_make(buf);
224 msg_print(creature_ptr->last_message);
228 creature_ptr->playing = FALSE;
229 creature_ptr->is_dead = TRUE;
230 creature_ptr->leaving = TRUE;
231 if (!current_world_ptr->total_winner) {
232 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("ダンジョンの探索に絶望して自殺した。", "gave up all hope to commit suicide."));
233 exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
234 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
237 (void)strcpy(creature_ptr->died_from, _("途中終了", "Quitting"));