3 * @brief プレイヤーのコマンド処理2 / Movement commands (part 2)
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
25 #include "object-hook.h"
27 #include "spells-summon.h"
28 #include "spells-status.h"
30 #include "monster-status.h"
34 #include "player-status.h"
35 #include "realm-hex.h"
36 #include "realm-song.h"
41 #include "player-move.h"
42 #include "player-effects.h"
43 #include "player-class.h"
44 #include "player-personality.h"
45 #include "player-inventory.h"
46 #include "objectkind.h"
47 #include "object-broken.h"
48 #include "object-flavor.h"
52 #include "cmd-basic.h"
54 #include "floor-save.h"
55 #include "dungeon-file.h"
58 #include "view-mainwindow.h"
59 #include "targeting.h"
62 * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
63 * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
64 * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
66 static bool confirm_leave_level(player_type *creature_ptr, bool down_stair)
68 quest_type *q_ptr = &quest[creature_ptr->inside_quest];
70 /* Confirm leaving from once only quest */
71 if (confirm_quest && creature_ptr->inside_quest &&
72 (q_ptr->type == QUEST_TYPE_RANDOM ||
73 (q_ptr->flags & QUEST_FLAG_ONCE &&
74 q_ptr->status != QUEST_STATUS_COMPLETED) ||
75 (q_ptr->flags & QUEST_FLAG_TOWER &&
76 ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
77 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
79 msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
80 if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
90 * @brief 魔法系コマンドが制限されているかを返す。
91 * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
93 bool cmd_limit_cast(player_type *creature_ptr)
95 if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
97 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
101 else if (creature_ptr->anti_magic)
103 msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
106 else if (creature_ptr->shero)
108 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
115 bool cmd_limit_confused(player_type *creature_ptr)
117 if (creature_ptr->confused)
119 msg_print(_("混乱していてできない!", "You are too confused!"));
125 bool cmd_limit_image(player_type *creature_ptr)
127 if (creature_ptr->image)
129 msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
135 bool cmd_limit_stun(player_type *creature_ptr)
137 if (creature_ptr->stun)
139 msg_print(_("頭が朦朧としていて集中できない!", "You are too stuned!"));
145 bool cmd_limit_arena(player_type *creature_ptr)
147 if (creature_ptr->inside_arena)
149 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
156 bool cmd_limit_blind(player_type *creature_ptr)
158 if (creature_ptr->blind)
160 msg_print(_("目が見えない。", "You can't see anything."));
165 msg_print(_("明かりがないので見えない。", "You have no light."));
171 bool cmd_limit_time_walk(player_type *creature_ptr)
173 if (creature_ptr->timewalk)
175 if (flush_failure) flush();
176 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
184 * @brief 階段を使って階層を昇る処理 / Go up one level
187 void do_cmd_go_up(player_type *creature_ptr)
192 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
193 feature_type *f_ptr = &f_info[g_ptr->feat];
197 if (creature_ptr->special_defense & KATA_MUSOU)
199 set_action(creature_ptr, ACTION_NONE);
203 if (!have_flag(f_ptr->flags, FF_LESS))
205 msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
209 /* Quest up stairs */
210 if (have_flag(f_ptr->flags, FF_QUEST))
212 if (!confirm_leave_level(creature_ptr, FALSE)) return;
215 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
216 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
218 msg_print(_("上の階に登った。", "You enter the up staircase."));
222 creature_ptr->inside_quest = g_ptr->special;
224 /* Activate the quest */
225 if (!quest[creature_ptr->inside_quest].status)
227 if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
229 init_flags = INIT_ASSIGN;
230 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
232 quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
235 /* Leaving a quest */
236 if (!creature_ptr->inside_quest)
238 p_ptr->current_floor_ptr->dun_level = 0;
240 creature_ptr->leaving = TRUE;
242 creature_ptr->oldpx = 0;
243 creature_ptr->oldpy = 0;
245 take_turn(creature_ptr, 100);
247 /* End the command */
251 if (!p_ptr->current_floor_ptr->dun_level)
257 go_up = confirm_leave_level(creature_ptr, FALSE);
262 take_turn(creature_ptr, 100);
264 if (autosave_l) do_cmd_save_game(TRUE);
266 /* For a random quest */
267 if (creature_ptr->inside_quest &&
268 quest[creature_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
272 creature_ptr->inside_quest = 0;
275 /* For a fixed quest */
276 if (creature_ptr->inside_quest &&
277 quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
281 creature_ptr->inside_quest = g_ptr->special;
282 p_ptr->current_floor_ptr->dun_level = 0;
286 /* For normal dungeon and random quest */
290 if (have_flag(f_ptr->flags, FF_SHAFT))
292 /* Create a way back */
293 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
299 /* Create a way back */
300 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
305 /* Get out from current dungeon */
306 if (p_ptr->current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth)
307 up_num = p_ptr->current_floor_ptr->dun_level;
309 if (record_stair) exe_write_diary(creature_ptr, NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
312 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
313 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
314 else if (up_num == p_ptr->current_floor_ptr->dun_level)
315 msg_print(_("地上に戻った。", "You go back to the surface."));
317 msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
318 creature_ptr->leaving = TRUE;
323 * @brief 階段を使って階層を降りる処理 / Go down one level
326 void do_cmd_go_down(player_type *creature_ptr)
329 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
330 feature_type *f_ptr = &f_info[g_ptr->feat];
332 bool fall_trap = FALSE;
335 if (creature_ptr->special_defense & KATA_MUSOU)
337 set_action(creature_ptr, ACTION_NONE);
341 if (!have_flag(f_ptr->flags, FF_MORE))
343 msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
347 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
350 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
355 /* Quest down stairs */
356 else if (have_flag(f_ptr->flags, FF_QUEST))
358 /* Confirm Leaving */
359 if(!confirm_leave_level(creature_ptr, TRUE)) return;
361 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
362 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
364 msg_print(_("下の階に降りた。", "You enter the down staircase."));
369 creature_ptr->inside_quest = g_ptr->special;
371 /* Activate the quest */
372 if (!quest[creature_ptr->inside_quest].status)
374 if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
376 init_flags = INIT_ASSIGN;
377 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
379 quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
382 /* Leaving a quest */
383 if (!creature_ptr->inside_quest)
385 p_ptr->current_floor_ptr->dun_level = 0;
387 creature_ptr->leaving = TRUE;
388 creature_ptr->oldpx = 0;
389 creature_ptr->oldpy = 0;
391 take_turn(creature_ptr, 100);
396 DUNGEON_IDX target_dungeon = 0;
398 if (!p_ptr->current_floor_ptr->dun_level)
400 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
402 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
404 msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
407 if (!max_dlv[target_dungeon])
409 msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
410 d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
411 if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
414 /* Save old player position */
415 creature_ptr->oldpx = creature_ptr->x;
416 creature_ptr->oldpy = creature_ptr->y;
417 creature_ptr->dungeon_idx = target_dungeon;
420 * Clear all saved floors
421 * and create a first saved floor
423 prepare_change_floor_mode(CFM_FIRST_FLOOR);
426 take_turn(creature_ptr, 100);
428 if (autosave_l) do_cmd_save_game(TRUE);
431 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
434 if (!p_ptr->current_floor_ptr->dun_level)
436 /* Enter the dungeon just now */
437 creature_ptr->enter_dungeon = TRUE;
438 down_num = d_info[creature_ptr->dungeon_idx].mindepth;
443 if (fall_trap) exe_write_diary(creature_ptr, NIKKI_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
444 else exe_write_diary(creature_ptr, NIKKI_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
449 msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
456 msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[creature_ptr->dungeon_idx].text);
460 if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
461 msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
463 msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
467 creature_ptr->leaving = TRUE;
471 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
475 if (have_flag(f_ptr->flags, FF_SHAFT))
477 /* Create a way back */
478 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
482 /* Create a way back */
483 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
491 * @brief 探索コマンドのメインルーチン / Simple command to "search" for one current_world_ptr->game_turn
494 void do_cmd_search(player_type * creature_ptr)
496 /* Allow repeated command */
499 /* Set repeat count */
500 command_rep = command_arg - 1;
501 creature_ptr->redraw |= (PR_STATE);
506 take_turn(creature_ptr, 100);
508 search(creature_ptr);
513 * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
514 * @param y 走査対象にしたいマスのY座標
515 * @param x 走査対象にしたいマスのX座標
516 * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
517 * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
519 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
521 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
522 OBJECT_IDX this_o_idx, next_o_idx = 0;
524 /* Scan all objects in the grid */
525 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
529 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
530 next_o_idx = o_ptr->next_o_idx;
532 /* Skip unknown chests XXX XXX */
533 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
535 /* Check for non empty chest */
536 if ((o_ptr->tval == TV_CHEST) &&
537 (((!trapped) && (o_ptr->pval)) || /* non empty */
538 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
548 * Attempt to open the given chest at the given location
549 * @param y 箱の存在するマスのY座標
550 * @param x 箱の存在するマスのX座標
551 * @param o_idx 箱のオブジェクトID
552 * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
554 * Assume there is no monster blocking the destination
556 static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
561 object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
563 take_turn(creature_ptr, 100);
565 /* Attempt to unlock it */
568 /* Assume locked, and thus not open */
571 /* Get the "disarm" factor */
572 i = creature_ptr->skill_dis;
574 /* Penalize some conditions */
575 if (creature_ptr->blind || no_lite()) i = i / 10;
576 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
578 /* Extract the difficulty */
581 /* Always have a small chance of success */
584 /* Success -- May still have traps */
585 if (randint0(100) < j)
587 msg_print(_("鍵をはずした。", "You have picked the lock."));
588 gain_exp(creature_ptr, 1);
592 /* Failure -- Keep trying */
595 /* We may continue repeating */
597 if (flush_failure) flush();
598 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
603 /* Allowed to open */
606 /* Apply chest traps, if any */
607 chest_trap(y, x, o_idx);
609 /* Let the Chest drop items */
610 chest_death(FALSE, y, x, o_idx);
616 * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
617 * Attempt to open the given chest at the given location
618 * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
619 * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
620 * @param test 地形条件を判定するための関数ポインタ
621 * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
623 * @details Return the number of features around (or under) the character.
624 * Usually look for doors and floor traps.
626 static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (*test)(FEAT_IDX feat), bool under)
632 /* Count how many matches */
635 /* Check around (and under) the character */
636 for (d = 0; d < 9; d++)
641 /* if not searching under player continue */
642 if ((d == 8) && !under) continue;
644 /* Extract adjacent (legal) location */
645 yy = creature_ptr->y + ddy_ddd[d];
646 xx = creature_ptr->x + ddx_ddd[d];
648 /* Get the p_ptr->current_floor_ptr->grid_array */
649 g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx];
651 /* Must have knowledge */
652 if (!(g_ptr->info & (CAVE_MARK))) continue;
654 /* Feature code (applying "mimic" field) */
655 feat = get_feat_mimic(g_ptr);
657 /* Not looking for this feature */
658 if (!((*test)(feat))) continue;
663 /* Remember the location. Only useful if only one match */
674 * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
675 * Return the number of chests around (or under) the character.
676 * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
677 * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
678 * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
681 * If requested, count only trapped chests.
683 static int count_chests(player_type *creature_ptr, POSITION *y, POSITION *x, bool trapped)
690 /* Count how many matches */
693 /* Check around (and under) the character */
694 for (d = 0; d < 9; d++)
696 /* Extract adjacent (legal) location */
697 POSITION yy = creature_ptr->y + ddy_ddd[d];
698 POSITION xx = creature_ptr->x + ddx_ddd[d];
700 /* No (visible) chest is there */
701 if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
703 /* Grab the object */
704 o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
707 if (o_ptr->pval == 0) continue;
709 /* No (known) traps here */
710 if (trapped && (!object_is_known(o_ptr) ||
711 !chest_traps[o_ptr->pval])) continue;
716 /* Remember the location. Only useful if only one match */
728 * @brief 「開ける」動作コマンドのサブルーチン /
729 * Perform the basic "open" command on doors
730 * @param y 対象を行うマスのY座標
731 * @param x 対象を行うマスのX座標
732 * @return 実際に処理が行われた場合TRUEを返す。
734 * Assume destination is a closed/locked/jammed door
735 * Assume there is no monster blocking the destination
736 * Returns TRUE if repeated commands may continue
738 static bool exe_open(player_type *creature_ptr, POSITION y, POSITION x)
742 /* Get requested grid */
743 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
744 feature_type *f_ptr = &f_info[g_ptr->feat];
747 take_turn(creature_ptr, 100);
749 /* Seeing true feature code (ignore mimic) */
752 if (!have_flag(f_ptr->flags, FF_OPEN))
755 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
759 else if (f_ptr->power)
762 i = creature_ptr->skill_dis;
764 /* Penalize some conditions */
765 if (creature_ptr->blind || no_lite()) i = i / 10;
766 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
768 /* Extract the lock power */
771 /* Extract the difficulty */
774 /* Always have a small chance of success */
778 if (randint0(100) < j)
780 msg_print(_("鍵をはずした。", "You have picked the lock."));
783 cave_alter_feat(y, x, FF_OPEN);
785 sound(SOUND_OPENDOOR);
788 gain_exp(creature_ptr, 1);
795 if (flush_failure) flush();
797 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
799 /* We may keep trying */
808 cave_alter_feat(y, x, FF_OPEN);
810 sound(SOUND_OPENDOOR);
816 * @brief 「開ける」コマンドのメインルーチン /
817 * Open a closed/locked/jammed door or a closed/locked chest.
820 * Unlocking a locked door/chest is worth one experience point.
822 void do_cmd_open(player_type *creature_ptr)
830 if (creature_ptr->wild_mode) return;
832 if (creature_ptr->special_defense & KATA_MUSOU)
834 set_action(creature_ptr, ACTION_NONE);
837 /* Option: Pick a direction */
840 int num_doors, num_chests;
842 num_doors = count_dt(creature_ptr, &y, &x, is_closed_door, FALSE);
843 num_chests = count_chests(creature_ptr, &y, &x, FALSE);
844 if (num_doors || num_chests)
846 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
848 if (!too_many) command_dir = coords_to_dir(y, x);
852 /* Allow repeated command */
855 /* Set repeat count */
856 command_rep = command_arg - 1;
857 creature_ptr->redraw |= (PR_STATE);
863 /* Get a "repeated" direction */
864 if (get_rep_dir(&dir, TRUE))
869 /* Get requested location */
870 y = creature_ptr->y + ddy[dir];
871 x = creature_ptr->x + ddx[dir];
873 /* Get requested grid */
874 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
876 /* Feature code (applying "mimic" field) */
877 feat = get_feat_mimic(g_ptr);
879 /* Check for chest */
880 o_idx = chest_check(y, x, FALSE);
882 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
884 msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
886 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
888 take_turn(creature_ptr, 100);
889 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
890 py_attack(creature_ptr, y, x, 0);
894 more = exe_open_chest(creature_ptr, y, x, o_idx);
898 more = exe_open(creature_ptr, y, x);
902 /* Cancel repeat unless we may continue */
903 if (!more) disturb(creature_ptr, FALSE, FALSE);
909 * @brief 「閉じる」動作コマンドのサブルーチン /
910 * Perform the basic "close" command
911 * @param y 対象を行うマスのY座標
912 * @param x 対象を行うマスのX座標
913 * @return 実際に処理が行われた場合TRUEを返す。
915 * Assume destination is an open/broken door
916 * Assume there is no monster blocking the destination
917 * Returns TRUE if repeated commands may continue
919 static bool exe_close(player_type *creature_ptr, POSITION y, POSITION x)
921 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
922 FEAT_IDX old_feat = g_ptr->feat;
925 take_turn(creature_ptr, 100);
927 /* Seeing true feature code (ignore mimic) */
930 if (have_flag(f_info[old_feat].flags, FF_CLOSE))
932 s16b closed_feat = feat_state(old_feat, FF_CLOSE);
934 /* Hack -- object in the way */
935 if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) &&
936 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
938 msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
943 cave_alter_feat(y, x, FF_CLOSE);
946 if (old_feat == g_ptr->feat)
948 msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
952 sound(SOUND_SHUTDOOR);
961 * @brief 「閉じる」コマンドのメインルーチン /
962 * Close an open door.
965 * Unlocking a locked door/chest is worth one experience point.
967 void do_cmd_close(player_type *creature_ptr)
974 if (creature_ptr->wild_mode) return;
976 if (creature_ptr->special_defense & KATA_MUSOU)
978 set_action(creature_ptr, ACTION_NONE);
981 /* Option: Pick a direction */
984 /* Count open doors */
985 if (count_dt(creature_ptr, &y, &x, is_open, FALSE) == 1)
987 command_dir = coords_to_dir(y, x);
991 /* Allow repeated command */
994 /* Set repeat count */
995 command_rep = command_arg - 1;
996 creature_ptr->redraw |= (PR_STATE);
1002 /* Get a "repeated" direction */
1003 if (get_rep_dir(&dir, FALSE))
1008 y = creature_ptr->y + ddy[dir];
1009 x = creature_ptr->x + ddx[dir];
1010 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1012 /* Feature code (applying "mimic" field) */
1013 feat = get_feat_mimic(g_ptr);
1015 /* Require open/broken door */
1016 if (!have_flag(f_info[feat].flags, FF_CLOSE))
1018 msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
1021 /* Monster in the way */
1022 else if (g_ptr->m_idx)
1024 take_turn(creature_ptr, 100);
1026 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1029 py_attack(creature_ptr, y, x, 0);
1032 /* Close the door */
1035 /* Close the door */
1036 more = exe_close(creature_ptr, y, x);
1040 /* Cancel repeat unless we may continue */
1041 if (!more) disturb(creature_ptr, FALSE, FALSE);
1046 * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
1047 * Determine if a given grid may be "tunneled"
1048 * @param y 対象を行うマスのY座標
1049 * @param x 対象を行うマスのX座標
1052 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
1054 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1056 /* Must have knowledge */
1057 if (!(g_ptr->info & CAVE_MARK))
1059 msg_print(_("そこには何も見当たらない。", "You see nothing there."));
1064 /* Must be a wall/door/etc */
1065 if (!cave_have_flag_grid(g_ptr, FF_TUNNEL))
1067 msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
1077 * @brief 「掘る」動作コマンドのサブルーチン /
1078 * Perform the basic "tunnel" command
1079 * @param y 対象を行うマスのY座標
1080 * @param x 対象を行うマスのX座標
1081 * @return 実際に処理が行われた場合TRUEを返す。
1083 * Assumes that no monster is blocking the destination
1084 * Do not use twall anymore
1085 * Returns TRUE if repeated commands may continue
1087 static bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x)
1090 feature_type *f_ptr, *mimic_f_ptr;
1095 /* Verify legality */
1096 if (!do_cmd_tunnel_test(y, x)) return (FALSE);
1098 take_turn(creature_ptr, 100);
1100 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1101 f_ptr = &f_info[g_ptr->feat];
1102 power = f_ptr->power;
1104 /* Feature code (applying "mimic" field) */
1105 mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
1107 name = f_name + mimic_f_ptr->name;
1111 if (have_flag(f_ptr->flags, FF_PERMANENT))
1114 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1116 msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
1119 /* Map border (mimiccing Permanent wall) */
1122 msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
1127 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1130 if (creature_ptr->skill_dig > randint0(20 * power))
1132 msg_format(_("%sをくずした。", "You have removed the %s."), name);
1134 /* Remove the feature */
1135 cave_alter_feat(y, x, FF_TUNNEL);
1136 creature_ptr->update |= (PU_FLOW);
1140 /* Message, keep digging */
1141 msg_format(_("%sをくずしている。", "You dig into the %s."), name);
1149 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1152 if (creature_ptr->skill_dig > power + randint0(40 * power))
1154 if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
1157 msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
1158 creature_ptr->update |= (PU_FLOW);
1161 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1163 /* Remove the feature */
1164 cave_alter_feat(y, x, FF_TUNNEL);
1166 chg_virtue(creature_ptr, V_DILIGENCE, 1);
1167 chg_virtue(creature_ptr, V_NATURE, -1);
1175 /* We may continue chopping */
1176 msg_format(_("%sを切っている。", "You chop away at the %s."), name);
1177 /* Occasional Search XXX XXX */
1178 if (randint0(100) < 25) search(creature_ptr);
1182 /* We may continue tunelling */
1183 msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
1190 if (is_hidden_door(g_ptr))
1192 /* Occasional Search XXX XXX */
1193 if (randint0(100) < 25) search(creature_ptr);
1200 * @brief 「掘る」動作コマンドのメインルーチン /
1201 * Tunnels through "walls" (including rubble and closed doors)
1205 * Note that you must tunnel in order to hit invisible monsters
1206 * in walls, though moving into walls still takes a current_world_ptr->game_turn anyway.
1208 * Digging is very difficult without a "digger" weapon, but can be
1209 * accomplished by strong players using heavy weapons.
1212 void do_cmd_tunnel(player_type *creature_ptr)
1221 if (creature_ptr->special_defense & KATA_MUSOU)
1223 set_action(creature_ptr, ACTION_NONE);
1226 /* Allow repeated command */
1229 /* Set repeat count */
1230 command_rep = command_arg - 1;
1231 creature_ptr->redraw |= (PR_STATE);
1233 /* Cancel the arg */
1237 /* Get a direction to tunnel, or Abort */
1238 if (get_rep_dir(&dir,FALSE))
1241 y = creature_ptr->y + ddy[dir];
1242 x = creature_ptr->x + ddx[dir];
1244 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1246 /* Feature code (applying "mimic" field) */
1247 feat = get_feat_mimic(g_ptr);
1249 /* No tunnelling through doors */
1250 if (have_flag(f_info[feat].flags, FF_DOOR))
1252 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
1255 /* No tunnelling through most features */
1256 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1258 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
1261 /* A monster is in the way */
1262 else if (g_ptr->m_idx)
1264 take_turn(creature_ptr, 100);
1265 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1268 py_attack(creature_ptr, y, x, 0);
1274 /* Tunnel through walls */
1275 more = exe_tunnel(creature_ptr, y, x);
1279 /* Cancel repetition unless we can continue */
1280 if (!more) disturb(creature_ptr, FALSE, FALSE);
1284 * @brief 移動処理による簡易な「開く」処理 /
1286 * @return 開く処理が実際に試みられた場合TRUEを返す
1289 * If there is a jammed/closed/locked door at the given location,
1290 * then attempt to unlock/open it. Return TRUE if an attempt was
1291 * made (successful or not), otherwise return FALSE.
1293 * The code here should be nearly identical to that in
1294 * do_cmd_open_test() and exe_open().
1297 bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x)
1301 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1302 feature_type *f_ptr = &f_info[g_ptr->feat];
1304 /* Must be a closed door */
1305 if (!is_closed_door(g_ptr->feat))
1311 if (!have_flag(f_ptr->flags, FF_OPEN))
1314 msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
1319 else if (f_ptr->power)
1322 i = creature_ptr->skill_dis;
1324 /* Penalize some conditions */
1325 if (creature_ptr->blind || no_lite()) i = i / 10;
1326 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1328 /* Extract the lock power */
1331 /* Extract the difficulty */
1334 /* Always have a small chance of success */
1338 if (randint0(100) < j)
1340 msg_print(_("鍵をはずした。", "You have picked the lock."));
1343 cave_alter_feat(y, x, FF_OPEN);
1345 sound(SOUND_OPENDOOR);
1348 gain_exp(creature_ptr, 1);
1355 if (flush_failure) flush();
1357 msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
1366 cave_alter_feat(y, x, FF_OPEN);
1368 sound(SOUND_OPENDOOR);
1374 * @brief 箱のトラップを解除する実行処理 /
1375 * Perform the basic "disarm" command
1376 * @param y 解除を行うマスのY座標
1377 * @param x 解除を行うマスのX座標
1378 * @param o_idx 箱のオブジェクトID
1379 * @return ターンを消費する処理が行われた場合TRUEを返す
1382 * Assume destination is a visible trap
1383 * Assume there is no monster blocking the destination
1384 * Returns TRUE if repeated commands may continue
1387 static bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
1391 object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
1393 take_turn(creature_ptr, 100);
1395 /* Get the "disarm" factor */
1396 i = creature_ptr->skill_dis;
1398 /* Penalize some conditions */
1399 if (creature_ptr->blind || no_lite()) i = i / 10;
1400 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1402 /* Extract the difficulty */
1403 j = i - o_ptr->pval;
1405 /* Always have a small chance of success */
1408 /* Must find the trap first. */
1409 if (!object_is_known(o_ptr))
1411 msg_print(_("トラップが見あたらない。", "I don't see any traps."));
1415 /* Already disarmed/unlocked */
1416 else if (o_ptr->pval <= 0)
1418 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1421 /* No traps to find. */
1422 else if (!chest_traps[o_ptr->pval])
1424 msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
1427 /* Success (get a lot of experience) */
1428 else if (randint0(100) < j)
1430 msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
1431 gain_exp(creature_ptr, o_ptr->pval);
1432 o_ptr->pval = (0 - o_ptr->pval);
1435 /* Failure -- Keep trying */
1436 else if ((i > 5) && (randint1(i) > 5))
1438 /* We may keep trying */
1440 if (flush_failure) flush();
1441 msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
1444 /* Failure -- Set off the trap */
1447 msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
1449 chest_trap(y, x, o_idx);
1456 * @brief 箱のトラップを解除するコマンドのサブルーチン /
1457 * Perform the basic "disarm" command
1458 * @param y 解除を行うマスのY座標
1459 * @param x 解除を行うマスのX座標
1460 * @param dir プレイヤーからみた方向ID
1461 * @return ターンを消費する処理が行われた場合TRUEを返す
1464 * Assume destination is a visible trap
1465 * Assume there is no monster blocking the destination
1466 * Returns TRUE if repeated commands may continue
1470 bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1472 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1475 feature_type *f_ptr = &f_info[g_ptr->feat];
1477 /* Access trap name */
1478 concptr name = (f_name + f_ptr->name);
1480 /* Extract trap "power" */
1481 int power = f_ptr->power;
1484 /* Get the "disarm" factor */
1485 int i = creature_ptr->skill_dis;
1488 take_turn(creature_ptr, 100);
1490 /* Penalize some conditions */
1491 if (creature_ptr->blind || no_lite()) i = i / 10;
1492 if (creature_ptr->confused || creature_ptr->image) i = i / 10;
1494 /* Extract the difficulty */
1497 /* Always have a small chance of success */
1501 if (randint0(100) < j)
1503 msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
1506 gain_exp(creature_ptr, power);
1508 /* Remove the trap */
1509 cave_alter_feat(y, x, FF_DISARM);
1511 /* Move the player onto the trap */
1512 move_player(creature_ptr, dir, easy_disarm, FALSE);
1515 /* Failure -- Keep trying */
1516 else if ((i > 5) && (randint1(i) > 5))
1519 if (flush_failure) flush();
1521 msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
1523 /* We may keep trying */
1527 /* Failure -- Set off the trap */
1530 msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
1531 /* Move the player onto the trap */
1532 move_player(creature_ptr, dir, easy_disarm, FALSE);
1539 * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
1540 * Disarms a trap, or chest
1543 void do_cmd_disarm(player_type *creature_ptr)
1551 if (creature_ptr->wild_mode) return;
1553 if (creature_ptr->special_defense & KATA_MUSOU)
1555 set_action(creature_ptr, ACTION_NONE);
1558 /* Option: Pick a direction */
1561 int num_traps, num_chests;
1563 /* Count visible traps */
1564 num_traps = count_dt(creature_ptr, &y, &x, is_trap, TRUE);
1566 /* Count chests (trapped) */
1567 num_chests = count_chests(creature_ptr, &y, &x, TRUE);
1569 /* See if only one target */
1570 if (num_traps || num_chests)
1572 bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
1573 if (!too_many) command_dir = coords_to_dir(y, x);
1578 /* Allow repeated command */
1581 /* Set repeat count */
1582 command_rep = command_arg - 1;
1583 creature_ptr->redraw |= (PR_STATE);
1585 /* Cancel the arg */
1589 /* Get a direction (or abort) */
1590 if (get_rep_dir(&dir,TRUE))
1595 y = creature_ptr->y + ddy[dir];
1596 x = creature_ptr->x + ddx[dir];
1597 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1599 /* Feature code (applying "mimic" field) */
1600 feat = get_feat_mimic(g_ptr);
1602 /* Check for chests */
1603 o_idx = chest_check(y, x, TRUE);
1606 if (!is_trap(feat) && !o_idx)
1608 msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
1611 /* Monster in the way */
1612 else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
1614 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1617 py_attack(creature_ptr, y, x, 0);
1623 more = exe_disarm_chest(creature_ptr, y, x, o_idx);
1629 more = exe_disarm(creature_ptr, y, x, dir);
1633 /* Cancel repeat unless told not to */
1634 if (!more) disturb(creature_ptr, FALSE, FALSE);
1639 * @brief 「打ち破る」動作コマンドのサブルーチン /
1640 * Perform the basic "bash" command
1641 * @param y 対象を行うマスのY座標
1642 * @param x 対象を行うマスのX座標
1643 * @param dir プレイヤーから見たターゲットの方角ID
1644 * @return 実際に処理が行われた場合TRUEを返す。
1647 * Assume destination is a closed/locked/jammed door
1648 * Assume there is no monster blocking the destination
1649 * Returns TRUE if repeated commands may continue
1652 static bool do_cmd_bash_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
1654 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1657 feature_type *f_ptr = &f_info[g_ptr->feat];
1659 /* Hack -- Bash power based on strength */
1660 /* (Ranges from 3 to 20 to 100 to 200) */
1661 int bash = adj_str_blow[creature_ptr->stat_ind[A_STR]];
1663 /* Extract door power */
1664 int temp = f_ptr->power;
1668 concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
1670 take_turn(creature_ptr, 100);
1672 msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
1674 /* Compare bash power to door power */
1675 temp = (bash - (temp * 10));
1677 if (creature_ptr->pclass == CLASS_BERSERKER) temp *= 2;
1679 /* Hack -- always have a chance */
1680 if (temp < 1) temp = 1;
1682 /* Hack -- attempt to bash down the door */
1683 if (randint0(100) < temp)
1685 msg_format(_("%sを壊した!", "The %s crashes open!"), name);
1687 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
1689 /* Break down the door */
1690 if ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
1692 cave_alter_feat(y, x, FF_BASH);
1698 cave_alter_feat(y, x, FF_OPEN);
1701 /* Hack -- Fall through the door */
1702 move_player(creature_ptr, dir, FALSE, FALSE);
1705 /* Saving throw against stun */
1706 else if (randint0(100) < adj_dex_safe[creature_ptr->stat_ind[A_DEX]] +
1709 msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
1711 /* Allow repeated bashing */
1715 /* High dexterity yields coolness */
1718 msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
1720 /* Hack -- Lose balance ala paralysis */
1721 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 2 + randint0(2));
1728 * @brief 「打ち破る」動作コマンドのメインルーチン /
1729 * Bash open a door, success based on character strength
1733 * For a closed door, pval is positive if locked; negative if stuck.
1735 * For an open door, pval is positive for a broken door.
1737 * A closed door can be opened - harder if locked. Any door might be
1738 * bashed open (and thereby broken). Bashing a door is (potentially)
1739 * faster! You move into the door way. To open a stuck door, it must
1740 * be bashed. A closed door can be jammed (see do_cmd_spike()).
1742 * Creatures can also open or bash doors, see elsewhere.
1745 void do_cmd_bash(player_type *creature_ptr)
1752 if (creature_ptr->wild_mode) return;
1754 if (creature_ptr->special_defense & KATA_MUSOU)
1756 set_action(creature_ptr, ACTION_NONE);
1759 /* Allow repeated command */
1762 /* Set repeat count */
1763 command_rep = command_arg - 1;
1764 creature_ptr->redraw |= (PR_STATE);
1766 /* Cancel the arg */
1770 /* Get a "repeated" direction */
1771 if (get_rep_dir(&dir,FALSE))
1776 y = creature_ptr->y + ddy[dir];
1777 x = creature_ptr->x + ddx[dir];
1779 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1781 /* Feature code (applying "mimic" field) */
1782 feat = get_feat_mimic(g_ptr);
1784 /* Nothing useful */
1785 if (!have_flag(f_info[feat].flags, FF_BASH))
1787 msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
1790 /* Monster in the way */
1791 else if (g_ptr->m_idx)
1793 take_turn(creature_ptr, 100);
1795 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
1798 py_attack(creature_ptr, y, x, 0);
1801 /* Bash a closed door */
1805 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1809 /* Unless valid action taken, cancel bash */
1810 if (!more) disturb(creature_ptr, FALSE, FALSE);
1815 * @brief 特定のマスに影響を及ぼすための汎用的コマンド
1819 * Manipulate an adjacent grid in some way
1821 * Attack monsters, tunnel through walls, disarm traps, open doors.
1823 * Consider confusion
1825 * This command must always take a current_world_ptr->game_turn, to prevent free detection
1826 * of invisible monsters.
1829 void do_cmd_alter(player_type *creature_ptr)
1836 if (creature_ptr->special_defense & KATA_MUSOU)
1838 set_action(creature_ptr, ACTION_NONE);
1841 /* Allow repeated command */
1844 /* Set repeat count */
1845 command_rep = command_arg - 1;
1846 creature_ptr->redraw |= (PR_STATE);
1848 /* Cancel the arg */
1852 /* Get a direction */
1853 if (get_rep_dir(&dir,TRUE))
1856 feature_type *f_ptr;
1858 y = creature_ptr->y + ddy[dir];
1859 x = creature_ptr->x + ddx[dir];
1861 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1863 /* Feature code (applying "mimic" field) */
1864 feat = get_feat_mimic(g_ptr);
1865 f_ptr = &f_info[feat];
1867 take_turn(creature_ptr, 100);
1871 py_attack(creature_ptr, y, x, 0);
1875 else if (have_flag(f_ptr->flags, FF_OPEN))
1877 more = exe_open(creature_ptr, y, x);
1880 /* Bash jammed doors */
1881 else if (have_flag(f_ptr->flags, FF_BASH))
1883 more = do_cmd_bash_aux(creature_ptr, y, x, dir);
1886 /* Tunnel through walls */
1887 else if (have_flag(f_ptr->flags, FF_TUNNEL))
1889 more = exe_tunnel(creature_ptr, y, x);
1892 /* Close open doors */
1893 else if (have_flag(f_ptr->flags, FF_CLOSE))
1895 more = exe_close(creature_ptr, y, x);
1899 else if (have_flag(f_ptr->flags, FF_DISARM))
1901 more = exe_disarm(creature_ptr, y, x, dir);
1906 msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
1910 /* Cancel repetition unless we can continue */
1911 if (!more) disturb(creature_ptr, FALSE, FALSE);
1917 * @brief 「くさびを打つ」ために必要なオブジェクトを所持しているかどうかの判定を返す /
1918 * Find the index of some "spikes", if possible.
1919 * @param ip くさびとして打てるオブジェクトのID
1920 * @return オブジェクトがある場合TRUEを返す
1923 * Let user choose a pile of spikes, perhaps?
1926 static bool get_spike(player_type *creature_ptr, INVENTORY_IDX *ip)
1930 /* Check every item in the pack */
1931 for (i = 0; i < INVEN_PACK; i++)
1933 object_type *o_ptr = &creature_ptr->inventory_list[i];
1934 if (!o_ptr->k_idx) continue;
1936 /* Check the "tval" code */
1937 if (o_ptr->tval == TV_SPIKE)
1939 /* Save the spike index */
1952 * @brief 「くさびを打つ」動作コマンドのメインルーチン /
1953 * Jam a closed door with a spike
1957 * This command may NOT be repeated
1960 void do_cmd_spike(player_type *creature_ptr)
1964 if (creature_ptr->wild_mode) return;
1965 if (creature_ptr->special_defense & KATA_MUSOU)
1967 set_action(creature_ptr, ACTION_NONE);
1970 /* Get a "repeated" direction */
1971 if (get_rep_dir(&dir, FALSE))
1978 y = creature_ptr->y + ddy[dir];
1979 x = creature_ptr->x + ddx[dir];
1980 g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
1982 /* Feature code (applying "mimic" field) */
1983 feat = get_feat_mimic(g_ptr);
1985 /* Require closed door */
1986 if (!have_flag(f_info[feat].flags, FF_SPIKE))
1988 msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
1992 else if (!get_spike(creature_ptr, &item))
1994 msg_print(_("くさびを持っていない!", "You have no spikes!"));
1997 /* Is a monster in the way? */
1998 else if (g_ptr->m_idx)
2000 take_turn(creature_ptr, 100);
2002 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
2005 py_attack(creature_ptr, y, x, 0);
2011 take_turn(creature_ptr, 100);
2013 /* Successful jamming */
2014 msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
2015 cave_alter_feat(y, x, FF_SPIKE);
2017 /* Use up, and describe, a single spike, from the bottom */
2018 inven_item_increase(item, -1);
2019 inven_item_describe(item);
2020 inven_item_optimize(item);
2028 * @brief 「歩く」動作コマンドのメインルーチン /
2029 * Support code for the "Walk" and "Jump" commands
2030 * @param pickup アイテムの自動拾いを行うならTRUE
2033 void do_cmd_walk(player_type *creature_ptr, bool pickup)
2040 /* Allow repeated command */
2043 /* Set repeat count */
2044 command_rep = command_arg - 1;
2045 creature_ptr->redraw |= (PR_STATE);
2047 /* Cancel the arg */
2051 /* Get a "repeated" direction */
2052 if (get_rep_dir(&dir, FALSE))
2054 take_turn(creature_ptr, 100);
2056 if ((dir != 5) && (creature_ptr->special_defense & KATA_MUSOU))
2058 set_action(creature_ptr, ACTION_NONE);
2061 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2062 if (creature_ptr->wild_mode) creature_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
2063 if (creature_ptr->action == ACTION_HAYAGAKE) creature_ptr->energy_use = creature_ptr->energy_use * (45-(creature_ptr->lev/2)) / 100;
2065 /* Actually move the character */
2066 move_player(creature_ptr, dir, pickup, FALSE);
2068 /* Allow more walking */
2072 /* Hack again -- Is there a special encounter ??? */
2073 if (creature_ptr->wild_mode && !cave_have_flag_bold(creature_ptr->y, creature_ptr->x, FF_TOWN))
2075 int tmp = 120 + creature_ptr->lev*10 - wilderness[creature_ptr->y][creature_ptr->x].level + 5;
2078 if (((wilderness[creature_ptr->y][creature_ptr->x].level + 5) > (creature_ptr->lev / 2)) && randint0(tmp) < (21-creature_ptr->skill_stl))
2080 /* Inform the player of his horrible fate :=) */
2081 msg_print(_("襲撃だ!", "You are ambushed !"));
2083 /* Go into large wilderness view */
2084 creature_ptr->oldpy = randint1(MAX_HGT-2);
2085 creature_ptr->oldpx = randint1(MAX_WID-2);
2086 change_wild_mode(TRUE);
2088 /* Give first move to monsters */
2089 take_turn(creature_ptr, 100);
2094 /* Cancel repeat unless we may continue */
2095 if (!more) disturb(creature_ptr, FALSE, FALSE);
2100 * @brief 「走る」動作コマンドのメインルーチン /
2104 void do_cmd_run(player_type *creature_ptr)
2107 if (cmd_limit_confused(creature_ptr)) return;
2109 if (creature_ptr->special_defense & KATA_MUSOU)
2111 set_action(creature_ptr, ACTION_NONE);
2114 /* Get a "repeated" direction */
2115 if (get_rep_dir(&dir,FALSE))
2117 /* Hack -- Set the run counter */
2118 creature_ptr->running = (command_arg ? command_arg : 1000);
2127 * @brief 「留まる」動作コマンドのメインルーチン /
2128 * Stay still. Search. Enter stores.
2129 * Pick up treasure if "pickup" is true.
2130 * @param pickup アイテムの自動拾いを行うならTRUE
2133 void do_cmd_stay(player_type *creature_ptr, bool pickup)
2135 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2137 /* Allow repeated command */
2140 /* Set repeat count */
2141 command_rep = command_arg - 1;
2142 creature_ptr->redraw |= (PR_STATE);
2144 /* Cancel the arg */
2148 take_turn(creature_ptr, 100);
2150 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2151 (void)move_player_effect(creature_ptr, creature_ptr->y, creature_ptr->x, mpe_mode);
2156 * @brief 「休む」動作コマンドのメインルーチン /
2157 * Resting allows a player to safely restore his hp -RAK-
2160 void do_cmd_rest(player_type *creature_ptr)
2163 set_action(creature_ptr, ACTION_NONE);
2165 if ((creature_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(creature_ptr) || INTERUPTING_SONG_EFFECT(creature_ptr)))
2167 stop_singing(creature_ptr);
2170 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all();
2172 /* Prompt for time if needed */
2173 if (command_arg <= 0)
2175 concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ",
2176 "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
2182 strcpy(out_val, "&");
2184 /* Ask for duration */
2185 if (!get_string(p, out_val, 4)) return;
2187 /* Rest until done */
2188 if (out_val[0] == '&')
2190 command_arg = COMMAND_ARG_REST_UNTIL_DONE;
2194 else if (out_val[0] == '*')
2196 command_arg = COMMAND_ARG_REST_FULL_HEALING;
2202 command_arg = (COMMAND_ARG)atoi(out_val);
2203 if (command_arg <= 0) return;
2207 if (command_arg > 9999) command_arg = 9999;
2209 if (creature_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(creature_ptr, FALSE);
2211 /* Take a current_world_ptr->game_turn (?) */
2212 take_turn(creature_ptr, 100);
2214 /* The sin of sloth */
2215 if (command_arg > 100) chg_virtue(creature_ptr, V_DILIGENCE, -1);
2217 /* Why are you sleeping when there's no need? WAKE UP!*/
2218 if ((creature_ptr->chp == creature_ptr->mhp) &&
2219 (creature_ptr->csp == creature_ptr->msp) &&
2220 !creature_ptr->blind && !creature_ptr->confused &&
2221 !creature_ptr->poisoned && !creature_ptr->afraid &&
2222 !creature_ptr->stun && !creature_ptr->cut &&
2223 !creature_ptr->slow && !creature_ptr->paralyzed &&
2224 !creature_ptr->image && !creature_ptr->word_recall &&
2225 !creature_ptr->alter_reality)
2226 chg_virtue(creature_ptr, V_DILIGENCE, -1);
2228 /* Save the rest code */
2229 creature_ptr->resting = command_arg;
2230 creature_ptr->action = ACTION_REST;
2231 creature_ptr->update |= (PU_BONUS);
2232 update_creature(creature_ptr);
2234 creature_ptr->redraw |= (PR_STATE);
2243 * @brief 射撃処理のメインルーチン
2246 void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type)
2249 object_type *j_ptr, *ammo_ptr;
2252 if(creature_ptr->wild_mode) return;
2254 creature_ptr->is_fired = FALSE; /* not fired yet */
2256 /* Get the "bow" (if any) */
2257 j_ptr = &creature_ptr->inventory_list[INVEN_BOW];
2259 /* Require a launcher */
2262 msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
2267 if (j_ptr->sval == SV_CRIMSON)
2269 msg_print(_("この武器は発動して使うもののようだ。", "Do activate."));
2274 if (j_ptr->sval == SV_HARP)
2276 msg_print(_("この武器で射撃はできない。", "It's not for firing."));
2282 if (creature_ptr->special_defense & KATA_MUSOU)
2284 set_action(creature_ptr, ACTION_NONE);
2287 q = _("どれを撃ちますか? ", "Fire which item? ");
2288 s = _("発射されるアイテムがありません。", "You have nothing to fire.");
2290 ammo_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), creature_ptr->tval_ammo);
2298 exe_fire(creature_ptr, item, j_ptr, snipe_type);
2300 if (!creature_ptr->is_fired || creature_ptr->pclass != CLASS_SNIPER) return;
2302 /* Sniper actions after some shootings */
2303 if (snipe_type == SP_AWAY)
2305 teleport_player(10 + (creature_ptr->concent * 2), 0L);
2307 if (snipe_type == SP_FINAL)
2309 msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
2310 (void)set_slow(creature_ptr, creature_ptr->slow + randint0(7) + 7, FALSE);
2311 (void)set_stun(creature_ptr, creature_ptr->stun + randint1(25));
2317 * @brief 投射処理メインルーチン /
2318 * Throw an object from the pack or floor.
2320 * @param boomerang ブーメラン処理ならばTRUE
2321 * @param shuriken 忍者の手裏剣処理ならばTRUE
2322 * @return ターンを消費した場合TRUEを返す
2325 * Note: "unseen" monsters are very hard to hit.
2327 * Should throwing a weapon do full damage? Should it allow the magic
2328 * to hit bonus of the weapon to have an effect? Should it ever cause
2329 * the item to be destroyed? Should it do any damage at all?
2332 bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_IDX shuriken)
2337 POSITION y, x, ty, tx, prev_y, prev_x;
2338 POSITION ny[19], nx[19];
2339 int chance, tdam, tdis;
2340 int mul, div, dd, ds;
2341 int cur_dis, visible;
2348 bool hit_body = FALSE;
2349 bool hit_wall = FALSE;
2350 bool equiped_item = FALSE;
2351 bool return_when_thrown = FALSE;
2353 GAME_TEXT o_name[MAX_NLEN];
2355 int msec = delay_factor * delay_factor * delay_factor;
2357 BIT_FLAGS flgs[TR_FLAG_SIZE];
2359 bool come_back = FALSE;
2360 bool do_drop = TRUE;
2362 if (creature_ptr->wild_mode) return FALSE;
2364 if (creature_ptr->special_defense & KATA_MUSOU)
2366 set_action(creature_ptr, ACTION_NONE);
2372 o_ptr = &creature_ptr->inventory_list[item];
2376 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
2378 item_tester_hook = item_tester_hook_boomerang;
2379 q = _("どの武器を投げますか? ", "Throw which item? ");
2380 s = _("投げる武器がない。", "You have nothing to throw.");
2381 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP), 0);
2388 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2391 o_ptr = &creature_ptr->inventory_list[item];
2396 o_ptr = &creature_ptr->inventory_list[item];
2401 q = _("どのアイテムを投げますか? ", "Throw which item? ");
2402 s = _("投げるアイテムがない。", "You have nothing to throw.");
2403 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP), 0);
2411 /* Item is cursed */
2412 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
2414 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
2418 if (creature_ptr->inside_arena && !boomerang)
2420 if (o_ptr->tval != TV_SPIKE)
2422 msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
2430 object_copy(q_ptr, o_ptr);
2432 /* Extract the thrown object's flags. */
2433 object_flags(q_ptr, flgs);
2434 torch_flags(q_ptr, flgs);
2436 /* Distribute the charges of rods/wands between the stacks */
2437 distribute_charges(o_ptr, q_ptr, 1);
2442 object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
2444 if (creature_ptr->mighty_throw) mult += 3;
2446 /* Extract a "distance multiplier" */
2447 /* Changed for 'launcher' mutation */
2448 mul = 10 + 2 * (mult - 1);
2450 /* Enforce a minimum "weight" of one pound */
2451 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
2452 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
2454 /* Hack -- Distance -- Reward strength, penalize weight */
2455 tdis = (adj_str_blow[creature_ptr->stat_ind[A_STR]] + 20) * mul / div;
2457 /* Max distance of 10-18 */
2458 if (tdis > mul) tdis = mul;
2462 ty = randint0(101) - 50 + creature_ptr->y;
2463 tx = randint0(101) - 50 + creature_ptr->x;
2467 project_length = tdis + 1;
2469 /* Get a direction (or cancel) */
2470 if (!get_aim_dir(&dir)) return FALSE;
2472 /* Predict the "target" location */
2473 tx = creature_ptr->x + 99 * ddx[dir];
2474 ty = creature_ptr->y + 99 * ddy[dir];
2476 /* Check for "target request" */
2477 if ((dir == 5) && target_okay())
2483 project_length = 0; /* reset to default */
2486 if ((q_ptr->name1 == ART_MJOLLNIR) ||
2487 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
2488 return_when_thrown = TRUE;
2490 /* Reduce and describe creature_ptr->inventory_list */
2493 inven_item_increase(item, -1);
2494 if (!return_when_thrown)
2495 inven_item_describe(item);
2496 inven_item_optimize(item);
2499 /* Reduce and describe floor item */
2502 floor_item_increase(0 - item, -1);
2503 floor_item_optimize(0 - item);
2505 if (item >= INVEN_RARM)
2507 equiped_item = TRUE;
2508 creature_ptr->redraw |= (PR_EQUIPPY);
2511 take_turn(creature_ptr, 100);
2513 /* Rogue and Ninja gets bonus */
2514 if ((creature_ptr->pclass == CLASS_ROGUE) || (creature_ptr->pclass == CLASS_NINJA))
2515 creature_ptr->energy_use -= creature_ptr->lev;
2517 /* Start at the player */
2518 y = creature_ptr->y;
2519 x = creature_ptr->x;
2523 if ((creature_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
2524 else shuriken = FALSE;
2526 /* Chance of hitting */
2527 if (have_flag(flgs, TR_THROW)) chance = ((creature_ptr->skill_tht) +
2528 ((creature_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
2529 else chance = (creature_ptr->skill_tht + (creature_ptr->to_h_b * BTH_PLUS_ADJ));
2531 if (shuriken) chance *= 2;
2536 /* Travel until stopped */
2537 for (cur_dis = 0; cur_dis <= tdis; )
2539 /* Hack -- Stop at the target */
2540 if ((y == ty) && (x == tx)) break;
2542 /* Calculate the new location (see "project()") */
2545 mmove2(&ny[cur_dis], &nx[cur_dis], creature_ptr->y, creature_ptr->x, ty, tx);
2547 /* Stopped by walls/doors */
2548 if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
2551 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !p_ptr->current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
2554 /* The player can see the (on screen) missile */
2555 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
2557 SYMBOL_CODE c = object_char(q_ptr);
2558 TERM_COLOR a = object_attr(q_ptr);
2560 /* Draw, Hilite, Fresh, Pause, Erase */
2561 print_rel(c, a, ny[cur_dis], nx[cur_dis]);
2562 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
2564 Term_xtra(TERM_XTRA_DELAY, msec);
2565 lite_spot(ny[cur_dis], nx[cur_dis]);
2569 /* The player cannot see the missile */
2572 /* Pause anyway, for consistancy */
2573 Term_xtra(TERM_XTRA_DELAY, msec);
2579 /* Save the new location */
2583 /* Advance the distance */
2586 /* Monster here, Try to hit it */
2587 if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
2589 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
2590 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2591 GAME_TEXT m_name[MAX_NLEN];
2592 monster_name(g_ptr->m_idx, m_name);
2594 /* Check the visibility */
2595 visible = m_ptr->ml;
2597 /* Note the collision */
2600 /* Did we hit it (penalize range) */
2601 if (test_hit_fire(creature_ptr, chance - cur_dis, m_ptr, m_ptr->ml, o_name))
2605 /* Handle unseen monster */
2608 /* Invisible monster */
2609 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
2612 /* Handle visible monster */
2615 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
2619 if (!creature_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2620 health_track(g_ptr->m_idx);
2624 /* Hack -- Base damage from thrown object */
2627 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
2628 tdam = damroll(dd, ds);
2629 /* Apply special damage */
2630 tdam = tot_dam_aux(creature_ptr, q_ptr, tdam, m_ptr, 0, TRUE);
2631 tdam = critical_shot(creature_ptr, q_ptr->weight, q_ptr->to_h, 0, tdam);
2632 if (q_ptr->to_d > 0)
2633 tdam += q_ptr->to_d;
2635 tdam += -q_ptr->to_d;
2639 tdam *= (mult+creature_ptr->num_blow[item - INVEN_RARM]);
2640 tdam += creature_ptr->to_d_m;
2642 else if (have_flag(flgs, TR_THROW))
2645 tdam += creature_ptr->to_d_m;
2653 tdam += ((creature_ptr->lev+30)*(creature_ptr->lev+30)-900)/55;
2656 /* No negative damage */
2657 if (tdam < 0) tdam = 0;
2659 /* Modify the damage */
2660 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
2662 msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
2663 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
2665 /* Hit the monster, check for death */
2666 if (mon_take_hit(g_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
2674 message_pain(g_ptr->m_idx, tdam);
2676 /* Anger the monster */
2677 if ((tdam > 0) && !object_is_potion(q_ptr))
2678 anger_monster(m_ptr);
2680 if (fear && m_ptr->ml)
2683 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2693 /* decrease toach's fuel */
2694 if (hit_body) torch_lost_fuel(q_ptr);
2696 /* Chance of breakage (during attacks) */
2697 j = (hit_body ? breakage_chance(q_ptr, creature_ptr->pclass == CLASS_ARCHER, 0) : 0);
2699 /* Figurines transform */
2700 if ((q_ptr->tval == TV_FIGURINE) && !(creature_ptr->inside_arena))
2704 if (!(summon_named_creature(0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
2705 msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
2706 else if (object_is_cursed(q_ptr))
2707 msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
2711 /* Potions smash open */
2712 if (object_is_potion(q_ptr))
2714 if (hit_body || hit_wall || (randint1(100) < j))
2716 msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
2718 if (potion_smash_effect(0, y, x, q_ptr->k_idx))
2720 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx];
2721 if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !MON_INVULNER(m_ptr))
2723 GAME_TEXT m_name[MAX_NLEN];
2724 monster_desc(m_name, m_ptr, 0);
2725 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
2726 set_hostile(&p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]);
2737 if (return_when_thrown)
2739 int back_chance = randint1(30)+20+((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
2740 char o2_name[MAX_NLEN];
2741 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
2744 if (boomerang) back_chance += 4+randint1(5);
2745 if (super_boomerang) back_chance += 100;
2746 object_desc(o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2748 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
2750 for (i = cur_dis - 1; i > 0; i--)
2752 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
2754 char c = object_char(q_ptr);
2755 byte a = object_attr(q_ptr);
2757 /* Draw, Hilite, Fresh, Pause, Erase */
2758 print_rel(c, a, ny[i], nx[i]);
2759 move_cursor_relative(ny[i], nx[i]);
2761 Term_xtra(TERM_XTRA_DELAY, msec);
2762 lite_spot(ny[i], nx[i]);
2767 /* Pause anyway, for consistancy */
2768 Term_xtra(TERM_XTRA_DELAY, msec);
2771 if((back_chance > 37) && !creature_ptr->blind && (item >= 0))
2773 msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
2780 msg_format(_("%sを受け損ねた!", "%s backs, but you can't catch!"), o2_name);
2784 msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
2786 y = creature_ptr->y;
2787 x = creature_ptr->x;
2792 msg_format(_("%sが返ってこなかった!", "%s doesn't back!"), o2_name);
2798 if (item == INVEN_RARM || item == INVEN_LARM)
2800 /* Access the wield slot */
2801 o_ptr = &creature_ptr->inventory_list[item];
2803 /* Wear the new stuff */
2804 object_copy(o_ptr, q_ptr);
2806 creature_ptr->total_weight += q_ptr->weight;
2808 /* Increment the equip counter by hand */
2809 creature_ptr->equip_cnt++;
2811 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
2812 creature_ptr->window |= (PW_EQUIP);
2820 else if (equiped_item)
2822 verify_equip_slot(creature_ptr, item);
2823 calc_android_exp(creature_ptr);
2828 if (cave_have_flag_bold(y, x, FF_PROJECT))
2830 (void)drop_near(q_ptr, j, y, x);
2834 (void)drop_near(q_ptr, j, prev_y, prev_x);
2842 * @brief 自殺するコマンドのメインルーチン
2843 * Hack -- commit suicide
2847 void do_cmd_suicide(player_type *creature_ptr)
2854 /* Verify Retirement */
2855 if (creature_ptr->total_winner)
2858 if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
2861 /* Verify Suicide */
2865 if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
2869 if (!creature_ptr->noscore)
2871 /* Special Verification for suicide */
2872 prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
2877 if (i != '@') return;
2879 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
2882 /* Initialize "last message" buffer */
2883 if (creature_ptr->last_message) string_free(creature_ptr->last_message);
2884 creature_ptr->last_message = NULL;
2886 /* Hack -- Note *winning* message */
2887 if (creature_ptr->total_winner && last_words)
2889 char buf[1024] = "";
2890 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
2893 while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
2894 } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
2898 creature_ptr->last_message = string_make(buf);
2899 msg_print(creature_ptr->last_message);
2904 creature_ptr->playing = FALSE;
2906 /* Kill the player */
2907 creature_ptr->is_dead = TRUE;
2908 creature_ptr->leaving = TRUE;
2910 if (!creature_ptr->total_winner)
2912 exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
2913 exe_write_diary(creature_ptr, NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
2914 exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 1, "\n\n\n\n");
2917 /* Cause of death */
2918 (void)strcpy(creature_ptr->died_from, _("途中終了", "Quitting"));