X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd2.c;h=0bb150338c1e5e64a58dc2c04152e7de687629cb;hb=efc142f5457acea2f3a823af0b6a42b851072f31;hp=7ab2aa2a03865d4df39fbcbfe3d34aa05ff6996d;hpb=17fe70dfffa44e0cbe8e7d5850067c694d0fb5e9;p=hengband%2Fhengband.git diff --git a/src/cmd2.c b/src/cmd2.c index 7ab2aa2a0..0bb150338 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -1,6 +1,8 @@ -/* File: cmd2.c */ - -/* +/*! + * @file cmd2.c + * @brief ãã¬ã¤ã¤ã¼ã®ã³ãã³ãå¦ç2 / Movement commands (part 2) + * @date 2014/01/02 + * @author * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke * * This software may be copied and distributed for educational, research, @@ -8,20 +10,52 @@ * are included in all such copies. Other copyrights may also apply. */ -/* Purpose: Movement commands (part 2) */ - #include "angband.h" -/* - * Go up one level +/*! + * @brief ããã¢è±åºæã«åºæ»ããä¸å¯è½ã ã£ãå ´åã«è¦åãå ããå¦ç + * @param down_stair TRUEãªãã°é段ãéããå¦çãFALSEãªãé段ãæãå¦çã«ããå 容 + * @return ããã¢ç§»åãå®éã«è¡ããªãTRUEããã£ã³ã»ã«ããå ´åã¯FALSE + */ +bool confirm_leave_level(bool down_stair) +{ + quest_type *q_ptr = &quest[p_ptr->inside_quest]; + + /* Confirm leaving from once only quest */ + if (confirm_quest && p_ptr->inside_quest && + (q_ptr->type == QUEST_TYPE_RANDOM || + (q_ptr->flags & QUEST_FLAG_ONCE && + q_ptr->status != QUEST_STATUS_COMPLETED) || + (q_ptr->flags & QUEST_FLAG_TOWER && + ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) || + (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED)))))) + { +#ifdef JP + msg_print("ãã®éãä¸åº¦å»ãã¨äºåº¦ã¨æ»ã£ã¦æ¥ããã¾ããã"); + if (get_check("æ¬å½ã«ãã®éãå»ãã¾ããï¼")) return TRUE; +#else + msg_print("You can't come back here once you leave this floor."); + if (get_check("Really leave this floor? ")) return TRUE; +#endif + } + else + { + return TRUE; + } + return FALSE; +} + +/*! + * @brief é段ã使ã£ã¦é層ãæãå¦ç / Go up one level + * @return ãªã */ void do_cmd_go_up(void) { bool go_up = FALSE; /* Player grid */ - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[c_ptr->feat]; int up_num = 0; @@ -34,24 +68,23 @@ void do_cmd_go_up(void) /* Verify stairs */ if (!have_flag(f_ptr->flags, FF_LESS)) { -#ifdef JP - msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("I see no up staircase here."); -#endif - + msg_print(_("ããã«ã¯ä¸ãé段ãè¦å½ãããªãã", "I see no up staircase here.")); return; } /* Quest up stairs */ if (have_flag(f_ptr->flags, FF_QUEST)) { + /* Cancel the command */ + if (!confirm_leave_level(FALSE)) return; + + /* Success */ #ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª"); + msg_print("ãªãã ãã®é段ã¯ï¼"); else - msg_print("¾å¤Î³¬¤ËÅФä¿¡£"); + msg_print("ä¸ã®éã«ç»ã£ãã"); #else msg_print("You enter the up staircase."); #endif @@ -63,6 +96,11 @@ void do_cmd_go_up(void) /* Activate the quest */ if (!quest[p_ptr->inside_quest].status) { + if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) + { + init_flags = INIT_ASSIGN; + process_dungeon_file("q_info.txt", 0, 0, 0, 0); + } quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN; } @@ -77,6 +115,9 @@ void do_cmd_go_up(void) p_ptr->oldpx = 0; p_ptr->oldpy = 0; + + /* Hack -- take a turn */ + p_ptr->energy_use = 100; /* End the command */ return; @@ -88,33 +129,14 @@ void do_cmd_go_up(void) } else { - quest_type *q_ptr = &quest[p_ptr->inside_quest]; - - /* Confirm leaving from once only quest */ - if (confirm_quest && p_ptr->inside_quest && - (q_ptr->type == QUEST_TYPE_RANDOM || - (q_ptr->flags & QUEST_FLAG_ONCE && - q_ptr->status != QUEST_STATUS_COMPLETED))) - { -#ifdef JP - msg_print("¤³¤Î³¬¤ò°ìÅÙµî¤ë¤ÈÆóÅÙ¤ÈÌá¤Ã¤ÆÍè¤é¤ì¤Þ¤»¤ó¡£"); - if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©")) go_up = TRUE; -#else - msg_print("You can't come back here once you leave this floor."); - if (get_check("Really leave this floor? ")) go_up = TRUE; -#endif - } - else - { - go_up = TRUE; - } + go_up = confirm_leave_level(FALSE); } /* Cancel the command */ if (!go_up) return; /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (autosave_l) do_cmd_save_game(TRUE); @@ -161,40 +183,29 @@ void do_cmd_go_up(void) if (dun_level - up_num < d_info[dungeon_type].mindepth) up_num = dun_level; } - -#ifdef JP - if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿"); -#else - if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "climbed up the stairs to"); -#endif + if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("é段ãä¸ã£ã", "climbed up the stairs to")); /* Success */ -#ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª"); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "")); else if (up_num == dun_level) - msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£"); - else - msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£"); -#else - if (up_num == dun_level) - msg_print("You go back to the surface."); + msg_print(_("å°ä¸ã«æ»ã£ãã", "You go back to the surface.")); else - msg_print("You enter a maze of up staircases."); -#endif + msg_print(_("é段ãä¸ã£ã¦æ°ããªãè¿·å®®ã¸ã¨è¶³ãè¸ã¿å ¥ããã", "You enter a maze of up staircases.")); /* Leaving */ p_ptr->leaving = TRUE; } -/* - * Go down one level +/*! + * @brief é段ã使ã£ã¦é層ãéããå¦ç / Go down one level + * @return ãªã */ void do_cmd_go_down(void) { /* Player grid */ - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[c_ptr->feat]; bool fall_trap = FALSE; @@ -208,12 +219,7 @@ void do_cmd_go_down(void) /* Verify stairs */ if (!have_flag(f_ptr->flags, FF_MORE)) { -#ifdef JP - msg_print("¤³¤³¤Ë¤Ï²¼¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("I see no down staircase here."); -#endif - + msg_print(_("ããã«ã¯ä¸ãé段ãè¦å½ãããªãã", "I see no down staircase here.")); return; } @@ -228,23 +234,31 @@ void do_cmd_go_down(void) /* Quest down stairs */ else if (have_flag(f_ptr->flags, FF_QUEST)) { + /* Confirm Leaving */ + if(!confirm_leave_level(TRUE)) return; + #ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª"); + msg_print("ãªãã ãã®é段ã¯ï¼"); else - msg_print("²¼¤Î³¬¤Ë¹ß¤ê¤¿¡£"); + msg_print("ä¸ã®éã«éããã"); #else msg_print("You enter the down staircase."); #endif - leave_quest_check(); + leave_tower_check(); p_ptr->inside_quest = c_ptr->special; /* Activate the quest */ if (!quest[p_ptr->inside_quest].status) { + if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) + { + init_flags = INIT_ASSIGN; + process_dungeon_file("q_info.txt", 0, 0, 0, 0); + } quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN; } @@ -259,6 +273,10 @@ void do_cmd_go_down(void) p_ptr->oldpx = 0; p_ptr->oldpy = 0; + + + /* Hack -- take a turn */ + p_ptr->energy_use = 100; } else @@ -271,27 +289,19 @@ void do_cmd_go_down(void) if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND)) { -#ifdef JP - msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÆþ¸ý¤ÏºÉ¤¬¤ì¤Æ¤¤¤ë¡ª"); -#else - msg_print("The entrance of this dungeon is closed!"); -#endif + msg_print(_("ãã³ã¸ã§ã³ã®å ¥å£ã¯å¡ããã¦ããï¼", "The entrance of this dungeon is closed!")); return; } if (!max_dlv[target_dungeon]) { -#ifdef JP - msg_format("¤³¤³¤Ë¤Ï%s¤ÎÆþ¤ê¸ý(%d³¬ÁêÅö)¤¬¤¢¤ê¤Þ¤¹", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth); - if (!get_check("ËÜÅö¤Ë¤³¤Î¥À¥ó¥¸¥ç¥ó¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return; -#else - msg_format("There is the entrance of %s (Danger level: %d)", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth); - if (!get_check("Do you really get in this dungeon? ")) return; -#endif + msg_format(_("ããã«ã¯%sã®å ¥ãå£(%déç¸å½)ãããã¾ã", "There is the entrance of %s (Danger level: %d)"), + d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth); + if (!get_check(_("æ¬å½ã«ãã®ãã³ã¸ã§ã³ã«å ¥ãã¾ããï¼", "Do you really get in this dungeon? "))) return; } /* Save old player position */ - p_ptr->oldpx = px; - p_ptr->oldpy = py; + p_ptr->oldpx = p_ptr->x; + p_ptr->oldpy = p_ptr->y; dungeon_type = (byte)target_dungeon; /* @@ -302,7 +312,7 @@ void do_cmd_go_down(void) } /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (autosave_l) do_cmd_save_game(TRUE); @@ -319,44 +329,27 @@ void do_cmd_go_down(void) if (record_stair) { -#ifdef JP - if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Í¸Í¤ËÍî¤Á¤¿"); - else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿"); -#else - if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fell through a trap door"); - else do_cmd_write_nikki(NIKKI_STAIR, down_num, "climbed down the stairs to"); -#endif + if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, _("è½ã¨ãæ¸ã«è½ã¡ã", "fell through a trap door")); + else do_cmd_write_nikki(NIKKI_STAIR, down_num, _("é段ãä¸ãã", "climbed down the stairs to")); } if (fall_trap) { -#ifdef JP - msg_print("¤ï¤¶¤ÈÍ¸Í¤ËÍî¤Á¤¿¡£"); -#else - msg_print("You deliberately jump through the trap door."); -#endif + msg_print(_("ããã¨è½ã¨ãæ¸ã«è½ã¡ãã", "You deliberately jump through the trap door.")); } else { /* Success */ if (target_dungeon) { -#ifdef JP - msg_format("%s¤ØÆþ¤Ã¤¿¡£", d_text + d_info[dungeon_type].text); -#else - msg_format("You entered %s.", d_text + d_info[dungeon_type].text); -#endif + msg_format(_("%sã¸å ¥ã£ãã", "You entered %s."), d_text + d_info[dungeon_type].text); } else { -#ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª"); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "")); else - msg_print("³¬Ãʤò²¼¤ê¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£"); -#else - msg_print("You enter a maze of down staircases."); -#endif + msg_print(_("é段ãä¸ãã¦æ°ããªãè¿·å®®ã¸ã¨è¶³ãè¸ã¿å ¥ããã", "You enter a maze of down staircases.")); } } @@ -385,9 +378,9 @@ void do_cmd_go_down(void) } - -/* - * Simple command to "search" for one turn +/*! + * @brief æ¢ç´¢ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Simple command to "search" for one turn + * @return ãªã */ void do_cmd_search(void) { @@ -405,17 +398,21 @@ void do_cmd_search(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Search */ search(); } -/* - * Determine if a grid contains a chest +/*! + * @brief 該å½ã®ãã¹ã«åå¨ãã¦ããç®±ã®ãªãã¸ã§ã¯ãIDãè¿ãã + * @param y èµ°æ»å¯¾è±¡ã«ããããã¹ã®Yåº§æ¨ + * @param x èµ°æ»å¯¾è±¡ã«ããããã¹ã®Xåº§æ¨ + * @param trapped TRUEãªãã°ãã©ãããåå¨ããç®±ã®ã¿ãFALSEãªãã°ç©ºã§ãªãç®±å ¨ã¦ã対象ã«ãã + * @return ç®±ãåå¨ããå ´åãã®ãªãã¸ã§ã¯ãIDãåå¨ããªãå ´å0ãè¿ãã */ -static s16b chest_check(int y, int x) +static s16b chest_check(int y, int x, bool trapped) { cave_type *c_ptr = &cave[y][x]; @@ -434,10 +431,15 @@ static s16b chest_check(int y, int x) next_o_idx = o_ptr->next_o_idx; /* Skip unknown chests XXX XXX */ - /* if (!o_ptr->marked) continue; */ + /* if (!(o_ptr->marked & OM_FOUND)) continue; */ - /* Check for chest */ - if (o_ptr->tval == TV_CHEST) return (this_o_idx); + /* Check for non empty chest */ + if ((o_ptr->tval == TV_CHEST) && + (((!trapped) && (o_ptr->pval)) || /* non empty */ + ((trapped) && (o_ptr->pval > 0)))) /* trapped only */ + { + return (this_o_idx); + } } /* No chest */ @@ -445,9 +447,16 @@ static s16b chest_check(int y, int x) } -/* +/*! + * @brief ç®±ããã¢ã¤ãã ãå¼ãåºã / * Allocates objects upon opening a chest -BEN- - * + * @param scatter TRUEãªãã°ãã©ããã«ããã¢ã¤ãã ã®æ¡æ£å¦ç + * @param y ç®±ã®åå¨ãããã¹ã®Yåº§æ¨ + * @param x ç®±ã®åå¨ãããã¹ã®Xåº§æ¨ + * @param o_idx ç®±ã®ãªãã¸ã§ã¯ãID + * @return ãªã + * @details + *
* Disperse treasures from the given chest, centered at (x,y). * * Small chests often contain "gold", while Large chests always contain @@ -455,6 +464,7 @@ static s16b chest_check(int y, int x) * and Steel chests contain 6 items. The "value" of the items in a * chest is based on the "power" of the chest, which is in turn based * on the level on which the chest is generated. + **/ static void chest_death(bool scatter, int y, int x, s16b o_idx) { @@ -555,11 +565,18 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx) } -/* +/*! + * @brief ç®±ã®ãã©ããå¦ç / * Chests have traps too. - * + * @param y ç®±ã®åå¨ãããã¹ã®Yåº§æ¨ + * @param x ç®±ã®åå¨ãããã¹ã®Xåº§æ¨ + * @param o_idx ç®±ã®ãªãã¸ã§ã¯ãID + * @return ãªã + * @details + *
* Exploding chest destroys contents (and traps). * Note that the chest itself is never destroyed. + **/ static void chest_trap(int y, int x, s16b o_idx) { @@ -579,8 +596,8 @@ static void chest_trap(int y, int x, s16b o_idx) if (trap & (CHEST_LOSE_STR)) { #ifdef JP - msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1); + msg_print("ä»æãããã¦ããå°ããªéã«åºããã¦ãã¾ã£ãï¼"); + take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "æ¯é", -1); #else msg_print("A small needle has pricked you!"); take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1); @@ -593,8 +610,8 @@ static void chest_trap(int y, int x, s16b o_idx) if (trap & (CHEST_LOSE_CON)) { #ifdef JP - msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1); + msg_print("ä»æãããã¦ããå°ããªéã«åºããã¦ãã¾ã£ãï¼"); + take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "æ¯é", -1); #else msg_print("A small needle has pricked you!"); take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1); @@ -606,12 +623,7 @@ static void chest_trap(int y, int x, s16b o_idx) /* Poison */ if (trap & (CHEST_POISON)) { -#ifdef JP - msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿Îп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A puff of green gas surrounds you!"); -#endif - + msg_print(_("çªå¦å¹ãåºããç·è²ã®ã¬ã¹ã«å ã¿è¾¼ã¾ããï¼", "A puff of green gas surrounds you!")); if (!(p_ptr->resist_pois || IS_OPPOSE_POIS())) { (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20)); @@ -621,13 +633,7 @@ static void chest_trap(int y, int x, s16b o_idx) /* Paralyze */ if (trap & (CHEST_PARALYZE)) { -#ifdef JP - msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿²«¿§¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A puff of yellow gas surrounds you!"); -#endif - - + msg_print(_("çªå¦å¹ãåºããé»è²ãã¬ã¹ã«å ã¿è¾¼ã¾ããï¼", "A puff of yellow gas surrounds you!")); if (!p_ptr->free_act) { (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20)); @@ -638,17 +644,11 @@ static void chest_trap(int y, int x, s16b o_idx) if (trap & (CHEST_SUMMON)) { int num = 2 + randint1(3); -#ifdef JP - msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿±ì¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("You are enveloped in a cloud of smoke!"); -#endif - - + msg_print(_("çªå¦å¹ãåºããç ã«å ã¿è¾¼ã¾ããï¼", "You are enveloped in a cloud of smoke!")); for (i = 0; i < num; i++) { if (randint1(100)
* Note that you must tunnel in order to hit invisible monsters * in walls, though moving into walls still takes a turn anyway. * * Digging is very difficult without a "digger" weapon, but can be * accomplished by strong players using heavy weapons. + **/ void do_cmd_tunnel(void) { @@ -1696,8 +1593,8 @@ void do_cmd_tunnel(void) if (get_rep_dir(&dir,FALSE)) { /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -1709,35 +1606,23 @@ void do_cmd_tunnel(void) if (have_flag(f_info[feat].flags, FF_DOOR)) { /* Message */ -#ifdef JP - msg_print("¥É¥¢¤Ï·¡¤ì¤Ê¤¤¡£"); -#else - msg_print("You cannot tunnel through doors."); -#endif + msg_print(_("ãã¢ã¯æããªãã", "You cannot tunnel through doors.")); } /* No tunnelling through most features */ else if (!have_flag(f_info[feat].flags, FF_TUNNEL)) { -#ifdef JP - msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£"); -#else - msg_print("You can't tunnel through that."); -#endif + msg_print(_("ããã¯æããªãã", "You can't tunnel through that.")); } /* A monster is in the way */ else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ -#ifdef JP - msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª"); -#else - msg_print("There is a monster in the way!"); -#endif + msg_print(_("ã¢ã³ã¹ã¿ã¼ãç«ã¡ãµããã£ã¦ããï¼", "There is a monster in the way!")); /* Attack */ py_attack(y, x, 0); @@ -1758,15 +1643,19 @@ void do_cmd_tunnel(void) #ifdef ALLOW_EASY_OPEN /* TNB */ -/* +/*! + * @brief 移åå¦çã«ããç°¡æãªãéããå¦ç / * easy_open_door -- - * + * @return éãå¦çãå®éã«è©¦ã¿ãããå ´åTRUEãè¿ã + * @details + *
* If there is a jammed/closed/locked door at the given location, * then attempt to unlock/open it. Return TRUE if an attempt was * made (successful or not), otherwise return FALSE. * * The code here should be nearly identical to that in * do_cmd_open_test() and do_cmd_open_aux(). + **/ bool easy_open_door(int y, int x) { @@ -1786,11 +1675,7 @@ bool easy_open_door(int y, int x) if (!have_flag(f_ptr->flags, FF_OPEN)) { /* Stuck */ -#ifdef JP - msg_format("%s¤Ï¤¬¤Ã¤Á¤ê¤ÈÊĤ¸¤é¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£", f_name + f_info[get_feat_mimic(c_ptr)].name); -#else - msg_format("The %s appears to be stuck.", f_name + f_info[get_feat_mimic(c_ptr)].name); -#endif + msg_format(_("%sã¯ãã£ã¡ãã¨éãããã¦ããããã ã", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name); } @@ -1817,19 +1702,11 @@ bool easy_open_door(int y, int x) if (randint0(100) < j) { /* Message */ -#ifdef JP - msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£"); -#else - msg_print("You have picked the lock."); -#endif - + msg_print(_("éµãã¯ãããã", "You have picked the lock.")); /* Open the door */ cave_alter_feat(y, x, FF_OPEN); - /* Update some things */ - p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE); - /* Sound */ sound(SOUND_OPENDOOR); @@ -1844,11 +1721,7 @@ bool easy_open_door(int y, int x) if (flush_failure) flush(); /* Message */ -#ifdef JP - msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("You failed to pick the lock."); -#endif + msg_print(_("éµãã¯ãããªãã£ãã", "You failed to pick the lock.")); } } @@ -1859,9 +1732,6 @@ bool easy_open_door(int y, int x) /* Open the door */ cave_alter_feat(y, x, FF_OPEN); - /* Update some things */ - p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE); - /* Sound */ sound(SOUND_OPENDOOR); } @@ -1873,14 +1743,19 @@ bool easy_open_door(int y, int x) #endif /* ALLOW_EASY_OPEN -- TNB */ -/* +/*! + * @brief ç®±ã®ãã©ããã解é¤ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Perform the basic "disarm" command - * + * @param y 解é¤ãè¡ããã¹ã®Yåº§æ¨ + * @param x 解é¤ãè¡ããã¹ã®Xåº§æ¨ + * @param o_idx ç®±ã®ãªãã¸ã§ã¯ãID + * @return ã¿ã¼ã³ãæ¶è²»ããå¦çãè¡ãããå ´åTRUEãè¿ã + * @details + *
* Assume destination is a visible trap - * * Assume there is no monster blocking the destination - * * Returns TRUE if repeated commands may continue + **/ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) { @@ -1892,7 +1767,7 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Get the "disarm" factor */ i = p_ptr->skill_dis; @@ -1908,47 +1783,28 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) if (j < 2) j = 2; /* Must find the trap first. */ - if (!object_known_p(o_ptr)) + if (!object_is_known(o_ptr)) { -#ifdef JP - msg_print("¥È¥é¥Ã¥×¤¬¸«¤¢¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("I don't see any traps."); -#endif + msg_print(_("ãã©ãããè¦ããããªãã", "I don't see any traps.")); } /* Already disarmed/unlocked */ else if (o_ptr->pval <= 0) { -#ifdef JP - msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£"); -#else - msg_print("The chest is not trapped."); -#endif - + msg_print(_("ç®±ã«ã¯ãã©ãããä»æãããã¦ããªãã", "The chest is not trapped.")); } /* No traps to find. */ else if (!chest_traps[o_ptr->pval]) { -#ifdef JP - msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£"); -#else - msg_print("The chest is not trapped."); -#endif - + msg_print(_("ç®±ã«ã¯ãã©ãããä»æãããã¦ããªãã", "The chest is not trapped.")); } /* Success (get a lot of experience) */ else if (randint0(100) < j) { -#ifdef JP - msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¥È¥é¥Ã¥×¤ò²ò½ü¤·¤¿¡£"); -#else - msg_print("You have disarmed the chest."); -#endif - + msg_print(_("ç®±ã«ä»æãããã¦ãããã©ããã解é¤ããã", "You have disarmed the chest.")); gain_exp(o_ptr->pval); o_ptr->pval = (0 - o_ptr->pval); } @@ -1959,23 +1815,13 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) /* We may keep trying */ more = TRUE; if (flush_failure) flush(); -#ifdef JP - msg_print("È¢¤Î¥È¥é¥Ã¥×²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£"); -#else - msg_print("You failed to disarm the chest."); -#endif - + msg_print(_("ç®±ã®ãã©ãã解é¤ã«å¤±æããã", "You failed to disarm the chest.")); } /* Failure -- Set off the trap */ else { -#ifdef JP - msg_print("¥È¥é¥Ã¥×¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("You set off a trap!"); -#endif - + msg_print(_("ãã©ãããä½åããã¦ãã¾ã£ãï¼", "You set off a trap!")); sound(SOUND_FAIL); chest_trap(y, x, o_idx); } @@ -1985,14 +1831,19 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) } -/* +/*! + * @brief ç®±ã®ãã©ããã解é¤ããã³ãã³ãã®ãµãã«ã¼ãã³ / * Perform the basic "disarm" command - * + * @param y 解é¤ãè¡ããã¹ã®Yåº§æ¨ + * @param x 解é¤ãè¡ããã¹ã®Xåº§æ¨ + * @param dir ãã¬ã¤ã¤ã¼ããã¿ãæ¹åID + * @return ã¿ã¼ã³ãæ¶è²»ããå¦çãè¡ãããå ´åTRUEãè¿ã + * @details + *
* Assume destination is a visible trap - * * Assume there is no monster blocking the destination - * * Returns TRUE if repeated commands may continue + **/ #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -2024,7 +1875,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) int j; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Penalize some conditions */ if (p_ptr->blind || no_lite()) i = i / 10; @@ -2040,12 +1891,8 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) if (randint0(100) < j) { /* Message */ -#ifdef JP - msg_format("%s¤ò²ò½ü¤·¤¿¡£", name); -#else - msg_format("You have disarmed the %s.", name); -#endif - + msg_format(_("%sã解é¤ããã", "You have disarmed the %s."), name); + /* Reward */ gain_exp(power); @@ -2072,11 +1919,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) if (flush_failure) flush(); /* Message */ -#ifdef JP - msg_format("%s¤Î²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£", name); -#else - msg_format("You failed to disarm the %s.", name); -#endif + msg_format(_("%sã®è§£é¤ã«å¤±æããã", "You failed to disarm the %s."), name); /* We may keep trying */ more = TRUE; @@ -2086,11 +1929,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) else { /* Message */ -#ifdef JP - msg_format("%s¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª", name); -#else - msg_format("You set off the %s!", name); -#endif + msg_format(_("%sãä½åããã¦ãã¾ã£ãï¼", "You set off the %s!"), name); #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -2110,8 +1949,10 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) } -/* +/*! + * @brief ç®±ãåºã®ãã©ãã解é¤å¦çåæ¹ã®çµ±åã¡ã¤ã³ã«ã¼ãã³ / * Disarms a trap, or chest + * @return ãªã */ void do_cmd_disarm(void) { @@ -2170,8 +2011,8 @@ void do_cmd_disarm(void) s16b feat; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid and contents */ c_ptr = &cave[y][x]; @@ -2180,30 +2021,20 @@ void do_cmd_disarm(void) feat = get_feat_mimic(c_ptr); /* Check for chests */ - o_idx = chest_check(y, x); + o_idx = chest_check(y, x, TRUE); /* Disarm a trap */ if (!is_trap(feat) && !o_idx) { /* Message */ -#ifdef JP - msg_print("¤½¤³¤Ë¤Ï²ò½ü¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("You see nothing there to disarm."); -#endif - + msg_print(_("ããã«ã¯è§£é¤ãããã®ãè¦å½ãããªãã", "You see nothing there to disarm.")); } /* Monster in the way */ else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx) { /* Message */ -#ifdef JP - msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª"); -#else - msg_print("There is a monster in the way!"); -#endif - + msg_print(_("ã¢ã³ã¹ã¿ã¼ãç«ã¡ãµããã£ã¦ããï¼", "There is a monster in the way!")); /* Attack */ py_attack(y, x, 0); @@ -2229,40 +2060,44 @@ void do_cmd_disarm(void) } -/* +/*! + * @brief ãæã¡ç ´ããåä½ã³ãã³ãã®ãµãã«ã¼ãã³ / * Perform the basic "bash" command - * + * @param y 対象ãè¡ããã¹ã®Yåº§æ¨ + * @param x 対象ãè¡ããã¹ã®Xåº§æ¨ + * @param dir ãã¬ã¤ã¤ã¼ããè¦ãã¿ã¼ã²ããã®æ¹è§ID + * @return å®éã«å¦çãè¡ãããå ´åTRUEãè¿ãã + * @details + *
* Assume destination is a closed/locked/jammed door - * * Assume there is no monster blocking the destination - * * Returns TRUE if repeated commands may continue + **/ static bool do_cmd_bash_aux(int y, int x, int dir) { /* Get grid */ cave_type *c_ptr = &cave[y][x]; + /* Get feature */ + feature_type *f_ptr = &f_info[c_ptr->feat]; + /* Hack -- Bash power based on strength */ /* (Ranges from 3 to 20 to 100 to 200) */ int bash = adj_str_blow[p_ptr->stat_ind[A_STR]]; /* Extract door power */ - int temp = f_info[c_ptr->feat].power; + int temp = f_ptr->power; bool more = FALSE; cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ -#ifdef JP - msg_format("%s¤ËÂÎÅö¤¿¤ê¤ò¤·¤¿¡ª", name); -#else - msg_format("You smash into the %s!", name); -#endif + msg_format(_("%sã«ä½å½ãããããï¼", "You smash into the %s!"), name); /* Compare bash power to door power XXX XXX XXX */ temp = (bash - (temp * 10)); @@ -2276,15 +2111,13 @@ static bool do_cmd_bash_aux(int y, int x, int dir) if (randint0(100) < temp) { /* Message */ -#ifdef JP - msg_format("%s¤ò²õ¤·¤¿¡ª", name); -#else - msg_format("The %s crashes open!", name); -#endif + msg_format(_("%sãå£ããï¼", "The %s crashes open!"), name); + /* Sound */ + sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR); /* Break down the door */ - if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat)) + if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS)) { cave_alter_feat(y, x, FF_BASH); } @@ -2295,15 +2128,8 @@ static bool do_cmd_bash_aux(int y, int x, int dir) cave_alter_feat(y, x, FF_OPEN); } - /* Sound */ - sound(SOUND_OPENDOOR); - /* Hack -- Fall through the door */ move_player(dir, FALSE, FALSE); - - /* Update some things */ - p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE); - p_ptr->update |= (PU_DISTANCE); } /* Saving throw against stun */ @@ -2311,12 +2137,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir) p_ptr->lev) { /* Message */ -#ifdef JP - msg_format("¤³¤Î%s¤Ï´è¾æ¤À¡£", name); -#else - msg_format("The %s holds firm.", name); -#endif - + msg_format(_("ãã®%sã¯é ä¸ã ã", "The %s holds firm."), name); /* Allow repeated bashing */ more = TRUE; @@ -2326,12 +2147,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir) else { /* Message */ -#ifdef JP - msg_print("ÂΤΥХé¥ó¥¹¤ò¤¯¤º¤·¤Æ¤·¤Þ¤Ã¤¿¡£"); -#else - msg_print("You are off-balance."); -#endif - + msg_print(_("ä½ã®ãã©ã³ã¹ããããã¦ãã¾ã£ãã", "You are off-balance.")); /* Hack -- Lose balance ala paralysis */ (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2)); @@ -2342,9 +2158,12 @@ static bool do_cmd_bash_aux(int y, int x, int dir) } -/* +/*! + * @brief ãæã¡ç ´ããåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Bash open a door, success based on character strength - * + * @return ãªã + * @details + *
* For a closed door, pval is positive if locked; negative if stuck. * * For an open door, pval is positive for a broken door. @@ -2355,6 +2174,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir) * be bashed. A closed door can be jammed (see do_cmd_spike()). * * Creatures can also open or bash doors, see elsewhere. + **/ void do_cmd_bash(void) { @@ -2389,8 +2209,8 @@ void do_cmd_bash(void) s16b feat; /* Bash location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -2402,27 +2222,17 @@ void do_cmd_bash(void) if (!have_flag(f_info[feat].flags, FF_BASH)) { /* Message */ -#ifdef JP - msg_print("¤½¤³¤Ë¤ÏÂÎÅö¤¿¤ê¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("You see nothing there to bash."); -#endif - + msg_print(_("ããã«ã¯ä½å½ãããããã®ãè¦å½ãããªãã", "You see nothing there to bash.")); } /* Monster in the way */ else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ -#ifdef JP - msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª"); -#else - msg_print("There is a monster in the way!"); -#endif - + msg_print(_("ã¢ã³ã¹ã¿ã¼ãç«ã¡ãµããã£ã¦ããï¼", "There is a monster in the way!")); /* Attack */ py_attack(y, x, 0); @@ -2441,7 +2251,11 @@ void do_cmd_bash(void) } -/* +/*! + * @brief ç¹å®ã®ãã¹ã«å½±é¿ãåã¼ãããã®æ±ç¨çã³ãã³ã + * @return ãªã + * @details + *
* Manipulate an adjacent grid in some way * * Attack monsters, tunnel through walls, disarm traps, open doors. @@ -2450,6 +2264,7 @@ void do_cmd_bash(void) * * This command must always take a turn, to prevent free detection * of invisible monsters. + **/ void do_cmd_alter(void) { @@ -2485,8 +2300,8 @@ void do_cmd_alter(void) feature_type *f_ptr; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -2496,7 +2311,7 @@ void do_cmd_alter(void) f_ptr = &f_info[feat]; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Attack monsters */ if (c_ptr->m_idx) @@ -2539,12 +2354,7 @@ void do_cmd_alter(void) else { /* Oops */ -#ifdef JP - msg_print("²¿¤â¤Ê¤¤¶õÃæ¤ò¹¶·â¤·¤¿¡£"); -#else - msg_print("You attack the empty air."); -#endif - + msg_print(_("ä½ããªã空ä¸ãæ»æããã", "You attack the empty air.")); } } @@ -2553,10 +2363,16 @@ void do_cmd_alter(void) } -/* + +/*! + * @brief ãããã³ãæã¤ãããã«å¿ è¦ãªãªãã¸ã§ã¯ãããããã©ããã®å¤å®ãè¿ã / * Find the index of some "spikes", if possible. - * + * @param ip ããã³ã¨ãã¦æã¦ããªãã¸ã§ã¯ãã®ID + * @return ãªãã¸ã§ã¯ããããå ´åTRUEãè¿ã + * @details + *
* XXX XXX XXX Let user choose a pile of spikes, perhaps? + **/ static bool get_spike(int *ip) { @@ -2586,10 +2402,14 @@ static bool get_spike(int *ip) } -/* +/*! + * @brief ãããã³ãæã¤ãåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Jam a closed door with a spike - * + * @return ãªã + * @details + *
* This command may NOT be repeated + **/ void do_cmd_spike(void) { @@ -2608,8 +2428,8 @@ void do_cmd_spike(void) s16b feat; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid and contents */ c_ptr = &cave[y][x]; @@ -2621,37 +2441,24 @@ void do_cmd_spike(void) if (!have_flag(f_info[feat].flags, FF_SPIKE)) { /* Message */ -#ifdef JP - msg_print("¤½¤³¤Ë¤Ï¤¯¤µ¤Ó¤òÂǤƤë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£"); -#else - msg_print("You see nothing there to spike."); -#endif - + msg_print(_("ããã«ã¯ããã³ãæã¦ããã®ãè¦å½ãããªãã", "You see nothing there to spike.")); } /* Get a spike */ else if (!get_spike(&item)) { /* Message */ -#ifdef JP - msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡ª"); -#else - msg_print("You have no spikes!"); -#endif + msg_print(_("ããã³ãæã£ã¦ããªãï¼", "You have no spikes!")); } /* Is a monster in the way? */ else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ -#ifdef JP - msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª"); -#else - msg_print("There is a monster in the way!"); -#endif + msg_print(_("ã¢ã³ã¹ã¿ã¼ãç«ã¡ãµããã£ã¦ããï¼", "There is a monster in the way!")); /* Attack */ py_attack(y, x, 0); @@ -2661,15 +2468,10 @@ void do_cmd_spike(void) else { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Successful jamming */ -#ifdef JP - msg_format("%s¤Ë¤¯¤µ¤Ó¤òÂǤÁ¹þ¤ó¤À¡£", f_name + f_info[feat].name); -#else - msg_format("You jam the %s with a spike.", f_name + f_info[feat].name); -#endif - + msg_format(_("%sã«ããã³ãæã¡è¾¼ãã ã", "You jam the %s with a spike."), f_name + f_info[feat].name); cave_alter_feat(y, x, FF_SPIKE); /* Use up, and describe, a single spike, from the bottom */ @@ -2682,8 +2484,11 @@ void do_cmd_spike(void) -/* +/*! + * @brief ãæ©ããåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Support code for the "Walk" and "Jump" commands + * @param pickup ã¢ã¤ãã ã®èªåæ¾ããè¡ããªãTRUE + * @return ãªã */ void do_cmd_walk(bool pickup) { @@ -2709,7 +2514,7 @@ void do_cmd_walk(bool pickup) if (get_rep_dir(&dir,FALSE)) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU)) { @@ -2717,8 +2522,8 @@ void do_cmd_walk(bool pickup) } /* Hack -- In small scale wilderness it takes MUCH more time to move */ - if (p_ptr->wild_mode) energy_use *= ((MAX_HGT + MAX_WID) / 2); - if (p_ptr->action == ACTION_HAYAGAKE) energy_use = energy_use * (45-(p_ptr->lev/2)) / 100; + if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2); + if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100; /* Actually move the character */ move_player(dir, pickup, FALSE); @@ -2728,19 +2533,15 @@ void do_cmd_walk(bool pickup) } /* Hack again -- Is there a special encounter ??? */ - if (p_ptr->wild_mode && !have_flag(f_flags_bold(py, px), FF_TOWN)) + if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN)) { - int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5; + int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5; if (tmp < 1) tmp = 1; - if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl)) + if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl)) { /* Inform the player of his horrible fate :=) */ -#ifdef JP - msg_print("½±·â¤À¡ª"); -#else - msg_print("You are ambushed !"); -#endif + msg_print(_("襲æã ï¼", "You are ambushed !")); /* Go into large wilderness view */ p_ptr->oldpy = randint1(MAX_HGT-2); @@ -2748,7 +2549,7 @@ void do_cmd_walk(bool pickup) change_wild_mode(); /* Give first move to monsters */ - energy_use = 100; + p_ptr->energy_use = 100; /* HACk -- set the encouter flag for the wilderness generation */ generate_encounter = TRUE; @@ -2760,9 +2561,10 @@ void do_cmd_walk(bool pickup) } - -/* +/*! + * @brief ãèµ°ããåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Start running. + * @return ãªã */ void do_cmd_run(void) { @@ -2771,12 +2573,7 @@ void do_cmd_run(void) /* Hack -- no running when confused */ if (p_ptr->confused) { -#ifdef JP - msg_print("º®Í𤷤Ƥ¤¤ÆÁö¤ì¤Ê¤¤¡ª"); -#else - msg_print("You are too confused!"); -#endif - + msg_print(_("æ··ä¹±ãã¦ãã¦èµ°ããªãï¼", "You are too confused!")); return; } @@ -2797,10 +2594,12 @@ void do_cmd_run(void) } - -/* +/*! + * @brief ãçã¾ããåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Stay still. Search. Enter stores. * Pick up treasure if "pickup" is true. + * @param pickup ã¢ã¤ãã ã®èªåæ¾ããè¡ããªãTRUE + * @return ãªã */ void do_cmd_stay(bool pickup) { @@ -2820,16 +2619,17 @@ void do_cmd_stay(bool pickup) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (pickup) mpe_mode |= MPE_DO_PICKUP; - (void)move_player_effect(py, px, py, px, mpe_mode); + (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode); } - -/* +/*! + * @brief ãä¼ããåä½ã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / * Resting allows a player to safely restore his hp -RAK- + * @return ãªã */ void do_cmd_rest(void) { @@ -2841,14 +2641,14 @@ void do_cmd_rest(void) stop_singing(); } + /* Hex */ + if (hex_spelling_any()) stop_hex_spell_all(); + /* Prompt for time if needed */ if (command_arg <= 0) { -#ifdef JP - cptr p = "µÙ·Æ (0-9999, '*' ¤Ç HP/MPÁ´²÷, '&' ¤ÇɬÍפʤÀ¤±): "; -#else - cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): "; -#endif + cptr p = _("ä¼æ© (0-9999, '*' 㧠HP/MPå ¨å¿«, '&' ã§å¿ è¦ãªã ã): ", + "Rest (0-9999, '*' for HP/SP, '&' as needed): "); char out_val[80]; @@ -2886,7 +2686,7 @@ void do_cmd_rest(void) if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE); /* Take a turn XXX XXX XXX (?) */ - energy_use = 100; + p_ptr->energy_use = 100; /* The sin of sloth */ if (command_arg > 100) @@ -2921,15 +2721,30 @@ void do_cmd_rest(void) } -/* +/*! + * @brief ç¢å¼¾ãå°æããå ´åã®ç ´æ確çãè¿ã / * Determines the odds of an object breaking when thrown at a monster - * + * @param o_ptr ç¢å¼¾ã®ãªãã¸ã§ã¯ãæ§é ä½åç §ãã¤ã³ã¿ + * @return ç ´æ確ç(%) + * @details * Note that artifacts never break, see the "drop_near()" function. */ static int breakage_chance(object_type *o_ptr) { int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0); + /* Examine the snipe type */ + if (snipe_type) + { + if (snipe_type == SP_KILL_WALL) return (100); + if (snipe_type == SP_EXPLODE) return (100); + if (snipe_type == SP_PIERCE) return (100); + if (snipe_type == SP_FINAL) return (100); + if (snipe_type == SP_NEEDLE) return (100); + if (snipe_type == SP_EVILNESS) return (40); + if (snipe_type == SP_HOLYNESS) return (40); + } + /* Examine the item type */ switch (o_ptr->tval) { @@ -2964,6 +2779,14 @@ static int breakage_chance(object_type *o_ptr) } +/*! + * @brief ç¢å¼¾ãå°æããéã®ã¹ã¬ã¤åçããããçµæãè¿ã / + * Determines the odds of an object breaking when thrown at a monster + * @param o_ptr ç¢å¼¾ã®ãªãã¸ã§ã¯ãæ§é ä½åç §ãã¤ã³ã¿ + * @param tdam è¨ç®éä¸ã®ãã¡ã¼ã¸é + * @param m_ptr ç®æ¨ã¢ã³ã¹ã¿ã¼ã®æ§é ä½åç §ãã¤ã³ã¿ + * @return ã¹ã¬ã¤åçãããããã¡ã¼ã¸é + */ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) { int mult = 10; @@ -2986,7 +2809,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_ANIMAL; } @@ -2998,7 +2821,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_ANIMAL; } @@ -3010,7 +2833,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_EVIL; } @@ -3022,7 +2845,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_EVIL; } @@ -3034,7 +2857,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags2 |= RF2_HUMAN; } @@ -3046,7 +2869,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags2 |= RF2_HUMAN; } @@ -3058,7 +2881,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_UNDEAD; } @@ -3070,7 +2893,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_UNDEAD; } @@ -3082,7 +2905,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_DEMON; } @@ -3094,7 +2917,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_DEMON; } @@ -3106,7 +2929,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_ORC; } @@ -3118,7 +2941,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_ORC)) && (r_ptr->flags3 & RF3_ORC)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_ORC; } @@ -3130,7 +2953,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_TROLL; } @@ -3142,7 +2965,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_TROLL; } @@ -3154,7 +2977,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_GIANT; } @@ -3166,7 +2989,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_GIANT; } @@ -3178,7 +3001,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_DRAGON; } @@ -3190,7 +3013,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if ((have_flag(flgs, TR_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_DRAGON; } @@ -3209,7 +3032,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) /* Notice immunity */ if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK); } @@ -3228,7 +3051,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) /* Notice immunity */ if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK); } @@ -3247,7 +3070,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) /* Notice immunity */ if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK); } @@ -3259,7 +3082,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if (r_ptr->flags3 & RF3_HURT_FIRE) { if (mult < 25) mult = 25; - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_HURT_FIRE; } @@ -3274,7 +3097,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) /* Notice immunity */ if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK); } @@ -3285,7 +3108,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) if (r_ptr->flags3 & RF3_HURT_COLD) { if (mult < 25) mult = 25; - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags3 |= RF3_HURT_COLD; } @@ -3300,7 +3123,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) /* Notice immunity */ if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK) { - if (m_ptr->ml && is_original_ap(m_ptr)) + if (is_original_ap_and_seen(m_ptr)) { r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK); } @@ -3323,14 +3146,22 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) } } + /* Sniper */ + if (snipe_type) mult = tot_dam_aux_snipe(mult, m_ptr); + /* Return the total damage */ return (tdam * mult / 10); } -/* +/*! + * @brief å°æå¦çã®ãµãã«ã¼ãã³ / * Fire an object from the pack or floor. - * + * @param item å°æãããªãã¸ã§ã¯ãã®ææID + * @param j_ptr å°ææ¦å¨ã®ãªãã¸ã§ã¯ãåç §ãã¤ã³ã¿ + * @return ãªã + * @details + *
* You may only fire items that "match" your missile launcher. * * You must use slings + pebbles/shots, bows + arrows, xbows + bolts. @@ -3355,12 +3186,13 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) * for the damage multiplier. * * Note that Bows of "Extra Shots" give an extra shot. + **/ void do_cmd_fire_aux(int item, object_type *j_ptr) { int dir; - int j, y, x, ny, nx, ty, tx; - int tdam, tdis, thits, tmul; + int i, j, y, x, ny, nx, ty, tx, prev_y, prev_x; + int tdam_base, tdis, thits, tmul; int bonus, chance; int cur_dis, visible; @@ -3373,6 +3205,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) char o_name[MAX_NLEN]; + u16b path_g[512]; /* For calcuration of path length */ + int msec = delay_factor * delay_factor * delay_factor; /* STICK TO */ @@ -3388,10 +3222,12 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) o_ptr = &o_list[0 - item]; } + /* Sniper - Cannot shot a single arrow twice */ + if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE; + /* Describe the object */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX); - /* Use the proper number of shots */ thits = p_ptr->num_fire; @@ -3399,7 +3235,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) tdis = 10; /* Base damage from thrown object plus launcher bonus */ - tdam = damroll(o_ptr->dd, o_ptr->ds) + o_ptr->to_d + j_ptr->to_d; + tdam_base = damroll(o_ptr->dd, o_ptr->ds) + o_ptr->to_d + j_ptr->to_d; /* Actually "fire" the object */ bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h); @@ -3408,7 +3244,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) else chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ); - energy_use = bow_energy(j_ptr->sval); + p_ptr->energy_use = bow_energy(j_ptr->sval); tmul = bow_tmul(j_ptr->sval); /* Get extra "power" from "extra might" */ @@ -3417,33 +3253,36 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128); /* Boost the damage */ - tdam *= tmul; - tdam /= 100; + tdam_base *= tmul; + tdam_base /= 100; /* Base range */ - tdis = 10 + tmul/40; + tdis = 13 + tmul/80; if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW)) - tdis -= 5; + { + if (p_ptr->concent) + tdis -= (5 - (p_ptr->concent + 1) / 2); + else + tdis -= 5; + } project_length = tdis + 1; /* Get a direction (or cancel) */ if (!get_aim_dir(&dir)) { - energy_use = 0; + p_ptr->energy_use = 0; + + if (snipe_type == SP_AWAY) snipe_type = SP_NONE; /* need not to reset project_length (already did)*/ return; } - /* Start at the player */ - y = py; - x = px; - /* Predict the "target" location */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) @@ -3452,12 +3291,15 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) ty = target_row; } + /* Get projection path length */ + tdis = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1; + project_length = 0; /* reset to default */ /* Don't shoot at my feet */ - if (tx == px && ty == py) + if (tx == p_ptr->x && ty == p_ptr->y) { - energy_use = 0; + p_ptr->energy_use = 0; /* project_length is already reset to 0 */ @@ -3465,6 +3307,21 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) } + /* Take a (partial) turn */ + p_ptr->energy_use = (p_ptr->energy_use / thits); + is_fired = TRUE; + + /* Sniper - Difficult to shot twice at 1 turn */ + if (snipe_type == SP_DOUBLE) p_ptr->concent = (p_ptr->concent + 1) / 2; + + /* Sniper - Repeat shooting when double shots */ + for (i = 0; i < ((snipe_type == SP_DOUBLE) ? 2 : 1); i++) + { + + /* Start at the player */ + y = p_ptr->y; + x = p_ptr->x; + /* Get local object */ q_ptr = &forge; @@ -3489,36 +3346,70 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) floor_item_optimize(0 - item); } - /* Sound */ sound(SOUND_SHOOT); - - /* Take a (partial) turn */ - energy_use = (energy_use / thits); - - /* Hack -- Handle stuff */ handle_stuff(); + /* Save the old location */ + prev_y = y; + prev_x = x; + + /* The shot does not hit yet */ + hit_body = FALSE; /* Travel until stopped */ for (cur_dis = 0; cur_dis <= tdis; ) { + cave_type *c_ptr; + /* Hack -- Stop at the target */ if ((y == ty) && (x == tx)) break; /* Calculate the new location (see "project()") */ ny = y; nx = x; - mmove2(&ny, &nx, py, px, ty, tx); + mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx); + + /* Shatter Arrow */ + if (snipe_type == SP_KILL_WALL) + { + c_ptr = &cave[ny][nx]; + + if (cave_have_flag_grid(c_ptr, FF_HURT_ROCK) && !c_ptr->m_idx) + { + if (c_ptr->info & (CAVE_MARK)) msg_print(_("岩ãç ãæ£ã£ãã", "Wall rocks were shattered.")); + /* Forget the wall */ + c_ptr->info &= ~(CAVE_MARK); + + p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE); + + /* Destroy the wall */ + cave_alter_feat(ny, nx, FF_HURT_ROCK); + + hit_body = TRUE; + break; + } + } /* Stopped by walls/doors */ - if (!have_flag(f_flags_bold(ny, nx), FF_PROJECT) && !cave[ny][nx].m_idx) break; + if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !cave[ny][nx].m_idx) break; /* Advance the distance */ cur_dis++; + /* Sniper */ + if (snipe_type == SP_LITE) + { + cave[ny][nx].info |= (CAVE_GLOW); + + /* Notice */ + note_spot(ny, nx); + + /* Redraw */ + lite_spot(ny, nx); + } /* The player can see the (on screen) missile */ if (panel_contains(ny, nx) && player_can_see_bold(ny, nx)) @@ -3542,6 +3433,29 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) Term_xtra(TERM_XTRA_DELAY, msec); } + /* Sniper */ + if (snipe_type == SP_KILL_TRAP) + { + project(0, 0, ny, nx, 0, GF_KILL_TRAP, + (PROJECT_JUMP | PROJECT_HIDE | PROJECT_GRID | PROJECT_ITEM), -1); + } + + /* Sniper */ + if (snipe_type == SP_EVILNESS) + { + cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); + + /* Notice */ + note_spot(ny, nx); + + /* Redraw */ + lite_spot(ny, nx); + } + + /* Save the old location */ + prev_y = y; + prev_x = x; + /* Save the new location */ x = nx; y = ny; @@ -3550,9 +3464,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Monster here, Try to hit it */ if (cave[y][x].m_idx) { - cave_type *c_ptr = &cave[y][x]; + cave_type *c_mon_ptr = &cave[y][x]; - monster_type *m_ptr = &m_list[c_ptr->m_idx]; + monster_type *m_ptr = &m_list[c_mon_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Check the visibility */ @@ -3561,7 +3475,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Note the collision */ hit_body = TRUE; - if (m_ptr->csleep) + if (MON_CSLEEP(m_ptr)) { if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1); if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1); @@ -3594,20 +3508,19 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) } /* Did we hit it (penalize range) */ - if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml)) + if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name)) { bool fear = FALSE; + int tdam = tdam_base; + + /* Get extra damage from concentration */ + if (p_ptr->concent) tdam = boost_concentration_damage(tdam); /* Handle unseen monster */ if (!visible) { /* Invisible monster */ -#ifdef JP - msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name); -#else - msg_format("The %s finds a mark.", o_name); -#endif - + msg_format(_("%sãæµãææããã", "The %s finds a mark."), o_name); } /* Handle visible monster */ @@ -3619,45 +3532,74 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) monster_desc(m_name, m_ptr, 0); /* Message */ -#ifdef JP - msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name); -#else - msg_format("The %s hits %s.", o_name, m_name); -#endif + msg_format(_("%sã%sã«å½ä¸ããã", "The %s hits %s."), o_name, m_name); + + if (m_ptr->ml) + { + /* Hack -- Track this monster race */ + if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); + + /* Hack -- Track this monster */ + health_track(c_mon_ptr->m_idx); + } + } + if (snipe_type == SP_NEEDLE) + { + if ((randint1(randint1(r_ptr->level / (3 + p_ptr->concent)) + (8 - p_ptr->concent)) == 1) + && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)) + { + char m_name[80]; - /* Hack -- Track this monster race */ - if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx); + /* Get "the monster" or "it" */ + monster_desc(m_name, m_ptr, 0); - /* Hack -- Track this monster */ - if (m_ptr->ml) health_track(c_ptr->m_idx); + tdam = m_ptr->hp + 1; + msg_format(_("%sã®æ¥æã«çªãåºãã£ãï¼", "Your shot sticked on a fatal spot of %s!"), m_name); + } + else tdam = 1; } + else + { + /* Apply special damage XXX XXX XXX */ + tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr); + tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam); - /* Apply special damage XXX XXX XXX */ - tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr); - tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam); + /* No negative damage */ + if (tdam < 0) tdam = 0; - /* No negative damage */ - if (tdam < 0) tdam = 0; + /* Modify the damage */ + tdam = mon_damage_mod(m_ptr, tdam, FALSE); + } - /* Modify the damage */ - tdam = mon_damage_mod(m_ptr, tdam, FALSE); + msg_format_wizard(CHEAT_MONSTER, + _("%dã®ãã¡ã¼ã¸ãä¸ããã(æ®ãHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), + tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp); - /* Complex message */ - if (p_ptr->wizard || cheat_xtra) + /* Sniper */ + if (snipe_type == SP_EXPLODE) { -#ifdef JP - msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", - tdam, m_ptr->hp); -#else - msg_format("You do %d (out of %d) damage.", - tdam, m_ptr->hp); -#endif + u16b flg = (PROJECT_STOP | PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID); + + sound(SOUND_EXPLODE); /* No explode sound - use breath fire instead */ + project(0, ((p_ptr->concent + 1) / 2 + 1), ny, nx, tdam, GF_MISSILE, flg, -1); + break; + } + + /* Sniper */ + if (snipe_type == SP_HOLYNESS) + { + cave[ny][nx].info |= (CAVE_GLOW); + + /* Notice */ + note_spot(ny, nx); + /* Redraw */ + lite_spot(ny, nx); } /* Hit the monster, check for death */ - if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) + if (mon_take_hit(c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) { /* Dead monster */ } @@ -3666,22 +3608,19 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) else { /* STICK TO */ - if (q_ptr->name1) + if (object_is_fixed_artifact(q_ptr) && + (p_ptr->pclass != CLASS_SNIPER || p_ptr->concent == 0)) { char m_name[80]; monster_desc(m_name, m_ptr, 0); stick_to = TRUE; -#ifdef JP - msg_format("%s¤Ï%s¤ËÆͤ»É¤µ¤Ã¤¿¡ª",o_name, m_name); -#else - msg_format("%^s have stuck into %s!",o_name, m_name); -#endif + msg_format(_("%sã¯%sã«çªãåºãã£ãï¼", "%^s have stuck into %s!"),o_name, m_name); } /* Message */ - message_pain(c_ptr->m_idx, tdam); + message_pain(c_mon_ptr->m_idx, tdam); /* Anger the monster */ if (tdam > 0) anger_monster(m_ptr); @@ -3698,20 +3637,68 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) monster_desc(m_name, m_ptr, 0); /* Message */ -#ifdef JP - msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name); -#else - msg_format("%^s flees in terror!", m_name); -#endif - + msg_format(_("%^sã¯ææãã¦éãåºããï¼", "%^s flees in terror!"), m_name); } - if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) + + set_target(m_ptr, p_ptr->y, p_ptr->x); + + /* Sniper */ + if (snipe_type == SP_RUSH) { - set_target(m_ptr, py, px); + int n = randint1(5) + 3; + int m_idx = c_mon_ptr->m_idx; + + for ( ; cur_dis <= tdis; ) + { + int ox = nx; + int oy = ny; + + if (!n) break; + + /* Calculate the new location (see "project()") */ + mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx); + + /* Stopped by wilderness boundary */ + if (!in_bounds2(ny, nx)) break; + + /* Stopped by walls/doors */ + if (!player_can_enter(cave[ny][nx].feat, 0)) break; + + /* Stopped by monsters */ + if (!cave_empty_bold(ny, nx)) break; + + cave[ny][nx].m_idx = m_idx; + cave[oy][ox].m_idx = 0; + + m_ptr->fx = nx; + m_ptr->fy = ny; + + /* Update the monster (new location) */ + update_mon(c_mon_ptr->m_idx, TRUE); + + lite_spot(ny, nx); + lite_spot(oy, ox); + + Term_fresh(); + Term_xtra(TERM_XTRA_DELAY, msec); + + x = nx; + y = ny; + cur_dis++; + n--; + } } } } + /* Sniper */ + if (snipe_type == SP_PIERCE) + { + if(p_ptr->concent < 1) break; + p_ptr->concent--; + continue; + } + /* Stop looking */ break; } @@ -3720,31 +3707,27 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Chance of breakage (during attacks) */ j = (hit_body ? breakage_chance(q_ptr) : 0); - if(stick_to) + if (stick_to) { int m_idx = cave[y][x].m_idx; monster_type *m_ptr = &m_list[m_idx]; int o_idx = o_pop(); if (!o_idx) - { -#ifdef JP - msg_format("%s¤Ï¤É¤³¤«¤Ø¹Ô¤Ã¤¿¡£", o_name); -#else - msg_format("The %s have gone to somewhere.", o_name); -#endif - if (q_ptr->name1) - { - a_info[j_ptr->name1].cur_num = 0; - } - return; - } - - o_ptr = &o_list[ o_idx ]; + { + msg_format(_("%sã¯ã©ããã¸è¡ã£ãã", "The %s have gone to somewhere."), o_name); + if (object_is_fixed_artifact(q_ptr)) + { + a_info[j_ptr->name1].cur_num = 0; + } + return; + } + + o_ptr = &o_list[o_idx]; object_copy(o_ptr, q_ptr); /* Forget mark */ - o_ptr->marked = 0; + o_ptr->marked &= OM_TOUCHED; /* Forget location */ o_ptr->iy = o_ptr->ix = 0; @@ -3757,42 +3740,58 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Carry object */ m_ptr->hold_o_idx = o_idx; - } - else + else if (cave_have_flag_bold(y, x, FF_PROJECT)) + { /* Drop (or break) near that location */ (void)drop_near(q_ptr, j, y, x); -} + } + else + { + /* Drop (or break) near that location */ + (void)drop_near(q_ptr, j, prev_y, prev_x); + } + /* Sniper - Repeat shooting when double shots */ + } + + /* Sniper - Loose his/her concentration after any shot */ + if (p_ptr->concent) reset_concentration(FALSE); +} +/*! + * @brief å°æå¦çã®ã¡ã¤ã³ã«ã¼ãã³ + * @return ãªã + */ void do_cmd_fire(void) { int item; object_type *j_ptr; cptr q, s; + is_fired = FALSE; /* not fired yet */ + /* Get the "bow" (if any) */ j_ptr = &inventory[INVEN_BOW]; /* Require a launcher */ if (!j_ptr->tval) { -#ifdef JP - msg_print("¼Í·âÍѤÎÉð´ï¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£"); -#else - msg_print("You have nothing to fire with."); -#endif + msg_print(_("å°æç¨ã®æ¦å¨ãæã£ã¦ããªãã", "You have nothing to fire with.")); flush(); return; } if (j_ptr->sval == SV_CRIMSON) { -#ifdef JP - msg_print("¤³¤ÎÉð´ï¤Ïȯư¤·¤Æ»È¤¦¤â¤Î¤Î¤è¤¦¤À¡£"); -#else - msg_print("Do activate."); -#endif + msg_print(_("ãã®æ¦å¨ã¯çºåãã¦ä½¿ããã®ã®ããã ã", "Do activate.")); + flush(); + return; + } + + if (j_ptr->sval == SV_HARP) + { + msg_print(_("ãã®æ¦å¨ã§å°æã¯ã§ããªãã", "It's not for firing.")); flush(); return; } @@ -3807,14 +3806,8 @@ void do_cmd_fire(void) item_tester_tval = p_ptr->tval_ammo; /* Get an item */ -#ifdef JP - q = "¤É¤ì¤ò·â¤Á¤Þ¤¹¤«? "; - s = "ȯ¼Í¤µ¤ì¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Fire which item? "; - s = "You have nothing to fire."; -#endif - + q = _("ã©ããæã¡ã¾ãã? ", "Fire which item? "); + s = _("çºå°ãããã¢ã¤ãã ãããã¾ããã", "You have nothing to fire."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) { flush(); @@ -3823,9 +3816,27 @@ void do_cmd_fire(void) /* Fire the item */ do_cmd_fire_aux(item, j_ptr); -} + if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return; + /* Sniper actions after some shootings */ + if (snipe_type == SP_AWAY) + { + teleport_player(10 + (p_ptr->concent * 2), 0L); + } + if (snipe_type == SP_FINAL) + { + msg_print(_("å°æã®ååãä½ã襲ã£ãã", "A reactionary of shooting attacked you. ")); + (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE); + (void)set_stun(p_ptr->stun + randint1(25)); + } +} + +/*! + * @brief ãªãã¸ã§ã¯ããæå°å¯è½ãªæ¦å¨ãã©ãããè¿ãã + * @param o_ptr å¤å®ãããªãã¸ã§ã¯ãã®æ§é ä½åç §ãã¤ã³ã¿ + * @return æå°å¯è½ãªæ¦å¨ãªãã°TRUE + */ static bool item_tester_hook_boomerang(object_type *o_ptr) { if ((o_ptr->tval==TV_DIGGING) || (o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM) || (o_ptr->tval == TV_HAFTED)) return (TRUE); @@ -3835,22 +3846,29 @@ static bool item_tester_hook_boomerang(object_type *o_ptr) } -/* +/*! + * @brief æå°å¦çã®ãµãã«ã¼ãã³ / * Throw an object from the pack or floor. - * + * @param mult å¨åã®åç + * @param boomerang ãã¼ã¡ã©ã³å¦çãªãã°TRUE + * @param shuriken å¿è ã®æè£å£å¦çãªãã°TRUE + * @return ã¿ã¼ã³ãæ¶è²»ããå ´åTRUEãè¿ã + * @details + *
* Note: "unseen" monsters are very hard to hit. * * Should throwing a weapon do full damage? Should it allow the magic * to hit bonus of the weapon to have an effect? Should it ever cause * the item to be destroyed? Should it do any damage at all? + **/ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) { int dir, item; - int i, j, y, x, ty, tx; + int i, j, y, x, ty, tx, prev_y, prev_x; int ny[19], nx[19]; int chance, tdam, tdis; - int mul, div; + int mul, div, dd, ds; int cur_dis, visible; object_type forge; @@ -3878,45 +3896,31 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) set_action(ACTION_NONE); } - if (shuriken) + if (shuriken >= 0) { item = shuriken; } else if (boomerang) { - if (buki_motteruka(INVEN_LARM)) + if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) { item_tester_hook = item_tester_hook_boomerang; -#ifdef JP - q = "¤É¤ÎÉð´ï¤òÅꤲ¤Þ¤¹¤«? "; - s = "Åꤲ¤ëÉð´ï¤¬¤Ê¤¤¡£"; -#else - q = "Throw which item? "; - s = "You have nothing to throw."; -#endif - + q = _("ã©ã®æ¦å¨ãæãã¾ãã? ", "Throw which item? "); + s = _("æããæ¦å¨ããªãã", "You have nothing to throw."); if (!get_item(&item, q, s, (USE_EQUIP))) { flush(); return FALSE; } } - else - { - item = INVEN_RARM; - } + else if (buki_motteruka(INVEN_LARM)) item = INVEN_LARM; + else item = INVEN_RARM; } else { /* Get an item */ -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÅꤲ¤Þ¤¹¤«? "; - s = "Åꤲ¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£"; -#else - q = "Throw which item? "; - s = "You have nothing to throw."; -#endif - + q = _("ã©ã®ã¢ã¤ãã ãæãã¾ãã? ", "Throw which item? "); + s = _("æããã¢ã¤ãã ããªãã", "You have nothing to throw."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP))) { flush(); @@ -3936,14 +3940,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Item is cursed */ - if (cursed_p(o_ptr) && (item >= INVEN_RARM)) + if (object_is_cursed(o_ptr) && (item >= INVEN_RARM)) { /* Oops */ -#ifdef JP - msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£"); -#else - msg_print("Hmmm, it seems to be cursed."); -#endif + msg_print(_("ãµã¼ããã©ãããåªããã¦ããããã ã", "Hmmm, it seems to be cursed.")); /* Nope */ return FALSE; @@ -3953,11 +3953,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) { if (o_ptr->tval != TV_SPIKE) { -#ifdef JP - msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª"); -#else - msg_print("You're in the arena now. This is hand-to-hand!"); -#endif + msg_print(_("ã¢ãªã¼ãã§ã¯ã¢ã¤ãã ã使ããªãï¼", "You're in the arena now. This is hand-to-hand!")); msg_print(NULL); /* Nope */ @@ -3973,6 +3969,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Extract the thrown object's flags. */ object_flags(q_ptr, flgs); + torch_flags(q_ptr, flgs); /* Distribute the charges of rods/wands between the stacks */ distribute_charges(o_ptr, q_ptr, 1); @@ -3999,10 +3996,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Max distance of 10-18 */ if (tdis > mul) tdis = mul; - if (shuriken) + if (shuriken >= 0) { - ty = randint0(101)-50+py; - tx = randint0(101)-50+px; + ty = randint0(101)-50+p_ptr->y; + tx = randint0(101)-50+p_ptr->x; } else { @@ -4012,8 +4009,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (!get_aim_dir(&dir)) return FALSE; /* Predict the "target" location */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) @@ -4051,15 +4048,15 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Rogue and Ninja gets bonus */ if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) - energy_use -= p_ptr->lev; + p_ptr->energy_use -= p_ptr->lev; /* Start at the player */ - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; /* Hack -- Handle stuff */ @@ -4075,6 +4072,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (shuriken) chance *= 2; + /* Save the old location */ + prev_y = y; + prev_x = x; + /* Travel until stopped */ for (cur_dis = 0; cur_dis <= tdis; ) { @@ -4084,30 +4085,27 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Calculate the new location (see "project()") */ ny[cur_dis] = y; nx[cur_dis] = x; - mmove2(&ny[cur_dis], &nx[cur_dis], py, px, ty, tx); + mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx); /* Stopped by walls/doors */ - if (!have_flag(f_flags_bold(ny[cur_dis], nx[cur_dis]), FF_PROJECT)) + if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT)) { hit_wall = TRUE; - break; + if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break; } - /* Advance the distance */ - cur_dis++; - /* The player can see the (on screen) missile */ - if (panel_contains(ny[cur_dis-1], nx[cur_dis-1]) && player_can_see_bold(ny[cur_dis-1], nx[cur_dis-1])) + if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis])) { char c = object_char(q_ptr); byte a = object_attr(q_ptr); /* Draw, Hilite, Fresh, Pause, Erase */ - print_rel(c, a, ny[cur_dis-1], nx[cur_dis-1]); - move_cursor_relative(ny[cur_dis-1], nx[cur_dis-1]); + print_rel(c, a, ny[cur_dis], nx[cur_dis]); + move_cursor_relative(ny[cur_dis], nx[cur_dis]); Term_fresh(); Term_xtra(TERM_XTRA_DELAY, msec); - lite_spot(ny[cur_dis-1], nx[cur_dis-1]); + lite_spot(ny[cur_dis], nx[cur_dis]); Term_fresh(); } @@ -4118,10 +4116,16 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) Term_xtra(TERM_XTRA_DELAY, msec); } + /* Save the old location */ + prev_y = y; + prev_x = x; + /* Save the new location */ - x = nx[cur_dis-1]; - y = ny[cur_dis-1]; + x = nx[cur_dis]; + y = ny[cur_dis]; + /* Advance the distance */ + cur_dis++; /* Monster here, Try to hit it */ if (cave[y][x].m_idx) @@ -4129,7 +4133,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) cave_type *c_ptr = &cave[y][x]; monster_type *m_ptr = &m_list[c_ptr->m_idx]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Check the visibility */ visible = m_ptr->ml; @@ -4138,7 +4141,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) hit_body = TRUE; /* Did we hit it (penalize range) */ - if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml)) + if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name)) { bool fear = FALSE; @@ -4146,12 +4149,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (!visible) { /* Invisible monster */ -#ifdef JP - msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name); -#else - msg_format("The %s finds a mark.", o_name); -#endif - + msg_format(_("%sãæµãææããã", "The %s finds a mark."), o_name); } /* Handle visible monster */ @@ -4163,25 +4161,26 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) monster_desc(m_name, m_ptr, 0); /* Message */ -#ifdef JP - msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name); -#else - msg_format("The %s hits %s.", o_name, m_name); -#endif - + msg_format(_("%sã%sã«å½ä¸ããã", "The %s hits %s."), o_name, m_name); - /* Hack -- Track this monster race */ - if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx); + if (m_ptr->ml) + { + /* Hack -- Track this monster race */ + if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - /* Hack -- Track this monster */ - if (m_ptr->ml) health_track(c_ptr->m_idx); + /* Hack -- Track this monster */ + health_track(c_ptr->m_idx); + } } /* Hack -- Base damage from thrown object */ - tdam = damroll(q_ptr->dd, q_ptr->ds); + dd = q_ptr->dd; + ds = q_ptr->ds; + torch_dice(q_ptr, &dd, &ds); /* throwing a torch */ + tdam = damroll(dd, ds); /* Apply special damage XXX XXX XXX */ tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE); - tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam); + tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam); if (q_ptr->to_d > 0) tdam += q_ptr->to_d; else @@ -4212,18 +4211,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Modify the damage */ tdam = mon_damage_mod(m_ptr, tdam, FALSE); - /* Complex message */ - if (p_ptr->wizard) - { -#ifdef JP - msg_format("%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", - tdam, m_ptr->hp); -#else - msg_format("You do %d (out of %d) damage.", - tdam, m_ptr->hp); -#endif - - } + msg_format_wizard(CHEAT_MONSTER, _("%dã®ãã¡ã¼ã¸ãä¸ããã(æ®ãHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), + tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp); /* Hit the monster, check for death */ if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) @@ -4253,12 +4242,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) monster_desc(m_name, m_ptr, 0); /* Message */ -#ifdef JP - msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name); -#else - msg_format("%^s flees in terror!", m_name); -#endif - + msg_format(_("%^sã¯ææãã¦éãåºããï¼", "%^s flees in terror!"), m_name); } } } @@ -4268,6 +4252,9 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) } } + /* decrease toach's fuel */ + if (hit_body) torch_lost_fuel(q_ptr); + /* Chance of breakage (during attacks) */ j = (hit_body ? breakage_chance(q_ptr) : 0); @@ -4277,19 +4264,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) j = 100; if (!(summon_named_creature(0, y, x, q_ptr->pval, - !(cursed_p(q_ptr)) ? PM_FORCE_PET : 0L))) -#ifdef JP -msg_print("¿Í·Á¤ÏDZ¤¸¶Ê¤¬¤êºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("The Figurine writhes and then shatters."); -#endif - - else if (cursed_p(q_ptr)) -#ifdef JP -msg_print("¤³¤ì¤Ï¤¢¤Þ¤êÎɤ¯¤Ê¤¤µ¤¤¬¤¹¤ë¡£"); -#else - msg_print("You have a bad feeling about this."); -#endif + !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L))) + msg_print(_("人形ã¯æ»ãæ²ããç ãæ£ã£ã¦ãã¾ã£ãï¼", "The Figurine writhes and then shatters.")); + else if (object_is_cursed(q_ptr)) + msg_print(_("ããã¯ãã¾ãè¯ããªãæ°ãããã", "You have a bad feeling about this.")); } @@ -4300,12 +4278,7 @@ msg_print(" if (hit_body || hit_wall || (randint1(100) < j)) { /* Message */ -#ifdef JP - msg_format("%s¤ÏºÕ¤±»¶¤Ã¤¿¡ª", o_name); -#else - msg_format("The %s shatters!", o_name); -#endif - + msg_format(_("%sã¯ç ãæ£ã£ãï¼", "The %s shatters!"), o_name); if (potion_smash_effect(0, y, x, q_ptr->k_idx)) { @@ -4314,16 +4287,11 @@ msg_print(" /* ToDo (Robert): fix the invulnerability */ if (cave[y][x].m_idx && is_friendly(&m_list[cave[y][x].m_idx]) && - !(m_ptr->invulner)) + !MON_INVULNER(m_ptr)) { char m_name[80]; monster_desc(m_name, &m_list[cave[y][x].m_idx], 0); -#ifdef JP - msg_format("%s¤ÏÅܤä¿¡ª", m_name); -#else - msg_format("%^s gets angry!", m_name); -#endif - + msg_format(_("%sã¯æã£ãï¼", "%^s gets angry!"), m_name); set_hostile(&m_list[cave[y][x].m_idx]); } } @@ -4348,7 +4316,7 @@ msg_print(" if((back_chance > 30) && (!one_in_(100) || super_boomerang)) { - for (i = cur_dis-1;i>0;i--) + for (i = cur_dis - 1; i > 0; i--) { if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i])) { @@ -4371,42 +4339,26 @@ msg_print(" } if((back_chance > 37) && !p_ptr->blind && (item >= 0)) { -#ifdef JP - msg_format("%s¤¬¼ê¸µ¤ËÊ֤äƤ¤¿¡£", o2_name); -#else - msg_format("%s comes back to you.", o2_name); -#endif + msg_format(_("%sãæå ã«è¿ã£ã¦ããã", "%s comes back to you."), o2_name); come_back = TRUE; } else { if (item >= 0) { -#ifdef JP - msg_format("%s¤ò¼õ¤±Â»¤Í¤¿¡ª", o2_name); -#else - msg_format("%s backs, but you can't catch!", o2_name); -#endif + msg_format(_("%sãåãæããï¼", "%s backs, but you can't catch!"), o2_name); } else { -#ifdef JP - msg_format("%s¤¬Ê֤äƤ¤¿¡£", o2_name); -#else - msg_format("%s comes back.", o2_name); -#endif + msg_format(_("%sãè¿ã£ã¦ããã", "%s comes back."), o2_name); } - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; } } else { -#ifdef JP - msg_format("%s¤¬Ê֤äƤ³¤Ê¤«¤Ã¤¿¡ª", o2_name); -#else - msg_format("%s doesn't back!", o2_name); -#endif + msg_format(_("%sãè¿ã£ã¦ããªãã£ãï¼", "%s doesn't back!"), o2_name); } } @@ -4451,16 +4403,269 @@ msg_print(" } /* Drop (or break) near that location */ - if (do_drop) (void)drop_near(q_ptr, j, y, x); + if (do_drop) + { + if (cave_have_flag_bold(y, x, FF_PROJECT)) + { + /* Drop (or break) near that location */ + (void)drop_near(q_ptr, j, y, x); + } + else + { + /* Drop (or break) near that location */ + (void)drop_near(q_ptr, j, prev_y, prev_x); + } + } return TRUE; } -/* +/*! + * @brief æå°å¦çã®ã¡ã¤ã³ã«ã¼ãã³ / * Throw an object from the pack or floor. + * @return ãªã */ void do_cmd_throw(void) { - do_cmd_throw_aux(1, FALSE, 0); + do_cmd_throw_aux(1, FALSE, -1); +} + + +#ifdef TRAVEL +/* + * Hack: travel command + */ +#define TRAVEL_UNABLE 9999 + +static int flow_head = 0; +static int flow_tail = 0; +static s16b temp2_x[MAX_SHORT]; +static s16b temp2_y[MAX_SHORT]; + +/*! + * @brief ãã©ãã«å¦çã®è¨æ¶é åãåæåãã Hack: forget the "flow" information + * @return ãªã + */ +void forget_travel_flow(void) +{ + int x, y; + + /* Check the entire dungeon */ + for (y = 0; y < cur_hgt; y++) + { + for (x = 0; x < cur_wid; x++) + { + /* Forget the old data */ + travel.cost[y][x] = MAX_SHORT; + } + } + + travel.y = travel.x = 0; +} + +/*! + * @brief ãã©ãã«å¦çä¸ã«å°å½¢ã«å¿ãã移åã³ã¹ãåºæºãè¿ã + * @param y 該å½å°ç¹ã®Yåº§æ¨ + * @param x 該å½å°ç¹ã®Xåº§æ¨ + * @return ã³ã¹ãå¤ + */ +static int travel_flow_cost(int y, int x) +{ + feature_type *f_ptr = &f_info[cave[y][x].feat]; + int cost = 1; + + /* Avoid obstacles (ex. trees) */ + if (have_flag(f_ptr->flags, FF_AVOID_RUN)) cost += 1; + + /* Water */ + if (have_flag(f_ptr->flags, FF_WATER)) + { + if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5; + } + + /* Lava */ + if (have_flag(f_ptr->flags, FF_LAVA)) + { + int lava = 2; + if (!p_ptr->resist_fire) lava *= 2; + if (!p_ptr->levitation) lava *= 2; + if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2; + + cost += lava; + } + + /* Detected traps and doors */ + if (cave[y][x].info & (CAVE_MARK)) + { + if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1; + if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10; + } + + return (cost); } + +/*! + * @brief ãã©ãã«å¦çã®å°éå°ç¹ã¾ã§ã®è¡ç¨ãå¾ãå¦çã®ãµãã«ã¼ãã³ + * @param y ç®æ¨å°ç¹ã®Yåº§æ¨ + * @param x ç®æ¨å°ç¹ã®Xåº§æ¨ + * @param n ç¾å¨ã®ã³ã¹ã + * @param wall ãã¬ã¤ã¤ã¼ãå£ã®ä¸ã«ãããªãã°TRUE + * @return ãªã + */ +static void travel_flow_aux(int y, int x, int n, bool wall) +{ + cave_type *c_ptr = &cave[y][x]; + feature_type *f_ptr = &f_info[c_ptr->feat]; + int old_head = flow_head; + int add_cost = 1; + int base_cost = (n % TRAVEL_UNABLE); + int from_wall = (n / TRAVEL_UNABLE); + int cost; + + /* Ignore out of bounds */ + if (!in_bounds(y, x)) return; + + /* Ignore unknown grid except in wilderness */ + if (dun_level > 0 && !(c_ptr->info & CAVE_KNOWN)) return; + + /* Ignore "walls" and "rubble" (include "secret doors") */ + if (have_flag(f_ptr->flags, FF_WALL) || + have_flag(f_ptr->flags, FF_CAN_DIG) || + (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic) || + (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)) + { + if (!wall || !from_wall) return; + add_cost += TRAVEL_UNABLE; + } + else + { + add_cost = travel_flow_cost(y, x); + } + + cost = base_cost + add_cost; + + /* Ignore lower cost entries */ + if (travel.cost[y][x] <= cost) return; + + /* Save the flow cost */ + travel.cost[y][x] = cost; + + /* Enqueue that entry */ + temp2_y[flow_head] = y; + temp2_x[flow_head] = x; + + /* Advance the queue */ + if (++flow_head == MAX_SHORT) flow_head = 0; + + /* Hack -- notice overflow by forgetting new entry */ + if (flow_head == flow_tail) flow_head = old_head; + + return; +} + +/*! + * @brief ãã©ãã«å¦çã®å°éå°ç¹ã¾ã§ã®è¡ç¨ãå¾ãå¦çã®ã¡ã¤ã³ã«ã¼ãã³ + * @param ty ç®æ¨å°ç¹ã®Yåº§æ¨ + * @param tx ç®æ¨å°ç¹ã®Xåº§æ¨ + * @return ãªã + */ +static void travel_flow(int ty, int tx) +{ + int x, y, d; + bool wall = FALSE; + feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; + + /* Reset the "queue" */ + flow_head = flow_tail = 0; + + /* is player in the wall? */ + if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE; + + /* Start at the target grid */ + travel_flow_aux(ty, tx, 0, wall); + + /* Now process the queue */ + while (flow_head != flow_tail) + { + /* Extract the next entry */ + y = temp2_y[flow_tail]; + x = temp2_x[flow_tail]; + + /* Forget that entry */ + if (++flow_tail == MAX_SHORT) flow_tail = 0; + + /* Ignore too far entries */ + //if (distance(ty, tx, y, x) > 100) continue; + + /* Add the "children" */ + for (d = 0; d < 8; d++) + { + /* Add that child if "legal" */ + travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall); + } + } + + /* Forget the flow info */ + flow_head = flow_tail = 0; +} + +/*! + * @brief ãã©ãã«å¦çã®ã¡ã¤ã³ã«ã¼ãã³ + * @return ãªã + */ +void do_cmd_travel(void) +{ + int x, y, i; + int dx, dy, sx, sy; + feature_type *f_ptr; + + if (travel.x != 0 && travel.y != 0 && + get_check(_("ãã©ãã«ãç¶ç¶ãã¾ããï¼", "Do you continue to travel?"))) + { + y = travel.y; + x = travel.x; + } + else if (!tgt_pt(&x, &y)) return; + + if ((x == p_ptr->x) && (y == p_ptr->y)) + { + msg_print(_("ãã§ã«ããã«ãã¾ãï¼", "You are already there!!")); + return; + } + + f_ptr = &f_info[cave[y][x].feat]; + + if ((cave[y][x].info & CAVE_MARK) && + (have_flag(f_ptr->flags, FF_WALL) || + have_flag(f_ptr->flags, FF_CAN_DIG) || + (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic))) + { + msg_print(_("ããã«ã¯è¡ããã¨ãã§ãã¾ããï¼", "You cannot travel there!")); + return; + } + + forget_travel_flow(); + travel_flow(y, x); + + travel.x = x; + travel.y = y; + + /* Travel till 255 steps */ + travel.run = 255; + + /* Paranoia */ + travel.dir = 0; + + /* Decides first direction */ + dx = abs(p_ptr->x - x); + dy = abs(p_ptr->y - y); + sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1); + sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1); + + for (i = 1; i <= 9; i++) + { + if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i; + } +} +#endif