3 * @brief プレイヤーのコマンド処理2 / Movement commands (part 2)
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
25 #include "object-hook.h"
27 #include "spells-summon.h"
28 #include "spells-status.h"
30 #include "monster-status.h"
34 #include "player-status.h"
35 #include "realm-hex.h"
36 #include "realm-song.h"
41 #include "player-move.h"
42 #include "player-effects.h"
43 #include "player-class.h"
44 #include "player-personality.h"
45 #include "objectkind.h"
46 #include "object-broken.h"
47 #include "object-flavor.h"
51 #include "cmd-basic.h"
53 #include "floor-save.h"
54 #include "dungeon-file.h"
57 #include "view-mainwindow.h"
58 #include "targeting.h"
61 * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
62 * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
63 * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
65 static bool confirm_leave_level(player_type *creature_ptr, bool down_stair)
67 quest_type *q_ptr = &quest[creature_ptr->inside_quest];
69 /* Confirm leaving from once only quest */
70 if (confirm_quest && creature_ptr->inside_quest &&
71 (q_ptr->type == QUEST_TYPE_RANDOM ||
72 (q_ptr->flags & QUEST_FLAG_ONCE &&
73 q_ptr->status != QUEST_STATUS_COMPLETED) ||
74 (q_ptr->flags & QUEST_FLAG_TOWER &&
75 ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
76 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
78 msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
79 if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
89 * @brief 魔法系コマンドが制限されているかを返す。
90 * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
92 bool cmd_limit_cast(player_type *creature_ptr)
94 if (current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
96 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
100 else if (creature_ptr->anti_magic)
102 msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
105 else if (creature_ptr->shero)
107 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
114 bool cmd_limit_confused(player_type *creature_ptr)
116 if (creature_ptr->confused)
118 msg_print(_("混乱していてできない!", "You are too confused!"));
124 bool cmd_limit_image(player_type *creature_ptr)
126 if (creature_ptr->image)
128 msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
134 bool cmd_limit_stun(player_type *creature_ptr)
136 if (creature_ptr->stun)
138 msg_print(_("頭が朦朧としていて集中できない!", "You are too stuned!"));
144 bool cmd_limit_arena(player_type *creature_ptr)
146 if (creature_ptr->inside_arena)
148 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
155 bool cmd_limit_blind(player_type *creature_ptr)
157 if (creature_ptr->blind)
159 msg_print(_("目が見えない。", "You can't see anything."));
164 msg_print(_("明かりがないので見えない。", "You have no light."));
170 bool cmd_limit_time_walk(player_type *creature_ptr)
172 if (creature_ptr->timewalk)
174 if (flush_failure) flush();
175 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
183 * @brief 階段を使って階層を昇る処理 / Go up one level
186 void do_cmd_go_up(player_type *creature_ptr)
191 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
192 feature_type *f_ptr = &f_info[g_ptr->feat];
196 if (creature_ptr->special_defense & KATA_MUSOU)
198 set_action(creature_ptr, ACTION_NONE);
202 if (!have_flag(f_ptr->flags, FF_LESS))
204 msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
208 /* Quest up stairs */
209 if (have_flag(f_ptr->flags, FF_QUEST))
211 if (!confirm_leave_level(creature_ptr, FALSE)) return;
214 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
215 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
217 msg_print(_("上の階に登った。", "You enter the up staircase."));
221 creature_ptr->inside_quest = g_ptr->special;
223 /* Activate the quest */
224 if (!quest[creature_ptr->inside_quest].status)
226 if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
228 init_flags = INIT_ASSIGN;
229 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
231 quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
234 /* Leaving a quest */
235 if (!creature_ptr->inside_quest)
237 current_floor_ptr->dun_level = 0;
239 creature_ptr->leaving = TRUE;
241 creature_ptr->oldpx = 0;
242 creature_ptr->oldpy = 0;
244 take_turn(creature_ptr, 100);
246 /* End the command */
250 if (!current_floor_ptr->dun_level)
256 go_up = confirm_leave_level(creature_ptr, FALSE);
261 take_turn(creature_ptr, 100);
263 if (autosave_l) do_cmd_save_game(TRUE);
265 /* For a random quest */
266 if (creature_ptr->inside_quest &&
267 quest[creature_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
271 creature_ptr->inside_quest = 0;
274 /* For a fixed quest */
275 if (creature_ptr->inside_quest &&
276 quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
280 creature_ptr->inside_quest = g_ptr->special;
281 current_floor_ptr->dun_level = 0;
285 /* For normal dungeon and random quest */
289 if (have_flag(f_ptr->flags, FF_SHAFT))
291 /* Create a way back */
292 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
298 /* Create a way back */
299 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
304 /* Get out from current dungeon */
305 if (current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth)
306 up_num = current_floor_ptr->dun_level;
308 if (record_stair) exe_write_diary(creature_ptr, NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
311 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
312 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
313 else if (up_num == current_floor_ptr->dun_level)
314 msg_print(_("地上に戻った。", "You go back to the surface."));
316 msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
317 creature_ptr->leaving = TRUE;
322 * @brief 階段を使って階層を降りる処理 / Go down one level
325 void do_cmd_go_down(player_type *creature_ptr)
328 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
329 feature_type *f_ptr = &f_info[g_ptr->feat];
331 bool fall_trap = FALSE;
334 if (creature_ptr->special_defense & KATA_MUSOU)
336 set_action(creature_ptr, ACTION_NONE);
340 if (!have_flag(f_ptr->flags, FF_MORE))
342 msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
346 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
349 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
354 /* Quest down stairs */
355 else if (have_flag(f_ptr->flags, FF_QUEST))
357 /* Confirm Leaving */
358 if(!confirm_leave_level(creature_ptr, TRUE)) return;
360 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
361 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
363 msg_print(_("下の階に降りた。", "You enter the down staircase."));
368 creature_ptr->inside_quest = g_ptr->special;
370 /* Activate the quest */
371 if (!quest[creature_ptr->inside_quest].status)
373 if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
375 init_flags = INIT_ASSIGN;
376 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
378 quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
381 /* Leaving a quest */
382 if (!creature_ptr->inside_quest)
384 current_floor_ptr->dun_level = 0;
386 creature_ptr->leaving = TRUE;
387 creature_ptr->oldpx = 0;
388 creature_ptr->oldpy = 0;
390 take_turn(creature_ptr, 100);
395 DUNGEON_IDX target_dungeon = 0;
397 if (!current_floor_ptr->dun_level)
399 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
401 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
403 msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
406 if (!max_dlv[target_dungeon])
408 msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
409 d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
410 if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
413 /* Save old player position */
414 creature_ptr->oldpx = creature_ptr->x;
415 creature_ptr->oldpy = creature_ptr->y;
416 creature_ptr->dungeon_idx = target_dungeon;
419 * Clear all saved floors
420 * and create a first saved floor
422 prepare_change_floor_mode(CFM_FIRST_FLOOR);
425 take_turn(creature_ptr, 100);
427 if (autosave_l) do_cmd_save_game(TRUE);
430 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
433 if (!current_floor_ptr->dun_level)
435 /* Enter the dungeon just now */
436 creature_ptr->enter_dungeon = TRUE;
437 down_num = d_info[creature_ptr->dungeon_idx].mindepth;
442 if (fall_trap) exe_write_diary(creature_ptr, NIKKI_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
443 else exe_write_diary(creature_ptr, NIKKI_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
448 msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
455 msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[creature_ptr->dungeon_idx].text);
459 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
460 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
462 msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
466 creature_ptr->leaving = TRUE;
470 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
474 if (have_flag(f_ptr->flags, FF_SHAFT))
476 /* Create a way back */
477 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
481 /* Create a way back */
482 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
490 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one current_world_ptr->game_turn
493 void do_cmd_search(player_type * creature_ptr)
495 /* Allow repeated command */
498 /* Set repeat count */
499 command_rep = command_arg - 1;
500 creature_ptr->redraw |= (PR_STATE);
505 take_turn(creature_ptr, 100);
507 search(creature_ptr);
512 * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
513 * @param y 走査対象にしたいマスのY座標
514 * @param x 走査対象にしたいマスのX座標
515 * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
516 * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
518 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
520 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
521 OBJECT_IDX this_o_idx, next_o_idx = 0;
523 /* Scan all objects in the grid */
524 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
528 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
529 next_o_idx = o_ptr->next_o_idx;
531 /* Skip unknown chests XXX XXX */
532 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
534 /* Check for non empty chest */
535 if ((o_ptr->tval == TV_CHEST) &&
536 (((!trapped) && (o_ptr->pval)) || /* non empty */
537 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
547 * Attempt to open the given chest at the given location
548 * @param y 箱の存在するマスのY座標
549 * @param x 箱の存在するマスのX座標
550 * @param o_idx 箱のオブジェクトID
551 * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
553 * Assume there is no monster blocking the destination
555 static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
560 object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx];
562 take_turn(creature_ptr, 100);
564 /* Attempt to unlock it */
567 /* Assume locked, and thus not open */
570 /* Get the "disarm" factor */
571 i = creature_ptr->skill_dis;
573 /* Penalize some conditions */
574 if (creature_ptr->blind || no_lite()) i = i / 10;
575 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
577 /* Extract the difficulty */
580 /* Always have a small chance of success */
583 /* Success -- May still have traps */
584 if (randint0(100) < j)
586 msg_print(_("鍵をはずした。", "You have picked the lock."));
587 gain_exp(creature_ptr, 1);
591 /* Failure -- Keep trying */
594 /* We may continue repeating */
596 if (flush_failure) flush();
597 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
602 /* Allowed to open */
605 /* Apply chest traps, if any */
606 chest_trap(y, x, o_idx);
608 /* Let the Chest drop items */
609 chest_death(FALSE, y, x, o_idx);
615 * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
616 * Attempt to open the given chest at the given location
617 * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
618 * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
619 * @param test 地形条件を判定するための関数ポインタ
620 * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
622 * @details Return the number of features around (or under) the character.
623 * Usually look for doors and floor traps.
625 static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (*test)(FEAT_IDX feat), bool under)
631 /* Count how many matches */
634 /* Check around (and under) the character */
635 for (d = 0; d < 9; d++)
640 /* if not searching under player continue */
641 if ((d == 8) && !under) continue;
643 /* Extract adjacent (legal) location */
644 yy = creature_ptr->y + ddy_ddd[d];
645 xx = creature_ptr->x + ddx_ddd[d];
647 /* Get the current_floor_ptr->grid_array */
648 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
650 /* Must have knowledge */
651 if (!(g_ptr->info & (CAVE_MARK))) continue;
653 /* Feature code (applying "mimic" field) */
654 feat = get_feat_mimic(g_ptr);
656 /* Not looking for this feature */
657 if (!((*test)(feat))) continue;
662 /* Remember the location. Only useful if only one match */
673 * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
674 * Return the number of chests around (or under) the character.
675 * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
676 * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
677 * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
680 * If requested, count only trapped chests.
682 static int count_chests(player_type *creature_ptr, POSITION *y, POSITION *x, bool trapped)
689 /* Count how many matches */
692 /* Check around (and under) the character */
693 for (d = 0; d < 9; d++)
695 /* Extract adjacent (legal) location */
696 POSITION yy = creature_ptr->y + ddy_ddd[d];
697 POSITION xx = creature_ptr->x + ddx_ddd[d];
699 /* No (visible) chest is there */
700 if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
702 /* Grab the object */
703 o_ptr = ¤t_floor_ptr->o_list[o_idx];
706 if (o_ptr->pval == 0) continue;
708 /* No (known) traps here */
709 if (trapped && (!object_is_known(o_ptr) ||
710 !chest_traps[o_ptr->pval])) continue;
715 /* Remember the location. Only useful if only one match */
727 * @brief 「開ける」動作コマンドのサブルーチン /
728 * Perform the basic "open" command on doors
729 * @param y 対象を行うマスのY座標
730 * @param x 対象を行うマスのX座標
731 * @return 実際に処理が行われた場合TRUEを返す。
733 * Assume destination is a closed/locked/jammed door
734 * Assume there is no monster blocking the destination
735 * Returns TRUE if repeated commands may continue
737 static bool exe_open(player_type *creature_ptr, POSITION y, POSITION x)
741 /* Get requested grid */
742 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
743 feature_type *f_ptr = &f_info[g_ptr->feat];
746 take_turn(creature_ptr, 100);
748 /* Seeing true feature code (ignore mimic) */
751 if (!have_flag(f_ptr->flags, FF_OPEN))
754 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
758 else if (f_ptr->power)
761 i = creature_ptr->skill_dis;
763 /* Penalize some conditions */
764 if (creature_ptr->blind || no_lite()) i = i / 10;
765 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
767 /* Extract the lock power */
770 /* Extract the difficulty */
773 /* Always have a small chance of success */
777 if (randint0(100) < j)
779 msg_print(_("鍵をはずした。", "You have picked the lock."));
782 cave_alter_feat(y, x, FF_OPEN);
784 sound(SOUND_OPENDOOR);
787 gain_exp(creature_ptr, 1);
794 if (flush_failure) flush();
796 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
798 /* We may keep trying */
807 cave_alter_feat(y, x, FF_OPEN);
809 sound(SOUND_OPENDOOR);
815 * @brief 「開ける」コマンドのメインルーチン /
816 * Open a closed/locked/jammed door or a closed/locked chest.
819 * Unlocking a locked door/chest is worth one experience point.
821 void do_cmd_open(player_type *creature_ptr)
829 if (creature_ptr->wild_mode) return;
831 if (creature_ptr->special_defense & KATA_MUSOU)
833 set_action(creature_ptr, ACTION_NONE);
836 /* Option: Pick a direction */
839 int num_doors, num_chests;
841 num_doors = count_dt(creature_ptr, &y, &x, is_closed_door, FALSE);
842 num_chests = count_chests(creature_ptr, &y, &x, FALSE);
843 if (num_doors || num_chests)
845 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
847 if (!too_many) command_dir = coords_to_dir(y, x);
851 /* Allow repeated command */
854 /* Set repeat count */
855 command_rep = command_arg - 1;
856 creature_ptr->redraw |= (PR_STATE);
862 /* Get a "repeated" direction */
863 if (get_rep_dir(&dir, TRUE))
868 /* Get requested location */
869 y = creature_ptr->y + ddy[dir];
870 x = creature_ptr->x + ddx[dir];
872 /* Get requested grid */
873 g_ptr = ¤t_floor_ptr->grid_array[y][x];
875 /* Feature code (applying "mimic" field) */
876 feat = get_feat_mimic(g_ptr);
878 /* Check for chest */
879 o_idx = chest_check(y, x, FALSE);
881 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
883 msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
885 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
887 take_turn(creature_ptr, 100);
888 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
893 more = exe_open_chest(creature_ptr, y, x, o_idx);
897 more = exe_open(creature_ptr, y, x);
901 /* Cancel repeat unless we may continue */
902 if (!more) disturb(FALSE, FALSE);
908 * @brief 「閉じる」動作コマンドのサブルーチン /
909 * Perform the basic "close" command
910 * @param y 対象を行うマスのY座標
911 * @param x 対象を行うマスのX座標
912 * @return 実際に処理が行われた場合TRUEを返す。
914 * Assume destination is an open/broken door
915 * Assume there is no monster blocking the destination
916 * Returns TRUE if repeated commands may continue
918 static bool exe_close(player_type *creature_ptr, POSITION y, POSITION x)
920 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
921 FEAT_IDX old_feat = g_ptr->feat;
924 take_turn(creature_ptr, 100);
926 /* Seeing true feature code (ignore mimic) */
929 if (have_flag(f_info[old_feat].flags, FF_CLOSE))
931 s16b closed_feat = feat_state(old_feat, FF_CLOSE);
933 /* Hack -- object in the way */
934 if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) &&
935 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
937 msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
942 cave_alter_feat(y, x, FF_CLOSE);
945 if (old_feat == g_ptr->feat)
947 msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
951 sound(SOUND_SHUTDOOR);
960 * @brief 「閉じる」コマンドのメインルーチン /
961 * Close an open door.
964 * Unlocking a locked door/chest is worth one experience point.
966 void do_cmd_close(player_type *creature_ptr)
973 if (creature_ptr->wild_mode) return;
975 if (creature_ptr->special_defense & KATA_MUSOU)
977 set_action(creature_ptr, ACTION_NONE);
980 /* Option: Pick a direction */
983 /* Count open doors */
984 if (count_dt(creature_ptr, &y, &x, is_open, FALSE) == 1)
986 command_dir = coords_to_dir(y, x);
990 /* Allow repeated command */
993 /* Set repeat count */
994 command_rep = command_arg - 1;
995 creature_ptr->redraw |= (PR_STATE);
1001 /* Get a "repeated" direction */
1002 if (get_rep_dir(&dir, FALSE))
1007 y = creature_ptr->y + ddy[dir];
1008 x = creature_ptr->x + ddx[dir];
1009 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1011 /* Feature code (applying "mimic" field) */
1012 feat = get_feat_mimic(g_ptr);
1014 /* Require open/broken door */
1015 if (!have_flag(f_info[feat].flags, FF_CLOSE))
1017 msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
1020 /* Monster in the way */
1021 else if (g_ptr->m_idx)
1023 take_turn(creature_ptr, 100);
1025 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1031 /* Close the door */
1034 /* Close the door */
1035 more = exe_close(creature_ptr, y, x);
1039 /* Cancel repeat unless we may continue */
1040 if (!more) disturb(FALSE, FALSE);
1045 * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
1046 * Determine if a given grid may be "tunneled"
1047 * @param y 対象を行うマスのY座標
1048 * @param x 対象を行うマスのX座標
1051 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
1053 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1055 /* Must have knowledge */
1056 if (!(g_ptr->info & CAVE_MARK))
1058 msg_print(_("そこには何も見当たらない。", "You see nothing there."));
1063 /* Must be a wall/door/etc */
1064 if (!cave_have_flag_grid(g_ptr, FF_TUNNEL))
1066 msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
1076 * @brief 「掘る」動作コマンドのサブルーチン /
1077 * Perform the basic "tunnel" command
1078 * @param y 対象を行うマスのY座標
1079 * @param x 対象を行うマスのX座標
1080 * @return 実際に処理が行われた場合TRUEを返す。
1082 * Assumes that no monster is blocking the destination
1083 * Do not use twall anymore
1084 * Returns TRUE if repeated commands may continue
1086 static bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x)
1089 feature_type *f_ptr, *mimic_f_ptr;
1094 /* Verify legality */
1095 if (!do_cmd_tunnel_test(y, x)) return (FALSE);
1097 take_turn(creature_ptr, 100);
1099 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1100 f_ptr = &f_info[g_ptr->feat];
1101 power = f_ptr->power;
1103 /* Feature code (applying "mimic" field) */
1104 mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
1106 name = f_name + mimic_f_ptr->name;
1110 if (have_flag(f_ptr->flags, FF_PERMANENT))
1113 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1115 msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
1118 /* Map border (mimiccing Permanent wall) */
1121 msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
1126 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1129 if (creature_ptr->skill_dig > randint0(20 * power))
1131 msg_format(_("%sをくずした。", "You have removed the %s."), name);
1133 /* Remove the feature */
1134 cave_alter_feat(y, x, FF_TUNNEL);
1135 creature_ptr->update |= (PU_FLOW);
1139 /* Message, keep digging */
1140 msg_format(_("%sをくずしている。", "You dig into the %s."), name);
1148 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1151 if (creature_ptr->skill_dig > power + randint0(40 * power))
1153 if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
1156 msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
1157 creature_ptr->update |= (PU_FLOW);
1160 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1162 /* Remove the feature */
1163 cave_alter_feat(y, x, FF_TUNNEL);
1165 chg_virtue(creature_ptr, V_DILIGENCE, 1);
1166 chg_virtue(creature_ptr, V_NATURE, -1);
1174 /* We may continue chopping */
1175 msg_format(_("%sを切っている。", "You chop away at the %s."), name);
1176 /* Occasional Search XXX XXX */
1177 if (randint0(100) < 25) search(creature_ptr);
1181 /* We may continue tunelling */
1182 msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
1189 if (is_hidden_door(g_ptr))
1191 /* Occasional Search XXX XXX */
1192 if (randint0(100) < 25) search(creature_ptr);
1199 * @brief 「掘る」動作コマンドのメインルーチン /
1200 * Tunnels through "walls" (including rubble and closed doors)
1204 * Note that you must tunnel in order to hit invisible monsters
1205 * in walls, though moving into walls still takes a current_world_ptr->game_turn anyway.
1207 * Digging is very difficult without a "digger" weapon, but can be
1208 * accomplished by strong players using heavy weapons.
1211 void do_cmd_tunnel(player_type *creature_ptr)
1220 if (creature_ptr->special_defense & KATA_MUSOU)
1222 set_action(creature_ptr, ACTION_NONE);
1225 /* Allow repeated command */
1228 /* Set repeat count */
1229 command_rep = command_arg - 1;
1230 creature_ptr->redraw |= (PR_STATE);
1232 /* Cancel the arg */
1236 /* Get a direction to tunnel, or Abort */
1237 if (get_rep_dir(&dir,FALSE))
1240 y = creature_ptr->y + ddy[dir];
1241 x = creature_ptr->x + ddx[dir];
1243 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1245 /* Feature code (applying "mimic" field) */
1246 feat = get_feat_mimic(g_ptr);
1248 /* No tunnelling through doors */
1249 if (have_flag(f_info[feat].flags, FF_DOOR))
1251 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
1254 /* No tunnelling through most features */
1255 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1257 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
1260 /* A monster is in the way */
1261 else if (g_ptr->m_idx)
1263 take_turn(creature_ptr, 100);
1264 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1273 /* Tunnel through walls */
1274 more = exe_tunnel(creature_ptr, y, x);
1278 /* Cancel repetition unless we can continue */
1279 if (!more) disturb(FALSE, FALSE);
1283 * @brief 移動処理による簡易な「開く」処理 /
1285 * @return 開く処理が実際に試みられた場合TRUEを返す
1288 * If there is a jammed/closed/locked door at the given location,
1289 * then attempt to unlock/open it. Return TRUE if an attempt was
1290 * made (successful or not), otherwise return FALSE.
1292 * The code here should be nearly identical to that in
1293 * do_cmd_open_test() and exe_open().
1296 bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x)
1300 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1301 feature_type *f_ptr = &f_info[g_ptr->feat];
1303 /* Must be a closed door */
1304 if (!is_closed_door(g_ptr->feat))
1310 if (!have_flag(f_ptr->flags, FF_OPEN))
1313 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
1318 else if (f_ptr->power)
1321 i = creature_ptr->skill_dis;
1323 /* Penalize some conditions */
1324 if (creature_ptr->blind || no_lite()) i = i / 10;
1325 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1327 /* Extract the lock power */
1330 /* Extract the difficulty */
1333 /* Always have a small chance of success */
1337 if (randint0(100) < j)
1339 msg_print(_("鍵をはずした。", "You have picked the lock."));
1342 cave_alter_feat(y, x, FF_OPEN);
1344 sound(SOUND_OPENDOOR);
1347 gain_exp(creature_ptr, 1);
1354 if (flush_failure) flush();
1356 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
1365 cave_alter_feat(y, x, FF_OPEN);
1367 sound(SOUND_OPENDOOR);
1373 * @brief 箱のトラップを解除する実行処理 /
1374 * Perform the basic "disarm" command
1375 * @param y 解除を行うマスのY座標
1376 * @param x 解除を行うマスのX座標
1377 * @param o_idx 箱のオブジェクトID
1378 * @return ターンを消費する処理が行われた場合TRUEを返す
1381 * Assume destination is a visible trap
1382 * Assume there is no monster blocking the destination
1383 * Returns TRUE if repeated commands may continue
1386 static bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
1390 object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx];
1392 take_turn(creature_ptr, 100);
1394 /* Get the "disarm" factor */
1395 i = creature_ptr->skill_dis;
1397 /* Penalize some conditions */
1398 if (creature_ptr->blind || no_lite()) i = i / 10;
1399 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1401 /* Extract the difficulty */
1402 j = i - o_ptr->pval;
1404 /* Always have a small chance of success */
1407 /* Must find the trap first. */
1408 if (!object_is_known(o_ptr))
1410 msg_print(_("トラップが見あたらない。", "I don't see any traps."));
1414 /* Already disarmed/unlocked */
1415 else if (o_ptr->pval <= 0)
1417 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1420 /* No traps to find. */
1421 else if (!chest_traps[o_ptr->pval])
1423 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1426 /* Success (get a lot of experience) */
1427 else if (randint0(100) < j)
1429 msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
1430 gain_exp(creature_ptr, o_ptr->pval);
1431 o_ptr->pval = (0 - o_ptr->pval);
1434 /* Failure -- Keep trying */
1435 else if ((i > 5) && (randint1(i) > 5))
1437 /* We may keep trying */
1439 if (flush_failure) flush();
1440 msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
1443 /* Failure -- Set off the trap */
1446 msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
1448 chest_trap(y, x, o_idx);
1455 * @brief 箱のトラップを解除するコマンドのサブルーチン /
1456 * Perform the basic "disarm" command
1457 * @param y 解除を行うマスのY座標
1458 * @param x 解除を行うマスのX座標
1459 * @param dir プレイヤーからみた方向ID
1460 * @return ターンを消費する処理が行われた場合TRUEを返す
1463 * Assume destination is a visible trap
1464 * Assume there is no monster blocking the destination
1465 * Returns TRUE if repeated commands may continue
1469 bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1471 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1474 feature_type *f_ptr = &f_info[g_ptr->feat];
1476 /* Access trap name */
1477 concptr name = (f_name + f_ptr->name);
1479 /* Extract trap "power" */
1480 int power = f_ptr->power;
1483 /* Get the "disarm" factor */
1484 int i = creature_ptr->skill_dis;
1487 take_turn(creature_ptr, 100);
1489 /* Penalize some conditions */
1490 if (creature_ptr->blind || no_lite()) i = i / 10;
1491 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1493 /* Extract the difficulty */
1496 /* Always have a small chance of success */
1500 if (randint0(100) < j)
1502 msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
1505 gain_exp(creature_ptr, power);
1507 /* Remove the trap */
1508 cave_alter_feat(y, x, FF_DISARM);
1510 /* Move the player onto the trap */
1511 move_player(creature_ptr, dir, easy_disarm, FALSE);
1514 /* Failure -- Keep trying */
1515 else if ((i > 5) && (randint1(i) > 5))
1518 if (flush_failure) flush();
1520 msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
1522 /* We may keep trying */
1526 /* Failure -- Set off the trap */
1529 msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
1530 /* Move the player onto the trap */
1531 move_player(creature_ptr, dir, easy_disarm, FALSE);
1538 * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
1539 * Disarms a trap, or chest
1542 void do_cmd_disarm(player_type *creature_ptr)
1550 if (creature_ptr->wild_mode) return;
1552 if (creature_ptr->special_defense & KATA_MUSOU)
1554 set_action(creature_ptr, ACTION_NONE);
1557 /* Option: Pick a direction */
1560 int num_traps, num_chests;
1562 /* Count visible traps */
1563 num_traps = count_dt(creature_ptr, &y, &x, is_trap, TRUE);
1565 /* Count chests (trapped) */
1566 num_chests = count_chests(creature_ptr, &y, &x, TRUE);
1568 /* See if only one target */
1569 if (num_traps || num_chests)
1571 bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
1572 if (!too_many) command_dir = coords_to_dir(y, x);
1577 /* Allow repeated command */
1580 /* Set repeat count */
1581 command_rep = command_arg - 1;
1582 creature_ptr->redraw |= (PR_STATE);
1584 /* Cancel the arg */
1588 /* Get a direction (or abort) */
1589 if (get_rep_dir(&dir,TRUE))
1594 y = creature_ptr->y + ddy[dir];
1595 x = creature_ptr->x + ddx[dir];
1596 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1598 /* Feature code (applying "mimic" field) */
1599 feat = get_feat_mimic(g_ptr);
1601 /* Check for chests */
1602 o_idx = chest_check(y, x, TRUE);
1605 if (!is_trap(feat) && !o_idx)
1607 msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
1610 /* Monster in the way */
1611 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
1613 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1622 more = exe_disarm_chest(creature_ptr, y, x, o_idx);
1628 more = exe_disarm(creature_ptr, y, x, dir);
1632 /* Cancel repeat unless told not to */
1633 if (!more) disturb(FALSE, FALSE);
1638 * @brief 「打ち破る」動作コマンドのサブルーチン /
1639 * Perform the basic "bash" command
1640 * @param y 対象を行うマスのY座標
1641 * @param x 対象を行うマスのX座標
1642 * @param dir プレイヤーから見たターゲットの方角ID
1643 * @return 実際に処理が行われた場合TRUEを返す。
1646 * Assume destination is a closed/locked/jammed door
1647 * Assume there is no monster blocking the destination
1648 * Returns TRUE if repeated commands may continue
1651 static bool do_cmd_bash_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1653 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1656 feature_type *f_ptr = &f_info[g_ptr->feat];
1658 /* Hack -- Bash power based on strength */
1659 /* (Ranges from 3 to 20 to 100 to 200) */
1660 int bash = adj_str_blow[creature_ptr->stat_ind[A_STR]];
1662 /* Extract door power */
1663 int temp = f_ptr->power;
1667 concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
1669 take_turn(creature_ptr, 100);
1671 msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
1673 /* Compare bash power to door power */
1674 temp = (bash - (temp * 10));
1676 if (creature_ptr->pclass == CLASS_BERSERKER) temp *= 2;
1678 /* Hack -- always have a chance */
1679 if (temp < 1) temp = 1;
1681 /* Hack -- attempt to bash down the door */
1682 if (randint0(100) < temp)
1684 msg_format(_("%sを壊した!", "The %s crashes open!"), name);
1686 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
1688 /* Break down the door */
1689 if ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
1691 cave_alter_feat(y, x, FF_BASH);
1697 cave_alter_feat(y, x, FF_OPEN);
1700 /* Hack -- Fall through the door */
1701 move_player(creature_ptr, dir, FALSE, FALSE);
1704 /* Saving throw against stun */
1705 else if (randint0(100) < adj_dex_safe[creature_ptr->stat_ind[A_DEX]] +
1708 msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
1710 /* Allow repeated bashing */
1714 /* High dexterity yields coolness */
1717 msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
1719 /* Hack -- Lose balance ala paralysis */
1720 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 2 + randint0(2));
1727 * @brief 「打ち破る」動作コマンドのメインルーチン /
1728 * Bash open a door, success based on character strength
1732 * For a closed door, pval is positive if locked; negative if stuck.
1734 * For an open door, pval is positive for a broken door.
1736 * A closed door can be opened - harder if locked. Any door might be
1737 * bashed open (and thereby broken). Bashing a door is (potentially)
1738 * faster! You move into the door way. To open a stuck door, it must
1739 * be bashed. A closed door can be jammed (see do_cmd_spike()).
1741 * Creatures can also open or bash doors, see elsewhere.
1744 void do_cmd_bash(player_type *creature_ptr)
1751 if (creature_ptr->wild_mode) return;
1753 if (creature_ptr->special_defense & KATA_MUSOU)
1755 set_action(creature_ptr, ACTION_NONE);
1758 /* Allow repeated command */
1761 /* Set repeat count */
1762 command_rep = command_arg - 1;
1763 creature_ptr->redraw |= (PR_STATE);
1765 /* Cancel the arg */
1769 /* Get a "repeated" direction */
1770 if (get_rep_dir(&dir,FALSE))
1775 y = creature_ptr->y + ddy[dir];
1776 x = creature_ptr->x + ddx[dir];
1778 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1780 /* Feature code (applying "mimic" field) */
1781 feat = get_feat_mimic(g_ptr);
1783 /* Nothing useful */
1784 if (!have_flag(f_info[feat].flags, FF_BASH))
1786 msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
1789 /* Monster in the way */
1790 else if (g_ptr->m_idx)
1792 take_turn(creature_ptr, 100);
1794 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1800 /* Bash a closed door */
1804 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1808 /* Unless valid action taken, cancel bash */
1809 if (!more) disturb(FALSE, FALSE);
1814 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
1818 * Manipulate an adjacent grid in some way
1820 * Attack monsters, tunnel through walls, disarm traps, open doors.
1822 * Consider confusion
1824 * This command must always take a current_world_ptr->game_turn, to prevent free detection
1825 * of invisible monsters.
1828 void do_cmd_alter(player_type *creature_ptr)
1835 if (creature_ptr->special_defense & KATA_MUSOU)
1837 set_action(creature_ptr, ACTION_NONE);
1840 /* Allow repeated command */
1843 /* Set repeat count */
1844 command_rep = command_arg - 1;
1845 creature_ptr->redraw |= (PR_STATE);
1847 /* Cancel the arg */
1851 /* Get a direction */
1852 if (get_rep_dir(&dir,TRUE))
1855 feature_type *f_ptr;
1857 y = creature_ptr->y + ddy[dir];
1858 x = creature_ptr->x + ddx[dir];
1860 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1862 /* Feature code (applying "mimic" field) */
1863 feat = get_feat_mimic(g_ptr);
1864 f_ptr = &f_info[feat];
1866 take_turn(creature_ptr, 100);
1874 else if (have_flag(f_ptr->flags, FF_OPEN))
1876 more = exe_open(creature_ptr, y, x);
1879 /* Bash jammed doors */
1880 else if (have_flag(f_ptr->flags, FF_BASH))
1882 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1885 /* Tunnel through walls */
1886 else if (have_flag(f_ptr->flags, FF_TUNNEL))
1888 more = exe_tunnel(creature_ptr, y, x);
1891 /* Close open doors */
1892 else if (have_flag(f_ptr->flags, FF_CLOSE))
1894 more = exe_close(creature_ptr, y, x);
1898 else if (have_flag(f_ptr->flags, FF_DISARM))
1900 more = exe_disarm(creature_ptr, y, x, dir);
1905 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
1909 /* Cancel repetition unless we can continue */
1910 if (!more) disturb(FALSE, FALSE);
1916 * @brief 「くさびを打つ」ために必要なオブジェクトを所持しているかどうかの判定を返す /
1917 * Find the index of some "spikes", if possible.
1918 * @param ip くさびとして打てるオブジェクトのID
1919 * @return オブジェクトがある場合TRUEを返す
1922 * Let user choose a pile of spikes, perhaps?
1925 static bool get_spike(player_type *creature_ptr, INVENTORY_IDX *ip)
1929 /* Check every item in the pack */
1930 for (i = 0; i < INVEN_PACK; i++)
1932 object_type *o_ptr = &creature_ptr->inventory_list[i];
1933 if (!o_ptr->k_idx) continue;
1935 /* Check the "tval" code */
1936 if (o_ptr->tval == TV_SPIKE)
1938 /* Save the spike index */
1951 * @brief 「くさびを打つ」動作コマンドのメインルーチン /
1952 * Jam a closed door with a spike
1956 * This command may NOT be repeated
1959 void do_cmd_spike(player_type *creature_ptr)
1963 if (creature_ptr->wild_mode) return;
1964 if (creature_ptr->special_defense & KATA_MUSOU)
1966 set_action(creature_ptr, ACTION_NONE);
1969 /* Get a "repeated" direction */
1970 if (get_rep_dir(&dir, FALSE))
1977 y = creature_ptr->y + ddy[dir];
1978 x = creature_ptr->x + ddx[dir];
1979 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1981 /* Feature code (applying "mimic" field) */
1982 feat = get_feat_mimic(g_ptr);
1984 /* Require closed door */
1985 if (!have_flag(f_info[feat].flags, FF_SPIKE))
1987 msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
1991 else if (!get_spike(creature_ptr, &item))
1993 msg_print(_("くさびを持っていない!", "You have no spikes!"));
1996 /* Is a monster in the way? */
1997 else if (g_ptr->m_idx)
1999 take_turn(creature_ptr, 100);
2001 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
2010 take_turn(creature_ptr, 100);
2012 /* Successful jamming */
2013 msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
2014 cave_alter_feat(y, x, FF_SPIKE);
2016 /* Use up, and describe, a single spike, from the bottom */
2017 inven_item_increase(item, -1);
2018 inven_item_describe(item);
2019 inven_item_optimize(item);
2027 * @brief 「歩く」動作コマンドのメインルーチン /
2028 * Support code for the "Walk" and "Jump" commands
2029 * @param pickup アイテムの自動拾いを行うならTRUE
2032 void do_cmd_walk(player_type *creature_ptr, bool pickup)
2039 /* Allow repeated command */
2042 /* Set repeat count */
2043 command_rep = command_arg - 1;
2044 creature_ptr->redraw |= (PR_STATE);
2046 /* Cancel the arg */
2050 /* Get a "repeated" direction */
2051 if (get_rep_dir(&dir, FALSE))
2053 take_turn(creature_ptr, 100);
2055 if ((dir != 5) && (creature_ptr->special_defense & KATA_MUSOU))
2057 set_action(creature_ptr, ACTION_NONE);
2060 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2061 if (creature_ptr->wild_mode) creature_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
2062 if (creature_ptr->action == ACTION_HAYAGAKE) creature_ptr->energy_use = creature_ptr->energy_use * (45-(creature_ptr->lev/2)) / 100;
2064 /* Actually move the character */
2065 move_player(creature_ptr, dir, pickup, FALSE);
2067 /* Allow more walking */
2071 /* Hack again -- Is there a special encounter ??? */
2072 if (creature_ptr->wild_mode && !cave_have_flag_bold(creature_ptr->y, creature_ptr->x, FF_TOWN))
2074 int tmp = 120 + creature_ptr->lev*10 - wilderness[creature_ptr->y][creature_ptr->x].level + 5;
2077 if (((wilderness[creature_ptr->y][creature_ptr->x].level + 5) > (creature_ptr->lev / 2)) && randint0(tmp) < (21-creature_ptr->skill_stl))
2079 /* Inform the player of his horrible fate :=) */
2080 msg_print(_("襲撃だ!", "You are ambushed !"));
2082 /* Go into large wilderness view */
2083 creature_ptr->oldpy = randint1(MAX_HGT-2);
2084 creature_ptr->oldpx = randint1(MAX_WID-2);
2085 change_wild_mode(TRUE);
2087 /* Give first move to monsters */
2088 take_turn(creature_ptr, 100);
2093 /* Cancel repeat unless we may continue */
2094 if (!more) disturb(FALSE, FALSE);
2099 * @brief 「走る」動作コマンドのメインルーチン /
2103 void do_cmd_run(player_type *creature_ptr)
2106 if (cmd_limit_confused(creature_ptr)) return;
2108 if (creature_ptr->special_defense & KATA_MUSOU)
2110 set_action(creature_ptr, ACTION_NONE);
2113 /* Get a "repeated" direction */
2114 if (get_rep_dir(&dir,FALSE))
2116 /* Hack -- Set the run counter */
2117 creature_ptr->running = (command_arg ? command_arg : 1000);
2126 * @brief 「留まる」動作コマンドのメインルーチン /
2127 * Stay still. Search. Enter stores.
2128 * Pick up treasure if "pickup" is true.
2129 * @param pickup アイテムの自動拾いを行うならTRUE
2132 void do_cmd_stay(player_type *creature_ptr, bool pickup)
2134 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2136 /* Allow repeated command */
2139 /* Set repeat count */
2140 command_rep = command_arg - 1;
2141 creature_ptr->redraw |= (PR_STATE);
2143 /* Cancel the arg */
2147 take_turn(creature_ptr, 100);
2149 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2150 (void)move_player_effect(creature_ptr, creature_ptr->y, creature_ptr->x, mpe_mode);
2155 * @brief 「休む」動作コマンドのメインルーチン /
2156 * Resting allows a player to safely restore his hp -RAK-
2159 void do_cmd_rest(player_type *creature_ptr)
2162 set_action(creature_ptr, ACTION_NONE);
2164 if ((creature_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(creature_ptr) || INTERUPTING_SONG_EFFECT(creature_ptr)))
2166 stop_singing(creature_ptr);
2169 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all();
2171 /* Prompt for time if needed */
2172 if (command_arg <= 0)
2174 concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ",
2175 "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
2181 strcpy(out_val, "&");
2183 /* Ask for duration */
2184 if (!get_string(p, out_val, 4)) return;
2186 /* Rest until done */
2187 if (out_val[0] == '&')
2189 command_arg = COMMAND_ARG_REST_UNTIL_DONE;
2193 else if (out_val[0] == '*')
2195 command_arg = COMMAND_ARG_REST_FULL_HEALING;
2201 command_arg = (COMMAND_ARG)atoi(out_val);
2202 if (command_arg <= 0) return;
2206 if (command_arg > 9999) command_arg = 9999;
2208 if (creature_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(creature_ptr, FALSE);
2210 /* Take a current_world_ptr->game_turn (?) */
2211 take_turn(creature_ptr, 100);
2213 /* The sin of sloth */
2214 if (command_arg > 100) chg_virtue(creature_ptr, V_DILIGENCE, -1);
2216 /* Why are you sleeping when there's no need? WAKE UP!*/
2217 if ((creature_ptr->chp == creature_ptr->mhp) &&
2218 (creature_ptr->csp == creature_ptr->msp) &&
2219 !creature_ptr->blind && !creature_ptr->confused &&
2220 !creature_ptr->poisoned && !creature_ptr->afraid &&
2221 !creature_ptr->stun && !creature_ptr->cut &&
2222 !creature_ptr->slow && !creature_ptr->paralyzed &&
2223 !creature_ptr->image && !creature_ptr->word_recall &&
2224 !creature_ptr->alter_reality)
2225 chg_virtue(creature_ptr, V_DILIGENCE, -1);
2227 /* Save the rest code */
2228 creature_ptr->resting = command_arg;
2229 creature_ptr->action = ACTION_REST;
2230 creature_ptr->update |= (PU_BONUS);
2231 update_creature(creature_ptr);
2233 creature_ptr->redraw |= (PR_STATE);
2242 * @brief 射撃処理のメインルーチン
2245 void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type)
2248 object_type *j_ptr, *ammo_ptr;
2251 if(creature_ptr->wild_mode) return;
2253 creature_ptr->is_fired = FALSE; /* not fired yet */
2255 /* Get the "bow" (if any) */
2256 j_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2258 /* Require a launcher */
2261 msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
2266 if (j_ptr->sval == SV_CRIMSON)
2268 msg_print(_("この武器は発動して使うもののようだ。", "Do activate."));
2273 if (j_ptr->sval == SV_HARP)
2275 msg_print(_("この武器で射撃はできない。", "It's not for firing."));
2281 if (creature_ptr->special_defense & KATA_MUSOU)
2283 set_action(creature_ptr, ACTION_NONE);
2286 q = _("どれを撃ちますか? ", "Fire which item? ");
2287 s = _("発射されるアイテムがありません。", "You have nothing to fire.");
2289 ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), creature_ptr->tval_ammo);
2297 exe_fire(item, j_ptr, snipe_type);
2299 if (!creature_ptr->is_fired || creature_ptr->pclass != CLASS_SNIPER) return;
2301 /* Sniper actions after some shootings */
2302 if (snipe_type == SP_AWAY)
2304 teleport_player(10 + (creature_ptr->concent * 2), 0L);
2306 if (snipe_type == SP_FINAL)
2308 msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
2309 (void)set_slow(creature_ptr, creature_ptr->slow + randint0(7) + 7, FALSE);
2310 (void)set_stun(creature_ptr, creature_ptr->stun + randint1(25));
2316 * @brief 投射処理メインルーチン /
2317 * Throw an object from the pack or floor.
2319 * @param boomerang ブーメラン処理ならばTRUE
2320 * @param shuriken 忍者の手裏剣処理ならばTRUE
2321 * @return ターンを消費した場合TRUEを返す
2324 * Note: "unseen" monsters are very hard to hit.
2326 * Should throwing a weapon do full damage? Should it allow the magic
2327 * to hit bonus of the weapon to have an effect? Should it ever cause
2328 * the item to be destroyed? Should it do any damage at all?
2331 bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_IDX shuriken)
2336 POSITION y, x, ty, tx, prev_y, prev_x;
2337 POSITION ny[19], nx[19];
2338 int chance, tdam, tdis;
2339 int mul, div, dd, ds;
2340 int cur_dis, visible;
2347 bool hit_body = FALSE;
2348 bool hit_wall = FALSE;
2349 bool equiped_item = FALSE;
2350 bool return_when_thrown = FALSE;
2352 GAME_TEXT o_name[MAX_NLEN];
2354 int msec = delay_factor * delay_factor * delay_factor;
2356 BIT_FLAGS flgs[TR_FLAG_SIZE];
2358 bool come_back = FALSE;
2359 bool do_drop = TRUE;
2361 if (creature_ptr->wild_mode) return FALSE;
2363 if (creature_ptr->special_defense & KATA_MUSOU)
2365 set_action(creature_ptr, ACTION_NONE);
2371 o_ptr = &creature_ptr->inventory_list[item];
2375 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2377 item_tester_hook = item_tester_hook_boomerang;
2378 q = _("どの武器を投げますか? ", "Throw which item? ");
2379 s = _("投げる武器がない。", "You have nothing to throw.");
2380 o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0);
2387 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2390 o_ptr = &creature_ptr->inventory_list[item];
2395 o_ptr = &creature_ptr->inventory_list[item];
2400 q = _("どのアイテムを投げますか? ", "Throw which item? ");
2401 s = _("投げるアイテムがない。", "You have nothing to throw.");
2402 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP), 0);
2410 /* Item is cursed */
2411 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
2413 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
2417 if (creature_ptr->inside_arena && !boomerang)
2419 if (o_ptr->tval != TV_SPIKE)
2421 msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
2429 object_copy(q_ptr, o_ptr);
2431 /* Extract the thrown object's flags. */
2432 object_flags(q_ptr, flgs);
2433 torch_flags(q_ptr, flgs);
2435 /* Distribute the charges of rods/wands between the stacks */
2436 distribute_charges(o_ptr, q_ptr, 1);
2441 object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
2443 if (creature_ptr->mighty_throw) mult += 3;
2445 /* Extract a "distance multiplier" */
2446 /* Changed for 'launcher' mutation */
2447 mul = 10 + 2 * (mult - 1);
2449 /* Enforce a minimum "weight" of one pound */
2450 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
2451 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
2453 /* Hack -- Distance -- Reward strength, penalize weight */
2454 tdis = (adj_str_blow[creature_ptr->stat_ind[A_STR]] + 20) * mul / div;
2456 /* Max distance of 10-18 */
2457 if (tdis > mul) tdis = mul;
2461 ty = randint0(101) - 50 + creature_ptr->y;
2462 tx = randint0(101) - 50 + creature_ptr->x;
2466 project_length = tdis + 1;
2468 /* Get a direction (or cancel) */
2469 if (!get_aim_dir(&dir)) return FALSE;
2471 /* Predict the "target" location */
2472 tx = creature_ptr->x + 99 * ddx[dir];
2473 ty = creature_ptr->y + 99 * ddy[dir];
2475 /* Check for "target request" */
2476 if ((dir == 5) && target_okay())
2482 project_length = 0; /* reset to default */
2485 if ((q_ptr->name1 == ART_MJOLLNIR) ||
2486 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
2487 return_when_thrown = TRUE;
2489 /* Reduce and describe creature_ptr->inventory_list */
2492 inven_item_increase(item, -1);
2493 if (!return_when_thrown)
2494 inven_item_describe(item);
2495 inven_item_optimize(item);
2498 /* Reduce and describe floor item */
2501 floor_item_increase(0 - item, -1);
2502 floor_item_optimize(0 - item);
2504 if (item >= INVEN_RARM)
2506 equiped_item = TRUE;
2507 creature_ptr->redraw |= (PR_EQUIPPY);
2510 take_turn(creature_ptr, 100);
2512 /* Rogue and Ninja gets bonus */
2513 if ((creature_ptr->pclass == CLASS_ROGUE) || (creature_ptr->pclass == CLASS_NINJA))
2514 creature_ptr->energy_use -= creature_ptr->lev;
2516 /* Start at the player */
2517 y = creature_ptr->y;
2518 x = creature_ptr->x;
2522 if ((creature_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
2523 else shuriken = FALSE;
2525 /* Chance of hitting */
2526 if (have_flag(flgs, TR_THROW)) chance = ((creature_ptr->skill_tht) +
2527 ((creature_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
2528 else chance = (creature_ptr->skill_tht + (creature_ptr->to_h_b * BTH_PLUS_ADJ));
2530 if (shuriken) chance *= 2;
2535 /* Travel until stopped */
2536 for (cur_dis = 0; cur_dis <= tdis; )
2538 /* Hack -- Stop at the target */
2539 if ((y == ty) && (x == tx)) break;
2541 /* Calculate the new location (see "project()") */
2544 mmove2(&ny[cur_dis], &nx[cur_dis], creature_ptr->y, creature_ptr->x, ty, tx);
2546 /* Stopped by walls/doors */
2547 if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
2550 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
2553 /* The player can see the (on screen) missile */
2554 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
2556 SYMBOL_CODE c = object_char(q_ptr);
2557 TERM_COLOR a = object_attr(q_ptr);
2559 /* Draw, Hilite, Fresh, Pause, Erase */
2560 print_rel(c, a, ny[cur_dis], nx[cur_dis]);
2561 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
2563 Term_xtra(TERM_XTRA_DELAY, msec);
2564 lite_spot(ny[cur_dis], nx[cur_dis]);
2568 /* The player cannot see the missile */
2571 /* Pause anyway, for consistancy */
2572 Term_xtra(TERM_XTRA_DELAY, msec);
2578 /* Save the new location */
2582 /* Advance the distance */
2585 /* Monster here, Try to hit it */
2586 if (current_floor_ptr->grid_array[y][x].m_idx)
2588 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2589 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2590 GAME_TEXT m_name[MAX_NLEN];
2591 monster_name(g_ptr->m_idx, m_name);
2593 /* Check the visibility */
2594 visible = m_ptr->ml;
2596 /* Note the collision */
2599 /* Did we hit it (penalize range) */
2600 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
2604 /* Handle unseen monster */
2607 /* Invisible monster */
2608 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
2611 /* Handle visible monster */
2614 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
2618 if (!creature_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2619 health_track(g_ptr->m_idx);
2623 /* Hack -- Base damage from thrown object */
2626 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
2627 tdam = damroll(dd, ds);
2628 /* Apply special damage */
2629 tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
2630 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
2631 if (q_ptr->to_d > 0)
2632 tdam += q_ptr->to_d;
2634 tdam += -q_ptr->to_d;
2638 tdam *= (mult+creature_ptr->num_blow[item - INVEN_RARM]);
2639 tdam += creature_ptr->to_d_m;
2641 else if (have_flag(flgs, TR_THROW))
2644 tdam += creature_ptr->to_d_m;
2652 tdam += ((creature_ptr->lev+30)*(creature_ptr->lev+30)-900)/55;
2655 /* No negative damage */
2656 if (tdam < 0) tdam = 0;
2658 /* Modify the damage */
2659 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
2661 msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
2662 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
2664 /* Hit the monster, check for death */
2665 if (mon_take_hit(g_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
2673 message_pain(g_ptr->m_idx, tdam);
2675 /* Anger the monster */
2676 if ((tdam > 0) && !object_is_potion(q_ptr))
2677 anger_monster(m_ptr);
2679 if (fear && m_ptr->ml)
2682 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2692 /* decrease toach's fuel */
2693 if (hit_body) torch_lost_fuel(q_ptr);
2695 /* Chance of breakage (during attacks) */
2696 j = (hit_body ? breakage_chance(q_ptr, creature_ptr->pclass == CLASS_ARCHER, 0) : 0);
2698 /* Figurines transform */
2699 if ((q_ptr->tval == TV_FIGURINE) && !(creature_ptr->inside_arena))
2703 if (!(summon_named_creature(0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
2704 msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
2705 else if (object_is_cursed(q_ptr))
2706 msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
2710 /* Potions smash open */
2711 if (object_is_potion(q_ptr))
2713 if (hit_body || hit_wall || (randint1(100) < j))
2715 msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
2717 if (potion_smash_effect(0, y, x, q_ptr->k_idx))
2719 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
2720 if (current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !MON_INVULNER(m_ptr))
2722 GAME_TEXT m_name[MAX_NLEN];
2723 monster_desc(m_name, m_ptr, 0);
2724 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
2725 set_hostile(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]);
2736 if (return_when_thrown)
2738 int back_chance = randint1(30)+20+((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2739 char o2_name[MAX_NLEN];
2740 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
2743 if (boomerang) back_chance += 4+randint1(5);
2744 if (super_boomerang) back_chance += 100;
2745 object_desc(o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2747 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
2749 for (i = cur_dis - 1; i > 0; i--)
2751 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
2753 char c = object_char(q_ptr);
2754 byte a = object_attr(q_ptr);
2756 /* Draw, Hilite, Fresh, Pause, Erase */
2757 print_rel(c, a, ny[i], nx[i]);
2758 move_cursor_relative(ny[i], nx[i]);
2760 Term_xtra(TERM_XTRA_DELAY, msec);
2761 lite_spot(ny[i], nx[i]);
2766 /* Pause anyway, for consistancy */
2767 Term_xtra(TERM_XTRA_DELAY, msec);
2770 if((back_chance > 37) && !creature_ptr->blind && (item >= 0))
2772 msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
2779 msg_format(_("%sを受け損ねた!", "%s backs, but you can't catch!"), o2_name);
2783 msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
2785 y = creature_ptr->y;
2786 x = creature_ptr->x;
2791 msg_format(_("%sが返ってこなかった!", "%s doesn't back!"), o2_name);
2797 if (item == INVEN_RARM || item == INVEN_LARM)
2799 /* Access the wield slot */
2800 o_ptr = &creature_ptr->inventory_list[item];
2802 /* Wear the new stuff */
2803 object_copy(o_ptr, q_ptr);
2805 creature_ptr->total_weight += q_ptr->weight;
2807 /* Increment the equip counter by hand */
2808 creature_ptr->equip_cnt++;
2810 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
2811 creature_ptr->window |= (PW_EQUIP);
2819 else if (equiped_item)
2822 calc_android_exp(creature_ptr);
2827 if (cave_have_flag_bold(y, x, FF_PROJECT))
2829 (void)drop_near(q_ptr, j, y, x);
2833 (void)drop_near(q_ptr, j, prev_y, prev_x);
2841 * @brief 自殺するコマンドのメインルーチン
2842 * Hack -- commit suicide
2846 void do_cmd_suicide(player_type *creature_ptr)
2853 /* Verify Retirement */
2854 if (creature_ptr->total_winner)
2857 if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
2860 /* Verify Suicide */
2864 if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
2868 if (!creature_ptr->noscore)
2870 /* Special Verification for suicide */
2871 prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
2876 if (i != '@') return;
2878 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
2881 /* Initialize "last message" buffer */
2882 if (creature_ptr->last_message) string_free(creature_ptr->last_message);
2883 creature_ptr->last_message = NULL;
2885 /* Hack -- Note *winning* message */
2886 if (creature_ptr->total_winner && last_words)
2888 char buf[1024] = "";
2889 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
2892 while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
2893 } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
2897 creature_ptr->last_message = string_make(buf);
2898 msg_print(creature_ptr->last_message);
2903 creature_ptr->playing = FALSE;
2905 /* Kill the player */
2906 creature_ptr->is_dead = TRUE;
2907 creature_ptr->leaving = TRUE;
2909 if (!creature_ptr->total_winner)
2911 exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
2912 exe_write_diary(creature_ptr, NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
2913 exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 1, "\n\n\n\n");
2916 /* Cause of death */
2917 (void)strcpy(creature_ptr->died_from, _("途中終了", "Quitting"));