X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=blobdiff_plain;f=src%2Fcmd1.c;h=ee3358e66687a483a30e34bbcaad8fce0edaccc4;hp=cd197ffdafc4862edfbf26d27123fa4dc35f0f4c;hb=27eb9b788665bd1bfdb3f2efb5a5b879a401a72f;hpb=6599307eda98e10beaae211323166bad3a4664ab diff --git a/src/cmd1.c b/src/cmd1.c index cd197ffda..ee3358e66 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -1,32 +1,173 @@ -/* File: cmd1.c */ - -/* +/*! + * @file cmd1.c + * @brief プレイヤーのコマンド処理1 / Movement commands (part 1) + * @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, * and not for profit purposes provided that this copyright and statement * are included in all such copies. Other copyrights may also apply. + * @note + *
+ * The running algorithm:                       -CJS-
+ *
+ * In the diagrams below, the player has just arrived in the
+ * grid marked as '@', and he has just come from a grid marked
+ * as 'o', and he is about to enter the grid marked as 'x'.
+ *
+ * Of course, if the "requested" move was impossible, then you
+ * will of course be blocked, and will stop.
+ *
+ * Overview: You keep moving until something interesting happens.
+ * If you are in an enclosed space, you follow corners. This is
+ * the usual corridor scheme. If you are in an open space, you go
+ * straight, but stop before entering enclosed space. This is
+ * analogous to reaching doorways. If you have enclosed space on
+ * one side only (that is, running along side a wall) stop if
+ * your wall opens out, or your open space closes in. Either case
+ * corresponds to a doorway.
+ *
+ * What happens depends on what you can really SEE. (i.e. if you
+ * have no light, then running along a dark corridor is JUST like
+ * running in a dark room.) The algorithm works equally well in
+ * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
+ *
+ * These conditions are kept in static memory:
+ * find_openarea         You are in the open on at least one
+ * side.
+ * find_breakleft        You have a wall on the left, and will
+ * stop if it opens
+ * find_breakright       You have a wall on the right, and will
+ * stop if it opens
+ *
+ * To initialize these conditions, we examine the grids adjacent
+ * to the grid marked 'x', two on each side (marked 'L' and 'R').
+ * If either one of the two grids on a given side is seen to be
+ * closed, then that side is considered to be closed. If both
+ * sides are closed, then it is an enclosed (corridor) run.
+ *
+ * LL           L
+ * @@x          LxR
+ * RR          @@R
+ *
+ * Looking at more than just the immediate squares is
+ * significant. Consider the following case. A run along the
+ * corridor will stop just before entering the center point,
+ * because a choice is clearly established. Running in any of
+ * three available directions will be defined as a corridor run.
+ * Note that a minor hack is inserted to make the angled corridor
+ * entry (with one side blocked near and the other side blocked
+ * further away from the runner) work correctly. The runner moves
+ * diagonally, but then saves the previous direction as being
+ * straight into the gap. Otherwise, the tail end of the other
+ * entry would be perceived as an alternative on the next move.
+ *
+ * \#.\#
+ * \#\#.\#\#
+ * \.\@x..
+ * \#\#.\#\#
+ * \#.\#
+ *
+ * Likewise, a run along a wall, and then into a doorway (two
+ * runs) will work correctly. A single run rightwards from \@ will
+ * stop at 1. Another run right and down will enter the corridor
+ * and make the corner, stopping at the 2.
+ *
+ * \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+ * o@@x       1
+ * \#\#\#\#\#\#\#\#\#\#\# \#\#\#\#\#\#
+ * \#2          \#
+ * \#\#\#\#\#\#\#\#\#\#\#\#\#
+ *
+ * After any move, the function area_affect is called to
+ * determine the new surroundings, and the direction of
+ * subsequent moves. It examines the current player location
+ * (at which the runner has just arrived) and the previous
+ * direction (from which the runner is considered to have come).
+ *
+ * Moving one square in some direction places you adjacent to
+ * three or five new squares (for straight and diagonal moves
+ * respectively) to which you were not previously adjacent,
+ * marked as '!' in the diagrams below.
+ *
+ *   ...!              ...
+ *   .o@@!  (normal)    .o.!  (diagonal)
+ *   ...!  (east)      ..@@!  (south east)
+ *                      !!!
+ *
+ * You STOP if any of the new squares are interesting in any way:
+ * for example, if they contain visible monsters or treasure.
+ *
+ * You STOP if any of the newly adjacent squares seem to be open,
+ * and you are also looking for a break on that side. (that is,
+ * find_openarea AND find_break).
+ *
+ * You STOP if any of the newly adjacent squares do NOT seem to be
+ * open and you are in an open area, and that side was previously
+ * entirely open.
+ *
+ * Corners: If you are not in the open (i.e. you are in a corridor)
+ * and there is only one way to go in the new squares, then turn in
+ * that direction. If there are more than two new ways to go, STOP.
+ * If there are two ways to go, and those ways are separated by a
+ * square which does not seem to be open, then STOP.
+ *
+ * Otherwise, we have a potential corner. There are two new open
+ * squares, which are also adjacent. One of the new squares is
+ * diagonally located, the other is straight on (as in the diagram).
+ * We consider two more squares further out (marked below as ?).
+ *
+ * We assign "option" to the straight-on grid, and "option2" to the
+ * diagonal grid, and "check_dir" to the grid marked 's'.
+ *
+ * \#\#s
+ * @@x?
+ * \#.?
+ *
+ * If they are both seen to be closed, then it is seen that no benefit
+ * is gained from moving straight. It is a known corner.  To cut the
+ * corner, go diagonally, otherwise go straight, but pretend you
+ * stepped diagonally into that next location for a full view next
+ * time. Conversely, if one of the ? squares is not seen to be closed,
+ * then there is a potential choice. We check to see whether it is a
+ * potential corner or an intersection/room entrance.  If the square
+ * two spaces straight ahead, and the space marked with 's' are both
+ * unknown space, then it is a potential corner and enter if
+ * find_examine is set, otherwise must stop because it is not a
+ * corner. (find_examine option is removed and always is TRUE.)
+ * 
*/ -/* Purpose: Movement commands (part 1) */ #include "angband.h" -#define MAX_VAMPIRIC_DRAIN 50 +#define MAX_VAMPIRIC_DRAIN 50 /*!< 吸血処理の最大回復HP */ -/* +/*! + * @brief プレイヤーからモンスターへの射撃命中判定 / * Determine if the player "hits" a monster (normal combat). - * Note -- Always miss 5%, always hit 5%, otherwise random. + * @param chance 基本命中値 + * @param m_ptr モンスターの構造体参照ポインタ + * @param vis 目標を視界に捕らえているならばTRUEを指定 + * @param o_name メッセージ表示時のモンスター名 + * @return 命中と判定された場合TRUEを返す + * @note Always miss 5%, always hit 5%, otherwise random. */ -bool test_hit_fire(int chance, int ac, int vis) +bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name) { - int k; + int k, ac; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Percentile dice */ - k = randint0(100); - + k = randint1(100); + + /* Snipers with high-concentration reduce instant miss percentage.*/ + k += p_ptr->concent; + /* Hack -- Instant miss or hit */ - if (k < 10) return (k < 5); + if (k <= 5) return (FALSE); + if (k > 95) return (TRUE); if (p_ptr->pseikaku == SEIKAKU_NAMAKE) if (one_in_(20)) return (FALSE); @@ -34,11 +175,31 @@ bool test_hit_fire(int chance, int ac, int vis) /* Never hit */ if (chance <= 0) return (FALSE); + ac = r_ptr->ac; + if (p_ptr->concent) + { + ac *= (8 - p_ptr->concent); + ac /= 8; + } + + if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3; + /* Invisible monsters are harder to hit */ if (!vis) chance = (chance + 1) / 2; /* Power competes against armor */ - if (randint0(chance) < (ac * 3 / 4)) return (FALSE); + if (randint0(chance) < (ac * 3 / 4)) + { + if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) + { + char m_name[80]; + + /* Extract monster name */ + monster_desc(m_name, m_ptr, 0); + msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name); + } + return (FALSE); + } /* Assume hit */ return (TRUE); @@ -46,10 +207,14 @@ bool test_hit_fire(int chance, int ac, int vis) -/* +/*! + * @brief プレイヤーからモンスターへの打撃命中判定 / * Determine if the player "hits" a monster (normal combat). - * - * Note -- Always miss 5%, always hit 5%, otherwise random. + * @param chance 基本命中値 + * @param ac モンスターのAC + * @param vis 目標を視界に捕らえているならばTRUEを指定 + * @return 命中と判定された場合TRUEを返す + * @note Always miss 5%, always hit 5%, otherwise random. */ bool test_hit_norm(int chance, int ac, int vis) { @@ -79,51 +244,55 @@ bool test_hit_norm(int chance, int ac, int vis) -/* - * Critical hits (from objects thrown by player) - * Factor in item weight, total plusses, and player level. +/*! + * @brief プレイヤーからモンスターへの射撃クリティカル判定 / + * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level. + * @param weight 矢弾の重量 + * @param plus_ammo 矢弾の命中修正 + * @param plus_bow 弓の命中修正 + * @param dam 現在算出中のダメージ値 + * @return クリティカル修正が入ったダメージ値 */ -s16b critical_shot(int weight, int plus, int dam) +HIT_POINT critical_shot(int weight, int plus_ammo, int plus_bow, HIT_POINT dam) { int i, k; - + object_type *j_ptr = &inventory[INVEN_BOW]; + /* Extract "shot" power */ - i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2)); - + i = p_ptr->to_h_b + plus_ammo; + + if (p_ptr->tval_ammo == TV_BOLT) + i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ); + else + i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ); + + + /* Snipers can shot more critically with crossbows */ + if (p_ptr->concent) i += ((i * p_ptr->concent) / 5); + if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2; + + /* Good bow makes more critical */ + i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5); + /* Critical hit */ - if (randint1(5000) <= i) + if (randint1(10000) <= i) { - k = weight + randint1(500); + k = weight * randint1(500); - if (k < 500) + if (k < 900) { -#ifdef JP - msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª"); -#else - msg_print("It was a good hit!"); -#endif - - dam = 2 * dam + 5; + msg_print(_("手ごたえがあった!", "It was a good hit!")); + dam += (dam / 2); } - else if (k < 1000) + else if (k < 1350) { -#ifdef JP - msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª"); -#else - msg_print("It was a great hit!"); -#endif - - dam = 2 * dam + 10; + msg_print(_("かなりの手ごたえがあった!", "It was a great hit!")); + dam *= 2; } else { -#ifdef JP - msg_print("²ñ¿´¤Î°ì·â¤À¡ª"); -#else - msg_print("It was a superb hit!"); -#endif - - dam = 3 * dam + 15; + msg_print(_("会心の一撃だ!", "It was a superb hit!")); + dam *= 3; } } @@ -132,17 +301,22 @@ s16b critical_shot(int weight, int plus, int dam) -/* - * Critical hits (by player) - * - * Factor in weapon weight, total plusses, player level. +/*! + * @brief プレイヤーからモンスターへの打撃クリティカル判定 / + * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus + * @param weight 矢弾の重量 + * @param plus 武器の命中修正 + * @param dam 現在算出中のダメージ値 + * @param meichuu 打撃の基本命中力 + * @param mode オプションフラグ + * @return クリティカル修正が入ったダメージ値 */ -s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode) +HIT_POINT critical_norm(int weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode) { int i, k; - + /* Extract "blow" power */ - i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3)); + i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn); /* Chance */ if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) @@ -152,52 +326,28 @@ s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode) if (k < 400) { -#ifdef JP - msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª"); -#else - msg_print("It was a good hit!"); -#endif + msg_print(_("手ごたえがあった!", "It was a good hit!")); dam = 2 * dam + 5; } else if (k < 700) { -#ifdef JP - msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª"); -#else - msg_print("It was a great hit!"); -#endif - + msg_print(_("かなりの手ごたえがあった!", "It was a great hit!")); dam = 2 * dam + 10; } else if (k < 900) { -#ifdef JP - msg_print("²ñ¿´¤Î°ì·â¤À¡ª"); -#else - msg_print("It was a superb hit!"); -#endif - + msg_print(_("会心の一撃だ!", "It was a superb hit!")); dam = 3 * dam + 15; } else if (k < 1300) { -#ifdef JP - msg_print("ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª"); -#else - msg_print("It was a *GREAT* hit!"); -#endif - + msg_print(_("最高の会心の一撃だ!", "It was a *GREAT* hit!")); dam = 3 * dam + 20; } else { -#ifdef JP - msg_print("ÈæÎà¤Ê¤­ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª"); -#else - msg_print("It was a *SUPERB* hit!"); -#endif - + msg_print(_("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!")); dam = ((7 * dam) / 2) + 25; } } @@ -207,441 +357,199 @@ s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode) -/* - * Extract the "total damage" from a given object hitting a given monster. - * - * Note that "flasks of oil" do NOT do fire damage, although they - * certainly could be made to do so. XXX XXX - * - * Note that most brands and slays are x3, except Slay Animal (x2), - * Slay Evil (x2), and Kill dragon (x5). +/*! + * @brief プレイヤー攻撃の種族スレイング倍率計算 + * @param mult 算出前の基本倍率(/10倍) + * @param flgs スレイフラグ配列 + * @param m_ptr 目標モンスターの構造体参照ポインタ + * @return スレイング加味後の倍率(/10倍) */ -s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown) +static MULTIPLY mult_slaying(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr) { - int mult = 10; - - monster_race *r_ptr = &r_info[m_ptr->r_idx]; - - u32b flgs[TR_FLAG_SIZE]; - - /* Extract the flags */ - object_flags(o_ptr, flgs); - - /* Some "weapons" and "ammo" do extra damage */ - switch (o_ptr->tval) + static const struct slay_table_t { + int slay_flag; + BIT_FLAGS affect_race_flag; + MULTIPLY slay_mult; + size_t flag_offset; + size_t r_flag_offset; + } slay_table[] = { +#define OFFSET(X) offsetof(monster_race, X) + {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)}, + {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)}, + {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)}, + {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)}, +#undef OFFSET + }; + int i; + monster_race* r_ptr = &r_info[m_ptr->r_idx]; + + for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i) { - case TV_SHOT: - case TV_ARROW: - case TV_BOLT: - case TV_HAFTED: - case TV_POLEARM: - case TV_SWORD: - case TV_DIGGING: - { - /* Slay Animal */ - if ((have_flag(flgs, TR_SLAY_ANIMAL)) && - (r_ptr->flags3 & RF3_ANIMAL)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_ANIMAL; - } - - if (mult < 25) mult = 25; - } - - /* Execute Animal */ - if ((have_flag(flgs, TR_KILL_ANIMAL)) && - (r_ptr->flags3 & RF3_ANIMAL)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_ANIMAL; - } + const struct slay_table_t* p = &slay_table[i]; - if (mult < 40) mult = 40; - } - - /* Slay Evil */ - if ((have_flag(flgs, TR_SLAY_EVIL)) && - (r_ptr->flags3 & RF3_EVIL)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_EVIL; - } - - if (mult < 20) mult = 20; - } - - /* Execute Evil */ - if ((have_flag(flgs, TR_KILL_EVIL)) && - (r_ptr->flags3 & RF3_EVIL)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_EVIL; - } - - if (mult < 35) mult = 35; - } - - /* Slay Human */ - if ((have_flag(flgs, TR_SLAY_HUMAN)) && - (r_ptr->flags2 & RF2_HUMAN)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags2 |= RF2_HUMAN; - } - - if (mult < 25) mult = 25; - } - - /* Execute Human */ - if ((have_flag(flgs, TR_KILL_HUMAN)) && - (r_ptr->flags2 & RF2_HUMAN)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags2 |= RF2_HUMAN; - } - - if (mult < 40) mult = 40; - } - - /* Slay Undead */ - if ((have_flag(flgs, TR_SLAY_UNDEAD)) && - (r_ptr->flags3 & RF3_UNDEAD)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_UNDEAD; - } - - if (mult < 30) mult = 30; - } - - /* Execute Undead */ - if ((have_flag(flgs, TR_KILL_UNDEAD)) && - (r_ptr->flags3 & RF3_UNDEAD)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_UNDEAD; - } - - if (mult < 50) mult = 50; - } - - /* Slay Demon */ - if ((have_flag(flgs, TR_SLAY_DEMON)) && - (r_ptr->flags3 & RF3_DEMON)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_DEMON; - } - - if (mult < 30) mult = 30; - } - - /* Execute Demon */ - if ((have_flag(flgs, TR_KILL_DEMON)) && - (r_ptr->flags3 & RF3_DEMON)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_DEMON; - } - - if (mult < 50) mult = 50; - } - - /* Slay Orc */ - if ((have_flag(flgs, TR_SLAY_ORC)) && - (r_ptr->flags3 & RF3_ORC)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_ORC; - } - - if (mult < 30) mult = 30; - } - - /* Execute Orc */ - if ((have_flag(flgs, TR_KILL_ORC)) && - (r_ptr->flags3 & RF3_ORC)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_ORC; - } - - if (mult < 50) mult = 50; - } - - /* Slay Troll */ - if ((have_flag(flgs, TR_SLAY_TROLL)) && - (r_ptr->flags3 & RF3_TROLL)) + if ((have_flag(flgs, p->slay_flag)) && + (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag)) + { + if (is_original_ap_and_seen(m_ptr)) { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_TROLL; - } - - if (mult < 30) mult = 30; + atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag; } - /* Execute Troll */ - if ((have_flag(flgs, TR_KILL_TROLL)) && - (r_ptr->flags3 & RF3_TROLL)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_TROLL; - } - - if (mult < 50) mult = 50; - } + mult = MAX(mult, p->slay_mult); + } + } - /* Slay Giant */ - if ((have_flag(flgs, TR_SLAY_GIANT)) && - (r_ptr->flags3 & RF3_GIANT)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_GIANT; - } + return mult; +} - if (mult < 30) mult = 30; - } +/*! + * @brief プレイヤー攻撃の属性スレイング倍率計算 + * @param mult 算出前の基本倍率(/10倍) + * @param flgs スレイフラグ配列 + * @param m_ptr 目標モンスターの構造体参照ポインタ + * @return スレイング加味後の倍率(/10倍) + */ +static MULTIPLY mult_brand(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr) +{ + static const struct brand_table_t { + int brand_flag; + BIT_FLAGS resist_mask; + BIT_FLAGS hurt_flag; + } brand_table[] = { + {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U }, + {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U }, + {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE}, + {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD}, + {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U }, + }; + int i; + monster_race* r_ptr = &r_info[m_ptr->r_idx]; + + for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i) + { + const struct brand_table_t* p = &brand_table[i]; - /* Execute Giant */ - if ((have_flag(flgs, TR_KILL_GIANT)) && - (r_ptr->flags3 & RF3_GIANT)) + if (have_flag(flgs, p->brand_flag)) + { + /* Notice immunity */ + if (r_ptr->flagsr & p->resist_mask) { if (is_original_ap_and_seen(m_ptr)) { - r_ptr->r_flags3 |= RF3_GIANT; + r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask); } - - if (mult < 50) mult = 50; } - /* Slay Dragon */ - if ((have_flag(flgs, TR_SLAY_DRAGON)) && - (r_ptr->flags3 & RF3_DRAGON)) + /* Otherwise, take the damage */ + else if (r_ptr->flags3 & p->hurt_flag) { if (is_original_ap_and_seen(m_ptr)) { - r_ptr->r_flags3 |= RF3_DRAGON; + r_ptr->r_flags3 |= p->hurt_flag; } - if (mult < 30) mult = 30; + mult = MAX(mult, 50); } - - /* Execute Dragon */ - if ((have_flag(flgs, TR_KILL_DRAGON)) && - (r_ptr->flags3 & RF3_DRAGON)) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_DRAGON; - } - - if (mult < 50) mult = 50; - - if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER)) - mult *= 3; - } - - /* Brand (Acid) */ - if (have_flag(flgs, TR_BRAND_ACID) || ((p_ptr->special_attack & (ATTACK_ACID)) && !thrown)) + else { - /* Notice immunity */ - if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK); - } - } - - /* Otherwise, take the damage */ - else - { - if (mult < 25) mult = 25; - } + mult = MAX(mult, 25); } + } + } - /* Brand (Elec) */ - if (have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown) || (mode == HISSATSU_ELEC)) - { - /* Notice immunity */ - if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK); - } - } - - /* Otherwise, take the damage */ - else if ((have_flag(flgs, TR_BRAND_ELEC) || ((p_ptr->special_attack & (ATTACK_ELEC)) && !thrown)) && (mode == HISSATSU_ELEC)) - { - if (mult < 70) mult = 70; - } - else if (mode == HISSATSU_ELEC) - { - if (mult < 50) mult = 50; - } + return mult; +} - else - { - if (mult < 25) mult = 25; - } - } +/*! + * @brief ダメージにスレイ要素を加える総合処理ルーチン / + * Extract the "total damage" from a given object hitting a given monster. + * @param o_ptr 使用武器オブジェクトの構造体参照ポインタ + * @param tdam 現在算出途中のダメージ値 + * @param m_ptr 目標モンスターの構造体参照ポインタ + * @param mode 剣術のID + * @param thrown 射撃処理ならばTRUEを指定する + * @return 総合的なスレイを加味したダメージ値 + * @note + * Note that "flasks of oil" do NOT do fire damage, although they\n + * certainly could be made to do so. XXX XXX\n + *\n + * Note that most brands and slays are x3, except Slay Animal (x2),\n + * Slay Evil (x2), and Kill dragon (x5).\n + */ +s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown) +{ + MULTIPLY mult = 10; - /* Brand (Fire) */ - if (have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown) || (mode == HISSATSU_FIRE)) - { - /* Notice immunity */ - if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK); - } - } + BIT_FLAGS flgs[TR_FLAG_SIZE]; - /* Otherwise, take the damage */ - else if ((have_flag(flgs, TR_BRAND_FIRE) || ((p_ptr->special_attack & (ATTACK_FIRE)) && !thrown)) && (mode == HISSATSU_FIRE)) - { - if (r_ptr->flags3 & RF3_HURT_FIRE) - { - if (mult < 70) mult = 70; - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_HURT_FIRE; - } - } - else if (mult < 35) mult = 35; - } - else - { - if (r_ptr->flags3 & RF3_HURT_FIRE) - { - if (mult < 50) mult = 50; - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_HURT_FIRE; - } - } - else if (mult < 25) mult = 25; - } - } + /* Extract the flags */ + object_flags(o_ptr, flgs); + torch_flags(o_ptr, flgs); /* torches has secret flags */ - /* Brand (Cold) */ - if (have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown) || (mode == HISSATSU_COLD)) - { - /* Notice immunity */ - if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK); - } - } - /* Otherwise, take the damage */ - else if ((have_flag(flgs, TR_BRAND_COLD) || ((p_ptr->special_attack & (ATTACK_COLD)) && !thrown)) && (mode == HISSATSU_COLD)) - { - if (r_ptr->flags3 & RF3_HURT_COLD) - { - if (mult < 70) mult = 70; - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_HURT_COLD; - } - } - else if (mult < 35) mult = 35; - } - else - { - if (r_ptr->flags3 & RF3_HURT_COLD) - { - if (mult < 50) mult = 50; - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_HURT_COLD; - } - } - else if (mult < 25) mult = 25; - } - } + if (!thrown) + { + /* Magical Swords */ + if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID); + if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD); + if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC); + if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE); + if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS); + } - /* Brand (Poison) */ - if (have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown) || (mode == HISSATSU_POISON)) - { - /* Notice immunity */ - if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK); - } - } + /* Hex - Slay Good (Runesword) */ + if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD); - /* Otherwise, take the damage */ - else if ((have_flag(flgs, TR_BRAND_POIS) || ((p_ptr->special_attack & (ATTACK_POIS)) && !thrown)) && (mode == HISSATSU_POISON)) - { - if (mult < 35) mult = 35; - } - else - { - if (mult < 25) mult = 25; - } - } - if ((mode == HISSATSU_ZANMA) && !monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)) - { - if (mult < 15) mult = 25; - else if (mult < 50) mult = MIN(50, mult+20); - } - if (mode == HISSATSU_UNDEAD) - { - if (r_ptr->flags3 & RF3_UNDEAD) - { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_UNDEAD; - } - if (mult == 10) mult = 70; - else if (mult < 140) mult = MIN(140, mult+60); - } - if (mult == 10) mult = 40; - else if (mult < 60) mult = MIN(60, mult+30); - } - if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr)) - { - int tmp = MIN(100, MAX(10, p_ptr->cut / 10)); - if (mult < tmp) mult = tmp; - } - if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK)) + /* Some "weapons" and "ammo" do extra damage */ + switch (o_ptr->tval) + { + case TV_SHOT: + case TV_ARROW: + case TV_BOLT: + case TV_HAFTED: + case TV_POLEARM: + case TV_SWORD: + case TV_DIGGING: + case TV_LITE: + { + /* Slaying */ + mult = mult_slaying(mult, flgs, m_ptr); + + /* Elemental Brand */ + mult = mult_brand(mult, flgs, m_ptr); + + /* Hissatsu */ + if (p_ptr->pclass == CLASS_SAMURAI) { - if (is_original_ap_and_seen(m_ptr)) - { - r_ptr->r_flags3 |= RF3_HURT_ROCK; - } - if (mult == 10) mult = 40; - else if (mult < 60) mult = 60; + mult = mult_hissatsu(mult, flgs, m_ptr, mode); } + + /* Force Weapon */ if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5))) { p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5)); p_ptr->redraw |= (PR_MANA); mult = mult * 3 / 2 + 20; } + + /* Hack -- The Nothung cause special damage to Fafner */ + if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER)) + mult = 150; break; } } @@ -652,129 +560,126 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bo } -/* +/*! + * @brief 地形やその上のアイテムの隠された要素を明かす / * Search for hidden things + * @param y 対象となるマスのY座標 + * @param x 対象となるマスのX座標 + * @return なし */ -void search(void) +static void discover_hidden_things(POSITION y, POSITION x) { - int y, x, chance; - - s16b this_o_idx, next_o_idx = 0; - + OBJECT_IDX this_o_idx, next_o_idx = 0; cave_type *c_ptr; + /* Access the grid */ + c_ptr = &cave[y][x]; - /* Start with base search ability */ - chance = p_ptr->skill_srh; + /* Invisible trap */ + if (c_ptr->mimic && is_trap(c_ptr->feat)) + { + /* Pick a trap */ + disclose_grid(y, x); - /* Penalize various conditions */ - if (p_ptr->blind || no_lite()) chance = chance / 10; - if (p_ptr->confused || p_ptr->image) chance = chance / 10; + /* Message */ + msg_print(_("トラップを発見した。", "You have found a trap.")); - /* Search the nearby grids, which are always in bounds */ - for (y = (py - 1); y <= (py + 1); y++) + /* Disturb */ + disturb(0, 1); + } + + /* Secret door */ + if (is_hidden_door(c_ptr)) { - for (x = (px - 1); x <= (px + 1); x++) - { - /* Sometimes, notice things */ - if (randint0(100) < chance) - { - /* Access the grid */ - c_ptr = &cave[y][x]; + /* Message */ + msg_print(_("隠しドアを発見した。", "You have found a secret door.")); - /* Invisible trap */ - if (c_ptr->mimic && is_trap(c_ptr->feat)) - { - /* Pick a trap */ - disclose_grid(y, x); + /* Disclose */ + disclose_grid(y, x); - /* Message */ -#ifdef JP - msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£"); -#else - msg_print("You have found a trap."); -#endif + /* Disturb */ + disturb(0, 0); + } - /* Disturb */ - disturb(0, 0); - } + /* Scan all objects in the grid */ + for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) + { + object_type *o_ptr; - /* Secret door */ - if (is_hidden_door(c_ptr)) - { - /* Message */ -#ifdef JP - msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£"); -#else - msg_print("You have found a secret door."); -#endif + /* Acquire object */ + o_ptr = &o_list[this_o_idx]; - /* Disclose */ - disclose_grid(y, x); + /* Acquire next object */ + next_o_idx = o_ptr->next_o_idx; - /* Disturb */ - disturb(0, 0); - } + /* Skip non-chests */ + if (o_ptr->tval != TV_CHEST) continue; - /* Scan all objects in the grid */ - for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) - { - object_type *o_ptr; + /* Skip non-trapped chests */ + if (!chest_traps[o_ptr->pval]) continue; - /* Acquire object */ - o_ptr = &o_list[this_o_idx]; + /* Identify once */ + if (!object_is_known(o_ptr)) + { + /* Message */ + msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!")); - /* Acquire next object */ - next_o_idx = o_ptr->next_o_idx; + /* Know the trap */ + object_known(o_ptr); - /* Skip non-chests */ - if (o_ptr->tval != TV_CHEST) continue; + /* Notice it */ + disturb(0, 0); + } + } +} - /* Skip non-trapped chests */ - if (!chest_traps[o_ptr->pval]) continue; +/*! + * @brief プレイヤーの探索処理判定 + * @return なし + */ +void search(void) +{ + DIRECTION i; + PERCENTAGE chance; - /* Identify once */ - if (!object_is_known(o_ptr)) - { - /* Message */ -#ifdef JP - msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª"); -#else - msg_print("You have discovered a trap on the chest!"); -#endif + /* Start with base search ability */ + chance = p_ptr->skill_srh; - /* Know the trap */ - object_known(o_ptr); + /* Penalize various conditions */ + if (p_ptr->blind || no_lite()) chance = chance / 10; + if (p_ptr->confused || p_ptr->image) chance = chance / 10; - /* Notice it */ - disturb(0, 0); - } - } - } + /* Search the nearby grids, which are always in bounds */ + for (i = 0; i < 9; ++ i) + { + /* Sometimes, notice things */ + if (randint0(100) < chance) + { + discover_hidden_things(p_ptr->y + ddy_ddd[i], p_ptr->x + ddx_ddd[i]); } } } -/* +/*! + * @brief プレイヤーがオブジェクトを拾った際のメッセージ表示処理 / * Helper routine for py_pickup() and py_pickup_floor(). - * - * Add the given dungeon object to the character's inventory. - * - * Delete the object afterwards. + * @param o_idx 取得したオブジェクトの参照ID + * @return なし + * @details + * アイテムを拾った際に「2つのケーキを持っている」\n + * "You have two cakes." とアイテムを拾った後の合計のみの表示がオリジナル\n + * だが、違和感が\n + * あるという指摘をうけたので、「~を拾った、~を持っている」という表示\n + * にかえてある。そのための配列。\n + * Add the given dungeon object to the character's inventory.\n + * Delete the object afterwards.\n */ void py_pickup_aux(int o_idx) { - int slot, i; + int slot; #ifdef JP -/* - * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥­¤ò»ý¤Ã¤Æ¤¤¤ë¡× - * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë - * ¤À¤¬¡¢°ãÏ´¶¤¬ - * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨ - * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£ - */ char o_name[MAX_NLEN]; char old_name[MAX_NLEN]; char kazu_str[80]; @@ -820,23 +725,23 @@ void py_pickup_aux(int o_idx) #ifdef JP if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT)) { - msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name); - msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢"); - msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name); + msg_format("こうして、%sは『クリムゾン』を手に入れた。", p_ptr->name); + msg_print("しかし今、『混沌のサーペント』の放ったモンスターが、"); + msg_format("%sに襲いかかる...", p_ptr->name); } else { if (plain_pickup) { - msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot)); + msg_format("%s(%c)を持っている。",o_name, index_to_label(slot)); } else { if (o_ptr->number > hirottakazu) { - msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£", + msg_format("%s拾って、%s(%c)を持っている。", kazu_str, o_name, index_to_label(slot)); } else { - msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot)); + msg_format("%s(%c)を拾った。", o_name, index_to_label(slot)); } } } @@ -848,36 +753,22 @@ void py_pickup_aux(int o_idx) record_turn = turn; - /* Check if completed a quest */ - for (i = 0; i < max_quests; i++) - { - if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && - (quest[i].status == QUEST_STATUS_TAKEN) && - (quest[i].k_idx == o_ptr->name1)) - { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - quest[i].status = QUEST_STATUS_COMPLETED; - quest[i].complev = (byte)p_ptr->lev; -#ifdef JP - msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You completed your quest!"); -#endif - - msg_print(NULL); - } - } + check_find_art_quest_completion(o_ptr); } -/* +/*! + * @brief プレイヤーがオブジェクト上に乗った際の表示処理 + * @param pickup 自動拾い処理を行うならばTRUEとする + * @return なし + * @details * Player "wants" to pick up an object or gold. * Note that we ONLY handle things that can be picked up. * See "move_player()" for handling of other things. */ void carry(bool pickup) { - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; s16b this_o_idx, next_o_idx = 0; @@ -950,7 +841,7 @@ void carry(bool pickup) /* Message */ #ifdef JP - msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£", + msg_format(" $%ld の価値がある%sを見つけた。", (long)value, o_name); #else msg_format("You collect %ld gold pieces worth of %s.", @@ -982,23 +873,13 @@ void carry(bool pickup) /* Describe the object */ else if (!pickup) { -#ifdef JP - msg_format("%s¤¬¤¢¤ë¡£", o_name); -#else - msg_format("You see %s.", o_name); -#endif - + msg_format(_("%sがある。", "You see %s."), o_name); } /* Note that the pack is too full */ else if (!inven_carry_okay(o_ptr)) { -#ifdef JP - msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name); -#else - msg_format("You have no room for %s.", o_name); -#endif - + msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name); } /* Pick up the item (if requested and allowed) */ @@ -1010,12 +891,7 @@ void carry(bool pickup) if (carry_query_flag) { char out_val[MAX_NLEN+20]; -#ifdef JP - sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name); -#else - sprintf(out_val, "Pick up %s? ", o_name); -#endif - + sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name); okay = get_check(out_val); } @@ -1031,8 +907,12 @@ void carry(bool pickup) } -/* +/*! + * @brief プレイヤーへのトラップ命中判定 / * Determine if a trap affects the player. + * @param power 基本回避難度 + * @return トラップが命中した場合TRUEを返す。 + * @details * Always miss 5% of the time, Always hit 5% of the time. * Otherwise, match trap power against player armor. */ @@ -1063,250 +943,205 @@ static int check_hit(int power) } - -/* - * Handle player hitting a real trap +/*! + * @brief 落とし穴系トラップの判定とプレイヤーの被害処理 + * @param trap_feat_type トラップの種別ID + * @return なし */ -static void hit_trap(bool break_trap) +static void hit_trap_pit(int trap_feat_type) { - int i, num, dam; - int x = px, y = py; - - /* Get the cave grid */ - cave_type *c_ptr = &cave[y][x]; + HIT_POINT dam; + cptr trap_name = ""; + cptr spike_name = ""; - int trap_feat = c_ptr->feat; - -#ifdef JP - cptr name = "¥È¥é¥Ã¥×"; -#else - cptr name = "a trap"; -#endif - - /* Disturb the player */ - disturb(0, 0); - - cave_alter_feat(y, x, FF_HIT_TRAP); - - /* Analyze XXX XXX XXX */ - switch (trap_feat) + switch (trap_feat_type) { - case FEAT_TRAP_TRAPDOOR: - { - if (p_ptr->levitation) - { -#ifdef JP - msg_print("Í¸Í¤òÈô¤Ó±Û¤¨¤¿¡£"); -#else - msg_print("You fly over a trap door."); -#endif - - } - else - { -#ifdef JP - msg_print("Í¸Í¤ËÍî¤Á¤¿¡ª"); - if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("¤¯¤Ã¤½¡Á¡ª"); -#else - msg_print("You have fallen through a trap door!"); -#endif + case TRAP_PIT: + trap_name = _("落とし穴", "a pit trap"); + break; + case TRAP_SPIKED_PIT: + trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit"); + spike_name = _("スパイク", "spikes"); + break; + case TRAP_POISON_PIT: + trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit"); + spike_name = _("毒を塗られたスパイク", "poisonous spikes"); + break; + default: + return; + } - sound(SOUND_FALL); - dam = damroll(2, 8); -#ifdef JP - name = "Í¸Í"; -#else - name = "a trap door"; -#endif + if (p_ptr->levitation) + { + msg_format(_("%sを飛び越えた。", "You fly over %s."), trap_name); + return; + } - take_hit(DAMAGE_NOESCAPE, dam, name, -1); + msg_format(_("%sに落ちてしまった!", "You have fallen into %s!"), trap_name); - /* Still alive and autosave enabled */ - if (autosave_l && (p_ptr->chp >= 0)) - do_cmd_save_game(TRUE); + /* Base damage */ + dam = damroll(2, 6); -#ifdef JP - do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Í¸Í¤ËÍî¤Á¤¿"); -#else - do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!"); -#endif - prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT); + /* Extra spike damage */ + if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) && + one_in_(2)) + { + msg_format(_("%sが刺さった!", "You are impaled on %s!"), spike_name); - /* Leaving */ - p_ptr->leaving = TRUE; - } - break; - } + dam = dam * 2; + (void)set_cut(p_ptr->cut + randint1(dam)); - case FEAT_TRAP_PIT: - { - if (p_ptr->levitation) + if (trap_feat_type == TRAP_POISON_PIT) { + if (p_ptr->resist_pois || IS_OPPOSE_POIS()) { -#ifdef JP - msg_print("Í·ê¤òÈô¤Ó±Û¤¨¤¿¡£"); -#else - msg_print("You fly over a pit trap."); -#endif - + msg_print(_("しかし毒の影響はなかった!", "The poison does not affect you!")); } else { -#ifdef JP - msg_print("Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("You have fallen into a pit!"); -#endif - - dam = damroll(2, 6); -#ifdef JP - name = "Í·ê"; -#else - name = "a pit trap"; -#endif - - take_hit(DAMAGE_NOESCAPE, dam, name, -1); + dam = dam * 2; + (void)set_poisoned(p_ptr->poisoned + randint1(dam)); } - break; } + } - case FEAT_TRAP_SPIKED_PIT: - { - if (p_ptr->levitation) - { -#ifdef JP - msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£"); -#else - msg_print("You fly over a spiked pit."); -#endif - - } - else - { -#ifdef JP - msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("You fall into a spiked pit!"); -#endif - - - /* Base damage */ -#ifdef JP - name = "Í·ê"; -#else - name = "a pit trap"; -#endif - - dam = damroll(2, 6); - - /* Extra spike damage */ - if (randint0(100) < 50) - { -#ifdef JP - msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("You are impaled!"); -#endif + /* Take the damage */ + take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1); +} +/*! + * @brief ダーツ系トラップ(通常ダメージ)の判定とプレイヤーの被害処理 + * @return ダーツが命中した場合TRUEを返す + */ +static bool hit_trap_dart(void) +{ + bool hit = FALSE; -#ifdef JP - name = "¥È¥²¤Î¤¢¤ëÍ·ê"; -#else - name = "a spiked pit"; -#endif + if (check_hit(125)) + { + msg_print(_("小さなダーツが飛んできて刺さった!", "A small dart hits you!")); - dam = dam * 2; - (void)set_cut(p_ptr->cut + randint1(dam)); - } + take_hit(DAMAGE_ATTACK, damroll(1, 4), _("ダーツの罠", "a dart trap"), -1); - /* Take the damage */ - take_hit(DAMAGE_NOESCAPE, dam, name, -1); - } - break; - } + if (!CHECK_MULTISHADOW()) hit = TRUE; + } + else + { + msg_print(_("小さなダーツが飛んできた!が、運良く当たらなかった。", "A small dart barely misses you.")); + } - case FEAT_TRAP_POISON_PIT: - { - if (p_ptr->levitation) - { -#ifdef JP - msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£"); -#else - msg_print("You fly over a spiked pit."); -#endif + return hit; +} - } - else - { -#ifdef JP - msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª"); -#else - msg_print("You fall into a spiked pit!"); -#endif +/*! + * @brief ダーツ系トラップ(通常ダメージ+能力値減少)の判定とプレイヤーの被害処理 + * @param stat 低下する能力値ID + * @return なし + */ +static void hit_trap_lose_stat(int stat) +{ + if (hit_trap_dart()) + { + do_dec_stat(stat); + } +} +/*! + * @brief ダーツ系トラップ(通常ダメージ+減速)の判定とプレイヤーの被害処理 + * @return なし + */ +static void hit_trap_slow(void) +{ + if (hit_trap_dart()) + { + set_slow(p_ptr->slow + randint0(20) + 20, FALSE); + } +} - /* Base damage */ - dam = damroll(2, 6); +/*! + * @brief ダーツ系トラップ(通常ダメージ+状態異常)の判定とプレイヤーの被害処理 + * @param trap_message メッセージの補完文字列 + * @param resist 状態異常に抵抗する判定が出たならTRUE + * @param set_status 状態異常を指定する関数ポインタ + * @param turn 状態異常の追加ターン量 + * @return なし + */ +static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(IDX), IDX turn_aux) +{ + msg_print(trap_message); -#ifdef JP - name = "Í·ê"; -#else - name = "a pit trap"; -#endif + if (!resist) + { + set_status(turn_aux); + } +} +/*! + * @brief プレイヤーへのトラップ作動処理メインルーチン / + * Handle player hitting a real trap + * @param break_trap 作動後のトラップ破壊が確定しているならばTRUE + * @return なし + */ +static void hit_trap(bool break_trap) +{ + int i, num, dam; + int x = p_ptr->x, y = p_ptr->y; - /* Extra spike damage */ - if (randint0(100) < 50) - { -#ifdef JP - msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("You are impaled on poisonous spikes!"); -#endif + /* Get the cave grid */ + cave_type *c_ptr = &cave[y][x]; + feature_type *f_ptr = &f_info[c_ptr->feat]; + int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP; + cptr name = _("トラップ", "a trap"); + /* Disturb the player */ + disturb(0, 1); -#ifdef JP - name = "¥È¥²¤Î¤¢¤ëÍ·ê"; -#else - name = "a spiked pit"; -#endif + cave_alter_feat(y, x, FF_HIT_TRAP); + /* Analyze XXX XXX XXX */ + switch (trap_feat_type) + { + case TRAP_TRAPDOOR: + { + if (p_ptr->levitation) + { + msg_print(_("落とし戸を飛び越えた。", "You fly over a trap door.")); + } + else + { + msg_print(_("落とし戸に落ちた!", "You have fallen through a trap door!")); + if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) + msg_print(_("くっそ~!", "")); - dam = dam * 2; - (void)set_cut(p_ptr->cut + randint1(dam)); + sound(SOUND_FALL); + dam = damroll(2, 8); + name = _("落とし戸", "a trap door"); - if (p_ptr->resist_pois || IS_OPPOSE_POIS()) - { -#ifdef JP - msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª"); -#else - msg_print("The poison does not affect you!"); -#endif + take_hit(DAMAGE_NOESCAPE, dam, name, -1); - } + /* Still alive and autosave enabled */ + if (autosave_l && (p_ptr->chp >= 0)) + do_cmd_save_game(TRUE); - else - { - dam = dam * 2; - (void)set_poisoned(p_ptr->poisoned + randint1(dam)); - } - } + do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("落とし戸に落ちた", "You have fallen through a trap door!")); + prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT); - /* Take the damage */ - take_hit(DAMAGE_NOESCAPE, dam, name, -1); + /* Leaving */ + p_ptr->leaving = TRUE; } - break; } - case FEAT_TRAP_TY_CURSE: + case TRAP_PIT: + case TRAP_SPIKED_PIT: + case TRAP_POISON_PIT: { -#ifdef JP - msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª"); -#else - msg_print("There is a flash of shimmering light!"); -#endif + hit_trap_pit(trap_feat_type); + break; + } + case TRAP_TY_CURSE: + { + msg_print(_("何かがピカッと光った!", "There is a flash of shimmering light!")); num = 2 + randint1(3); for (i = 0; i < num; i++) { @@ -1327,292 +1162,121 @@ static void hit_trap(bool break_trap) break; } - case FEAT_TRAP_TELEPORT: + case TRAP_TELEPORT: { -#ifdef JP - msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª"); -#else - msg_print("You hit a teleport trap!"); -#endif - - teleport_player(100, TRUE); + msg_print(_("テレポート・トラップにひっかかった!", "You hit a teleport trap!")); + teleport_player(100, TELEPORT_PASSIVE); break; } - case FEAT_TRAP_FIRE: + case TRAP_FIRE: { -#ifdef JP - msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª"); -#else - msg_print("You are enveloped in flames!"); -#endif - + msg_print(_("炎に包まれた!", "You are enveloped in flames!")); dam = damroll(4, 6); -#ifdef JP - (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1); -#else - (void)fire_dam(dam, "a fire trap", -1); -#endif - + (void)fire_dam(dam, _("炎のトラップ", "a fire trap"), -1, FALSE); break; } - case FEAT_TRAP_ACID: + case TRAP_ACID: { -#ifdef JP - msg_print("»À¤¬¿á¤­¤«¤±¤é¤ì¤¿¡ª"); -#else - msg_print("You are splashed with acid!"); -#endif - + msg_print(_("酸が吹きかけられた!", "You are splashed with acid!")); dam = damroll(4, 6); -#ifdef JP - (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1); -#else - (void)acid_dam(dam, "an acid trap", -1); -#endif - + (void)acid_dam(dam, _("酸のトラップ", "an acid trap"), -1, FALSE); break; } - case FEAT_TRAP_SLOW: + case TRAP_SLOW: { - if (check_hit(125)) - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("A small dart hits you!"); -#endif - - dam = damroll(1, 4); - take_hit(DAMAGE_ATTACK, dam, name, -1); - (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE); - } - else - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("A small dart barely misses you."); -#endif - - } + hit_trap_slow(); break; } - case FEAT_TRAP_LOSE_STR: + case TRAP_LOSE_STR: { - if (check_hit(125)) - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("A small dart hits you!"); -#endif - - dam = damroll(1, 4); -#ifdef JP - take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1); -#else - take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1); -#endif - - (void)do_dec_stat(A_STR); - } - else - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("A small dart barely misses you."); -#endif - - } + hit_trap_lose_stat(A_STR); break; } - case FEAT_TRAP_LOSE_DEX: + case TRAP_LOSE_DEX: { - if (check_hit(125)) - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("A small dart hits you!"); -#endif - - dam = damroll(1, 4); -#ifdef JP - take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1); -#else - take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1); -#endif - - (void)do_dec_stat(A_DEX); - } - else - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("A small dart barely misses you."); -#endif - - } + hit_trap_lose_stat(A_DEX); break; } - case FEAT_TRAP_LOSE_CON: + case TRAP_LOSE_CON: { - if (check_hit(125)) - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª"); -#else - msg_print("A small dart hits you!"); -#endif - - dam = damroll(1, 4); -#ifdef JP - take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1); -#else - take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1); -#endif - - (void)do_dec_stat(A_CON); - } - else - { -#ifdef JP - msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£"); -#else - msg_print("A small dart barely misses you."); -#endif - - } + hit_trap_lose_stat(A_CON); break; } - case FEAT_TRAP_BLIND: + case TRAP_BLIND: { -#ifdef JP - msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A black gas surrounds you!"); -#endif - - if (!p_ptr->resist_blind) - { - (void)set_blind(p_ptr->blind + randint0(50) + 25); - } + hit_trap_set_abnormal_status( + _("黒いガスに包み込まれた!", "A black gas surrounds you!"), + p_ptr->resist_blind, + set_blind, p_ptr->blind + (TIME_EFFECT)randint0(50) + 25); break; } - case FEAT_TRAP_CONFUSE: + case TRAP_CONFUSE: { -#ifdef JP - msg_print("¤­¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A gas of scintillating colors surrounds you!"); -#endif - - if (!p_ptr->resist_conf) - { - (void)set_confused(p_ptr->confused + randint0(20) + 10); - } + hit_trap_set_abnormal_status( + _("きらめくガスに包み込まれた!", "A gas of scintillating colors surrounds you!"), + p_ptr->resist_conf, + set_confused, p_ptr->confused + (TIME_EFFECT)randint0(20) + 10); break; } - case FEAT_TRAP_POISON: + case TRAP_POISON: { -#ifdef JP - msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A pungent green gas surrounds you!"); -#endif - - if (!p_ptr->resist_pois && !IS_OPPOSE_POIS()) - { - (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10); - } + hit_trap_set_abnormal_status( + _("刺激的な緑色のガスに包み込まれた!", "A pungent green gas surrounds you!"), + p_ptr->resist_pois || IS_OPPOSE_POIS(), + set_poisoned, p_ptr->poisoned + (TIME_EFFECT)randint0(20) + 10); break; } - case FEAT_TRAP_SLEEP: + case TRAP_SLEEP: { -#ifdef JP - msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª"); -#else - msg_print("A strange white mist surrounds you!"); -#endif - + msg_print(_("奇妙な白い霧に包まれた!", "A strange white mist surrounds you!")); if (!p_ptr->free_act) { -#ifdef JP -msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£"); -#else - msg_print("You fall asleep."); -#endif - + msg_print(_("あなたは眠りに就いた。", "You fall asleep.")); if (ironman_nightmare) { -#ifdef JP -msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£"); -#else - msg_print("A horrible vision enters your mind."); -#endif - - - /* Pick a nightmare */ - get_mon_num_prep(get_nightmare, NULL); + msg_print(_("身の毛もよだつ光景が頭に浮かんだ。", "A horrible vision enters your mind.")); /* Have some nightmares */ - have_nightmare(get_mon_num(MAX_DEPTH)); + sanity_blast(NULL, FALSE); - /* Remove the monster restriction */ - get_mon_num_prep(NULL, NULL); } (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5); } break; } - case FEAT_TRAP_TRAPS: + case TRAP_TRAPS: { -#ifdef JP -msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª"); -#else - msg_print("There is a bright flash of light!"); -#endif - + msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!")); /* Make some new traps */ project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1); break; } - case FEAT_TRAP_ALARM: + case TRAP_ALARM: { -#ifdef JP - msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª"); -#else - msg_print("An alarm sounds!"); -#endif + msg_print(_("けたたましい音が鳴り響いた!", "An alarm sounds!")); aggravate_monsters(0); break; } - case FEAT_TRAP_OPEN: + case TRAP_OPEN: { -#ifdef JP - msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª"); -#else - msg_print("Suddenly, surrounding walls are opened!"); -#endif + msg_print(_("大音響と共にまわりの壁が崩れた!", "Suddenly, surrounding walls are opened!")); (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1); (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1); (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1); @@ -1621,17 +1285,13 @@ msg_print(" break; } - case FEAT_TRAP_ARMAGEDDON: + case TRAP_ARMAGEDDON: { static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1}; int evil_idx = 0, good_idx = 0; int lev; -#ifdef JP - msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤­¹þ¤Þ¤ì¤¿¡ª"); -#else - msg_print("Suddenly, you are surrounded by immotal beings!"); -#endif + msg_print(_("突然天界の戦争に巻き込まれた!", "Suddenly, you are surrounded by immotal beings!")); /* Summon Demons and Angels */ for (lev = dun_level; lev >= 20; lev -= 1 + lev/16) @@ -1646,7 +1306,7 @@ msg_print(" if (!in_bounds(y1, x1)) continue; /* Require line of projection */ - if (!projectable(py, px, y1, x1)) continue; + if (!projectable(p_ptr->y, p_ptr->x, y1, x1)) continue; if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET))) evil_idx = hack_m_idx_ii; @@ -1671,13 +1331,9 @@ msg_print(" break; } - case FEAT_TRAP_PIRANHA: + case TRAP_PIRANHA: { -#ifdef JP - msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª"); -#else - msg_print("Suddenly, the room is filled with water with piranhas!"); -#endif + msg_print(_("突然壁から水が溢れ出した!ピラニアがいる!", "Suddenly, the room is filled with water with piranhas!")); /* Water fills room */ fire_ball_hide(GF_WATER_FLOW, 0, 1, 10); @@ -1695,178 +1351,125 @@ msg_print(" if (break_trap && is_trap(c_ptr->feat)) { cave_alter_feat(y, x, FF_DISARM); -#ifdef JP - msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£"); -#else - msg_print("You destroyed the trap."); -#endif + msg_print(_("トラップを粉砕した。", "You destroyed the trap.")); } } -static void touch_zap_player(monster_type *m_ptr) +/*! + * @brief 敵オーラによるプレイヤーのダメージ処理(補助) + * @param m_ptr オーラを持つモンスターの構造体参照ポインタ + * @param immune ダメージを回避できる免疫フラグ + * @param flags_offset オーラフラグ配列の参照オフセット + * @param r_flags_offset モンスターの耐性配列の参照オフセット + * @param aura_flag オーラフラグ配列 + * @param dam_func ダメージ処理を行う関数の参照ポインタ + * @param message オーラダメージを受けた際のメッセージ + * @return なし + */ +static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag, + int (*dam_func)(HIT_POINT dam, cptr kb_str, int monspell, bool aura), cptr message) { - int aura_damage = 0; monster_race *r_ptr = &r_info[m_ptr->r_idx]; - if (r_ptr->flags2 & RF2_AURA_FIRE) + if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune) { - if (!p_ptr->immune_fire) - { - char aura_dam[80]; + char mon_name[80]; + int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17)); - aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17)); + /* Hack -- Get the "died from" name */ + monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); - /* Hack -- Get the "died from" name */ - monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); + msg_print(message); -#ifdef JP - msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª"); -#else - msg_print("You are suddenly very hot!"); -#endif - - if (prace_is_(RACE_ENT)) aura_damage += aura_damage / 3; - if (IS_OPPOSE_FIRE()) aura_damage = (aura_damage + 2) / 3; - if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3; + dam_func(aura_damage, mon_name, -1, TRUE); - take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1); - if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE; - handle_stuff(); - } - } - - if (r_ptr->flags3 & RF3_AURA_COLD) - { - if (!p_ptr->immune_cold) + if (is_original_ap_and_seen(m_ptr)) { - char aura_dam[80]; - - aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17)); - - /* Hack -- Get the "died from" name */ - monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); - -#ifdef JP - msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª"); -#else - msg_print("You are suddenly very cold!"); -#endif - - if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3; - if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3; - - take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1); - if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD; - handle_stuff(); + atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag; } - } - - if (r_ptr->flags2 & RF2_AURA_ELEC) - { - if (!p_ptr->immune_elec) - { - char aura_dam[80]; - - aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17)); - - /* Hack -- Get the "died from" name */ - monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); - - if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3; - if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3; - if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3; - -#ifdef JP - msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª"); -#else - msg_print("You get zapped!"); -#endif - take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1); - if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC; - handle_stuff(); - } + handle_stuff(); } } +/*! + * @brief 敵オーラによるプレイヤーのダメージ処理(メイン) + * @param m_ptr オーラを持つモンスターの構造体参照ポインタ + * @return なし + */ +static void touch_zap_player(monster_type *m_ptr) +{ + touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE, + fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!")); + touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD, + cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!")); + touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC, + elec_dam, _("電撃をくらった!", "You get zapped!")); +} + +/*! + * @brief プレイヤーの変異要素による打撃処理 + * @param m_idx 攻撃目標となったモンスターの参照ID + * @param attack 変異要素による攻撃要素の種類 + * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ + * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ + * @return なし + */ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath) { - int k, bonus, chance; + HIT_POINT k; + int bonus, chance; int n_weight = 0; monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; char m_name[80]; - int dss, ddd; + int dice_num, dice_side; cptr atk_desc; switch (attack) { case MUT2_SCOR_TAIL: - dss = 3; - ddd = 7; + dice_num = 3; + dice_side = 7; n_weight = 5; -#ifdef JP - atk_desc = "¿¬Èø"; -#else - atk_desc = "tail"; -#endif + atk_desc = _("尻尾", "tail"); break; case MUT2_HORNS: - dss = 2; - ddd = 6; + dice_num = 2; + dice_side = 6; n_weight = 15; -#ifdef JP - atk_desc = "³Ñ"; -#else - atk_desc = "horns"; -#endif + atk_desc = _("角", "horns"); break; case MUT2_BEAK: - dss = 2; - ddd = 4; + dice_num = 2; + dice_side = 4; n_weight = 5; -#ifdef JP - atk_desc = "¥¯¥Á¥Ð¥·"; -#else - atk_desc = "beak"; -#endif + atk_desc = _("クチバシ", "beak"); break; case MUT2_TRUNK: - dss = 1; - ddd = 4; + dice_num = 1; + dice_side = 4; n_weight = 35; -#ifdef JP - atk_desc = "¾Ý¤ÎÉ¡"; -#else - atk_desc = "trunk"; -#endif + atk_desc = _("象の鼻", "trunk"); break; case MUT2_TENTACLES: - dss = 2; - ddd = 5; + dice_num = 2; + dice_side = 5; n_weight = 5; -#ifdef JP - atk_desc = "¿¨¼ê"; -#else - atk_desc = "tentacles"; -#endif + atk_desc = _("触手", "tentacles"); break; default: - dss = ddd = n_weight = 1; -#ifdef JP - atk_desc = "̤ÄêµÁ¤ÎÉô°Ì"; -#else - atk_desc = "undefined body part"; -#endif + dice_num = dice_side = n_weight = 1; + atk_desc = _("未定義の部位", "undefined body part"); } @@ -1884,15 +1487,9 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath) { /* Sound */ sound(SOUND_HIT); + msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc); -#ifdef JP - msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc); -#else - msg_format("You hit %s with your %s.", m_name, atk_desc); -#endif - - - k = damroll(ddd, dss); + k = damroll(dice_num, dice_side); k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0); /* Apply the player damage bonuses */ @@ -1905,15 +1502,9 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath) k = mon_damage_mod(m_ptr, k, FALSE); /* Complex message */ - if (p_ptr->wizard) - { -#ifdef JP - msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp); -#else - msg_format("You do %d (out of %d) damage.", k, m_ptr->hp); -#endif - - } + msg_format_wizard(CHEAT_MONSTER, + _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), + k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp); /* Anger the monster */ if (k > 0) anger_monster(m_ptr); @@ -1950,25 +1541,28 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath) sound(SOUND_MISS); /* Message */ -#ifdef JP - msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name); -#else - msg_format("You miss %s.", m_name); -#endif - + msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name); } } - -/* +/*! + * @brief プレイヤーの打撃処理サブルーチン / * Player attacks a (poor, defenseless) creature -RAK- - * + * @param y 攻撃目標のY座標 + * @param x 攻撃目標のX座標 + * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ + * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ + * @param hand 攻撃を行うための武器を持つ手 + * @param mode 発動中の剣術ID + * @return なし + * @details * If no "weapon" is available, then "punch" the monster one time. */ -static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode) +static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT_FLAGS mode) { - int num = 0, k, bonus, chance, vir; + int num = 0, bonus, chance, vir; + HIT_POINT k; cave_type *c_ptr = &cave[y][x]; @@ -1981,7 +1575,6 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int char m_name[80]; bool success_hit = FALSE; - bool old_success_hit = FALSE; bool backstab = FALSE; bool vorpal_cut = FALSE; int chaos_effect = 0; @@ -2010,7 +1603,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3; if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2; if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3; - if (m_ptr->csleep && m_ptr->ml) + if (MON_CSLEEP(m_ptr) && m_ptr->ml) { /* Can't backstab creatures that we can't see, right? */ backstab = TRUE; @@ -2019,7 +1612,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { fuiuchi = TRUE; } - else if (m_ptr->monfear && m_ptr->ml) + else if (MON_MONFEAR(m_ptr) && m_ptr->ml) { stab_fleeing = TRUE; } @@ -2029,7 +1622,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int case CLASS_MONK: case CLASS_FORCETRAINER: case CLASS_BERSERKER: - if (empty_hands(TRUE) & EMPTY_HAND_RARM) monk_attack = TRUE; + if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE; break; } @@ -2055,12 +1648,12 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if ((r_ptr->level + 10) > p_ptr->lev) { - int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN; - int sval = inventory[INVEN_RARM+hand].sval; + OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN; + OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM+hand].sval; int now_exp = p_ptr->weapon_exp[tval][sval]; if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval]) { - int amount = 0; + SUB_EXP amount = 0; if (now_exp < WEAPON_EXP_BEGINNER) amount = 80; else if (now_exp < WEAPON_EXP_SKILLED) amount = 10; else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1; @@ -2072,8 +1665,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int } /* Disturb the monster */ - m_ptr->csleep = 0; - if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE); + (void)set_monster_csleep(c_ptr->m_idx, 0); /* Extract monster name (or "it") */ monster_desc(m_name, m_ptr, 0); @@ -2099,30 +1691,36 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2; else num_blow = p_ptr->num_blow[hand]; + /* Hack -- DOKUBARI always hit once */ + if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1; + /* Attack once for each legal blow */ while ((num++ < num_blow) && !p_ptr->is_dead) { if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO)) { + int n = 1; + if (p_ptr->migite && p_ptr->hidarite) { - success_hit = one_in_(2); + n *= 2; } - else success_hit = TRUE; - } - else if (mode == HISSATSU_MAJIN) - { - if (num == 1) + if (mode == HISSATSU_3DAN) { - if (one_in_(2)) - success_hit = FALSE; - old_success_hit = success_hit; + n *= 2; } - else success_hit = old_success_hit; + + success_hit = one_in_(n); } else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE; else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml); + if (mode == HISSATSU_MAJIN) + { + if (one_in_(2)) + success_hit = FALSE; + } + /* Test for hit */ if (success_hit) { @@ -2133,10 +1731,10 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int /* Message */ #ifdef JP - if (backstab) msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ­»É¤·¤¿¡ª", m_name); - else if (fuiuchi) msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª", m_name); - else if (stab_fleeing) msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ­»É¤·¤¿¡ª", m_name); - else if (!monk_attack) msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name); + if (backstab) msg_format("あなたは冷酷にも眠っている無力な%sを突き刺した!", m_name); + else if (fuiuchi) msg_format("不意を突いて%sに強烈な一撃を喰らわせた!", m_name); + else if (stab_fleeing) msg_format("逃げる%sを背中から突き刺した!", m_name); + else if (!monk_attack) msg_format("%sを攻撃した。", m_name); #else if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name); else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name); @@ -2183,7 +1781,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int } /* Vampiric drain */ - if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN)) + if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE)) { /* Only drain "living" monsters */ if (monster_living(r_ptr)) @@ -2192,7 +1790,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int can_drain = FALSE; } - if ((have_flag(flgs, TR_VORPAL)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou) + if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou) vorpal_cut = TRUE; else vorpal_cut = FALSE; @@ -2200,7 +1798,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { int special_effect = 0, stun_effect = 0, times = 0, max_times; int min_level = 1; - martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0]; + const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0]; int resist_stun = 0; int weight = 8; @@ -2239,11 +1837,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (p_ptr->wizard && cheat_xtra) { -#ifdef JP - msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£"); -#else - msg_print("Attack re-selected."); -#endif + msg_print(_("攻撃を再選択しました。", "Attack re-selected.")); } } else @@ -2261,12 +1855,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if (r_ptr->flags1 & RF1_MALE) { -#ifdef JP - msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name); -#else - msg_format("You hit %s in the groin with your knee!", m_name); -#endif - + msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), m_name); sound(SOUND_PAIN); special_effect = MA_KNEE; } @@ -2279,12 +1868,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (!((r_ptr->flags1 & RF1_NEVER_MOVE) || my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char))) { -#ifdef JP - msg_format("%s¤Î­¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name); -#else - msg_format("You kick %s in the ankle.", m_name); -#endif - + msg_format(_("%sの足首に関節蹴りをくらわした!", "You kick %s in the ankle."), m_name); special_effect = MA_SLOW; } else msg_format(ma_ptr->desc, m_name); @@ -2300,9 +1884,9 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int } if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4; - if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0])) + if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI) { - weight += (p_ptr->magic_num1[0]/30); + weight += (P_PTR_KI / 30); if (weight > 20) weight = 20; } @@ -2310,12 +1894,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp)) { -#ifdef JP - msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name); -#else - msg_format("%^s moans in agony!", m_name); -#endif - + msg_format(_("%^sは苦痛にうめいている!", "%^s moans in agony!"), m_name); stun_effect = 7 + randint1(13); resist_stun /= 3; } @@ -2326,12 +1905,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int (randint1(p_ptr->lev) > r_ptr->level) && m_ptr->mspeed > 60) { -#ifdef JP - msg_format("%^s¤Ï­¤ò¤Ò¤­¤º¤ê»Ï¤á¤¿¡£", m_name); -#else - msg_format("%^s starts limping slower.", m_name); -#endif - + msg_format(_("%^sは足をひきずり始めた。", "%^s starts limping slower."), m_name); m_ptr->mspeed -= 10; } } @@ -2340,15 +1914,14 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10)) { -#ifdef JP - if (m_ptr->stunned) msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name); - else msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name); -#else - if (m_ptr->stunned) msg_format("%^s is more stunned.", m_name); - else msg_format("%^s is stunned.", m_name); -#endif - - m_ptr->stunned += stun_effect; + if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr))) + { + msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name); + } + else + { + msg_format(_("%^sはさらにフラフラになった。", "%^s is more stunned."), m_name); + } } } } @@ -2390,11 +1963,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2)) { char chainsword_noise[1024]; -#ifdef JP - if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise)) -#else - if (!get_rnd_line("chainswd.txt", 0, chainsword_noise)) -#endif + if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise)) { msg_print(chainsword_noise); } @@ -2402,19 +1971,11 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (o_ptr->name1 == ART_VORPAL_BLADE) { -#ifdef JP - msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª"); -#else - msg_print("Your Vorpal Blade goes snicker-snack!"); -#endif + msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!")); } else { -#ifdef JP - msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name); -#else - msg_format("Your weapon cuts deep into %s!", m_name); -#endif + msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), m_name); } /* Try to increase the damage */ @@ -2423,38 +1984,24 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mult++; } - k *= mult; + k *= (HIT_POINT)mult; /* Ouch! */ if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp) { -#ifdef JP - msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name); -#else - msg_format("You cut %s in half!", m_name); -#endif + msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), m_name); } else { switch (mult) { -#ifdef JP - case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break; - case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break; - case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break; - case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break; - case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break; - case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break; - default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break; -#else - case 2: msg_format("You gouge %s!", m_name); break; - case 3: msg_format("You maim %s!", m_name); break; - case 4: msg_format("You carve %s!", m_name); break; - case 5: msg_format("You cleave %s!", m_name); break; - case 6: msg_format("You smite %s!", m_name); break; - case 7: msg_format("You eviscerate %s!", m_name); break; - default: msg_format("You shred %s!", m_name); break; -#endif + case 2: msg_format(_("%sを斬った!", "You gouge %s!"), m_name); break; + case 3: msg_format(_("%sをぶった斬った!", "You maim %s!"), m_name); break; + case 4: msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), m_name); break; + case 5: msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), m_name); break; + case 6: msg_format(_("%sを刺身にした!", "You smite %s!"), m_name); break; + case 7: msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), m_name); break; + default: msg_format(_("%sを細切れにした!", "You shred %s!"), m_name); break; } } drain_result = drain_result * 3 / 2; @@ -2482,21 +2029,13 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (zantetsu_mukou) { -#ifdef JP - msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª"); -#else - msg_print("You cannot cut such a elastic thing!"); -#endif + msg_print(_("こんな軟らかいものは切れん!", "You cannot cut such a elastic thing!")); k = 0; } if (e_j_mukou) { -#ifdef JP - msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª"); -#else - msg_print("Spiders are difficult for you to deal with!"); -#endif + msg_print(_("蜘蛛は苦手だ!", "Spiders are difficult for you to deal with!")); k /= 2; } @@ -2510,35 +2049,22 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (!(r_ptr->flags3 & (RF3_NO_STUN))) { /* Get stunned */ - if (m_ptr->stunned) + if (MON_STUNNED(m_ptr)) { -#ifdef JP - msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name); -#else - msg_format("%s is more dazed.", m_name); -#endif - + msg_format(_("%sはひどくもうろうとした。", "%s is more dazed."), m_name); tmp /= 2; } else { -#ifdef JP - msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name); -#else - msg_format("%s is dazed.", m_name); -#endif + msg_format(_("%s はもうろうとした。", "%s is dazed."), m_name); } /* Apply stun */ - m_ptr->stunned = (tmp < 200) ? tmp : 200; + (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp); } else { -#ifdef JP - msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name); -#else - msg_format("%s is not effected.", m_name); -#endif + msg_format(_("%s には効果がなかった。", "%s is not effected."), m_name); } } @@ -2549,11 +2075,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)) { k = m_ptr->hp + 1; -#ifdef JP - msg_format("%s¤ÎµÞ½ê¤òÆͤ­»É¤·¤¿¡ª", m_name); -#else - msg_format("You hit %s on a fatal spot!", m_name); -#endif + msg_format(_("%sの急所を突き刺した!", "You hit %s on a fatal spot!"), m_name); } else k = 1; } @@ -2564,11 +2086,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { k *= 5; drain_result *= 2; -#ifdef JP - msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ­»É¤µ¤Ã¤¿¡ª", m_name); -#else - msg_format("You critically injured %s!", m_name); -#endif + msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), m_name); } else if (((m_ptr->hp < maxhp/2) && one_in_((p_ptr->num_blow[0]+p_ptr->num_blow[1]+1)*10)) || ((one_in_(666) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))) { @@ -2576,33 +2094,19 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { k = MAX(k*5, m_ptr->hp/2); drain_result *= 2; -#ifdef JP - msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name); -#else - msg_format("You fatally injured %s!", m_name); -#endif + msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), m_name); } else { k = m_ptr->hp + 1; -#ifdef JP - msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name); -#else - msg_format("You hit %s on a fatal spot!", m_name); -#endif + msg_format(_("刃が%sの急所を貫いた!", "You hit %s on a fatal spot!"), m_name); } } } - /* Complex message */ - if (p_ptr->wizard || cheat_xtra) - { -#ifdef JP - msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp); -#else - msg_format("You do %d (out of %d) damage.", k, m_ptr->hp); -#endif - } + msg_format_wizard(CHEAT_MONSTER, + _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), k, + m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp); if (k <= 0) can_drain = FALSE; @@ -2613,24 +2117,20 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (mon_take_hit(c_ptr->m_idx, k, fear, NULL)) { *mdeath = TRUE; - if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use) + if ((p_ptr->pclass == CLASS_BERSERKER) && p_ptr->energy_use) { if (p_ptr->migite && p_ptr->hidarite) { - if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5); - else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5); + if (hand) p_ptr->energy_use = p_ptr->energy_use*3/5+p_ptr->energy_use*num*2/(p_ptr->num_blow[hand]*5); + else p_ptr->energy_use = p_ptr->energy_use*num*3/(p_ptr->num_blow[hand]*5); } else { - energy_use = energy_use*num/p_ptr->num_blow[hand]; + p_ptr->energy_use = p_ptr->energy_use*num/p_ptr->num_blow[hand]; } } if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel) -#ifdef JP - msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥"); -#else - msg_print("Sigh... Another trifling thing I've cut...."); -#endif + msg_print(_("またつまらぬものを斬ってしまった...", "Sigh... Another trifling thing I've cut....")); break; } @@ -2648,8 +2148,8 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if (is_human) { - int to_h = o_ptr->to_h; - int to_d = o_ptr->to_d; + HIT_PROB to_h = o_ptr->to_h; + HIT_POINT to_d = o_ptr->to_d; int i, flag; flag = 1; @@ -2662,11 +2162,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (o_ptr->to_h != to_h || o_ptr->to_d != to_d) { -#ifdef JP - msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª"); -#else - msg_print("Muramasa sucked blood, and became more powerful!"); -#endif + msg_print(_("妖刀は血を吸って強くなった!", "Muramasa sucked blood, and became more powerful!")); o_ptr->to_h = to_h; o_ptr->to_d = to_d; } @@ -2678,14 +2174,12 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { drain_heal = damroll(2, drain_result / 6); + /* Hex */ + if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2; + if (cheat_xtra) { -#ifdef JP - msg_format("Draining left: %d", drain_left); -#else - msg_format("Draining left: %d", drain_left); -#endif - + msg_format(_("Draining left: %d", "Draining left: %d"), drain_left); } if (drain_left) @@ -2702,12 +2196,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (drain_msg) { -#ifdef JP - msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name); -#else - msg_format("Your weapon drains life from %s!", m_name); -#endif - + msg_format(_("刃が%sから生命力を吸い取った!", "Your weapon drains life from %s!"), m_name); drain_msg = FALSE; } @@ -2720,23 +2209,20 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int } m_ptr->maxhp -= (k+7)/8; if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp; + if (m_ptr->maxhp < 1) m_ptr->maxhp = 1; weak = TRUE; } can_drain = FALSE; drain_result = 0; /* Confusion attack */ - if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF)) + if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION)) { /* Cancel glowing hands */ if (p_ptr->special_attack & ATTACK_CONFUSE) { p_ptr->special_attack &= ~(ATTACK_CONFUSE); -#ifdef JP - msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£"); -#else - msg_print("Your hands stop glowing."); -#endif + msg_print(_("手の輝きがなくなった。", "Your hands stop glowing.")); p_ptr->redraw |= (PR_STATUS); } @@ -2745,32 +2231,17 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (r_ptr->flags3 & RF3_NO_CONF) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF; - -#ifdef JP - msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name); -#else - msg_format("%^s is unaffected.", m_name); -#endif + msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name); } else if (randint0(100) < r_ptr->level) { -#ifdef JP - msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name); -#else - msg_format("%^s is unaffected.", m_name); -#endif - + msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name); } else { -#ifdef JP - msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name); -#else - msg_format("%^s appears confused.", m_name); -#endif - - m_ptr->confused += 10 + randint0(p_ptr->lev) / 5; + msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name); + (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5); } } @@ -2783,36 +2254,21 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (r_ptr->flags1 & RF1_UNIQUE) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; -#ifdef JP - msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name); -#else - msg_format("%^s is unaffected!", m_name); -#endif - + msg_format(_("%^sには効果がなかった。", "%^s is unaffected!"), m_name); resists_tele = TRUE; } else if (r_ptr->level > randint1(100)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; -#ifdef JP - msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name); -#else - msg_format("%^s resists!", m_name); -#endif - + msg_format(_("%^sは抵抗力を持っている!", "%^s resists!"), m_name); resists_tele = TRUE; } } if (!resists_tele) { -#ifdef JP - msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name); -#else - msg_format("%^s disappears!", m_name); -#endif - - teleport_away(c_ptr->m_idx, 50, FALSE, TRUE); + msg_format(_("%^sは消えた!", "%^s disappears!"), m_name); + teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE); num = num_blow + 1; /* Can't hit it anymore! */ *mdeath = TRUE; } @@ -2825,55 +2281,40 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if (polymorph_monster(y, x)) { -#ifdef JP - msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name); -#else - msg_format("%^s changes!", m_name); -#endif - - - /* Hack -- Get new monster */ - m_ptr = &m_list[c_ptr->m_idx]; - - /* Oops, we need a different name... */ - monster_desc(m_name, m_ptr, 0); - - /* Hack -- Get new race */ - r_ptr = &r_info[m_ptr->r_idx]; - + msg_format(_("%^sは変化した!", "%^s changes!"), m_name); *fear = FALSE; weak = FALSE; } else { -#ifdef JP - msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name); -#else - msg_format("%^s is unaffected.", m_name); -#endif - + msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name); } + + /* Hack -- Get new monster */ + m_ptr = &m_list[c_ptr->m_idx]; + + /* Oops, we need a different name... */ + monster_desc(m_name, m_ptr, 0); + + /* Hack -- Get new race */ + r_ptr = &r_info[m_ptr->r_idx]; } } else if (o_ptr->name1 == ART_G_HAMMER) { - monster_type *m_ptr = &m_list[c_ptr->m_idx]; + monster_type *target_ptr = &m_list[c_ptr->m_idx]; - if (m_ptr->hold_o_idx) + if (target_ptr->hold_o_idx) { - object_type *q_ptr = &o_list[m_ptr->hold_o_idx]; + object_type *q_ptr = &o_list[target_ptr->hold_o_idx]; char o_name[MAX_NLEN]; object_desc(o_name, q_ptr, OD_NAME_ONLY); q_ptr->held_m_idx = 0; - q_ptr->marked = 0; - m_ptr->hold_o_idx = q_ptr->next_o_idx; + q_ptr->marked = OM_TOUCHED; + target_ptr->hold_o_idx = q_ptr->next_o_idx; q_ptr->next_o_idx = 0; -#ifdef JP - msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name); -#else - msg_format("You snatched %s.", o_name); -#endif + msg_format(_("%sを奪った。", "You snatched %s."), o_name); inven_carry(q_ptr); } } @@ -2887,26 +2328,18 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3)) { - u32b flgs[TR_FLAG_SIZE]; + u32b flgs_aux[TR_FLAG_SIZE]; /* Sound */ sound(SOUND_HIT); /* Message */ -#ifdef JP - msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name); -#else - msg_format("You miss %s.", m_name); -#endif + msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name); /* Message */ -#ifdef JP - msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ­¤¿¡ª"); -#else - msg_print("Your scythe returns to you!"); -#endif + msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!")); /* Extract the flags */ - object_flags(o_ptr, flgs); + object_flags(o_ptr, flgs_aux); k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]); { @@ -2921,6 +2354,8 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int case RACE_HUMAN: case RACE_AMBERITE: case RACE_DUNADAN: + case RACE_BARBARIAN: + case RACE_BEASTMAN: mult = 25;break; case RACE_HALF_ORC: case RACE_HALF_TROLL: @@ -2961,13 +2396,13 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25)) mult = 25; - if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30))) + if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30))) { p_ptr->csp -= (1+(p_ptr->msp / 30)); p_ptr->redraw |= (PR_MANA); mult = mult * 3 / 2 + 20; } - k *= mult; + k *= (HIT_POINT)mult; k /= 10; } @@ -2975,29 +2410,19 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (one_in_(6)) { int mult = 2; -#ifdef JP - msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª"); -#else - msg_format("Your weapon cuts deep into yourself!"); -#endif + msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!")); /* Try to increase the damage */ while (one_in_(4)) { mult++; } - k *= mult; + k *= (HIT_POINT)mult; } k += (p_ptr->to_d[hand] + o_ptr->to_d); - if (k < 0) k = 0; -#ifdef JP - take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1); -#else - take_hit(DAMAGE_FORCE, k, "Death scythe", -1); -#endif - + take_hit(DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1); redraw_stuff(); } else @@ -3006,11 +2431,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int sound(SOUND_MISS); /* Message */ -#ifdef JP - msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name); -#else - msg_format("You miss %s.", m_name); -#endif + msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name); } } backstab = FALSE; @@ -3020,11 +2441,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (weak && !(*mdeath)) { -#ifdef JP - msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name); -#else - msg_format("%^s seems weakened.", m_name); -#endif + msg_format(_("%sは弱くなったようだ。", "%^s seems weakened."), m_name); } if (drain_left != MAX_VAMPIRIC_DRAIN) { @@ -3036,12 +2453,21 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int /* Mega-Hack -- apply earthquake brand */ if (do_quake) { - earthquake(py, px, 10); + earthquake(p_ptr->y, p_ptr->x, 10); if (!cave[y][x].m_idx) *mdeath = TRUE; } } -bool py_attack(int y, int x, int mode) +/*! + * @brief プレイヤーの打撃処理メインルーチン + * @param y 攻撃目標のY座標 + * @param x 攻撃目標のX座標 + * @param mode 発動中の剣術ID + * @return 実際に攻撃処理が行われた場合TRUEを返す。 + * @details + * If no "weapon" is available, then "punch" the monster one time. + */ +bool py_attack(int y, int x, BIT_FLAGS mode) { bool fear = FALSE; bool mdeath = FALSE; @@ -3053,18 +2479,15 @@ bool py_attack(int y, int x, int mode) char m_name[80]; /* Disturb the player */ - disturb(0, 0); + disturb(0, 1); - energy_use = 100; + p_ptr->energy_use = 100; if (!p_ptr->migite && !p_ptr->hidarite && !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES))) { -#ifdef JP - msg_format("%s¹¶·â¤Ç¤­¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ" : ""); -#else - msg_print("You cannot do attacking."); -#endif + msg_format(_("%s攻撃できない。", "You cannot do attacking."), + (empty_hands(FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : ""); return FALSE; } @@ -3074,7 +2497,7 @@ bool py_attack(int y, int x, int mode) if (m_ptr->ml) { /* Auto-Recall if possible and visible */ - monster_race_track(m_ptr->ap_r_idx); + if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); /* Track a new monster */ health_track(c_ptr->m_idx); @@ -3085,22 +2508,14 @@ bool py_attack(int y, int x, int mode) { if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU)) { -#ifdef JP - msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª"); -#else - msg_print("I can not attack women!"); -#endif + msg_print(_("拙者、おなごは斬れぬ!", "I can not attack women!")); return FALSE; } } if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) { -#ifdef JP - msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£"); -#else - msg_print("Something prevent you from attacking."); -#endif + msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking.")); return FALSE; } @@ -3113,11 +2528,7 @@ bool py_attack(int y, int x, int mode) if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE; if (stormbringer) { -#ifdef JP - msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name); -#else - msg_format("Your black blade greedily attacks %s!", m_name); -#endif + msg_format(_("黒い刃は強欲に%sを攻撃した!", "Your black blade greedily attacks %s!"), m_name); chg_virtue(V_INDIVIDUALISM, 1); chg_virtue(V_HONOUR, -1); chg_virtue(V_JUSTICE, -1); @@ -3125,11 +2536,7 @@ bool py_attack(int y, int x, int mode) } else if (p_ptr->pclass != CLASS_BERSERKER) { -#ifdef JP - if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©")) -#else - if (get_check("Really hit it? ")) -#endif + if (get_check(_("本当に攻撃しますか?", "Really hit it? "))) { chg_virtue(V_INDIVIDUALISM, 1); chg_virtue(V_HONOUR, -1); @@ -3138,11 +2545,7 @@ bool py_attack(int y, int x, int mode) } else { -#ifdef JP - msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name); -#else - msg_format("You stop to avoid hitting %s.", m_name); -#endif + msg_format(_("%sを攻撃するのを止めた。", "You stop to avoid hitting %s."), m_name); return FALSE; } } @@ -3154,28 +2557,18 @@ bool py_attack(int y, int x, int mode) { /* Message */ if (m_ptr->ml) -#ifdef JP - msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤­¤Ê¤¤¡ª", m_name); -#else - msg_format("You are too afraid to attack %s!", m_name); -#endif - + msg_format(_("恐くて%sを攻撃できない!", "You are too afraid to attack %s!"), m_name); else -#ifdef JP - msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª"); -#else - msg_format ("There is something scary in your way!"); -#endif + msg_format (_("そっちには何か恐いものがいる!", "There is something scary in your way!")); /* Disturb the monster */ - m_ptr->csleep = 0; - if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE); + (void)set_monster_csleep(c_ptr->m_idx, 0); /* Done */ return FALSE; } - if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */ + if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */ { 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); @@ -3253,12 +2646,7 @@ bool py_attack(int y, int x, int mode) sound(SOUND_FLEE); /* 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 ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath)) @@ -3270,6 +2658,14 @@ bool py_attack(int y, int x, int mode) } +/*! + * @brief パターンによる移動制限処理 + * @param c_y プレイヤーの移動元Y座標 + * @param c_x プレイヤーの移動元X座標 + * @param n_y プレイヤーの移動先Y座標 + * @param n_x プレイヤーの移動先X座標 + * @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。 + */ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) { feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat]; @@ -3280,18 +2676,15 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE; - pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->power : NOT_PATTERN_TILE; - pattern_type_new = is_pattern_tile_new ? new_f_ptr->power : NOT_PATTERN_TILE; + pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE; + pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE; if (pattern_type_new == PATTERN_TILE_START) { if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image) { -#ifdef JP - if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤭»Ï¤á¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©")) -#else - if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? ")) -#endif + if (get_check(_("パターンの上を歩き始めると、全てを歩かなければなりません。いいですか?", + "If you start walking the Pattern, you must walk the whole way. Ok? "))) return TRUE; else return FALSE; @@ -3309,11 +2702,8 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) } else { -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤭»Ï¤á¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£"); -#else - msg_print("You must start walking the Pattern from the startpoint."); -#endif + msg_print(_("パターンの上を歩くにはスタート地点から歩き始めなくてはなりません。", + "You must start walking the Pattern from the startpoint.")); return FALSE; } @@ -3329,12 +2719,7 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) return TRUE; else { -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£"); -#else - msg_print("You must walk the Pattern in correct order."); -#endif - + msg_print(_("パターンの上は正しい順序で歩かねばなりません。", "You must walk the Pattern in correct order.")); return FALSE; } } @@ -3344,12 +2729,7 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) { if (!is_pattern_tile_new) { -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£"); -#else - msg_print("You may not step off from the Pattern."); -#endif - + msg_print(_("パターンを踏み外してはいけません。", "You may not step off from the Pattern.")); return FALSE; } else @@ -3361,11 +2741,8 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) { if (!is_pattern_tile_cur) { -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤭»Ï¤á¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£"); -#else - msg_print("You must start walking the Pattern from the startpoint."); -#endif + msg_print(_("パターンの上を歩くにはスタート地点から歩き始めなくてはなりません。", + "You must start walking the Pattern from the startpoint.")); return FALSE; } @@ -3388,11 +2765,7 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) break; default: if (p_ptr->wizard) -#ifdef JP - msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur); -#else - msg_format("Funny Pattern walking, %d.", pattern_type_cur); -#endif + msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur); return TRUE; /* Goof-up */ } @@ -3403,17 +2776,9 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) else { if (!is_pattern_tile_new) -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£"); -#else - msg_print("You may not step off from the Pattern."); -#endif + msg_print(_("パターンを踏み外してはいけません。", "You may not step off from the Pattern.")); else -#ifdef JP - msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£"); -#else - msg_print("You must walk the Pattern in correct order."); -#endif + msg_print(_("パターンの上は正しい順序で歩かねばなりません。", "You must walk the Pattern in correct order.")); return FALSE; } @@ -3422,6 +2787,12 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x) } +/*! + * @brief プレイヤーが地形踏破可能かを返す + * @param feature 判定したい地形ID + * @param mode 移動に関するオプションフラグ + * @return 移動可能ならばTRUEを返す + */ bool player_can_enter(s16b feature, u16b mode) { feature_type *f_ptr = &f_info[feature]; @@ -3445,25 +2816,29 @@ bool player_can_enter(s16b feature, u16b mode) } -/* - * Move the player +/*! + * @brief 移動に伴うプレイヤーのステータス変化処理 + * @param ny 移動先Y座標 + * @param nx 移動先X座標 + * @param mpe_mode 移動オプションフラグ + * @return プレイヤーが死亡やフロア離脱を行わず、実際に移動が可能ならばTRUEを返す。 */ -bool move_player_effect(int ny, int nx, u32b mpe_mode) +bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode) { cave_type *c_ptr = &cave[ny][nx]; feature_type *f_ptr = &f_info[c_ptr->feat]; if (!(mpe_mode & MPE_STAYING)) { - int oy = py; - int ox = px; + POSITION oy = p_ptr->y; + POSITION ox = p_ptr->x; cave_type *oc_ptr = &cave[oy][ox]; - int om_idx = oc_ptr->m_idx; - int nm_idx = c_ptr->m_idx; + IDX om_idx = oc_ptr->m_idx; + IDX nm_idx = c_ptr->m_idx; /* Move the player */ - py = ny; - px = nx; + p_ptr->y = ny; + p_ptr->x = nx; /* Hack -- For moving monster or riding player's moving */ if (!(mpe_mode & MPE_DONT_SWAP_MON)) @@ -3495,11 +2870,20 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) /* Redraw new spot */ lite_spot(ny, nx); - if (mpe_mode & MPE_FORGET_FLOW) forget_flow(); - /* Check for new panel (redraw map) */ verify_panel(); + if (mpe_mode & MPE_FORGET_FLOW) + { + forget_flow(); + + /* Mega-Hack -- Forget the view */ + p_ptr->update |= (PU_UN_VIEW); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + } + /* Update stuff */ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE); @@ -3525,11 +2909,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) (!have_flag(f_ptr->flags, FF_PROJECT) || (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))) { -#ifdef JP - msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£"); -#else - msg_print("You cannot run in here."); -#endif + msg_print(_("ここでは素早く動けない。", "You cannot run in here.")); set_action(ACTION_NONE); } } @@ -3538,7 +2918,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) { if (music_singing(MUSIC_WALL)) { - (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE, + (void)project(0, 0, p_ptr->y, p_ptr->x, (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1); if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE; @@ -3567,9 +2947,9 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) if (have_flag(f_ptr->flags, FF_STORE)) { /* Disturb */ - disturb(0, 0); + disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter store */ command_new = SPECIAL_KEY_STORE; } @@ -3578,9 +2958,9 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) else if (have_flag(f_ptr->flags, FF_BLDG)) { /* Disturb */ - disturb(0, 0); + disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter building */ command_new = SPECIAL_KEY_BUILDING; } @@ -3589,9 +2969,9 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) else if (have_flag(f_ptr->flags, FF_QUEST_ENTER)) { /* Disturb */ - disturb(0, 0); + disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter quest level */ command_new = SPECIAL_KEY_QUEST; } @@ -3600,16 +2980,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) { if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT) { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL); - quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED; - quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev; -#ifdef JP - msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You accomplished your quest!"); -#endif - - msg_print(NULL); + complete_quest(p_ptr->inside_quest); } leave_quest_check(); @@ -3626,20 +2997,16 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING)) { /* Disturb */ - disturb(0, 0); + disturb(0, 1); /* Hidden trap */ if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET)) { /* Message */ -#ifdef JP - msg_print("¥È¥é¥Ã¥×¤À¡ª"); -#else - msg_print("You found a trap!"); -#endif + msg_print(_("トラップだ!", "You found a trap!")); /* Pick a trap */ - disclose_grid(py, px); + disclose_grid(p_ptr->y, p_ptr->x); } /* Hit the trap */ @@ -3660,50 +3027,54 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) { if (alert_trap_detect) { -#ifdef JP - msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *"); -#else - msg_print("*Leaving trap detect region!*"); -#endif + msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*")); } - if (disturb_trap_detect) disturb(0, 0); + if (disturb_trap_detect) disturb(0, 1); } } return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving; } - +/*! + * @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す + * @param feat 地形ID + * @return トラップが自動的に無効ならばTRUEを返す + */ bool trap_can_be_ignored(int feat) { - switch (feat) + feature_type *f_ptr = &f_info[feat]; + + if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE; + + switch (f_ptr->subtype) { - case FEAT_TRAP_TRAPDOOR: - case FEAT_TRAP_PIT: - case FEAT_TRAP_SPIKED_PIT: - case FEAT_TRAP_POISON_PIT: + case TRAP_TRAPDOOR: + case TRAP_PIT: + case TRAP_SPIKED_PIT: + case TRAP_POISON_PIT: if (p_ptr->levitation) return TRUE; break; - case FEAT_TRAP_TELEPORT: + case TRAP_TELEPORT: if (p_ptr->anti_tele) return TRUE; break; - case FEAT_TRAP_FIRE: + case TRAP_FIRE: if (p_ptr->immune_fire) return TRUE; break; - case FEAT_TRAP_ACID: + case TRAP_ACID: if (p_ptr->immune_acid) return TRUE; break; - case FEAT_TRAP_BLIND: + case TRAP_BLIND: if (p_ptr->resist_blind) return TRUE; break; - case FEAT_TRAP_CONFUSE: + case TRAP_CONFUSE: if (p_ptr->resist_conf) return TRUE; break; - case FEAT_TRAP_POISON: + case TRAP_POISON: if (p_ptr->resist_pois) return TRUE; break; - case FEAT_TRAP_SLEEP: + case TRAP_SLEEP: if (p_ptr->free_act) return TRUE; break; } @@ -3721,20 +3092,26 @@ bool trap_can_be_ignored(int feat) have_flag((MF)->flags, FF_PROJECT) && \ !have_flag((MF)->flags, FF_OPEN)) -/* + +/*! + * @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す / * Move player in the given direction, with the given "pickup" flag. - * - * This routine should (probably) always induce energy expenditure. - * - * Note that moving will *always* take a turn, and will *always* hit - * any monster which might be in the destination grid. Previously, - * moving into walls was "free" and did NOT hit invisible monsters. + * @param dir 移動方向ID + * @param do_pickup 罠解除を試みながらの移動ならばTRUE + * @param break_trap トラップ粉砕処理を行うならばTRUE + * @return 実際に移動が行われたならばTRUEを返す。 + * @note + * This routine should (probably) always induce energy expenditure.\n + * @details + * Note that moving will *always* take a turn, and will *always* hit\n + * any monster which might be in the destination grid. Previously,\n + * moving into walls was "free" and did NOT hit invisible monsters.\n */ -void move_player(int dir, bool do_pickup, bool break_trap) +void move_player(DIRECTION dir, bool do_pickup, bool break_trap) { /* Find the result of moving */ - int y = py + ddy[dir]; - int x = px + ddx[dir]; + POSITION y = p_ptr->y + ddy[dir]; + POSITION x = p_ptr->x + ddx[dir]; /* Examine the destination */ cave_type *c_ptr = &cave[y][x]; @@ -3833,7 +3210,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) } p_ptr->leaving = TRUE; - energy_use = 100; + p_ptr->energy_use = 100; return; } @@ -3852,7 +3229,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) /* Player can not walk through "walls"... */ /* unless in Shadow Form */ - p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_TUNNEL) && + p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) && (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) && !have_flag(f_ptr->flags, FF_PERMANENT); @@ -3865,10 +3242,10 @@ void move_player(int dir, bool do_pickup, bool break_trap) if (!is_hostile(m_ptr) && !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun || ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) && - pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls)) + pattern_seq(p_ptr->y, p_ptr->x, y, x) && (p_can_enter || p_can_kill_walls)) { - m_ptr->csleep = 0; - if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE); + /* Disturb the monster */ + (void)set_monster_csleep(c_ptr->m_idx, 0); /* Extract monster name (or "it") */ monster_desc(m_name, m_ptr, 0); @@ -3876,7 +3253,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) if (m_ptr->ml) { /* Auto-Recall if possible and visible */ - monster_race_track(m_ptr->ap_r_idx); + if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); /* Track a new monster */ health_track(c_ptr->m_idx); @@ -3888,19 +3265,14 @@ void move_player(int dir, bool do_pickup, bool break_trap) py_attack(y, x, 0); oktomove = FALSE; } - else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0)) + else if (monster_can_cross_terrain(cave[p_ptr->y][p_ptr->x].feat, r_ptr, 0)) { do_past = TRUE; } else { -#ifdef JP - msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name); -#else - msg_format("%^s is in your way!", m_name); -#endif - - energy_use = 0; + msg_format(_("%^sが邪魔だ!", "%^s is in your way!"), m_name); + p_ptr->energy_use = 0; oktomove = FALSE; } @@ -3917,35 +3289,27 @@ void move_player(int dir, bool do_pickup, bool break_trap) { if (riding_r_ptr->flags1 & RF1_NEVER_MOVE) { -#ifdef JP - msg_print("Æ°¤±¤Ê¤¤¡ª"); -#else - msg_print("Can't move!"); -#endif - energy_use = 0; + msg_print(_("動けない!", "Can't move!")); + p_ptr->energy_use = 0; oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } - else if (riding_m_ptr->monfear) + else if (MON_MONFEAR(riding_m_ptr)) { - char m_name[80]; + char steed_name[80]; /* Acquire the monster name */ - monster_desc(m_name, riding_m_ptr, 0); + monster_desc(steed_name, riding_m_ptr, 0); /* Dump a message */ -#ifdef JP - msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤­¤Ê¤¤¡£", m_name); -#else - msg_format("%^s is too scared to control.", m_name); -#endif + msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name); oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } else if (p_ptr->riding_ryoute) { oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY)) { @@ -3959,49 +3323,33 @@ void move_player(int dir, bool do_pickup, bool break_trap) !(riding_r_ptr->flags7 & RF7_AQUATIC) && (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE))) { -#ifdef JP - msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name); -#else - msg_print("Can't swim."); -#endif - energy_use = 0; + msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(c_ptr)].name); + p_ptr->energy_use = 0; oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC)) { -#ifdef JP - msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name); -#else - msg_print("Can't land."); -#endif - energy_use = 0; + msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name); + p_ptr->energy_use = 0; oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) { -#ifdef JP - msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name); -#else - msg_print("Too hot to go through."); -#endif - energy_use = 0; + msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(c_ptr)].name); + p_ptr->energy_use = 0; oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } - if (oktomove && riding_m_ptr->stunned && one_in_(2)) + if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2)) { - char m_name[80]; - monster_desc(m_name, riding_m_ptr, 0); -#ifdef JP - msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name); -#else - msg_format("You cannot control stunned %s!",m_name); -#endif + char steed_name[80]; + monster_desc(steed_name, riding_m_ptr, 0); + msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name); oktomove = FALSE; - disturb(0, 0); + disturb(0, 1); } } @@ -4011,13 +3359,8 @@ void move_player(int dir, bool do_pickup, bool break_trap) else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation) { -#ifdef JP - msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name); -#else - msg_format("You need to fly to go through the %s.", f_name + f_info[get_feat_mimic(c_ptr)].name); -#endif - - energy_use = 0; + msg_format(_("空を飛ばないと%sの上には行けない。", "You need to fly to go through the %s."), f_name + f_info[get_feat_mimic(c_ptr)].name); + p_ptr->energy_use = 0; running = 0; oktomove = FALSE; } @@ -4029,7 +3372,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) */ else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls) { - if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation) energy_use *= 2; + if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2; } #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -4056,27 +3399,20 @@ void move_player(int dir, bool do_pickup, bool break_trap) oktomove = FALSE; - /* Disturb the player */ - disturb(0, 0); - /* Notice things in the dark */ if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x)) { /* Boundary floor mimic */ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) { -#ifdef JP - msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£"); -#else - msg_print("You feel you cannot go any more."); -#endif + msg_print(_("それ以上先には進めないようだ。", "You feel you cannot go any more.")); } /* Wall (or secret door) */ else { #ifdef JP - msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name); + msg_format("%sが行く手をはばんでいるようだ。", name); #else msg_format("You feel %s %s blocking your way.", is_a_vowel(name[0]) ? "an" : "a", name); @@ -4093,14 +3429,9 @@ void move_player(int dir, bool do_pickup, bool break_trap) /* Boundary floor mimic */ if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) { -#ifdef JP - msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£"); -#else - msg_print("You cannot go any more."); -#endif - + msg_print(_("それ以上先には進めない。", "You cannot go any more.")); if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) - energy_use = 0; + p_ptr->energy_use = 0; } /* Wall (or secret door) */ @@ -4112,7 +3443,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) #endif /* ALLOW_EASY_OPEN */ #ifdef JP - msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name); + msg_format("%sが行く手をはばんでいる。", name); #else msg_format("There is %s %s blocking your way.", is_a_vowel(name[0]) ? "an" : "a", name); @@ -4124,24 +3455,27 @@ void move_player(int dir, bool do_pickup, bool break_trap) * typing mistakes should not cost you a turn... */ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) - energy_use = 0; + p_ptr->energy_use = 0; } } + /* Disturb the player */ + disturb(0, 1); + /* Sound */ if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL); } /* Normal movement */ - if (oktomove && !pattern_seq(py, px, y, x)) + if (oktomove && !pattern_seq(p_ptr->y, p_ptr->x, y, x)) { if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) { - energy_use = 0; + p_ptr->energy_use = 0; } /* To avoid a loop with running */ - disturb(0, 0); + disturb(0, 1); oktomove = FALSE; } @@ -4155,18 +3489,14 @@ void move_player(int dir, bool do_pickup, bool break_trap) { if (!process_warning(x, y)) { - energy_use = 25; + p_ptr->energy_use = 25; return; } } if (do_past) { -#ifdef JP - msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name); -#else - msg_format("You push past %s.", m_name); -#endif + msg_format(_("%sを押し退けた。", "You push past %s."), m_name); } /* Change oldpx and oldpy to place the player well when going back to big mode */ @@ -4211,8 +3541,13 @@ void move_player(int dir, bool do_pickup, bool break_trap) static bool ignore_avoid_run; -/* +/*! + * @brief ダッシュ移動処理中、移動先のマスが既知の壁かどうかを判定する / * Hack -- Check for a "known wall" (see below) + * @param dir 想定する移動方向ID + * @param y 移動元のY座標 + * @param x 移動元のX座標 + * @return 移動先が既知の壁ならばTRUE */ static int see_wall(int dir, int y, int x) { @@ -4251,8 +3586,13 @@ static int see_wall(int dir, int y, int x) } -/* +/*! + * @brief ダッシュ移動処理中、移動先のマスか未知の地形かどうかを判定する / * Hack -- Check for an "unknown corner" (see below) + * @param dir 想定する移動方向ID + * @param y 移動元のY座標 + * @param x 移動元のX座標 + * @return 移動先が未知の地形ならばTRUE */ static int see_nothing(int dir, int y, int x) { @@ -4277,137 +3617,6 @@ static int see_nothing(int dir, int y, int x) -/* - * The running algorithm: -CJS- - * - * In the diagrams below, the player has just arrived in the - * grid marked as '@', and he has just come from a grid marked - * as 'o', and he is about to enter the grid marked as 'x'. - * - * Of course, if the "requested" move was impossible, then you - * will of course be blocked, and will stop. - * - * Overview: You keep moving until something interesting happens. - * If you are in an enclosed space, you follow corners. This is - * the usual corridor scheme. If you are in an open space, you go - * straight, but stop before entering enclosed space. This is - * analogous to reaching doorways. If you have enclosed space on - * one side only (that is, running along side a wall) stop if - * your wall opens out, or your open space closes in. Either case - * corresponds to a doorway. - * - * What happens depends on what you can really SEE. (i.e. if you - * have no light, then running along a dark corridor is JUST like - * running in a dark room.) The algorithm works equally well in - * corridors, rooms, mine tailings, earthquake rubble, etc, etc. - * - * These conditions are kept in static memory: - * find_openarea You are in the open on at least one - * side. - * find_breakleft You have a wall on the left, and will - * stop if it opens - * find_breakright You have a wall on the right, and will - * stop if it opens - * - * To initialize these conditions, we examine the grids adjacent - * to the grid marked 'x', two on each side (marked 'L' and 'R'). - * If either one of the two grids on a given side is seen to be - * closed, then that side is considered to be closed. If both - * sides are closed, then it is an enclosed (corridor) run. - * - * LL L - * @x LxR - * RR @R - * - * Looking at more than just the immediate squares is - * significant. Consider the following case. A run along the - * corridor will stop just before entering the center point, - * because a choice is clearly established. Running in any of - * three available directions will be defined as a corridor run. - * Note that a minor hack is inserted to make the angled corridor - * entry (with one side blocked near and the other side blocked - * further away from the runner) work correctly. The runner moves - * diagonally, but then saves the previous direction as being - * straight into the gap. Otherwise, the tail end of the other - * entry would be perceived as an alternative on the next move. - * - * #.# - * ##.## - * .@x.. - * ##.## - * #.# - * - * Likewise, a run along a wall, and then into a doorway (two - * runs) will work correctly. A single run rightwards from @ will - * stop at 1. Another run right and down will enter the corridor - * and make the corner, stopping at the 2. - * - * ################## - * o@x 1 - * ########### ###### - * #2 # - * ############# - * - * After any move, the function area_affect is called to - * determine the new surroundings, and the direction of - * subsequent moves. It examines the current player location - * (at which the runner has just arrived) and the previous - * direction (from which the runner is considered to have come). - * - * Moving one square in some direction places you adjacent to - * three or five new squares (for straight and diagonal moves - * respectively) to which you were not previously adjacent, - * marked as '!' in the diagrams below. - * - * ...! ... - * .o@! (normal) .o.! (diagonal) - * ...! (east) ..@! (south east) - * !!! - * - * You STOP if any of the new squares are interesting in any way: - * for example, if they contain visible monsters or treasure. - * - * You STOP if any of the newly adjacent squares seem to be open, - * and you are also looking for a break on that side. (that is, - * find_openarea AND find_break). - * - * You STOP if any of the newly adjacent squares do NOT seem to be - * open and you are in an open area, and that side was previously - * entirely open. - * - * Corners: If you are not in the open (i.e. you are in a corridor) - * and there is only one way to go in the new squares, then turn in - * that direction. If there are more than two new ways to go, STOP. - * If there are two ways to go, and those ways are separated by a - * square which does not seem to be open, then STOP. - * - * Otherwise, we have a potential corner. There are two new open - * squares, which are also adjacent. One of the new squares is - * diagonally located, the other is straight on (as in the diagram). - * We consider two more squares further out (marked below as ?). - * - * We assign "option" to the straight-on grid, and "option2" to the - * diagonal grid, and "check_dir" to the grid marked 's'. - * - * ##s - * @x? - * #.? - * - * If they are both seen to be closed, then it is seen that no benefit - * is gained from moving straight. It is a known corner. To cut the - * corner, go diagonally, otherwise go straight, but pretend you - * stepped diagonally into that next location for a full view next - * time. Conversely, if one of the ? squares is not seen to be closed, - * then there is a potential choice. We check to see whether it is a - * potential corner or an intersection/room entrance. If the square - * two spaces straight ahead, and the space marked with 's' are both - * unknown space, then it is a potential corner and enter if - * find_examine is set, otherwise must stop because it is not a - * corner. (find_examine option is removed and always is TRUE.) - */ - - - /* * Hack -- allow quick "cycling" through the legal directions @@ -4424,12 +3633,12 @@ static byte chome[] = /* * The direction we are running */ -static byte find_current; +static DIRECTION find_current; /* * The direction we came from */ -static byte find_prevdir; +static DIRECTION find_prevdir; /* * We are looking for open area @@ -4444,19 +3653,21 @@ static bool find_breakleft; -/* +/*! + * @brief ダッシュ処理の導入 / * Initialize the running algorithm for a new direction. - * - * Diagonal Corridor -- allow diaginal entry into corridors. - * - * Blunt Corridor -- If there is a wall two spaces ahead and - * we seem to be in a corridor, then force a turn into the side - * corridor, must be moving straight into a corridor here. ??? - * - * Diagonal Corridor Blunt Corridor (?) - * # # # - * #x# @x# - * @p. p + * @param dir 導入の移動先 + * @details + * Diagonal Corridor -- allow diaginal entry into corridors.\n + *\n + * Blunt Corridor -- If there is a wall two spaces ahead and\n + * we seem to be in a corridor, then force a turn into the side\n + * corridor, must be moving straight into a corridor here. ???\n + *\n + * Diagonal Corridor Blunt Corridor (?)\n + * \# \# \#\n + * \#x\# \@x\#\n + * \@\@p. p\n */ static void run_init(int dir) { @@ -4480,12 +3691,12 @@ static void run_init(int dir) deepleft = deepright = FALSE; shortright = shortleft = FALSE; - p_ptr->run_py = py; - p_ptr->run_px = px; + p_ptr->run_py = p_ptr->y; + p_ptr->run_px = p_ptr->x; /* Find the destination grid */ - row = py + ddy[dir]; - col = px + ddx[dir]; + row = p_ptr->y + ddy[dir]; + col = p_ptr->x + ddx[dir]; ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN); @@ -4493,7 +3704,7 @@ static void run_init(int dir) i = chome[dir]; /* Check for walls */ - if (see_wall(cycle[i+1], py, px)) + if (see_wall(cycle[i+1], p_ptr->y, p_ptr->x)) { find_breakleft = TRUE; shortleft = TRUE; @@ -4505,7 +3716,7 @@ static void run_init(int dir) } /* Check for walls */ - if (see_wall(cycle[i-1], py, px)) + if (see_wall(cycle[i-1], p_ptr->y, p_ptr->x)) { find_breakright = TRUE; shortright = TRUE; @@ -4551,9 +3762,11 @@ static void run_init(int dir) } -/* +/*! + * @brief ダッシュ移動が継続できるかどうかの判定 / * Update the current "run" path - * + * @return + * ダッシュ移動が継続できるならばTRUEを返す。 * Return TRUE if the running should be stopped */ static bool run_test(void) @@ -4575,21 +3788,17 @@ static bool run_test(void) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(cave[py][px].info & CAVE_UNSAFE)) + if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { -#ifdef JP - msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *"); -#else - msg_print("*Leaving trap detect region!*"); -#endif + msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*")); } if (disturb_trap_detect) @@ -4609,8 +3818,8 @@ static bool run_test(void) new_dir = cycle[chome[prev_dir] + i]; /* New location */ - row = py + ddy[new_dir]; - col = px + ddx[new_dir]; + row = p_ptr->y + ddy[new_dir]; + col = p_ptr->x + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; @@ -4760,7 +3969,7 @@ static bool run_test(void) for (i = -max; i < 0; i++) { /* Unknown grid or non-wall */ - if (!see_wall(cycle[chome[prev_dir] + i], py, px)) + if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x)) { /* Looking to break right */ if (find_breakright) @@ -4784,7 +3993,7 @@ static bool run_test(void) for (i = max; i > 0; i--) { /* Unknown grid or non-wall */ - if (!see_wall(cycle[chome[prev_dir] + i], py, px)) + if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x)) { /* Looking to break left */ if (find_breakleft) @@ -4838,8 +4047,8 @@ static bool run_test(void) else { /* Get next location */ - row = py + ddy[option]; - col = px + ddx[option]; + row = p_ptr->y + ddy[option]; + col = p_ptr->x + ddx[option]; /* Don't see that it is closed off. */ /* This could be a potential corner or an intersection. */ @@ -4880,7 +4089,7 @@ static bool run_test(void) } /* About to hit a known wall, stop */ - if (see_wall(find_current, py, px)) + if (see_wall(find_current, p_ptr->y, p_ptr->x)) { return (TRUE); } @@ -4891,8 +4100,11 @@ static bool run_test(void) -/* +/*! + * @brief 継続的なダッシュ処理 / * Take one step along the current "run" path + * @param dir 移動を試みる方向ID + * @return なし */ void run_step(int dir) { @@ -4903,14 +4115,12 @@ void run_step(int dir) ignore_avoid_run = TRUE; /* Hack -- do not start silly run */ - if (see_wall(dir, py, px)) + if (see_wall(dir, p_ptr->y, p_ptr->x)) { + sound(SOUND_HITWALL); + /* Message */ -#ifdef JP - msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£"); -#else - msg_print("You cannot run in that direction."); -#endif + msg_print(_("その方向には走れません。", "You cannot run in that direction.")); /* Disturb */ disturb(0, 0); @@ -4941,7 +4151,7 @@ void run_step(int dir) if (--running <= 0) return; /* Take time */ - energy_use = 100; + p_ptr->energy_use = 100; /* Move the player, using the "pickup" flag */ #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -4961,3 +4171,145 @@ void run_step(int dir) disturb(0, 0); } } + + +#ifdef TRAVEL + +/*! + * @brief トラベル機能の判定処理 / + * Test for traveling + * @param prev_dir 前回移動を行った元の方角ID + * @return なし + */ +static int travel_test(int prev_dir) +{ + int new_dir = 0; + int i, max; + const cave_type *c_ptr; + int cost; + + /* Cannot travel when blind */ + if (p_ptr->blind || no_lite()) + { + msg_print(_("目が見えない!", "You cannot see!")); + return (0); + } + + /* break run when leaving trap detected region */ + if ((disturb_trap_detect || alert_trap_detect) + && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) + { + /* No duplicate warning */ + p_ptr->dtrap = FALSE; + + /* You are just on the edge */ + if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) + { + if (alert_trap_detect) + { + msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*")); + } + + if (disturb_trap_detect) + { + /* Break Run */ + return (0); + } + } + } + + /* Range of newly adjacent grids */ + max = (prev_dir & 0x01) + 1; + + /* Look at every newly adjacent square. */ + for (i = -max; i <= max; i++) + { + /* New direction */ + int dir = cycle[chome[prev_dir] + i]; + + /* New location */ + int row = p_ptr->y + ddy[dir]; + int col = p_ptr->x + ddx[dir]; + + /* Access grid */ + c_ptr = &cave[row][col]; + + /* Visible monsters abort running */ + if (c_ptr->m_idx) + { + monster_type *m_ptr = &m_list[c_ptr->m_idx]; + + /* Visible monster */ + if (m_ptr->ml) return (0); + } + + } + + /* Travel cost of current grid */ + cost = travel.cost[p_ptr->y][p_ptr->x]; + + /* Determine travel direction */ + for (i = 0; i < 8; ++ i) { + int dir_cost = travel.cost[p_ptr->y+ddy_ddd[i]][p_ptr->x+ddx_ddd[i]]; + + if (dir_cost < cost) + { + new_dir = ddd[i]; + cost = dir_cost; + } + } + + if (!new_dir) return (0); + + /* Access newly move grid */ + c_ptr = &cave[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; + + /* Close door abort traveling */ + if (!easy_open && is_closed_door(c_ptr->feat)) return (0); + + /* Visible and unignorable trap abort tarveling */ + if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0); + + /* Move new grid */ + return (new_dir); +} + + +/*! + * @brief トラベル機能の実装 / + * Travel command + * @return なし + */ +void travel_step(void) +{ + /* Get travel direction */ + travel.dir = travel_test(travel.dir); + + /* disturb */ + if (!travel.dir) + { + if (travel.run == 255) + { + msg_print(_("道筋が見つかりません!", "No route is found!")); + travel.y = travel.x = 0; + } + disturb(0, 1); + return; + } + + p_ptr->energy_use = 100; + + move_player(travel.dir, always_pickup, FALSE); + + if ((p_ptr->y == travel.y) && (p_ptr->x == travel.x)) + { + travel.run = 0; + travel.y = travel.x = 0; + } + else if (travel.run > 0) + travel.run--; + + /* Travel Delay */ + Term_xtra(TERM_XTRA_DELAY, delay_factor); +} +#endif