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.
17 #include "object-hook.h"
18 #include "projection.h"
19 #include "spells-summon.h"
20 #include "spells-status.h"
21 #include "monster-status.h"
25 #include "player-status.h"
26 #include "realm-hex.h"
29 * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
30 * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
31 * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
33 bool confirm_leave_level(bool down_stair)
35 quest_type *q_ptr = &quest[p_ptr->inside_quest];
37 /* Confirm leaving from once only quest */
38 if (confirm_quest && p_ptr->inside_quest &&
39 (q_ptr->type == QUEST_TYPE_RANDOM ||
40 (q_ptr->flags & QUEST_FLAG_ONCE &&
41 q_ptr->status != QUEST_STATUS_COMPLETED) ||
42 (q_ptr->flags & QUEST_FLAG_TOWER &&
43 ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
44 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
46 msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
47 if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
57 bool cmd_limit_confused(player_type *creature_ptr)
61 msg_print(_("混乱していてできない!", "You are too confused!"));
67 bool cmd_limit_arena(player_type *creature_ptr)
69 if (p_ptr->inside_arena)
71 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
78 bool cmd_limit_time_walk(player_type *creature_ptr)
82 if (flush_failure) flush();
83 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
91 * @brief 階段を使って階層を昇る処理 / Go up one level
94 void do_cmd_go_up(void)
99 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
100 feature_type *f_ptr = &f_info[c_ptr->feat];
104 if (p_ptr->special_defense & KATA_MUSOU)
106 set_action(ACTION_NONE);
110 if (!have_flag(f_ptr->flags, FF_LESS))
112 msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
116 /* Quest up stairs */
117 if (have_flag(f_ptr->flags, FF_QUEST))
119 /* Cancel the command */
120 if (!confirm_leave_level(FALSE)) return;
124 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
125 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
127 msg_print(_("上の階に登った。", "You enter the up staircase."));
131 p_ptr->inside_quest = c_ptr->special;
133 /* Activate the quest */
134 if (!quest[p_ptr->inside_quest].status)
136 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
138 init_flags = INIT_ASSIGN;
139 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
141 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
144 /* Leaving a quest */
145 if (!p_ptr->inside_quest)
151 p_ptr->leaving = TRUE;
156 /* Hack -- take a turn */
157 p_ptr->energy_use = 100;
159 /* End the command */
169 go_up = confirm_leave_level(FALSE);
172 /* Cancel the command */
175 /* Hack -- take a turn */
176 p_ptr->energy_use = 100;
178 if (autosave_l) do_cmd_save_game(TRUE);
180 /* For a random quest */
181 if (p_ptr->inside_quest &&
182 quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
186 p_ptr->inside_quest = 0;
189 /* For a fixed quest */
190 if (p_ptr->inside_quest &&
191 quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
195 p_ptr->inside_quest = c_ptr->special;
200 /* For normal dungeon and random quest */
204 if (have_flag(f_ptr->flags, FF_SHAFT))
206 /* Create a way back */
207 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
213 /* Create a way back */
214 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
219 /* Get out from current dungeon */
220 if (dun_level - up_num < d_info[dungeon_type].mindepth)
223 if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
226 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
227 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
228 else if (up_num == dun_level)
229 msg_print(_("地上に戻った。", "You go back to the surface."));
231 msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
234 p_ptr->leaving = TRUE;
239 * @brief 階段を使って階層を降りる処理 / Go down one level
242 void do_cmd_go_down(void)
245 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
246 feature_type *f_ptr = &f_info[c_ptr->feat];
248 bool fall_trap = FALSE;
251 if (p_ptr->special_defense & KATA_MUSOU)
253 set_action(ACTION_NONE);
257 if (!have_flag(f_ptr->flags, FF_MORE))
259 msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
263 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
266 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
271 /* Quest down stairs */
272 else if (have_flag(f_ptr->flags, FF_QUEST))
274 /* Confirm Leaving */
275 if(!confirm_leave_level(TRUE)) return;
277 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
278 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
280 msg_print(_("下の階に降りた。", "You enter the down staircase."));
285 p_ptr->inside_quest = c_ptr->special;
287 /* Activate the quest */
288 if (!quest[p_ptr->inside_quest].status)
290 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
292 init_flags = INIT_ASSIGN;
293 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
295 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
298 /* Leaving a quest */
299 if (!p_ptr->inside_quest)
305 p_ptr->leaving = TRUE;
311 /* Hack -- take a turn */
312 p_ptr->energy_use = 100;
317 DUNGEON_IDX target_dungeon = 0;
321 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
323 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
325 msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
328 if (!max_dlv[target_dungeon])
330 msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
331 d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
332 if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
335 /* Save old player position */
336 p_ptr->oldpx = p_ptr->x;
337 p_ptr->oldpy = p_ptr->y;
338 dungeon_type = target_dungeon;
341 * Clear all saved floors
342 * and create a first saved floor
344 prepare_change_floor_mode(CFM_FIRST_FLOOR);
347 /* Hack -- take a turn */
348 p_ptr->energy_use = 100;
350 if (autosave_l) do_cmd_save_game(TRUE);
353 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
358 /* Enter the dungeon just now */
359 p_ptr->enter_dungeon = TRUE;
360 down_num = d_info[dungeon_type].mindepth;
365 if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
366 else do_cmd_write_nikki(NIKKI_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
371 msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
378 msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[dungeon_type].text);
382 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
383 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
385 msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
391 p_ptr->leaving = TRUE;
395 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
399 if (have_flag(f_ptr->flags, FF_SHAFT))
401 /* Create a way back */
402 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
406 /* Create a way back */
407 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
415 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
418 void do_cmd_search(void)
420 /* Allow repeated command */
423 /* Set repeat count */
424 command_rep = command_arg - 1;
425 p_ptr->redraw |= (PR_STATE);
430 p_ptr->energy_use = 100;
438 * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
439 * @param y 走査対象にしたいマスのY座標
440 * @param x 走査対象にしたいマスのX座標
441 * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
442 * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
444 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
446 cave_type *c_ptr = &cave[y][x];
447 OBJECT_IDX this_o_idx, next_o_idx = 0;
449 /* Scan all objects in the grid */
450 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
454 o_ptr = &o_list[this_o_idx];
455 next_o_idx = o_ptr->next_o_idx;
457 /* Skip unknown chests XXX XXX */
458 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
460 /* Check for non empty chest */
461 if ((o_ptr->tval == TV_CHEST) &&
462 (((!trapped) && (o_ptr->pval)) || /* non empty */
463 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
472 * @brief 箱を開けるコマンドのメインルーチン /
473 * Attempt to open the given chest at the given location
474 * @param y 箱の存在するマスのY座標
475 * @param x 箱の存在するマスのX座標
476 * @param o_idx 箱のオブジェクトID
477 * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
479 * Assume there is no monster blocking the destination
481 static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
486 object_type *o_ptr = &o_list[o_idx];
488 p_ptr->energy_use = 100;
490 /* Attempt to unlock it */
493 /* Assume locked, and thus not open */
496 /* Get the "disarm" factor */
497 i = p_ptr->skill_dis;
499 /* Penalize some conditions */
500 if (p_ptr->blind || no_lite()) i = i / 10;
501 if (p_ptr->confused || p_ptr->image) i = i / 10;
503 /* Extract the difficulty */
506 /* Always have a small chance of success */
509 /* Success -- May still have traps */
510 if (randint0(100) < j)
512 msg_print(_("鍵をはずした。", "You have picked the lock."));
517 /* Failure -- Keep trying */
520 /* We may continue repeating */
522 if (flush_failure) flush();
523 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
528 /* Allowed to open */
531 /* Apply chest traps, if any */
532 chest_trap(y, x, o_idx);
534 /* Let the Chest drop items */
535 chest_death(FALSE, y, x, o_idx);
541 * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
542 * Attempt to open the given chest at the given location
543 * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
544 * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
545 * @param test 地形条件を判定するための関数ポインタ
546 * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
548 * @details Return the number of features around (or under) the character.
549 * Usually look for doors and floor traps.
551 static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under)
553 int d, count, xx, yy;
555 /* Count how many matches */
558 /* Check around (and under) the character */
559 for (d = 0; d < 9; d++)
564 /* if not searching under player continue */
565 if ((d == 8) && !under) continue;
567 /* Extract adjacent (legal) location */
568 yy = p_ptr->y + ddy_ddd[d];
569 xx = p_ptr->x + ddx_ddd[d];
572 c_ptr = &cave[yy][xx];
574 /* Must have knowledge */
575 if (!(c_ptr->info & (CAVE_MARK))) continue;
577 /* Feature code (applying "mimic" field) */
578 feat = get_feat_mimic(c_ptr);
580 /* Not looking for this feature */
581 if (!((*test)(feat))) continue;
586 /* Remember the location. Only useful if only one match */
597 * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
598 * Return the number of chests around (or under) the character.
599 * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
600 * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
601 * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
604 * If requested, count only trapped chests.
606 static int count_chests(POSITION *y, POSITION *x, bool trapped)
613 /* Count how many matches */
616 /* Check around (and under) the character */
617 for (d = 0; d < 9; d++)
619 /* Extract adjacent (legal) location */
620 POSITION yy = p_ptr->y + ddy_ddd[d];
621 POSITION xx = p_ptr->x + ddx_ddd[d];
623 /* No (visible) chest is there */
624 if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
626 /* Grab the object */
627 o_ptr = &o_list[o_idx];
630 if (o_ptr->pval == 0) continue;
632 /* No (known) traps here */
633 if (trapped && (!object_is_known(o_ptr) ||
634 !chest_traps[o_ptr->pval])) continue;
639 /* Remember the location. Only useful if only one match */
650 * @brief プレイヤーから指定の座標がどの方角にあるかを返す /
651 * Convert an adjacent location to a direction.
652 * @param y 方角を確認したY座標
653 * @param x 方角を確認したX座標
656 static DIRECTION coords_to_dir(POSITION y, POSITION x)
658 int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
665 if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
667 return d[dx + 1][dy + 1];
671 * @brief 「開ける」動作コマンドのサブルーチン /
672 * Perform the basic "open" command on doors
673 * @param y 対象を行うマスのY座標
674 * @param x 対象を行うマスのX座標
675 * @return 実際に処理が行われた場合TRUEを返す。
677 * Assume destination is a closed/locked/jammed door
678 * Assume there is no monster blocking the destination
679 * Returns TRUE if repeated commands may continue
681 static bool do_cmd_open_aux(POSITION y, POSITION x)
685 /* Get requested grid */
686 cave_type *c_ptr = &cave[y][x];
687 feature_type *f_ptr = &f_info[c_ptr->feat];
690 p_ptr->energy_use = 100;
692 /* Seeing true feature code (ignore mimic) */
695 if (!have_flag(f_ptr->flags, FF_OPEN))
698 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
702 else if (f_ptr->power)
705 i = p_ptr->skill_dis;
707 /* Penalize some conditions */
708 if (p_ptr->blind || no_lite()) i = i / 10;
709 if (p_ptr->confused || p_ptr->image) i = i / 10;
711 /* Extract the lock power */
714 /* Extract the difficulty */
717 /* Always have a small chance of success */
721 if (randint0(100) < j)
723 msg_print(_("鍵をはずした。", "You have picked the lock."));
726 cave_alter_feat(y, x, FF_OPEN);
728 sound(SOUND_OPENDOOR);
738 if (flush_failure) flush();
740 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
742 /* We may keep trying */
751 cave_alter_feat(y, x, FF_OPEN);
753 sound(SOUND_OPENDOOR);
759 * @brief 「開ける」コマンドのメインルーチン /
760 * Open a closed/locked/jammed door or a closed/locked chest.
763 * Unlocking a locked door/chest is worth one experience point.
765 void do_cmd_open(void)
773 if (p_ptr->wild_mode) return;
775 if (p_ptr->special_defense & KATA_MUSOU)
777 set_action(ACTION_NONE);
780 /* Option: Pick a direction */
783 int num_doors, num_chests;
785 /* Count closed doors (locked or jammed) */
786 num_doors = count_dt(&y, &x, is_closed_door, FALSE);
788 /* Count chests (locked) */
789 num_chests = count_chests(&y, &x, FALSE);
791 /* See if only one target */
792 if (num_doors || num_chests)
794 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
796 if (!too_many) command_dir = coords_to_dir(y, x);
800 /* Allow repeated command */
803 /* Set repeat count */
804 command_rep = command_arg - 1;
805 p_ptr->redraw |= (PR_STATE);
811 /* Get a "repeated" direction */
812 if (get_rep_dir(&dir, TRUE))
817 /* Get requested location */
818 y = p_ptr->y + ddy[dir];
819 x = p_ptr->x + ddx[dir];
821 /* Get requested grid */
824 /* Feature code (applying "mimic" field) */
825 feat = get_feat_mimic(c_ptr);
827 /* Check for chest */
828 o_idx = chest_check(y, x, FALSE);
831 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
833 msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
836 /* Monster in the way */
837 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
839 p_ptr->energy_use = 100;
840 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
848 more = do_cmd_open_chest(y, x, o_idx);
855 more = do_cmd_open_aux(y, x);
859 /* Cancel repeat unless we may continue */
860 if (!more) disturb(FALSE, FALSE);
866 * @brief 「閉じる」動作コマンドのサブルーチン /
867 * Perform the basic "close" command
868 * @param y 対象を行うマスのY座標
869 * @param x 対象を行うマスのX座標
870 * @return 実際に処理が行われた場合TRUEを返す。
872 * Assume destination is an open/broken door
873 * Assume there is no monster blocking the destination
874 * Returns TRUE if repeated commands may continue
876 static bool do_cmd_close_aux(POSITION y, POSITION x)
878 cave_type *c_ptr = &cave[y][x];
879 FEAT_IDX old_feat = c_ptr->feat;
882 p_ptr->energy_use = 100;
884 /* Seeing true feature code (ignore mimic) */
887 if (have_flag(f_info[old_feat].flags, FF_CLOSE))
889 s16b closed_feat = feat_state(old_feat, FF_CLOSE);
891 /* Hack -- object in the way */
892 if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
893 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
895 msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
900 cave_alter_feat(y, x, FF_CLOSE);
903 if (old_feat == c_ptr->feat)
905 msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
909 sound(SOUND_SHUTDOOR);
918 * @brief 「閉じる」コマンドのメインルーチン /
919 * Close an open door.
922 * Unlocking a locked door/chest is worth one experience point.
924 void do_cmd_close(void)
931 if (p_ptr->wild_mode) return;
933 if (p_ptr->special_defense & KATA_MUSOU)
935 set_action(ACTION_NONE);
938 /* Option: Pick a direction */
941 /* Count open doors */
942 if (count_dt(&y, &x, is_open, FALSE) == 1)
944 command_dir = coords_to_dir(y, x);
948 /* Allow repeated command */
951 /* Set repeat count */
952 command_rep = command_arg - 1;
953 p_ptr->redraw |= (PR_STATE);
959 /* Get a "repeated" direction */
960 if (get_rep_dir(&dir, FALSE))
965 y = p_ptr->y + ddy[dir];
966 x = p_ptr->x + ddx[dir];
969 /* Feature code (applying "mimic" field) */
970 feat = get_feat_mimic(c_ptr);
972 /* Require open/broken door */
973 if (!have_flag(f_info[feat].flags, FF_CLOSE))
975 msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
978 /* Monster in the way */
979 else if (c_ptr->m_idx)
981 p_ptr->energy_use = 100;
983 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
993 more = do_cmd_close_aux(y, x);
997 /* Cancel repeat unless we may continue */
998 if (!more) disturb(FALSE, FALSE);
1003 * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
1004 * Determine if a given grid may be "tunneled"
1005 * @param y 対象を行うマスのY座標
1006 * @param x 対象を行うマスのX座標
1009 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
1011 cave_type *c_ptr = &cave[y][x];
1013 /* Must have knowledge */
1014 if (!(c_ptr->info & CAVE_MARK))
1016 msg_print(_("そこには何も見当たらない。", "You see nothing there."));
1021 /* Must be a wall/door/etc */
1022 if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
1024 msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
1034 * @brief 「掘る」動作コマンドのサブルーチン /
1035 * Perform the basic "tunnel" command
1036 * @param y 対象を行うマスのY座標
1037 * @param x 対象を行うマスのX座標
1038 * @return 実際に処理が行われた場合TRUEを返す。
1040 * Assumes that no monster is blocking the destination
1041 * Do not use twall anymore
1042 * Returns TRUE if repeated commands may continue
1044 static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
1047 feature_type *f_ptr, *mimic_f_ptr;
1052 /* Verify legality */
1053 if (!do_cmd_tunnel_test(y, x)) return (FALSE);
1055 p_ptr->energy_use = 100;
1058 c_ptr = &cave[y][x];
1059 f_ptr = &f_info[c_ptr->feat];
1060 power = f_ptr->power;
1062 /* Feature code (applying "mimic" field) */
1063 mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
1065 name = f_name + mimic_f_ptr->name;
1069 if (have_flag(f_ptr->flags, FF_PERMANENT))
1072 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1074 msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
1077 /* Map border (mimiccing Permanent wall) */
1080 msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
1085 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1088 if (p_ptr->skill_dig > randint0(20 * power))
1090 msg_format(_("%sをくずした。", "You have removed the %s."), name);
1092 /* Remove the feature */
1093 cave_alter_feat(y, x, FF_TUNNEL);
1095 /* Update some things */
1096 p_ptr->update |= (PU_FLOW);
1100 /* Message, keep digging */
1101 msg_format(_("%sをくずしている。", "You dig into the %s."), name);
1109 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1112 if (p_ptr->skill_dig > power + randint0(40 * power))
1114 if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
1117 msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
1118 p_ptr->update |= (PU_FLOW);
1121 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1123 /* Remove the feature */
1124 cave_alter_feat(y, x, FF_TUNNEL);
1126 chg_virtue(V_DILIGENCE, 1);
1127 chg_virtue(V_NATURE, -1);
1135 /* We may continue chopping */
1136 msg_format(_("%sを切っている。", "You chop away at the %s."), name);
1137 /* Occasional Search XXX XXX */
1138 if (randint0(100) < 25) search();
1142 /* We may continue tunelling */
1143 msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
1150 if (is_hidden_door(c_ptr))
1152 /* Occasional Search XXX XXX */
1153 if (randint0(100) < 25) search();
1160 * @brief 「掘る」動作コマンドのメインルーチン /
1161 * Tunnels through "walls" (including rubble and closed doors)
1165 * Note that you must tunnel in order to hit invisible monsters
1166 * in walls, though moving into walls still takes a turn anyway.
1168 * Digging is very difficult without a "digger" weapon, but can be
1169 * accomplished by strong players using heavy weapons.
1172 void do_cmd_tunnel(void)
1182 if (p_ptr->special_defense & KATA_MUSOU)
1184 set_action(ACTION_NONE);
1187 /* Allow repeated command */
1190 /* Set repeat count */
1191 command_rep = command_arg - 1;
1192 p_ptr->redraw |= (PR_STATE);
1194 /* Cancel the arg */
1198 /* Get a direction to tunnel, or Abort */
1199 if (get_rep_dir(&dir,FALSE))
1202 y = p_ptr->y + ddy[dir];
1203 x = p_ptr->x + ddx[dir];
1206 c_ptr = &cave[y][x];
1208 /* Feature code (applying "mimic" field) */
1209 feat = get_feat_mimic(c_ptr);
1211 /* No tunnelling through doors */
1212 if (have_flag(f_info[feat].flags, FF_DOOR))
1214 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
1217 /* No tunnelling through most features */
1218 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1220 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
1223 /* A monster is in the way */
1224 else if (c_ptr->m_idx)
1226 p_ptr->energy_use = 100;
1228 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1237 /* Tunnel through walls */
1238 more = do_cmd_tunnel_aux(y, x);
1242 /* Cancel repetition unless we can continue */
1243 if (!more) disturb(FALSE, FALSE);
1247 * @brief 移動処理による簡易な「開く」処理 /
1249 * @return 開く処理が実際に試みられた場合TRUEを返す
1252 * If there is a jammed/closed/locked door at the given location,
1253 * then attempt to unlock/open it. Return TRUE if an attempt was
1254 * made (successful or not), otherwise return FALSE.
1256 * The code here should be nearly identical to that in
1257 * do_cmd_open_test() and do_cmd_open_aux().
1260 bool easy_open_door(POSITION y, POSITION x)
1264 cave_type *c_ptr = &cave[y][x];
1265 feature_type *f_ptr = &f_info[c_ptr->feat];
1267 /* Must be a closed door */
1268 if (!is_closed_door(c_ptr->feat))
1274 if (!have_flag(f_ptr->flags, FF_OPEN))
1277 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
1282 else if (f_ptr->power)
1285 i = p_ptr->skill_dis;
1287 /* Penalize some conditions */
1288 if (p_ptr->blind || no_lite()) i = i / 10;
1289 if (p_ptr->confused || p_ptr->image) i = i / 10;
1291 /* Extract the lock power */
1294 /* Extract the difficulty */
1297 /* Always have a small chance of success */
1301 if (randint0(100) < j)
1303 msg_print(_("鍵をはずした。", "You have picked the lock."));
1306 cave_alter_feat(y, x, FF_OPEN);
1308 sound(SOUND_OPENDOOR);
1318 if (flush_failure) flush();
1320 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
1329 cave_alter_feat(y, x, FF_OPEN);
1331 sound(SOUND_OPENDOOR);
1337 * @brief 箱のトラップを解除するコマンドのメインルーチン /
1338 * Perform the basic "disarm" command
1339 * @param y 解除を行うマスのY座標
1340 * @param x 解除を行うマスのX座標
1341 * @param o_idx 箱のオブジェクトID
1342 * @return ターンを消費する処理が行われた場合TRUEを返す
1345 * Assume destination is a visible trap
1346 * Assume there is no monster blocking the destination
1347 * Returns TRUE if repeated commands may continue
1350 static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
1354 object_type *o_ptr = &o_list[o_idx];
1356 p_ptr->energy_use = 100;
1358 /* Get the "disarm" factor */
1359 i = p_ptr->skill_dis;
1361 /* Penalize some conditions */
1362 if (p_ptr->blind || no_lite()) i = i / 10;
1363 if (p_ptr->confused || p_ptr->image) i = i / 10;
1365 /* Extract the difficulty */
1366 j = i - o_ptr->pval;
1368 /* Always have a small chance of success */
1371 /* Must find the trap first. */
1372 if (!object_is_known(o_ptr))
1374 msg_print(_("トラップが見あたらない。", "I don't see any traps."));
1378 /* Already disarmed/unlocked */
1379 else if (o_ptr->pval <= 0)
1381 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1384 /* No traps to find. */
1385 else if (!chest_traps[o_ptr->pval])
1387 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1390 /* Success (get a lot of experience) */
1391 else if (randint0(100) < j)
1393 msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
1394 gain_exp(o_ptr->pval);
1395 o_ptr->pval = (0 - o_ptr->pval);
1398 /* Failure -- Keep trying */
1399 else if ((i > 5) && (randint1(i) > 5))
1401 /* We may keep trying */
1403 if (flush_failure) flush();
1404 msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
1407 /* Failure -- Set off the trap */
1410 msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
1412 chest_trap(y, x, o_idx);
1419 * @brief 箱のトラップを解除するコマンドのサブルーチン /
1420 * Perform the basic "disarm" command
1421 * @param y 解除を行うマスのY座標
1422 * @param x 解除を行うマスのX座標
1423 * @param dir プレイヤーからみた方向ID
1424 * @return ターンを消費する処理が行われた場合TRUEを返す
1427 * Assume destination is a visible trap
1428 * Assume there is no monster blocking the destination
1429 * Returns TRUE if repeated commands may continue
1433 bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
1435 cave_type *c_ptr = &cave[y][x];
1438 feature_type *f_ptr = &f_info[c_ptr->feat];
1440 /* Access trap name */
1441 concptr name = (f_name + f_ptr->name);
1443 /* Extract trap "power" */
1444 int power = f_ptr->power;
1447 /* Get the "disarm" factor */
1448 int i = p_ptr->skill_dis;
1451 p_ptr->energy_use = 100;
1453 /* Penalize some conditions */
1454 if (p_ptr->blind || no_lite()) i = i / 10;
1455 if (p_ptr->confused || p_ptr->image) i = i / 10;
1457 /* Extract the difficulty */
1460 /* Always have a small chance of success */
1464 if (randint0(100) < j)
1466 msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
1471 /* Remove the trap */
1472 cave_alter_feat(y, x, FF_DISARM);
1474 /* Move the player onto the trap */
1475 move_player(dir, easy_disarm, FALSE);
1478 /* Failure -- Keep trying */
1479 else if ((i > 5) && (randint1(i) > 5))
1482 if (flush_failure) flush();
1484 msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
1486 /* We may keep trying */
1490 /* Failure -- Set off the trap */
1493 msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
1494 /* Move the player onto the trap */
1495 move_player(dir, easy_disarm, FALSE);
1502 * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
1503 * Disarms a trap, or chest
1506 void do_cmd_disarm(void)
1514 if (p_ptr->wild_mode) return;
1516 if (p_ptr->special_defense & KATA_MUSOU)
1518 set_action(ACTION_NONE);
1521 /* Option: Pick a direction */
1524 int num_traps, num_chests;
1526 /* Count visible traps */
1527 num_traps = count_dt(&y, &x, is_trap, TRUE);
1529 /* Count chests (trapped) */
1530 num_chests = count_chests(&y, &x, TRUE);
1532 /* See if only one target */
1533 if (num_traps || num_chests)
1535 bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
1536 if (!too_many) command_dir = coords_to_dir(y, x);
1541 /* Allow repeated command */
1544 /* Set repeat count */
1545 command_rep = command_arg - 1;
1546 p_ptr->redraw |= (PR_STATE);
1548 /* Cancel the arg */
1552 /* Get a direction (or abort) */
1553 if (get_rep_dir(&dir,TRUE))
1558 y = p_ptr->y + ddy[dir];
1559 x = p_ptr->x + ddx[dir];
1560 c_ptr = &cave[y][x];
1562 /* Feature code (applying "mimic" field) */
1563 feat = get_feat_mimic(c_ptr);
1565 /* Check for chests */
1566 o_idx = chest_check(y, x, TRUE);
1569 if (!is_trap(feat) && !o_idx)
1571 msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
1574 /* Monster in the way */
1575 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
1577 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1586 more = do_cmd_disarm_chest(y, x, o_idx);
1592 more = do_cmd_disarm_aux(y, x, dir);
1596 /* Cancel repeat unless told not to */
1597 if (!more) disturb(FALSE, FALSE);
1602 * @brief 「打ち破る」動作コマンドのサブルーチン /
1603 * Perform the basic "bash" command
1604 * @param y 対象を行うマスのY座標
1605 * @param x 対象を行うマスのX座標
1606 * @param dir プレイヤーから見たターゲットの方角ID
1607 * @return 実際に処理が行われた場合TRUEを返す。
1610 * Assume destination is a closed/locked/jammed door
1611 * Assume there is no monster blocking the destination
1612 * Returns TRUE if repeated commands may continue
1615 static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
1618 cave_type *c_ptr = &cave[y][x];
1621 feature_type *f_ptr = &f_info[c_ptr->feat];
1623 /* Hack -- Bash power based on strength */
1624 /* (Ranges from 3 to 20 to 100 to 200) */
1625 int bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
1627 /* Extract door power */
1628 int temp = f_ptr->power;
1632 concptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
1634 p_ptr->energy_use = 100;
1636 msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
1638 /* Compare bash power to door power */
1639 temp = (bash - (temp * 10));
1641 if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
1643 /* Hack -- always have a chance */
1644 if (temp < 1) temp = 1;
1646 /* Hack -- attempt to bash down the door */
1647 if (randint0(100) < temp)
1649 msg_format(_("%sを壊した!", "The %s crashes open!"), name);
1651 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
1653 /* Break down the door */
1654 if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
1656 cave_alter_feat(y, x, FF_BASH);
1662 cave_alter_feat(y, x, FF_OPEN);
1665 /* Hack -- Fall through the door */
1666 move_player(dir, FALSE, FALSE);
1669 /* Saving throw against stun */
1670 else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
1673 msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
1675 /* Allow repeated bashing */
1679 /* High dexterity yields coolness */
1682 msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
1684 /* Hack -- Lose balance ala paralysis */
1685 (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
1692 * @brief 「打ち破る」動作コマンドのメインルーチン /
1693 * Bash open a door, success based on character strength
1697 * For a closed door, pval is positive if locked; negative if stuck.
1699 * For an open door, pval is positive for a broken door.
1701 * A closed door can be opened - harder if locked. Any door might be
1702 * bashed open (and thereby broken). Bashing a door is (potentially)
1703 * faster! You move into the door way. To open a stuck door, it must
1704 * be bashed. A closed door can be jammed (see do_cmd_spike()).
1706 * Creatures can also open or bash doors, see elsewhere.
1709 void do_cmd_bash(void)
1715 if (p_ptr->wild_mode) return;
1717 if (p_ptr->special_defense & KATA_MUSOU)
1719 set_action(ACTION_NONE);
1722 /* Allow repeated command */
1725 /* Set repeat count */
1726 command_rep = command_arg - 1;
1727 p_ptr->redraw |= (PR_STATE);
1729 /* Cancel the arg */
1733 /* Get a "repeated" direction */
1734 if (get_rep_dir(&dir,FALSE))
1739 y = p_ptr->y + ddy[dir];
1740 x = p_ptr->x + ddx[dir];
1743 c_ptr = &cave[y][x];
1745 /* Feature code (applying "mimic" field) */
1746 feat = get_feat_mimic(c_ptr);
1748 /* Nothing useful */
1749 if (!have_flag(f_info[feat].flags, FF_BASH))
1751 msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
1754 /* Monster in the way */
1755 else if (c_ptr->m_idx)
1757 p_ptr->energy_use = 100;
1759 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1765 /* Bash a closed door */
1769 more = do_cmd_bash_aux(y, x, dir);
1773 /* Unless valid action taken, cancel bash */
1774 if (!more) disturb(FALSE, FALSE);
1779 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
1783 * Manipulate an adjacent grid in some way
1785 * Attack monsters, tunnel through walls, disarm traps, open doors.
1787 * Consider confusion
1789 * This command must always take a turn, to prevent free detection
1790 * of invisible monsters.
1793 void do_cmd_alter(void)
1800 if (p_ptr->special_defense & KATA_MUSOU)
1802 set_action(ACTION_NONE);
1805 /* Allow repeated command */
1808 /* Set repeat count */
1809 command_rep = command_arg - 1;
1810 p_ptr->redraw |= (PR_STATE);
1812 /* Cancel the arg */
1816 /* Get a direction */
1817 if (get_rep_dir(&dir,TRUE))
1820 feature_type *f_ptr;
1822 y = p_ptr->y + ddy[dir];
1823 x = p_ptr->x + ddx[dir];
1826 c_ptr = &cave[y][x];
1828 /* Feature code (applying "mimic" field) */
1829 feat = get_feat_mimic(c_ptr);
1830 f_ptr = &f_info[feat];
1832 p_ptr->energy_use = 100;
1840 else if (have_flag(f_ptr->flags, FF_OPEN))
1842 more = do_cmd_open_aux(y, x);
1845 /* Bash jammed doors */
1846 else if (have_flag(f_ptr->flags, FF_BASH))
1848 more = do_cmd_bash_aux(y, x, dir);
1851 /* Tunnel through walls */
1852 else if (have_flag(f_ptr->flags, FF_TUNNEL))
1854 more = do_cmd_tunnel_aux(y, x);
1857 /* Close open doors */
1858 else if (have_flag(f_ptr->flags, FF_CLOSE))
1860 more = do_cmd_close_aux(y, x);
1864 else if (have_flag(f_ptr->flags, FF_DISARM))
1866 more = do_cmd_disarm_aux(y, x, dir);
1871 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
1875 /* Cancel repetition unless we can continue */
1876 if (!more) disturb(FALSE, FALSE);
1882 * @brief 「くさびを打つ」ために必要なオブジェクトがあるかどうかの判定を返す /
1883 * Find the index of some "spikes", if possible.
1884 * @param ip くさびとして打てるオブジェクトのID
1885 * @return オブジェクトがある場合TRUEを返す
1888 * Let user choose a pile of spikes, perhaps?
1891 static bool get_spike(INVENTORY_IDX *ip)
1895 /* Check every item in the pack */
1896 for (i = 0; i < INVEN_PACK; i++)
1898 object_type *o_ptr = &inventory[i];
1900 /* Skip non-objects */
1901 if (!o_ptr->k_idx) continue;
1903 /* Check the "tval" code */
1904 if (o_ptr->tval == TV_SPIKE)
1906 /* Save the spike index */
1919 * @brief 「くさびを打つ」動作コマンドのメインルーチン /
1920 * Jam a closed door with a spike
1924 * This command may NOT be repeated
1927 void do_cmd_spike(void)
1931 if (p_ptr->wild_mode) return;
1933 if (p_ptr->special_defense & KATA_MUSOU)
1935 set_action(ACTION_NONE);
1938 /* Get a "repeated" direction */
1939 if (get_rep_dir(&dir, FALSE))
1946 y = p_ptr->y + ddy[dir];
1947 x = p_ptr->x + ddx[dir];
1948 c_ptr = &cave[y][x];
1950 /* Feature code (applying "mimic" field) */
1951 feat = get_feat_mimic(c_ptr);
1953 /* Require closed door */
1954 if (!have_flag(f_info[feat].flags, FF_SPIKE))
1956 msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
1960 else if (!get_spike(&item))
1962 msg_print(_("くさびを持っていない!", "You have no spikes!"));
1965 /* Is a monster in the way? */
1966 else if (c_ptr->m_idx)
1968 p_ptr->energy_use = 100;
1970 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1979 p_ptr->energy_use = 100;
1981 /* Successful jamming */
1982 msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
1983 cave_alter_feat(y, x, FF_SPIKE);
1985 /* Use up, and describe, a single spike, from the bottom */
1986 inven_item_increase(item, -1);
1987 inven_item_describe(item);
1988 inven_item_optimize(item);
1996 * @brief 「歩く」動作コマンドのメインルーチン /
1997 * Support code for the "Walk" and "Jump" commands
1998 * @param pickup アイテムの自動拾いを行うならTRUE
2001 void do_cmd_walk(bool pickup)
2008 /* Allow repeated command */
2011 /* Set repeat count */
2012 command_rep = command_arg - 1;
2013 p_ptr->redraw |= (PR_STATE);
2015 /* Cancel the arg */
2019 /* Get a "repeated" direction */
2020 if (get_rep_dir(&dir, FALSE))
2022 p_ptr->energy_use = 100;
2024 if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
2026 set_action(ACTION_NONE);
2029 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2030 if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
2031 if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100;
2033 /* Actually move the character */
2034 move_player(dir, pickup, FALSE);
2036 /* Allow more walking */
2040 /* Hack again -- Is there a special encounter ??? */
2041 if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN))
2043 int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5;
2046 if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
2048 /* Inform the player of his horrible fate :=) */
2049 msg_print(_("襲撃だ!", "You are ambushed !"));
2051 /* Go into large wilderness view */
2052 p_ptr->oldpy = randint1(MAX_HGT-2);
2053 p_ptr->oldpx = randint1(MAX_WID-2);
2056 /* Give first move to monsters */
2057 p_ptr->energy_use = 100;
2059 /* HACk -- set the encouter flag for the wilderness generation */
2060 generate_encounter = TRUE;
2064 /* Cancel repeat unless we may continue */
2065 if (!more) disturb(FALSE, FALSE);
2070 * @brief 「走る」動作コマンドのメインルーチン /
2074 void do_cmd_run(void)
2077 if (cmd_limit_confused(p_ptr)) return;
2079 if (p_ptr->special_defense & KATA_MUSOU)
2081 set_action(ACTION_NONE);
2084 /* Get a "repeated" direction */
2085 if (get_rep_dir(&dir,FALSE))
2087 /* Hack -- Set the run counter */
2088 running = (command_arg ? command_arg : 1000);
2097 * @brief 「留まる」動作コマンドのメインルーチン /
2098 * Stay still. Search. Enter stores.
2099 * Pick up treasure if "pickup" is true.
2100 * @param pickup アイテムの自動拾いを行うならTRUE
2103 void do_cmd_stay(bool pickup)
2105 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2107 /* Allow repeated command */
2110 /* Set repeat count */
2111 command_rep = command_arg - 1;
2112 p_ptr->redraw |= (PR_STATE);
2114 /* Cancel the arg */
2118 p_ptr->energy_use = 100;
2120 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2121 (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
2126 * @brief 「休む」動作コマンドのメインルーチン /
2127 * Resting allows a player to safely restore his hp -RAK-
2130 void do_cmd_rest(void)
2133 set_action(ACTION_NONE);
2135 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
2141 if (hex_spelling_any()) stop_hex_spell_all();
2143 /* Prompt for time if needed */
2144 if (command_arg <= 0)
2146 concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ",
2147 "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
2153 strcpy(out_val, "&");
2155 /* Ask for duration */
2156 if (!get_string(p, out_val, 4)) return;
2158 /* Rest until done */
2159 if (out_val[0] == '&')
2161 command_arg = COMMAND_ARG_REST_UNTIL_DONE;
2165 else if (out_val[0] == '*')
2167 command_arg = COMMAND_ARG_REST_FULL_HEALING;
2173 command_arg = (COMMAND_ARG)atoi(out_val);
2174 if (command_arg <= 0) return;
2180 if (command_arg > 9999) command_arg = 9999;
2182 if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
2184 /* Take a turn (?) */
2185 p_ptr->energy_use = 100;
2187 /* The sin of sloth */
2188 if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
2190 /* Why are you sleeping when there's no need? WAKE UP!*/
2191 if ((p_ptr->chp == p_ptr->mhp) &&
2192 (p_ptr->csp == p_ptr->msp) &&
2193 !p_ptr->blind && !p_ptr->confused &&
2194 !p_ptr->poisoned && !p_ptr->afraid &&
2195 !p_ptr->stun && !p_ptr->cut &&
2196 !p_ptr->slow && !p_ptr->paralyzed &&
2197 !p_ptr->image && !p_ptr->word_recall &&
2198 !p_ptr->alter_reality)
2199 chg_virtue(V_DILIGENCE, -1);
2201 /* Save the rest code */
2202 resting = command_arg;
2203 p_ptr->action = ACTION_REST;
2204 p_ptr->update |= (PU_BONUS);
2205 update_creature(p_ptr);
2207 p_ptr->redraw |= (PR_STATE);
2216 * @brief 射撃処理のメインルーチン
2219 void do_cmd_fire(void)
2222 object_type *j_ptr, *ammo_ptr;
2225 if(p_ptr->wild_mode) return;
2227 is_fired = FALSE; /* not fired yet */
2229 /* Get the "bow" (if any) */
2230 j_ptr = &inventory[INVEN_BOW];
2232 /* Require a launcher */
2235 msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
2240 if (j_ptr->sval == SV_CRIMSON)
2242 msg_print(_("この武器は発動して使うもののようだ。", "Do activate."));
2247 if (j_ptr->sval == SV_HARP)
2249 msg_print(_("この武器で射撃はできない。", "It's not for firing."));
2255 if (p_ptr->special_defense & KATA_MUSOU)
2257 set_action(ACTION_NONE);
2260 /* Require proper missile */
2261 item_tester_tval = p_ptr->tval_ammo;
2263 q = _("どれを撃ちますか? ", "Fire which item? ");
2264 s = _("発射されるアイテムがありません。", "You have nothing to fire.");
2267 ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
2275 exe_fire(item, j_ptr);
2277 if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
2279 /* Sniper actions after some shootings */
2280 if (snipe_type == SP_AWAY)
2282 teleport_player(10 + (p_ptr->concent * 2), 0L);
2284 if (snipe_type == SP_FINAL)
2286 msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
2287 (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE);
2288 (void)set_stun(p_ptr->stun + randint1(25));
2294 * @brief 投射処理メインルーチン /
2295 * Throw an object from the pack or floor.
2297 * @param boomerang ブーメラン処理ならばTRUE
2298 * @param shuriken 忍者の手裏剣処理ならばTRUE
2299 * @return ターンを消費した場合TRUEを返す
2302 * Note: "unseen" monsters are very hard to hit.
2304 * Should throwing a weapon do full damage? Should it allow the magic
2305 * to hit bonus of the weapon to have an effect? Should it ever cause
2306 * the item to be destroyed? Should it do any damage at all?
2309 bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
2314 POSITION y, x, ty, tx, prev_y, prev_x;
2315 POSITION ny[19], nx[19];
2316 int chance, tdam, tdis;
2317 int mul, div, dd, ds;
2318 int cur_dis, visible;
2325 bool hit_body = FALSE;
2326 bool hit_wall = FALSE;
2327 bool equiped_item = FALSE;
2328 bool return_when_thrown = FALSE;
2330 GAME_TEXT o_name[MAX_NLEN];
2332 int msec = delay_factor * delay_factor * delay_factor;
2334 BIT_FLAGS flgs[TR_FLAG_SIZE];
2336 bool come_back = FALSE;
2337 bool do_drop = TRUE;
2339 if (p_ptr->wild_mode) return FALSE;
2341 if (p_ptr->special_defense & KATA_MUSOU)
2343 set_action(ACTION_NONE);
2349 o_ptr = &inventory[item];
2353 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
2355 item_tester_hook = item_tester_hook_boomerang;
2356 q = _("どの武器を投げますか? ", "Throw which item? ");
2357 s = _("投げる武器がない。", "You have nothing to throw.");
2358 o_ptr = choose_object(&item, q, s, (USE_EQUIP));
2365 else if (has_melee_weapon(INVEN_LARM))
2368 o_ptr = &inventory[item];
2373 o_ptr = &inventory[item];
2378 q = _("どのアイテムを投げますか? ", "Throw which item? ");
2379 s = _("投げるアイテムがない。", "You have nothing to throw.");
2380 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP));
2388 /* Item is cursed */
2389 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
2391 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
2396 if (p_ptr->inside_arena && !boomerang)
2398 if (o_ptr->tval != TV_SPIKE)
2400 msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
2409 /* Obtain a local object */
2410 object_copy(q_ptr, o_ptr);
2412 /* Extract the thrown object's flags. */
2413 object_flags(q_ptr, flgs);
2414 torch_flags(q_ptr, flgs);
2416 /* Distribute the charges of rods/wands between the stacks */
2417 distribute_charges(o_ptr, q_ptr, 1);
2422 object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
2424 if (p_ptr->mighty_throw) mult += 3;
2426 /* Extract a "distance multiplier" */
2427 /* Changed for 'launcher' mutation */
2428 mul = 10 + 2 * (mult - 1);
2430 /* Enforce a minimum "weight" of one pound */
2431 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
2432 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
2434 /* Hack -- Distance -- Reward strength, penalize weight */
2435 tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div;
2437 /* Max distance of 10-18 */
2438 if (tdis > mul) tdis = mul;
2442 ty = randint0(101) - 50 + p_ptr->y;
2443 tx = randint0(101) - 50 + p_ptr->x;
2447 project_length = tdis + 1;
2449 /* Get a direction (or cancel) */
2450 if (!get_aim_dir(&dir)) return FALSE;
2452 /* Predict the "target" location */
2453 tx = p_ptr->x + 99 * ddx[dir];
2454 ty = p_ptr->y + 99 * ddy[dir];
2456 /* Check for "target request" */
2457 if ((dir == 5) && target_okay())
2463 project_length = 0; /* reset to default */
2466 if ((q_ptr->name1 == ART_MJOLLNIR) ||
2467 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
2468 return_when_thrown = TRUE;
2470 /* Reduce and describe inventory */
2473 inven_item_increase(item, -1);
2474 if (!return_when_thrown)
2475 inven_item_describe(item);
2476 inven_item_optimize(item);
2479 /* Reduce and describe floor item */
2482 floor_item_increase(0 - item, -1);
2483 floor_item_optimize(0 - item);
2485 if (item >= INVEN_RARM)
2487 equiped_item = TRUE;
2488 p_ptr->redraw |= (PR_EQUIPPY);
2491 p_ptr->energy_use = 100;
2493 /* Rogue and Ninja gets bonus */
2494 if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
2495 p_ptr->energy_use -= p_ptr->lev;
2497 /* Start at the player */
2503 if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
2504 else shuriken = FALSE;
2506 /* Chance of hitting */
2507 if (have_flag(flgs, TR_THROW)) chance = ((p_ptr->skill_tht) +
2508 ((p_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
2509 else chance = (p_ptr->skill_tht + (p_ptr->to_h_b * BTH_PLUS_ADJ));
2511 if (shuriken) chance *= 2;
2516 /* Travel until stopped */
2517 for (cur_dis = 0; cur_dis <= tdis; )
2519 /* Hack -- Stop at the target */
2520 if ((y == ty) && (x == tx)) break;
2522 /* Calculate the new location (see "project()") */
2525 mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx);
2527 /* Stopped by walls/doors */
2528 if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
2531 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
2534 /* The player can see the (on screen) missile */
2535 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
2537 SYMBOL_CODE c = object_char(q_ptr);
2538 TERM_COLOR a = object_attr(q_ptr);
2540 /* Draw, Hilite, Fresh, Pause, Erase */
2541 print_rel(c, a, ny[cur_dis], nx[cur_dis]);
2542 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
2544 Term_xtra(TERM_XTRA_DELAY, msec);
2545 lite_spot(ny[cur_dis], nx[cur_dis]);
2549 /* The player cannot see the missile */
2552 /* Pause anyway, for consistancy */
2553 Term_xtra(TERM_XTRA_DELAY, msec);
2559 /* Save the new location */
2563 /* Advance the distance */
2566 /* Monster here, Try to hit it */
2567 if (cave[y][x].m_idx)
2569 cave_type *c_ptr = &cave[y][x];
2570 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2572 /* Check the visibility */
2573 visible = m_ptr->ml;
2575 /* Note the collision */
2578 /* Did we hit it (penalize range) */
2579 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
2583 /* Handle unseen monster */
2586 /* Invisible monster */
2587 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
2590 /* Handle visible monster */
2593 GAME_TEXT m_name[MAX_NLEN];
2594 monster_desc(m_name, m_ptr, 0);
2595 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
2599 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2600 health_track(c_ptr->m_idx);
2604 /* Hack -- Base damage from thrown object */
2607 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
2608 tdam = damroll(dd, ds);
2609 /* Apply special damage */
2610 tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
2611 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
2612 if (q_ptr->to_d > 0)
2613 tdam += q_ptr->to_d;
2615 tdam += -q_ptr->to_d;
2619 tdam *= (mult+p_ptr->num_blow[item - INVEN_RARM]);
2620 tdam += p_ptr->to_d_m;
2622 else if (have_flag(flgs, TR_THROW))
2625 tdam += p_ptr->to_d_m;
2633 tdam += ((p_ptr->lev+30)*(p_ptr->lev+30)-900)/55;
2636 /* No negative damage */
2637 if (tdam < 0) tdam = 0;
2639 /* Modify the damage */
2640 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
2642 msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
2643 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
2645 /* Hit the monster, check for death */
2646 if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
2654 message_pain(c_ptr->m_idx, tdam);
2656 /* Anger the monster */
2657 if ((tdam > 0) && !object_is_potion(q_ptr))
2658 anger_monster(m_ptr);
2660 if (fear && m_ptr->ml)
2663 GAME_TEXT m_name[MAX_NLEN];
2664 monster_desc(m_name, m_ptr, 0);
2665 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2675 /* decrease toach's fuel */
2676 if (hit_body) torch_lost_fuel(q_ptr);
2678 /* Chance of breakage (during attacks) */
2679 j = (hit_body ? breakage_chance(q_ptr) : 0);
2681 /* Figurines transform */
2682 if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
2686 if (!(summon_named_creature(0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
2687 msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
2688 else if (object_is_cursed(q_ptr))
2689 msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
2694 /* Potions smash open */
2695 if (object_is_potion(q_ptr))
2697 if (hit_body || hit_wall || (randint1(100) < j))
2699 msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
2701 if (potion_smash_effect(0, y, x, q_ptr->k_idx))
2703 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
2705 /* ToDo (Robert): fix the invulnerability */
2706 if (cave[y][x].m_idx &&
2707 is_friendly(&m_list[cave[y][x].m_idx]) &&
2708 !MON_INVULNER(m_ptr))
2710 GAME_TEXT m_name[MAX_NLEN];
2711 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
2712 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
2713 set_hostile(&m_list[cave[y][x].m_idx]);
2724 if (return_when_thrown)
2726 int back_chance = randint1(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
2727 char o2_name[MAX_NLEN];
2728 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
2731 if (boomerang) back_chance += 4+randint1(5);
2732 if (super_boomerang) back_chance += 100;
2733 object_desc(o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2735 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
2737 for (i = cur_dis - 1; i > 0; i--)
2739 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
2741 char c = object_char(q_ptr);
2742 byte a = object_attr(q_ptr);
2744 /* Draw, Hilite, Fresh, Pause, Erase */
2745 print_rel(c, a, ny[i], nx[i]);
2746 move_cursor_relative(ny[i], nx[i]);
2748 Term_xtra(TERM_XTRA_DELAY, msec);
2749 lite_spot(ny[i], nx[i]);
2754 /* Pause anyway, for consistancy */
2755 Term_xtra(TERM_XTRA_DELAY, msec);
2758 if((back_chance > 37) && !p_ptr->blind && (item >= 0))
2760 msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
2767 msg_format(_("%sを受け損ねた!", "%s backs, but you can't catch!"), o2_name);
2771 msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
2779 msg_format(_("%sが返ってこなかった!", "%s doesn't back!"), o2_name);
2785 if (item == INVEN_RARM || item == INVEN_LARM)
2787 /* Access the wield slot */
2788 o_ptr = &inventory[item];
2790 /* Wear the new stuff */
2791 object_copy(o_ptr, q_ptr);
2793 p_ptr->total_weight += q_ptr->weight;
2795 /* Increment the equip counter by hand */
2798 /* Recalculate torch */
2799 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
2800 p_ptr->window |= (PW_EQUIP);
2808 else if (equiped_item)
2816 if (cave_have_flag_bold(y, x, FF_PROJECT))
2818 (void)drop_near(q_ptr, j, y, x);
2822 (void)drop_near(q_ptr, j, prev_y, prev_x);
2832 * Hack: travel command
2834 #define TRAVEL_UNABLE 9999
2836 static int flow_head = 0;
2837 static int flow_tail = 0;
2838 static POSITION temp2_x[MAX_SHORT];
2839 static POSITION temp2_y[MAX_SHORT];
2842 * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
2845 void forget_travel_flow(void)
2848 /* Check the entire dungeon / Forget the old data */
2849 for (y = 0; y < cur_hgt; y++)
2851 for (x = 0; x < cur_wid; x++)
2854 travel.cost[y][x] = MAX_SHORT;
2857 travel.y = travel.x = 0;
2861 * @brief トラベル処理中に地形に応じた移動コスト基準を返す
2866 static int travel_flow_cost(POSITION y, POSITION x)
2868 feature_type *f_ptr = &f_info[cave[y][x].feat];
2871 /* Avoid obstacles (ex. trees) */
2872 if (have_flag(f_ptr->flags, FF_AVOID_RUN)) cost += 1;
2875 if (have_flag(f_ptr->flags, FF_WATER))
2877 if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5;
2881 if (have_flag(f_ptr->flags, FF_LAVA))
2884 if (!p_ptr->resist_fire) lava *= 2;
2885 if (!p_ptr->levitation) lava *= 2;
2886 if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2;
2891 /* Detected traps and doors */
2892 if (cave[y][x].info & (CAVE_MARK))
2894 if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
2895 if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
2902 * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
2906 * @param wall プレイヤーが壁の中にいるならばTRUE
2909 static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
2911 cave_type *c_ptr = &cave[y][x];
2912 feature_type *f_ptr = &f_info[c_ptr->feat];
2913 int old_head = flow_head;
2915 int base_cost = (n % TRAVEL_UNABLE);
2916 int from_wall = (n / TRAVEL_UNABLE);
2919 /* Ignore out of bounds */
2920 if (!in_bounds(y, x)) return;
2922 /* Ignore unknown grid except in wilderness */
2923 if (dun_level > 0 && !(c_ptr->info & CAVE_KNOWN)) return;
2925 /* Ignore "walls" and "rubble" (include "secret doors") */
2926 if (have_flag(f_ptr->flags, FF_WALL) ||
2927 have_flag(f_ptr->flags, FF_CAN_DIG) ||
2928 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic) ||
2929 (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation))
2931 if (!wall || !from_wall) return;
2932 add_cost += TRAVEL_UNABLE;
2936 add_cost = travel_flow_cost(y, x);
2939 cost = base_cost + add_cost;
2941 /* Ignore lower cost entries */
2942 if (travel.cost[y][x] <= cost) return;
2944 /* Save the flow cost */
2945 travel.cost[y][x] = cost;
2947 /* Enqueue that entry */
2948 temp2_y[flow_head] = y;
2949 temp2_x[flow_head] = x;
2951 /* Advance the queue */
2952 if (++flow_head == MAX_SHORT) flow_head = 0;
2954 /* Hack -- notice overflow by forgetting new entry */
2955 if (flow_head == flow_tail) flow_head = old_head;
2961 * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
2962 * @param ty 目標地点のY座標
2963 * @param tx 目標地点のX座標
2966 static void travel_flow(POSITION ty, POSITION tx)
2970 feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
2972 /* Reset the "queue" */
2973 flow_head = flow_tail = 0;
2975 /* is player in the wall? */
2976 if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE;
2978 /* Start at the target grid */
2979 travel_flow_aux(ty, tx, 0, wall);
2981 /* Now process the queue */
2982 while (flow_head != flow_tail)
2984 /* Extract the next entry */
2985 y = temp2_y[flow_tail];
2986 x = temp2_x[flow_tail];
2988 /* Forget that entry */
2989 if (++flow_tail == MAX_SHORT) flow_tail = 0;
2991 /* Ignore too far entries */
2992 //if (distance(ty, tx, y, x) > 100) continue;
2994 /* Add the "children" */
2995 for (d = 0; d < 8; d++)
2997 /* Add that child if "legal" */
2998 travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
3002 /* Forget the flow info */
3003 flow_head = flow_tail = 0;
3007 * @brief トラベル処理のメインルーチン
3010 void do_cmd_travel(void)
3014 POSITION dx, dy, sx, sy;
3015 feature_type *f_ptr;
3017 if (travel.x != 0 && travel.y != 0 &&
3018 get_check(_("トラベルを継続しますか?", "Do you continue to travel?")))
3023 else if (!tgt_pt(&x, &y)) return;
3025 if ((x == p_ptr->x) && (y == p_ptr->y))
3027 msg_print(_("すでにそこにいます!", "You are already there!!"));
3031 f_ptr = &f_info[cave[y][x].feat];
3033 if ((cave[y][x].info & CAVE_MARK) &&
3034 (have_flag(f_ptr->flags, FF_WALL) ||
3035 have_flag(f_ptr->flags, FF_CAN_DIG) ||
3036 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic)))
3038 msg_print(_("そこには行くことができません!", "You cannot travel there!"));
3042 forget_travel_flow();
3048 /* Travel till 255 steps */
3054 /* Decides first direction */
3055 dx = abs(p_ptr->x - x);
3056 dy = abs(p_ptr->y - y);
3057 sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1);
3058 sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1);
3060 for (i = 1; i <= 9; i++)
3062 if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;