3 * @brief ¥×¥ì¥¤¥ä¡¼¤Î¥³¥Þ¥ó¥É½èÍý2 / Movement commands (part 2)
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 * @brief ¥Õ¥í¥¢Ã¦½Ð»þ¤Ë½ÐÌá¤ê¤¬ÉÔ²Äǽ¤À¤Ã¤¿¾ì¹ç¤Ë·Ù¹ð¤ò²Ã¤¨¤ë½èÍý
18 * @param down_stair TRUE¤Ê¤é¤Ð³¬Ãʤò¹ß¤ê¤ë½èÍý¡¢FALSE¤Ê¤é³¬Ãʤò¾º¤ë½èÍý¤Ë¤è¤ëÆâÍÆ
19 * @return ¥Õ¥í¥¢°ÜÆ°¤ò¼ÂºÝ¤Ë¹Ô¤¦¤Ê¤éTRUE¡¢¥¥ã¥ó¥»¥ë¤¹¤ë¾ì¹ç¤ÏFALSE
21 bool confirm_leave_level(bool down_stair)
23 quest_type *q_ptr = &quest[p_ptr->inside_quest];
25 /* Confirm leaving from once only quest */
26 if (confirm_quest && p_ptr->inside_quest &&
27 (q_ptr->type == QUEST_TYPE_RANDOM ||
28 (q_ptr->flags & QUEST_FLAG_ONCE &&
29 q_ptr->status != QUEST_STATUS_COMPLETED) ||
30 (q_ptr->flags & QUEST_FLAG_TOWER &&
31 ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
32 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
35 msg_print("¤³¤Î³¬¤ò°ìÅÙµî¤ë¤ÈÆóÅÙ¤ÈÌá¤Ã¤ÆÍè¤é¤ì¤Þ¤»¤ó¡£");
36 if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©")) return TRUE;
38 msg_print("You can't come back here once you leave this floor.");
39 if (get_check("Really leave this floor? ")) return TRUE;
50 * @brief ³¬Ãʤò»È¤Ã¤Æ³¬Áؤò¾º¤ë½èÍý / Go up one level
53 void do_cmd_go_up(void)
58 cave_type *c_ptr = &cave[py][px];
59 feature_type *f_ptr = &f_info[c_ptr->feat];
63 if (p_ptr->special_defense & KATA_MUSOU)
65 set_action(ACTION_NONE);
69 if (!have_flag(f_ptr->flags, FF_LESS))
72 msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
74 msg_print("I see no up staircase here.");
81 if (have_flag(f_ptr->flags, FF_QUEST))
83 /* Cancel the command */
84 if (!confirm_leave_level(FALSE)) return;
89 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
90 msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
92 msg_print("¾å¤Î³¬¤ËÅФä¿¡£");
94 msg_print("You enter the up staircase.");
99 p_ptr->inside_quest = c_ptr->special;
101 /* Activate the quest */
102 if (!quest[p_ptr->inside_quest].status)
104 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
106 init_flags = INIT_ASSIGN;
107 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
109 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
112 /* Leaving a quest */
113 if (!p_ptr->inside_quest)
119 p_ptr->leaving = TRUE;
124 /* Hack -- take a turn */
127 /* End the command */
137 go_up = confirm_leave_level(FALSE);
140 /* Cancel the command */
143 /* Hack -- take a turn */
146 if (autosave_l) do_cmd_save_game(TRUE);
148 /* For a random quest */
149 if (p_ptr->inside_quest &&
150 quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
154 p_ptr->inside_quest = 0;
157 /* For a fixed quest */
158 if (p_ptr->inside_quest &&
159 quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
163 p_ptr->inside_quest = c_ptr->special;
168 /* For normal dungeon and random quest */
172 if (have_flag(f_ptr->flags, FF_SHAFT))
174 /* Create a way back */
175 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
181 /* Create a way back */
182 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
187 /* Get out from current dungeon */
188 if (dun_level - up_num < d_info[dungeon_type].mindepth)
193 if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿");
195 if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "climbed up the stairs to");
200 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
201 msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
202 else if (up_num == dun_level)
203 msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£");
205 msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
207 if (up_num == dun_level)
208 msg_print("You go back to the surface.");
210 msg_print("You enter a maze of up staircases.");
214 p_ptr->leaving = TRUE;
219 * @brief ³¬Ãʤò»È¤Ã¤Æ³¬Áؤò¹ß¤ê¤ë½èÍý / Go down one level
222 void do_cmd_go_down(void)
225 cave_type *c_ptr = &cave[py][px];
226 feature_type *f_ptr = &f_info[c_ptr->feat];
228 bool fall_trap = FALSE;
231 if (p_ptr->special_defense & KATA_MUSOU)
233 set_action(ACTION_NONE);
237 if (!have_flag(f_ptr->flags, FF_MORE))
240 msg_print("¤³¤³¤Ë¤Ï²¼¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
242 msg_print("I see no down staircase here.");
248 if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
251 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
256 /* Quest down stairs */
257 else if (have_flag(f_ptr->flags, FF_QUEST))
259 /* Confirm Leaving */
260 if(!confirm_leave_level(TRUE)) return;
263 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
264 msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
266 msg_print("²¼¤Î³¬¤Ë¹ß¤ê¤¿¡£");
268 msg_print("You enter the down staircase.");
274 p_ptr->inside_quest = c_ptr->special;
276 /* Activate the quest */
277 if (!quest[p_ptr->inside_quest].status)
279 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
281 init_flags = INIT_ASSIGN;
282 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
284 quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
287 /* Leaving a quest */
288 if (!p_ptr->inside_quest)
294 p_ptr->leaving = TRUE;
300 /* Hack -- take a turn */
306 int target_dungeon = 0;
310 target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
312 if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
315 msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÆþ¸ý¤ÏºÉ¤¬¤ì¤Æ¤¤¤ë¡ª");
317 msg_print("The entrance of this dungeon is closed!");
321 if (!max_dlv[target_dungeon])
324 msg_format("¤³¤³¤Ë¤Ï%s¤ÎÆþ¤ê¸ý(%d³¬ÁêÅö)¤¬¤¢¤ê¤Þ¤¹", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
325 if (!get_check("ËÜÅö¤Ë¤³¤Î¥À¥ó¥¸¥ç¥ó¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
327 msg_format("There is the entrance of %s (Danger level: %d)", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
328 if (!get_check("Do you really get in this dungeon? ")) return;
332 /* Save old player position */
335 dungeon_type = (byte)target_dungeon;
338 * Clear all saved floors
339 * and create a first saved floor
341 prepare_change_floor_mode(CFM_FIRST_FLOOR);
344 /* Hack -- take a turn */
347 if (autosave_l) do_cmd_save_game(TRUE);
350 if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
355 /* Enter the dungeon just now */
356 p_ptr->enter_dungeon = TRUE;
357 down_num = d_info[dungeon_type].mindepth;
363 if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
364 else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿");
366 if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fell through a trap door");
367 else do_cmd_write_nikki(NIKKI_STAIR, down_num, "climbed down the stairs to");
374 msg_print("¤ï¤¶¤ÈÍî¤È¤·¸Í¤ËÍî¤Á¤¿¡£");
376 msg_print("You deliberately jump through the trap door.");
385 msg_format("%s¤ØÆþ¤Ã¤¿¡£", d_text + d_info[dungeon_type].text);
387 msg_format("You entered %s.", d_text + d_info[dungeon_type].text);
393 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
394 msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
396 msg_print("³¬Ãʤò²¼¤ê¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
398 msg_print("You enter a maze of down staircases.");
405 p_ptr->leaving = TRUE;
409 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
413 if (have_flag(f_ptr->flags, FF_SHAFT))
415 /* Create a way back */
416 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
420 /* Create a way back */
421 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
429 * @brief õº÷¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó / Simple command to "search" for one turn
432 void do_cmd_search(void)
434 /* Allow repeated command */
437 /* Set repeat count */
438 command_rep = command_arg - 1;
440 /* Redraw the state */
441 p_ptr->redraw |= (PR_STATE);
456 * @brief ³ºÅö¤Î¥Þ¥¹¤Ë¸ºß¤·¤Æ¤¤¤ëÈ¢¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID¤òÊÖ¤¹¡£
457 * @param y ÁöººÂоݤˤ·¤¿¤¤¥Þ¥¹¤ÎYºÂɸ
458 * @param x ÁöººÂоݤˤ·¤¿¤¤¥Þ¥¹¤ÎXºÂɸ
459 * @param trapped TRUE¤Ê¤é¤Ð¥È¥é¥Ã¥×¤¬Â¸ºß¤¹¤ëÈ¢¤Î¤ß¡¢FALSE¤Ê¤é¤Ð¶õ¤Ç¤Ê¤¤È¢Á´¤Æ¤òÂоݤˤ¹¤ë
460 * @return È¢¤¬Â¸ºß¤¹¤ë¾ì¹ç¤½¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID¡¢Â¸ºß¤·¤Ê¤¤¾ì¹ç0¤òÊÖ¤¹¡£
462 static s16b chest_check(int y, int x, bool trapped)
464 cave_type *c_ptr = &cave[y][x];
466 s16b this_o_idx, next_o_idx = 0;
469 /* Scan all objects in the grid */
470 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
475 o_ptr = &o_list[this_o_idx];
477 /* Acquire next object */
478 next_o_idx = o_ptr->next_o_idx;
480 /* Skip unknown chests XXX XXX */
481 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
483 /* Check for non empty chest */
484 if ((o_ptr->tval == TV_CHEST) &&
485 (((!trapped) && (o_ptr->pval)) || /* non empty */
486 ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
498 * @brief È¢¤«¤é¥¢¥¤¥Æ¥à¤ò°ú¤½Ð¤¹ /
499 * Allocates objects upon opening a chest -BEN-
500 * @param scatter TRUE¤Ê¤é¤Ð¥È¥é¥Ã¥×¤Ë¤è¤ë¥¢¥¤¥Æ¥à¤Î³È»¶½èÍý
501 * @param y È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎYºÂɸ
502 * @param x È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎXºÂɸ
503 * @param o_idx È¢¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID
507 * Disperse treasures from the given chest, centered at (x,y).
509 * Small chests often contain "gold", while Large chests always contain
510 * items. Wooden chests contain 2 items, Iron chests contain 4 items,
511 * and Steel chests contain 6 items. The "value" of the items in a
512 * chest is based on the "power" of the chest, which is in turn based
513 * on the level on which the chest is generated.
516 static void chest_death(bool scatter, int y, int x, s16b o_idx)
526 object_type *o_ptr = &o_list[o_idx];
529 /* Small chests often hold "gold" */
530 small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
532 /* Determine how much to drop (see above) */
533 number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;
535 if (o_ptr->sval == SV_CHEST_KANDUME)
540 object_level = o_ptr->xtra3;
544 /* Determine the "value" of the items */
545 object_level = ABS(o_ptr->pval) + 10;
548 /* Zero pval means empty chest */
549 if (!o_ptr->pval) number = 0;
551 /* Opening a chest */
552 opening_chest = TRUE;
554 /* Drop some objects (non-chests) */
555 for (; number > 0; --number)
557 /* Get local object */
560 /* Wipe the object */
563 /* Small chests often drop gold */
564 if (small && (randint0(100) < 25))
567 if (!make_gold(q_ptr)) continue;
570 /* Otherwise drop an item */
573 /* Make a good object */
574 if (!make_object(q_ptr, mode)) continue;
577 /* If chest scatters its contents, pick any floor square. */
581 for (i = 0; i < 200; i++)
583 /* Pick a totally random spot. */
584 y = randint0(MAX_HGT);
585 x = randint0(MAX_WID);
587 /* Must be an empty floor. */
588 if (!cave_empty_bold(y, x)) continue;
590 /* Place the object there. */
591 drop_near(q_ptr, -1, y, x);
597 /* Normally, drop object near the chest. */
598 else drop_near(q_ptr, -1, y, x);
601 /* Reset the object level */
602 object_level = base_level;
604 /* No longer opening a chest */
605 opening_chest = FALSE;
616 * @brief È¢¤Î¥È¥é¥Ã¥×½èÍý /
617 * Chests have traps too.
618 * @param y È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎYºÂɸ
619 * @param x È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎXºÂɸ
620 * @param o_idx È¢¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID
624 * Exploding chest destroys contents (and traps).
625 * Note that the chest itself is never destroyed.
628 static void chest_trap(int y, int x, s16b o_idx)
632 object_type *o_ptr = &o_list[o_idx];
634 int mon_level = o_ptr->xtra3;
636 /* Ignore disarmed chests */
637 if (o_ptr->pval <= 0) return;
639 /* Obtain the traps */
640 trap = chest_traps[o_ptr->pval];
643 if (trap & (CHEST_LOSE_STR))
646 msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
647 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1);
649 msg_print("A small needle has pricked you!");
650 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
653 (void)do_dec_stat(A_STR);
656 /* Lose constitution */
657 if (trap & (CHEST_LOSE_CON))
660 msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
661 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1);
663 msg_print("A small needle has pricked you!");
664 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
667 (void)do_dec_stat(A_CON);
671 if (trap & (CHEST_POISON))
674 msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿Îп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
676 msg_print("A puff of green gas surrounds you!");
679 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
681 (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
686 if (trap & (CHEST_PARALYZE))
689 msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿²«¿§¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
691 msg_print("A puff of yellow gas surrounds you!");
695 if (!p_ptr->free_act)
697 (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
701 /* Summon monsters */
702 if (trap & (CHEST_SUMMON))
704 int num = 2 + randint1(3);
706 msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿±ì¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
708 msg_print("You are enveloped in a cloud of smoke!");
712 for (i = 0; i < num; i++)
714 if (randint1(100)<dun_level)
715 activate_hi_summon(py, px, FALSE);
717 (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
721 /* Elemental summon. */
722 if (trap & (CHEST_E_SUMMON))
725 msg_print("Êõ¤ò¼é¤ë¤¿¤á¤Ë¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿¡ª");
727 msg_print("Elemental beings appear to protect their treasures!");
729 for (i = 0; i < randint1(3) + 5; i++)
731 (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
735 /* Force clouds, then summon birds. */
736 if (trap & (CHEST_BIRD_STORM))
739 msg_print("Ä»¤Î·²¤ì¤¬¤¢¤Ê¤¿¤ò¼è¤ê´¬¤¤¤¿¡ª");
741 msg_print("A storm of birds swirls around you!");
744 for (i = 0; i < randint1(3) + 3; i++)
745 (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
747 for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
749 (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
753 /* Various colorful summonings. */
754 if (trap & (CHEST_H_SUMMON))
760 msg_print("±ê¤Èⲫ¤Î±À¤ÎÃæ¤Ë°Ë⤬»Ñ¤ò¸½¤·¤¿¡ª");
762 msg_print("Demons materialize in clouds of fire and brimstone!");
765 for (i = 0; i < randint1(3) + 2; i++)
767 (void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);
768 (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
772 /* Summon dragons. */
776 msg_print("°Å°Ç¤Ë¥É¥é¥´¥ó¤Î±Æ¤¬¤Ü¤ó¤ä¤ê¤È¸½¤ì¤¿¡ª");
778 msg_print("Draconic forms loom out of the darkness!");
781 for (i = 0; i < randint1(3) + 2; i++)
783 (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
787 /* Summon hybrids. */
791 msg_print("´ñ̯¤Ê»Ñ¤Î²øʪ¤¬½±¤Ã¤ÆÍ褿¡ª");
793 msg_print("Creatures strange and twisted assault you!");
796 for (i = 0; i < randint1(5) + 3; i++)
798 (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
802 /* Summon vortices (scattered) */
806 msg_print("±²´¬¤¬¹çÂΤ·¡¢ÇËÎö¤·¤¿¡ª");
808 msg_print("Vortices coalesce and wreak destruction!");
811 for (i = 0; i < randint1(3) + 2; i++)
813 (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
819 if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
821 /* Determine how many nasty tricks can be played. */
822 int nasty_tricks_count = 4 + randint0(3);
826 msg_print("¶²¤í¤·¤¤À¼¤¬¶Á¤¤¤¿: ¡Ö°Å°Ç¤¬Æò¤ò¤Ä¤Ä¤Þ¤ó¡ª¡×");
828 msg_print("Hideous voices bid: 'Let the darkness have thee!'");
831 /* This is gonna hurt... */
832 for (; nasty_tricks_count > 0; nasty_tricks_count--)
834 /* ...but a high saving throw does help a little. */
835 if (randint1(100+o_ptr->pval*2) > p_ptr->skill_sav)
838 if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
840 if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "a chest dispel-player trap", -1);
842 else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);
845 if (!p_ptr->free_act)
846 (void)set_paralyzed(p_ptr->paralyzed + 2 +
849 (void)set_stun(p_ptr->stun + 10 +
852 else if (one_in_(3)) apply_disenchant(0);
855 (void)do_dec_stat(A_STR);
856 (void)do_dec_stat(A_DEX);
857 (void)do_dec_stat(A_CON);
858 (void)do_dec_stat(A_INT);
859 (void)do_dec_stat(A_WIS);
860 (void)do_dec_stat(A_CHR);
862 else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);
867 /* Aggravate monsters. */
868 if (trap & (CHEST_ALARM))
871 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
873 msg_print("An alarm sounds!");
875 aggravate_monsters(0);
879 if ((trap & (CHEST_EXPLODE)) && o_ptr->k_idx)
882 msg_print("ÆÍÁ³¡¢È¢¤¬Çúȯ¤·¤¿¡ª");
883 msg_print("È¢¤ÎÃæ¤Îʪ¤Ï¤¹¤Ù¤ÆÊ´¡¹¤ËºÕ¤±»¶¤Ã¤¿¡ª");
885 msg_print("There is a sudden explosion!");
886 msg_print("Everything inside the chest is destroyed!");
890 sound(SOUND_EXPLODE);
892 take_hit(DAMAGE_ATTACK, damroll(5, 8), "Çúȯ¤¹¤ëÈ¢", -1);
894 take_hit(DAMAGE_ATTACK, damroll(5, 8), "an exploding chest", -1);
898 /* Scatter contents. */
899 if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx)
902 msg_print("ÊõÈ¢¤ÎÃæ¿È¤Ï¥À¥ó¥¸¥ç¥ó¤¸¤å¤¦¤Ë»¶Í𤷤¿¡ª");
904 msg_print("The contents of the chest scatter all over the dungeon!");
906 chest_death(TRUE, y, x, o_idx);
913 * @brief È¢¤ò³«¤±¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
914 * Attempt to open the given chest at the given location
915 * @param y È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎYºÂɸ
916 * @param x È¢¤Î¸ºß¤¹¤ë¥Þ¥¹¤ÎXºÂɸ
917 * @param o_idx È¢¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID
918 * @return È¢¤¬³«¤«¤Ê¤«¤Ã¤¿¾ì¹çTRUE / Returns TRUE if repeated commands may continue
920 * Assume there is no monster blocking the destination
922 static bool do_cmd_open_chest(int y, int x, s16b o_idx)
930 object_type *o_ptr = &o_list[o_idx];
936 /* Attempt to unlock it */
939 /* Assume locked, and thus not open */
942 /* Get the "disarm" factor */
943 i = p_ptr->skill_dis;
945 /* Penalize some conditions */
946 if (p_ptr->blind || no_lite()) i = i / 10;
947 if (p_ptr->confused || p_ptr->image) i = i / 10;
949 /* Extract the difficulty */
952 /* Always have a small chance of success */
955 /* Success -- May still have traps */
956 if (randint0(100) < j)
959 msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
961 msg_print("You have picked the lock.");
968 /* Failure -- Keep trying */
971 /* We may continue repeating */
973 if (flush_failure) flush();
975 msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
977 msg_print("You failed to pick the lock.");
983 /* Allowed to open */
986 /* Apply chest traps, if any */
987 chest_trap(y, x, o_idx);
989 /* Let the Chest drop items */
990 chest_death(FALSE, y, x, o_idx);
998 #if defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) /* TNB */
1001 * @brief ÃÏ·Á¤Ï³«¤¯¤â¤Î¤Ç¤¢¤Ã¤Æ¡¢¤«¤Ä³«¤«¤ì¤Æ¤¤¤ë¤«¤òÊÖ¤¹ /
1002 * Attempt to open the given chest at the given location
1003 * @param feat ÃÏ·ÁID
1004 * @return ³«¤¤¤¿ÃÏ·Á¤Ç¤¢¤ë¾ì¹çTRUE¤òÊÖ¤¹ / Return TRUE if the given feature is an open door
1006 static bool is_open(int feat)
1008 return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
1013 * @brief ¥×¥ì¥¤¥ä¡¼¤Î¼þÊÕ9¥Þ¥¹¤Ë³ºÅö¤¹¤ëÃÏ·Á¤¬¤¤¤¯¤Ä¤¢¤ë¤«¤òÊÖ¤¹ /
1014 * Attempt to open the given chest at the given location
1015 * @param y ³ºÅö¤¹¤ëÃÏ·Á¤ÎÃ椫¤é1¤Ä¤ÎYºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1016 * @param x ³ºÅö¤¹¤ëÃÏ·Á¤ÎÃ椫¤é1¤Ä¤ÎXºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1017 * @param test ÃÏ·Á¾ò·ï¤òȽÄꤹ¤ë¤¿¤á¤Î´Ø¿ô¥Ý¥¤¥ó¥¿
1018 * @param under TRUE¤Ê¤é¤Ð¥×¥ì¥¤¥ä¡¼¤Îľ²¼¤ÎºÂɸ¤âÁöººÂоݤˤ¹¤ë
1019 * @return ³ºÅö¤¹¤ëÃÏ·Á¤Î¿ô
1020 * @details Return the number of features around (or under) the character.
1021 * Usually look for doors and floor traps.
1023 static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
1025 int d, count, xx, yy;
1027 /* Count how many matches */
1030 /* Check around (and under) the character */
1031 for (d = 0; d < 9; d++)
1036 /* if not searching under player continue */
1037 if ((d == 8) && !under) continue;
1039 /* Extract adjacent (legal) location */
1040 yy = py + ddy_ddd[d];
1041 xx = px + ddx_ddd[d];
1044 c_ptr = &cave[yy][xx];
1046 /* Must have knowledge */
1047 if (!(c_ptr->info & (CAVE_MARK))) continue;
1049 /* Feature code (applying "mimic" field) */
1050 feat = get_feat_mimic(c_ptr);
1052 /* Not looking for this feature */
1053 if (!((*test)(feat))) continue;
1058 /* Remember the location. Only useful if only one match */
1069 * @brief ¥×¥ì¥¤¥ä¡¼¤Î¼þÊÕ9¥Þ¥¹¤ËÈ¢¤Î¤¢¤ë¥Þ¥¹¤¬¤¤¤¯¤Ä¤¢¤ë¤«¤òÊÖ¤¹ /
1070 * Return the number of chests around (or under) the character.
1071 * @param y ³ºÅö¤¹¤ë¥Þ¥¹¤ÎÃ椫¤é1¤Ä¤ÎYºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1072 * @param x ³ºÅö¤¹¤ë¥Þ¥¹¤ÎÃ椫¤é1¤Ä¤ÎXºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1073 * @param trapped TRUE¤Ê¤é¤Ð¥È¥é¥Ã¥×¤Î¸ºß¤¬È½ÌÀ¤·¤Æ¤¤¤ëÈ¢¤Î¤ßÂоݤˤ¹¤ë
1074 * @return ³ºÅö¤¹¤ëÃÏ·Á¤Î¿ô
1076 * If requested, count only trapped chests.
1078 static int count_chests(int *y, int *x, bool trapped)
1080 int d, count, o_idx;
1084 /* Count how many matches */
1087 /* Check around (and under) the character */
1088 for (d = 0; d < 9; d++)
1090 /* Extract adjacent (legal) location */
1091 int yy = py + ddy_ddd[d];
1092 int xx = px + ddx_ddd[d];
1094 /* No (visible) chest is there */
1095 if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
1097 /* Grab the object */
1098 o_ptr = &o_list[o_idx];
1101 if (o_ptr->pval == 0) continue;
1103 /* No (known) traps here */
1104 if (trapped && (!object_is_known(o_ptr) ||
1105 !chest_traps[o_ptr->pval])) continue;
1110 /* Remember the location. Only useful if only one match */
1121 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é»ØÄê¤ÎºÂɸ¤¬¤É¤ÎÊý³Ñ¤Ë¤¢¤ë¤«¤òÊÖ¤¹ /
1122 * Convert an adjacent location to a direction.
1123 * @param y Êý³Ñ¤ò³Îǧ¤·¤¿YºÂɸ
1124 * @param x Êý³Ñ¤ò³Îǧ¤·¤¿XºÂɸ
1127 static int coords_to_dir(int y, int x)
1129 int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
1136 if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
1138 return d[dx + 1][dy + 1];
1141 #endif /* defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) -- TNB */
1145 * @brief ¡Ö³«¤±¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
1146 * Perform the basic "open" command on doors
1147 * @param y Âоݤò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
1148 * @param x Âоݤò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
1149 * @return ¼ÂºÝ¤Ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1151 * Assume destination is a closed/locked/jammed door
1152 * Assume there is no monster blocking the destination
1153 * Returns TRUE if repeated commands may continue
1155 static bool do_cmd_open_aux(int y, int x)
1159 /* Get requested grid */
1160 cave_type *c_ptr = &cave[y][x];
1162 feature_type *f_ptr = &f_info[c_ptr->feat];
1170 /* Seeing true feature code (ignore mimic) */
1173 if (!have_flag(f_ptr->flags, FF_OPEN))
1177 msg_format("%s¤Ï¤¬¤Ã¤Á¤ê¤ÈÊĤ¸¤é¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
1179 msg_format("The %s appears to be stuck.", f_name + f_info[get_feat_mimic(c_ptr)].name);
1185 else if (f_ptr->power)
1188 i = p_ptr->skill_dis;
1190 /* Penalize some conditions */
1191 if (p_ptr->blind || no_lite()) i = i / 10;
1192 if (p_ptr->confused || p_ptr->image) i = i / 10;
1194 /* Extract the lock power */
1197 /* Extract the difficulty XXX XXX XXX */
1200 /* Always have a small chance of success */
1204 if (randint0(100) < j)
1208 msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
1210 msg_print("You have picked the lock.");
1214 cave_alter_feat(y, x, FF_OPEN);
1217 sound(SOUND_OPENDOOR);
1227 if (flush_failure) flush();
1231 msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
1233 msg_print("You failed to pick the lock.");
1237 /* We may keep trying */
1246 cave_alter_feat(y, x, FF_OPEN);
1249 sound(SOUND_OPENDOOR);
1257 * @brief ¡Ö³«¤±¤ë¡×¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1258 * Open a closed/locked/jammed door or a closed/locked chest.
1261 * Unlocking a locked door/chest is worth one experience point.
1263 void do_cmd_open(void)
1271 if (p_ptr->special_defense & KATA_MUSOU)
1273 set_action(ACTION_NONE);
1276 #ifdef ALLOW_EASY_OPEN /* TNB */
1278 /* Option: Pick a direction */
1281 int num_doors, num_chests;
1283 /* Count closed doors (locked or jammed) */
1284 num_doors = count_dt(&y, &x, is_closed_door, FALSE);
1286 /* Count chests (locked) */
1287 num_chests = count_chests(&y, &x, FALSE);
1289 /* See if only one target */
1290 if (num_doors || num_chests)
1292 bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
1294 if (!too_many) command_dir = coords_to_dir(y, x);
1298 #endif /* ALLOW_EASY_OPEN -- TNB */
1300 /* Allow repeated command */
1303 /* Set repeat count */
1304 command_rep = command_arg - 1;
1306 /* Redraw the state */
1307 p_ptr->redraw |= (PR_STATE);
1309 /* Cancel the arg */
1313 /* Get a "repeated" direction */
1314 if (get_rep_dir(&dir, TRUE))
1319 /* Get requested location */
1323 /* Get requested grid */
1324 c_ptr = &cave[y][x];
1326 /* Feature code (applying "mimic" field) */
1327 feat = get_feat_mimic(c_ptr);
1329 /* Check for chest */
1330 o_idx = chest_check(y, x, FALSE);
1332 /* Nothing useful */
1333 if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
1337 msg_print("¤½¤³¤Ë¤Ï³«¤±¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
1339 msg_print("You see nothing there to open.");
1344 /* Monster in the way */
1345 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
1352 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
1354 msg_print("There is a monster in the way!");
1365 /* Open the chest */
1366 more = do_cmd_open_chest(y, x, o_idx);
1373 more = do_cmd_open_aux(y, x);
1377 /* Cancel repeat unless we may continue */
1378 if (!more) disturb(0, 0);
1384 * @brief ¡ÖÊĤ¸¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
1385 * Perform the basic "close" command
1386 * @param y Âоݤò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
1387 * @param x Âоݤò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
1388 * @return ¼ÂºÝ¤Ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1390 * Assume destination is an open/broken door
1391 * Assume there is no monster blocking the destination
1392 * Returns TRUE if repeated commands may continue
1394 static bool do_cmd_close_aux(int y, int x)
1396 /* Get grid and contents */
1397 cave_type *c_ptr = &cave[y][x];
1398 s16b old_feat = c_ptr->feat;
1404 /* Seeing true feature code (ignore mimic) */
1407 if (have_flag(f_info[old_feat].flags, FF_CLOSE))
1409 s16b closed_feat = feat_state(old_feat, FF_CLOSE);
1411 /* Hack -- object in the way */
1412 if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
1413 (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
1417 msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤ÆÊĤޤé¤Ê¤¤¡£");
1419 msg_print("There seems stuck.");
1424 /* Close the door */
1425 cave_alter_feat(y, x, FF_CLOSE);
1428 if (old_feat == c_ptr->feat)
1432 msg_print("¥É¥¢¤Ï²õ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
1434 msg_print("The door appears to be broken.");
1440 sound(SOUND_SHUTDOOR);
1451 * @brief ¡ÖÊĤ¸¤ë¡×¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1452 * Close an open door.
1455 * Unlocking a locked door/chest is worth one experience point.
1457 void do_cmd_close(void)
1463 if (p_ptr->special_defense & KATA_MUSOU)
1465 set_action(ACTION_NONE);
1468 #ifdef ALLOW_EASY_OPEN /* TNB */
1470 /* Option: Pick a direction */
1473 /* Count open doors */
1474 if (count_dt(&y, &x, is_open, FALSE) == 1)
1476 command_dir = coords_to_dir(y, x);
1480 #endif /* ALLOW_EASY_OPEN -- TNB */
1482 /* Allow repeated command */
1485 /* Set repeat count */
1486 command_rep = command_arg - 1;
1488 /* Redraw the state */
1489 p_ptr->redraw |= (PR_STATE);
1491 /* Cancel the arg */
1495 /* Get a "repeated" direction */
1496 if (get_rep_dir(&dir,FALSE))
1501 /* Get requested location */
1505 /* Get grid and contents */
1506 c_ptr = &cave[y][x];
1508 /* Feature code (applying "mimic" field) */
1509 feat = get_feat_mimic(c_ptr);
1511 /* Require open/broken door */
1512 if (!have_flag(f_info[feat].flags, FF_CLOSE))
1516 msg_print("¤½¤³¤Ë¤ÏÊĤ¸¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
1518 msg_print("You see nothing there to close.");
1522 /* Monster in the way */
1523 else if (c_ptr->m_idx)
1530 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
1532 msg_print("There is a monster in the way!");
1539 /* Close the door */
1542 /* Close the door */
1543 more = do_cmd_close_aux(y, x);
1547 /* Cancel repeat unless we may continue */
1548 if (!more) disturb(0, 0);
1553 * @brief ¡Ö·¡¤ë¡×¥³¥Þ¥ó¥É¤ò³ºÅö¤Î¥Þ¥¹¤Ë¹Ô¤¨¤ë¤«¤ÎȽÄê¤È·ë²Ì¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨ /
1554 * Determine if a given grid may be "tunneled"
1555 * @param y Âоݤò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
1556 * @param x Âоݤò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
1559 static bool do_cmd_tunnel_test(int y, int x)
1561 cave_type *c_ptr = &cave[y][x];
1563 /* Must have knowledge */
1564 if (!(c_ptr->info & CAVE_MARK))
1568 msg_print("¤½¤³¤Ë¤Ï²¿¤â¸«Åö¤¿¤é¤Ê¤¤¡£");
1570 msg_print("You see nothing there.");
1577 /* Must be a wall/door/etc */
1578 if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
1582 msg_print("¤½¤³¤Ë¤Ï·¡¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
1584 msg_print("You see nothing there to tunnel.");
1597 * @brief ¡Ö·¡¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
1598 * Perform the basic "tunnel" command
1599 * @param y Âоݤò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
1600 * @param x Âоݤò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
1601 * @return ¼ÂºÝ¤Ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1603 * Assumes that no monster is blocking the destination
1604 * Do not use twall anymore
1605 * Returns TRUE if repeated commands may continue
1607 static bool do_cmd_tunnel_aux(int y, int x)
1610 feature_type *f_ptr, *mimic_f_ptr;
1615 /* Verify legality */
1616 if (!do_cmd_tunnel_test(y, x)) return (FALSE);
1622 c_ptr = &cave[y][x];
1623 f_ptr = &f_info[c_ptr->feat];
1624 power = f_ptr->power;
1626 /* Feature code (applying "mimic" field) */
1627 mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
1629 name = f_name + mimic_f_ptr->name;
1634 if (have_flag(f_ptr->flags, FF_PERMANENT))
1637 if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
1640 msg_print("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£");
1642 msg_print("This seems to be permanent rock.");
1646 /* Map border (mimiccing Permanent wall) */
1650 msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
1652 msg_print("You can't tunnel through that!");
1658 else if (have_flag(f_ptr->flags, FF_CAN_DIG))
1661 if (p_ptr->skill_dig > randint0(20 * power))
1665 msg_format("%s¤ò¤¯¤º¤·¤¿¡£", name);
1667 msg_format("You have removed the %s.", name);
1670 /* Remove the feature */
1671 cave_alter_feat(y, x, FF_TUNNEL);
1673 /* Update some things */
1674 p_ptr->update |= (PU_FLOW);
1678 /* Message, keep digging */
1680 msg_format("%s¤ò¤¯¤º¤·¤Æ¤¤¤ë¡£", name);
1682 msg_format("You dig into the %s.", name);
1691 bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
1694 if (p_ptr->skill_dig > power + randint0(40 * power))
1697 if (tree) msg_format("%s¤òÀÚ¤êʧ¤Ã¤¿¡£", name);
1700 msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
1701 p_ptr->update |= (PU_FLOW);
1704 if (tree) msg_format("You have cleared away the %s.", name);
1707 msg_print("You have finished the tunnel.");
1708 p_ptr->update |= (PU_FLOW);
1713 if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
1715 /* Remove the feature */
1716 cave_alter_feat(y, x, FF_TUNNEL);
1718 chg_virtue(V_DILIGENCE, 1);
1719 chg_virtue(V_NATURE, -1);
1727 /* We may continue chopping */
1729 msg_format("%s¤òÀڤäƤ¤¤ë¡£", name);
1731 msg_format("You chop away at the %s.", name);
1733 /* Occasional Search XXX XXX */
1734 if (randint0(100) < 25) search();
1738 /* We may continue tunelling */
1740 msg_format("%s¤Ë·ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£", name);
1742 msg_format("You tunnel into the %s.", name);
1750 if (is_hidden_door(c_ptr))
1752 /* Occasional Search XXX XXX */
1753 if (randint0(100) < 25) search();
1762 * @brief ¡Ö·¡¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1763 * Tunnels through "walls" (including rubble and closed doors)
1767 * Note that you must tunnel in order to hit invisible monsters
1768 * in walls, though moving into walls still takes a turn anyway.
1770 * Digging is very difficult without a "digger" weapon, but can be
1771 * accomplished by strong players using heavy weapons.
1774 void do_cmd_tunnel(void)
1784 if (p_ptr->special_defense & KATA_MUSOU)
1786 set_action(ACTION_NONE);
1789 /* Allow repeated command */
1792 /* Set repeat count */
1793 command_rep = command_arg - 1;
1795 /* Redraw the state */
1796 p_ptr->redraw |= (PR_STATE);
1798 /* Cancel the arg */
1802 /* Get a direction to tunnel, or Abort */
1803 if (get_rep_dir(&dir,FALSE))
1810 c_ptr = &cave[y][x];
1812 /* Feature code (applying "mimic" field) */
1813 feat = get_feat_mimic(c_ptr);
1815 /* No tunnelling through doors */
1816 if (have_flag(f_info[feat].flags, FF_DOOR))
1820 msg_print("¥É¥¢¤Ï·¡¤ì¤Ê¤¤¡£");
1822 msg_print("You cannot tunnel through doors.");
1826 /* No tunnelling through most features */
1827 else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
1830 msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£");
1832 msg_print("You can't tunnel through that.");
1836 /* A monster is in the way */
1837 else if (c_ptr->m_idx)
1844 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
1846 msg_print("There is a monster in the way!");
1856 /* Tunnel through walls */
1857 more = do_cmd_tunnel_aux(y, x);
1861 /* Cancel repetition unless we can continue */
1862 if (!more) disturb(0, 0);
1866 #ifdef ALLOW_EASY_OPEN /* TNB */
1869 * @brief °ÜÆ°½èÍý¤Ë¤è¤ë´Ê°×¤Ê¡Ö³«¤¯¡×½èÍý /
1871 * @return ³«¤¯½èÍý¤¬¼ÂºÝ¤Ë»î¤ß¤é¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
1874 * If there is a jammed/closed/locked door at the given location,
1875 * then attempt to unlock/open it. Return TRUE if an attempt was
1876 * made (successful or not), otherwise return FALSE.
1878 * The code here should be nearly identical to that in
1879 * do_cmd_open_test() and do_cmd_open_aux().
1882 bool easy_open_door(int y, int x)
1886 cave_type *c_ptr = &cave[y][x];
1887 feature_type *f_ptr = &f_info[c_ptr->feat];
1889 /* Must be a closed door */
1890 if (!is_closed_door(c_ptr->feat))
1897 if (!have_flag(f_ptr->flags, FF_OPEN))
1901 msg_format("%s¤Ï¤¬¤Ã¤Á¤ê¤ÈÊĤ¸¤é¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
1903 msg_format("The %s appears to be stuck.", f_name + f_info[get_feat_mimic(c_ptr)].name);
1909 else if (f_ptr->power)
1912 i = p_ptr->skill_dis;
1914 /* Penalize some conditions */
1915 if (p_ptr->blind || no_lite()) i = i / 10;
1916 if (p_ptr->confused || p_ptr->image) i = i / 10;
1918 /* Extract the lock power */
1921 /* Extract the difficulty XXX XXX XXX */
1924 /* Always have a small chance of success */
1928 if (randint0(100) < j)
1932 msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
1934 msg_print("You have picked the lock.");
1938 cave_alter_feat(y, x, FF_OPEN);
1941 sound(SOUND_OPENDOOR);
1951 if (flush_failure) flush();
1955 msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
1957 msg_print("You failed to pick the lock.");
1967 cave_alter_feat(y, x, FF_OPEN);
1970 sound(SOUND_OPENDOOR);
1977 #endif /* ALLOW_EASY_OPEN -- TNB */
1981 * @brief È¢¤Î¥È¥é¥Ã¥×¤ò²ò½ü¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1982 * Perform the basic "disarm" command
1983 * @param y ²ò½ü¤ò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
1984 * @param x ²ò½ü¤ò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
1985 * @param o_idx È¢¤Î¥ª¥Ö¥¸¥§¥¯¥ÈID
1986 * @return ¥¿¡¼¥ó¤ò¾ÃÈñ¤¹¤ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
1989 * Assume destination is a visible trap
1990 * Assume there is no monster blocking the destination
1991 * Returns TRUE if repeated commands may continue
1994 static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
2000 object_type *o_ptr = &o_list[o_idx];
2006 /* Get the "disarm" factor */
2007 i = p_ptr->skill_dis;
2009 /* Penalize some conditions */
2010 if (p_ptr->blind || no_lite()) i = i / 10;
2011 if (p_ptr->confused || p_ptr->image) i = i / 10;
2013 /* Extract the difficulty */
2014 j = i - o_ptr->pval;
2016 /* Always have a small chance of success */
2019 /* Must find the trap first. */
2020 if (!object_is_known(o_ptr))
2023 msg_print("¥È¥é¥Ã¥×¤¬¸«¤¢¤¿¤é¤Ê¤¤¡£");
2025 msg_print("I don't see any traps.");
2030 /* Already disarmed/unlocked */
2031 else if (o_ptr->pval <= 0)
2034 msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£");
2036 msg_print("The chest is not trapped.");
2041 /* No traps to find. */
2042 else if (!chest_traps[o_ptr->pval])
2045 msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£");
2047 msg_print("The chest is not trapped.");
2052 /* Success (get a lot of experience) */
2053 else if (randint0(100) < j)
2056 msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¥È¥é¥Ã¥×¤ò²ò½ü¤·¤¿¡£");
2058 msg_print("You have disarmed the chest.");
2061 gain_exp(o_ptr->pval);
2062 o_ptr->pval = (0 - o_ptr->pval);
2065 /* Failure -- Keep trying */
2066 else if ((i > 5) && (randint1(i) > 5))
2068 /* We may keep trying */
2070 if (flush_failure) flush();
2072 msg_print("È¢¤Î¥È¥é¥Ã¥×²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£");
2074 msg_print("You failed to disarm the chest.");
2079 /* Failure -- Set off the trap */
2083 msg_print("¥È¥é¥Ã¥×¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª");
2085 msg_print("You set off a trap!");
2089 chest_trap(y, x, o_idx);
2098 * @brief È¢¤Î¥È¥é¥Ã¥×¤ò²ò½ü¤¹¤ë¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
2099 * Perform the basic "disarm" command
2100 * @param y ²ò½ü¤ò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
2101 * @param x ²ò½ü¤ò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
2102 * @param dir ¥×¥ì¥¤¥ä¡¼¤«¤é¤ß¤¿Êý¸þID
2103 * @return ¥¿¡¼¥ó¤ò¾ÃÈñ¤¹¤ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
2106 * Assume destination is a visible trap
2107 * Assume there is no monster blocking the destination
2108 * Returns TRUE if repeated commands may continue
2111 #ifdef ALLOW_EASY_DISARM /* TNB */
2113 bool do_cmd_disarm_aux(int y, int x, int dir)
2115 #else /* ALLOW_EASY_DISARM -- TNB */
2117 static bool do_cmd_disarm_aux(int y, int x, int dir)
2119 #endif /* ALLOW_EASY_DISARM -- TNB */
2121 /* Get grid and contents */
2122 cave_type *c_ptr = &cave[y][x];
2125 feature_type *f_ptr = &f_info[c_ptr->feat];
2127 /* Access trap name */
2128 cptr name = (f_name + f_ptr->name);
2130 /* Extract trap "power" */
2131 int power = f_ptr->power;
2135 /* Get the "disarm" factor */
2136 int i = p_ptr->skill_dis;
2143 /* Penalize some conditions */
2144 if (p_ptr->blind || no_lite()) i = i / 10;
2145 if (p_ptr->confused || p_ptr->image) i = i / 10;
2147 /* Extract the difficulty */
2150 /* Always have a small chance of success */
2154 if (randint0(100) < j)
2158 msg_format("%s¤ò²ò½ü¤·¤¿¡£", name);
2160 msg_format("You have disarmed the %s.", name);
2166 /* Remove the trap */
2167 cave_alter_feat(y, x, FF_DISARM);
2169 #ifdef ALLOW_EASY_DISARM /* TNB */
2171 /* Move the player onto the trap */
2172 move_player(dir, easy_disarm, FALSE);
2174 #else /* ALLOW_EASY_DISARM -- TNB */
2176 /* move the player onto the trap grid */
2177 move_player(dir, FALSE, FALSE);
2179 #endif /* ALLOW_EASY_DISARM -- TNB */
2182 /* Failure -- Keep trying */
2183 else if ((i > 5) && (randint1(i) > 5))
2186 if (flush_failure) flush();
2190 msg_format("%s¤Î²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£", name);
2192 msg_format("You failed to disarm the %s.", name);
2195 /* We may keep trying */
2199 /* Failure -- Set off the trap */
2204 msg_format("%s¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª", name);
2206 msg_format("You set off the %s!", name);
2209 #ifdef ALLOW_EASY_DISARM /* TNB */
2211 /* Move the player onto the trap */
2212 move_player(dir, easy_disarm, FALSE);
2214 #else /* ALLOW_EASY_DISARM -- TNB */
2216 /* Move the player onto the trap */
2217 move_player(dir, FALSE, FALSE);
2219 #endif /* ALLOW_EASY_DISARM -- TNB */
2228 * @brief È¢¡¢¾²¤Î¥È¥é¥Ã¥×²ò½ü½èÍýÁÐÊý¤ÎÅý¹ç¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2229 * Disarms a trap, or chest
2232 void do_cmd_disarm(void)
2240 if (p_ptr->special_defense & KATA_MUSOU)
2242 set_action(ACTION_NONE);
2245 #ifdef ALLOW_EASY_DISARM /* TNB */
2247 /* Option: Pick a direction */
2250 int num_traps, num_chests;
2252 /* Count visible traps */
2253 num_traps = count_dt(&y, &x, is_trap, TRUE);
2255 /* Count chests (trapped) */
2256 num_chests = count_chests(&y, &x, TRUE);
2258 /* See if only one target */
2259 if (num_traps || num_chests)
2261 bool too_many = (num_traps && num_chests) || (num_traps > 1) ||
2263 if (!too_many) command_dir = coords_to_dir(y, x);
2267 #endif /* ALLOW_EASY_DISARM -- TNB */
2269 /* Allow repeated command */
2272 /* Set repeat count */
2273 command_rep = command_arg - 1;
2275 /* Redraw the state */
2276 p_ptr->redraw |= (PR_STATE);
2278 /* Cancel the arg */
2282 /* Get a direction (or abort) */
2283 if (get_rep_dir(&dir,TRUE))
2292 /* Get grid and contents */
2293 c_ptr = &cave[y][x];
2295 /* Feature code (applying "mimic" field) */
2296 feat = get_feat_mimic(c_ptr);
2298 /* Check for chests */
2299 o_idx = chest_check(y, x, TRUE);
2302 if (!is_trap(feat) && !o_idx)
2306 msg_print("¤½¤³¤Ë¤Ï²ò½ü¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
2308 msg_print("You see nothing there to disarm.");
2313 /* Monster in the way */
2314 else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
2318 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
2320 msg_print("There is a monster in the way!");
2331 /* Disarm the chest */
2332 more = do_cmd_disarm_chest(y, x, o_idx);
2338 /* Disarm the trap */
2339 more = do_cmd_disarm_aux(y, x, dir);
2343 /* Cancel repeat unless told not to */
2344 if (!more) disturb(0, 0);
2349 * @brief ¡ÖÂǤÁÇˤë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
2350 * Perform the basic "bash" command
2351 * @param y Âоݤò¹Ô¤¦¥Þ¥¹¤ÎYºÂɸ
2352 * @param x Âоݤò¹Ô¤¦¥Þ¥¹¤ÎXºÂɸ
2353 * @param dir ¥×¥ì¥¤¥ä¡¼¤«¤é¸«¤¿¥¿¡¼¥²¥Ã¥È¤ÎÊý³ÑID
2354 * @return ¼ÂºÝ¤Ë½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2357 * Assume destination is a closed/locked/jammed door
2358 * Assume there is no monster blocking the destination
2359 * Returns TRUE if repeated commands may continue
2362 static bool do_cmd_bash_aux(int y, int x, int dir)
2365 cave_type *c_ptr = &cave[y][x];
2368 feature_type *f_ptr = &f_info[c_ptr->feat];
2370 /* Hack -- Bash power based on strength */
2371 /* (Ranges from 3 to 20 to 100 to 200) */
2372 int bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
2374 /* Extract door power */
2375 int temp = f_ptr->power;
2379 cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
2386 msg_format("%s¤ËÂÎÅö¤¿¤ê¤ò¤·¤¿¡ª", name);
2388 msg_format("You smash into the %s!", name);
2391 /* Compare bash power to door power XXX XXX XXX */
2392 temp = (bash - (temp * 10));
2394 if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
2396 /* Hack -- always have a chance */
2397 if (temp < 1) temp = 1;
2399 /* Hack -- attempt to bash down the door */
2400 if (randint0(100) < temp)
2404 msg_format("%s¤ò²õ¤·¤¿¡ª", name);
2406 msg_format("The %s crashes open!", name);
2410 sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
2412 /* Break down the door */
2413 if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
2415 cave_alter_feat(y, x, FF_BASH);
2421 cave_alter_feat(y, x, FF_OPEN);
2424 /* Hack -- Fall through the door */
2425 move_player(dir, FALSE, FALSE);
2428 /* Saving throw against stun */
2429 else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
2434 msg_format("¤³¤Î%s¤Ï´è¾æ¤À¡£", name);
2436 msg_format("The %s holds firm.", name);
2440 /* Allow repeated bashing */
2444 /* High dexterity yields coolness */
2449 msg_print("ÂΤΥХé¥ó¥¹¤ò¤¯¤º¤·¤Æ¤·¤Þ¤Ã¤¿¡£");
2451 msg_print("You are off-balance.");
2455 /* Hack -- Lose balance ala paralysis */
2456 (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
2465 * @brief ¡ÖÂǤÁÇˤë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2466 * Bash open a door, success based on character strength
2470 * For a closed door, pval is positive if locked; negative if stuck.
2472 * For an open door, pval is positive for a broken door.
2474 * A closed door can be opened - harder if locked. Any door might be
2475 * bashed open (and thereby broken). Bashing a door is (potentially)
2476 * faster! You move into the door way. To open a stuck door, it must
2477 * be bashed. A closed door can be jammed (see do_cmd_spike()).
2479 * Creatures can also open or bash doors, see elsewhere.
2482 void do_cmd_bash(void)
2491 if (p_ptr->special_defense & KATA_MUSOU)
2493 set_action(ACTION_NONE);
2496 /* Allow repeated command */
2499 /* Set repeat count */
2500 command_rep = command_arg - 1;
2502 /* Redraw the state */
2503 p_ptr->redraw |= (PR_STATE);
2505 /* Cancel the arg */
2509 /* Get a "repeated" direction */
2510 if (get_rep_dir(&dir,FALSE))
2519 c_ptr = &cave[y][x];
2521 /* Feature code (applying "mimic" field) */
2522 feat = get_feat_mimic(c_ptr);
2524 /* Nothing useful */
2525 if (!have_flag(f_info[feat].flags, FF_BASH))
2529 msg_print("¤½¤³¤Ë¤ÏÂÎÅö¤¿¤ê¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
2531 msg_print("You see nothing there to bash.");
2536 /* Monster in the way */
2537 else if (c_ptr->m_idx)
2544 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
2546 msg_print("There is a monster in the way!");
2554 /* Bash a closed door */
2558 more = do_cmd_bash_aux(y, x, dir);
2562 /* Unless valid action taken, cancel bash */
2563 if (!more) disturb(0, 0);
2568 * @brief ÆÃÄê¤Î¥Þ¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¤¿¤á¤ÎÈÆÍÑŪ¥³¥Þ¥ó¥É
2572 * Manipulate an adjacent grid in some way
2574 * Attack monsters, tunnel through walls, disarm traps, open doors.
2576 * Consider confusion XXX XXX XXX
2578 * This command must always take a turn, to prevent free detection
2579 * of invisible monsters.
2582 void do_cmd_alter(void)
2591 if (p_ptr->special_defense & KATA_MUSOU)
2593 set_action(ACTION_NONE);
2596 /* Allow repeated command */
2599 /* Set repeat count */
2600 command_rep = command_arg - 1;
2602 /* Redraw the state */
2603 p_ptr->redraw |= (PR_STATE);
2605 /* Cancel the arg */
2609 /* Get a direction */
2610 if (get_rep_dir(&dir,TRUE))
2613 feature_type *f_ptr;
2620 c_ptr = &cave[y][x];
2622 /* Feature code (applying "mimic" field) */
2623 feat = get_feat_mimic(c_ptr);
2624 f_ptr = &f_info[feat];
2629 /* Attack monsters */
2637 else if (have_flag(f_ptr->flags, FF_OPEN))
2639 more = do_cmd_open_aux(y, x);
2642 /* Bash jammed doors */
2643 else if (have_flag(f_ptr->flags, FF_BASH))
2645 more = do_cmd_bash_aux(y, x, dir);
2648 /* Tunnel through walls */
2649 else if (have_flag(f_ptr->flags, FF_TUNNEL))
2651 more = do_cmd_tunnel_aux(y, x);
2654 /* Close open doors */
2655 else if (have_flag(f_ptr->flags, FF_CLOSE))
2657 more = do_cmd_close_aux(y, x);
2661 else if (have_flag(f_ptr->flags, FF_DISARM))
2663 more = do_cmd_disarm_aux(y, x, dir);
2671 msg_print("²¿¤â¤Ê¤¤¶õÃæ¤ò¹¶·â¤·¤¿¡£");
2673 msg_print("You attack the empty air.");
2679 /* Cancel repetition unless we can continue */
2680 if (!more) disturb(0, 0);
2686 * @brief ¡Ö¤¯¤µ¤Ó¤òÂǤġפ¿¤á¤ËɬÍפʥª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê¤òÊÖ¤¹ /
2687 * Find the index of some "spikes", if possible.
2688 * @param ip ¤¯¤µ¤Ó¤È¤·¤ÆÂǤƤ륪¥Ö¥¸¥§¥¯¥È¤ÎID
2689 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¾ì¹çTRUE¤òÊÖ¤¹
2692 * XXX XXX XXX Let user choose a pile of spikes, perhaps?
2695 static bool get_spike(int *ip)
2699 /* Check every item in the pack */
2700 for (i = 0; i < INVEN_PACK; i++)
2702 object_type *o_ptr = &inventory[i];
2704 /* Skip non-objects */
2705 if (!o_ptr->k_idx) continue;
2707 /* Check the "tval" code */
2708 if (o_ptr->tval == TV_SPIKE)
2710 /* Save the spike index */
2724 * @brief ¡Ö¤¯¤µ¤Ó¤òÂǤġ×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2725 * Jam a closed door with a spike
2729 * This command may NOT be repeated
2732 void do_cmd_spike(void)
2736 if (p_ptr->special_defense & KATA_MUSOU)
2738 set_action(ACTION_NONE);
2741 /* Get a "repeated" direction */
2742 if (get_rep_dir(&dir,FALSE))
2752 /* Get grid and contents */
2753 c_ptr = &cave[y][x];
2755 /* Feature code (applying "mimic" field) */
2756 feat = get_feat_mimic(c_ptr);
2758 /* Require closed door */
2759 if (!have_flag(f_info[feat].flags, FF_SPIKE))
2763 msg_print("¤½¤³¤Ë¤Ï¤¯¤µ¤Ó¤òÂǤƤë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
2765 msg_print("You see nothing there to spike.");
2771 else if (!get_spike(&item))
2775 msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡ª");
2777 msg_print("You have no spikes!");
2781 /* Is a monster in the way? */
2782 else if (c_ptr->m_idx)
2789 msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
2791 msg_print("There is a monster in the way!");
2804 /* Successful jamming */
2806 msg_format("%s¤Ë¤¯¤µ¤Ó¤òÂǤÁ¹þ¤ó¤À¡£", f_name + f_info[feat].name);
2808 msg_format("You jam the %s with a spike.", f_name + f_info[feat].name);
2811 cave_alter_feat(y, x, FF_SPIKE);
2813 /* Use up, and describe, a single spike, from the bottom */
2814 inven_item_increase(item, -1);
2815 inven_item_describe(item);
2816 inven_item_optimize(item);
2824 * @brief ¡ÖÊ⤯¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2825 * Support code for the "Walk" and "Jump" commands
2826 * @param pickup ¥¢¥¤¥Æ¥à¤Î¼«Æ°½¦¤¤¤ò¹Ô¤¦¤Ê¤éTRUE
2829 void do_cmd_walk(bool pickup)
2836 /* Allow repeated command */
2839 /* Set repeat count */
2840 command_rep = command_arg - 1;
2842 /* Redraw the state */
2843 p_ptr->redraw |= (PR_STATE);
2845 /* Cancel the arg */
2849 /* Get a "repeated" direction */
2850 if (get_rep_dir(&dir,FALSE))
2855 if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
2857 set_action(ACTION_NONE);
2860 /* Hack -- In small scale wilderness it takes MUCH more time to move */
2861 if (p_ptr->wild_mode) energy_use *= ((MAX_HGT + MAX_WID) / 2);
2862 if (p_ptr->action == ACTION_HAYAGAKE) energy_use = energy_use * (45-(p_ptr->lev/2)) / 100;
2864 /* Actually move the character */
2865 move_player(dir, pickup, FALSE);
2867 /* Allow more walking */
2871 /* Hack again -- Is there a special encounter ??? */
2872 if (p_ptr->wild_mode && !cave_have_flag_bold(py, px, FF_TOWN))
2874 int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
2877 if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
2879 /* Inform the player of his horrible fate :=) */
2881 msg_print("½±·â¤À¡ª");
2883 msg_print("You are ambushed !");
2886 /* Go into large wilderness view */
2887 p_ptr->oldpy = randint1(MAX_HGT-2);
2888 p_ptr->oldpx = randint1(MAX_WID-2);
2891 /* Give first move to monsters */
2894 /* HACk -- set the encouter flag for the wilderness generation */
2895 generate_encounter = TRUE;
2899 /* Cancel repeat unless we may continue */
2900 if (!more) disturb(0, 0);
2905 * @brief ¡ÖÁö¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2909 void do_cmd_run(void)
2913 /* Hack -- no running when confused */
2914 if (p_ptr->confused)
2917 msg_print("º®Í𤷤Ƥ¤¤ÆÁö¤ì¤Ê¤¤¡ª");
2919 msg_print("You are too confused!");
2925 if (p_ptr->special_defense & KATA_MUSOU)
2927 set_action(ACTION_NONE);
2930 /* Get a "repeated" direction */
2931 if (get_rep_dir(&dir,FALSE))
2933 /* Hack -- Set the run counter */
2934 running = (command_arg ? command_arg : 1000);
2943 * @brief ¡Öα¤Þ¤ë¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2944 * Stay still. Search. Enter stores.
2945 * Pick up treasure if "pickup" is true.
2946 * @param pickup ¥¢¥¤¥Æ¥à¤Î¼«Æ°½¦¤¤¤ò¹Ô¤¦¤Ê¤éTRUE
2949 void do_cmd_stay(bool pickup)
2951 u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
2953 /* Allow repeated command */
2956 /* Set repeat count */
2957 command_rep = command_arg - 1;
2959 /* Redraw the state */
2960 p_ptr->redraw |= (PR_STATE);
2962 /* Cancel the arg */
2969 if (pickup) mpe_mode |= MPE_DO_PICKUP;
2970 (void)move_player_effect(py, px, mpe_mode);
2975 * @brief ¡ÖµÙ¤à¡×Æ°ºî¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2976 * Resting allows a player to safely restore his hp -RAK-
2979 void do_cmd_rest(void)
2982 set_action(ACTION_NONE);
2984 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] || p_ptr->magic_num1[1]))
2990 if (hex_spelling_any()) stop_hex_spell_all();
2992 /* Prompt for time if needed */
2993 if (command_arg <= 0)
2996 cptr p = "µÙ·Æ (0-9999, '*' ¤Ç HP/MPÁ´²÷, '&' ¤ÇɬÍפʤÀ¤±): ";
2998 cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): ";
3005 strcpy(out_val, "&");
3007 /* Ask for duration */
3008 if (!get_string(p, out_val, 4)) return;
3010 /* Rest until done */
3011 if (out_val[0] == '&')
3017 else if (out_val[0] == '*')
3025 command_arg = atoi(out_val);
3026 if (command_arg <= 0) return;
3032 if (command_arg > 9999) command_arg = 9999;
3034 if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
3036 /* Take a turn XXX XXX XXX (?) */
3039 /* The sin of sloth */
3040 if (command_arg > 100)
3041 chg_virtue(V_DILIGENCE, -1);
3043 /* Why are you sleeping when there's no need? WAKE UP!*/
3044 if ((p_ptr->chp == p_ptr->mhp) &&
3045 (p_ptr->csp == p_ptr->msp) &&
3046 !p_ptr->blind && !p_ptr->confused &&
3047 !p_ptr->poisoned && !p_ptr->afraid &&
3048 !p_ptr->stun && !p_ptr->cut &&
3049 !p_ptr->slow && !p_ptr->paralyzed &&
3050 !p_ptr->image && !p_ptr->word_recall &&
3051 !p_ptr->alter_reality)
3052 chg_virtue(V_DILIGENCE, -1);
3054 /* Save the rest code */
3055 resting = command_arg;
3056 p_ptr->action = ACTION_REST;
3058 /* Recalculate bonuses */
3059 p_ptr->update |= (PU_BONUS);
3061 /* Redraw the state */
3062 p_ptr->redraw |= (PR_STATE);
3073 * @brief ÌðÃƤò¼Í·â¤·¤¿¾ì¹ç¤ÎÇË»³ÎΨ¤òÊÖ¤¹ /
3074 * Determines the odds of an object breaking when thrown at a monster
3075 * @param o_ptr ÌðÃƤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
3076 * @return ÇË»³ÎΨ(%)
3078 * Note that artifacts never break, see the "drop_near()" function.
3080 static int breakage_chance(object_type *o_ptr)
3082 int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0);
3084 /* Examine the snipe type */
3087 if (snipe_type == SP_KILL_WALL) return (100);
3088 if (snipe_type == SP_EXPLODE) return (100);
3089 if (snipe_type == SP_PIERCE) return (100);
3090 if (snipe_type == SP_FINAL) return (100);
3091 if (snipe_type == SP_NEEDLE) return (100);
3092 if (snipe_type == SP_EVILNESS) return (40);
3093 if (snipe_type == SP_HOLYNESS) return (40);
3096 /* Examine the item type */
3097 switch (o_ptr->tval)
3113 /* Sometimes break */
3118 return (20 - archer_bonus * 2);
3123 return (10 - archer_bonus);
3131 * @brief ÌðÃƤò¼Í·â¤·¤¿ºÝ¤Î¥¹¥ì¥¤ÇÜΨ¤ò¤«¤±¤¿·ë²Ì¤òÊÖ¤¹ /
3132 * Determines the odds of an object breaking when thrown at a monster
3133 * @param o_ptr ÌðÃƤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
3134 * @param tdam ·×»»ÅÓÃæ¤Î¥À¥á¡¼¥¸ÎÌ
3135 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
3136 * @return ¥¹¥ì¥¤ÇÜΨ¤ò¤«¤±¤¿¥À¥á¡¼¥¸ÎÌ
3138 static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
3142 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3144 u32b flgs[TR_FLAG_SIZE];
3146 /* Extract the flags */
3147 object_flags(o_ptr, flgs);
3149 /* Some "weapons" and "ammo" do extra damage */
3150 switch (o_ptr->tval)
3157 if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
3158 (r_ptr->flags3 & RF3_ANIMAL))
3160 if (is_original_ap_and_seen(m_ptr))
3162 r_ptr->r_flags3 |= RF3_ANIMAL;
3165 if (mult < 17) mult = 17;
3169 if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
3170 (r_ptr->flags3 & RF3_ANIMAL))
3172 if (is_original_ap_and_seen(m_ptr))
3174 r_ptr->r_flags3 |= RF3_ANIMAL;
3177 if (mult < 27) mult = 27;
3181 if ((have_flag(flgs, TR_SLAY_EVIL)) &&
3182 (r_ptr->flags3 & RF3_EVIL))
3184 if (is_original_ap_and_seen(m_ptr))
3186 r_ptr->r_flags3 |= RF3_EVIL;
3189 if (mult < 15) mult = 15;
3193 if ((have_flag(flgs, TR_KILL_EVIL)) &&
3194 (r_ptr->flags3 & RF3_EVIL))
3196 if (is_original_ap_and_seen(m_ptr))
3198 r_ptr->r_flags3 |= RF3_EVIL;
3201 if (mult < 25) mult = 25;
3205 if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
3206 (r_ptr->flags2 & RF2_HUMAN))
3208 if (is_original_ap_and_seen(m_ptr))
3210 r_ptr->r_flags2 |= RF2_HUMAN;
3213 if (mult < 17) mult = 17;
3217 if ((have_flag(flgs, TR_KILL_HUMAN)) &&
3218 (r_ptr->flags2 & RF2_HUMAN))
3220 if (is_original_ap_and_seen(m_ptr))
3222 r_ptr->r_flags2 |= RF2_HUMAN;
3225 if (mult < 27) mult = 27;
3229 if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
3230 (r_ptr->flags3 & RF3_UNDEAD))
3232 if (is_original_ap_and_seen(m_ptr))
3234 r_ptr->r_flags3 |= RF3_UNDEAD;
3237 if (mult < 20) mult = 20;
3241 if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
3242 (r_ptr->flags3 & RF3_UNDEAD))
3244 if (is_original_ap_and_seen(m_ptr))
3246 r_ptr->r_flags3 |= RF3_UNDEAD;
3249 if (mult < 30) mult = 30;
3253 if ((have_flag(flgs, TR_SLAY_DEMON)) &&
3254 (r_ptr->flags3 & RF3_DEMON))
3256 if (is_original_ap_and_seen(m_ptr))
3258 r_ptr->r_flags3 |= RF3_DEMON;
3261 if (mult < 20) mult = 20;
3265 if ((have_flag(flgs, TR_KILL_DEMON)) &&
3266 (r_ptr->flags3 & RF3_DEMON))
3268 if (is_original_ap_and_seen(m_ptr))
3270 r_ptr->r_flags3 |= RF3_DEMON;
3273 if (mult < 30) mult = 30;
3277 if ((have_flag(flgs, TR_SLAY_ORC)) &&
3278 (r_ptr->flags3 & RF3_ORC))
3280 if (is_original_ap_and_seen(m_ptr))
3282 r_ptr->r_flags3 |= RF3_ORC;
3285 if (mult < 20) mult = 20;
3289 if ((have_flag(flgs, TR_KILL_ORC)) &&
3290 (r_ptr->flags3 & RF3_ORC))
3292 if (is_original_ap_and_seen(m_ptr))
3294 r_ptr->r_flags3 |= RF3_ORC;
3297 if (mult < 30) mult = 30;
3301 if ((have_flag(flgs, TR_SLAY_TROLL)) &&
3302 (r_ptr->flags3 & RF3_TROLL))
3304 if (is_original_ap_and_seen(m_ptr))
3306 r_ptr->r_flags3 |= RF3_TROLL;
3309 if (mult < 20) mult = 20;
3313 if ((have_flag(flgs, TR_KILL_TROLL)) &&
3314 (r_ptr->flags3 & RF3_TROLL))
3316 if (is_original_ap_and_seen(m_ptr))
3318 r_ptr->r_flags3 |= RF3_TROLL;
3321 if (mult < 30) mult = 30;
3325 if ((have_flag(flgs, TR_SLAY_GIANT)) &&
3326 (r_ptr->flags3 & RF3_GIANT))
3328 if (is_original_ap_and_seen(m_ptr))
3330 r_ptr->r_flags3 |= RF3_GIANT;
3333 if (mult < 20) mult = 20;
3337 if ((have_flag(flgs, TR_KILL_GIANT)) &&
3338 (r_ptr->flags3 & RF3_GIANT))
3340 if (is_original_ap_and_seen(m_ptr))
3342 r_ptr->r_flags3 |= RF3_GIANT;
3345 if (mult < 30) mult = 30;
3349 if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
3350 (r_ptr->flags3 & RF3_DRAGON))
3352 if (is_original_ap_and_seen(m_ptr))
3354 r_ptr->r_flags3 |= RF3_DRAGON;
3357 if (mult < 20) mult = 20;
3360 /* Execute Dragon */
3361 if ((have_flag(flgs, TR_KILL_DRAGON)) &&
3362 (r_ptr->flags3 & RF3_DRAGON))
3364 if (is_original_ap_and_seen(m_ptr))
3366 r_ptr->r_flags3 |= RF3_DRAGON;
3369 if (mult < 30) mult = 30;
3371 if ((o_ptr->name1 == ART_BARD_ARROW) &&
3372 (m_ptr->r_idx == MON_SMAUG) &&
3373 (inventory[INVEN_BOW].name1 == ART_BARD))
3378 if (have_flag(flgs, TR_BRAND_ACID))
3380 /* Notice immunity */
3381 if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
3383 if (is_original_ap_and_seen(m_ptr))
3385 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
3389 /* Otherwise, take the damage */
3392 if (mult < 17) mult = 17;
3397 if (have_flag(flgs, TR_BRAND_ELEC))
3399 /* Notice immunity */
3400 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
3402 if (is_original_ap_and_seen(m_ptr))
3404 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
3408 /* Otherwise, take the damage */
3411 if (mult < 17) mult = 17;
3416 if (have_flag(flgs, TR_BRAND_FIRE))
3418 /* Notice immunity */
3419 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
3421 if (is_original_ap_and_seen(m_ptr))
3423 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
3427 /* Otherwise, take the damage */
3430 if (r_ptr->flags3 & RF3_HURT_FIRE)
3432 if (mult < 25) mult = 25;
3433 if (is_original_ap_and_seen(m_ptr))
3435 r_ptr->r_flags3 |= RF3_HURT_FIRE;
3438 else if (mult < 17) mult = 17;
3443 if (have_flag(flgs, TR_BRAND_COLD))
3445 /* Notice immunity */
3446 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
3448 if (is_original_ap_and_seen(m_ptr))
3450 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
3453 /* Otherwise, take the damage */
3456 if (r_ptr->flags3 & RF3_HURT_COLD)
3458 if (mult < 25) mult = 25;
3459 if (is_original_ap_and_seen(m_ptr))
3461 r_ptr->r_flags3 |= RF3_HURT_COLD;
3464 else if (mult < 17) mult = 17;
3468 /* Brand (Poison) */
3469 if (have_flag(flgs, TR_BRAND_POIS))
3471 /* Notice immunity */
3472 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
3474 if (is_original_ap_and_seen(m_ptr))
3476 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
3480 /* Otherwise, take the damage */
3483 if (mult < 17) mult = 17;
3487 if ((have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
3489 p_ptr->csp -= (1+(p_ptr->msp / 30));
3490 p_ptr->redraw |= (PR_MANA);
3491 mult = mult * 5 / 2;
3498 if (snipe_type) mult = tot_dam_aux_snipe(mult, m_ptr);
3500 /* Return the total damage */
3501 return (tdam * mult / 10);
3506 * @brief ¼Í·â½èÍý¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
3507 * Fire an object from the pack or floor.
3508 * @param item ¼Í·â¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê»ýID
3509 * @param j_ptr ¼Í·âÉð´ï¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È¥Ý¥¤¥ó¥¿
3513 * You may only fire items that "match" your missile launcher.
3515 * You must use slings + pebbles/shots, bows + arrows, xbows + bolts.
3517 * See "calc_bonuses()" for more calculations and such.
3519 * Note that "firing" a missile is MUCH better than "throwing" it.
3521 * Note: "unseen" monsters are very hard to hit.
3523 * Objects are more likely to break if they "attempt" to hit a monster.
3525 * Rangers (with Bows) and Anyone (with "Extra Shots") get extra shots.
3527 * The "extra shot" code works by decreasing the amount of energy
3528 * required to make each shot, spreading the shots out over time.
3530 * Note that when firing missiles, the launcher multiplier is applied
3531 * after all the bonuses are added in, making multipliers very useful.
3533 * Note that Bows of "Extra Might" get extra range and an extra bonus
3534 * for the damage multiplier.
3536 * Note that Bows of "Extra Shots" give an extra shot.
3539 void do_cmd_fire_aux(int item, object_type *j_ptr)
3542 int i, j, y, x, ny, nx, ty, tx, prev_y, prev_x;
3543 int tdam_base, tdis, thits, tmul;
3545 int cur_dis, visible;
3552 bool hit_body = FALSE;
3554 char o_name[MAX_NLEN];
3556 u16b path_g[512]; /* For calcuration of path length */
3558 int msec = delay_factor * delay_factor * delay_factor;
3561 bool stick_to = FALSE;
3563 /* Access the item (if in the pack) */
3566 o_ptr = &inventory[item];
3570 o_ptr = &o_list[0 - item];
3573 /* Sniper - Cannot shot a single arrow twice */
3574 if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
3576 /* Describe the object */
3577 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
3579 /* Use the proper number of shots */
3580 thits = p_ptr->num_fire;
3582 /* Use a base distance */
3585 /* Base damage from thrown object plus launcher bonus */
3586 tdam_base = damroll(o_ptr->dd, o_ptr->ds) + o_ptr->to_d + j_ptr->to_d;
3588 /* Actually "fire" the object */
3589 bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
3590 if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
3591 chance = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + bonus) * BTH_PLUS_ADJ);
3593 chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
3595 energy_use = bow_energy(j_ptr->sval);
3596 tmul = bow_tmul(j_ptr->sval);
3598 /* Get extra "power" from "extra might" */
3599 if (p_ptr->xtra_might) tmul++;
3601 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
3603 /* Boost the damage */
3608 tdis = 13 + tmul/80;
3609 if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
3612 tdis -= (5 - (p_ptr->concent + 1) / 2);
3617 project_length = tdis + 1;
3619 /* Get a direction (or cancel) */
3620 if (!get_aim_dir(&dir))
3624 if (snipe_type == SP_AWAY) snipe_type = SP_NONE;
3626 /* need not to reset project_length (already did)*/
3631 /* Predict the "target" location */
3632 tx = px + 99 * ddx[dir];
3633 ty = py + 99 * ddy[dir];
3635 /* Check for "target request" */
3636 if ((dir == 5) && target_okay())
3642 /* Get projection path length */
3643 tdis = project_path(path_g, project_length, py, px, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1;
3645 project_length = 0; /* reset to default */
3647 /* Don't shoot at my feet */
3648 if (tx == px && ty == py)
3652 /* project_length is already reset to 0 */
3658 /* Take a (partial) turn */
3659 energy_use = (energy_use / thits);
3662 /* Sniper - Difficult to shot twice at 1 turn */
3663 if (snipe_type == SP_DOUBLE) p_ptr->concent = (p_ptr->concent + 1) / 2;
3665 /* Sniper - Repeat shooting when double shots */
3666 for (i = 0; i < ((snipe_type == SP_DOUBLE) ? 2 : 1); i++)
3669 /* Start at the player */
3673 /* Get local object */
3676 /* Obtain a local object */
3677 object_copy(q_ptr, o_ptr);
3682 /* Reduce and describe inventory */
3685 inven_item_increase(item, -1);
3686 inven_item_describe(item);
3687 inven_item_optimize(item);
3690 /* Reduce and describe floor item */
3693 floor_item_increase(0 - item, -1);
3694 floor_item_optimize(0 - item);
3700 /* Hack -- Handle stuff */
3703 /* Save the old location */
3707 /* The shot does not hit yet */
3710 /* Travel until stopped */
3711 for (cur_dis = 0; cur_dis <= tdis; )
3715 /* Hack -- Stop at the target */
3716 if ((y == ty) && (x == tx)) break;
3718 /* Calculate the new location (see "project()") */
3721 mmove2(&ny, &nx, py, px, ty, tx);
3724 if (snipe_type == SP_KILL_WALL)
3726 c_ptr = &cave[ny][nx];
3728 if (cave_have_flag_grid(c_ptr, FF_HURT_ROCK) && !c_ptr->m_idx)
3731 if (c_ptr->info & (CAVE_MARK)) msg_print("´ä¤¬ºÕ¤±»¶¤Ã¤¿¡£");
3733 if (c_ptr->info & (CAVE_MARK)) msg_print("Wall rocks were shattered.");
3735 /* Forget the wall */
3736 c_ptr->info &= ~(CAVE_MARK);
3738 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
3740 /* Destroy the wall */
3741 cave_alter_feat(ny, nx, FF_HURT_ROCK);
3748 /* Stopped by walls/doors */
3749 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !cave[ny][nx].m_idx) break;
3751 /* Advance the distance */
3755 if (snipe_type == SP_LITE)
3757 cave[ny][nx].info |= (CAVE_GLOW);
3766 /* The player can see the (on screen) missile */
3767 if (panel_contains(ny, nx) && player_can_see_bold(ny, nx))
3769 char c = object_char(q_ptr);
3770 byte a = object_attr(q_ptr);
3772 /* Draw, Hilite, Fresh, Pause, Erase */
3773 print_rel(c, a, ny, nx);
3774 move_cursor_relative(ny, nx);
3776 Term_xtra(TERM_XTRA_DELAY, msec);
3781 /* The player cannot see the missile */
3784 /* Pause anyway, for consistancy */
3785 Term_xtra(TERM_XTRA_DELAY, msec);
3789 if (snipe_type == SP_KILL_TRAP)
3791 project(0, 0, ny, nx, 0, GF_KILL_TRAP,
3792 (PROJECT_JUMP | PROJECT_HIDE | PROJECT_GRID | PROJECT_ITEM), -1);
3796 if (snipe_type == SP_EVILNESS)
3798 cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
3807 /* Save the old location */
3811 /* Save the new location */
3816 /* Monster here, Try to hit it */
3817 if (cave[y][x].m_idx)
3820 cave_type *c_ptr = &cave[y][x];
3822 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3823 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3825 /* Check the visibility */
3826 visible = m_ptr->ml;
3828 /* Note the collision */
3831 if (MON_CSLEEP(m_ptr))
3833 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3834 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3837 if ((r_ptr->level + 10) > p_ptr->lev)
3839 int now_exp = p_ptr->weapon_exp[0][j_ptr->sval];
3840 if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
3843 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
3844 else if (now_exp < WEAPON_EXP_SKILLED) amount = 25;
3845 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
3846 else if (p_ptr->lev > 34) amount = 2;
3847 p_ptr->weapon_exp[0][j_ptr->sval] += amount;
3848 p_ptr->update |= (PU_BONUS);
3854 if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
3855 && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level)
3858 p_ptr->skill_exp[GINOU_RIDING] += 1;
3859 p_ptr->update |= (PU_BONUS);
3863 /* Some shots have hit bonus */
3867 armour *= (8 - p_ptr->concent);
3871 /* Did we hit it (penalize range) */
3872 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
3875 int tdam = tdam_base;
3877 /* Get extra damage from concentration */
3878 if (p_ptr->concent) tdam = boost_concentration_damage(tdam);
3880 /* Handle unseen monster */
3883 /* Invisible monster */
3885 msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name);
3887 msg_format("The %s finds a mark.", o_name);
3892 /* Handle visible monster */
3897 /* Get "the monster" or "it" */
3898 monster_desc(m_name, m_ptr, 0);
3902 msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name);
3904 msg_format("The %s hits %s.", o_name, m_name);
3909 /* Hack -- Track this monster race */
3910 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
3912 /* Hack -- Track this monster */
3913 health_track(c_ptr->m_idx);
3917 if (snipe_type == SP_NEEDLE)
3919 if ((randint1(randint1(r_ptr->level / (3 + p_ptr->concent)) + (8 - p_ptr->concent)) == 1)
3920 && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
3924 /* Get "the monster" or "it" */
3925 monster_desc(m_name, m_ptr, 0);
3927 tdam = m_ptr->hp + 1;
3929 msg_format("%s¤ÎµÞ½ê¤ËÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
3931 msg_format("Your shot sticked on a fatal spot of %s!", m_name);
3938 /* Apply special damage XXX XXX XXX */
3939 tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
3940 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam);
3942 /* No negative damage */
3943 if (tdam < 0) tdam = 0;
3945 /* Modify the damage */
3946 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
3949 /* Complex message */
3950 if (p_ptr->wizard || cheat_xtra)
3953 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",
3956 msg_format("You do %d (out of %d) damage.",
3963 if (snipe_type == SP_EXPLODE)
3965 u16b flg = (PROJECT_STOP | PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID);
3967 sound(SOUND_EXPLODE); /* No explode sound - use breath fire instead */
3968 project(0, ((p_ptr->concent + 1) / 2 + 1), ny, nx, tdam, GF_MISSILE, flg, -1);
3973 if (snipe_type == SP_HOLYNESS)
3975 cave[ny][nx].info |= (CAVE_GLOW);
3984 /* Hit the monster, check for death */
3985 if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
3994 if (object_is_fixed_artifact(q_ptr) &&
3995 (p_ptr->pclass != CLASS_SNIPER || p_ptr->concent == 0))
3999 monster_desc(m_name, m_ptr, 0);
4003 msg_format("%s¤Ï%s¤ËÆͤ»É¤µ¤Ã¤¿¡ª",o_name, m_name);
4005 msg_format("%^s have stuck into %s!",o_name, m_name);
4010 message_pain(c_ptr->m_idx, tdam);
4012 /* Anger the monster */
4013 if (tdam > 0) anger_monster(m_ptr);
4016 if (fear && m_ptr->ml)
4023 /* Get the monster name (or "it") */
4024 monster_desc(m_name, m_ptr, 0);
4028 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
4030 msg_format("%^s flees in terror!", m_name);
4035 set_target(m_ptr, py, px);
4038 if (snipe_type == SP_RUSH)
4040 int n = randint1(5) + 3;
4041 int m_idx = c_ptr->m_idx;
4043 for ( ; cur_dis <= tdis; )
4050 /* Calculate the new location (see "project()") */
4051 mmove2(&ny, &nx, py, px, ty, tx);
4053 /* Stopped by wilderness boundary */
4054 if (!in_bounds2(ny, nx)) break;
4056 /* Stopped by walls/doors */
4057 if (!player_can_enter(cave[ny][nx].feat, 0)) break;
4059 /* Stopped by monsters */
4060 if (!cave_empty_bold(ny, nx)) break;
4062 cave[ny][nx].m_idx = m_idx;
4063 cave[oy][ox].m_idx = 0;
4068 /* Update the monster (new location) */
4069 update_mon(c_ptr->m_idx, TRUE);
4075 Term_xtra(TERM_XTRA_DELAY, msec);
4087 if (snipe_type == SP_PIERCE)
4089 if(p_ptr->concent < 1) break;
4099 /* Chance of breakage (during attacks) */
4100 j = (hit_body ? breakage_chance(q_ptr) : 0);
4104 int m_idx = cave[y][x].m_idx;
4105 monster_type *m_ptr = &m_list[m_idx];
4106 int o_idx = o_pop();
4111 msg_format("%s¤Ï¤É¤³¤«¤Ø¹Ô¤Ã¤¿¡£", o_name);
4113 msg_format("The %s have gone to somewhere.", o_name);
4115 if (object_is_fixed_artifact(q_ptr))
4117 a_info[j_ptr->name1].cur_num = 0;
4122 o_ptr = &o_list[o_idx];
4123 object_copy(o_ptr, q_ptr);
4126 o_ptr->marked &= OM_TOUCHED;
4128 /* Forget location */
4129 o_ptr->iy = o_ptr->ix = 0;
4131 /* Memorize monster */
4132 o_ptr->held_m_idx = m_idx;
4135 o_ptr->next_o_idx = m_ptr->hold_o_idx;
4138 m_ptr->hold_o_idx = o_idx;
4140 else if (cave_have_flag_bold(y, x, FF_PROJECT))
4142 /* Drop (or break) near that location */
4143 (void)drop_near(q_ptr, j, y, x);
4147 /* Drop (or break) near that location */
4148 (void)drop_near(q_ptr, j, prev_y, prev_x);
4151 /* Sniper - Repeat shooting when double shots */
4154 /* Sniper - Loose his/her concentration after any shot */
4155 if (p_ptr->concent) reset_concentration(FALSE);
4159 * @brief ¼Í·â½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
4162 void do_cmd_fire(void)
4168 is_fired = FALSE; /* not fired yet */
4170 /* Get the "bow" (if any) */
4171 j_ptr = &inventory[INVEN_BOW];
4173 /* Require a launcher */
4177 msg_print("¼Í·âÍѤÎÉð´ï¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£");
4179 msg_print("You have nothing to fire with.");
4185 if (j_ptr->sval == SV_CRIMSON)
4188 msg_print("¤³¤ÎÉð´ï¤Ïȯư¤·¤Æ»È¤¦¤â¤Î¤Î¤è¤¦¤À¡£");
4190 msg_print("Do activate.");
4197 if (p_ptr->special_defense & KATA_MUSOU)
4199 set_action(ACTION_NONE);
4202 /* Require proper missile */
4203 item_tester_tval = p_ptr->tval_ammo;
4207 q = "¤É¤ì¤ò·â¤Á¤Þ¤¹¤«? ";
4208 s = "ȯ¼Í¤µ¤ì¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4210 q = "Fire which item? ";
4211 s = "You have nothing to fire.";
4214 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
4221 do_cmd_fire_aux(item, j_ptr);
4223 if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
4225 /* Sniper actions after some shootings */
4226 if (snipe_type == SP_AWAY)
4228 teleport_player(10 + (p_ptr->concent * 2), 0L);
4230 if (snipe_type == SP_FINAL)
4233 msg_print("¼Í·â¤ÎÈ¿Æ°¤¬ÂΤò½±¤Ã¤¿¡£");
4235 msg_print("A reactionary of shooting attacked you. ");
4237 (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE);
4238 (void)set_stun(p_ptr->stun + randint1(25));
4243 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬Åê¼Í²Äǽ¤ÊÉð´ï¤«¤É¤¦¤«¤òÊÖ¤¹¡£
4244 * @param o_ptr ȽÄꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
4245 * @return Åê¼Í²Äǽ¤ÊÉð´ï¤Ê¤é¤ÐTRUE
4247 static bool item_tester_hook_boomerang(object_type *o_ptr)
4249 if ((o_ptr->tval==TV_DIGGING) || (o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM) || (o_ptr->tval == TV_HAFTED)) return (TRUE);
4257 * @brief Åê¼Í½èÍý¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
4258 * Throw an object from the pack or floor.
4259 * @param mult °ÒÎϤÎÇÜΨ
4260 * @param boomerang ¥Ö¡¼¥á¥é¥ó½èÍý¤Ê¤é¤ÐTRUE
4261 * @param shuriken Ǧ¼Ô¤Î¼ê΢·õ½èÍý¤Ê¤é¤ÐTRUE
4262 * @return ¥¿¡¼¥ó¤ò¾ÃÈñ¤·¤¿¾ì¹çTRUE¤òÊÖ¤¹
4265 * Note: "unseen" monsters are very hard to hit.
4267 * Should throwing a weapon do full damage? Should it allow the magic
4268 * to hit bonus of the weapon to have an effect? Should it ever cause
4269 * the item to be destroyed? Should it do any damage at all?
4272 bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
4275 int i, j, y, x, ty, tx, prev_y, prev_x;
4277 int chance, tdam, tdis;
4278 int mul, div, dd, ds;
4279 int cur_dis, visible;
4286 bool hit_body = FALSE;
4287 bool hit_wall = FALSE;
4288 bool equiped_item = FALSE;
4289 bool return_when_thrown = FALSE;
4291 char o_name[MAX_NLEN];
4293 int msec = delay_factor * delay_factor * delay_factor;
4295 u32b flgs[TR_FLAG_SIZE];
4297 bool come_back = FALSE;
4298 bool do_drop = TRUE;
4301 if (p_ptr->special_defense & KATA_MUSOU)
4303 set_action(ACTION_NONE);
4312 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4314 item_tester_hook = item_tester_hook_boomerang;
4316 q = "¤É¤ÎÉð´ï¤òÅꤲ¤Þ¤¹¤«? ";
4317 s = "Åꤲ¤ëÉð´ï¤¬¤Ê¤¤¡£";
4319 q = "Throw which item? ";
4320 s = "You have nothing to throw.";
4323 if (!get_item(&item, q, s, (USE_EQUIP)))
4329 else if (buki_motteruka(INVEN_LARM)) item = INVEN_LARM;
4330 else item = INVEN_RARM;
4336 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÅꤲ¤Þ¤¹¤«? ";
4337 s = "Åꤲ¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
4339 q = "Throw which item? ";
4340 s = "You have nothing to throw.";
4343 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)))
4350 /* Access the item (if in the pack) */
4353 o_ptr = &inventory[item];
4357 o_ptr = &o_list[0 - item];
4361 /* Item is cursed */
4362 if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
4366 msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
4368 msg_print("Hmmm, it seems to be cursed.");
4375 if (p_ptr->inside_arena && !boomerang)
4377 if (o_ptr->tval != TV_SPIKE)
4380 msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª");
4382 msg_print("You're in the arena now. This is hand-to-hand!");
4391 /* Get local object */
4394 /* Obtain a local object */
4395 object_copy(q_ptr, o_ptr);
4397 /* Extract the thrown object's flags. */
4398 object_flags(q_ptr, flgs);
4399 torch_flags(q_ptr, flgs);
4401 /* Distribute the charges of rods/wands between the stacks */
4402 distribute_charges(o_ptr, q_ptr, 1);
4408 object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
4410 if (p_ptr->mighty_throw) mult += 3;
4412 /* Extract a "distance multiplier" */
4413 /* Changed for 'launcher' mutation */
4414 mul = 10 + 2 * (mult - 1);
4416 /* Enforce a minimum "weight" of one pound */
4417 div = ((q_ptr->weight > 10) ? q_ptr->weight : 10);
4418 if ((have_flag(flgs, TR_THROW)) || boomerang) div /= 2;
4420 /* Hack -- Distance -- Reward strength, penalize weight */
4421 tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div;
4423 /* Max distance of 10-18 */
4424 if (tdis > mul) tdis = mul;
4428 ty = randint0(101)-50+py;
4429 tx = randint0(101)-50+px;
4433 project_length = tdis + 1;
4435 /* Get a direction (or cancel) */
4436 if (!get_aim_dir(&dir)) return FALSE;
4438 /* Predict the "target" location */
4439 tx = px + 99 * ddx[dir];
4440 ty = py + 99 * ddy[dir];
4442 /* Check for "target request" */
4443 if ((dir == 5) && target_okay())
4449 project_length = 0; /* reset to default */
4452 if ((q_ptr->name1 == ART_MJOLLNIR) ||
4453 (q_ptr->name1 == ART_AEGISFANG) || boomerang)
4454 return_when_thrown = TRUE;
4456 /* Reduce and describe inventory */
4459 inven_item_increase(item, -1);
4460 if (!return_when_thrown)
4461 inven_item_describe(item);
4462 inven_item_optimize(item);
4465 /* Reduce and describe floor item */
4468 floor_item_increase(0 - item, -1);
4469 floor_item_optimize(0 - item);
4471 if (item >= INVEN_RARM)
4473 equiped_item = TRUE;
4474 p_ptr->redraw |= (PR_EQUIPPY);
4480 /* Rogue and Ninja gets bonus */
4481 if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
4482 energy_use -= p_ptr->lev;
4484 /* Start at the player */
4489 /* Hack -- Handle stuff */
4492 if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
4493 else shuriken = FALSE;
4495 /* Chance of hitting */
4496 if (have_flag(flgs, TR_THROW)) chance = ((p_ptr->skill_tht) +
4497 ((p_ptr->to_h_b + q_ptr->to_h) * BTH_PLUS_ADJ));
4498 else chance = (p_ptr->skill_tht + (p_ptr->to_h_b * BTH_PLUS_ADJ));
4500 if (shuriken) chance *= 2;
4502 /* Save the old location */
4506 /* Travel until stopped */
4507 for (cur_dis = 0; cur_dis <= tdis; )
4509 /* Hack -- Stop at the target */
4510 if ((y == ty) && (x == tx)) break;
4512 /* Calculate the new location (see "project()") */
4515 mmove2(&ny[cur_dis], &nx[cur_dis], py, px, ty, tx);
4517 /* Stopped by walls/doors */
4518 if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
4521 if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
4524 /* The player can see the (on screen) missile */
4525 if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
4527 char c = object_char(q_ptr);
4528 byte a = object_attr(q_ptr);
4530 /* Draw, Hilite, Fresh, Pause, Erase */
4531 print_rel(c, a, ny[cur_dis], nx[cur_dis]);
4532 move_cursor_relative(ny[cur_dis], nx[cur_dis]);
4534 Term_xtra(TERM_XTRA_DELAY, msec);
4535 lite_spot(ny[cur_dis], nx[cur_dis]);
4539 /* The player cannot see the missile */
4542 /* Pause anyway, for consistancy */
4543 Term_xtra(TERM_XTRA_DELAY, msec);
4546 /* Save the old location */
4550 /* Save the new location */
4554 /* Advance the distance */
4557 /* Monster here, Try to hit it */
4558 if (cave[y][x].m_idx)
4560 cave_type *c_ptr = &cave[y][x];
4562 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4563 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4565 /* Check the visibility */
4566 visible = m_ptr->ml;
4568 /* Note the collision */
4571 /* Did we hit it (penalize range) */
4572 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
4576 /* Handle unseen monster */
4579 /* Invisible monster */
4581 msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name);
4583 msg_format("The %s finds a mark.", o_name);
4588 /* Handle visible monster */
4593 /* Get "the monster" or "it" */
4594 monster_desc(m_name, m_ptr, 0);
4598 msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name);
4600 msg_format("The %s hits %s.", o_name, m_name);
4605 /* Hack -- Track this monster race */
4606 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
4608 /* Hack -- Track this monster */
4609 health_track(c_ptr->m_idx);
4613 /* Hack -- Base damage from thrown object */
4616 torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
4617 tdam = damroll(dd, ds);
4618 /* Apply special damage XXX XXX XXX */
4619 tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
4620 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
4621 if (q_ptr->to_d > 0)
4622 tdam += q_ptr->to_d;
4624 tdam += -q_ptr->to_d;
4628 tdam *= (mult+p_ptr->num_blow[item - INVEN_RARM]);
4629 tdam += p_ptr->to_d_m;
4631 else if (have_flag(flgs, TR_THROW))
4634 tdam += p_ptr->to_d_m;
4642 tdam += ((p_ptr->lev+30)*(p_ptr->lev+30)-900)/55;
4645 /* No negative damage */
4646 if (tdam < 0) tdam = 0;
4648 /* Modify the damage */
4649 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
4651 /* Complex message */
4655 msg_format("%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",
4658 msg_format("You do %d (out of %d) damage.",
4664 /* Hit the monster, check for death */
4665 if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
4674 message_pain(c_ptr->m_idx, tdam);
4676 /* Anger the monster */
4677 if ((tdam > 0) && !object_is_potion(q_ptr))
4678 anger_monster(m_ptr);
4681 if (fear && m_ptr->ml)
4688 /* Get the monster name (or "it") */
4689 monster_desc(m_name, m_ptr, 0);
4693 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
4695 msg_format("%^s flees in terror!", m_name);
4707 /* decrease toach's fuel */
4708 if (hit_body) torch_lost_fuel(q_ptr);
4710 /* Chance of breakage (during attacks) */
4711 j = (hit_body ? breakage_chance(q_ptr) : 0);
4713 /* Figurines transform */
4714 if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
4718 if (!(summon_named_creature(0, y, x, q_ptr->pval,
4719 !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
4721 msg_print("¿Í·Á¤ÏDZ¤¸¶Ê¤¬¤êºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
4723 msg_print("The Figurine writhes and then shatters.");
4726 else if (object_is_cursed(q_ptr))
4728 msg_print("¤³¤ì¤Ï¤¢¤Þ¤êÎɤ¯¤Ê¤¤µ¤¤¬¤¹¤ë¡£");
4730 msg_print("You have a bad feeling about this.");
4736 /* Potions smash open */
4737 if (object_is_potion(q_ptr))
4739 if (hit_body || hit_wall || (randint1(100) < j))
4743 msg_format("%s¤ÏºÕ¤±»¶¤Ã¤¿¡ª", o_name);
4745 msg_format("The %s shatters!", o_name);
4749 if (potion_smash_effect(0, y, x, q_ptr->k_idx))
4751 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
4753 /* ToDo (Robert): fix the invulnerability */
4754 if (cave[y][x].m_idx &&
4755 is_friendly(&m_list[cave[y][x].m_idx]) &&
4756 !MON_INVULNER(m_ptr))
4759 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
4761 msg_format("%s¤ÏÅܤä¿¡ª", m_name);
4763 msg_format("%^s gets angry!", m_name);
4766 set_hostile(&m_list[cave[y][x].m_idx]);
4777 if (return_when_thrown)
4779 int back_chance = randint1(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4780 char o2_name[MAX_NLEN];
4781 bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
4784 if (boomerang) back_chance += 4+randint1(5);
4785 if (super_boomerang) back_chance += 100;
4786 object_desc(o2_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4788 if((back_chance > 30) && (!one_in_(100) || super_boomerang))
4790 for (i = cur_dis - 1; i > 0; i--)
4792 if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
4794 char c = object_char(q_ptr);
4795 byte a = object_attr(q_ptr);
4797 /* Draw, Hilite, Fresh, Pause, Erase */
4798 print_rel(c, a, ny[i], nx[i]);
4799 move_cursor_relative(ny[i], nx[i]);
4801 Term_xtra(TERM_XTRA_DELAY, msec);
4802 lite_spot(ny[i], nx[i]);
4807 /* Pause anyway, for consistancy */
4808 Term_xtra(TERM_XTRA_DELAY, msec);
4811 if((back_chance > 37) && !p_ptr->blind && (item >= 0))
4814 msg_format("%s¤¬¼ê¸µ¤ËÊ֤äƤ¤¿¡£", o2_name);
4816 msg_format("%s comes back to you.", o2_name);
4825 msg_format("%s¤ò¼õ¤±Â»¤Í¤¿¡ª", o2_name);
4827 msg_format("%s backs, but you can't catch!", o2_name);
4833 msg_format("%s¤¬Ê֤äƤ¤¿¡£", o2_name);
4835 msg_format("%s comes back.", o2_name);
4845 msg_format("%s¤¬Ê֤äƤ³¤Ê¤«¤Ã¤¿¡ª", o2_name);
4847 msg_format("%s doesn't back!", o2_name);
4854 if (item == INVEN_RARM || item == INVEN_LARM)
4856 /* Access the wield slot */
4857 o_ptr = &inventory[item];
4859 /* Wear the new stuff */
4860 object_copy(o_ptr, q_ptr);
4862 /* Increase the weight */
4863 p_ptr->total_weight += q_ptr->weight;
4865 /* Increment the equip counter by hand */
4868 /* Recalculate bonuses */
4869 p_ptr->update |= (PU_BONUS);
4871 /* Recalculate torch */
4872 p_ptr->update |= (PU_TORCH);
4874 /* Recalculate mana XXX */
4875 p_ptr->update |= (PU_MANA);
4878 p_ptr->window |= (PW_EQUIP);
4886 else if (equiped_item)
4892 /* Drop (or break) near that location */
4895 if (cave_have_flag_bold(y, x, FF_PROJECT))
4897 /* Drop (or break) near that location */
4898 (void)drop_near(q_ptr, j, y, x);
4902 /* Drop (or break) near that location */
4903 (void)drop_near(q_ptr, j, prev_y, prev_x);
4912 * @brief Åê¼Í½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4913 * Throw an object from the pack or floor.
4916 void do_cmd_throw(void)
4918 do_cmd_throw_aux(1, FALSE, -1);
4924 * Hack: travel command
4926 #define TRAVEL_UNABLE 9999
4928 static int flow_head = 0;
4929 static int flow_tail = 0;
4930 static s16b temp2_x[MAX_SHORT];
4931 static s16b temp2_y[MAX_SHORT];
4934 * @brief ¥È¥é¥Ù¥ë½èÍý¤Îµ²±ÇÛÎó¤ò½é´ü²½¤¹¤ë Hack: forget the "flow" information
4937 void forget_travel_flow(void)
4941 /* Check the entire dungeon */
4942 for (y = 0; y < cur_hgt; y++)
4944 for (x = 0; x < cur_wid; x++)
4946 /* Forget the old data */
4947 travel.cost[y][x] = MAX_SHORT;
4951 travel.y = travel.x = 0;
4955 * @brief ¥È¥é¥Ù¥ë½èÍýÃæ¤ËÃÏ·Á¤Ë±þ¤¸¤¿°ÜÆ°¥³¥¹¥È´ð½à¤òÊÖ¤¹
4956 * @param y ³ºÅöÃÏÅÀ¤ÎYºÂɸ
4957 * @param x ³ºÅöÃÏÅÀ¤ÎXºÂɸ
4960 static int travel_flow_cost(int y, int x)
4962 feature_type *f_ptr = &f_info[cave[y][x].feat];
4965 /* Avoid obstacles (ex. trees) */
4966 if (have_flag(f_ptr->flags, FF_AVOID_RUN)) cost += 1;
4969 if (have_flag(f_ptr->flags, FF_WATER))
4971 if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5;
4975 if (have_flag(f_ptr->flags, FF_LAVA))
4978 if (!p_ptr->resist_fire) lava *= 2;
4979 if (!p_ptr->levitation) lava *= 2;
4980 if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2;
4985 /* Detected traps and doors */
4986 if (cave[y][x].info & (CAVE_MARK))
4988 if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
4989 if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
4996 * @brief ¥È¥é¥Ù¥ë½èÍý¤ÎÅþãÃÏÅÀ¤Þ¤Ç¤Î¹ÔÄø¤òÆÀ¤ë½èÍý¤Î¥µ¥Ö¥ë¡¼¥Á¥ó
4997 * @param y ÌÜɸÃÏÅÀ¤ÎYºÂɸ
4998 * @param x ÌÜɸÃÏÅÀ¤ÎXºÂɸ
4999 * @param n ¸½ºß¤Î¥³¥¹¥È
5000 * @param wall ¥×¥ì¥¤¥ä¡¼¤¬ÊɤÎÃæ¤Ë¤¤¤ë¤Ê¤é¤ÐTRUE
5003 static void travel_flow_aux(int y, int x, int n, bool wall)
5005 cave_type *c_ptr = &cave[y][x];
5006 feature_type *f_ptr = &f_info[c_ptr->feat];
5007 int old_head = flow_head;
5009 int base_cost = (n % TRAVEL_UNABLE);
5010 int from_wall = (n / TRAVEL_UNABLE);
5013 /* Ignore out of bounds */
5014 if (!in_bounds(y, x)) return;
5016 /* Ignore unknown grid except in wilderness */
5017 if (dun_level > 0 && !(c_ptr->info & CAVE_KNOWN)) return;
5019 /* Ignore "walls" and "rubble" (include "secret doors") */
5020 if (have_flag(f_ptr->flags, FF_WALL) ||
5021 have_flag(f_ptr->flags, FF_CAN_DIG) ||
5022 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic) ||
5023 (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation))
5025 if (!wall || !from_wall) return;
5026 add_cost += TRAVEL_UNABLE;
5030 add_cost = travel_flow_cost(y, x);
5033 cost = base_cost + add_cost;
5035 /* Ignore lower cost entries */
5036 if (travel.cost[y][x] <= cost) return;
5038 /* Save the flow cost */
5039 travel.cost[y][x] = cost;
5041 /* Enqueue that entry */
5042 temp2_y[flow_head] = y;
5043 temp2_x[flow_head] = x;
5045 /* Advance the queue */
5046 if (++flow_head == MAX_SHORT) flow_head = 0;
5048 /* Hack -- notice overflow by forgetting new entry */
5049 if (flow_head == flow_tail) flow_head = old_head;
5055 * @brief ¥È¥é¥Ù¥ë½èÍý¤ÎÅþãÃÏÅÀ¤Þ¤Ç¤Î¹ÔÄø¤òÆÀ¤ë½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
5056 * @param ty ÌÜɸÃÏÅÀ¤ÎYºÂɸ
5057 * @param tx ÌÜɸÃÏÅÀ¤ÎXºÂɸ
5060 static void travel_flow(int ty, int tx)
5064 feature_type *f_ptr = &f_info[cave[py][px].feat];
5066 /* Reset the "queue" */
5067 flow_head = flow_tail = 0;
5069 /* is player in the wall? */
5070 if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE;
5072 /* Start at the target grid */
5073 travel_flow_aux(ty, tx, 0, wall);
5075 /* Now process the queue */
5076 while (flow_head != flow_tail)
5078 /* Extract the next entry */
5079 y = temp2_y[flow_tail];
5080 x = temp2_x[flow_tail];
5082 /* Forget that entry */
5083 if (++flow_tail == MAX_SHORT) flow_tail = 0;
5085 /* Ignore too far entries */
5086 //if (distance(ty, tx, y, x) > 100) continue;
5088 /* Add the "children" */
5089 for (d = 0; d < 8; d++)
5091 /* Add that child if "legal" */
5092 travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
5096 /* Forget the flow info */
5097 flow_head = flow_tail = 0;
5101 * @brief ¥È¥é¥Ù¥ë½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
5104 void do_cmd_travel(void)
5108 feature_type *f_ptr;
5110 if (travel.x != 0 && travel.y != 0 &&
5111 get_check(_("¥È¥é¥Ù¥ë¤ò·Ñ³¤·¤Þ¤¹¤«¡©", "Do you continue to travel?")))
5116 else if (!tgt_pt(&x, &y)) return;
5118 if ((x == px) && (y == py))
5121 msg_print("¤¹¤Ç¤Ë¤½¤³¤Ë¤¤¤Þ¤¹¡ª");
5123 msg_print("You are already there!!");
5128 f_ptr = &f_info[cave[y][x].feat];
5130 if ((cave[y][x].info & CAVE_MARK) &&
5131 (have_flag(f_ptr->flags, FF_WALL) ||
5132 have_flag(f_ptr->flags, FF_CAN_DIG) ||
5133 (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic)))
5136 msg_print("¤½¤³¤Ë¤Ï¹Ô¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¡ª");
5138 msg_print("You cannot travel there!");
5143 forget_travel_flow();
5149 /* Travel till 255 steps */
5155 /* Decides first direction */
5158 sx = ((x == px) || (dx < dy)) ? 0 : ((x > px) ? 1 : -1);
5159 sy = ((y == py) || (dy < dx)) ? 0 : ((y > py) ? 1 : -1);
5161 for (i = 1; i <= 9; i++)
5163 if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;