2 * @brief その他の小さなコマンド処理群 (探索、汎用グリッド処理、自殺/引退/切腹)
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-action/cmd-others.h"
13 #include "action/open-close-execution.h"
14 #include "action/tunnel-execution.h"
15 #include "cmd-action/cmd-attack.h"
16 #include "core/asking-player.h"
17 #include "core/disturbance.h"
18 #include "core/player-redraw-types.h"
19 #include "floor/geometry.h"
20 #include "game-option/game-play-options.h"
21 #include "grid/feature.h"
22 #include "grid/grid.h"
23 #include "io/input-key-acceptor.h"
24 #include "io/input-key-requester.h"
25 #include "io/write-diary.h"
26 #include "main/music-definitions-table.h"
27 #include "main/sound-of-music.h"
28 #include "player/attack-defense-types.h"
29 #include "player/player-move.h"
30 #include "player/special-defense-types.h"
31 #include "status/action-setter.h"
32 #include "system/floor-type-definition.h"
33 #include "target/target-getter.h"
34 #include "term/screen-processor.h"
35 #include "util/bit-flags-calculator.h"
36 #include "view/display-messages.h"
37 #include "world/world.h"
40 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
43 void do_cmd_search(player_type *creature_ptr)
46 command_rep = command_arg - 1;
47 creature_ptr->redraw |= PR_STATE;
51 take_turn(creature_ptr, 100);
54 if (creature_ptr->action == ACTION_SEARCH)
58 static bool exe_alter(player_type *creature_ptr)
61 if (!get_rep_dir(creature_ptr, &dir, TRUE))
64 POSITION y = creature_ptr->y + ddy[dir];
65 POSITION x = creature_ptr->x + ddx[dir];
67 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
68 FEAT_IDX feat = get_feat_mimic(g_ptr);
70 f_ptr = &f_info[feat];
71 take_turn(creature_ptr, 100);
73 do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
77 if (has_flag(f_ptr->flags, FF_OPEN))
78 return exe_open(creature_ptr, y, x);
80 if (has_flag(f_ptr->flags, FF_BASH))
81 return exe_bash(creature_ptr, y, x, dir);
83 if (has_flag(f_ptr->flags, FF_TUNNEL))
84 return exe_tunnel(creature_ptr, y, x);
86 if (has_flag(f_ptr->flags, FF_CLOSE))
87 return exe_close(creature_ptr, y, x);
89 if (has_flag(f_ptr->flags, FF_DISARM))
90 return exe_disarm(creature_ptr, y, x, dir);
92 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
97 * @brief 特定のマスに影響を及ぼすための汎用的コマンド / Manipulate an adjacent grid in some way
101 void do_cmd_alter(player_type *creature_ptr)
103 if (creature_ptr->special_defense & KATA_MUSOU)
104 set_action(creature_ptr, ACTION_NONE);
107 command_rep = command_arg - 1;
108 creature_ptr->redraw |= PR_STATE;
112 if (!exe_alter(creature_ptr))
113 disturb(creature_ptr, FALSE, FALSE);
119 * @return 自殺/引退/切腹を実施するならTRUE、キャンセルならFALSE
121 static bool decide_suicide(void)
123 if (current_world_ptr->noscore)
126 prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
133 static void accept_winner_message(player_type *creature_ptr)
135 if (!current_world_ptr->total_winner || !last_words)
139 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
141 while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof(buf)))
143 } while (!get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
146 creature_ptr->last_message = string_make(buf);
147 msg_print(creature_ptr->last_message);
152 * @brief 自殺するコマンドのメインルーチン
157 void do_cmd_suicide(player_type *creature_ptr)
160 if (current_world_ptr->total_winner) {
161 if (!get_check_strict(creature_ptr, _("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY))
164 if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? ")))
168 if (!decide_suicide())
171 if (creature_ptr->last_message)
172 string_free(creature_ptr->last_message);
174 creature_ptr->last_message = NULL;
175 accept_winner_message(creature_ptr);
176 creature_ptr->playing = FALSE;
177 creature_ptr->is_dead = TRUE;
178 creature_ptr->leaving = TRUE;
179 if (!current_world_ptr->total_winner) {
180 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
181 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("ダンジョンの探索に絶望して自殺した。", "gave up all hope to commit suicide."));
182 exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
183 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
186 (void)strcpy(creature_ptr->died_from, _("途中終了", "Quitting"));