3 * @brief ¥×¥ì¥¤¥ä¡¼¤Î¥³¥Þ¥ó¥É½èÍý1 / Movement commands (part 1)
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
12 * The running algorithm: -CJS-\n
14 * In the diagrams below, the player has just arrived in the\n
15 * grid marked as '@', and he has just come from a grid marked\n
16 * as 'o', and he is about to enter the grid marked as 'x'.\n
18 * Of course, if the "requested" move was impossible, then you\n
19 * will of course be blocked, and will stop.\n
21 * Overview: You keep moving until something interesting happens.\n
22 * If you are in an enclosed space, you follow corners. This is\n
23 * the usual corridor scheme. If you are in an open space, you go\n
24 * straight, but stop before entering enclosed space. This is\n
25 * analogous to reaching doorways. If you have enclosed space on\n
26 * one side only (that is, running along side a wall) stop if\n
27 * your wall opens out, or your open space closes in. Either case\n
28 * corresponds to a doorway.\n
30 * What happens depends on what you can really SEE. (i.e. if you\n
31 * have no light, then running along a dark corridor is JUST like\n
32 * running in a dark room.) The algorithm works equally well in\n
33 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.\n
35 * These conditions are kept in static memory:\n
36 * find_openarea You are in the open on at least one\n
38 * find_breakleft You have a wall on the left, and will\n
40 * find_breakright You have a wall on the right, and will\n
43 * To initialize these conditions, we examine the grids adjacent\n
44 * to the grid marked 'x', two on each side (marked 'L' and 'R').\n
45 * If either one of the two grids on a given side is seen to be\n
46 * closed, then that side is considered to be closed. If both\n
47 * sides are closed, then it is an enclosed (corridor) run.\n
53 * Looking at more than just the immediate squares is\n
54 * significant. Consider the following case. A run along the\n
55 * corridor will stop just before entering the center point,\n
56 * because a choice is clearly established. Running in any of\n
57 * three available directions will be defined as a corridor run.\n
58 * Note that a minor hack is inserted to make the angled corridor\n
59 * entry (with one side blocked near and the other side blocked\n
60 * further away from the runner) work correctly. The runner moves\n
61 * diagonally, but then saves the previous direction as being\n
62 * straight into the gap. Otherwise, the tail end of the other\n
63 * entry would be perceived as an alternative on the next move.\n
71 * Likewise, a run along a wall, and then into a doorway (two\n
72 * runs) will work correctly. A single run rightwards from @ will\n
73 * stop at 1. Another run right and down will enter the corridor\n
74 * and make the corner, stopping at the 2.\n
76 * ##################\n
78 * ########### ######\n
82 * After any move, the function area_affect is called to\n
83 * determine the new surroundings, and the direction of\n
84 * subsequent moves. It examines the current player location\n
85 * (at which the runner has just arrived) and the previous\n
86 * direction (from which the runner is considered to have come).\n
88 * Moving one square in some direction places you adjacent to\n
89 * three or five new squares (for straight and diagonal moves\n
90 * respectively) to which you were not previously adjacent,\n
91 * marked as '!' in the diagrams below.\n
94 * .o@! (normal) .o.! (diagonal)\n
95 * ...! (east) ..@! (south east)\n
98 * You STOP if any of the new squares are interesting in any way:\n
99 * for example, if they contain visible monsters or treasure.\n
101 * You STOP if any of the newly adjacent squares seem to be open,\n
102 * and you are also looking for a break on that side. (that is,\n
103 * find_openarea AND find_break).\n
105 * You STOP if any of the newly adjacent squares do NOT seem to be\n
106 * open and you are in an open area, and that side was previously\n
109 * Corners: If you are not in the open (i.e. you are in a corridor)\n
110 * and there is only one way to go in the new squares, then turn in\n
111 * that direction. If there are more than two new ways to go, STOP.\n
112 * If there are two ways to go, and those ways are separated by a\n
113 * square which does not seem to be open, then STOP.\n
115 * Otherwise, we have a potential corner. There are two new open\n
116 * squares, which are also adjacent. One of the new squares is\n
117 * diagonally located, the other is straight on (as in the diagram).\n
118 * We consider two more squares further out (marked below as ?).\n
120 * We assign "option" to the straight-on grid, and "option2" to the\n
121 * diagonal grid, and "check_dir" to the grid marked 's'.\n
127 * If they are both seen to be closed, then it is seen that no benefit\n
128 * is gained from moving straight. It is a known corner. To cut the\n
129 * corner, go diagonally, otherwise go straight, but pretend you\n
130 * stepped diagonally into that next location for a full view next\n
131 * time. Conversely, if one of the ? squares is not seen to be closed\n,
132 * then there is a potential choice. We check to see whether it is a\n
133 * potential corner or an intersection/room entrance. If the square\n
134 * two spaces straight ahead, and the space marked with 's' are both\n
135 * unknown space, then it is a potential corner and enter if\n
136 * find_examine is set, otherwise must stop because it is not a\n
137 * corner. (find_examine option is removed and always is TRUE.)\n
142 #define MAX_VAMPIRIC_DRAIN 50 /*!< µÛ·ì½èÍý¤ÎºÇÂç²óÉüHP */
146 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·âÌ¿ÃæȽÄê /
147 * Determine if the player "hits" a monster (normal combat).
148 * @param chance ´ðËÜÌ¿ÃæÃÍ
149 * @param m_ptr ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
150 * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
151 * @param o_name ¥á¥Ã¥»¡¼¥¸É½¼¨»þ¤Î¥â¥ó¥¹¥¿¡¼Ì¾
152 * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
153 * @note Always miss 5%, always hit 5%, otherwise random.
155 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
158 monster_race *r_ptr = &r_info[m_ptr->r_idx];
161 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
163 /* Percentile dice */
166 /* Snipers with high-concentration reduce instant miss percentage.*/
169 /* Hack -- Instant miss or hit */
170 if (k < 10) return (k < 5);
172 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
173 if (one_in_(20)) return (FALSE);
176 if (chance <= 0) return (FALSE);
178 /* Invisible monsters are harder to hit */
179 if (!vis) chance = (chance + 1) / 2;
181 /* Power competes against armor */
182 if (randint0(chance) < (ac * 3 / 4))
184 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
188 /* Extract monster name */
189 monster_desc(m_name, m_ptr, 0);
190 msg_format(_("%s¤Ï%s¤ò»Â¤ê¼Î¤Æ¤¿¡ª", "%s cuts down %s!"), m_name, o_name);
202 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂÇ·âÌ¿ÃæȽÄê /
203 * Determine if the player "hits" a monster (normal combat).
204 * @param chance ´ðËÜÌ¿ÃæÃÍ
205 * @param ac ¥â¥ó¥¹¥¿¡¼¤ÎAC
206 * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
207 * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
208 * @note Always miss 5%, always hit 5%, otherwise random.
210 bool test_hit_norm(int chance, int ac, int vis)
214 /* Percentile dice */
217 /* Hack -- Instant miss or hit */
218 if (k < 10) return (k < 5);
220 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
221 if (one_in_(20)) return (FALSE);
223 /* Wimpy attack never hits */
224 if (chance <= 0) return (FALSE);
226 /* Penalize invisible targets */
227 if (!vis) chance = (chance + 1) / 2;
229 /* Power must defeat armor */
230 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
239 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·â¥¯¥ê¥Æ¥£¥«¥ëȽÄê /
240 * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
241 * @param weight ÌðÃƤνÅÎÌ
242 * @param plus_ammo ÌðÃƤÎÌ¿Ã潤Àµ
243 * @param plus_bow µÝ¤ÎÌ¿Ã潤Àµ
244 * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
245 * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
247 s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
250 object_type *j_ptr = &inventory[INVEN_BOW];
252 /* Extract "shot" power */
253 i = p_ptr->to_h_b + plus_ammo;
255 if (p_ptr->tval_ammo == TV_BOLT)
256 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
258 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
261 /* Snipers can shot more critically with crossbows */
262 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
263 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
265 /* Good bow makes more critical */
266 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
269 if (randint1(10000) <= i)
271 k = weight * randint1(500);
276 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
278 msg_print("It was a good hit!");
286 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
288 msg_print("It was a great hit!");
296 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
298 msg_print("It was a superb hit!");
311 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂǷ⥯¥ê¥Æ¥£¥«¥ëȽÄê /
312 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
313 * @param weight ÌðÃƤνÅÎÌ
314 * @param plus Éð´ï¤ÎÌ¿Ã潤Àµ
315 * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
316 * @param meichuu ÂÇ·â¤Î´ðËÜÌ¿ÃæÎÏ
317 * @param mode ¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
318 * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
320 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
324 /* Extract "blow" power */
325 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
328 if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
330 k = weight + randint1(650);
331 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
336 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
338 msg_print("It was a good hit!");
346 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
348 msg_print("It was a great hit!");
356 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
358 msg_print("It was a superb hit!");
366 msg_print("ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
368 msg_print("It was a *GREAT* hit!");
376 msg_print("ÈæÎà¤Ê¤ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
378 msg_print("It was a *SUPERB* hit!");
381 dam = ((7 * dam) / 2) + 25;
391 * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î¼ï²¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
392 * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
393 * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
394 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
395 * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
397 static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
399 static const struct slay_table_t {
401 u32b affect_race_flag;
404 size_t r_flag_offset;
406 #define OFFSET(X) offsetof(monster_race, X)
407 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
408 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
409 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
410 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
411 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
412 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
413 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
414 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
415 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
416 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
417 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
418 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
419 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
420 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
421 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
422 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
423 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
424 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
425 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
426 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
430 monster_race* r_ptr = &r_info[m_ptr->r_idx];
432 for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
434 const struct slay_table_t* p = &slay_table[i];
436 if ((have_flag(flgs, p->slay_flag)) &&
437 (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
439 if (is_original_ap_and_seen(m_ptr))
441 atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
444 mult = MAX(mult, p->slay_mult);
452 * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î°À¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
453 * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
454 * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
455 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
456 * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
458 static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
460 static const struct brand_table_t {
465 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
466 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
467 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
468 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
469 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
472 monster_race* r_ptr = &r_info[m_ptr->r_idx];
474 for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
476 const struct brand_table_t* p = &brand_table[i];
478 if (have_flag(flgs, p->brand_flag))
480 /* Notice immunity */
481 if (r_ptr->flagsr & p->resist_mask)
483 if (is_original_ap_and_seen(m_ptr))
485 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
489 /* Otherwise, take the damage */
490 else if (r_ptr->flags3 & p->hurt_flag)
492 if (is_original_ap_and_seen(m_ptr))
494 r_ptr->r_flags3 |= p->hurt_flag;
497 mult = MAX(mult, 50);
501 mult = MAX(mult, 25);
510 * @brief ¥À¥á¡¼¥¸¤Ë¥¹¥ì¥¤Í×ÁǤò²Ã¤¨¤ëÁí¹ç½èÍý¥ë¡¼¥Á¥ó /
511 * Extract the "total damage" from a given object hitting a given monster.
512 * @param o_ptr »ÈÍÑÉð´ï¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
513 * @param tdam ¸½ºß»»½ÐÅÓÃæ¤Î¥À¥á¡¼¥¸ÃÍ
514 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
515 * @param mode ·õ½Ñ¤ÎID
516 * @param thrown ¼Í·â½èÍý¤Ê¤é¤ÐTRUE¤ò»ØÄꤹ¤ë
517 * @return Áí¹çŪ¤Ê¥¹¥ì¥¤¤ò²ÃÌ£¤·¤¿¥À¥á¡¼¥¸ÃÍ
519 * Note that "flasks of oil" do NOT do fire damage, although they\n
520 * certainly could be made to do so. XXX XXX\n
522 * Note that most brands and slays are x3, except Slay Animal (x2),\n
523 * Slay Evil (x2), and Kill dragon (x5).\n
525 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
529 u32b flgs[TR_FLAG_SIZE];
531 /* Extract the flags */
532 object_flags(o_ptr, flgs);
533 torch_flags(o_ptr, flgs); /* torches has secret flags */
538 if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
539 if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
540 if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
541 if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
542 if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
545 /* Hex - Slay Good (Runesword) */
546 if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
548 /* Some "weapons" and "ammo" do extra damage */
561 mult = mult_slaying(mult, flgs, m_ptr);
563 /* Elemental Brand */
564 mult = mult_brand(mult, flgs, m_ptr);
567 if (p_ptr->pclass == CLASS_SAMURAI)
569 mult = mult_hissatsu(mult, flgs, m_ptr, mode);
573 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
575 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
576 p_ptr->redraw |= (PR_MANA);
577 mult = mult * 3 / 2 + 20;
580 /* Hack -- The Nothung cause special damage to Fafner */
581 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
586 if (mult > 150) mult = 150;
588 /* Return the total damage */
589 return (tdam * mult / 10);
594 * @brief ÃÏ·Á¤ä¤½¤Î¾å¤Î¥¢¥¤¥Æ¥à¤Î±£¤µ¤ì¤¿Í×ÁǤòÌÀ¤«¤¹ /
595 * Search for hidden things
596 * @param y ÂоݤȤʤë¥Þ¥¹¤ÎYºÂɸ
597 * @param x ÂоݤȤʤë¥Þ¥¹¤ÎXºÂɸ
600 static void discover_hidden_things(int y, int x)
602 s16b this_o_idx, next_o_idx = 0;
606 /* Access the grid */
610 if (c_ptr->mimic && is_trap(c_ptr->feat))
616 msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
623 if (is_hidden_door(c_ptr))
626 msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
635 /* Scan all objects in the grid */
636 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
641 o_ptr = &o_list[this_o_idx];
643 /* Acquire next object */
644 next_o_idx = o_ptr->next_o_idx;
646 /* Skip non-chests */
647 if (o_ptr->tval != TV_CHEST) continue;
649 /* Skip non-trapped chests */
650 if (!chest_traps[o_ptr->pval]) continue;
653 if (!object_is_known(o_ptr))
656 msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
668 * @brief ¥×¥ì¥¤¥ä¡¼¤Îõº÷½èÍýȽÄê
675 /* Start with base search ability */
676 chance = p_ptr->skill_srh;
678 /* Penalize various conditions */
679 if (p_ptr->blind || no_lite()) chance = chance / 10;
680 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
682 /* Search the nearby grids, which are always in bounds */
683 for (i = 0; i < 9; ++ i)
685 /* Sometimes, notice things */
686 if (randint0(100) < chance)
688 discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
695 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¤ò½¦¤Ã¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸É½¼¨½èÍý /
696 * Helper routine for py_pickup() and py_pickup_floor().
697 * @param o_idx ¼èÆÀ¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾ÈID
700 * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×\n
701 * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë\n
703 * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨\n
704 * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£\n
705 * Add the given dungeon object to the character's inventory.\n
706 * Delete the object afterwards.\n
708 void py_pickup_aux(int o_idx)
713 char o_name[MAX_NLEN];
714 char old_name[MAX_NLEN];
718 char o_name[MAX_NLEN];
723 o_ptr = &o_list[o_idx];
726 /* Describe the object */
727 object_desc(old_name, o_ptr, OD_NAME_ONLY);
728 object_desc_kosuu(kazu_str, o_ptr);
729 hirottakazu = o_ptr->number;
731 /* Carry the object */
732 slot = inven_carry(o_ptr);
734 /* Get the object again */
735 o_ptr = &inventory[slot];
737 /* Delete the object */
738 delete_object_idx(o_idx);
740 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
742 bool old_known = identify_item(o_ptr);
744 /* Auto-inscription/destroy */
745 autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
747 /* If it is destroyed, don't pick it up */
748 if (o_ptr->marked & OM_AUTODESTROY) return;
751 /* Describe the object */
752 object_desc(o_name, o_ptr, 0);
756 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
758 msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name);
759 msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢");
760 msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name);
766 msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot));
770 if (o_ptr->number > hirottakazu) {
771 msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",
772 kazu_str, o_name, index_to_label(slot));
774 msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot));
778 strcpy(record_o_name, old_name);
780 msg_format("You have %s (%c).", o_name, index_to_label(slot));
781 strcpy(record_o_name, o_name);
786 check_find_art_quest_completion(o_ptr);
791 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¾å¤Ë¾è¤Ã¤¿ºÝ¤Îɽ¼¨½èÍý
792 * @param pickup ¼«Æ°½¦¤¤½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE¤È¤¹¤ë
795 * Player "wants" to pick up an object or gold.
796 * Note that we ONLY handle things that can be picked up.
797 * See "move_player()" for handling of other things.
799 void carry(bool pickup)
801 cave_type *c_ptr = &cave[py][px];
803 s16b this_o_idx, next_o_idx = 0;
805 char o_name[MAX_NLEN];
807 /* Recenter the map around the player */
811 p_ptr->update |= (PU_MONSTERS);
814 p_ptr->redraw |= (PR_MAP);
817 p_ptr->window |= (PW_OVERHEAD);
822 /* Automatically pickup/destroy/inscribe items */
823 autopick_pickup_items(c_ptr);
826 #ifdef ALLOW_EASY_FLOOR
830 py_pickup_floor(pickup);
834 #endif /* ALLOW_EASY_FLOOR */
836 /* Scan the pile of objects */
837 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
842 o_ptr = &o_list[this_o_idx];
844 #ifdef ALLOW_EASY_SENSE /* TNB */
846 /* Option: Make item sensing easy */
849 /* Sense the object */
850 (void)sense_object(o_ptr);
853 #endif /* ALLOW_EASY_SENSE -- TNB */
855 /* Describe the object */
856 object_desc(o_name, o_ptr, 0);
858 /* Acquire next object */
859 next_o_idx = o_ptr->next_o_idx;
861 /* Hack -- disturb */
865 if (o_ptr->tval == TV_GOLD)
867 int value = (long)o_ptr->pval;
869 /* Delete the gold */
870 delete_object_idx(this_o_idx);
874 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
875 (long)value, o_name);
877 msg_format("You collect %ld gold pieces worth of %s.",
878 (long)value, o_name);
884 /* Collect the gold */
888 p_ptr->redraw |= (PR_GOLD);
891 p_ptr->window |= (PW_PLAYER);
894 /* Pick up objects */
897 /* Hack - some objects were handled in autopick_pickup_items(). */
898 if (o_ptr->marked & OM_NOMSG)
900 /* Clear the flag. */
901 o_ptr->marked &= ~OM_NOMSG;
903 /* Describe the object */
907 msg_format("%s¤¬¤¢¤ë¡£", o_name);
909 msg_format("You see %s.", o_name);
914 /* Note that the pack is too full */
915 else if (!inven_carry_okay(o_ptr))
918 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
920 msg_format("You have no room for %s.", o_name);
925 /* Pick up the item (if requested and allowed) */
930 /* Hack -- query every item */
931 if (carry_query_flag)
933 char out_val[MAX_NLEN+20];
935 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
937 sprintf(out_val, "Pick up %s? ", o_name);
940 okay = get_check(out_val);
943 /* Attempt to pick up an object. */
946 /* Pick up the object */
947 py_pickup_aux(this_o_idx);
956 * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×Ì¿ÃæȽÄê /
957 * Determine if a trap affects the player.
958 * @param power ´ðËܲóÈòÆñÅÙ
959 * @return ¥È¥é¥Ã¥×¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
961 * Always miss 5% of the time, Always hit 5% of the time.
962 * Otherwise, match trap power against player armor.
964 static int check_hit(int power)
968 /* Percentile dice */
971 /* Hack -- 5% hit, 5% miss */
972 if (k < 10) return (k < 5);
974 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
975 if (one_in_(20)) return (TRUE);
977 /* Paranoia -- No power */
978 if (power <= 0) return (FALSE);
981 ac = p_ptr->ac + p_ptr->to_a;
983 /* Power competes against Armor */
984 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
992 * @brief Íî¤È¤··ê·Ï¥È¥é¥Ã¥×¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
993 * @param trap_feat_type ¥È¥é¥Ã¥×¤Î¼ïÊÌID
996 static void hit_trap_pit(int trap_feat_type)
1000 cptr spike_name = "";
1002 switch (trap_feat_type)
1005 trap_name = _("Íî¤È¤··ê", "a pit trap");
1007 case TRAP_SPIKED_PIT:
1008 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
1009 spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
1011 case TRAP_POISON_PIT:
1012 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
1013 spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
1019 if (p_ptr->levitation)
1021 msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
1025 msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
1028 dam = damroll(2, 6);
1030 /* Extra spike damage */
1031 if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
1034 msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
1037 (void)set_cut(p_ptr->cut + randint1(dam));
1039 if (trap_feat_type == TRAP_POISON_PIT) {
1040 if (p_ptr->resist_pois || IS_OPPOSE_POIS())
1042 msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
1047 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
1052 /* Take the damage */
1053 take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
1057 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
1058 * @return ¥À¡¼¥Ä¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹
1060 static bool hit_trap_dart(void)
1066 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
1068 take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
1070 if (!CHECK_MULTISHADOW()) hit = TRUE;
1074 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
1081 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡ÜǽÎÏÃ͸º¾¯¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
1082 * @param stat Äã²¼¤¹¤ëǽÎÏÃÍID
1085 static void hit_trap_lose_stat(int stat)
1087 if (hit_trap_dart())
1094 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¸ºÂ®¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
1097 static void hit_trap_slow(void)
1099 if (hit_trap_dart())
1101 set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
1106 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¾õÂÖ°Û¾ï¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
1107 * @param trap_message ¥á¥Ã¥»¡¼¥¸¤ÎÊ䴰ʸ»úÎó
1108 * @param resist ¾õÂÖ°Û¾ï¤ËÄñ¹³¤¹¤ëȽÄ꤬½Ð¤¿¤Ê¤éTRUE
1109 * @param set_status ¾õÂÖ°Û¾ï¤ò»ØÄꤹ¤ë´Ø¿ô¥Ý¥¤¥ó¥¿
1110 * @param turn ¾õÂÖ°Û¾ï¤ÎÄɲå¿¡¼¥óÎÌ
1113 static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
1115 msg_print(trap_message);
1124 * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×ºîÆ°½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1125 * Handle player hitting a real trap
1126 * @param break_trap ºîÆ°¸å¤Î¥È¥é¥Ã¥×Ç˲õ¤¬³ÎÄꤷ¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE
1129 static void hit_trap(bool break_trap)
1134 /* Get the cave grid */
1135 cave_type *c_ptr = &cave[y][x];
1136 feature_type *f_ptr = &f_info[c_ptr->feat];
1137 int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP;
1140 cptr name = "¥È¥é¥Ã¥×";
1142 cptr name = "a trap";
1145 /* Disturb the player */
1148 cave_alter_feat(y, x, FF_HIT_TRAP);
1150 /* Analyze XXX XXX XXX */
1151 switch (trap_feat_type)
1155 if (p_ptr->levitation)
1158 msg_print("Íî¤È¤·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
1160 msg_print("You fly over a trap door.");
1167 msg_print("Íî¤È¤·¸Í¤ËÍî¤Á¤¿¡ª");
1168 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1169 msg_print("¤¯¤Ã¤½¡Á¡ª");
1171 msg_print("You have fallen through a trap door!");
1175 dam = damroll(2, 8);
1179 name = "a trap door";
1182 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1184 /* Still alive and autosave enabled */
1185 if (autosave_l && (p_ptr->chp >= 0))
1186 do_cmd_save_game(TRUE);
1189 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
1191 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
1193 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
1196 p_ptr->leaving = TRUE;
1202 case TRAP_SPIKED_PIT:
1203 case TRAP_POISON_PIT:
1205 hit_trap_pit(trap_feat_type);
1212 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1214 msg_print("There is a flash of shimmering light!");
1217 num = 2 + randint1(3);
1218 for (i = 0; i < num; i++)
1220 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1223 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1225 bool stop_ty = FALSE;
1230 stop_ty = activate_ty_curse(stop_ty, &count);
1240 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1242 msg_print("You hit a teleport trap!");
1245 teleport_player(100, TELEPORT_PASSIVE);
1252 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1254 msg_print("You are enveloped in flames!");
1257 dam = damroll(4, 6);
1259 (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
1261 (void)fire_dam(dam, "a fire trap", -1, FALSE);
1270 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1272 msg_print("You are splashed with acid!");
1275 dam = damroll(4, 6);
1277 (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
1279 (void)acid_dam(dam, "an acid trap", -1, FALSE);
1293 hit_trap_lose_stat(A_STR);
1299 hit_trap_lose_stat(A_DEX);
1305 hit_trap_lose_stat(A_CON);
1311 hit_trap_set_abnormal_status(
1312 _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
1313 p_ptr->resist_blind,
1314 set_blind, p_ptr->blind + randint0(50) + 25);
1320 hit_trap_set_abnormal_status(
1321 _("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
1323 set_confused, p_ptr->confused + randint0(20) + 10);
1329 hit_trap_set_abnormal_status(
1330 _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
1331 p_ptr->resist_pois || IS_OPPOSE_POIS(),
1332 set_poisoned, p_ptr->poisoned + randint0(20) + 10);
1339 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1341 msg_print("A strange white mist surrounds you!");
1344 if (!p_ptr->free_act)
1347 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1349 msg_print("You fall asleep.");
1353 if (ironman_nightmare)
1356 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1358 msg_print("A horrible vision enters your mind.");
1362 /* Pick a nightmare */
1363 get_mon_num_prep(get_nightmare, NULL);
1365 /* Have some nightmares */
1366 have_nightmare(get_mon_num(MAX_DEPTH));
1368 /* Remove the monster restriction */
1369 get_mon_num_prep(NULL, NULL);
1371 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1379 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1381 msg_print("There is a bright flash of light!");
1384 /* Make some new traps */
1385 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1393 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1395 msg_print("An alarm sounds!");
1398 aggravate_monsters(0);
1406 msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
1408 msg_print("Suddenly, surrounding walls are opened!");
1410 (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1411 (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1412 (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1413 aggravate_monsters(0);
1418 case TRAP_ARMAGEDDON:
1420 static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
1421 int evil_idx = 0, good_idx = 0;
1425 msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤¹þ¤Þ¤ì¤¿¡ª");
1427 msg_print("Suddenly, you are surrounded by immotal beings!");
1430 /* Summon Demons and Angels */
1431 for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
1433 num = levs[MIN(lev/10, 9)];
1434 for (i = 0; i < num; i++)
1436 int x1 = rand_spread(x, 7);
1437 int y1 = rand_spread(y, 5);
1439 /* Skip illegal grids */
1440 if (!in_bounds(y1, x1)) continue;
1442 /* Require line of projection */
1443 if (!projectable(py, px, y1, x1)) continue;
1445 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
1446 evil_idx = hack_m_idx_ii;
1448 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
1450 good_idx = hack_m_idx_ii;
1453 /* Let them fight each other */
1454 if (evil_idx && good_idx)
1456 monster_type *evil_ptr = &m_list[evil_idx];
1457 monster_type *good_ptr = &m_list[good_idx];
1458 evil_ptr->target_y = good_ptr->fy;
1459 evil_ptr->target_x = good_ptr->fx;
1460 good_ptr->target_y = evil_ptr->fy;
1461 good_ptr->target_x = evil_ptr->fx;
1471 msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
1473 msg_print("Suddenly, the room is filled with water with piranhas!");
1476 /* Water fills room */
1477 fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
1479 /* Summon Piranhas */
1480 num = 1 + dun_level/20;
1481 for (i = 0; i < num; i++)
1483 (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
1489 if (break_trap && is_trap(c_ptr->feat))
1491 cave_alter_feat(y, x, FF_DISARM);
1493 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1495 msg_print("You destroyed the trap.");
1502 * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡ÊÊä½õ¡Ë
1503 * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1504 * @param immune ¥À¥á¡¼¥¸¤ò²óÈò¤Ç¤¤ëÌȱ֥ե饰
1505 * @param flags_offset ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
1506 * @param r_flags_offset ¥â¥ó¥¹¥¿¡¼¤ÎÂÑÀÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
1507 * @param aura_flag ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó
1508 * @param dam_func ¥À¥á¡¼¥¸½èÍý¤ò¹Ô¤¦´Ø¿ô¤Î»²¾È¥Ý¥¤¥ó¥¿
1509 * @param message ¥ª¡¼¥é¥À¥á¡¼¥¸¤ò¼õ¤±¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸
1512 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
1513 int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
1515 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1517 if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
1520 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1522 /* Hack -- Get the "died from" name */
1523 monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1527 dam_func(aura_damage, mon_name, -1, TRUE);
1529 if (is_original_ap_and_seen(m_ptr))
1531 atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
1539 * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡Ê¥á¥¤¥ó¡Ë
1540 * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1543 static void touch_zap_player(monster_type *m_ptr)
1545 touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1546 fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
1547 touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1548 cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
1549 touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1550 elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
1555 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÊÑ°ÛÍ×ÁǤˤè¤ëÂÇ·â½èÍý
1556 * @param m_idx ¹¶·âÌÜɸ¤È¤Ê¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤Î»²¾ÈID
1557 * @param attack ÊÑ°ÛÍ×ÁǤˤè¤ë¹¶·âÍ×ÁǤμïÎà
1558 * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1559 * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1562 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1564 int k, bonus, chance;
1566 monster_type *m_ptr = &m_list[m_idx];
1567 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1576 case MUT2_SCOR_TAIL:
1603 atk_desc = "¥¯¥Á¥Ð¥·";
1614 atk_desc = "¾Ý¤ÎÉ¡";
1620 case MUT2_TENTACLES:
1627 atk_desc = "tentacles";
1632 dss = ddd = n_weight = 1;
1634 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1636 atk_desc = "undefined body part";
1641 /* Extract monster name (or "it") */
1642 monster_desc(m_name, m_ptr, 0);
1645 /* Calculate the "attack quality" */
1646 bonus = p_ptr->to_h_m;
1647 bonus += (p_ptr->lev * 6 / 5);
1648 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1651 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1657 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1659 msg_format("You hit %s with your %s.", m_name, atk_desc);
1663 k = damroll(ddd, dss);
1664 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1666 /* Apply the player damage bonuses */
1669 /* No negative damage */
1672 /* Modify the damage */
1673 k = mon_damage_mod(m_ptr, k, FALSE);
1675 /* Complex message */
1679 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1681 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1686 /* Anger the monster */
1687 if (k > 0) anger_monster(m_ptr);
1689 /* Damage, check for fear and mdeath */
1692 case MUT2_SCOR_TAIL:
1693 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1694 *mdeath = (m_ptr->r_idx == 0);
1697 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1700 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1703 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1705 case MUT2_TENTACLES:
1706 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1709 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1712 touch_zap_player(m_ptr);
1722 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1724 msg_format("You miss %s.", m_name);
1732 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥µ¥Ö¥ë¡¼¥Á¥ó /
1733 * Player attacks a (poor, defenseless) creature -RAK-
1734 * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
1735 * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
1736 * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1737 * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1738 * @param hand ¹¶·â¤ò¹Ô¤¦¤¿¤á¤ÎÉð´ï¤ò»ý¤Ä¼ê
1739 * @param mode ȯưÃæ¤Î·õ½ÑID
1742 * If no "weapon" is available, then "punch" the monster one time.
1744 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1746 int num = 0, k, bonus, chance, vir;
1748 cave_type *c_ptr = &cave[y][x];
1750 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1751 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1753 /* Access the weapon */
1754 object_type *o_ptr = &inventory[INVEN_RARM + hand];
1758 bool success_hit = FALSE;
1759 bool backstab = FALSE;
1760 bool vorpal_cut = FALSE;
1761 int chaos_effect = 0;
1762 bool stab_fleeing = FALSE;
1763 bool fuiuchi = FALSE;
1764 bool monk_attack = FALSE;
1765 bool do_quake = FALSE;
1767 bool drain_msg = TRUE;
1768 int drain_result = 0, drain_heal = 0;
1769 bool can_drain = FALSE;
1771 int drain_left = MAX_VAMPIRIC_DRAIN;
1772 u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1773 bool is_human = (r_ptr->d_char == 'p');
1774 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1775 bool zantetsu_mukou, e_j_mukou;
1777 switch (p_ptr->pclass)
1781 if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
1783 int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
1784 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1785 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1786 if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
1787 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1789 /* Can't backstab creatures that we can't see, right? */
1792 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1796 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1798 stab_fleeing = TRUE;
1804 case CLASS_FORCETRAINER:
1805 case CLASS_BERSERKER:
1806 if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
1810 if (!o_ptr->k_idx) /* Empty hand */
1812 if ((r_ptr->level + 10) > p_ptr->lev)
1814 if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1816 if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1817 p_ptr->skill_exp[GINOU_SUDE] += 40;
1818 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1819 p_ptr->skill_exp[GINOU_SUDE] += 5;
1820 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
1821 p_ptr->skill_exp[GINOU_SUDE] += 1;
1822 else if ((p_ptr->lev > 34))
1823 if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
1824 p_ptr->update |= (PU_BONUS);
1828 else if (object_is_melee_weapon(o_ptr))
1830 if ((r_ptr->level + 10) > p_ptr->lev)
1832 int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
1833 int sval = inventory[INVEN_RARM+hand].sval;
1834 int now_exp = p_ptr->weapon_exp[tval][sval];
1835 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
1838 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1839 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1840 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
1841 else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
1842 p_ptr->weapon_exp[tval][sval] += amount;
1843 p_ptr->update |= (PU_BONUS);
1848 /* Disturb the monster */
1849 (void)set_monster_csleep(c_ptr->m_idx, 0);
1851 /* Extract monster name (or "it") */
1852 monster_desc(m_name, m_ptr, 0);
1854 /* Calculate the "attack quality" */
1855 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
1856 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1857 if (mode == HISSATSU_IAI) chance += 60;
1858 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1860 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1862 vir = virtue_number(V_VALOUR);
1865 chance += (p_ptr->virtues[vir - 1]/10);
1868 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1869 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1871 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1872 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
1873 else num_blow = p_ptr->num_blow[hand];
1875 /* Hack -- DOKUBARI always hit once */
1876 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
1878 /* Attack once for each legal blow */
1879 while ((num++ < num_blow) && !p_ptr->is_dead)
1881 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1885 if (p_ptr->migite && p_ptr->hidarite)
1889 if (mode == HISSATSU_3DAN)
1894 success_hit = one_in_(n);
1896 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1897 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
1899 if (mode == HISSATSU_MAJIN)
1902 success_hit = FALSE;
1908 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1915 if (backstab) msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª", m_name);
1916 else if (fuiuchi) msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª", m_name);
1917 else if (stab_fleeing) msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª", m_name);
1918 else if (!monk_attack) msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
1920 if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name);
1921 else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name);
1922 else if (stab_fleeing) msg_format("You backstab the fleeing %s!", m_name);
1923 else if (!monk_attack) msg_format("You hit %s.", m_name);
1926 /* Hack -- bare hands do one damage */
1929 object_flags(o_ptr, flgs);
1931 /* Select a chaotic effect (50% chance) */
1932 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1935 chg_virtue(V_CHANCE, 1);
1937 if (randint1(5) < 3)
1939 /* Vampiric (20%) */
1942 else if (one_in_(250))
1947 else if (!one_in_(10))
1949 /* Confusion (26.892%) */
1952 else if (one_in_(2))
1954 /* Teleport away (1.494%) */
1959 /* Polymorph (1.494%) */
1964 /* Vampiric drain */
1965 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1967 /* Only drain "living" monsters */
1968 if (monster_living(r_ptr))
1974 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
1976 else vorpal_cut = FALSE;
1980 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1982 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1983 int resist_stun = 0;
1986 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1987 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1988 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1989 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1990 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1993 if (p_ptr->special_defense & KAMAE_BYAKKO)
1994 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
1995 else if (p_ptr->special_defense & KAMAE_SUZAKU)
1997 else if (p_ptr->special_defense & KAMAE_GENBU)
2000 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
2001 /* Attempt 'times' */
2002 for (times = 0; times < max_times; times++)
2006 ma_ptr = &ma_blows[randint0(MAX_MA)];
2007 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
2008 else min_level = ma_ptr->min_level;
2010 while ((min_level > p_ptr->lev) ||
2011 (randint1(p_ptr->lev) < ma_ptr->chance));
2013 /* keep the highest level attack available we found */
2014 if ((ma_ptr->min_level > old_ptr->min_level) &&
2015 !p_ptr->stun && !p_ptr->confused)
2019 if (p_ptr->wizard && cheat_xtra)
2022 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
2024 msg_print("Attack re-selected.");
2034 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
2035 else min_level = ma_ptr->min_level;
2036 k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
2037 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
2039 if (ma_ptr->effect == MA_KNEE)
2041 if (r_ptr->flags1 & RF1_MALE)
2044 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2046 msg_format("You hit %s in the groin with your knee!", m_name);
2050 special_effect = MA_KNEE;
2053 msg_format(ma_ptr->desc, m_name);
2056 else if (ma_ptr->effect == MA_SLOW)
2058 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
2059 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
2062 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2064 msg_format("You kick %s in the ankle.", m_name);
2067 special_effect = MA_SLOW;
2069 else msg_format(ma_ptr->desc, m_name);
2075 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
2078 msg_format(ma_ptr->desc, m_name);
2081 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
2082 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
2084 weight += (p_ptr->magic_num1[0]/30);
2085 if (weight > 20) weight = 20;
2088 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
2090 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2093 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
2095 msg_format("%^s moans in agony!", m_name);
2098 stun_effect = 7 + randint1(13);
2102 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2104 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2105 (randint1(p_ptr->lev) > r_ptr->level) &&
2109 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
2111 msg_format("%^s starts limping slower.", m_name);
2114 m_ptr->mspeed -= 10;
2118 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2120 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
2122 if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
2125 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2127 msg_format("%^s is stunned.", m_name);
2133 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2135 msg_format("%^s is more stunned.", m_name);
2142 /* Handle normal weapon */
2143 else if (o_ptr->k_idx)
2145 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2146 k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
2150 k *= (3 + (p_ptr->lev / 20));
2154 k = k*(5+(p_ptr->lev*2/25))/2;
2156 else if (stab_fleeing)
2161 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
2162 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
2167 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
2168 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2176 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
2178 char chainsword_noise[1024];
2180 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
2182 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
2185 msg_print(chainsword_noise);
2189 if (o_ptr->name1 == ART_VORPAL_BLADE)
2192 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
2194 msg_print("Your Vorpal Blade goes snicker-snack!");
2200 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
2202 msg_format("Your weapon cuts deep into %s!", m_name);
2206 /* Try to increase the damage */
2207 while (one_in_(vorpal_chance))
2215 if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
2218 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
2220 msg_format("You cut %s in half!", m_name);
2228 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
2229 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
2230 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
2231 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
2232 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
2233 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
2234 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
2236 case 2: msg_format("You gouge %s!", m_name); break;
2237 case 3: msg_format("You maim %s!", m_name); break;
2238 case 4: msg_format("You carve %s!", m_name); break;
2239 case 5: msg_format("You cleave %s!", m_name); break;
2240 case 6: msg_format("You smite %s!", m_name); break;
2241 case 7: msg_format("You eviscerate %s!", m_name); break;
2242 default: msg_format("You shred %s!", m_name); break;
2246 drain_result = drain_result * 3 / 2;
2250 drain_result += o_ptr->to_d;
2253 /* Apply the player damage bonuses */
2254 k += p_ptr->to_d[hand];
2255 drain_result += p_ptr->to_d[hand];
2257 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2258 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
2259 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2261 /* No negative damage */
2264 if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
2272 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2274 msg_print("You cannot cut such a elastic thing!");
2282 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2284 msg_print("Spiders are difficult for you to deal with!");
2289 if (mode == HISSATSU_MINEUCHI)
2291 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2294 anger_monster(m_ptr);
2296 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2299 if (MON_STUNNED(m_ptr))
2302 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2304 msg_format("%s is more dazed.", m_name);
2312 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2314 msg_format("%s is dazed.", m_name);
2319 (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
2324 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2326 msg_format("%s is not effected.", m_name);
2331 /* Modify the damage */
2332 k = mon_damage_mod(m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
2333 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2335 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2339 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2341 msg_format("You hit %s on a fatal spot!", m_name);
2346 else if ((p_ptr->pclass == CLASS_NINJA) && buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7)))
2348 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2349 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2354 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2356 msg_format("You critically injured %s!", m_name);
2359 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)))
2361 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2363 k = MAX(k*5, m_ptr->hp/2);
2366 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2368 msg_format("You fatally injured %s!", m_name);
2375 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2377 msg_format("You hit %s on a fatal spot!", m_name);
2383 /* Complex message */
2384 if (p_ptr->wizard || cheat_xtra)
2387 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2389 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2393 if (k <= 0) can_drain = FALSE;
2395 if (drain_result > m_ptr->hp)
2396 drain_result = m_ptr->hp;
2398 /* Damage, check for fear and death */
2399 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2402 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2404 if (p_ptr->migite && p_ptr->hidarite)
2406 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2407 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2411 energy_use = energy_use*num/p_ptr->num_blow[hand];
2414 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2416 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2418 msg_print("Sigh... Another trifling thing I've cut....");
2423 /* Anger the monster */
2424 if (k > 0) anger_monster(m_ptr);
2426 touch_zap_player(m_ptr);
2428 /* Are we draining it? A little note: If the monster is
2429 dead, the drain does not work... */
2431 if (can_drain && (drain_result > 0))
2433 if (o_ptr->name1 == ART_MURAMASA)
2437 int to_h = o_ptr->to_h;
2438 int to_d = o_ptr->to_d;
2442 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2446 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2449 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2452 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2454 msg_print("Muramasa sucked blood, and became more powerful!");
2463 if (drain_result > 5) /* Did we really hurt it? */
2465 drain_heal = damroll(2, drain_result / 6);
2468 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
2473 msg_format("Draining left: %d", drain_left);
2475 msg_format("Draining left: %d", drain_left);
2482 if (drain_heal < drain_left)
2484 drain_left -= drain_heal;
2488 drain_heal = drain_left;
2495 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2497 msg_format("Your weapon drains life from %s!", m_name);
2503 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2505 hp_player(drain_heal);
2506 /* We get to keep some of it! */
2510 m_ptr->maxhp -= (k+7)/8;
2511 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2512 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2518 /* Confusion attack */
2519 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
2521 /* Cancel glowing hands */
2522 if (p_ptr->special_attack & ATTACK_CONFUSE)
2524 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2526 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2528 msg_print("Your hands stop glowing.");
2530 p_ptr->redraw |= (PR_STATUS);
2534 /* Confuse the monster */
2535 if (r_ptr->flags3 & RF3_NO_CONF)
2537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2540 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2542 msg_format("%^s is unaffected.", m_name);
2546 else if (randint0(100) < r_ptr->level)
2549 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2551 msg_format("%^s is unaffected.", m_name);
2558 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2560 msg_format("%^s appears confused.", m_name);
2563 (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
2567 else if (chaos_effect == 4)
2569 bool resists_tele = FALSE;
2571 if (r_ptr->flagsr & RFR_RES_TELE)
2573 if (r_ptr->flags1 & RF1_UNIQUE)
2575 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2577 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2579 msg_format("%^s is unaffected!", m_name);
2582 resists_tele = TRUE;
2584 else if (r_ptr->level > randint1(100))
2586 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2588 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2590 msg_format("%^s resists!", m_name);
2593 resists_tele = TRUE;
2600 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2602 msg_format("%^s disappears!", m_name);
2605 teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE);
2606 num = num_blow + 1; /* Can't hit it anymore! */
2611 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2613 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2614 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2616 if (polymorph_monster(y, x))
2619 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2621 msg_format("%^s changes!", m_name);
2630 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2632 msg_format("%^s is unaffected.", m_name);
2636 /* Hack -- Get new monster */
2637 m_ptr = &m_list[c_ptr->m_idx];
2639 /* Oops, we need a different name... */
2640 monster_desc(m_name, m_ptr, 0);
2642 /* Hack -- Get new race */
2643 r_ptr = &r_info[m_ptr->r_idx];
2646 else if (o_ptr->name1 == ART_G_HAMMER)
2648 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2650 if (m_ptr->hold_o_idx)
2652 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2653 char o_name[MAX_NLEN];
2655 object_desc(o_name, q_ptr, OD_NAME_ONLY);
2656 q_ptr->held_m_idx = 0;
2657 q_ptr->marked = OM_TOUCHED;
2658 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2659 q_ptr->next_o_idx = 0;
2661 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2663 msg_format("You snatched %s.", o_name);
2673 backstab = FALSE; /* Clumsy! */
2674 fuiuchi = FALSE; /* Clumsy! */
2676 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2678 u32b flgs[TR_FLAG_SIZE];
2685 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2687 msg_format("You miss %s.", m_name);
2691 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2693 msg_print("Your scythe returns to you!");
2696 /* Extract the flags */
2697 object_flags(o_ptr, flgs);
2699 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2702 switch (p_ptr->mimic_form)
2705 switch (p_ptr->prace)
2712 case RACE_BARBARIAN:
2716 case RACE_HALF_TROLL:
2717 case RACE_HALF_OGRE:
2718 case RACE_HALF_GIANT:
2719 case RACE_HALF_TITAN:
2727 case RACE_DRACONIAN:
2734 case MIMIC_DEMON_LORD:
2741 if (p_ptr->align < 0 && mult < 20)
2743 if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
2745 if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
2747 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
2749 if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
2751 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
2754 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
2756 p_ptr->csp -= (1+(p_ptr->msp / 30));
2757 p_ptr->redraw |= (PR_MANA);
2758 mult = mult * 3 / 2 + 20;
2764 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2769 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
2771 msg_format("Your weapon cuts deep into yourself!");
2773 /* Try to increase the damage */
2781 k += (p_ptr->to_d[hand] + o_ptr->to_d);
2786 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
2788 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
2800 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2802 msg_format("You miss %s.", m_name);
2811 if (weak && !(*mdeath))
2814 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
2816 msg_format("%^s seems weakened.", m_name);
2819 if (drain_left != MAX_VAMPIRIC_DRAIN)
2823 chg_virtue(V_UNLIFE, 1);
2826 /* Mega-Hack -- apply earthquake brand */
2829 earthquake(py, px, 10);
2830 if (!cave[y][x].m_idx) *mdeath = TRUE;
2835 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó
2836 * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
2837 * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
2838 * @param mode ȯưÃæ¤Î·õ½ÑID
2839 * @return ¼ÂºÝ¤Ë¹¶·â½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2841 * If no "weapon" is available, then "punch" the monster one time.
2843 bool py_attack(int y, int x, int mode)
2846 bool mdeath = FALSE;
2847 bool stormbringer = FALSE;
2849 cave_type *c_ptr = &cave[y][x];
2850 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2851 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2854 /* Disturb the player */
2859 if (!p_ptr->migite && !p_ptr->hidarite &&
2860 !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2863 msg_format("%s¹¶·â¤Ç¤¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ" : "");
2865 msg_print("You cannot do attacking.");
2870 /* Extract monster name (or "it") */
2871 monster_desc(m_name, m_ptr, 0);
2875 /* Auto-Recall if possible and visible */
2876 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2878 /* Track a new monster */
2879 health_track(c_ptr->m_idx);
2882 if ((r_ptr->flags1 & RF1_FEMALE) &&
2883 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
2885 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
2888 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
2890 msg_print("I can not attack women!");
2896 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
2899 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
2901 msg_print("Something prevent you from attacking.");
2906 /* Stop if friendly */
2907 if (!is_hostile(m_ptr) &&
2908 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
2909 p_ptr->shero || !m_ptr->ml))
2911 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2912 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2916 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
2918 msg_format("Your black blade greedily attacks %s!", m_name);
2920 chg_virtue(V_INDIVIDUALISM, 1);
2921 chg_virtue(V_HONOUR, -1);
2922 chg_virtue(V_JUSTICE, -1);
2923 chg_virtue(V_COMPASSION, -1);
2925 else if (p_ptr->pclass != CLASS_BERSERKER)
2928 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
2930 if (get_check("Really hit it? "))
2933 chg_virtue(V_INDIVIDUALISM, 1);
2934 chg_virtue(V_HONOUR, -1);
2935 chg_virtue(V_JUSTICE, -1);
2936 chg_virtue(V_COMPASSION, -1);
2941 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
2943 msg_format("You stop to avoid hitting %s.", m_name);
2951 /* Handle player fear */
2957 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
2959 msg_format("You are too afraid to attack %s!", m_name);
2964 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
2966 msg_format ("There is something scary in your way!");
2969 /* Disturb the monster */
2970 (void)set_monster_csleep(c_ptr->m_idx, 0);
2976 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2978 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
2979 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
2982 if (p_ptr->migite && p_ptr->hidarite)
2984 if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level))
2986 if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2987 p_ptr->skill_exp[GINOU_NITOURYU] += 80;
2988 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2989 p_ptr->skill_exp[GINOU_NITOURYU] += 4;
2990 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2991 p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2992 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2993 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2994 p_ptr->update |= (PU_BONUS);
2998 /* Gain riding experience */
3001 int cur = p_ptr->skill_exp[GINOU_RIDING];
3002 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
3006 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
3007 int targetlevel = r_ptr->level;
3010 if ((cur / 200 - 5) < targetlevel)
3013 /* Extra experience */
3014 if ((cur / 100) < ridinglevel)
3016 if ((cur / 100 + 15) < ridinglevel)
3017 inc += 1 + (ridinglevel - (cur / 100 + 15));
3022 p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
3024 p_ptr->update |= (PU_BONUS);
3028 riding_t_m_idx = c_ptr->m_idx;
3029 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
3030 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
3032 /* Mutations which yield extra 'natural' attacks */
3035 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
3036 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
3037 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
3038 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
3039 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
3040 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
3041 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
3042 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
3043 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
3044 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
3047 /* Hack -- delay fear messages */
3048 if (fear && m_ptr->ml && !mdeath)
3055 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
3057 msg_format("%^s flees in terror!", m_name);
3062 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
3064 set_action(ACTION_NONE);
3072 * @brief ¥Ñ¥¿¡¼¥ó¤Ë¤è¤ë°ÜÆ°À©¸Â½èÍý
3073 * @param c_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µYºÂɸ
3074 * @param c_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µXºÂɸ
3075 * @param n_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèYºÂɸ
3076 * @param n_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèXºÂɸ
3077 * @return °ÜÆ°½èÍý¤¬²Äǽ¤Ç¤¢¤ë¾ì¹ç¡Ê²Äǽ¤Ê¾ì¹ç¤ËÁªÂò¤·¤¿¾ì¹ç¡ËTRUE¤òÊÖ¤¹¡£
3079 bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
3081 feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
3082 feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
3083 bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
3084 bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
3085 int pattern_type_cur, pattern_type_new;
3087 if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
3089 pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE;
3090 pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE;
3092 if (pattern_type_new == PATTERN_TILE_START)
3094 if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
3097 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
3099 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
3108 else if ((pattern_type_new == PATTERN_TILE_OLD) ||
3109 (pattern_type_new == PATTERN_TILE_END) ||
3110 (pattern_type_new == PATTERN_TILE_WRECKED))
3112 if (is_pattern_tile_cur)
3119 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3121 msg_print("You must start walking the Pattern from the startpoint.");
3127 else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
3128 (pattern_type_cur == PATTERN_TILE_TELEPORT))
3132 else if (pattern_type_cur == PATTERN_TILE_START)
3134 if (is_pattern_tile_new)
3139 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3141 msg_print("You must walk the Pattern in correct order.");
3147 else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
3148 (pattern_type_cur == PATTERN_TILE_END) ||
3149 (pattern_type_cur == PATTERN_TILE_WRECKED))
3151 if (!is_pattern_tile_new)
3154 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3156 msg_print("You may not step off from the Pattern.");
3168 if (!is_pattern_tile_cur)
3171 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3173 msg_print("You must start walking the Pattern from the startpoint.");
3180 byte ok_move = PATTERN_TILE_START;
3181 switch (pattern_type_cur)
3183 case PATTERN_TILE_1:
3184 ok_move = PATTERN_TILE_2;
3186 case PATTERN_TILE_2:
3187 ok_move = PATTERN_TILE_3;
3189 case PATTERN_TILE_3:
3190 ok_move = PATTERN_TILE_4;
3192 case PATTERN_TILE_4:
3193 ok_move = PATTERN_TILE_1;
3198 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
3200 msg_format("Funny Pattern walking, %d.", pattern_type_cur);
3203 return TRUE; /* Goof-up */
3206 if ((pattern_type_new == ok_move) ||
3207 (pattern_type_new == pattern_type_cur))
3211 if (!is_pattern_tile_new)
3213 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3215 msg_print("You may not step off from the Pattern.");
3219 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3221 msg_print("You must walk the Pattern in correct order.");
3232 * @brief ¥×¥ì¥¤¥ä¡¼¤¬ÃÏ·ÁƧÇ˲Äǽ¤«¤òÊÖ¤¹
3233 * @param feature ȽÄꤷ¤¿¤¤ÃÏ·ÁID
3234 * @param mode °ÜÆ°¤Ë´Ø¤¹¤ë¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
3235 * @return °ÜÆ°²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3237 bool player_can_enter(s16b feature, u16b mode)
3239 feature_type *f_ptr = &f_info[feature];
3241 if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
3244 if (have_flag(f_ptr->flags, FF_PATTERN))
3246 if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
3250 if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
3251 if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
3252 if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
3254 if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
3261 * @brief °ÜÆ°¤Ëȼ¤¦¥×¥ì¥¤¥ä¡¼¤Î¥¹¥Æ¡¼¥¿¥¹ÊѲ½½èÍý
3262 * @param ny °ÜÆ°ÀèYºÂɸ
3263 * @param nx °ÜÆ°ÀèXºÂɸ
3264 * @param mpe_mode °ÜÆ°¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
3265 * @return ¥×¥ì¥¤¥ä¡¼¤¬»àË´¤ä¥Õ¥í¥¢Î¥Ã¦¤ò¹Ô¤ï¤º¡¢¼ÂºÝ¤Ë°ÜÆ°¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
3267 bool move_player_effect(int ny, int nx, u32b mpe_mode)
3269 cave_type *c_ptr = &cave[ny][nx];
3270 feature_type *f_ptr = &f_info[c_ptr->feat];
3272 if (!(mpe_mode & MPE_STAYING))
3276 cave_type *oc_ptr = &cave[oy][ox];
3277 int om_idx = oc_ptr->m_idx;
3278 int nm_idx = c_ptr->m_idx;
3280 /* Move the player */
3284 /* Hack -- For moving monster or riding player's moving */
3285 if (!(mpe_mode & MPE_DONT_SWAP_MON))
3287 /* Swap two monsters */
3288 c_ptr->m_idx = om_idx;
3289 oc_ptr->m_idx = nm_idx;
3291 if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
3293 monster_type *om_ptr = &m_list[om_idx];
3296 update_mon(om_idx, TRUE);
3299 if (nm_idx > 0) /* Monster on new spot */
3301 monster_type *nm_ptr = &m_list[nm_idx];
3304 update_mon(nm_idx, TRUE);
3308 /* Redraw old spot */
3311 /* Redraw new spot */
3314 /* Check for new panel (redraw map) */
3317 if (mpe_mode & MPE_FORGET_FLOW)
3321 /* Mega-Hack -- Forget the view */
3322 p_ptr->update |= (PU_UN_VIEW);
3325 p_ptr->redraw |= (PR_MAP);
3329 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
3332 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3334 /* Remove "unsafe" flag */
3335 if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
3337 /* For get everything when requested hehe I'm *NASTY* */
3338 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
3341 if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
3343 if (p_ptr->pclass == CLASS_NINJA)
3345 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
3346 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
3349 if ((p_ptr->action == ACTION_HAYAGAKE) &&
3350 (!have_flag(f_ptr->flags, FF_PROJECT) ||
3351 (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
3354 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
3356 msg_print("You cannot run in here.");
3358 set_action(ACTION_NONE);
3362 if (mpe_mode & MPE_ENERGY_USE)
3364 if (music_singing(MUSIC_WALL))
3366 (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE,
3367 PROJECT_KILL | PROJECT_ITEM, -1);
3369 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3372 /* Spontaneous Searching */
3373 if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
3378 /* Continuous Searching */
3379 if (p_ptr->action == ACTION_SEARCH)
3385 /* Handle "objects" */
3386 if (!(mpe_mode & MPE_DONT_PICKUP))
3388 carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
3391 /* Handle "store doors" */
3392 if (have_flag(f_ptr->flags, FF_STORE))
3398 /* Hack -- Enter store */
3399 command_new = SPECIAL_KEY_STORE;
3402 /* Handle "building doors" -KMW- */
3403 else if (have_flag(f_ptr->flags, FF_BLDG))
3409 /* Hack -- Enter building */
3410 command_new = SPECIAL_KEY_BUILDING;
3413 /* Handle quest areas -KMW- */
3414 else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3420 /* Hack -- Enter quest level */
3421 command_new = SPECIAL_KEY_QUEST;
3424 else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
3426 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
3428 complete_quest(p_ptr->inside_quest);
3431 leave_quest_check();
3433 p_ptr->inside_quest = c_ptr->special;
3438 p_ptr->leaving = TRUE;
3441 /* Set off a trap */
3442 else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
3448 if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
3452 msg_print("¥È¥é¥Ã¥×¤À¡ª");
3454 msg_print("You found a trap!");
3458 disclose_grid(py, px);
3462 hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
3464 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3467 /* Warn when leaving trap detected region */
3468 if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
3469 && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
3471 /* No duplicate warning */
3472 p_ptr->dtrap = FALSE;
3474 /* You are just on the edge */
3475 if (!(c_ptr->info & CAVE_UNSAFE))
3477 if (alert_trap_detect)
3480 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
3482 msg_print("*Leaving trap detect region!*");
3486 if (disturb_trap_detect) disturb(0, 1);
3490 return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
3494 * @brief ³ºÅöÃÏ·Á¤Î¥È¥é¥Ã¥×¤¬¥×¥ì¥¤¥ä¡¼¤Ë¤È¤Ã¤Æ̵¸ú¤«¤É¤¦¤«¤òȽÄꤷ¤ÆÊÖ¤¹
3495 * @param feat ÃÏ·ÁID
3496 * @return ¥È¥é¥Ã¥×¤¬¼«Æ°Åª¤Ë̵¸ú¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3498 bool trap_can_be_ignored(int feat)
3500 feature_type *f_ptr = &f_info[feat];
3502 if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE;
3504 switch (f_ptr->subtype)
3508 case TRAP_SPIKED_PIT:
3509 case TRAP_POISON_PIT:
3510 if (p_ptr->levitation) return TRUE;
3513 if (p_ptr->anti_tele) return TRUE;
3516 if (p_ptr->immune_fire) return TRUE;
3519 if (p_ptr->immune_acid) return TRUE;
3522 if (p_ptr->resist_blind) return TRUE;
3525 if (p_ptr->resist_conf) return TRUE;
3528 if (p_ptr->resist_pois) return TRUE;
3531 if (p_ptr->free_act) return TRUE;
3540 * Determine if a "boundary" grid is "floor mimic"
3542 #define boundary_floor(C, F, MF) \
3543 ((C)->mimic && permanent_wall(F) && \
3544 (have_flag((MF)->flags, FF_MOVE) || have_flag((MF)->flags, FF_CAN_FLY)) && \
3545 have_flag((MF)->flags, FF_PROJECT) && \
3546 !have_flag((MF)->flags, FF_OPEN))
3550 * @brief ³ºÅöÃÏ·Á¤Î¥È¥é¥Ã¥×¤¬¥×¥ì¥¤¥ä¡¼¤Ë¤È¤Ã¤Æ̵¸ú¤«¤É¤¦¤«¤òȽÄꤷ¤ÆÊÖ¤¹ /
3551 * Move player in the given direction, with the given "pickup" flag.
3552 * @param dir °ÜÆ°Êý¸þID
3553 * @param do_pickup 櫲ò½ü¤ò»î¤ß¤Ê¤¬¤é¤Î°ÜÆ°¤Ê¤é¤ÐTRUE
3554 * @param break_trap ¥È¥é¥Ã¥×Ê´ºÕ½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE
3555 * @return ¼ÂºÝ¤Ë°ÜÆ°¤¬¹Ô¤ï¤ì¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
3557 * This routine should (probably) always induce energy expenditure.\n
3559 * Note that moving will *always* take a turn, and will *always* hit\n
3560 * any monster which might be in the destination grid. Previously,\n
3561 * moving into walls was "free" and did NOT hit invisible monsters.\n
3563 void move_player(int dir, bool do_pickup, bool break_trap)
3565 /* Find the result of moving */
3566 int y = py + ddy[dir];
3567 int x = px + ddx[dir];
3569 /* Examine the destination */
3570 cave_type *c_ptr = &cave[y][x];
3572 feature_type *f_ptr = &f_info[c_ptr->feat];
3574 monster_type *m_ptr;
3576 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
3577 monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
3581 bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
3582 bool p_can_kill_walls = FALSE;
3583 bool stormbringer = FALSE;
3585 bool oktomove = TRUE;
3586 bool do_past = FALSE;
3589 if (!dun_level && !p_ptr->wild_mode &&
3590 ((x == 0) || (x == MAX_WID - 1) ||
3591 (y == 0) || (y == MAX_HGT - 1)))
3593 /* Can the player enter the grid? */
3594 if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
3596 /* Hack: move to new area */
3597 if ((y == 0) && (x == 0))
3599 p_ptr->wilderness_y--;
3600 p_ptr->wilderness_x--;
3601 p_ptr->oldpy = cur_hgt - 2;
3602 p_ptr->oldpx = cur_wid - 2;
3603 ambush_flag = FALSE;
3606 else if ((y == 0) && (x == MAX_WID - 1))
3608 p_ptr->wilderness_y--;
3609 p_ptr->wilderness_x++;
3610 p_ptr->oldpy = cur_hgt - 2;
3612 ambush_flag = FALSE;
3615 else if ((y == MAX_HGT - 1) && (x == 0))
3617 p_ptr->wilderness_y++;
3618 p_ptr->wilderness_x--;
3620 p_ptr->oldpx = cur_wid - 2;
3621 ambush_flag = FALSE;
3624 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3626 p_ptr->wilderness_y++;
3627 p_ptr->wilderness_x++;
3630 ambush_flag = FALSE;
3635 p_ptr->wilderness_y--;
3636 p_ptr->oldpy = cur_hgt - 2;
3638 ambush_flag = FALSE;
3641 else if (y == MAX_HGT - 1)
3643 p_ptr->wilderness_y++;
3646 ambush_flag = FALSE;
3651 p_ptr->wilderness_x--;
3652 p_ptr->oldpx = cur_wid - 2;
3654 ambush_flag = FALSE;
3657 else if (x == MAX_WID - 1)
3659 p_ptr->wilderness_x++;
3662 ambush_flag = FALSE;
3665 p_ptr->leaving = TRUE;
3671 /* "Blocked" message appears later */
3672 /* oktomove = FALSE; */
3673 p_can_enter = FALSE;
3676 /* Get the monster */
3677 m_ptr = &m_list[c_ptr->m_idx];
3680 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3681 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3683 /* Player can not walk through "walls"... */
3684 /* unless in Shadow Form */
3685 p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
3686 (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
3687 !have_flag(f_ptr->flags, FF_PERMANENT);
3689 /* Hack -- attack monsters */
3690 if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
3692 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3694 /* Attack -- only if we can see it OR it is not in a wall */
3695 if (!is_hostile(m_ptr) &&
3696 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3697 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3698 pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls))
3700 /* Disturb the monster */
3701 (void)set_monster_csleep(c_ptr->m_idx, 0);
3703 /* Extract monster name (or "it") */
3704 monster_desc(m_name, m_ptr, 0);
3708 /* Auto-Recall if possible and visible */
3709 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
3711 /* Track a new monster */
3712 health_track(c_ptr->m_idx);
3716 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3721 else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0))
3728 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3730 msg_format("%^s is in your way!", m_name);
3737 /* now continue on to 'movement' */
3746 if (oktomove && p_ptr->riding)
3748 if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
3751 msg_print("Æ°¤±¤Ê¤¤¡ª");
3753 msg_print("Can't move!");
3759 else if (MON_MONFEAR(riding_m_ptr))
3763 /* Acquire the monster name */
3764 monster_desc(m_name, riding_m_ptr, 0);
3766 /* Dump a message */
3768 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3770 msg_format("%^s is too scared to control.", m_name);
3775 else if (p_ptr->riding_ryoute)
3780 else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
3784 else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
3788 else if (have_flag(f_ptr->flags, FF_WATER) &&
3789 !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
3790 (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
3793 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3795 msg_print("Can't swim.");
3801 else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
3804 msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name);
3806 msg_print("Can't land.");
3812 else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3815 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3817 msg_print("Too hot to go through.");
3824 if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
3827 monster_desc(m_name, riding_m_ptr, 0);
3829 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3831 msg_format("You cannot control stunned %s!",m_name);
3842 else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
3845 msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3847 msg_format("You need to fly to go through the %s.", f_name + f_info[get_feat_mimic(c_ptr)].name);
3856 * Player can move through trees and
3857 * has effective -10 speed
3858 * Rangers can move without penality
3860 else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
3862 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) energy_use *= 2;
3865 #ifdef ALLOW_EASY_DISARM /* TNB */
3867 /* Disarm a visible trap */
3868 else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
3870 if (!trap_can_be_ignored(c_ptr->feat))
3872 (void)do_cmd_disarm_aux(y, x, dir);
3877 #endif /* ALLOW_EASY_DISARM -- TNB */
3879 /* Player can not walk through "walls" unless in wraith form...*/
3880 else if (!p_can_enter && !p_can_kill_walls)
3882 /* Feature code (applying "mimic" field) */
3883 s16b feat = get_feat_mimic(c_ptr);
3884 feature_type *mimic_f_ptr = &f_info[feat];
3885 cptr name = f_name + mimic_f_ptr->name;
3889 /* Notice things in the dark */
3890 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3892 /* Boundary floor mimic */
3893 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3896 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
3898 msg_print("You feel you cannot go any more.");
3902 /* Wall (or secret door) */
3906 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
3908 msg_format("You feel %s %s blocking your way.",
3909 is_a_vowel(name[0]) ? "an" : "a", name);
3912 c_ptr->info |= (CAVE_MARK);
3920 /* Boundary floor mimic */
3921 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3924 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
3926 msg_print("You cannot go any more.");
3929 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3933 /* Wall (or secret door) */
3936 #ifdef ALLOW_EASY_OPEN
3938 if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
3939 #endif /* ALLOW_EASY_OPEN */
3942 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
3944 msg_format("There is %s %s blocking your way.",
3945 is_a_vowel(name[0]) ? "an" : "a", name);
3949 * Well, it makes sense that you lose time bumping into
3950 * a wall _if_ you are confused, stunned or blind; but
3951 * typing mistakes should not cost you a turn...
3953 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3958 /* Disturb the player */
3962 if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
3965 /* Normal movement */
3966 if (oktomove && !pattern_seq(py, px, y, x))
3968 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3973 /* To avoid a loop with running */
3979 /* Normal movement */
3982 u32b mpe_mode = MPE_ENERGY_USE;
3986 if (!process_warning(x, y))
3996 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
3998 msg_format("You push past %s.", m_name);
4002 /* Change oldpx and oldpy to place the player well when going back to big mode */
4003 if (p_ptr->wild_mode)
4005 if (ddy[dir] > 0) p_ptr->oldpy = 1;
4006 if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
4007 if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
4008 if (ddx[dir] > 0) p_ptr->oldpx = 1;
4009 if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
4010 if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
4013 if (p_can_kill_walls)
4015 cave_alter_feat(y, x, FF_HURT_DISI);
4017 /* Update some things -- similar to GF_KILL_WALL */
4018 p_ptr->update |= (PU_FLOW);
4022 /* sound(SOUND_WALK); */
4024 #ifdef ALLOW_EASY_DISARM /* TNB */
4026 if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
4028 #else /* ALLOW_EASY_DISARM -- TNB */
4030 if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
4032 #endif /* ALLOW_EASY_DISARM -- TNB */
4034 if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
4036 /* Move the player */
4037 (void)move_player_effect(y, x, mpe_mode);
4042 static bool ignore_avoid_run;
4045 * @brief ¥À¥Ã¥·¥å°ÜÆ°½èÍýÃæ¡¢°ÜÆ°Àè¤Î¥Þ¥¹¤¬´ûÃΤÎÊɤ«¤É¤¦¤«¤òȽÄꤹ¤ë /
4046 * Hack -- Check for a "known wall" (see below)
4047 * @param dir ÁÛÄꤹ¤ë°ÜÆ°Êý¸þID
4048 * @param y °ÜÆ°¸µ¤ÎYºÂɸ
4049 * @param x °ÜÆ°¸µ¤ÎXºÂɸ
4050 * @return °ÜÆ°À褬´ûÃΤÎÊɤʤé¤ÐTRUE
4052 static int see_wall(int dir, int y, int x)
4056 /* Get the new location */
4060 /* Illegal grids are not known walls */
4061 if (!in_bounds2(y, x)) return (FALSE);
4064 c_ptr = &cave[y][x];
4066 /* Must be known to the player */
4067 if (c_ptr->info & (CAVE_MARK))
4069 /* Feature code (applying "mimic" field) */
4070 s16b feat = get_feat_mimic(c_ptr);
4071 feature_type *f_ptr = &f_info[feat];
4073 /* Wall grids are known walls */
4074 if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
4076 /* Don't run on a tree unless explicitly requested */
4077 if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
4080 /* Don't run in a wall */
4081 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
4082 return !have_flag(f_ptr->flags, FF_DOOR);
4090 * @brief ¥À¥Ã¥·¥å°ÜÆ°½èÍýÃæ¡¢°ÜÆ°Àè¤Î¥Þ¥¹¤«Ì¤ÃΤÎÃÏ·Á¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
4091 * Hack -- Check for an "unknown corner" (see below)
4092 * @param dir ÁÛÄꤹ¤ë°ÜÆ°Êý¸þID
4093 * @param y °ÜÆ°¸µ¤ÎYºÂɸ
4094 * @param x °ÜÆ°¸µ¤ÎXºÂɸ
4095 * @return °ÜÆ°À褬̤ÃΤÎÃÏ·Á¤Ê¤é¤ÐTRUE
4097 static int see_nothing(int dir, int y, int x)
4099 /* Get the new location */
4103 /* Illegal grids are unknown */
4104 if (!in_bounds2(y, x)) return (TRUE);
4106 /* Memorized grids are always known */
4107 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
4109 /* Viewable door/wall grids are known */
4110 if (player_can_see_bold(y, x)) return (FALSE);
4122 * Hack -- allow quick "cycling" through the legal directions
4124 static byte cycle[] =
4125 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
4128 * Hack -- map each direction into the "middle" of the "cycle[]" array
4130 static byte chome[] =
4131 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
4134 * The direction we are running
4136 static byte find_current;
4139 * The direction we came from
4141 static byte find_prevdir;
4144 * We are looking for open area
4146 static bool find_openarea;
4149 * We are looking for a break
4151 static bool find_breakright;
4152 static bool find_breakleft;
4157 * @brief ¥À¥Ã¥·¥å½èÍý¤ÎƳÆþ /
4158 * Initialize the running algorithm for a new direction.
4159 * @param dir ƳÆþ¤Î°ÜÆ°Àè
4161 * Diagonal Corridor -- allow diaginal entry into corridors.\n
4163 * Blunt Corridor -- If there is a wall two spaces ahead and\n
4164 * we seem to be in a corridor, then force a turn into the side\n
4165 * corridor, must be moving straight into a corridor here. ???\n
4167 * Diagonal Corridor Blunt Corridor (?)\n
4172 static void run_init(int dir)
4174 int row, col, deepleft, deepright;
4175 int i, shortleft, shortright;
4178 /* Save the direction */
4181 /* Assume running straight */
4184 /* Assume looking for open area */
4185 find_openarea = TRUE;
4187 /* Assume not looking for breaks */
4188 find_breakright = find_breakleft = FALSE;
4190 /* Assume no nearby walls */
4191 deepleft = deepright = FALSE;
4192 shortright = shortleft = FALSE;
4197 /* Find the destination grid */
4198 row = py + ddy[dir];
4199 col = px + ddx[dir];
4201 ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN);
4203 /* Extract cycle index */
4206 /* Check for walls */
4207 if (see_wall(cycle[i+1], py, px))
4209 find_breakleft = TRUE;
4212 else if (see_wall(cycle[i+1], row, col))
4214 find_breakleft = TRUE;
4218 /* Check for walls */
4219 if (see_wall(cycle[i-1], py, px))
4221 find_breakright = TRUE;
4224 else if (see_wall(cycle[i-1], row, col))
4226 find_breakright = TRUE;
4230 /* Looking for a break */
4231 if (find_breakleft && find_breakright)
4233 /* Not looking for open area */
4234 find_openarea = FALSE;
4236 /* Hack -- allow angled corridor entry */
4239 if (deepleft && !deepright)
4241 find_prevdir = cycle[i - 1];
4243 else if (deepright && !deepleft)
4245 find_prevdir = cycle[i + 1];
4249 /* Hack -- allow blunt corridor entry */
4250 else if (see_wall(cycle[i], row, col))
4252 if (shortleft && !shortright)
4254 find_prevdir = cycle[i - 2];
4256 else if (shortright && !shortleft)
4258 find_prevdir = cycle[i + 2];
4266 * @brief ¥À¥Ã¥·¥å°ÜÆ°¤¬·Ñ³¤Ç¤¤ë¤«¤É¤¦¤«¤ÎȽÄê /
4267 * Update the current "run" path
4269 * ¥À¥Ã¥·¥å°ÜÆ°¤¬·Ñ³¤Ç¤¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
4270 * Return TRUE if the running should be stopped
4272 static bool run_test(void)
4274 int prev_dir, new_dir, check_dir = 0;
4277 int option = 0, option2 = 0;
4280 feature_type *f_ptr;
4282 /* Where we came from */
4283 prev_dir = find_prevdir;
4286 /* Range of newly adjacent grids */
4287 max = (prev_dir & 0x01) + 1;
4289 /* break run when leaving trap detected region */
4290 if ((disturb_trap_detect || alert_trap_detect)
4291 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4293 /* No duplicate warning */
4294 p_ptr->dtrap = FALSE;
4296 /* You are just on the edge */
4297 if (!(cave[py][px].info & CAVE_UNSAFE))
4299 if (alert_trap_detect)
4302 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4304 msg_print("*Leaving trap detect region!*");
4308 if (disturb_trap_detect)
4316 /* Look at every newly adjacent square. */
4317 for (i = -max; i <= max; i++)
4319 s16b this_o_idx, next_o_idx = 0;
4322 new_dir = cycle[chome[prev_dir] + i];
4325 row = py + ddy[new_dir];
4326 col = px + ddx[new_dir];
4329 c_ptr = &cave[row][col];
4331 /* Feature code (applying "mimic" field) */
4332 feat = get_feat_mimic(c_ptr);
4333 f_ptr = &f_info[feat];
4335 /* Visible monsters abort running */
4338 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4340 /* Visible monster */
4341 if (m_ptr->ml) return (TRUE);
4344 /* Visible objects abort running */
4345 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4349 /* Acquire object */
4350 o_ptr = &o_list[this_o_idx];
4352 /* Acquire next object */
4353 next_o_idx = o_ptr->next_o_idx;
4355 /* Visible object */
4356 if (o_ptr->marked & OM_FOUND) return (TRUE);
4359 /* Assume unknown */
4362 /* Check memorized grids */
4363 if (c_ptr->info & (CAVE_MARK))
4365 bool notice = have_flag(f_ptr->flags, FF_NOTICE);
4367 if (notice && have_flag(f_ptr->flags, FF_MOVE))
4370 if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
4372 /* Option -- ignore */
4377 else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
4379 /* Option -- ignore */
4384 else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
4391 else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
4392 (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
4399 /* Interesting feature */
4400 if (notice) return (TRUE);
4402 /* The grid is "visible" */
4406 /* Analyze unknown grids and floors considering mimic */
4407 if (inv || !see_wall(0, row, col))
4409 /* Looking for open area */
4415 /* The first new direction. */
4421 /* Three new directions. Stop running. */
4427 /* Two non-adjacent new directions. Stop running. */
4428 else if (option != cycle[chome[prev_dir] + i - 1])
4433 /* Two new (adjacent) directions (case 1) */
4434 else if (new_dir & 0x01)
4436 check_dir = cycle[chome[prev_dir] + i - 2];
4440 /* Two new (adjacent) directions (case 2) */
4443 check_dir = cycle[chome[prev_dir] + i + 1];
4449 /* Obstacle, while looking for open area */
4456 /* Break to the right */
4457 find_breakright = TRUE;
4462 /* Break to the left */
4463 find_breakleft = TRUE;
4469 /* Looking for open area */
4472 /* Hack -- look again */
4473 for (i = -max; i < 0; i++)
4475 /* Unknown grid or non-wall */
4476 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4478 /* Looking to break right */
4479 if (find_breakright)
4488 /* Looking to break left */
4496 /* Hack -- look again */
4497 for (i = max; i > 0; i--)
4499 /* Unknown grid or non-wall */
4500 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4502 /* Looking to break left */
4512 /* Looking to break right */
4513 if (find_breakright)
4521 /* Not looking for open area */
4533 /* Primary option */
4534 find_current = option;
4536 /* No other options */
4537 find_prevdir = option;
4540 /* Two options, examining corners */
4543 /* Primary option */
4544 find_current = option;
4546 /* Hack -- allow curving */
4547 find_prevdir = option2;
4550 /* Two options, pick one */
4553 /* Get next location */
4554 row = py + ddy[option];
4555 col = px + ddx[option];
4557 /* Don't see that it is closed off. */
4558 /* This could be a potential corner or an intersection. */
4559 if (!see_wall(option, row, col) ||
4560 !see_wall(check_dir, row, col))
4562 /* Can not see anything ahead and in the direction we */
4563 /* are turning, assume that it is a potential corner. */
4564 if (see_nothing(option, row, col) &&
4565 see_nothing(option2, row, col))
4567 find_current = option;
4568 find_prevdir = option2;
4571 /* STOP: we are next to an intersection or a room */
4578 /* This corner is seen to be enclosed; we cut the corner. */
4581 find_current = option2;
4582 find_prevdir = option2;
4585 /* This corner is seen to be enclosed, and we */
4586 /* deliberately go the long way. */
4589 find_current = option;
4590 find_prevdir = option2;
4595 /* About to hit a known wall, stop */
4596 if (see_wall(find_current, py, px))
4608 * @brief ·Ñ³Ū¤Ê¥À¥Ã¥·¥å½èÍý /
4609 * Take one step along the current "run" path
4610 * @param dir °ÜÆ°¤ò»î¤ß¤ëÊý¸þID
4613 void run_step(int dir)
4618 /* Ignore AVOID_RUN on a first step */
4619 ignore_avoid_run = TRUE;
4621 /* Hack -- do not start silly run */
4622 if (see_wall(dir, py, px))
4626 msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£");
4628 msg_print("You cannot run in that direction.");
4656 /* Decrease the run counter */
4657 if (--running <= 0) return;
4662 /* Move the player, using the "pickup" flag */
4663 #ifdef ALLOW_EASY_DISARM /* TNB */
4665 move_player(find_current, FALSE, FALSE);
4667 #else /* ALLOW_EASY_DISARM -- TNB */
4669 move_player(find_current, always_pickup, FALSE);
4671 #endif /* ALLOW_EASY_DISARM -- TNB */
4673 if (player_bold(p_ptr->run_py, p_ptr->run_px))
4685 * @brief ¥È¥é¥Ù¥ëµ¡Ç½¤ÎȽÄê½èÍý /
4686 * Test for traveling
4687 * @param prev_dir Á°²ó°ÜÆ°¤ò¹Ô¤Ã¤¿¸µ¤ÎÊý³ÑID
4690 static int travel_test(int prev_dir)
4694 const cave_type *c_ptr;
4697 /* Cannot travel when blind */
4698 if (p_ptr->blind || no_lite())
4700 msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
4704 /* break run when leaving trap detected region */
4705 if ((disturb_trap_detect || alert_trap_detect)
4706 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4708 /* No duplicate warning */
4709 p_ptr->dtrap = FALSE;
4711 /* You are just on the edge */
4712 if (!(cave[py][px].info & CAVE_UNSAFE))
4714 if (alert_trap_detect)
4717 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4719 msg_print("*Leaving trap detect region!*");
4723 if (disturb_trap_detect)
4731 /* Range of newly adjacent grids */
4732 max = (prev_dir & 0x01) + 1;
4734 /* Look at every newly adjacent square. */
4735 for (i = -max; i <= max; i++)
4738 int dir = cycle[chome[prev_dir] + i];
4741 int row = py + ddy[dir];
4742 int col = px + ddx[dir];
4745 c_ptr = &cave[row][col];
4747 /* Visible monsters abort running */
4750 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4752 /* Visible monster */
4753 if (m_ptr->ml) return (0);
4758 /* Travel cost of current grid */
4759 cost = travel.cost[py][px];
4761 /* Determine travel direction */
4762 for (i = 0; i < 8; ++ i) {
4763 int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]];
4765 if (dir_cost < cost)
4772 if (!new_dir) return (0);
4774 /* Access newly move grid */
4775 c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]];
4777 /* Close door abort traveling */
4778 if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
4780 /* Visible and unignorable trap abort tarveling */
4781 if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
4789 * @brief ¥È¥é¥Ù¥ëµ¡Ç½¤Î¼ÂÁõ /
4793 void travel_step(void)
4795 /* Get travel direction */
4796 travel.dir = travel_test(travel.dir);
4801 if (travel.run == 255)
4804 msg_print("Æ»¶Ú¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡ª");
4806 msg_print("No route is found!");
4808 travel.y = travel.x = 0;
4816 move_player(travel.dir, always_pickup, FALSE);
4818 if ((py == travel.y) && (px == travel.x))
4821 travel.y = travel.x = 0;
4823 else if (travel.run > 0)
4827 Term_xtra(TERM_XTRA_DELAY, delay_factor);