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;
56 bool cmd_limit_arena(player_type *creature_ptr)
58 if (p_ptr->inside_arena)
60 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
67 bool cmd_limit_time_walk(player_type *creature_ptr)
71 if (flush_failure) flush();
72 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
80 * @brief 階段を使って階層を昇る処理 / Go up one level
83 void do_cmd_go_up(void)
88 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
89 feature_type *f_ptr = &f_info[c_ptr->feat];
93 if (p_ptr->special_defense & KATA_MUSOU)
95 set_action(ACTION_NONE);
99 if (!have_flag(f_ptr->flags, FF_LESS))
101 msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
105 /* Quest up stairs */
106 if (have_flag(f_ptr->flags, FF_QUEST))
108 /* Cancel the command */
109 if (!confirm_leave_level(FALSE)) return;
113 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
114 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
116 msg_print(_("上の階に登った。", "You enter the up staircase."));
120 p_ptr->inside_quest = c_ptr->special;
122 /* Activate the quest */
123 if (!quest[p_ptr->inside_quest].status)
125 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
127 init_flags = INIT_ASSIGN;
128 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
130 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
133 /* Leaving a quest */
134 if (!p_ptr->inside_quest)
140 p_ptr->leaving = TRUE;
145 /* Hack -- take a turn */
146 p_ptr->energy_use = 100;
148 /* End the command */
158 go_up = confirm_leave_level(FALSE);
161 /* Cancel the command */
164 /* Hack -- take a turn */
165 p_ptr->energy_use = 100;
167 if (autosave_l) do_cmd_save_game(TRUE);
169 /* For a random quest */
170 if (p_ptr->inside_quest &&
171 quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
175 p_ptr->inside_quest = 0;
178 /* For a fixed quest */
179 if (p_ptr->inside_quest &&
180 quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
184 p_ptr->inside_quest = c_ptr->special;
189 /* For normal dungeon and random quest */
193 if (have_flag(f_ptr->flags, FF_SHAFT))
195 /* Create a way back */
196 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
202 /* Create a way back */
203 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
208 /* Get out from current dungeon */
209 if (dun_level - up_num < d_info[dungeon_type].mindepth)
212 if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
215 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
216 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
217 else if (up_num == dun_level)
218 msg_print(_("地上に戻った。", "You go back to the surface."));
220 msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
223 p_ptr->leaving = TRUE;
228 * @brief 階段を使って階層を降りる処理 / Go down one level
231 void do_cmd_go_down(void)
234 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
235 feature_type *f_ptr = &f_info[c_ptr->feat];
237 bool fall_trap = FALSE;
240 if (p_ptr->special_defense & KATA_MUSOU)
242 set_action(ACTION_NONE);
246 if (!have_flag(f_ptr->flags, FF_MORE))
248 msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
252 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
255 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
260 /* Quest down stairs */
261 else if (have_flag(f_ptr->flags, FF_QUEST))
263 /* Confirm Leaving */
264 if(!confirm_leave_level(TRUE)) return;
266 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
267 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
269 msg_print(_("下の階に降りた。", "You enter the down staircase."));
274 p_ptr->inside_quest = c_ptr->special;
276 /* Activate the quest */
277 if (!quest[p_ptr->inside_quest].status)
279 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
281 init_flags = INIT_ASSIGN;
282 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
284 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
287 /* Leaving a quest */
288 if (!p_ptr->inside_quest)
294 p_ptr->leaving = TRUE;
300 /* Hack -- take a turn */
301 p_ptr->energy_use = 100;
306 DUNGEON_IDX target_dungeon = 0;
310 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
312 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
314 msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
317 if (!max_dlv[target_dungeon])
319 msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
320 d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
321 if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
324 /* Save old player position */
325 p_ptr->oldpx = p_ptr->x;
326 p_ptr->oldpy = p_ptr->y;
327 dungeon_type = target_dungeon;
330 * Clear all saved floors
331 * and create a first saved floor
333 prepare_change_floor_mode(CFM_FIRST_FLOOR);
336 /* Hack -- take a turn */
337 p_ptr->energy_use = 100;
339 if (autosave_l) do_cmd_save_game(TRUE);
342 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
347 /* Enter the dungeon just now */
348 p_ptr->enter_dungeon = TRUE;
349 down_num = d_info[dungeon_type].mindepth;
354 if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
355 else do_cmd_write_nikki(NIKKI_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
360 msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
367 msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[dungeon_type].text);
371 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
372 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
374 msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
380 p_ptr->leaving = TRUE;
384 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
388 if (have_flag(f_ptr->flags, FF_SHAFT))
390 /* Create a way back */
391 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
395 /* Create a way back */
396 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
404 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
407 void do_cmd_search(void)
409 /* Allow repeated command */
412 /* Set repeat count */
413 command_rep = command_arg - 1;
414 p_ptr->redraw |= (PR_STATE);
419 p_ptr->energy_use = 100;
427 * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
428 * @param y 走査対象にしたいマスのY座標
429 * @param x 走査対象にしたいマスのX座標
430 * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
431 * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
433 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
435 cave_type *c_ptr = &cave[y][x];
436 OBJECT_IDX this_o_idx, next_o_idx = 0;
438 /* Scan all objects in the grid */
439 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
443 o_ptr = &o_list[this_o_idx];
444 next_o_idx = o_ptr->next_o_idx;
446 /* Skip unknown chests XXX XXX */
447 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
449 /* Check for non empty chest */
450 if ((o_ptr->tval == TV_CHEST) &&
451 (((!trapped) && (o_ptr->pval)) || /* non empty */
452 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
461 * @brief 箱を開けるコマンドのメインルーチン /
462 * Attempt to open the given chest at the given location
463 * @param y 箱の存在するマスのY座標
464 * @param x 箱の存在するマスのX座標
465 * @param o_idx 箱のオブジェクトID
466 * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
468 * Assume there is no monster blocking the destination
470 static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
475 object_type *o_ptr = &o_list[o_idx];
477 p_ptr->energy_use = 100;
479 /* Attempt to unlock it */
482 /* Assume locked, and thus not open */
485 /* Get the "disarm" factor */
486 i = p_ptr->skill_dis;
488 /* Penalize some conditions */
489 if (p_ptr->blind || no_lite()) i = i / 10;
490 if (p_ptr->confused || p_ptr->image) i = i / 10;
492 /* Extract the difficulty */
495 /* Always have a small chance of success */
498 /* Success -- May still have traps */
499 if (randint0(100) < j)
501 msg_print(_("鍵をはずした。", "You have picked the lock."));
506 /* Failure -- Keep trying */
509 /* We may continue repeating */
511 if (flush_failure) flush();
512 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
517 /* Allowed to open */
520 /* Apply chest traps, if any */
521 chest_trap(y, x, o_idx);
523 /* Let the Chest drop items */
524 chest_death(FALSE, y, x, o_idx);
530 * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
531 * Attempt to open the given chest at the given location
532 * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
533 * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
534 * @param test 地形条件を判定するための関数ポインタ
535 * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
537 * @details Return the number of features around (or under) the character.
538 * Usually look for doors and floor traps.
540 static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under)
542 int d, count, xx, yy;
544 /* Count how many matches */
547 /* Check around (and under) the character */
548 for (d = 0; d < 9; d++)
553 /* if not searching under player continue */
554 if ((d == 8) && !under) continue;
556 /* Extract adjacent (legal) location */
557 yy = p_ptr->y + ddy_ddd[d];
558 xx = p_ptr->x + ddx_ddd[d];
561 c_ptr = &cave[yy][xx];
563 /* Must have knowledge */
564 if (!(c_ptr->info & (CAVE_MARK))) continue;
566 /* Feature code (applying "mimic" field) */
567 feat = get_feat_mimic(c_ptr);
569 /* Not looking for this feature */
570 if (!((*test)(feat))) continue;
575 /* Remember the location. Only useful if only one match */
586 * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
587 * Return the number of chests around (or under) the character.
588 * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
589 * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
590 * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
593 * If requested, count only trapped chests.
595 static int count_chests(POSITION *y, POSITION *x, bool trapped)
602 /* Count how many matches */
605 /* Check around (and under) the character */
606 for (d = 0; d < 9; d++)
608 /* Extract adjacent (legal) location */
609 POSITION yy = p_ptr->y + ddy_ddd[d];
610 POSITION xx = p_ptr->x + ddx_ddd[d];
612 /* No (visible) chest is there */
613 if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
615 /* Grab the object */
616 o_ptr = &o_list[o_idx];
619 if (o_ptr->pval == 0) continue;
621 /* No (known) traps here */
622 if (trapped && (!object_is_known(o_ptr) ||
623 !chest_traps[o_ptr->pval])) continue;
628 /* Remember the location. Only useful if only one match */
639 * @brief プレイヤーから指定の座標がどの方角にあるかを返す /
640 * Convert an adjacent location to a direction.
641 * @param y 方角を確認したY座標
642 * @param x 方角を確認したX座標
645 static DIRECTION coords_to_dir(POSITION y, POSITION x)
647 int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
654 if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
656 return d[dx + 1][dy + 1];
660 * @brief 「開ける」動作コマンドのサブルーチン /
661 * Perform the basic "open" command on doors
662 * @param y 対象を行うマスのY座標
663 * @param x 対象を行うマスのX座標
664 * @return 実際に処理が行われた場合TRUEを返す。
666 * Assume destination is a closed/locked/jammed door
667 * Assume there is no monster blocking the destination
668 * Returns TRUE if repeated commands may continue
670 static bool do_cmd_open_aux(POSITION y, POSITION x)
674 /* Get requested grid */
675 cave_type *c_ptr = &cave[y][x];
676 feature_type *f_ptr = &f_info[c_ptr->feat];
679 p_ptr->energy_use = 100;
681 /* Seeing true feature code (ignore mimic) */
684 if (!have_flag(f_ptr->flags, FF_OPEN))
687 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
691 else if (f_ptr->power)
694 i = p_ptr->skill_dis;
696 /* Penalize some conditions */
697 if (p_ptr->blind || no_lite()) i = i / 10;
698 if (p_ptr->confused || p_ptr->image) i = i / 10;
700 /* Extract the lock power */
703 /* Extract the difficulty */
706 /* Always have a small chance of success */
710 if (randint0(100) < j)
712 msg_print(_("鍵をはずした。", "You have picked the lock."));
715 cave_alter_feat(y, x, FF_OPEN);
717 sound(SOUND_OPENDOOR);
727 if (flush_failure) flush();
729 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
731 /* We may keep trying */
740 cave_alter_feat(y, x, FF_OPEN);
742 sound(SOUND_OPENDOOR);
748 * @brief 「開ける」コマンドのメインルーチン /
749 * Open a closed/locked/jammed door or a closed/locked chest.
752 * Unlocking a locked door/chest is worth one experience point.
754 void do_cmd_open(void)
762 if (p_ptr->wild_mode) return;
764 if (p_ptr->special_defense & KATA_MUSOU)
766 set_action(ACTION_NONE);
769 /* Option: Pick a direction */
772 int num_doors, num_chests;
774 /* Count closed doors (locked or jammed) */
775 num_doors = count_dt(&y, &x, is_closed_door, FALSE);
777 /* Count chests (locked) */
778 num_chests = count_chests(&y, &x, FALSE);
780 /* See if only one target */
781 if (num_doors || num_chests)
783 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
785 if (!too_many) command_dir = coords_to_dir(y, x);
789 /* Allow repeated command */
792 /* Set repeat count */
793 command_rep = command_arg - 1;
794 p_ptr->redraw |= (PR_STATE);
800 /* Get a "repeated" direction */
801 if (get_rep_dir(&dir, TRUE))
806 /* Get requested location */
807 y = p_ptr->y + ddy[dir];
808 x = p_ptr->x + ddx[dir];
810 /* Get requested grid */
813 /* Feature code (applying "mimic" field) */
814 feat = get_feat_mimic(c_ptr);
816 /* Check for chest */
817 o_idx = chest_check(y, x, FALSE);
820 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
822 msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
825 /* Monster in the way */
826 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
828 p_ptr->energy_use = 100;
829 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
837 more = do_cmd_open_chest(y, x, o_idx);
844 more = do_cmd_open_aux(y, x);
848 /* Cancel repeat unless we may continue */
849 if (!more) disturb(FALSE, FALSE);
855 * @brief 「閉じる」動作コマンドのサブルーチン /
856 * Perform the basic "close" command
857 * @param y 対象を行うマスのY座標
858 * @param x 対象を行うマスのX座標
859 * @return 実際に処理が行われた場合TRUEを返す。
861 * Assume destination is an open/broken door
862 * Assume there is no monster blocking the destination
863 * Returns TRUE if repeated commands may continue
865 static bool do_cmd_close_aux(POSITION y, POSITION x)
867 cave_type *c_ptr = &cave[y][x];
868 FEAT_IDX old_feat = c_ptr->feat;
871 p_ptr->energy_use = 100;
873 /* Seeing true feature code (ignore mimic) */
876 if (have_flag(f_info[old_feat].flags, FF_CLOSE))
878 s16b closed_feat = feat_state(old_feat, FF_CLOSE);
880 /* Hack -- object in the way */
881 if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
882 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
884 msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
889 cave_alter_feat(y, x, FF_CLOSE);
892 if (old_feat == c_ptr->feat)
894 msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
898 sound(SOUND_SHUTDOOR);
907 * @brief 「閉じる」コマンドのメインルーチン /
908 * Close an open door.
911 * Unlocking a locked door/chest is worth one experience point.
913 void do_cmd_close(void)
920 if (p_ptr->wild_mode) return;
922 if (p_ptr->special_defense & KATA_MUSOU)
924 set_action(ACTION_NONE);
927 /* Option: Pick a direction */
930 /* Count open doors */
931 if (count_dt(&y, &x, is_open, FALSE) == 1)
933 command_dir = coords_to_dir(y, x);
937 /* Allow repeated command */
940 /* Set repeat count */
941 command_rep = command_arg - 1;
942 p_ptr->redraw |= (PR_STATE);
948 /* Get a "repeated" direction */
949 if (get_rep_dir(&dir, FALSE))
954 y = p_ptr->y + ddy[dir];
955 x = p_ptr->x + ddx[dir];
958 /* Feature code (applying "mimic" field) */
959 feat = get_feat_mimic(c_ptr);
961 /* Require open/broken door */
962 if (!have_flag(f_info[feat].flags, FF_CLOSE))
964 msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
967 /* Monster in the way */
968 else if (c_ptr->m_idx)
970 p_ptr->energy_use = 100;
972 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
982 more = do_cmd_close_aux(y, x);
986 /* Cancel repeat unless we may continue */
987 if (!more) disturb(FALSE, FALSE);
992 * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
993 * Determine if a given grid may be "tunneled"
994 * @param y 対象を行うマスのY座標
995 * @param x 対象を行うマスのX座標
998 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
1000 cave_type *c_ptr = &cave[y][x];
1002 /* Must have knowledge */
1003 if (!(c_ptr->info & CAVE_MARK))
1005 msg_print(_("そこには何も見当たらない。", "You see nothing there."));
1010 /* Must be a wall/door/etc */
1011 if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
1013 msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
1023 * @brief 「掘る」動作コマンドのサブルーチン /
1024 * Perform the basic "tunnel" command
1025 * @param y 対象を行うマスのY座標
1026 * @param x 対象を行うマスのX座標
1027 * @return 実際に処理が行われた場合TRUEを返す。
1029 * Assumes that no monster is blocking the destination
1030 * Do not use twall anymore
1031 * Returns TRUE if repeated commands may continue
1033 static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
1036 feature_type *f_ptr, *mimic_f_ptr;
1041 /* Verify legality */
1042 if (!do_cmd_tunnel_test(y, x)) return (FALSE);
1044 p_ptr->energy_use = 100;
1047 c_ptr = &cave[y][x];
1048 f_ptr = &f_info[c_ptr->feat];
1049 power = f_ptr->power;
1051 /* Feature code (applying "mimic" field) */
1052 mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
1054 name = f_name + mimic_f_ptr->name;
1058 if (have_flag(f_ptr->flags, FF_PERMANENT))
1061 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1063 msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
1066 /* Map border (mimiccing Permanent wall) */
1069 msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
1074 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1077 if (p_ptr->skill_dig > randint0(20 * power))
1079 msg_format(_("%sをくずした。", "You have removed the %s."), name);
1081 /* Remove the feature */
1082 cave_alter_feat(y, x, FF_TUNNEL);
1084 /* Update some things */
1085 p_ptr->update |= (PU_FLOW);
1089 /* Message, keep digging */
1090 msg_format(_("%sをくずしている。", "You dig into the %s."), name);
1098 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1101 if (p_ptr->skill_dig > power + randint0(40 * power))
1103 if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
1106 msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
1107 p_ptr->update |= (PU_FLOW);
1110 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1112 /* Remove the feature */
1113 cave_alter_feat(y, x, FF_TUNNEL);
1115 chg_virtue(V_DILIGENCE, 1);
1116 chg_virtue(V_NATURE, -1);
1124 /* We may continue chopping */
1125 msg_format(_("%sを切っている。", "You chop away at the %s."), name);
1126 /* Occasional Search XXX XXX */
1127 if (randint0(100) < 25) search();
1131 /* We may continue tunelling */
1132 msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
1139 if (is_hidden_door(c_ptr))
1141 /* Occasional Search XXX XXX */
1142 if (randint0(100) < 25) search();
1149 * @brief 「掘る」動作コマンドのメインルーチン /
1150 * Tunnels through "walls" (including rubble and closed doors)
1154 * Note that you must tunnel in order to hit invisible monsters
1155 * in walls, though moving into walls still takes a turn anyway.
1157 * Digging is very difficult without a "digger" weapon, but can be
1158 * accomplished by strong players using heavy weapons.
1161 void do_cmd_tunnel(void)
1171 if (p_ptr->special_defense & KATA_MUSOU)
1173 set_action(ACTION_NONE);
1176 /* Allow repeated command */
1179 /* Set repeat count */
1180 command_rep = command_arg - 1;
1181 p_ptr->redraw |= (PR_STATE);
1183 /* Cancel the arg */
1187 /* Get a direction to tunnel, or Abort */
1188 if (get_rep_dir(&dir,FALSE))
1191 y = p_ptr->y + ddy[dir];
1192 x = p_ptr->x + ddx[dir];
1195 c_ptr = &cave[y][x];
1197 /* Feature code (applying "mimic" field) */
1198 feat = get_feat_mimic(c_ptr);
1200 /* No tunnelling through doors */
1201 if (have_flag(f_info[feat].flags, FF_DOOR))
1203 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
1206 /* No tunnelling through most features */
1207 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1209 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
1212 /* A monster is in the way */
1213 else if (c_ptr->m_idx)
1215 p_ptr->energy_use = 100;
1217 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1226 /* Tunnel through walls */
1227 more = do_cmd_tunnel_aux(y, x);
1231 /* Cancel repetition unless we can continue */
1232 if (!more) disturb(FALSE, FALSE);
1236 * @brief 移動処理による簡易な「開く」処理 /
1238 * @return 開く処理が実際に試みられた場合TRUEを返す
1241 * If there is a jammed/closed/locked door at the given location,
1242 * then attempt to unlock/open it. Return TRUE if an attempt was
1243 * made (successful or not), otherwise return FALSE.
1245 * The code here should be nearly identical to that in
1246 * do_cmd_open_test() and do_cmd_open_aux().
1249 bool easy_open_door(POSITION y, POSITION x)
1253 cave_type *c_ptr = &cave[y][x];
1254 feature_type *f_ptr = &f_info[c_ptr->feat];
1256 /* Must be a closed door */
1257 if (!is_closed_door(c_ptr->feat))
1263 if (!have_flag(f_ptr->flags, FF_OPEN))
1266 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
1271 else if (f_ptr->power)
1274 i = p_ptr->skill_dis;
1276 /* Penalize some conditions */
1277 if (p_ptr->blind || no_lite()) i = i / 10;
1278 if (p_ptr->confused || p_ptr->image) i = i / 10;
1280 /* Extract the lock power */
1283 /* Extract the difficulty */
1286 /* Always have a small chance of success */
1290 if (randint0(100) < j)
1292 msg_print(_("鍵をはずした。", "You have picked the lock."));
1295 cave_alter_feat(y, x, FF_OPEN);
1297 sound(SOUND_OPENDOOR);
1307 if (flush_failure) flush();
1309 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
1318 cave_alter_feat(y, x, FF_OPEN);
1320 sound(SOUND_OPENDOOR);
1326 * @brief 箱のトラップを解除するコマンドのメインルーチン /
1327 * Perform the basic "disarm" command
1328 * @param y 解除を行うマスのY座標
1329 * @param x 解除を行うマスのX座標
1330 * @param o_idx 箱のオブジェクトID
1331 * @return ターンを消費する処理が行われた場合TRUEを返す
1334 * Assume destination is a visible trap
1335 * Assume there is no monster blocking the destination
1336 * Returns TRUE if repeated commands may continue
1339 static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
1343 object_type *o_ptr = &o_list[o_idx];
1345 p_ptr->energy_use = 100;
1347 /* Get the "disarm" factor */
1348 i = p_ptr->skill_dis;
1350 /* Penalize some conditions */
1351 if (p_ptr->blind || no_lite()) i = i / 10;
1352 if (p_ptr->confused || p_ptr->image) i = i / 10;
1354 /* Extract the difficulty */
1355 j = i - o_ptr->pval;
1357 /* Always have a small chance of success */
1360 /* Must find the trap first. */
1361 if (!object_is_known(o_ptr))
1363 msg_print(_("トラップが見あたらない。", "I don't see any traps."));
1367 /* Already disarmed/unlocked */
1368 else if (o_ptr->pval <= 0)
1370 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1373 /* No traps to find. */
1374 else if (!chest_traps[o_ptr->pval])
1376 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1379 /* Success (get a lot of experience) */
1380 else if (randint0(100) < j)
1382 msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
1383 gain_exp(o_ptr->pval);
1384 o_ptr->pval = (0 - o_ptr->pval);
1387 /* Failure -- Keep trying */
1388 else if ((i > 5) && (randint1(i) > 5))
1390 /* We may keep trying */
1392 if (flush_failure) flush();
1393 msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
1396 /* Failure -- Set off the trap */
1399 msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
1401 chest_trap(y, x, o_idx);
1408 * @brief 箱のトラップを解除するコマンドのサブルーチン /
1409 * Perform the basic "disarm" command
1410 * @param y 解除を行うマスのY座標
1411 * @param x 解除を行うマスのX座標
1412 * @param dir プレイヤーからみた方向ID
1413 * @return ターンを消費する処理が行われた場合TRUEを返す
1416 * Assume destination is a visible trap
1417 * Assume there is no monster blocking the destination
1418 * Returns TRUE if repeated commands may continue
1422 bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
1424 cave_type *c_ptr = &cave[y][x];
1427 feature_type *f_ptr = &f_info[c_ptr->feat];
1429 /* Access trap name */
1430 concptr name = (f_name + f_ptr->name);
1432 /* Extract trap "power" */
1433 int power = f_ptr->power;
1436 /* Get the "disarm" factor */
1437 int i = p_ptr->skill_dis;
1440 p_ptr->energy_use = 100;
1442 /* Penalize some conditions */
1443 if (p_ptr->blind || no_lite()) i = i / 10;
1444 if (p_ptr->confused || p_ptr->image) i = i / 10;
1446 /* Extract the difficulty */
1449 /* Always have a small chance of success */
1453 if (randint0(100) < j)
1455 msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
1460 /* Remove the trap */
1461 cave_alter_feat(y, x, FF_DISARM);
1463 /* Move the player onto the trap */
1464 move_player(dir, easy_disarm, FALSE);
1467 /* Failure -- Keep trying */
1468 else if ((i > 5) && (randint1(i) > 5))
1471 if (flush_failure) flush();
1473 msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
1475 /* We may keep trying */
1479 /* Failure -- Set off the trap */
1482 msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
1483 /* Move the player onto the trap */
1484 move_player(dir, easy_disarm, FALSE);
1491 * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
1492 * Disarms a trap, or chest
1495 void do_cmd_disarm(void)
1503 if (p_ptr->wild_mode) return;
1505 if (p_ptr->special_defense & KATA_MUSOU)
1507 set_action(ACTION_NONE);
1510 /* Option: Pick a direction */
1513 int num_traps, num_chests;
1515 /* Count visible traps */
1516 num_traps = count_dt(&y, &x, is_trap, TRUE);
1518 /* Count chests (trapped) */
1519 num_chests = count_chests(&y, &x, TRUE);
1521 /* See if only one target */
1522 if (num_traps || num_chests)
1524 bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
1525 if (!too_many) command_dir = coords_to_dir(y, x);
1530 /* Allow repeated command */
1533 /* Set repeat count */
1534 command_rep = command_arg - 1;
1535 p_ptr->redraw |= (PR_STATE);
1537 /* Cancel the arg */
1541 /* Get a direction (or abort) */
1542 if (get_rep_dir(&dir,TRUE))
1547 y = p_ptr->y + ddy[dir];
1548 x = p_ptr->x + ddx[dir];
1549 c_ptr = &cave[y][x];
1551 /* Feature code (applying "mimic" field) */
1552 feat = get_feat_mimic(c_ptr);
1554 /* Check for chests */
1555 o_idx = chest_check(y, x, TRUE);
1558 if (!is_trap(feat) && !o_idx)
1560 msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
1563 /* Monster in the way */
1564 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
1566 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1575 more = do_cmd_disarm_chest(y, x, o_idx);
1581 more = do_cmd_disarm_aux(y, x, dir);
1585 /* Cancel repeat unless told not to */
1586 if (!more) disturb(FALSE, FALSE);
1591 * @brief 「打ち破る」動作コマンドのサブルーチン /
1592 * Perform the basic "bash" command
1593 * @param y 対象を行うマスのY座標
1594 * @param x 対象を行うマスのX座標
1595 * @param dir プレイヤーから見たターゲットの方角ID
1596 * @return 実際に処理が行われた場合TRUEを返す。
1599 * Assume destination is a closed/locked/jammed door
1600 * Assume there is no monster blocking the destination
1601 * Returns TRUE if repeated commands may continue
1604 static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
1607 cave_type *c_ptr = &cave[y][x];
1610 feature_type *f_ptr = &f_info[c_ptr->feat];
1612 /* Hack -- Bash power based on strength */
1613 /* (Ranges from 3 to 20 to 100 to 200) */
1614 int bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
1616 /* Extract door power */
1617 int temp = f_ptr->power;
1621 concptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
1623 p_ptr->energy_use = 100;
1625 msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
1627 /* Compare bash power to door power */
1628 temp = (bash - (temp * 10));
1630 if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
1632 /* Hack -- always have a chance */
1633 if (temp < 1) temp = 1;
1635 /* Hack -- attempt to bash down the door */
1636 if (randint0(100) < temp)
1638 msg_format(_("%sを壊した!", "The %s crashes open!"), name);
1640 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
1642 /* Break down the door */
1643 if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
1645 cave_alter_feat(y, x, FF_BASH);
1651 cave_alter_feat(y, x, FF_OPEN);
1654 /* Hack -- Fall through the door */
1655 move_player(dir, FALSE, FALSE);
1658 /* Saving throw against stun */
1659 else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
1662 msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
1664 /* Allow repeated bashing */
1668 /* High dexterity yields coolness */
1671 msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
1673 /* Hack -- Lose balance ala paralysis */
1674 (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
1681 * @brief 「打ち破る」動作コマンドのメインルーチン /
1682 * Bash open a door, success based on character strength
1686 * For a closed door, pval is positive if locked; negative if stuck.
1688 * For an open door, pval is positive for a broken door.
1690 * A closed door can be opened - harder if locked. Any door might be
1691 * bashed open (and thereby broken). Bashing a door is (potentially)
1692 * faster! You move into the door way. To open a stuck door, it must
1693 * be bashed. A closed door can be jammed (see do_cmd_spike()).
1695 * Creatures can also open or bash doors, see elsewhere.
1698 void do_cmd_bash(void)
1704 if (p_ptr->wild_mode) return;
1706 if (p_ptr->special_defense & KATA_MUSOU)
1708 set_action(ACTION_NONE);
1711 /* Allow repeated command */
1714 /* Set repeat count */
1715 command_rep = command_arg - 1;
1716 p_ptr->redraw |= (PR_STATE);
1718 /* Cancel the arg */
1722 /* Get a "repeated" direction */
1723 if (get_rep_dir(&dir,FALSE))
1728 y = p_ptr->y + ddy[dir];
1729 x = p_ptr->x + ddx[dir];
1732 c_ptr = &cave[y][x];
1734 /* Feature code (applying "mimic" field) */
1735 feat = get_feat_mimic(c_ptr);
1737 /* Nothing useful */
1738 if (!have_flag(f_info[feat].flags, FF_BASH))
1740 msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
1743 /* Monster in the way */
1744 else if (c_ptr->m_idx)
1746 p_ptr->energy_use = 100;
1748 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1754 /* Bash a closed door */
1758 more = do_cmd_bash_aux(y, x, dir);
1762 /* Unless valid action taken, cancel bash */
1763 if (!more) disturb(FALSE, FALSE);
1768 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
1772 * Manipulate an adjacent grid in some way
1774 * Attack monsters, tunnel through walls, disarm traps, open doors.
1776 * Consider confusion
1778 * This command must always take a turn, to prevent free detection
1779 * of invisible monsters.
1782 void do_cmd_alter(void)
1789 if (p_ptr->special_defense & KATA_MUSOU)
1791 set_action(ACTION_NONE);
1794 /* Allow repeated command */
1797 /* Set repeat count */
1798 command_rep = command_arg - 1;
1799 p_ptr->redraw |= (PR_STATE);
1801 /* Cancel the arg */
1805 /* Get a direction */
1806 if (get_rep_dir(&dir,TRUE))
1809 feature_type *f_ptr;
1811 y = p_ptr->y + ddy[dir];
1812 x = p_ptr->x + ddx[dir];
1815 c_ptr = &cave[y][x];
1817 /* Feature code (applying "mimic" field) */
1818 feat = get_feat_mimic(c_ptr);
1819 f_ptr = &f_info[feat];
1821 p_ptr->energy_use = 100;
1829 else if (have_flag(f_ptr->flags, FF_OPEN))
1831 more = do_cmd_open_aux(y, x);
1834 /* Bash jammed doors */
1835 else if (have_flag(f_ptr->flags, FF_BASH))
1837 more = do_cmd_bash_aux(y, x, dir);
1840 /* Tunnel through walls */
1841 else if (have_flag(f_ptr->flags, FF_TUNNEL))
1843 more = do_cmd_tunnel_aux(y, x);
1846 /* Close open doors */
1847 else if (have_flag(f_ptr->flags, FF_CLOSE))
1849 more = do_cmd_close_aux(y, x);
1853 else if (have_flag(f_ptr->flags, FF_DISARM))
1855 more = do_cmd_disarm_aux(y, x, dir);
1860 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
1864 /* Cancel repetition unless we can continue */
1865 if (!more) disturb(FALSE, FALSE);
1871 * @brief 「くさびを打つ」ために必要なオブジェクトがあるかどうかの判定を返す /
1872 * Find the index of some "spikes", if possible.
1873 * @param ip くさびとして打てるオブジェクトのID
1874 * @return オブジェクトがある場合TRUEを返す
1877 * Let user choose a pile of spikes, perhaps?
1880 static bool get_spike(INVENTORY_IDX *ip)
1884 /* Check every item in the pack */
1885 for (i = 0; i < INVEN_PACK; i++)
1887 object_type *o_ptr = &inventory[i];
1889 /* Skip non-objects */
1890 if (!o_ptr->k_idx) continue;
1892 /* Check the "tval" code */
1893 if (o_ptr->tval == TV_SPIKE)
1895 /* Save the spike index */
1908 * @brief 「くさびを打つ」動作コマンドのメインルーチン /
1909 * Jam a closed door with a spike
1913 * This command may NOT be repeated
1916 void do_cmd_spike(void)
1920 if (p_ptr->wild_mode) return;
1922 if (p_ptr->special_defense & KATA_MUSOU)
1924 set_action(ACTION_NONE);
1927 /* Get a "repeated" direction */
1928 if (get_rep_dir(&dir, FALSE))
1935 y = p_ptr->y + ddy[dir];
1936 x = p_ptr->x + ddx[dir];
1937 c_ptr = &cave[y][x];
1939 /* Feature code (applying "mimic" field) */
1940 feat = get_feat_mimic(c_ptr);
1942 /* Require closed door */
1943 if (!have_flag(f_info[feat].flags, FF_SPIKE))
1945 msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
1949 else if (!get_spike(&item))
1951 msg_print(_("くさびを持っていない!", "You have no spikes!"));
1954 /* Is a monster in the way? */
1955 else if (c_ptr->m_idx)
1957 p_ptr->energy_use = 100;
1959 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1968 p_ptr->energy_use = 100;
1970 /* Successful jamming */
1971 msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
1972 cave_alter_feat(y, x, FF_SPIKE);
1974 /* Use up, and describe, a single spike, from the bottom */
1975 inven_item_increase(item, -1);
1976 inven_item_describe(item);
1977 inven_item_optimize(item);
1985 * @brief 「歩く」動作コマンドのメインルーチン /
1986 * Support code for the "Walk" and "Jump" commands
1987 * @param pickup アイテムの自動拾いを行うならTRUE
1990 void do_cmd_walk(bool pickup)
1997 /* Allow repeated command */
2000 /* Set repeat count */
2001 command_rep = command_arg - 1;
2002 p_ptr->redraw |= (PR_STATE);
2004 /* Cancel the arg */
2008 /* Get a "repeated" direction */
2009 if (get_rep_dir(&dir, FALSE))
2011 p_ptr->energy_use = 100;
2013 if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
2015 set_action(ACTION_NONE);
2018 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2019 if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
2020 if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100;
2022 /* Actually move the character */
2023 move_player(dir, pickup, FALSE);
2025 /* Allow more walking */
2029 /* Hack again -- Is there a special encounter ??? */
2030 if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN))
2032 int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5;
2035 if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
2037 /* Inform the player of his horrible fate :=) */
2038 msg_print(_("襲撃だ!", "You are ambushed !"));
2040 /* Go into large wilderness view */
2041 p_ptr->oldpy = randint1(MAX_HGT-2);
2042 p_ptr->oldpx = randint1(MAX_WID-2);
2045 /* Give first move to monsters */
2046 p_ptr->energy_use = 100;
2048 /* HACk -- set the encouter flag for the wilderness generation */
2049 generate_encounter = TRUE;
2053 /* Cancel repeat unless we may continue */
2054 if (!more) disturb(FALSE, FALSE);
2059 * @brief 「走る」動作コマンドのメインルーチン /
2063 void do_cmd_run(void)
2067 /* Hack -- no running when confused */
2068 if (p_ptr->confused)
2070 msg_print(_("混乱していて走れない!", "You are too confused!"));
2074 if (p_ptr->special_defense & KATA_MUSOU)
2076 set_action(ACTION_NONE);
2079 /* Get a "repeated" direction */
2080 if (get_rep_dir(&dir,FALSE))
2082 /* Hack -- Set the run counter */
2083 running = (command_arg ? command_arg : 1000);
2092 * @brief 「留まる」動作コマンドのメインルーチン /
2093 * Stay still. Search. Enter stores.
2094 * Pick up treasure if "pickup" is true.
2095 * @param pickup アイテムの自動拾いを行うならTRUE
2098 void do_cmd_stay(bool pickup)
2100 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2102 /* Allow repeated command */
2105 /* Set repeat count */
2106 command_rep = command_arg - 1;
2107 p_ptr->redraw |= (PR_STATE);
2109 /* Cancel the arg */
2113 p_ptr->energy_use = 100;
2115 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2116 (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
2121 * @brief 「休む」動作コマンドのメインルーチン /
2122 * Resting allows a player to safely restore his hp -RAK-
2125 void do_cmd_rest(void)
2128 set_action(ACTION_NONE);
2130 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
2136 if (hex_spelling_any()) stop_hex_spell_all();
2138 /* Prompt for time if needed */
2139 if (command_arg <= 0)
2141 concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ",
2142 "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
2148 strcpy(out_val, "&");
2150 /* Ask for duration */
2151 if (!get_string(p, out_val, 4)) return;
2153 /* Rest until done */
2154 if (out_val[0] == '&')
2156 command_arg = COMMAND_ARG_REST_UNTIL_DONE;
2160 else if (out_val[0] == '*')
2162 command_arg = COMMAND_ARG_REST_FULL_HEALING;
2168 command_arg = (COMMAND_ARG)atoi(out_val);
2169 if (command_arg <= 0) return;
2175 if (command_arg > 9999) command_arg = 9999;
2177 if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
2179 /* Take a turn (?) */
2180 p_ptr->energy_use = 100;
2182 /* The sin of sloth */
2183 if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
2185 /* Why are you sleeping when there's no need? WAKE UP!*/
2186 if ((p_ptr->chp == p_ptr->mhp) &&
2187 (p_ptr->csp == p_ptr->msp) &&
2188 !p_ptr->blind && !p_ptr->confused &&
2189 !p_ptr->poisoned && !p_ptr->afraid &&
2190 !p_ptr->stun && !p_ptr->cut &&
2191 !p_ptr->slow && !p_ptr->paralyzed &&
2192 !p_ptr->image && !p_ptr->word_recall &&
2193 !p_ptr->alter_reality)
2194 chg_virtue(V_DILIGENCE, -1);
2196 /* Save the rest code */
2197 resting = command_arg;
2198 p_ptr->action = ACTION_REST;
2199 p_ptr->update |= (PU_BONUS);
2200 update_creature(p_ptr);
2202 p_ptr->redraw |= (PR_STATE);
2211 * @brief 射撃処理のメインルーチン
2214 void do_cmd_fire(void)
2217 object_type *j_ptr, *ammo_ptr;
2220 if(p_ptr->wild_mode) return;
2222 is_fired = FALSE; /* not fired yet */
2224 /* Get the "bow" (if any) */
2225 j_ptr = &inventory[INVEN_BOW];
2227 /* Require a launcher */
2230 msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
2235 if (j_ptr->sval == SV_CRIMSON)
2237 msg_print(_("この武器は発動して使うもののようだ。", "Do activate."));
2242 if (j_ptr->sval == SV_HARP)
2244 msg_print(_("この武器で射撃はできない。", "It's not for firing."));
2250 if (p_ptr->special_defense & KATA_MUSOU)
2252 set_action(ACTION_NONE);
2255 /* Require proper missile */
2256 item_tester_tval = p_ptr->tval_ammo;
2258 q = _("どれを撃ちますか? ", "Fire which item? ");
2259 s = _("発射されるアイテムがありません。", "You have nothing to fire.");
2262 ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
2270 exe_fire(item, j_ptr);
2272 if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
2274 /* Sniper actions after some shootings */
2275 if (snipe_type == SP_AWAY)
2277 teleport_player(10 + (p_ptr->concent * 2), 0L);
2279 if (snipe_type == SP_FINAL)
2281 msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
2282 (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE);
2283 (void)set_stun(p_ptr->stun + randint1(25));
2289 * @brief 投射処理メインルーチン /
2290 * Throw an object from the pack or floor.
2292 * @param boomerang ブーメラン処理ならばTRUE
2293 * @param shuriken 忍者の手裏剣処理ならばTRUE
2294 * @return ターンを消費した場合TRUEを返す
2297 * Note: "unseen" monsters are very hard to hit.
2299 * Should throwing a weapon do full damage? Should it allow the magic
2300 * to hit bonus of the weapon to have an effect? Should it ever cause
2301 * the item to be destroyed? Should it do any damage at all?
2304 bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
2309 POSITION y, x, ty, tx, prev_y, prev_x;
2310 POSITION ny[19], nx[19];
2311 int chance, tdam, tdis;
2312 int mul, div, dd, ds;
2313 int cur_dis, visible;
2320 bool hit_body = FALSE;
2321 bool hit_wall = FALSE;
2322 bool equiped_item = FALSE;
2323 bool return_when_thrown = FALSE;
2325 GAME_TEXT o_name[MAX_NLEN];
2327 int msec = delay_factor * delay_factor * delay_factor;
2329 BIT_FLAGS flgs[TR_FLAG_SIZE];
2331 bool come_back = FALSE;
2332 bool do_drop = TRUE;
2334 if (p_ptr->wild_mode) return FALSE;
2336 if (p_ptr->special_defense & KATA_MUSOU)
2338 set_action(ACTION_NONE);
2344 o_ptr = &inventory[item];
2348 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
2350 item_tester_hook = item_tester_hook_boomerang;
2351 q = _("どの武器を投げますか? ", "Throw which item? ");
2352 s = _("投げる武器がない。", "You have nothing to throw.");
2353 o_ptr = choose_object(&item, q, s, (USE_EQUIP));
2360 else if (has_melee_weapon(INVEN_LARM))
2363 o_ptr = &inventory[item];
2368 o_ptr = &inventory[item];
2373 q = _("どのアイテムを投げますか? ", "Throw which item? ");
2374 s = _("投げるアイテムがない。", "You have nothing to throw.");
2375 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP));
2383 /* Item is cursed */
2384 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
2386 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
2391 if (p_ptr->inside_arena && !boomerang)
2393 if (o_ptr->tval != TV_SPIKE)
2395 msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
2404 /* Obtain a local object */
2405 object_copy(q_ptr, o_ptr);
2407 /* Extract the thrown object's flags. */
2408 object_flags(q_ptr, flgs);
2409 torch_flags(q_ptr, flgs);
2411 /* Distribute the charges of rods/wands between the stacks */
2412 distribute_charges(o_ptr, q_ptr, 1);
2417 object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
2419 if (p_ptr->mighty_throw) mult += 3;
2421 /* Extract a "distance multiplier" */
2422 /* Changed for 'launcher' mutation */
2423 mul = 10 + 2 * (mult - 1);
2425 /* Enforce a minimum "weight" of one pound */
2426 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
2427 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
2429 /* Hack -- Distance -- Reward strength, penalize weight */
2430 tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div;
2432 /* Max distance of 10-18 */
2433 if (tdis > mul) tdis = mul;
2437 ty = randint0(101) - 50 + p_ptr->y;
2438 tx = randint0(101) - 50 + p_ptr->x;
2442 project_length = tdis + 1;
2444 /* Get a direction (or cancel) */
2445 if (!get_aim_dir(&dir)) return FALSE;
2447 /* Predict the "target" location */
2448 tx = p_ptr->x + 99 * ddx[dir];
2449 ty = p_ptr->y + 99 * ddy[dir];
2451 /* Check for "target request" */
2452 if ((dir == 5) && target_okay())
2458 project_length = 0; /* reset to default */
2461 if ((q_ptr->name1 == ART_MJOLLNIR) ||
2462 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
2463 return_when_thrown = TRUE;
2465 /* Reduce and describe inventory */
2468 inven_item_increase(item, -1);
2469 if (!return_when_thrown)
2470 inven_item_describe(item);
2471 inven_item_optimize(item);
2474 /* Reduce and describe floor item */
2477 floor_item_increase(0 - item, -1);
2478 floor_item_optimize(0 - item);
2480 if (item >= INVEN_RARM)
2482 equiped_item = TRUE;
2483 p_ptr->redraw |= (PR_EQUIPPY);
2486 p_ptr->energy_use = 100;
2488 /* Rogue and Ninja gets bonus */
2489 if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
2490 p_ptr->energy_use -= p_ptr->lev;
2492 /* Start at the player */
2498 if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
2499 else shuriken = FALSE;
2501 /* Chance of hitting */
2502 if (have_flag(flgs, TR_THROW)) chance = ((p_ptr->skill_tht) +
2503 ((p_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
2504 else chance = (p_ptr->skill_tht + (p_ptr->to_h_b * BTH_PLUS_ADJ));
2506 if (shuriken) chance *= 2;
2511 /* Travel until stopped */
2512 for (cur_dis = 0; cur_dis <= tdis; )
2514 /* Hack -- Stop at the target */
2515 if ((y == ty) && (x == tx)) break;
2517 /* Calculate the new location (see "project()") */
2520 mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx);
2522 /* Stopped by walls/doors */
2523 if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
2526 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
2529 /* The player can see the (on screen) missile */
2530 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
2532 SYMBOL_CODE c = object_char(q_ptr);
2533 TERM_COLOR a = object_attr(q_ptr);
2535 /* Draw, Hilite, Fresh, Pause, Erase */
2536 print_rel(c, a, ny[cur_dis], nx[cur_dis]);
2537 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
2539 Term_xtra(TERM_XTRA_DELAY, msec);
2540 lite_spot(ny[cur_dis], nx[cur_dis]);
2544 /* The player cannot see the missile */
2547 /* Pause anyway, for consistancy */
2548 Term_xtra(TERM_XTRA_DELAY, msec);
2554 /* Save the new location */
2558 /* Advance the distance */
2561 /* Monster here, Try to hit it */
2562 if (cave[y][x].m_idx)
2564 cave_type *c_ptr = &cave[y][x];
2565 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2567 /* Check the visibility */
2568 visible = m_ptr->ml;
2570 /* Note the collision */
2573 /* Did we hit it (penalize range) */
2574 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
2578 /* Handle unseen monster */
2581 /* Invisible monster */
2582 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
2585 /* Handle visible monster */
2588 GAME_TEXT m_name[MAX_NLEN];
2589 monster_desc(m_name, m_ptr, 0);
2590 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
2594 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2595 health_track(c_ptr->m_idx);
2599 /* Hack -- Base damage from thrown object */
2602 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
2603 tdam = damroll(dd, ds);
2604 /* Apply special damage */
2605 tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
2606 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
2607 if (q_ptr->to_d > 0)
2608 tdam += q_ptr->to_d;
2610 tdam += -q_ptr->to_d;
2614 tdam *= (mult+p_ptr->num_blow[item - INVEN_RARM]);
2615 tdam += p_ptr->to_d_m;
2617 else if (have_flag(flgs, TR_THROW))
2620 tdam += p_ptr->to_d_m;
2628 tdam += ((p_ptr->lev+30)*(p_ptr->lev+30)-900)/55;
2631 /* No negative damage */
2632 if (tdam < 0) tdam = 0;
2634 /* Modify the damage */
2635 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
2637 msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
2638 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
2640 /* Hit the monster, check for death */
2641 if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
2649 message_pain(c_ptr->m_idx, tdam);
2651 /* Anger the monster */
2652 if ((tdam > 0) && !object_is_potion(q_ptr))
2653 anger_monster(m_ptr);
2655 if (fear && m_ptr->ml)
2658 GAME_TEXT m_name[MAX_NLEN];
2659 monster_desc(m_name, m_ptr, 0);
2660 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2670 /* decrease toach's fuel */
2671 if (hit_body) torch_lost_fuel(q_ptr);
2673 /* Chance of breakage (during attacks) */
2674 j = (hit_body ? breakage_chance(q_ptr) : 0);
2676 /* Figurines transform */
2677 if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
2681 if (!(summon_named_creature(0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
2682 msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
2683 else if (object_is_cursed(q_ptr))
2684 msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
2689 /* Potions smash open */
2690 if (object_is_potion(q_ptr))
2692 if (hit_body || hit_wall || (randint1(100) < j))
2694 msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
2696 if (potion_smash_effect(0, y, x, q_ptr->k_idx))
2698 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
2700 /* ToDo (Robert): fix the invulnerability */
2701 if (cave[y][x].m_idx &&
2702 is_friendly(&m_list[cave[y][x].m_idx]) &&
2703 !MON_INVULNER(m_ptr))
2705 GAME_TEXT m_name[MAX_NLEN];
2706 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
2707 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
2708 set_hostile(&m_list[cave[y][x].m_idx]);
2719 if (return_when_thrown)
2721 int back_chance = randint1(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
2722 char o2_name[MAX_NLEN];
2723 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
2726 if (boomerang) back_chance += 4+randint1(5);
2727 if (super_boomerang) back_chance += 100;
2728 object_desc(o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2730 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
2732 for (i = cur_dis - 1; i > 0; i--)
2734 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
2736 char c = object_char(q_ptr);
2737 byte a = object_attr(q_ptr);
2739 /* Draw, Hilite, Fresh, Pause, Erase */
2740 print_rel(c, a, ny[i], nx[i]);
2741 move_cursor_relative(ny[i], nx[i]);
2743 Term_xtra(TERM_XTRA_DELAY, msec);
2744 lite_spot(ny[i], nx[i]);
2749 /* Pause anyway, for consistancy */
2750 Term_xtra(TERM_XTRA_DELAY, msec);
2753 if((back_chance > 37) && !p_ptr->blind && (item >= 0))
2755 msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
2762 msg_format(_("%sを受け損ねた!", "%s backs, but you can't catch!"), o2_name);
2766 msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
2774 msg_format(_("%sが返ってこなかった!", "%s doesn't back!"), o2_name);
2780 if (item == INVEN_RARM || item == INVEN_LARM)
2782 /* Access the wield slot */
2783 o_ptr = &inventory[item];
2785 /* Wear the new stuff */
2786 object_copy(o_ptr, q_ptr);
2788 p_ptr->total_weight += q_ptr->weight;
2790 /* Increment the equip counter by hand */
2793 /* Recalculate torch */
2794 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
2795 p_ptr->window |= (PW_EQUIP);
2803 else if (equiped_item)
2811 if (cave_have_flag_bold(y, x, FF_PROJECT))
2813 (void)drop_near(q_ptr, j, y, x);
2817 (void)drop_near(q_ptr, j, prev_y, prev_x);
2827 * Hack: travel command
2829 #define TRAVEL_UNABLE 9999
2831 static int flow_head = 0;
2832 static int flow_tail = 0;
2833 static POSITION temp2_x[MAX_SHORT];
2834 static POSITION temp2_y[MAX_SHORT];
2837 * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
2840 void forget_travel_flow(void)
2843 /* Check the entire dungeon / Forget the old data */
2844 for (y = 0; y < cur_hgt; y++)
2846 for (x = 0; x < cur_wid; x++)
2849 travel.cost[y][x] = MAX_SHORT;
2852 travel.y = travel.x = 0;
2856 * @brief トラベル処理中に地形に応じた移動コスト基準を返す
2861 static int travel_flow_cost(POSITION y, POSITION x)
2863 feature_type *f_ptr = &f_info[cave[y][x].feat];
2866 /* Avoid obstacles (ex. trees) */
2867 if (have_flag(f_ptr->flags, FF_AVOID_RUN)) cost += 1;
2870 if (have_flag(f_ptr->flags, FF_WATER))
2872 if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5;
2876 if (have_flag(f_ptr->flags, FF_LAVA))
2879 if (!p_ptr->resist_fire) lava *= 2;
2880 if (!p_ptr->levitation) lava *= 2;
2881 if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2;
2886 /* Detected traps and doors */
2887 if (cave[y][x].info & (CAVE_MARK))
2889 if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
2890 if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
2897 * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
2901 * @param wall プレイヤーが壁の中にいるならばTRUE
2904 static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
2906 cave_type *c_ptr = &cave[y][x];
2907 feature_type *f_ptr = &f_info[c_ptr->feat];
2908 int old_head = flow_head;
2910 int base_cost = (n % TRAVEL_UNABLE);
2911 int from_wall = (n / TRAVEL_UNABLE);
2914 /* Ignore out of bounds */
2915 if (!in_bounds(y, x)) return;
2917 /* Ignore unknown grid except in wilderness */
2918 if (dun_level > 0 && !(c_ptr->info & CAVE_KNOWN)) return;
2920 /* Ignore "walls" and "rubble" (include "secret doors") */
2921 if (have_flag(f_ptr->flags, FF_WALL) ||
2922 have_flag(f_ptr->flags, FF_CAN_DIG) ||
2923 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic) ||
2924 (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation))
2926 if (!wall || !from_wall) return;
2927 add_cost += TRAVEL_UNABLE;
2931 add_cost = travel_flow_cost(y, x);
2934 cost = base_cost + add_cost;
2936 /* Ignore lower cost entries */
2937 if (travel.cost[y][x] <= cost) return;
2939 /* Save the flow cost */
2940 travel.cost[y][x] = cost;
2942 /* Enqueue that entry */
2943 temp2_y[flow_head] = y;
2944 temp2_x[flow_head] = x;
2946 /* Advance the queue */
2947 if (++flow_head == MAX_SHORT) flow_head = 0;
2949 /* Hack -- notice overflow by forgetting new entry */
2950 if (flow_head == flow_tail) flow_head = old_head;
2956 * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
2957 * @param ty 目標地点のY座標
2958 * @param tx 目標地点のX座標
2961 static void travel_flow(POSITION ty, POSITION tx)
2965 feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
2967 /* Reset the "queue" */
2968 flow_head = flow_tail = 0;
2970 /* is player in the wall? */
2971 if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE;
2973 /* Start at the target grid */
2974 travel_flow_aux(ty, tx, 0, wall);
2976 /* Now process the queue */
2977 while (flow_head != flow_tail)
2979 /* Extract the next entry */
2980 y = temp2_y[flow_tail];
2981 x = temp2_x[flow_tail];
2983 /* Forget that entry */
2984 if (++flow_tail == MAX_SHORT) flow_tail = 0;
2986 /* Ignore too far entries */
2987 //if (distance(ty, tx, y, x) > 100) continue;
2989 /* Add the "children" */
2990 for (d = 0; d < 8; d++)
2992 /* Add that child if "legal" */
2993 travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
2997 /* Forget the flow info */
2998 flow_head = flow_tail = 0;
3002 * @brief トラベル処理のメインルーチン
3005 void do_cmd_travel(void)
3009 POSITION dx, dy, sx, sy;
3010 feature_type *f_ptr;
3012 if (travel.x != 0 && travel.y != 0 &&
3013 get_check(_("トラベルを継続しますか?", "Do you continue to travel?")))
3018 else if (!tgt_pt(&x, &y)) return;
3020 if ((x == p_ptr->x) && (y == p_ptr->y))
3022 msg_print(_("すでにそこにいます!", "You are already there!!"));
3026 f_ptr = &f_info[cave[y][x].feat];
3028 if ((cave[y][x].info & CAVE_MARK) &&
3029 (have_flag(f_ptr->flags, FF_WALL) ||
3030 have_flag(f_ptr->flags, FF_CAN_DIG) ||
3031 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic)))
3033 msg_print(_("そこには行くことができません!", "You cannot travel there!"));
3037 forget_travel_flow();
3043 /* Travel till 255 steps */
3049 /* Decides first direction */
3050 dx = abs(p_ptr->x - x);
3051 dy = abs(p_ptr->y - y);
3052 sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1);
3053 sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1);
3055 for (i = 1; i <= 9; i++)
3057 if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;