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.
15 #define MAX_VAMPIRIC_DRAIN 50 /*!< µÛ·ì½èÍý¤ÎºÇÂç²óÉüHP */
19 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·âÌ¿ÃæȽÄê /
20 * Determine if the player "hits" a monster (normal combat).
21 * @param chance ´ðËÜÌ¿ÃæÃÍ
22 * @param m_ptr ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
23 * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
24 * @param o_name ¥á¥Ã¥»¡¼¥¸É½¼¨»þ¤Î¥â¥ó¥¹¥¿¡¼Ì¾
25 * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
26 * @note Always miss 5%, always hit 5%, otherwise random.
28 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
31 monster_race *r_ptr = &r_info[m_ptr->r_idx];
34 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
39 /* Snipers with high-concentration reduce instant miss percentage.*/
42 /* Hack -- Instant miss or hit */
43 if (k < 10) return (k < 5);
45 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
46 if (one_in_(20)) return (FALSE);
49 if (chance <= 0) return (FALSE);
51 /* Invisible monsters are harder to hit */
52 if (!vis) chance = (chance + 1) / 2;
54 /* Power competes against armor */
55 if (randint0(chance) < (ac * 3 / 4))
57 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
61 /* Extract monster name */
62 monster_desc(m_name, m_ptr, 0);
63 msg_format(_("%s¤Ï%s¤ò»Â¤ê¼Î¤Æ¤¿¡ª", "%s cuts down %s!"), m_name, o_name);
75 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂÇ·âÌ¿ÃæȽÄê /
76 * Determine if the player "hits" a monster (normal combat).
77 * @param chance ´ðËÜÌ¿ÃæÃÍ
78 * @param ac ¥â¥ó¥¹¥¿¡¼¤ÎAC
79 * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
80 * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
81 * @note Always miss 5%, always hit 5%, otherwise random.
83 bool test_hit_norm(int chance, int ac, int vis)
90 /* Hack -- Instant miss or hit */
91 if (k < 10) return (k < 5);
93 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
94 if (one_in_(20)) return (FALSE);
96 /* Wimpy attack never hits */
97 if (chance <= 0) return (FALSE);
99 /* Penalize invisible targets */
100 if (!vis) chance = (chance + 1) / 2;
102 /* Power must defeat armor */
103 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
112 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·â¥¯¥ê¥Æ¥£¥«¥ëȽÄê /
113 * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
114 * @param weight ÌðÃƤνÅÎÌ
115 * @param plus_ammo ÌðÃƤÎÌ¿Ã潤Àµ
116 * @param plus_bow µÝ¤ÎÌ¿Ã潤Àµ
117 * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
118 * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
120 s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
123 object_type *j_ptr = &inventory[INVEN_BOW];
125 /* Extract "shot" power */
126 i = p_ptr->to_h_b + plus_ammo;
128 if (p_ptr->tval_ammo == TV_BOLT)
129 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
131 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
134 /* Snipers can shot more critically with crossbows */
135 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
136 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
138 /* Good bow makes more critical */
139 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
142 if (randint1(10000) <= i)
144 k = weight * randint1(500);
149 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
151 msg_print("It was a good hit!");
159 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
161 msg_print("It was a great hit!");
169 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
171 msg_print("It was a superb hit!");
184 * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂǷ⥯¥ê¥Æ¥£¥«¥ëȽÄê /
185 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
186 * @param weight ÌðÃƤνÅÎÌ
187 * @param plus Éð´ï¤ÎÌ¿Ã潤Àµ
188 * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
189 * @param meichuu ÂÇ·â¤Î´ðËÜÌ¿ÃæÎÏ
190 * @param mode ¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
191 * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
193 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
197 /* Extract "blow" power */
198 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
201 if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
203 k = weight + randint1(650);
204 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
209 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
211 msg_print("It was a good hit!");
219 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
221 msg_print("It was a great hit!");
229 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
231 msg_print("It was a superb hit!");
239 msg_print("ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
241 msg_print("It was a *GREAT* hit!");
249 msg_print("ÈæÎà¤Ê¤ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
251 msg_print("It was a *SUPERB* hit!");
254 dam = ((7 * dam) / 2) + 25;
264 * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î¼ï²¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
265 * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
266 * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
267 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
268 * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
270 static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
272 static const struct slay_table_t {
274 u32b affect_race_flag;
277 size_t r_flag_offset;
279 #define OFFSET(X) offsetof(monster_race, X)
280 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
281 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
282 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
283 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
284 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
285 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
286 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
287 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
288 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
289 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
290 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
291 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
292 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
293 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
294 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
295 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
296 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
297 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
298 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
299 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
303 monster_race* r_ptr = &r_info[m_ptr->r_idx];
305 for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
307 const struct slay_table_t* p = &slay_table[i];
309 if ((have_flag(flgs, p->slay_flag)) &&
310 (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
312 if (is_original_ap_and_seen(m_ptr))
314 atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
317 mult = MAX(mult, p->slay_mult);
325 * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î°À¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
326 * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
327 * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
328 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
329 * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
331 static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
333 static const struct brand_table_t {
338 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
339 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
340 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
341 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
342 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
345 monster_race* r_ptr = &r_info[m_ptr->r_idx];
347 for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
349 const struct brand_table_t* p = &brand_table[i];
351 if (have_flag(flgs, p->brand_flag))
353 /* Notice immunity */
354 if (r_ptr->flagsr & p->resist_mask)
356 if (is_original_ap_and_seen(m_ptr))
358 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
362 /* Otherwise, take the damage */
363 else if (r_ptr->flags3 & p->hurt_flag)
365 if (is_original_ap_and_seen(m_ptr))
367 r_ptr->r_flags3 |= p->hurt_flag;
370 mult = MAX(mult, 50);
374 mult = MAX(mult, 25);
383 * @brief ¥À¥á¡¼¥¸¤Ë¥¹¥ì¥¤Í×ÁǤò²Ã¤¨¤ëÁí¹ç½èÍý¥ë¡¼¥Á¥ó /
384 * Extract the "total damage" from a given object hitting a given monster.
385 * @param o_ptr »ÈÍÑÉð´ï¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
386 * @param tdam ¸½ºß»»½ÐÅÓÃæ¤Î¥À¥á¡¼¥¸ÃÍ
387 * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
388 * @param mode ·õ½Ñ¤ÎID
389 * @param thrown ¼Í·â½èÍý¤Ê¤é¤ÐTRUE¤ò»ØÄꤹ¤ë
390 * @return Áí¹çŪ¤Ê¥¹¥ì¥¤¤ò²ÃÌ£¤·¤¿¥À¥á¡¼¥¸ÃÍ
392 * Note that "flasks of oil" do NOT do fire damage, although they\n
393 * certainly could be made to do so. XXX XXX\n
395 * Note that most brands and slays are x3, except Slay Animal (x2),\n
396 * Slay Evil (x2), and Kill dragon (x5).\n
398 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
402 u32b flgs[TR_FLAG_SIZE];
404 /* Extract the flags */
405 object_flags(o_ptr, flgs);
406 torch_flags(o_ptr, flgs); /* torches has secret flags */
411 if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
412 if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
413 if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
414 if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
415 if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
418 /* Hex - Slay Good (Runesword) */
419 if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
421 /* Some "weapons" and "ammo" do extra damage */
434 mult = mult_slaying(mult, flgs, m_ptr);
436 /* Elemental Brand */
437 mult = mult_brand(mult, flgs, m_ptr);
440 if (p_ptr->pclass == CLASS_SAMURAI)
442 mult = mult_hissatsu(mult, flgs, m_ptr, mode);
446 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
448 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
449 p_ptr->redraw |= (PR_MANA);
450 mult = mult * 3 / 2 + 20;
453 /* Hack -- The Nothung cause special damage to Fafner */
454 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
459 if (mult > 150) mult = 150;
461 /* Return the total damage */
462 return (tdam * mult / 10);
467 * @brief ÃÏ·Á¤ä¤½¤Î¾å¤Î¥¢¥¤¥Æ¥à¤Î±£¤µ¤ì¤¿Í×ÁǤòÌÀ¤«¤¹ /
468 * Search for hidden things
469 * @param y ÂоݤȤʤë¥Þ¥¹¤ÎYºÂɸ
470 * @param x ÂоݤȤʤë¥Þ¥¹¤ÎXºÂɸ
473 static void discover_hidden_things(int y, int x)
475 s16b this_o_idx, next_o_idx = 0;
479 /* Access the grid */
483 if (c_ptr->mimic && is_trap(c_ptr->feat))
489 msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
496 if (is_hidden_door(c_ptr))
499 msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
508 /* Scan all objects in the grid */
509 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
514 o_ptr = &o_list[this_o_idx];
516 /* Acquire next object */
517 next_o_idx = o_ptr->next_o_idx;
519 /* Skip non-chests */
520 if (o_ptr->tval != TV_CHEST) continue;
522 /* Skip non-trapped chests */
523 if (!chest_traps[o_ptr->pval]) continue;
526 if (!object_is_known(o_ptr))
529 msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
541 * @brief ¥×¥ì¥¤¥ä¡¼¤Îõº÷½èÍýȽÄê
548 /* Start with base search ability */
549 chance = p_ptr->skill_srh;
551 /* Penalize various conditions */
552 if (p_ptr->blind || no_lite()) chance = chance / 10;
553 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
555 /* Search the nearby grids, which are always in bounds */
556 for (i = 0; i < 9; ++ i)
558 /* Sometimes, notice things */
559 if (randint0(100) < chance)
561 discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
568 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¤ò½¦¤Ã¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸É½¼¨½èÍý /
569 * Helper routine for py_pickup() and py_pickup_floor().
570 * @param o_idx ¼èÆÀ¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾ÈID
573 * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×\n
574 * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë\n
576 * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨\n
577 * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£\n
578 * Add the given dungeon object to the character's inventory.\n
579 * Delete the object afterwards.\n
581 void py_pickup_aux(int o_idx)
586 char o_name[MAX_NLEN];
587 char old_name[MAX_NLEN];
591 char o_name[MAX_NLEN];
596 o_ptr = &o_list[o_idx];
599 /* Describe the object */
600 object_desc(old_name, o_ptr, OD_NAME_ONLY);
601 object_desc_kosuu(kazu_str, o_ptr);
602 hirottakazu = o_ptr->number;
604 /* Carry the object */
605 slot = inven_carry(o_ptr);
607 /* Get the object again */
608 o_ptr = &inventory[slot];
610 /* Delete the object */
611 delete_object_idx(o_idx);
613 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
615 bool old_known = identify_item(o_ptr);
617 /* Auto-inscription/destroy */
618 autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
620 /* If it is destroyed, don't pick it up */
621 if (o_ptr->marked & OM_AUTODESTROY) return;
624 /* Describe the object */
625 object_desc(o_name, o_ptr, 0);
629 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
631 msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name);
632 msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢");
633 msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name);
639 msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot));
643 if (o_ptr->number > hirottakazu) {
644 msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",
645 kazu_str, o_name, index_to_label(slot));
647 msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot));
651 strcpy(record_o_name, old_name);
653 msg_format("You have %s (%c).", o_name, index_to_label(slot));
654 strcpy(record_o_name, o_name);
659 check_find_art_quest_completion(o_ptr);
664 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¾å¤Ë¾è¤Ã¤¿ºÝ¤Îɽ¼¨½èÍý
665 * @param pickup ¼«Æ°½¦¤¤½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE¤È¤¹¤ë
668 * Player "wants" to pick up an object or gold.
669 * Note that we ONLY handle things that can be picked up.
670 * See "move_player()" for handling of other things.
672 void carry(bool pickup)
674 cave_type *c_ptr = &cave[py][px];
676 s16b this_o_idx, next_o_idx = 0;
678 char o_name[MAX_NLEN];
680 /* Recenter the map around the player */
684 p_ptr->update |= (PU_MONSTERS);
687 p_ptr->redraw |= (PR_MAP);
690 p_ptr->window |= (PW_OVERHEAD);
695 /* Automatically pickup/destroy/inscribe items */
696 autopick_pickup_items(c_ptr);
699 #ifdef ALLOW_EASY_FLOOR
703 py_pickup_floor(pickup);
707 #endif /* ALLOW_EASY_FLOOR */
709 /* Scan the pile of objects */
710 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
715 o_ptr = &o_list[this_o_idx];
717 #ifdef ALLOW_EASY_SENSE /* TNB */
719 /* Option: Make item sensing easy */
722 /* Sense the object */
723 (void)sense_object(o_ptr);
726 #endif /* ALLOW_EASY_SENSE -- TNB */
728 /* Describe the object */
729 object_desc(o_name, o_ptr, 0);
731 /* Acquire next object */
732 next_o_idx = o_ptr->next_o_idx;
734 /* Hack -- disturb */
738 if (o_ptr->tval == TV_GOLD)
740 int value = (long)o_ptr->pval;
742 /* Delete the gold */
743 delete_object_idx(this_o_idx);
747 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
748 (long)value, o_name);
750 msg_format("You collect %ld gold pieces worth of %s.",
751 (long)value, o_name);
757 /* Collect the gold */
761 p_ptr->redraw |= (PR_GOLD);
764 p_ptr->window |= (PW_PLAYER);
767 /* Pick up objects */
770 /* Hack - some objects were handled in autopick_pickup_items(). */
771 if (o_ptr->marked & OM_NOMSG)
773 /* Clear the flag. */
774 o_ptr->marked &= ~OM_NOMSG;
776 /* Describe the object */
780 msg_format("%s¤¬¤¢¤ë¡£", o_name);
782 msg_format("You see %s.", o_name);
787 /* Note that the pack is too full */
788 else if (!inven_carry_okay(o_ptr))
791 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
793 msg_format("You have no room for %s.", o_name);
798 /* Pick up the item (if requested and allowed) */
803 /* Hack -- query every item */
804 if (carry_query_flag)
806 char out_val[MAX_NLEN+20];
808 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
810 sprintf(out_val, "Pick up %s? ", o_name);
813 okay = get_check(out_val);
816 /* Attempt to pick up an object. */
819 /* Pick up the object */
820 py_pickup_aux(this_o_idx);
829 * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×Ì¿ÃæȽÄê /
830 * Determine if a trap affects the player.
831 * @param power ´ðËܲóÈòÆñÅÙ
832 * @return ¥È¥é¥Ã¥×¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
834 * Always miss 5% of the time, Always hit 5% of the time.
835 * Otherwise, match trap power against player armor.
837 static int check_hit(int power)
841 /* Percentile dice */
844 /* Hack -- 5% hit, 5% miss */
845 if (k < 10) return (k < 5);
847 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
848 if (one_in_(20)) return (TRUE);
850 /* Paranoia -- No power */
851 if (power <= 0) return (FALSE);
854 ac = p_ptr->ac + p_ptr->to_a;
856 /* Power competes against Armor */
857 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
865 * @brief Íî¤È¤··ê·Ï¥È¥é¥Ã¥×¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
866 * @param trap_feat_type ¥È¥é¥Ã¥×¤Î¼ïÊÌID
869 static void hit_trap_pit(int trap_feat_type)
873 cptr spike_name = "";
875 switch (trap_feat_type)
878 trap_name = _("Íî¤È¤··ê", "a pit trap");
880 case TRAP_SPIKED_PIT:
881 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
882 spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
884 case TRAP_POISON_PIT:
885 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
886 spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
892 if (p_ptr->levitation)
894 msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
898 msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
903 /* Extra spike damage */
904 if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
907 msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
910 (void)set_cut(p_ptr->cut + randint1(dam));
912 if (trap_feat_type == TRAP_POISON_PIT) {
913 if (p_ptr->resist_pois || IS_OPPOSE_POIS())
915 msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
920 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
925 /* Take the damage */
926 take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
930 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
931 * @return ¥À¡¼¥Ä¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹
933 static bool hit_trap_dart(void)
939 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
941 take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
943 if (!CHECK_MULTISHADOW()) hit = TRUE;
947 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
954 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡ÜǽÎÏÃ͸º¾¯¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
955 * @param stat Äã²¼¤¹¤ëǽÎÏÃÍID
958 static void hit_trap_lose_stat(int stat)
967 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¸ºÂ®¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
970 static void hit_trap_slow(void)
974 set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
979 * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¾õÂÖ°Û¾ï¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
980 * @param trap_message ¥á¥Ã¥»¡¼¥¸¤ÎÊ䴰ʸ»úÎó
981 * @param resist ¾õÂÖ°Û¾ï¤ËÄñ¹³¤¹¤ëȽÄ꤬½Ð¤¿¤Ê¤éTRUE
982 * @param set_status ¾õÂÖ°Û¾ï¤ò»ØÄꤹ¤ë´Ø¿ô¥Ý¥¤¥ó¥¿
983 * @param turn ¾õÂÖ°Û¾ï¤ÎÄɲå¿¡¼¥óÎÌ
986 static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
988 msg_print(trap_message);
997 * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×ºîÆ°½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
998 * Handle player hitting a real trap
999 * @param break_trap ºîÆ°¸å¤Î¥È¥é¥Ã¥×Ç˲õ¤¬³ÎÄꤷ¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE
1002 static void hit_trap(bool break_trap)
1007 /* Get the cave grid */
1008 cave_type *c_ptr = &cave[y][x];
1009 feature_type *f_ptr = &f_info[c_ptr->feat];
1010 int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP;
1013 cptr name = "¥È¥é¥Ã¥×";
1015 cptr name = "a trap";
1018 /* Disturb the player */
1021 cave_alter_feat(y, x, FF_HIT_TRAP);
1023 /* Analyze XXX XXX XXX */
1024 switch (trap_feat_type)
1028 if (p_ptr->levitation)
1031 msg_print("Íî¤È¤·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
1033 msg_print("You fly over a trap door.");
1040 msg_print("Íî¤È¤·¸Í¤ËÍî¤Á¤¿¡ª");
1041 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1042 msg_print("¤¯¤Ã¤½¡Á¡ª");
1044 msg_print("You have fallen through a trap door!");
1048 dam = damroll(2, 8);
1052 name = "a trap door";
1055 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1057 /* Still alive and autosave enabled */
1058 if (autosave_l && (p_ptr->chp >= 0))
1059 do_cmd_save_game(TRUE);
1062 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
1064 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
1066 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
1069 p_ptr->leaving = TRUE;
1075 case TRAP_SPIKED_PIT:
1076 case TRAP_POISON_PIT:
1078 hit_trap_pit(trap_feat_type);
1085 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1087 msg_print("There is a flash of shimmering light!");
1090 num = 2 + randint1(3);
1091 for (i = 0; i < num; i++)
1093 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1096 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1098 bool stop_ty = FALSE;
1103 stop_ty = activate_ty_curse(stop_ty, &count);
1113 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1115 msg_print("You hit a teleport trap!");
1118 teleport_player(100, TELEPORT_PASSIVE);
1125 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1127 msg_print("You are enveloped in flames!");
1130 dam = damroll(4, 6);
1132 (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
1134 (void)fire_dam(dam, "a fire trap", -1, FALSE);
1143 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1145 msg_print("You are splashed with acid!");
1148 dam = damroll(4, 6);
1150 (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
1152 (void)acid_dam(dam, "an acid trap", -1, FALSE);
1166 hit_trap_lose_stat(A_STR);
1172 hit_trap_lose_stat(A_DEX);
1178 hit_trap_lose_stat(A_CON);
1184 hit_trap_set_abnormal_status(
1185 _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
1186 p_ptr->resist_blind,
1187 set_blind, p_ptr->blind + randint0(50) + 25);
1193 hit_trap_set_abnormal_status(
1194 _("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
1196 set_confused, p_ptr->confused + randint0(20) + 10);
1202 hit_trap_set_abnormal_status(
1203 _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
1204 p_ptr->resist_pois || IS_OPPOSE_POIS(),
1205 set_poisoned, p_ptr->poisoned + randint0(20) + 10);
1212 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1214 msg_print("A strange white mist surrounds you!");
1217 if (!p_ptr->free_act)
1220 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1222 msg_print("You fall asleep.");
1226 if (ironman_nightmare)
1229 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1231 msg_print("A horrible vision enters your mind.");
1235 /* Pick a nightmare */
1236 get_mon_num_prep(get_nightmare, NULL);
1238 /* Have some nightmares */
1239 have_nightmare(get_mon_num(MAX_DEPTH));
1241 /* Remove the monster restriction */
1242 get_mon_num_prep(NULL, NULL);
1244 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1252 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1254 msg_print("There is a bright flash of light!");
1257 /* Make some new traps */
1258 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1266 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1268 msg_print("An alarm sounds!");
1271 aggravate_monsters(0);
1279 msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
1281 msg_print("Suddenly, surrounding walls are opened!");
1283 (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1284 (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1285 (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1286 aggravate_monsters(0);
1291 case TRAP_ARMAGEDDON:
1293 static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
1294 int evil_idx = 0, good_idx = 0;
1298 msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤¹þ¤Þ¤ì¤¿¡ª");
1300 msg_print("Suddenly, you are surrounded by immotal beings!");
1303 /* Summon Demons and Angels */
1304 for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
1306 num = levs[MIN(lev/10, 9)];
1307 for (i = 0; i < num; i++)
1309 int x1 = rand_spread(x, 7);
1310 int y1 = rand_spread(y, 5);
1312 /* Skip illegal grids */
1313 if (!in_bounds(y1, x1)) continue;
1315 /* Require line of projection */
1316 if (!projectable(py, px, y1, x1)) continue;
1318 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
1319 evil_idx = hack_m_idx_ii;
1321 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
1323 good_idx = hack_m_idx_ii;
1326 /* Let them fight each other */
1327 if (evil_idx && good_idx)
1329 monster_type *evil_ptr = &m_list[evil_idx];
1330 monster_type *good_ptr = &m_list[good_idx];
1331 evil_ptr->target_y = good_ptr->fy;
1332 evil_ptr->target_x = good_ptr->fx;
1333 good_ptr->target_y = evil_ptr->fy;
1334 good_ptr->target_x = evil_ptr->fx;
1344 msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
1346 msg_print("Suddenly, the room is filled with water with piranhas!");
1349 /* Water fills room */
1350 fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
1352 /* Summon Piranhas */
1353 num = 1 + dun_level/20;
1354 for (i = 0; i < num; i++)
1356 (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
1362 if (break_trap && is_trap(c_ptr->feat))
1364 cave_alter_feat(y, x, FF_DISARM);
1366 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1368 msg_print("You destroyed the trap.");
1375 * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡ÊÊä½õ¡Ë
1376 * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1377 * @param immune ¥À¥á¡¼¥¸¤ò²óÈò¤Ç¤¤ëÌȱ֥ե饰
1378 * @param flags_offset ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
1379 * @param r_flags_offset ¥â¥ó¥¹¥¿¡¼¤ÎÂÑÀÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
1380 * @param aura_flag ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó
1381 * @param dam_func ¥À¥á¡¼¥¸½èÍý¤ò¹Ô¤¦´Ø¿ô¤Î»²¾È¥Ý¥¤¥ó¥¿
1382 * @param message ¥ª¡¼¥é¥À¥á¡¼¥¸¤ò¼õ¤±¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸
1385 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
1386 int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
1388 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1390 if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
1393 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1395 /* Hack -- Get the "died from" name */
1396 monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1400 dam_func(aura_damage, mon_name, -1, TRUE);
1402 if (is_original_ap_and_seen(m_ptr))
1404 atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
1412 * @brief Ũ¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡Ê¥á¥¤¥ó¡Ë
1413 * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1416 static void touch_zap_player(monster_type *m_ptr)
1418 touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1419 fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
1420 touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1421 cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
1422 touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1423 elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
1428 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÊÑ°ÛÍ×ÁǤˤè¤ëÂÇ·â½èÍý
1429 * @param m_idx ¹¶·âÌÜɸ¤È¤Ê¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤Î»²¾ÈID
1430 * @param attack ÊÑ°ÛÍ×ÁǤˤè¤ë¹¶·âÍ×ÁǤμïÎà
1431 * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1432 * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1435 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1437 int k, bonus, chance;
1439 monster_type *m_ptr = &m_list[m_idx];
1440 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1449 case MUT2_SCOR_TAIL:
1476 atk_desc = "¥¯¥Á¥Ð¥·";
1487 atk_desc = "¾Ý¤ÎÉ¡";
1493 case MUT2_TENTACLES:
1500 atk_desc = "tentacles";
1505 dss = ddd = n_weight = 1;
1507 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1509 atk_desc = "undefined body part";
1514 /* Extract monster name (or "it") */
1515 monster_desc(m_name, m_ptr, 0);
1518 /* Calculate the "attack quality" */
1519 bonus = p_ptr->to_h_m;
1520 bonus += (p_ptr->lev * 6 / 5);
1521 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1524 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1530 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1532 msg_format("You hit %s with your %s.", m_name, atk_desc);
1536 k = damroll(ddd, dss);
1537 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1539 /* Apply the player damage bonuses */
1542 /* No negative damage */
1545 /* Modify the damage */
1546 k = mon_damage_mod(m_ptr, k, FALSE);
1548 /* Complex message */
1552 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1554 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1559 /* Anger the monster */
1560 if (k > 0) anger_monster(m_ptr);
1562 /* Damage, check for fear and mdeath */
1565 case MUT2_SCOR_TAIL:
1566 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1567 *mdeath = (m_ptr->r_idx == 0);
1570 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1573 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1576 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1578 case MUT2_TENTACLES:
1579 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1582 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1585 touch_zap_player(m_ptr);
1595 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1597 msg_format("You miss %s.", m_name);
1605 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥µ¥Ö¥ë¡¼¥Á¥ó /
1606 * Player attacks a (poor, defenseless) creature -RAK-
1607 * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
1608 * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
1609 * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1610 * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
1611 * @param hand ¹¶·â¤ò¹Ô¤¦¤¿¤á¤ÎÉð´ï¤ò»ý¤Ä¼ê
1612 * @param mode ȯưÃæ¤Î·õ½ÑID
1615 * If no "weapon" is available, then "punch" the monster one time.
1617 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1619 int num = 0, k, bonus, chance, vir;
1621 cave_type *c_ptr = &cave[y][x];
1623 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1624 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1626 /* Access the weapon */
1627 object_type *o_ptr = &inventory[INVEN_RARM + hand];
1631 bool success_hit = FALSE;
1632 bool backstab = FALSE;
1633 bool vorpal_cut = FALSE;
1634 int chaos_effect = 0;
1635 bool stab_fleeing = FALSE;
1636 bool fuiuchi = FALSE;
1637 bool monk_attack = FALSE;
1638 bool do_quake = FALSE;
1640 bool drain_msg = TRUE;
1641 int drain_result = 0, drain_heal = 0;
1642 bool can_drain = FALSE;
1644 int drain_left = MAX_VAMPIRIC_DRAIN;
1645 u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1646 bool is_human = (r_ptr->d_char == 'p');
1647 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1648 bool zantetsu_mukou, e_j_mukou;
1650 switch (p_ptr->pclass)
1654 if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
1656 int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
1657 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1658 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1659 if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
1660 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1662 /* Can't backstab creatures that we can't see, right? */
1665 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1669 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1671 stab_fleeing = TRUE;
1677 case CLASS_FORCETRAINER:
1678 case CLASS_BERSERKER:
1679 if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
1683 if (!o_ptr->k_idx) /* Empty hand */
1685 if ((r_ptr->level + 10) > p_ptr->lev)
1687 if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1689 if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1690 p_ptr->skill_exp[GINOU_SUDE] += 40;
1691 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1692 p_ptr->skill_exp[GINOU_SUDE] += 5;
1693 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
1694 p_ptr->skill_exp[GINOU_SUDE] += 1;
1695 else if ((p_ptr->lev > 34))
1696 if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
1697 p_ptr->update |= (PU_BONUS);
1701 else if (object_is_melee_weapon(o_ptr))
1703 if ((r_ptr->level + 10) > p_ptr->lev)
1705 int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
1706 int sval = inventory[INVEN_RARM+hand].sval;
1707 int now_exp = p_ptr->weapon_exp[tval][sval];
1708 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
1711 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1712 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1713 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
1714 else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
1715 p_ptr->weapon_exp[tval][sval] += amount;
1716 p_ptr->update |= (PU_BONUS);
1721 /* Disturb the monster */
1722 (void)set_monster_csleep(c_ptr->m_idx, 0);
1724 /* Extract monster name (or "it") */
1725 monster_desc(m_name, m_ptr, 0);
1727 /* Calculate the "attack quality" */
1728 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
1729 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1730 if (mode == HISSATSU_IAI) chance += 60;
1731 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1733 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1735 vir = virtue_number(V_VALOUR);
1738 chance += (p_ptr->virtues[vir - 1]/10);
1741 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1742 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1744 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1745 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
1746 else num_blow = p_ptr->num_blow[hand];
1748 /* Hack -- DOKUBARI always hit once */
1749 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
1751 /* Attack once for each legal blow */
1752 while ((num++ < num_blow) && !p_ptr->is_dead)
1754 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1758 if (p_ptr->migite && p_ptr->hidarite)
1762 if (mode == HISSATSU_3DAN)
1767 success_hit = one_in_(n);
1769 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1770 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
1772 if (mode == HISSATSU_MAJIN)
1775 success_hit = FALSE;
1781 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1788 if (backstab) msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª", m_name);
1789 else if (fuiuchi) msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª", m_name);
1790 else if (stab_fleeing) msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª", m_name);
1791 else if (!monk_attack) msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
1793 if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name);
1794 else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name);
1795 else if (stab_fleeing) msg_format("You backstab the fleeing %s!", m_name);
1796 else if (!monk_attack) msg_format("You hit %s.", m_name);
1799 /* Hack -- bare hands do one damage */
1802 object_flags(o_ptr, flgs);
1804 /* Select a chaotic effect (50% chance) */
1805 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1808 chg_virtue(V_CHANCE, 1);
1810 if (randint1(5) < 3)
1812 /* Vampiric (20%) */
1815 else if (one_in_(250))
1820 else if (!one_in_(10))
1822 /* Confusion (26.892%) */
1825 else if (one_in_(2))
1827 /* Teleport away (1.494%) */
1832 /* Polymorph (1.494%) */
1837 /* Vampiric drain */
1838 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1840 /* Only drain "living" monsters */
1841 if (monster_living(r_ptr))
1847 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
1849 else vorpal_cut = FALSE;
1853 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1855 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1856 int resist_stun = 0;
1859 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1860 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1861 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1862 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1863 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1866 if (p_ptr->special_defense & KAMAE_BYAKKO)
1867 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
1868 else if (p_ptr->special_defense & KAMAE_SUZAKU)
1870 else if (p_ptr->special_defense & KAMAE_GENBU)
1873 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
1874 /* Attempt 'times' */
1875 for (times = 0; times < max_times; times++)
1879 ma_ptr = &ma_blows[randint0(MAX_MA)];
1880 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1881 else min_level = ma_ptr->min_level;
1883 while ((min_level > p_ptr->lev) ||
1884 (randint1(p_ptr->lev) < ma_ptr->chance));
1886 /* keep the highest level attack available we found */
1887 if ((ma_ptr->min_level > old_ptr->min_level) &&
1888 !p_ptr->stun && !p_ptr->confused)
1892 if (p_ptr->wizard && cheat_xtra)
1895 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
1897 msg_print("Attack re-selected.");
1907 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1908 else min_level = ma_ptr->min_level;
1909 k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
1910 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1912 if (ma_ptr->effect == MA_KNEE)
1914 if (r_ptr->flags1 & RF1_MALE)
1917 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
1919 msg_format("You hit %s in the groin with your knee!", m_name);
1923 special_effect = MA_KNEE;
1926 msg_format(ma_ptr->desc, m_name);
1929 else if (ma_ptr->effect == MA_SLOW)
1931 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1932 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1935 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
1937 msg_format("You kick %s in the ankle.", m_name);
1940 special_effect = MA_SLOW;
1942 else msg_format(ma_ptr->desc, m_name);
1948 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1951 msg_format(ma_ptr->desc, m_name);
1954 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1955 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
1957 weight += (p_ptr->magic_num1[0]/30);
1958 if (weight > 20) weight = 20;
1961 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
1963 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1966 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
1968 msg_format("%^s moans in agony!", m_name);
1971 stun_effect = 7 + randint1(13);
1975 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1977 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1978 (randint1(p_ptr->lev) > r_ptr->level) &&
1982 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
1984 msg_format("%^s starts limping slower.", m_name);
1987 m_ptr->mspeed -= 10;
1991 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1993 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1995 if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1998 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2000 msg_format("%^s is stunned.", m_name);
2006 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2008 msg_format("%^s is more stunned.", m_name);
2015 /* Handle normal weapon */
2016 else if (o_ptr->k_idx)
2018 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2019 k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
2023 k *= (3 + (p_ptr->lev / 20));
2027 k = k*(5+(p_ptr->lev*2/25))/2;
2029 else if (stab_fleeing)
2034 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
2035 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
2040 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
2041 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2049 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
2051 char chainsword_noise[1024];
2053 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
2055 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
2058 msg_print(chainsword_noise);
2062 if (o_ptr->name1 == ART_VORPAL_BLADE)
2065 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
2067 msg_print("Your Vorpal Blade goes snicker-snack!");
2073 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
2075 msg_format("Your weapon cuts deep into %s!", m_name);
2079 /* Try to increase the damage */
2080 while (one_in_(vorpal_chance))
2088 if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
2091 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
2093 msg_format("You cut %s in half!", m_name);
2101 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
2102 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
2103 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
2104 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
2105 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
2106 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
2107 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
2109 case 2: msg_format("You gouge %s!", m_name); break;
2110 case 3: msg_format("You maim %s!", m_name); break;
2111 case 4: msg_format("You carve %s!", m_name); break;
2112 case 5: msg_format("You cleave %s!", m_name); break;
2113 case 6: msg_format("You smite %s!", m_name); break;
2114 case 7: msg_format("You eviscerate %s!", m_name); break;
2115 default: msg_format("You shred %s!", m_name); break;
2119 drain_result = drain_result * 3 / 2;
2123 drain_result += o_ptr->to_d;
2126 /* Apply the player damage bonuses */
2127 k += p_ptr->to_d[hand];
2128 drain_result += p_ptr->to_d[hand];
2130 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2131 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
2132 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2134 /* No negative damage */
2137 if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
2145 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2147 msg_print("You cannot cut such a elastic thing!");
2155 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2157 msg_print("Spiders are difficult for you to deal with!");
2162 if (mode == HISSATSU_MINEUCHI)
2164 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2167 anger_monster(m_ptr);
2169 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2172 if (MON_STUNNED(m_ptr))
2175 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2177 msg_format("%s is more dazed.", m_name);
2185 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2187 msg_format("%s is dazed.", m_name);
2192 (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
2197 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2199 msg_format("%s is not effected.", m_name);
2204 /* Modify the damage */
2205 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))));
2206 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2208 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2212 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2214 msg_format("You hit %s on a fatal spot!", m_name);
2219 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)))
2221 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2222 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2227 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2229 msg_format("You critically injured %s!", m_name);
2232 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)))
2234 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2236 k = MAX(k*5, m_ptr->hp/2);
2239 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2241 msg_format("You fatally injured %s!", m_name);
2248 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2250 msg_format("You hit %s on a fatal spot!", m_name);
2256 /* Complex message */
2257 if (p_ptr->wizard || cheat_xtra)
2260 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2262 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2266 if (k <= 0) can_drain = FALSE;
2268 if (drain_result > m_ptr->hp)
2269 drain_result = m_ptr->hp;
2271 /* Damage, check for fear and death */
2272 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2275 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2277 if (p_ptr->migite && p_ptr->hidarite)
2279 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2280 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2284 energy_use = energy_use*num/p_ptr->num_blow[hand];
2287 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2289 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2291 msg_print("Sigh... Another trifling thing I've cut....");
2296 /* Anger the monster */
2297 if (k > 0) anger_monster(m_ptr);
2299 touch_zap_player(m_ptr);
2301 /* Are we draining it? A little note: If the monster is
2302 dead, the drain does not work... */
2304 if (can_drain && (drain_result > 0))
2306 if (o_ptr->name1 == ART_MURAMASA)
2310 int to_h = o_ptr->to_h;
2311 int to_d = o_ptr->to_d;
2315 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2319 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2322 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2325 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2327 msg_print("Muramasa sucked blood, and became more powerful!");
2336 if (drain_result > 5) /* Did we really hurt it? */
2338 drain_heal = damroll(2, drain_result / 6);
2341 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
2346 msg_format("Draining left: %d", drain_left);
2348 msg_format("Draining left: %d", drain_left);
2355 if (drain_heal < drain_left)
2357 drain_left -= drain_heal;
2361 drain_heal = drain_left;
2368 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2370 msg_format("Your weapon drains life from %s!", m_name);
2376 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2378 hp_player(drain_heal);
2379 /* We get to keep some of it! */
2383 m_ptr->maxhp -= (k+7)/8;
2384 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2385 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2391 /* Confusion attack */
2392 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
2394 /* Cancel glowing hands */
2395 if (p_ptr->special_attack & ATTACK_CONFUSE)
2397 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2399 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2401 msg_print("Your hands stop glowing.");
2403 p_ptr->redraw |= (PR_STATUS);
2407 /* Confuse the monster */
2408 if (r_ptr->flags3 & RF3_NO_CONF)
2410 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2413 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2415 msg_format("%^s is unaffected.", m_name);
2419 else if (randint0(100) < r_ptr->level)
2422 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2424 msg_format("%^s is unaffected.", m_name);
2431 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2433 msg_format("%^s appears confused.", m_name);
2436 (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
2440 else if (chaos_effect == 4)
2442 bool resists_tele = FALSE;
2444 if (r_ptr->flagsr & RFR_RES_TELE)
2446 if (r_ptr->flags1 & RF1_UNIQUE)
2448 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2450 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2452 msg_format("%^s is unaffected!", m_name);
2455 resists_tele = TRUE;
2457 else if (r_ptr->level > randint1(100))
2459 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2461 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2463 msg_format("%^s resists!", m_name);
2466 resists_tele = TRUE;
2473 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2475 msg_format("%^s disappears!", m_name);
2478 teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE);
2479 num = num_blow + 1; /* Can't hit it anymore! */
2484 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2486 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2487 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2489 if (polymorph_monster(y, x))
2492 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2494 msg_format("%^s changes!", m_name);
2503 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2505 msg_format("%^s is unaffected.", m_name);
2509 /* Hack -- Get new monster */
2510 m_ptr = &m_list[c_ptr->m_idx];
2512 /* Oops, we need a different name... */
2513 monster_desc(m_name, m_ptr, 0);
2515 /* Hack -- Get new race */
2516 r_ptr = &r_info[m_ptr->r_idx];
2519 else if (o_ptr->name1 == ART_G_HAMMER)
2521 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2523 if (m_ptr->hold_o_idx)
2525 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2526 char o_name[MAX_NLEN];
2528 object_desc(o_name, q_ptr, OD_NAME_ONLY);
2529 q_ptr->held_m_idx = 0;
2530 q_ptr->marked = OM_TOUCHED;
2531 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2532 q_ptr->next_o_idx = 0;
2534 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2536 msg_format("You snatched %s.", o_name);
2546 backstab = FALSE; /* Clumsy! */
2547 fuiuchi = FALSE; /* Clumsy! */
2549 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2551 u32b flgs[TR_FLAG_SIZE];
2558 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2560 msg_format("You miss %s.", m_name);
2564 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2566 msg_print("Your scythe returns to you!");
2569 /* Extract the flags */
2570 object_flags(o_ptr, flgs);
2572 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2575 switch (p_ptr->mimic_form)
2578 switch (p_ptr->prace)
2585 case RACE_BARBARIAN:
2589 case RACE_HALF_TROLL:
2590 case RACE_HALF_OGRE:
2591 case RACE_HALF_GIANT:
2592 case RACE_HALF_TITAN:
2600 case RACE_DRACONIAN:
2607 case MIMIC_DEMON_LORD:
2614 if (p_ptr->align < 0 && mult < 20)
2616 if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
2618 if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
2620 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
2622 if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
2624 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
2627 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
2629 p_ptr->csp -= (1+(p_ptr->msp / 30));
2630 p_ptr->redraw |= (PR_MANA);
2631 mult = mult * 3 / 2 + 20;
2637 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2642 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
2644 msg_format("Your weapon cuts deep into yourself!");
2646 /* Try to increase the damage */
2654 k += (p_ptr->to_d[hand] + o_ptr->to_d);
2659 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
2661 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
2673 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2675 msg_format("You miss %s.", m_name);
2684 if (weak && !(*mdeath))
2687 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
2689 msg_format("%^s seems weakened.", m_name);
2692 if (drain_left != MAX_VAMPIRIC_DRAIN)
2696 chg_virtue(V_UNLIFE, 1);
2699 /* Mega-Hack -- apply earthquake brand */
2702 earthquake(py, px, 10);
2703 if (!cave[y][x].m_idx) *mdeath = TRUE;
2708 * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó
2709 * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
2710 * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
2711 * @param mode ȯưÃæ¤Î·õ½ÑID
2712 * @return ¼ÂºÝ¤Ë¹¶·â½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2714 * If no "weapon" is available, then "punch" the monster one time.
2716 bool py_attack(int y, int x, int mode)
2719 bool mdeath = FALSE;
2720 bool stormbringer = FALSE;
2722 cave_type *c_ptr = &cave[y][x];
2723 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2724 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2727 /* Disturb the player */
2732 if (!p_ptr->migite && !p_ptr->hidarite &&
2733 !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2736 msg_format("%s¹¶·â¤Ç¤¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ" : "");
2738 msg_print("You cannot do attacking.");
2743 /* Extract monster name (or "it") */
2744 monster_desc(m_name, m_ptr, 0);
2748 /* Auto-Recall if possible and visible */
2749 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2751 /* Track a new monster */
2752 health_track(c_ptr->m_idx);
2755 if ((r_ptr->flags1 & RF1_FEMALE) &&
2756 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
2758 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
2761 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
2763 msg_print("I can not attack women!");
2769 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
2772 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
2774 msg_print("Something prevent you from attacking.");
2779 /* Stop if friendly */
2780 if (!is_hostile(m_ptr) &&
2781 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
2782 p_ptr->shero || !m_ptr->ml))
2784 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2785 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2789 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
2791 msg_format("Your black blade greedily attacks %s!", m_name);
2793 chg_virtue(V_INDIVIDUALISM, 1);
2794 chg_virtue(V_HONOUR, -1);
2795 chg_virtue(V_JUSTICE, -1);
2796 chg_virtue(V_COMPASSION, -1);
2798 else if (p_ptr->pclass != CLASS_BERSERKER)
2801 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
2803 if (get_check("Really hit it? "))
2806 chg_virtue(V_INDIVIDUALISM, 1);
2807 chg_virtue(V_HONOUR, -1);
2808 chg_virtue(V_JUSTICE, -1);
2809 chg_virtue(V_COMPASSION, -1);
2814 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
2816 msg_format("You stop to avoid hitting %s.", m_name);
2824 /* Handle player fear */
2830 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
2832 msg_format("You are too afraid to attack %s!", m_name);
2837 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
2839 msg_format ("There is something scary in your way!");
2842 /* Disturb the monster */
2843 (void)set_monster_csleep(c_ptr->m_idx, 0);
2849 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2851 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
2852 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
2855 if (p_ptr->migite && p_ptr->hidarite)
2857 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))
2859 if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2860 p_ptr->skill_exp[GINOU_NITOURYU] += 80;
2861 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2862 p_ptr->skill_exp[GINOU_NITOURYU] += 4;
2863 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2864 p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2865 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2866 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2867 p_ptr->update |= (PU_BONUS);
2871 /* Gain riding experience */
2874 int cur = p_ptr->skill_exp[GINOU_RIDING];
2875 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
2879 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
2880 int targetlevel = r_ptr->level;
2883 if ((cur / 200 - 5) < targetlevel)
2886 /* Extra experience */
2887 if ((cur / 100) < ridinglevel)
2889 if ((cur / 100 + 15) < ridinglevel)
2890 inc += 1 + (ridinglevel - (cur / 100 + 15));
2895 p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2897 p_ptr->update |= (PU_BONUS);
2901 riding_t_m_idx = c_ptr->m_idx;
2902 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
2903 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
2905 /* Mutations which yield extra 'natural' attacks */
2908 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
2909 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
2910 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
2911 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
2912 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
2913 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
2914 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
2915 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
2916 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
2917 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
2920 /* Hack -- delay fear messages */
2921 if (fear && m_ptr->ml && !mdeath)
2928 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
2930 msg_format("%^s flees in terror!", m_name);
2935 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
2937 set_action(ACTION_NONE);
2945 * @brief ¥Ñ¥¿¡¼¥ó¤Ë¤è¤ë°ÜÆ°À©¸Â½èÍý
2946 * @param c_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µYºÂɸ
2947 * @param c_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µXºÂɸ
2948 * @param n_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèYºÂɸ
2949 * @param n_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèXºÂɸ
2950 * @return °ÜÆ°½èÍý¤¬²Äǽ¤Ç¤¢¤ë¾ì¹ç¡Ê²Äǽ¤Ê¾ì¹ç¤ËÁªÂò¤·¤¿¾ì¹ç¡ËTRUE¤òÊÖ¤¹¡£
2952 bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
2954 feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
2955 feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
2956 bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
2957 bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
2958 int pattern_type_cur, pattern_type_new;
2960 if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
2962 pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE;
2963 pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE;
2965 if (pattern_type_new == PATTERN_TILE_START)
2967 if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
2970 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
2972 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
2981 else if ((pattern_type_new == PATTERN_TILE_OLD) ||
2982 (pattern_type_new == PATTERN_TILE_END) ||
2983 (pattern_type_new == PATTERN_TILE_WRECKED))
2985 if (is_pattern_tile_cur)
2992 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
2994 msg_print("You must start walking the Pattern from the startpoint.");
3000 else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
3001 (pattern_type_cur == PATTERN_TILE_TELEPORT))
3005 else if (pattern_type_cur == PATTERN_TILE_START)
3007 if (is_pattern_tile_new)
3012 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3014 msg_print("You must walk the Pattern in correct order.");
3020 else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
3021 (pattern_type_cur == PATTERN_TILE_END) ||
3022 (pattern_type_cur == PATTERN_TILE_WRECKED))
3024 if (!is_pattern_tile_new)
3027 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3029 msg_print("You may not step off from the Pattern.");
3041 if (!is_pattern_tile_cur)
3044 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3046 msg_print("You must start walking the Pattern from the startpoint.");
3053 byte ok_move = PATTERN_TILE_START;
3054 switch (pattern_type_cur)
3056 case PATTERN_TILE_1:
3057 ok_move = PATTERN_TILE_2;
3059 case PATTERN_TILE_2:
3060 ok_move = PATTERN_TILE_3;
3062 case PATTERN_TILE_3:
3063 ok_move = PATTERN_TILE_4;
3065 case PATTERN_TILE_4:
3066 ok_move = PATTERN_TILE_1;
3071 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
3073 msg_format("Funny Pattern walking, %d.", pattern_type_cur);
3076 return TRUE; /* Goof-up */
3079 if ((pattern_type_new == ok_move) ||
3080 (pattern_type_new == pattern_type_cur))
3084 if (!is_pattern_tile_new)
3086 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3088 msg_print("You may not step off from the Pattern.");
3092 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3094 msg_print("You must walk the Pattern in correct order.");
3105 * @brief ¥×¥ì¥¤¥ä¡¼¤¬ÃÏ·ÁƧÇ˲Äǽ¤«¤òÊÖ¤¹
3106 * @param feature ȽÄꤷ¤¿¤¤ÃÏ·ÁID
3107 * @param mode °ÜÆ°¤Ë´Ø¤¹¤ë¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
3108 * @return °ÜÆ°²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3110 bool player_can_enter(s16b feature, u16b mode)
3112 feature_type *f_ptr = &f_info[feature];
3114 if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
3117 if (have_flag(f_ptr->flags, FF_PATTERN))
3119 if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
3123 if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
3124 if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
3125 if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
3127 if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
3134 * @brief °ÜÆ°¤Ëȼ¤¦¥×¥ì¥¤¥ä¡¼¤Î¥¹¥Æ¡¼¥¿¥¹ÊѲ½½èÍý
3135 * @param ny °ÜÆ°ÀèYºÂɸ
3136 * @param nx °ÜÆ°ÀèXºÂɸ
3137 * @param mpe_mode °ÜÆ°¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
3138 * @return ¥×¥ì¥¤¥ä¡¼¤¬»àË´¤ä¥Õ¥í¥¢Î¥Ã¦¤ò¹Ô¤ï¤º¡¢¼ÂºÝ¤Ë°ÜÆ°¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
3140 bool move_player_effect(int ny, int nx, u32b mpe_mode)
3142 cave_type *c_ptr = &cave[ny][nx];
3143 feature_type *f_ptr = &f_info[c_ptr->feat];
3145 if (!(mpe_mode & MPE_STAYING))
3149 cave_type *oc_ptr = &cave[oy][ox];
3150 int om_idx = oc_ptr->m_idx;
3151 int nm_idx = c_ptr->m_idx;
3153 /* Move the player */
3157 /* Hack -- For moving monster or riding player's moving */
3158 if (!(mpe_mode & MPE_DONT_SWAP_MON))
3160 /* Swap two monsters */
3161 c_ptr->m_idx = om_idx;
3162 oc_ptr->m_idx = nm_idx;
3164 if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
3166 monster_type *om_ptr = &m_list[om_idx];
3169 update_mon(om_idx, TRUE);
3172 if (nm_idx > 0) /* Monster on new spot */
3174 monster_type *nm_ptr = &m_list[nm_idx];
3177 update_mon(nm_idx, TRUE);
3181 /* Redraw old spot */
3184 /* Redraw new spot */
3187 /* Check for new panel (redraw map) */
3190 if (mpe_mode & MPE_FORGET_FLOW)
3194 /* Mega-Hack -- Forget the view */
3195 p_ptr->update |= (PU_UN_VIEW);
3198 p_ptr->redraw |= (PR_MAP);
3202 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
3205 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3207 /* Remove "unsafe" flag */
3208 if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
3210 /* For get everything when requested hehe I'm *NASTY* */
3211 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
3214 if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
3216 if (p_ptr->pclass == CLASS_NINJA)
3218 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
3219 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
3222 if ((p_ptr->action == ACTION_HAYAGAKE) &&
3223 (!have_flag(f_ptr->flags, FF_PROJECT) ||
3224 (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
3227 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
3229 msg_print("You cannot run in here.");
3231 set_action(ACTION_NONE);
3235 if (mpe_mode & MPE_ENERGY_USE)
3237 if (music_singing(MUSIC_WALL))
3239 (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE,
3240 PROJECT_KILL | PROJECT_ITEM, -1);
3242 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3245 /* Spontaneous Searching */
3246 if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
3251 /* Continuous Searching */
3252 if (p_ptr->action == ACTION_SEARCH)
3258 /* Handle "objects" */
3259 if (!(mpe_mode & MPE_DONT_PICKUP))
3261 carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
3264 /* Handle "store doors" */
3265 if (have_flag(f_ptr->flags, FF_STORE))
3271 /* Hack -- Enter store */
3272 command_new = SPECIAL_KEY_STORE;
3275 /* Handle "building doors" -KMW- */
3276 else if (have_flag(f_ptr->flags, FF_BLDG))
3282 /* Hack -- Enter building */
3283 command_new = SPECIAL_KEY_BUILDING;
3286 /* Handle quest areas -KMW- */
3287 else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3293 /* Hack -- Enter quest level */
3294 command_new = SPECIAL_KEY_QUEST;
3297 else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
3299 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
3301 complete_quest(p_ptr->inside_quest);
3304 leave_quest_check();
3306 p_ptr->inside_quest = c_ptr->special;
3311 p_ptr->leaving = TRUE;
3314 /* Set off a trap */
3315 else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
3321 if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
3325 msg_print("¥È¥é¥Ã¥×¤À¡ª");
3327 msg_print("You found a trap!");
3331 disclose_grid(py, px);
3335 hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
3337 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3340 /* Warn when leaving trap detected region */
3341 if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
3342 && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
3344 /* No duplicate warning */
3345 p_ptr->dtrap = FALSE;
3347 /* You are just on the edge */
3348 if (!(c_ptr->info & CAVE_UNSAFE))
3350 if (alert_trap_detect)
3353 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
3355 msg_print("*Leaving trap detect region!*");
3359 if (disturb_trap_detect) disturb(0, 1);
3363 return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
3367 * @brief ³ºÅöÃÏ·Á¤Î¥È¥é¥Ã¥×¤¬¥×¥ì¥¤¥ä¡¼¤Ë¤È¤Ã¤Æ̵¸ú¤«¤É¤¦¤«¤òȽÄꤷ¤ÆÊÖ¤¹
3368 * @param feat ÃÏ·ÁID
3369 * @return ¥È¥é¥Ã¥×¤¬¼«Æ°Åª¤Ë̵¸ú¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
3371 bool trap_can_be_ignored(int feat)
3373 feature_type *f_ptr = &f_info[feat];
3375 if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE;
3377 switch (f_ptr->subtype)
3381 case TRAP_SPIKED_PIT:
3382 case TRAP_POISON_PIT:
3383 if (p_ptr->levitation) return TRUE;
3386 if (p_ptr->anti_tele) return TRUE;
3389 if (p_ptr->immune_fire) return TRUE;
3392 if (p_ptr->immune_acid) return TRUE;
3395 if (p_ptr->resist_blind) return TRUE;
3398 if (p_ptr->resist_conf) return TRUE;
3401 if (p_ptr->resist_pois) return TRUE;
3404 if (p_ptr->free_act) return TRUE;
3413 * Determine if a "boundary" grid is "floor mimic"
3415 #define boundary_floor(C, F, MF) \
3416 ((C)->mimic && permanent_wall(F) && \
3417 (have_flag((MF)->flags, FF_MOVE) || have_flag((MF)->flags, FF_CAN_FLY)) && \
3418 have_flag((MF)->flags, FF_PROJECT) && \
3419 !have_flag((MF)->flags, FF_OPEN))
3422 * Move player in the given direction, with the given "pickup" flag.
3424 * This routine should (probably) always induce energy expenditure.
3426 * Note that moving will *always* take a turn, and will *always* hit
3427 * any monster which might be in the destination grid. Previously,
3428 * moving into walls was "free" and did NOT hit invisible monsters.
3430 void move_player(int dir, bool do_pickup, bool break_trap)
3432 /* Find the result of moving */
3433 int y = py + ddy[dir];
3434 int x = px + ddx[dir];
3436 /* Examine the destination */
3437 cave_type *c_ptr = &cave[y][x];
3439 feature_type *f_ptr = &f_info[c_ptr->feat];
3441 monster_type *m_ptr;
3443 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
3444 monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
3448 bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
3449 bool p_can_kill_walls = FALSE;
3450 bool stormbringer = FALSE;
3452 bool oktomove = TRUE;
3453 bool do_past = FALSE;
3456 if (!dun_level && !p_ptr->wild_mode &&
3457 ((x == 0) || (x == MAX_WID - 1) ||
3458 (y == 0) || (y == MAX_HGT - 1)))
3460 /* Can the player enter the grid? */
3461 if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
3463 /* Hack: move to new area */
3464 if ((y == 0) && (x == 0))
3466 p_ptr->wilderness_y--;
3467 p_ptr->wilderness_x--;
3468 p_ptr->oldpy = cur_hgt - 2;
3469 p_ptr->oldpx = cur_wid - 2;
3470 ambush_flag = FALSE;
3473 else if ((y == 0) && (x == MAX_WID - 1))
3475 p_ptr->wilderness_y--;
3476 p_ptr->wilderness_x++;
3477 p_ptr->oldpy = cur_hgt - 2;
3479 ambush_flag = FALSE;
3482 else if ((y == MAX_HGT - 1) && (x == 0))
3484 p_ptr->wilderness_y++;
3485 p_ptr->wilderness_x--;
3487 p_ptr->oldpx = cur_wid - 2;
3488 ambush_flag = FALSE;
3491 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3493 p_ptr->wilderness_y++;
3494 p_ptr->wilderness_x++;
3497 ambush_flag = FALSE;
3502 p_ptr->wilderness_y--;
3503 p_ptr->oldpy = cur_hgt - 2;
3505 ambush_flag = FALSE;
3508 else if (y == MAX_HGT - 1)
3510 p_ptr->wilderness_y++;
3513 ambush_flag = FALSE;
3518 p_ptr->wilderness_x--;
3519 p_ptr->oldpx = cur_wid - 2;
3521 ambush_flag = FALSE;
3524 else if (x == MAX_WID - 1)
3526 p_ptr->wilderness_x++;
3529 ambush_flag = FALSE;
3532 p_ptr->leaving = TRUE;
3538 /* "Blocked" message appears later */
3539 /* oktomove = FALSE; */
3540 p_can_enter = FALSE;
3543 /* Get the monster */
3544 m_ptr = &m_list[c_ptr->m_idx];
3547 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3548 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3550 /* Player can not walk through "walls"... */
3551 /* unless in Shadow Form */
3552 p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
3553 (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
3554 !have_flag(f_ptr->flags, FF_PERMANENT);
3556 /* Hack -- attack monsters */
3557 if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
3559 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3561 /* Attack -- only if we can see it OR it is not in a wall */
3562 if (!is_hostile(m_ptr) &&
3563 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3564 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3565 pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls))
3567 /* Disturb the monster */
3568 (void)set_monster_csleep(c_ptr->m_idx, 0);
3570 /* Extract monster name (or "it") */
3571 monster_desc(m_name, m_ptr, 0);
3575 /* Auto-Recall if possible and visible */
3576 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
3578 /* Track a new monster */
3579 health_track(c_ptr->m_idx);
3583 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3588 else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0))
3595 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3597 msg_format("%^s is in your way!", m_name);
3604 /* now continue on to 'movement' */
3613 if (oktomove && p_ptr->riding)
3615 if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
3618 msg_print("Æ°¤±¤Ê¤¤¡ª");
3620 msg_print("Can't move!");
3626 else if (MON_MONFEAR(riding_m_ptr))
3630 /* Acquire the monster name */
3631 monster_desc(m_name, riding_m_ptr, 0);
3633 /* Dump a message */
3635 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3637 msg_format("%^s is too scared to control.", m_name);
3642 else if (p_ptr->riding_ryoute)
3647 else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
3651 else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
3655 else if (have_flag(f_ptr->flags, FF_WATER) &&
3656 !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
3657 (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
3660 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3662 msg_print("Can't swim.");
3668 else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
3671 msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name);
3673 msg_print("Can't land.");
3679 else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3682 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3684 msg_print("Too hot to go through.");
3691 if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
3694 monster_desc(m_name, riding_m_ptr, 0);
3696 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3698 msg_format("You cannot control stunned %s!",m_name);
3709 else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
3712 msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3714 msg_format("You need to fly to go through the %s.", f_name + f_info[get_feat_mimic(c_ptr)].name);
3723 * Player can move through trees and
3724 * has effective -10 speed
3725 * Rangers can move without penality
3727 else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
3729 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) energy_use *= 2;
3732 #ifdef ALLOW_EASY_DISARM /* TNB */
3734 /* Disarm a visible trap */
3735 else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
3737 if (!trap_can_be_ignored(c_ptr->feat))
3739 (void)do_cmd_disarm_aux(y, x, dir);
3744 #endif /* ALLOW_EASY_DISARM -- TNB */
3746 /* Player can not walk through "walls" unless in wraith form...*/
3747 else if (!p_can_enter && !p_can_kill_walls)
3749 /* Feature code (applying "mimic" field) */
3750 s16b feat = get_feat_mimic(c_ptr);
3751 feature_type *mimic_f_ptr = &f_info[feat];
3752 cptr name = f_name + mimic_f_ptr->name;
3756 /* Notice things in the dark */
3757 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3759 /* Boundary floor mimic */
3760 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3763 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
3765 msg_print("You feel you cannot go any more.");
3769 /* Wall (or secret door) */
3773 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
3775 msg_format("You feel %s %s blocking your way.",
3776 is_a_vowel(name[0]) ? "an" : "a", name);
3779 c_ptr->info |= (CAVE_MARK);
3787 /* Boundary floor mimic */
3788 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3791 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
3793 msg_print("You cannot go any more.");
3796 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3800 /* Wall (or secret door) */
3803 #ifdef ALLOW_EASY_OPEN
3805 if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
3806 #endif /* ALLOW_EASY_OPEN */
3809 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
3811 msg_format("There is %s %s blocking your way.",
3812 is_a_vowel(name[0]) ? "an" : "a", name);
3816 * Well, it makes sense that you lose time bumping into
3817 * a wall _if_ you are confused, stunned or blind; but
3818 * typing mistakes should not cost you a turn...
3820 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3825 /* Disturb the player */
3829 if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
3832 /* Normal movement */
3833 if (oktomove && !pattern_seq(py, px, y, x))
3835 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3840 /* To avoid a loop with running */
3846 /* Normal movement */
3849 u32b mpe_mode = MPE_ENERGY_USE;
3853 if (!process_warning(x, y))
3863 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
3865 msg_format("You push past %s.", m_name);
3869 /* Change oldpx and oldpy to place the player well when going back to big mode */
3870 if (p_ptr->wild_mode)
3872 if (ddy[dir] > 0) p_ptr->oldpy = 1;
3873 if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
3874 if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
3875 if (ddx[dir] > 0) p_ptr->oldpx = 1;
3876 if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
3877 if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
3880 if (p_can_kill_walls)
3882 cave_alter_feat(y, x, FF_HURT_DISI);
3884 /* Update some things -- similar to GF_KILL_WALL */
3885 p_ptr->update |= (PU_FLOW);
3889 /* sound(SOUND_WALK); */
3891 #ifdef ALLOW_EASY_DISARM /* TNB */
3893 if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
3895 #else /* ALLOW_EASY_DISARM -- TNB */
3897 if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
3899 #endif /* ALLOW_EASY_DISARM -- TNB */
3901 if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
3903 /* Move the player */
3904 (void)move_player_effect(y, x, mpe_mode);
3909 static bool ignore_avoid_run;
3912 * Hack -- Check for a "known wall" (see below)
3914 static int see_wall(int dir, int y, int x)
3918 /* Get the new location */
3922 /* Illegal grids are not known walls */
3923 if (!in_bounds2(y, x)) return (FALSE);
3926 c_ptr = &cave[y][x];
3928 /* Must be known to the player */
3929 if (c_ptr->info & (CAVE_MARK))
3931 /* Feature code (applying "mimic" field) */
3932 s16b feat = get_feat_mimic(c_ptr);
3933 feature_type *f_ptr = &f_info[feat];
3935 /* Wall grids are known walls */
3936 if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
3938 /* Don't run on a tree unless explicitly requested */
3939 if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
3942 /* Don't run in a wall */
3943 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
3944 return !have_flag(f_ptr->flags, FF_DOOR);
3952 * Hack -- Check for an "unknown corner" (see below)
3954 static int see_nothing(int dir, int y, int x)
3956 /* Get the new location */
3960 /* Illegal grids are unknown */
3961 if (!in_bounds2(y, x)) return (TRUE);
3963 /* Memorized grids are always known */
3964 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
3966 /* Viewable door/wall grids are known */
3967 if (player_can_see_bold(y, x)) return (FALSE);
3978 * The running algorithm: -CJS-
3980 * In the diagrams below, the player has just arrived in the
3981 * grid marked as '@', and he has just come from a grid marked
3982 * as 'o', and he is about to enter the grid marked as 'x'.
3984 * Of course, if the "requested" move was impossible, then you
3985 * will of course be blocked, and will stop.
3987 * Overview: You keep moving until something interesting happens.
3988 * If you are in an enclosed space, you follow corners. This is
3989 * the usual corridor scheme. If you are in an open space, you go
3990 * straight, but stop before entering enclosed space. This is
3991 * analogous to reaching doorways. If you have enclosed space on
3992 * one side only (that is, running along side a wall) stop if
3993 * your wall opens out, or your open space closes in. Either case
3994 * corresponds to a doorway.
3996 * What happens depends on what you can really SEE. (i.e. if you
3997 * have no light, then running along a dark corridor is JUST like
3998 * running in a dark room.) The algorithm works equally well in
3999 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
4001 * These conditions are kept in static memory:
4002 * find_openarea You are in the open on at least one
4004 * find_breakleft You have a wall on the left, and will
4006 * find_breakright You have a wall on the right, and will
4009 * To initialize these conditions, we examine the grids adjacent
4010 * to the grid marked 'x', two on each side (marked 'L' and 'R').
4011 * If either one of the two grids on a given side is seen to be
4012 * closed, then that side is considered to be closed. If both
4013 * sides are closed, then it is an enclosed (corridor) run.
4019 * Looking at more than just the immediate squares is
4020 * significant. Consider the following case. A run along the
4021 * corridor will stop just before entering the center point,
4022 * because a choice is clearly established. Running in any of
4023 * three available directions will be defined as a corridor run.
4024 * Note that a minor hack is inserted to make the angled corridor
4025 * entry (with one side blocked near and the other side blocked
4026 * further away from the runner) work correctly. The runner moves
4027 * diagonally, but then saves the previous direction as being
4028 * straight into the gap. Otherwise, the tail end of the other
4029 * entry would be perceived as an alternative on the next move.
4037 * Likewise, a run along a wall, and then into a doorway (two
4038 * runs) will work correctly. A single run rightwards from @ will
4039 * stop at 1. Another run right and down will enter the corridor
4040 * and make the corner, stopping at the 2.
4042 * ##################
4044 * ########### ######
4048 * After any move, the function area_affect is called to
4049 * determine the new surroundings, and the direction of
4050 * subsequent moves. It examines the current player location
4051 * (at which the runner has just arrived) and the previous
4052 * direction (from which the runner is considered to have come).
4054 * Moving one square in some direction places you adjacent to
4055 * three or five new squares (for straight and diagonal moves
4056 * respectively) to which you were not previously adjacent,
4057 * marked as '!' in the diagrams below.
4060 * .o@! (normal) .o.! (diagonal)
4061 * ...! (east) ..@! (south east)
4064 * You STOP if any of the new squares are interesting in any way:
4065 * for example, if they contain visible monsters or treasure.
4067 * You STOP if any of the newly adjacent squares seem to be open,
4068 * and you are also looking for a break on that side. (that is,
4069 * find_openarea AND find_break).
4071 * You STOP if any of the newly adjacent squares do NOT seem to be
4072 * open and you are in an open area, and that side was previously
4075 * Corners: If you are not in the open (i.e. you are in a corridor)
4076 * and there is only one way to go in the new squares, then turn in
4077 * that direction. If there are more than two new ways to go, STOP.
4078 * If there are two ways to go, and those ways are separated by a
4079 * square which does not seem to be open, then STOP.
4081 * Otherwise, we have a potential corner. There are two new open
4082 * squares, which are also adjacent. One of the new squares is
4083 * diagonally located, the other is straight on (as in the diagram).
4084 * We consider two more squares further out (marked below as ?).
4086 * We assign "option" to the straight-on grid, and "option2" to the
4087 * diagonal grid, and "check_dir" to the grid marked 's'.
4093 * If they are both seen to be closed, then it is seen that no benefit
4094 * is gained from moving straight. It is a known corner. To cut the
4095 * corner, go diagonally, otherwise go straight, but pretend you
4096 * stepped diagonally into that next location for a full view next
4097 * time. Conversely, if one of the ? squares is not seen to be closed,
4098 * then there is a potential choice. We check to see whether it is a
4099 * potential corner or an intersection/room entrance. If the square
4100 * two spaces straight ahead, and the space marked with 's' are both
4101 * unknown space, then it is a potential corner and enter if
4102 * find_examine is set, otherwise must stop because it is not a
4103 * corner. (find_examine option is removed and always is TRUE.)
4110 * Hack -- allow quick "cycling" through the legal directions
4112 static byte cycle[] =
4113 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
4116 * Hack -- map each direction into the "middle" of the "cycle[]" array
4118 static byte chome[] =
4119 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
4122 * The direction we are running
4124 static byte find_current;
4127 * The direction we came from
4129 static byte find_prevdir;
4132 * We are looking for open area
4134 static bool find_openarea;
4137 * We are looking for a break
4139 static bool find_breakright;
4140 static bool find_breakleft;
4145 * Initialize the running algorithm for a new direction.
4147 * Diagonal Corridor -- allow diaginal entry into corridors.
4149 * Blunt Corridor -- If there is a wall two spaces ahead and
4150 * we seem to be in a corridor, then force a turn into the side
4151 * corridor, must be moving straight into a corridor here. ???
4153 * Diagonal Corridor Blunt Corridor (?)
4158 static void run_init(int dir)
4160 int row, col, deepleft, deepright;
4161 int i, shortleft, shortright;
4164 /* Save the direction */
4167 /* Assume running straight */
4170 /* Assume looking for open area */
4171 find_openarea = TRUE;
4173 /* Assume not looking for breaks */
4174 find_breakright = find_breakleft = FALSE;
4176 /* Assume no nearby walls */
4177 deepleft = deepright = FALSE;
4178 shortright = shortleft = FALSE;
4183 /* Find the destination grid */
4184 row = py + ddy[dir];
4185 col = px + ddx[dir];
4187 ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN);
4189 /* Extract cycle index */
4192 /* Check for walls */
4193 if (see_wall(cycle[i+1], py, px))
4195 find_breakleft = TRUE;
4198 else if (see_wall(cycle[i+1], row, col))
4200 find_breakleft = TRUE;
4204 /* Check for walls */
4205 if (see_wall(cycle[i-1], py, px))
4207 find_breakright = TRUE;
4210 else if (see_wall(cycle[i-1], row, col))
4212 find_breakright = TRUE;
4216 /* Looking for a break */
4217 if (find_breakleft && find_breakright)
4219 /* Not looking for open area */
4220 find_openarea = FALSE;
4222 /* Hack -- allow angled corridor entry */
4225 if (deepleft && !deepright)
4227 find_prevdir = cycle[i - 1];
4229 else if (deepright && !deepleft)
4231 find_prevdir = cycle[i + 1];
4235 /* Hack -- allow blunt corridor entry */
4236 else if (see_wall(cycle[i], row, col))
4238 if (shortleft && !shortright)
4240 find_prevdir = cycle[i - 2];
4242 else if (shortright && !shortleft)
4244 find_prevdir = cycle[i + 2];
4252 * Update the current "run" path
4254 * Return TRUE if the running should be stopped
4256 static bool run_test(void)
4258 int prev_dir, new_dir, check_dir = 0;
4261 int option = 0, option2 = 0;
4264 feature_type *f_ptr;
4266 /* Where we came from */
4267 prev_dir = find_prevdir;
4270 /* Range of newly adjacent grids */
4271 max = (prev_dir & 0x01) + 1;
4273 /* break run when leaving trap detected region */
4274 if ((disturb_trap_detect || alert_trap_detect)
4275 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4277 /* No duplicate warning */
4278 p_ptr->dtrap = FALSE;
4280 /* You are just on the edge */
4281 if (!(cave[py][px].info & CAVE_UNSAFE))
4283 if (alert_trap_detect)
4286 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4288 msg_print("*Leaving trap detect region!*");
4292 if (disturb_trap_detect)
4300 /* Look at every newly adjacent square. */
4301 for (i = -max; i <= max; i++)
4303 s16b this_o_idx, next_o_idx = 0;
4306 new_dir = cycle[chome[prev_dir] + i];
4309 row = py + ddy[new_dir];
4310 col = px + ddx[new_dir];
4313 c_ptr = &cave[row][col];
4315 /* Feature code (applying "mimic" field) */
4316 feat = get_feat_mimic(c_ptr);
4317 f_ptr = &f_info[feat];
4319 /* Visible monsters abort running */
4322 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4324 /* Visible monster */
4325 if (m_ptr->ml) return (TRUE);
4328 /* Visible objects abort running */
4329 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4333 /* Acquire object */
4334 o_ptr = &o_list[this_o_idx];
4336 /* Acquire next object */
4337 next_o_idx = o_ptr->next_o_idx;
4339 /* Visible object */
4340 if (o_ptr->marked & OM_FOUND) return (TRUE);
4343 /* Assume unknown */
4346 /* Check memorized grids */
4347 if (c_ptr->info & (CAVE_MARK))
4349 bool notice = have_flag(f_ptr->flags, FF_NOTICE);
4351 if (notice && have_flag(f_ptr->flags, FF_MOVE))
4354 if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
4356 /* Option -- ignore */
4361 else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
4363 /* Option -- ignore */
4368 else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
4375 else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
4376 (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
4383 /* Interesting feature */
4384 if (notice) return (TRUE);
4386 /* The grid is "visible" */
4390 /* Analyze unknown grids and floors considering mimic */
4391 if (inv || !see_wall(0, row, col))
4393 /* Looking for open area */
4399 /* The first new direction. */
4405 /* Three new directions. Stop running. */
4411 /* Two non-adjacent new directions. Stop running. */
4412 else if (option != cycle[chome[prev_dir] + i - 1])
4417 /* Two new (adjacent) directions (case 1) */
4418 else if (new_dir & 0x01)
4420 check_dir = cycle[chome[prev_dir] + i - 2];
4424 /* Two new (adjacent) directions (case 2) */
4427 check_dir = cycle[chome[prev_dir] + i + 1];
4433 /* Obstacle, while looking for open area */
4440 /* Break to the right */
4441 find_breakright = TRUE;
4446 /* Break to the left */
4447 find_breakleft = TRUE;
4453 /* Looking for open area */
4456 /* Hack -- look again */
4457 for (i = -max; i < 0; i++)
4459 /* Unknown grid or non-wall */
4460 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4462 /* Looking to break right */
4463 if (find_breakright)
4472 /* Looking to break left */
4480 /* Hack -- look again */
4481 for (i = max; i > 0; i--)
4483 /* Unknown grid or non-wall */
4484 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4486 /* Looking to break left */
4496 /* Looking to break right */
4497 if (find_breakright)
4505 /* Not looking for open area */
4517 /* Primary option */
4518 find_current = option;
4520 /* No other options */
4521 find_prevdir = option;
4524 /* Two options, examining corners */
4527 /* Primary option */
4528 find_current = option;
4530 /* Hack -- allow curving */
4531 find_prevdir = option2;
4534 /* Two options, pick one */
4537 /* Get next location */
4538 row = py + ddy[option];
4539 col = px + ddx[option];
4541 /* Don't see that it is closed off. */
4542 /* This could be a potential corner or an intersection. */
4543 if (!see_wall(option, row, col) ||
4544 !see_wall(check_dir, row, col))
4546 /* Can not see anything ahead and in the direction we */
4547 /* are turning, assume that it is a potential corner. */
4548 if (see_nothing(option, row, col) &&
4549 see_nothing(option2, row, col))
4551 find_current = option;
4552 find_prevdir = option2;
4555 /* STOP: we are next to an intersection or a room */
4562 /* This corner is seen to be enclosed; we cut the corner. */
4565 find_current = option2;
4566 find_prevdir = option2;
4569 /* This corner is seen to be enclosed, and we */
4570 /* deliberately go the long way. */
4573 find_current = option;
4574 find_prevdir = option2;
4579 /* About to hit a known wall, stop */
4580 if (see_wall(find_current, py, px))
4592 * Take one step along the current "run" path
4594 void run_step(int dir)
4599 /* Ignore AVOID_RUN on a first step */
4600 ignore_avoid_run = TRUE;
4602 /* Hack -- do not start silly run */
4603 if (see_wall(dir, py, px))
4607 msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£");
4609 msg_print("You cannot run in that direction.");
4637 /* Decrease the run counter */
4638 if (--running <= 0) return;
4643 /* Move the player, using the "pickup" flag */
4644 #ifdef ALLOW_EASY_DISARM /* TNB */
4646 move_player(find_current, FALSE, FALSE);
4648 #else /* ALLOW_EASY_DISARM -- TNB */
4650 move_player(find_current, always_pickup, FALSE);
4652 #endif /* ALLOW_EASY_DISARM -- TNB */
4654 if (player_bold(p_ptr->run_py, p_ptr->run_px))
4665 * Test for traveling
4667 static int travel_test(int prev_dir)
4671 const cave_type *c_ptr;
4674 /* Cannot travel when blind */
4675 if (p_ptr->blind || no_lite())
4677 msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
4681 /* break run when leaving trap detected region */
4682 if ((disturb_trap_detect || alert_trap_detect)
4683 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4685 /* No duplicate warning */
4686 p_ptr->dtrap = FALSE;
4688 /* You are just on the edge */
4689 if (!(cave[py][px].info & CAVE_UNSAFE))
4691 if (alert_trap_detect)
4694 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4696 msg_print("*Leaving trap detect region!*");
4700 if (disturb_trap_detect)
4708 /* Range of newly adjacent grids */
4709 max = (prev_dir & 0x01) + 1;
4711 /* Look at every newly adjacent square. */
4712 for (i = -max; i <= max; i++)
4715 int dir = cycle[chome[prev_dir] + i];
4718 int row = py + ddy[dir];
4719 int col = px + ddx[dir];
4722 c_ptr = &cave[row][col];
4724 /* Visible monsters abort running */
4727 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4729 /* Visible monster */
4730 if (m_ptr->ml) return (0);
4735 /* Travel cost of current grid */
4736 cost = travel.cost[py][px];
4738 /* Determine travel direction */
4739 for (i = 0; i < 8; ++ i) {
4740 int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]];
4742 if (dir_cost < cost)
4749 if (!new_dir) return (0);
4751 /* Access newly move grid */
4752 c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]];
4754 /* Close door abort traveling */
4755 if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
4757 /* Visible and unignorable trap abort tarveling */
4758 if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
4768 void travel_step(void)
4770 /* Get travel direction */
4771 travel.dir = travel_test(travel.dir);
4776 if (travel.run == 255)
4779 msg_print("Æ»¶Ú¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡ª");
4781 msg_print("No route is found!");
4783 travel.y = travel.x = 0;
4791 move_player(travel.dir, always_pickup, FALSE);
4793 if ((py == travel.y) && (px == travel.x))
4796 travel.y = travel.x = 0;
4798 else if (travel.run > 0)
4802 Term_xtra(TERM_XTRA_DELAY, delay_factor);