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.
14 #include "main/music-definitions-table.h"
15 #include "main/sound-definitions-table.h"
19 #include "io/write-diary.h"
20 #include "cmd/cmd-dump.h"
21 #include "cmd/cmd-save.h"
26 #include "object-hook.h"
27 #include "monster-status.h"
31 #include "player-status.h"
32 #include "realm-hex.h"
36 #include "player-move.h"
37 #include "player-effects.h"
38 #include "player-personality.h"
39 #include "player-inventory.h"
40 #include "object/object-kind.h"
41 #include "object-broken.h"
42 #include "object-flavor.h"
46 #include "cmd-basic.h"
47 #include "dungeon-file.h"
50 #include "view/display-main-window.h"
51 #include "targeting.h"
55 * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
56 * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
57 * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
59 static bool confirm_leave_level(player_type *creature_ptr, bool down_stair)
61 quest_type *q_ptr = &quest[creature_ptr->current_floor_ptr->inside_quest];
63 /* Confirm leaving from once only quest */
64 if (confirm_quest && creature_ptr->current_floor_ptr->inside_quest &&
65 (q_ptr->type == QUEST_TYPE_RANDOM ||
66 (q_ptr->flags & QUEST_FLAG_ONCE &&
67 q_ptr->status != QUEST_STATUS_COMPLETED) ||
68 (q_ptr->flags & QUEST_FLAG_TOWER &&
69 ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
70 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
72 msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
73 if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
83 * @brief 魔法系コマンドが制限されているかを返す。
84 * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
86 bool cmd_limit_cast(player_type *creature_ptr)
88 if (creature_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
90 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
94 else if (creature_ptr->anti_magic)
96 msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
99 else if (creature_ptr->shero)
101 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
108 bool cmd_limit_confused(player_type *creature_ptr)
110 if (creature_ptr->confused)
112 msg_print(_("混乱していてできない!", "You are too confused!"));
118 bool cmd_limit_image(player_type *creature_ptr)
120 if (creature_ptr->image)
122 msg_print(_("幻覚が見えて集中できない!", "Your hallucinations prevent you from concentrating!"));
128 bool cmd_limit_stun(player_type *creature_ptr)
130 if (creature_ptr->stun)
132 msg_print(_("頭が朦朧としていて集中できない!", "You are too stunned!"));
138 bool cmd_limit_arena(player_type *creature_ptr)
140 if (creature_ptr->current_floor_ptr->inside_arena)
142 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
149 bool cmd_limit_blind(player_type *creature_ptr)
151 if (creature_ptr->blind)
153 msg_print(_("目が見えない。", "You can't see anything."));
156 if (no_lite(creature_ptr))
158 msg_print(_("明かりがないので見えない。", "You have no light."));
164 bool cmd_limit_time_walk(player_type *creature_ptr)
166 if (creature_ptr->timewalk)
168 if (flush_failure) flush();
169 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
177 * @brief 階段を使って階層を昇る処理 / Go up one level
180 void do_cmd_go_up(player_type *creature_ptr)
185 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
186 feature_type *f_ptr = &f_info[g_ptr->feat];
190 if (creature_ptr->special_defense & KATA_MUSOU)
192 set_action(creature_ptr, ACTION_NONE);
196 if (!have_flag(f_ptr->flags, FF_LESS))
198 msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
202 /* Quest up stairs */
203 if (have_flag(f_ptr->flags, FF_QUEST))
205 if (!confirm_leave_level(creature_ptr, FALSE)) return;
208 if (IS_ECHIZEN(creature_ptr))
209 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
211 msg_print(_("上の階に登った。", "You enter the up staircase."));
213 leave_quest_check(creature_ptr);
215 creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
217 /* Activate the quest */
218 if (!quest[creature_ptr->current_floor_ptr->inside_quest].status)
220 if (quest[creature_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
222 init_flags = INIT_ASSIGN;
223 process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
225 quest[creature_ptr->current_floor_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
228 /* Leaving a quest */
229 if (!creature_ptr->current_floor_ptr->inside_quest)
231 creature_ptr->current_floor_ptr->dun_level = 0;
233 creature_ptr->leaving = TRUE;
235 creature_ptr->oldpx = 0;
236 creature_ptr->oldpy = 0;
238 take_turn(creature_ptr, 100);
240 /* End the command */
244 if (!creature_ptr->current_floor_ptr->dun_level)
250 go_up = confirm_leave_level(creature_ptr, FALSE);
255 take_turn(creature_ptr, 100);
257 if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
259 /* For a random quest */
260 if (creature_ptr->current_floor_ptr->inside_quest &&
261 quest[creature_ptr->current_floor_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
263 leave_quest_check(creature_ptr);
265 creature_ptr->current_floor_ptr->inside_quest = 0;
268 /* For a fixed quest */
269 if (creature_ptr->current_floor_ptr->inside_quest &&
270 quest[creature_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
272 leave_quest_check(creature_ptr);
274 creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
275 creature_ptr->current_floor_ptr->dun_level = 0;
279 /* For normal dungeon and random quest */
283 if (have_flag(f_ptr->flags, FF_SHAFT))
285 /* Create a way back */
286 prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
292 /* Create a way back */
293 prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP);
298 /* Get out from current dungeon */
299 if (creature_ptr->current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth)
300 up_num = creature_ptr->current_floor_ptr->dun_level;
302 if (record_stair) exe_write_diary(creature_ptr, DIARY_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
305 if (IS_ECHIZEN(creature_ptr))
306 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
307 else if (up_num == creature_ptr->current_floor_ptr->dun_level)
308 msg_print(_("地上に戻った。", "You go back to the surface."));
310 msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
311 creature_ptr->leaving = TRUE;
316 * @brief 階段を使って階層を降りる処理 / Go down one level
317 * @param creature_ptr プレーヤーへの参照ポインタ
320 void do_cmd_go_down(player_type *creature_ptr)
322 bool fall_trap = FALSE;
325 if (creature_ptr->special_defense & KATA_MUSOU)
327 set_action(creature_ptr, ACTION_NONE);
331 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
332 feature_type *f_ptr = &f_info[g_ptr->feat];
333 if (!have_flag(f_ptr->flags, FF_MORE))
335 msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
339 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
342 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
344 do_cmd_quest(creature_ptr);
348 /* Quest down stairs */
349 if (have_flag(f_ptr->flags, FF_QUEST))
351 /* Confirm Leaving */
352 if(!confirm_leave_level(creature_ptr, TRUE)) return;
354 if (IS_ECHIZEN(creature_ptr))
355 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
357 msg_print(_("下の階に降りた。", "You enter the down staircase."));
359 leave_quest_check(creature_ptr);
360 leave_tower_check(creature_ptr);
362 creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
364 /* Activate the quest */
365 if (!quest[creature_ptr->current_floor_ptr->inside_quest].status)
367 if (quest[creature_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
369 init_flags = INIT_ASSIGN;
370 process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
372 quest[creature_ptr->current_floor_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
375 /* Leaving a quest */
376 if (!creature_ptr->current_floor_ptr->inside_quest)
378 creature_ptr->current_floor_ptr->dun_level = 0;
380 creature_ptr->leaving = TRUE;
381 creature_ptr->oldpx = 0;
382 creature_ptr->oldpy = 0;
384 take_turn(creature_ptr, 100);
388 DUNGEON_IDX target_dungeon = 0;
390 if (!creature_ptr->current_floor_ptr->dun_level)
392 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
394 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
396 msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
399 if (!max_dlv[target_dungeon])
401 msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
402 d_name + d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
403 if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
406 /* Save old player position */
407 creature_ptr->oldpx = creature_ptr->x;
408 creature_ptr->oldpy = creature_ptr->y;
409 creature_ptr->dungeon_idx = target_dungeon;
412 * Clear all saved floors
413 * and create a first saved floor
415 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
418 take_turn(creature_ptr, 100);
420 if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
423 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
426 if (!creature_ptr->current_floor_ptr->dun_level)
428 /* Enter the dungeon just now */
429 creature_ptr->enter_dungeon = TRUE;
430 down_num = d_info[creature_ptr->dungeon_idx].mindepth;
435 if (fall_trap) exe_write_diary(creature_ptr, DIARY_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
436 else exe_write_diary(creature_ptr, DIARY_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
441 msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
448 msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[creature_ptr->dungeon_idx].text);
452 if (IS_ECHIZEN(creature_ptr))
453 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
455 msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
459 creature_ptr->leaving = TRUE;
463 prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
467 /* Create a way back */
468 if (have_flag(f_ptr->flags, FF_SHAFT))
470 prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
474 prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN);
480 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
483 void do_cmd_search(player_type * creature_ptr)
485 /* Allow repeated command */
488 /* Set repeat count */
489 command_rep = command_arg - 1;
490 creature_ptr->redraw |= (PR_STATE);
496 take_turn(creature_ptr, 100);
497 search(creature_ptr);
502 * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
503 * @param y 走査対象にしたいマスのY座標
504 * @param x 走査対象にしたいマスのX座標
505 * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
506 * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
508 static OBJECT_IDX chest_check(floor_type *floor_ptr, POSITION y, POSITION x, bool trapped)
510 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
511 OBJECT_IDX this_o_idx, next_o_idx = 0;
513 /* Scan all objects in the grid */
514 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
518 o_ptr = &floor_ptr->o_list[this_o_idx];
519 next_o_idx = o_ptr->next_o_idx;
521 /* Skip unknown chests XXX XXX */
522 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
524 /* Check for non empty chest */
525 if ((o_ptr->tval == TV_CHEST) &&
526 (((!trapped) && (o_ptr->pval)) || /* non empty */
527 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
538 * Attempt to open the given chest at the given location
539 * @param y 箱の存在するマスのY座標
540 * @param x 箱の存在するマスのX座標
541 * @param o_idx 箱のオブジェクトID
542 * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
544 * Assume there is no monster blocking the destination
546 static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
550 object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
552 take_turn(creature_ptr, 100);
554 /* Attempt to unlock it */
557 /* Assume locked, and thus not open */
560 /* Get the "disarm" factor */
561 int i = creature_ptr->skill_dis;
563 /* Penalize some conditions */
564 if (creature_ptr->blind || no_lite(creature_ptr)) i = i / 10;
565 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
567 /* Extract the difficulty */
568 int j = i - o_ptr->pval;
570 /* Always have a small chance of success */
573 /* Success -- May still have traps */
574 if (randint0(100) < j)
576 msg_print(_("鍵をはずした。", "You have picked the lock."));
577 gain_exp(creature_ptr, 1);
581 /* Failure -- Keep trying */
584 /* We may continue repeating */
586 if (flush_failure) flush();
587 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
592 /* Allowed to open */
595 /* Apply chest traps, if any */
596 chest_trap(creature_ptr, y, x, o_idx);
598 /* Let the Chest drop items */
599 chest_death(creature_ptr, FALSE, y, x, o_idx);
606 * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
607 * Attempt to open the given chest at the given location
608 * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
609 * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
610 * @param test 地形条件を判定するための関数ポインタ
611 * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
613 * @details Return the number of features around (or under) the character.
614 * Usually look for doors and floor traps.
616 static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (*test)(player_type*, FEAT_IDX feat), bool under)
618 /* Check around (and under) the character */
620 for (DIRECTION d = 0; d < 9; d++)
625 /* if not searching under player continue */
626 if ((d == 8) && !under) continue;
628 /* Extract adjacent (legal) location */
629 POSITION yy = creature_ptr->y + ddy_ddd[d];
630 POSITION xx = creature_ptr->x + ddx_ddd[d];
632 /* Get the creature_ptr->current_floor_ptr->grid_array */
633 g_ptr = &creature_ptr->current_floor_ptr->grid_array[yy][xx];
635 /* Must have knowledge */
636 if (!(g_ptr->info & (CAVE_MARK))) continue;
638 /* Feature code (applying "mimic" field) */
639 feat = get_feat_mimic(g_ptr);
641 /* Not looking for this feature */
642 if (!((*test)(creature_ptr, feat))) continue;
647 /* Remember the location. Only useful if only one match */
658 * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
659 * Return the number of chests around (or under) the character.
660 * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
661 * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
662 * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
665 * If requested, count only trapped chests.
667 static int count_chests(player_type *creature_ptr, POSITION *y, POSITION *x, bool trapped)
669 /* Check around (and under) the character */
671 for (DIRECTION d = 0; d < 9; d++)
673 /* Extract adjacent (legal) location */
674 POSITION yy = creature_ptr->y + ddy_ddd[d];
675 POSITION xx = creature_ptr->x + ddx_ddd[d];
677 /* No (visible) chest is there */
678 OBJECT_IDX o_idx = chest_check(creature_ptr->current_floor_ptr, yy, xx, FALSE);
679 if (!o_idx) continue;
681 /* Grab the object */
683 o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
686 if (o_ptr->pval == 0) continue;
688 /* No (known) traps here */
689 if (trapped && (!object_is_known(o_ptr) ||
690 !chest_traps[o_ptr->pval])) continue;
695 /* Remember the location. Only useful if only one match */
707 * @brief 「開ける」動作コマンドのサブルーチン /
708 * Perform the basic "open" command on doors
709 * @param y 対象を行うマスのY座標
710 * @param x 対象を行うマスのX座標
711 * @return 実際に処理が行われた場合TRUEを返す。
713 * Assume destination is a closed/locked/jammed door
714 * Assume there is no monster blocking the destination
715 * Returns TRUE if repeated commands may continue
717 static bool exe_open(player_type *creature_ptr, POSITION y, POSITION x)
719 /* Get requested grid */
720 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
721 feature_type *f_ptr = &f_info[g_ptr->feat];
724 take_turn(creature_ptr, 100);
726 /* Seeing true feature code (ignore mimic) */
729 if (!have_flag(f_ptr->flags, FF_OPEN))
732 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
738 cave_alter_feat(creature_ptr, y, x, FF_OPEN);
739 sound(SOUND_OPENDOOR);
744 int i = creature_ptr->skill_dis;
746 /* Penalize some conditions */
747 if (creature_ptr->blind || no_lite(creature_ptr)) i = i / 10;
748 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
750 /* Extract the difficulty */
751 int j = f_ptr->power;
754 /* Always have a small chance of success */
757 if (randint0(100) >= j)
759 if (flush_failure) flush();
760 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
764 msg_print(_("鍵をはずした。", "You have picked the lock."));
767 cave_alter_feat(creature_ptr, y, x, FF_OPEN);
769 sound(SOUND_OPENDOOR);
772 gain_exp(creature_ptr, 1);
777 * @brief 「開ける」コマンドのメインルーチン /
778 * Open a closed/locked/jammed door or a closed/locked chest.
781 * Unlocking a locked door/chest is worth one experience point.
783 void do_cmd_open(player_type *creature_ptr)
791 if (creature_ptr->wild_mode) return;
793 if (creature_ptr->special_defense & KATA_MUSOU)
795 set_action(creature_ptr, ACTION_NONE);
798 /* Option: Pick a direction */
801 int num_doors, num_chests;
803 num_doors = count_dt(creature_ptr, &y, &x, is_closed_door, FALSE);
804 num_chests = count_chests(creature_ptr, &y, &x, FALSE);
805 if (num_doors || num_chests)
807 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
809 if (!too_many) command_dir = coords_to_dir(creature_ptr, y, x);
813 /* Allow repeated command */
816 /* Set repeat count */
817 command_rep = command_arg - 1;
818 creature_ptr->redraw |= (PR_STATE);
824 /* Get a "repeated" direction */
825 if (get_rep_dir(creature_ptr, &dir, TRUE))
830 /* Get requested location */
831 y = creature_ptr->y + ddy[dir];
832 x = creature_ptr->x + ddx[dir];
834 /* Get requested grid */
835 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
837 /* Feature code (applying "mimic" field) */
838 feat = get_feat_mimic(g_ptr);
840 /* Check for chest */
841 o_idx = chest_check(creature_ptr->current_floor_ptr, y, x, FALSE);
843 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
845 msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
847 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
849 take_turn(creature_ptr, 100);
850 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
851 py_attack(creature_ptr, y, x, 0);
855 more = exe_open_chest(creature_ptr, y, x, o_idx);
859 more = exe_open(creature_ptr, y, x);
863 /* Cancel repeat unless we may continue */
864 if (!more) disturb(creature_ptr, FALSE, FALSE);
871 * @brief 「閉じる」動作コマンドのサブルーチン /
872 * Perform the basic "close" command
873 * @param y 対象を行うマスのY座標
874 * @param x 対象を行うマスのX座標
875 * @return 実際に処理が行われた場合TRUEを返す。
877 * Assume destination is an open/broken door
878 * Assume there is no monster blocking the destination
879 * Returns TRUE if repeated commands may continue
881 static bool exe_close(player_type *creature_ptr, POSITION y, POSITION x)
883 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
884 FEAT_IDX old_feat = g_ptr->feat;
887 take_turn(creature_ptr, 100);
889 /* Seeing true feature code (ignore mimic) */
892 if (!have_flag(f_info[old_feat].flags, FF_CLOSE))
897 s16b closed_feat = feat_state(creature_ptr, old_feat, FF_CLOSE);
899 /* Hack -- object in the way */
900 if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) &&
901 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
903 msg_print(_("何かがつっかえて閉まらない。", "Something prevents it from closing."));
908 cave_alter_feat(creature_ptr, y, x, FF_CLOSE);
911 if (old_feat == g_ptr->feat)
913 msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
917 sound(SOUND_SHUTDOOR);
926 * @brief 「閉じる」コマンドのメインルーチン /
927 * Close an open door.
930 * Unlocking a locked door/chest is worth one experience point.
932 void do_cmd_close(player_type *creature_ptr)
939 if (creature_ptr->wild_mode) return;
941 if (creature_ptr->special_defense & KATA_MUSOU)
943 set_action(creature_ptr, ACTION_NONE);
946 /* Option: Pick a direction */
949 /* Count open doors */
950 if (count_dt(creature_ptr, &y, &x, is_open, FALSE) == 1)
952 command_dir = coords_to_dir(creature_ptr, y, x);
956 /* Allow repeated command */
959 /* Set repeat count */
960 command_rep = command_arg - 1;
961 creature_ptr->redraw |= (PR_STATE);
967 /* Get a "repeated" direction */
968 if (get_rep_dir(creature_ptr, &dir, FALSE))
973 y = creature_ptr->y + ddy[dir];
974 x = creature_ptr->x + ddx[dir];
975 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
977 /* Feature code (applying "mimic" field) */
978 feat = get_feat_mimic(g_ptr);
980 /* Require open/broken door */
981 if (!have_flag(f_info[feat].flags, FF_CLOSE))
983 msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
986 /* Monster in the way */
987 else if (g_ptr->m_idx)
989 take_turn(creature_ptr, 100);
991 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
994 py_attack(creature_ptr, y, x, 0);
1000 /* Close the door */
1001 more = exe_close(creature_ptr, y, x);
1005 /* Cancel repeat unless we may continue */
1006 if (!more) disturb(creature_ptr, FALSE, FALSE);
1011 * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
1012 * Determine if a given grid may be "tunneled"
1013 * @param y 対象を行うマスのY座標
1014 * @param x 対象を行うマスのX座標
1017 static bool do_cmd_tunnel_test(floor_type *floor_ptr, POSITION y, POSITION x)
1019 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
1021 /* Must have knowledge */
1022 if (!(g_ptr->info & CAVE_MARK))
1024 msg_print(_("そこには何も見当たらない。", "You see nothing there."));
1029 /* Must be a wall/door/etc */
1030 if (!cave_have_flag_grid(g_ptr, FF_TUNNEL))
1032 msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
1042 * @brief 「掘る」動作コマンドのサブルーチン /
1043 * Perform the basic "tunnel" command
1044 * @param y 対象を行うマスのY座標
1045 * @param x 対象を行うマスのX座標
1046 * @return 実際に処理が行われた場合TRUEを返す。
1048 * Assumes that no monster is blocking the destination
1049 * Do not use twall anymore
1050 * Returns TRUE if repeated commands may continue
1052 static bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x)
1055 feature_type *f_ptr, *mimic_f_ptr;
1060 /* Verify legality */
1061 if (!do_cmd_tunnel_test(creature_ptr->current_floor_ptr, y, x)) return FALSE;
1063 take_turn(creature_ptr, 100);
1065 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1066 f_ptr = &f_info[g_ptr->feat];
1067 power = f_ptr->power;
1069 /* Feature code (applying "mimic" field) */
1070 mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
1072 name = f_name + mimic_f_ptr->name;
1076 if (have_flag(f_ptr->flags, FF_PERMANENT))
1079 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1081 msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
1084 /* Map border (mimiccing Permanent wall) */
1087 msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
1092 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1095 if (creature_ptr->skill_dig > randint0(20 * power))
1097 msg_format(_("%sをくずした。", "You have removed the %s."), name);
1099 /* Remove the feature */
1100 cave_alter_feat(creature_ptr, y, x, FF_TUNNEL);
1101 creature_ptr->update |= (PU_FLOW);
1105 /* Message, keep digging */
1106 msg_format(_("%sをくずしている。", "You dig into the %s."), name);
1114 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1117 if (creature_ptr->skill_dig > power + randint0(40 * power))
1119 if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
1122 msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
1123 creature_ptr->update |= (PU_FLOW);
1126 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1128 /* Remove the feature */
1129 cave_alter_feat(creature_ptr, y, x, FF_TUNNEL);
1131 chg_virtue(creature_ptr, V_DILIGENCE, 1);
1132 chg_virtue(creature_ptr, V_NATURE, -1);
1140 /* We may continue chopping */
1141 msg_format(_("%sを切っている。", "You chop away at the %s."), name);
1142 /* Occasional Search XXX XXX */
1143 if (randint0(100) < 25) search(creature_ptr);
1147 /* We may continue tunelling */
1148 msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
1155 if (is_hidden_door(creature_ptr, g_ptr))
1157 /* Occasional Search XXX XXX */
1158 if (randint0(100) < 25) search(creature_ptr);
1166 * @brief 「掘る」動作コマンドのメインルーチン /
1167 * Tunnels through "walls" (including rubble and closed doors)
1171 * Note that you must tunnel in order to hit invisible monsters
1172 * in walls, though moving into walls still takes a turn anyway.
1174 * Digging is very difficult without a "digger" weapon, but can be
1175 * accomplished by strong players using heavy weapons.
1178 void do_cmd_tunnel(player_type *creature_ptr)
1187 if (creature_ptr->special_defense & KATA_MUSOU)
1189 set_action(creature_ptr, ACTION_NONE);
1192 /* Allow repeated command */
1195 /* Set repeat count */
1196 command_rep = command_arg - 1;
1197 creature_ptr->redraw |= (PR_STATE);
1199 /* Cancel the arg */
1203 /* Get a direction to tunnel, or Abort */
1204 if (get_rep_dir(creature_ptr, &dir,FALSE))
1207 y = creature_ptr->y + ddy[dir];
1208 x = creature_ptr->x + ddx[dir];
1210 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1212 /* Feature code (applying "mimic" field) */
1213 feat = get_feat_mimic(g_ptr);
1215 /* No tunnelling through doors */
1216 if (have_flag(f_info[feat].flags, FF_DOOR))
1218 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
1221 /* No tunnelling through most features */
1222 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1224 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
1227 /* A monster is in the way */
1228 else if (g_ptr->m_idx)
1230 take_turn(creature_ptr, 100);
1231 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1234 py_attack(creature_ptr, y, x, 0);
1240 /* Tunnel through walls */
1241 more = exe_tunnel(creature_ptr, y, x);
1245 /* Cancel repetition unless we can continue */
1246 if (!more) disturb(creature_ptr, FALSE, FALSE);
1250 * @brief 移動処理による簡易な「開く」処理 /
1252 * @return 開く処理が実際に試みられた場合TRUEを返す
1255 * If there is a jammed/closed/locked door at the given location,
1256 * then attempt to unlock/open it. Return TRUE if an attempt was
1257 * made (successful or not), otherwise return FALSE.
1259 * The code here should be nearly identical to that in
1260 * do_cmd_open_test() and exe_open().
1263 bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x)
1267 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1268 feature_type *f_ptr = &f_info[g_ptr->feat];
1270 /* Must be a closed door */
1271 if (!is_closed_door(creature_ptr, g_ptr->feat))
1277 if (!have_flag(f_ptr->flags, FF_OPEN))
1280 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
1285 else if (f_ptr->power)
1288 i = creature_ptr->skill_dis;
1290 /* Penalize some conditions */
1291 if (creature_ptr->blind || no_lite(creature_ptr)) i = i / 10;
1292 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1294 /* Extract the lock power */
1297 /* Extract the difficulty */
1300 /* Always have a small chance of success */
1304 if (randint0(100) < j)
1306 msg_print(_("鍵をはずした。", "You have picked the lock."));
1309 cave_alter_feat(creature_ptr, y, x, FF_OPEN);
1311 sound(SOUND_OPENDOOR);
1314 gain_exp(creature_ptr, 1);
1321 if (flush_failure) flush();
1323 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
1332 cave_alter_feat(creature_ptr, y, x, FF_OPEN);
1334 sound(SOUND_OPENDOOR);
1341 * @brief 箱のトラップを解除する実行処理 /
1342 * Perform the basic "disarm" command
1343 * @param y 解除を行うマスのY座標
1344 * @param x 解除を行うマスのX座標
1345 * @param o_idx 箱のオブジェクトID
1346 * @return ターンを消費する処理が行われた場合TRUEを返す
1349 * Assume destination is a visible trap
1350 * Assume there is no monster blocking the destination
1351 * Returns TRUE if repeated commands may continue
1354 static bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
1358 object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
1360 take_turn(creature_ptr, 100);
1362 /* Get the "disarm" factor */
1363 i = creature_ptr->skill_dis;
1365 /* Penalize some conditions */
1366 if (creature_ptr->blind || no_lite(creature_ptr)) i = i / 10;
1367 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1369 /* Extract the difficulty */
1370 j = i - o_ptr->pval;
1372 /* Always have a small chance of success */
1375 /* Must find the trap first. */
1376 if (!object_is_known(o_ptr))
1378 msg_print(_("トラップが見あたらない。", "I don't see any traps."));
1382 /* Already disarmed/unlocked */
1383 else if (o_ptr->pval <= 0)
1385 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1388 /* No traps to find. */
1389 else if (!chest_traps[o_ptr->pval])
1391 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1394 /* Success (get a lot of experience) */
1395 else if (randint0(100) < j)
1397 msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
1398 gain_exp(creature_ptr, o_ptr->pval);
1399 o_ptr->pval = (0 - o_ptr->pval);
1402 /* Failure -- Keep trying */
1403 else if ((i > 5) && (randint1(i) > 5))
1405 /* We may keep trying */
1407 if (flush_failure) flush();
1408 msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
1411 /* Failure -- Set off the trap */
1414 msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
1416 chest_trap(creature_ptr, y, x, o_idx);
1424 * @brief 箱のトラップを解除するコマンドのサブルーチン /
1425 * Perform the basic "disarm" command
1426 * @param y 解除を行うマスのY座標
1427 * @param x 解除を行うマスのX座標
1428 * @param dir プレイヤーからみた方向ID
1429 * @return ターンを消費する処理が行われた場合TRUEを返す
1432 * Assume destination is a visible trap
1433 * Assume there is no monster blocking the destination
1434 * Returns TRUE if repeated commands may continue
1438 bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1440 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1443 feature_type *f_ptr = &f_info[g_ptr->feat];
1445 /* Access trap name */
1446 concptr name = (f_name + f_ptr->name);
1448 /* Extract trap "power" */
1449 int power = f_ptr->power;
1452 /* Get the "disarm" factor */
1453 int i = creature_ptr->skill_dis;
1456 take_turn(creature_ptr, 100);
1458 /* Penalize some conditions */
1459 if (creature_ptr->blind || no_lite(creature_ptr)) i = i / 10;
1460 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1462 /* Extract the difficulty */
1465 /* Always have a small chance of success */
1469 if (randint0(100) < j)
1471 msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
1474 gain_exp(creature_ptr, power);
1476 /* Remove the trap */
1477 cave_alter_feat(creature_ptr, y, x, FF_DISARM);
1479 /* Move the player onto the trap */
1480 move_player(creature_ptr, dir, easy_disarm, FALSE);
1483 /* Failure -- Keep trying */
1484 else if ((i > 5) && (randint1(i) > 5))
1487 if (flush_failure) flush();
1489 msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
1491 /* We may keep trying */
1495 /* Failure -- Set off the trap */
1498 msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
1499 /* Move the player onto the trap */
1500 move_player(creature_ptr, dir, easy_disarm, FALSE);
1508 * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
1509 * Disarms a trap, or chest
1512 void do_cmd_disarm(player_type *creature_ptr)
1520 if (creature_ptr->wild_mode) return;
1522 if (creature_ptr->special_defense & KATA_MUSOU)
1524 set_action(creature_ptr, ACTION_NONE);
1527 /* Option: Pick a direction */
1530 int num_traps, num_chests;
1532 /* Count visible traps */
1533 num_traps = count_dt(creature_ptr, &y, &x, is_trap, TRUE);
1535 /* Count chests (trapped) */
1536 num_chests = count_chests(creature_ptr, &y, &x, TRUE);
1538 /* See if only one target */
1539 if (num_traps || num_chests)
1541 bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
1542 if (!too_many) command_dir = coords_to_dir(creature_ptr, y, x);
1546 /* Allow repeated command */
1549 /* Set repeat count */
1550 command_rep = command_arg - 1;
1551 creature_ptr->redraw |= (PR_STATE);
1553 /* Cancel the arg */
1557 /* Get a direction (or abort) */
1558 if (get_rep_dir(creature_ptr, &dir,TRUE))
1563 y = creature_ptr->y + ddy[dir];
1564 x = creature_ptr->x + ddx[dir];
1565 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1567 /* Feature code (applying "mimic" field) */
1568 feat = get_feat_mimic(g_ptr);
1570 /* Check for chests */
1571 o_idx = chest_check(creature_ptr->current_floor_ptr, y, x, TRUE);
1574 if (!is_trap(creature_ptr, feat) && !o_idx)
1576 msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
1579 /* Monster in the way */
1580 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
1582 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1585 py_attack(creature_ptr, y, x, 0);
1591 more = exe_disarm_chest(creature_ptr, y, x, o_idx);
1597 more = exe_disarm(creature_ptr, y, x, dir);
1601 /* Cancel repeat unless told not to */
1602 if (!more) disturb(creature_ptr, FALSE, FALSE);
1607 * @brief 「打ち破る」動作コマンドのサブルーチン /
1608 * Perform the basic "bash" command
1609 * @param y 対象を行うマスのY座標
1610 * @param x 対象を行うマスのX座標
1611 * @param dir プレイヤーから見たターゲットの方角ID
1612 * @return 実際に処理が行われた場合TRUEを返す。
1615 * Assume destination is a closed/locked/jammed door
1616 * Assume there is no monster blocking the destination
1617 * Returns TRUE if repeated commands may continue
1620 static bool do_cmd_bash_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1622 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1625 feature_type *f_ptr = &f_info[g_ptr->feat];
1627 /* Hack -- Bash power based on strength */
1628 /* (Ranges from 3 to 20 to 100 to 200) */
1629 int bash = adj_str_blow[creature_ptr->stat_ind[A_STR]];
1631 /* Extract door power */
1632 int temp = f_ptr->power;
1636 concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
1638 take_turn(creature_ptr, 100);
1640 msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
1642 /* Compare bash power to door power */
1643 temp = (bash - (temp * 10));
1645 if (creature_ptr->pclass == CLASS_BERSERKER) temp *= 2;
1647 /* Hack -- always have a chance */
1648 if (temp < 1) temp = 1;
1650 /* Hack -- attempt to bash down the door */
1651 if (randint0(100) < temp)
1653 msg_format(_("%sを壊した!", "The %s crashes open!"), name);
1655 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
1657 /* Break down the door */
1658 if ((randint0(100) < 50) || (feat_state(creature_ptr, g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
1660 cave_alter_feat(creature_ptr, y, x, FF_BASH);
1666 cave_alter_feat(creature_ptr, y, x, FF_OPEN);
1669 /* Hack -- Fall through the door */
1670 move_player(creature_ptr, dir, FALSE, FALSE);
1673 /* Saving throw against stun */
1674 else if (randint0(100) < adj_dex_safe[creature_ptr->stat_ind[A_DEX]] +
1677 msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
1679 /* Allow repeated bashing */
1683 /* High dexterity yields coolness */
1686 msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
1688 /* Hack -- Lose balance ala paralysis */
1689 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 2 + randint0(2));
1697 * @brief 「打ち破る」動作コマンドのメインルーチン /
1698 * Bash open a door, success based on character strength
1702 * For a closed door, pval is positive if locked; negative if stuck.
1704 * For an open door, pval is positive for a broken door.
1706 * A closed door can be opened - harder if locked. Any door might be
1707 * bashed open (and thereby broken). Bashing a door is (potentially)
1708 * faster! You move into the door way. To open a stuck door, it must
1709 * be bashed. A closed door can be jammed (see do_cmd_spike()).
1711 * Creatures can also open or bash doors, see elsewhere.
1714 void do_cmd_bash(player_type *creature_ptr)
1721 if (creature_ptr->wild_mode) return;
1723 if (creature_ptr->special_defense & KATA_MUSOU)
1725 set_action(creature_ptr, ACTION_NONE);
1728 /* Allow repeated command */
1731 /* Set repeat count */
1732 command_rep = command_arg - 1;
1733 creature_ptr->redraw |= (PR_STATE);
1735 /* Cancel the arg */
1739 /* Get a "repeated" direction */
1740 if (get_rep_dir(creature_ptr, &dir,FALSE))
1745 y = creature_ptr->y + ddy[dir];
1746 x = creature_ptr->x + ddx[dir];
1748 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1750 /* Feature code (applying "mimic" field) */
1751 feat = get_feat_mimic(g_ptr);
1753 /* Nothing useful */
1754 if (!have_flag(f_info[feat].flags, FF_BASH))
1756 msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
1759 /* Monster in the way */
1760 else if (g_ptr->m_idx)
1762 take_turn(creature_ptr, 100);
1764 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1767 py_attack(creature_ptr, y, x, 0);
1770 /* Bash a closed door */
1774 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1778 /* Unless valid action taken, cancel bash */
1779 if (!more) disturb(creature_ptr, FALSE, FALSE);
1784 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
1788 * Manipulate an adjacent grid in some way
1790 * Attack monsters, tunnel through walls, disarm traps, open doors.
1792 * Consider confusion
1794 * This command must always take a turn, to prevent free detection
1795 * of invisible monsters.
1798 void do_cmd_alter(player_type *creature_ptr)
1805 if (creature_ptr->special_defense & KATA_MUSOU)
1807 set_action(creature_ptr, ACTION_NONE);
1810 /* Allow repeated command */
1813 /* Set repeat count */
1814 command_rep = command_arg - 1;
1815 creature_ptr->redraw |= (PR_STATE);
1817 /* Cancel the arg */
1821 /* Get a direction */
1822 if (get_rep_dir(creature_ptr, &dir,TRUE))
1825 feature_type *f_ptr;
1827 y = creature_ptr->y + ddy[dir];
1828 x = creature_ptr->x + ddx[dir];
1830 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1832 /* Feature code (applying "mimic" field) */
1833 feat = get_feat_mimic(g_ptr);
1834 f_ptr = &f_info[feat];
1836 take_turn(creature_ptr, 100);
1840 py_attack(creature_ptr, y, x, 0);
1844 else if (have_flag(f_ptr->flags, FF_OPEN))
1846 more = exe_open(creature_ptr, y, x);
1849 /* Bash jammed doors */
1850 else if (have_flag(f_ptr->flags, FF_BASH))
1852 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1855 /* Tunnel through walls */
1856 else if (have_flag(f_ptr->flags, FF_TUNNEL))
1858 more = exe_tunnel(creature_ptr, y, x);
1861 /* Close open doors */
1862 else if (have_flag(f_ptr->flags, FF_CLOSE))
1864 more = exe_close(creature_ptr, y, x);
1868 else if (have_flag(f_ptr->flags, FF_DISARM))
1870 more = exe_disarm(creature_ptr, y, x, dir);
1875 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
1879 /* Cancel repetition unless we can continue */
1880 if (!more) disturb(creature_ptr, FALSE, FALSE);
1886 * @brief 「くさびを打つ」ために必要なオブジェクトを所持しているかどうかの判定を返す /
1887 * Find the index of some "spikes", if possible.
1888 * @param ip くさびとして打てるオブジェクトのID
1889 * @return オブジェクトがある場合TRUEを返す
1892 * Let user choose a pile of spikes, perhaps?
1895 static bool get_spike(player_type *creature_ptr, INVENTORY_IDX *ip)
1899 /* Check every item in the pack */
1900 for (i = 0; i < INVEN_PACK; i++)
1902 object_type *o_ptr = &creature_ptr->inventory_list[i];
1903 if (!o_ptr->k_idx) continue;
1905 /* Check the "tval" code */
1906 if (o_ptr->tval == TV_SPIKE)
1908 /* Save the spike index */
1921 * @brief 「くさびを打つ」動作コマンドのメインルーチン /
1922 * Jam a closed door with a spike
1923 * @param creature_ptr プレーヤーへの参照ポインタ
1927 * This command may NOT be repeated
1930 void do_cmd_spike(player_type *creature_ptr)
1934 if (creature_ptr->wild_mode) return;
1935 if (creature_ptr->special_defense & KATA_MUSOU)
1937 set_action(creature_ptr, ACTION_NONE);
1940 /* Get a "repeated" direction */
1941 if (!get_rep_dir(creature_ptr, &dir, FALSE)) return;
1943 POSITION y = creature_ptr->y + ddy[dir];
1944 POSITION x = creature_ptr->x + ddx[dir];
1946 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
1948 /* Feature code (applying "mimic" field) */
1949 FEAT_IDX feat = get_feat_mimic(g_ptr);
1951 /* Require closed door */
1953 if (!have_flag(f_info[feat].flags, FF_SPIKE))
1955 msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
1959 else if (!get_spike(creature_ptr, &item))
1961 msg_print(_("くさびを持っていない!", "You have no spikes!"));
1964 /* Is a monster in the way? */
1965 else if (g_ptr->m_idx)
1967 take_turn(creature_ptr, 100);
1969 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1972 py_attack(creature_ptr, y, x, 0);
1978 take_turn(creature_ptr, 100);
1980 /* Successful jamming */
1981 msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
1982 cave_alter_feat(creature_ptr, y, x, FF_SPIKE);
1984 vary_item(creature_ptr, item, -1);
1990 * @brief 「歩く」動作コマンドのメインルーチン /
1991 * Support code for the "Walk" and "Jump" commands
1992 * @param creature_ptr プレーヤーへの参照ポインタ
1993 * @param pickup アイテムの自動拾いを行うならTRUE
1996 void do_cmd_walk(player_type *creature_ptr, bool pickup)
1998 /* Allow repeated command */
2001 /* Set repeat count */
2002 command_rep = command_arg - 1;
2003 creature_ptr->redraw |= (PR_STATE);
2005 /* Cancel the arg */
2009 /* Get a "repeated" direction */
2012 if (get_rep_dir(creature_ptr, &dir, FALSE))
2014 take_turn(creature_ptr, 100);
2016 if ((dir != 5) && (creature_ptr->special_defense & KATA_MUSOU))
2018 set_action(creature_ptr, ACTION_NONE);
2021 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2022 if (creature_ptr->wild_mode) creature_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
2023 if (creature_ptr->action == ACTION_HAYAGAKE) creature_ptr->energy_use = creature_ptr->energy_use * (45-(creature_ptr->lev/2)) / 100;
2025 /* Actually move the character */
2026 move_player(creature_ptr, dir, pickup, FALSE);
2028 /* Allow more walking */
2032 /* Hack again -- Is there a special encounter ??? */
2033 if (creature_ptr->wild_mode && !cave_have_flag_bold(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, FF_TOWN))
2035 int tmp = 120 + creature_ptr->lev*10 - wilderness[creature_ptr->y][creature_ptr->x].level + 5;
2038 if (((wilderness[creature_ptr->y][creature_ptr->x].level + 5) > (creature_ptr->lev / 2)) && randint0(tmp) < (21-creature_ptr->skill_stl))
2040 /* Inform the player of his horrible fate :=) */
2041 msg_print(_("襲撃だ!", "You are ambushed !"));
2043 /* Go into large wilderness view */
2044 creature_ptr->oldpy = randint1(MAX_HGT-2);
2045 creature_ptr->oldpx = randint1(MAX_WID-2);
2046 change_wild_mode(creature_ptr, TRUE);
2048 /* Give first move to monsters */
2049 take_turn(creature_ptr, 100);
2054 /* Cancel repeat unless we may continue */
2055 if (!more) disturb(creature_ptr, FALSE, FALSE);
2060 * @brief 「走る」動作コマンドのメインルーチン /
2062 * @param creature_ptr プレーヤーへの参照ポインタ
2065 void do_cmd_run(player_type *creature_ptr)
2068 if (cmd_limit_confused(creature_ptr)) return;
2070 if (creature_ptr->special_defense & KATA_MUSOU)
2072 set_action(creature_ptr, ACTION_NONE);
2075 /* Get a "repeated" direction */
2076 if (get_rep_dir(creature_ptr, &dir,FALSE))
2078 /* Hack -- Set the run counter */
2079 creature_ptr->running = (command_arg ? command_arg : 1000);
2082 run_step(creature_ptr, dir);
2088 * @brief 「留まる」動作コマンドのメインルーチン /
2089 * Stay still. Search. Enter stores.
2090 * Pick up treasure if "pickup" is true.
2091 * @param creature_ptr プレーヤーへの参照ポインタ
2092 * @param pickup アイテムの自動拾いを行うならTRUE
2095 void do_cmd_stay(player_type *creature_ptr, bool pickup)
2097 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2099 /* Allow repeated command */
2102 /* Set repeat count */
2103 command_rep = command_arg - 1;
2104 creature_ptr->redraw |= (PR_STATE);
2106 /* Cancel the arg */
2110 take_turn(creature_ptr, 100);
2112 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2113 (void)move_player_effect(creature_ptr, creature_ptr->y, creature_ptr->x, mpe_mode);
2118 * @brief 「休む」動作コマンドのメインルーチン /
2119 * Resting allows a player to safely restore his hp -RAK-
2120 * @param creature_ptr プレーヤーへの参照ポインタ
2123 void do_cmd_rest(player_type *creature_ptr)
2125 set_action(creature_ptr, ACTION_NONE);
2127 if ((creature_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(creature_ptr) || INTERUPTING_SONG_EFFECT(creature_ptr)))
2129 stop_singing(creature_ptr);
2132 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
2134 /* Prompt for time if needed */
2135 if (command_arg <= 0)
2137 concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ",
2138 "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
2143 strcpy(out_val, "&");
2145 /* Ask for duration */
2146 if (!get_string(p, out_val, 4)) return;
2148 /* Rest until done */
2149 if (out_val[0] == '&')
2151 command_arg = COMMAND_ARG_REST_UNTIL_DONE;
2155 else if (out_val[0] == '*')
2157 command_arg = COMMAND_ARG_REST_FULL_HEALING;
2163 command_arg = (COMMAND_ARG)atoi(out_val);
2164 if (command_arg <= 0) return;
2168 if (command_arg > 9999) command_arg = 9999;
2170 if (creature_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(creature_ptr, FALSE);
2172 /* Take a turn (?) */
2173 take_turn(creature_ptr, 100);
2175 /* The sin of sloth */
2176 if (command_arg > 100) chg_virtue(creature_ptr, V_DILIGENCE, -1);
2178 /* Why are you sleeping when there's no need? WAKE UP!*/
2179 if ((creature_ptr->chp == creature_ptr->mhp) &&
2180 (creature_ptr->csp == creature_ptr->msp) &&
2181 !creature_ptr->blind && !creature_ptr->confused &&
2182 !creature_ptr->poisoned && !creature_ptr->afraid &&
2183 !creature_ptr->stun && !creature_ptr->cut &&
2184 !creature_ptr->slow && !creature_ptr->paralyzed &&
2185 !creature_ptr->image && !creature_ptr->word_recall &&
2186 !creature_ptr->alter_reality)
2187 chg_virtue(creature_ptr, V_DILIGENCE, -1);
2189 /* Save the rest code */
2190 creature_ptr->resting = command_arg;
2191 creature_ptr->action = ACTION_REST;
2192 creature_ptr->update |= (PU_BONUS);
2193 update_creature(creature_ptr);
2195 creature_ptr->redraw |= (PR_STATE);
2196 update_output(creature_ptr);
2205 * @brief 射撃処理のメインルーチン
2206 * @param creature_ptr プレーヤーへの参照ポインタ
2207 * @param snipe_type ???
2210 void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type)
2213 object_type *j_ptr, *ammo_ptr;
2216 if(creature_ptr->wild_mode) return;
2218 creature_ptr->is_fired = FALSE; /* not fired yet */
2220 /* Get the "bow" (if any) */
2221 j_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2223 /* Require a launcher */
2226 msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
2231 if (j_ptr->sval == SV_CRIMSON)
2233 msg_print(_("この武器は発動して使うもののようだ。", "It's already activated."));
2238 if (j_ptr->sval == SV_HARP)
2240 msg_print(_("この武器で射撃はできない。", "It's not for firing."));
2246 if (creature_ptr->special_defense & KATA_MUSOU)
2248 set_action(creature_ptr, ACTION_NONE);
2251 q = _("どれを撃ちますか? ", "Fire which item? ");
2252 s = _("発射されるアイテムがありません。", "You have nothing to fire.");
2254 ammo_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), creature_ptr->tval_ammo);
2262 exe_fire(creature_ptr, item, j_ptr, snipe_type);
2264 if (!creature_ptr->is_fired || creature_ptr->pclass != CLASS_SNIPER) return;
2266 /* Sniper actions after some shootings */
2267 if (snipe_type == SP_AWAY)
2269 teleport_player(creature_ptr, 10 + (creature_ptr->concent * 2), 0L);
2272 if (snipe_type == SP_FINAL)
2274 msg_print(_("射撃の反動が体を襲った。", "The weapon's recoil stuns you. "));
2275 (void)set_slow(creature_ptr, creature_ptr->slow + randint0(7) + 7, FALSE);
2276 (void)set_stun(creature_ptr, creature_ptr->stun + randint1(25));
2282 * @brief 投射処理メインルーチン /
2283 * Throw an object from the pack or floor.
2285 * @param creature_ptr プレーヤーへの参照ポインタ
2286 * @param boomerang ブーメラン処理ならばTRUE
2287 * @param shuriken 忍者の手裏剣処理ならばTRUE
2288 * @return ターンを消費した場合TRUEを返す
2291 * Note: "unseen" monsters are very hard to hit.
2293 * Should throwing a weapon do full damage? Should it allow the magic
2294 * to hit bonus of the weapon to have an effect? Should it ever cause
2295 * the item to be destroyed? Should it do any damage at all?
2298 bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_IDX shuriken)
2303 POSITION y, x, ty, tx, prev_y, prev_x;
2304 POSITION ny[19], nx[19];
2305 int chance, tdam, tdis;
2306 int mul, div, dd, ds;
2307 int cur_dis, visible;
2314 bool hit_body = FALSE;
2315 bool hit_wall = FALSE;
2316 bool equiped_item = FALSE;
2317 bool return_when_thrown = FALSE;
2319 GAME_TEXT o_name[MAX_NLEN];
2321 int msec = delay_factor * delay_factor * delay_factor;
2323 BIT_FLAGS flgs[TR_FLAG_SIZE];
2325 bool come_back = FALSE;
2326 bool do_drop = TRUE;
2328 if (creature_ptr->wild_mode) return FALSE;
2330 if (creature_ptr->special_defense & KATA_MUSOU)
2332 set_action(creature_ptr, ACTION_NONE);
2338 o_ptr = &creature_ptr->inventory_list[item];
2342 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2344 item_tester_hook = item_tester_hook_boomerang;
2345 q = _("どの武器を投げますか? ", "Throw which item? ");
2346 s = _("投げる武器がない。", "You have nothing to throw.");
2347 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP), 0);
2354 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2357 o_ptr = &creature_ptr->inventory_list[item];
2362 o_ptr = &creature_ptr->inventory_list[item];
2367 q = _("どのアイテムを投げますか? ", "Throw which item? ");
2368 s = _("投げるアイテムがない。", "You have nothing to throw.");
2369 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP), 0);
2377 /* Item is cursed */
2378 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
2380 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
2384 if (creature_ptr->current_floor_ptr->inside_arena && !boomerang)
2386 if (o_ptr->tval != TV_SPIKE)
2388 msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
2396 object_copy(q_ptr, o_ptr);
2398 /* Extract the thrown object's flags. */
2399 object_flags(q_ptr, flgs);
2400 torch_flags(q_ptr, flgs);
2402 /* Distribute the charges of rods/wands between the stacks */
2403 distribute_charges(o_ptr, q_ptr, 1);
2408 object_desc(creature_ptr, o_name, q_ptr, OD_OMIT_PREFIX);
2410 if (creature_ptr->mighty_throw) mult += 3;
2412 /* Extract a "distance multiplier" */
2413 /* Changed for 'launcher' mutation */
2414 mul = 10 + 2 * (mult - 1);
2416 /* Enforce a minimum "weight" of one pound */
2417 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
2418 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
2420 /* Hack -- Distance -- Reward strength, penalize weight */
2421 tdis = (adj_str_blow[creature_ptr->stat_ind[A_STR]] + 20) * mul / div;
2423 /* Max distance of 10-18 */
2424 if (tdis > mul) tdis = mul;
2428 ty = randint0(101) - 50 + creature_ptr->y;
2429 tx = randint0(101) - 50 + creature_ptr->x;
2433 project_length = tdis + 1;
2435 /* Get a direction (or cancel) */
2436 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
2438 /* Predict the "target" location */
2439 tx = creature_ptr->x + 99 * ddx[dir];
2440 ty = creature_ptr->y + 99 * ddy[dir];
2442 /* Check for "target request" */
2443 if ((dir == 5) && target_okay(creature_ptr))
2449 project_length = 0; /* reset to default */
2452 if ((q_ptr->name1 == ART_MJOLLNIR) ||
2453 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
2454 return_when_thrown = TRUE;
2458 inven_item_increase(creature_ptr, item, -1);
2459 if (!return_when_thrown)
2460 inven_item_describe(creature_ptr, item);
2461 inven_item_optimize(creature_ptr, item);
2465 floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
2466 floor_item_optimize(creature_ptr, 0 - item);
2469 if (item >= INVEN_RARM)
2471 equiped_item = TRUE;
2472 creature_ptr->redraw |= (PR_EQUIPPY);
2475 take_turn(creature_ptr, 100);
2477 /* Rogue and Ninja gets bonus */
2478 if ((creature_ptr->pclass == CLASS_ROGUE) || (creature_ptr->pclass == CLASS_NINJA))
2479 creature_ptr->energy_use -= creature_ptr->lev;
2481 /* Start at the player */
2482 y = creature_ptr->y;
2483 x = creature_ptr->x;
2485 handle_stuff(creature_ptr);
2487 if ((creature_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
2488 else shuriken = FALSE;
2490 /* Chance of hitting */
2491 if (have_flag(flgs, TR_THROW)) chance = ((creature_ptr->skill_tht) +
2492 ((creature_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
2493 else chance = (creature_ptr->skill_tht + (creature_ptr->to_h_b * BTH_PLUS_ADJ));
2495 if (shuriken) chance *= 2;
2500 /* Travel until stopped */
2501 for (cur_dis = 0; cur_dis <= tdis; )
2503 /* Hack -- Stop at the target */
2504 if ((y == ty) && (x == tx)) break;
2506 /* Calculate the new location (see "project()") */
2509 mmove2(&ny[cur_dis], &nx[cur_dis], creature_ptr->y, creature_ptr->x, ty, tx);
2511 /* Stopped by walls/doors */
2512 if (!cave_have_flag_bold(creature_ptr->current_floor_ptr, ny[cur_dis], nx[cur_dis], FF_PROJECT))
2515 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !creature_ptr->current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
2518 /* The player can see the (on screen) missile */
2519 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(creature_ptr, ny[cur_dis], nx[cur_dis]))
2521 SYMBOL_CODE c = object_char(q_ptr);
2522 TERM_COLOR a = object_attr(q_ptr);
2524 /* Draw, Hilite, Fresh, Pause, Erase */
2525 print_rel(creature_ptr, c, a, ny[cur_dis], nx[cur_dis]);
2526 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
2528 Term_xtra(TERM_XTRA_DELAY, msec);
2529 lite_spot(creature_ptr, ny[cur_dis], nx[cur_dis]);
2533 /* The player cannot see the missile */
2536 /* Pause anyway, for consistancy */
2537 Term_xtra(TERM_XTRA_DELAY, msec);
2543 /* Save the new location */
2547 /* Advance the distance */
2550 /* Monster here, Try to hit it */
2551 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
2553 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
2554 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2555 GAME_TEXT m_name[MAX_NLEN];
2556 monster_name(creature_ptr, g_ptr->m_idx, m_name);
2558 /* Check the visibility */
2559 visible = m_ptr->ml;
2561 /* Note the collision */
2564 /* Did we hit it (penalize range) */
2565 if (test_hit_fire(creature_ptr, chance - cur_dis, m_ptr, m_ptr->ml, o_name))
2569 /* Handle unseen monster */
2572 /* Invisible monster */
2573 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
2576 /* Handle visible monster */
2579 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
2583 if (!creature_ptr->image) monster_race_track(creature_ptr, m_ptr->ap_r_idx);
2584 health_track(creature_ptr, g_ptr->m_idx);
2588 /* Hack -- Base damage from thrown object */
2591 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
2592 tdam = damroll(dd, ds);
2593 /* Apply special damage */
2594 tdam = tot_dam_aux(creature_ptr, q_ptr, tdam, m_ptr, 0, TRUE);
2595 tdam = critical_shot(creature_ptr, q_ptr->weight, q_ptr->to_h, 0, tdam);
2596 if (q_ptr->to_d > 0)
2597 tdam += q_ptr->to_d;
2599 tdam += -q_ptr->to_d;
2603 tdam *= (mult+creature_ptr->num_blow[item - INVEN_RARM]);
2604 tdam += creature_ptr->to_d_m;
2606 else if (have_flag(flgs, TR_THROW))
2609 tdam += creature_ptr->to_d_m;
2617 tdam += ((creature_ptr->lev+30)*(creature_ptr->lev+30)-900)/55;
2620 /* No negative damage */
2621 if (tdam < 0) tdam = 0;
2623 /* Modify the damage */
2624 tdam = mon_damage_mod(creature_ptr, m_ptr, tdam, FALSE);
2626 msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
2627 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
2629 /* Hit the monster, check for death */
2630 if (mon_take_hit(creature_ptr, g_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
2638 message_pain(creature_ptr, g_ptr->m_idx, tdam);
2640 /* Anger the monster */
2641 if ((tdam > 0) && !object_is_potion(q_ptr))
2642 anger_monster(creature_ptr, m_ptr);
2644 if (fear && m_ptr->ml)
2647 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2657 /* decrease toach's fuel */
2658 if (hit_body) torch_lost_fuel(q_ptr);
2660 /* Chance of breakage (during attacks) */
2661 j = (hit_body ? breakage_chance(creature_ptr, q_ptr, creature_ptr->pclass == CLASS_ARCHER, 0) : 0);
2663 /* Figurines transform */
2664 if ((q_ptr->tval == TV_FIGURINE) && !(creature_ptr->current_floor_ptr->inside_arena))
2668 if (!(summon_named_creature(creature_ptr, 0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
2669 msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
2670 else if (object_is_cursed(q_ptr))
2671 msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
2675 /* Potions smash open */
2676 if (object_is_potion(q_ptr))
2678 if (hit_body || hit_wall || (randint1(100) < j))
2680 msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
2682 if (potion_smash_effect(creature_ptr, 0, y, x, q_ptr->k_idx))
2684 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx];
2685 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !MON_INVULNER(m_ptr))
2687 GAME_TEXT m_name[MAX_NLEN];
2688 monster_desc(creature_ptr, m_name, m_ptr, 0);
2689 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
2690 set_hostile(creature_ptr, &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx]);
2701 if (return_when_thrown)
2703 int back_chance = randint1(30)+20+((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2704 char o2_name[MAX_NLEN];
2705 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
2708 if (boomerang) back_chance += 4+randint1(5);
2709 if (super_boomerang) back_chance += 100;
2710 object_desc(creature_ptr, o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2712 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
2714 for (i = cur_dis - 1; i > 0; i--)
2716 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(creature_ptr, ny[i], nx[i]))
2718 char c = object_char(q_ptr);
2719 byte a = object_attr(q_ptr);
2721 /* Draw, Hilite, Fresh, Pause, Erase */
2722 print_rel(creature_ptr, c, a, ny[i], nx[i]);
2723 move_cursor_relative(ny[i], nx[i]);
2725 Term_xtra(TERM_XTRA_DELAY, msec);
2726 lite_spot(creature_ptr, ny[i], nx[i]);
2731 /* Pause anyway, for consistancy */
2732 Term_xtra(TERM_XTRA_DELAY, msec);
2735 if((back_chance > 37) && !creature_ptr->blind && (item >= 0))
2737 msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
2744 msg_format(_("%sを受け損ねた!", "%s comes back, but you can't catch!"), o2_name);
2748 msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
2750 y = creature_ptr->y;
2751 x = creature_ptr->x;
2756 msg_format(_("%sが返ってこなかった!", "%s doesn't come back!"), o2_name);
2762 if (item == INVEN_RARM || item == INVEN_LARM)
2764 /* Access the wield slot */
2765 o_ptr = &creature_ptr->inventory_list[item];
2767 /* Wear the new stuff */
2768 object_copy(o_ptr, q_ptr);
2770 creature_ptr->total_weight += q_ptr->weight;
2772 /* Increment the equip counter by hand */
2773 creature_ptr->equip_cnt++;
2775 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
2776 creature_ptr->window |= (PW_EQUIP);
2780 inven_carry(creature_ptr, q_ptr);
2784 else if (equiped_item)
2786 verify_equip_slot(creature_ptr, item);
2787 calc_android_exp(creature_ptr);
2792 if (cave_have_flag_bold(creature_ptr->current_floor_ptr, y, x, FF_PROJECT))
2794 (void)drop_near(creature_ptr, q_ptr, j, y, x);
2798 (void)drop_near(creature_ptr, q_ptr, j, prev_y, prev_x);
2806 * @brief 自殺するコマンドのメインルーチン
2807 * Hack -- commit suicide
2811 void do_cmd_suicide(player_type *creature_ptr)
2818 /* Verify Retirement */
2819 if (current_world_ptr->total_winner)
2822 if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
2825 /* Verify Suicide */
2829 if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
2832 if (!current_world_ptr->noscore)
2834 /* Special Verification for suicide */
2835 prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
2840 if (i != '@') return;
2842 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
2845 /* Initialize "last message" buffer */
2846 if (creature_ptr->last_message) string_free(creature_ptr->last_message);
2847 creature_ptr->last_message = NULL;
2849 /* Hack -- Note *winning* message */
2850 if (current_world_ptr->total_winner && last_words)
2852 char buf[1024] = "";
2853 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
2856 while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
2857 } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
2861 creature_ptr->last_message = string_make(buf);
2862 msg_print(creature_ptr->last_message);
2867 creature_ptr->playing = FALSE;
2869 /* Kill the player */
2870 creature_ptr->is_dead = TRUE;
2871 creature_ptr->leaving = TRUE;
2873 if (!current_world_ptr->total_winner)
2875 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("ダンジョンの探索に絶望して自殺した。", "gave up all hope to commit suicide."));
2876 exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
2877 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
2880 /* Cause of death */
2881 (void)strcpy(creature_ptr->died_from, _("途中終了", "Quitting"));