4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Movement commands (part 1) */
14 #define MAX_VAMPIRIC_DRAIN 50
18 * Determine if the player "hits" a monster (normal combat).
19 * Note -- Always miss 5%, always hit 5%, otherwise random.
21 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
24 monster_race *r_ptr = &r_info[m_ptr->r_idx];
27 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
32 /* Snipers with high-concentration reduce instant miss percentage.*/
35 /* Hack -- Instant miss or hit */
36 if (k < 10) return (k < 5);
38 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
39 if (one_in_(20)) return (FALSE);
42 if (chance <= 0) return (FALSE);
44 /* Invisible monsters are harder to hit */
45 if (!vis) chance = (chance + 1) / 2;
47 /* Power competes against armor */
48 if (randint0(chance) < (ac * 3 / 4))
50 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
54 /* Extract monster name */
55 monster_desc(m_name, m_ptr, 0);
56 msg_format(_("%s¤Ï%s¤ò»Â¤ê¼Î¤Æ¤¿¡ª", "%s cuts down %s!"), m_name, o_name);
68 * Determine if the player "hits" a monster (normal combat).
70 * Note -- Always miss 5%, always hit 5%, otherwise random.
72 bool test_hit_norm(int chance, int ac, int vis)
79 /* Hack -- Instant miss or hit */
80 if (k < 10) return (k < 5);
82 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
83 if (one_in_(20)) return (FALSE);
85 /* Wimpy attack never hits */
86 if (chance <= 0) return (FALSE);
88 /* Penalize invisible targets */
89 if (!vis) chance = (chance + 1) / 2;
91 /* Power must defeat armor */
92 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
101 * Critical hits (from objects thrown by player)
102 * Factor in item weight, total plusses, and player level.
104 s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
107 object_type *j_ptr = &inventory[INVEN_BOW];
109 /* Extract "shot" power */
110 i = p_ptr->to_h_b + plus_ammo;
112 if (p_ptr->tval_ammo == TV_BOLT)
113 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
115 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
118 /* Snipers can shot more critically with crossbows */
119 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
120 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
122 /* Good bow makes more critical */
123 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
126 if (randint1(10000) <= i)
128 k = weight * randint1(500);
133 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
135 msg_print("It was a good hit!");
143 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
145 msg_print("It was a great hit!");
153 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
155 msg_print("It was a superb hit!");
168 * Critical hits (by player)
170 * Factor in weapon weight, total plusses, player melee bonus
172 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
176 /* Extract "blow" power */
177 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
180 if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
182 k = weight + randint1(650);
183 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
188 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
190 msg_print("It was a good hit!");
198 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
200 msg_print("It was a great hit!");
208 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
210 msg_print("It was a superb hit!");
218 msg_print("ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
220 msg_print("It was a *GREAT* hit!");
228 msg_print("ÈæÎà¤Ê¤ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
230 msg_print("It was a *SUPERB* hit!");
233 dam = ((7 * dam) / 2) + 25;
242 static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
244 static const struct slay_table_t {
246 u32b affect_race_flag;
249 size_t r_flag_offset;
251 #define OFFSET(X) offsetof(monster_race, X)
252 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
253 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
254 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
255 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
256 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
257 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
258 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
259 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
260 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
261 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
262 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
263 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
264 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
265 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
266 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
267 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
268 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
269 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
270 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
271 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
275 monster_race* r_ptr = &r_info[m_ptr->r_idx];
277 for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
279 const struct slay_table_t* p = &slay_table[i];
281 if ((have_flag(flgs, p->slay_flag)) &&
282 (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
284 if (is_original_ap_and_seen(m_ptr))
286 atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
289 mult = MAX(mult, p->slay_mult);
296 static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
298 static const struct brand_table_t {
303 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
304 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
305 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
306 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
307 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
310 monster_race* r_ptr = &r_info[m_ptr->r_idx];
312 for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
314 const struct brand_table_t* p = &brand_table[i];
316 if (have_flag(flgs, p->brand_flag))
318 /* Notice immunity */
319 if (r_ptr->flagsr & p->resist_mask)
321 if (is_original_ap_and_seen(m_ptr))
323 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
327 /* Otherwise, take the damage */
328 else if (r_ptr->flags3 & p->hurt_flag)
330 if (is_original_ap_and_seen(m_ptr))
332 r_ptr->r_flags3 |= p->hurt_flag;
335 mult = MAX(mult, 50);
339 mult = MAX(mult, 25);
347 * Extract the "total damage" from a given object hitting a given monster.
349 * Note that "flasks of oil" do NOT do fire damage, although they
350 * certainly could be made to do so. XXX XXX
352 * Note that most brands and slays are x3, except Slay Animal (x2),
353 * Slay Evil (x2), and Kill dragon (x5).
355 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
359 u32b flgs[TR_FLAG_SIZE];
361 /* Extract the flags */
362 object_flags(o_ptr, flgs);
363 torch_flags(o_ptr, flgs); /* torches has secret flags */
368 if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
369 if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
370 if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
371 if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
372 if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
375 /* Hex - Slay Good (Runesword) */
376 if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
378 /* Some "weapons" and "ammo" do extra damage */
391 mult = mult_slaying(mult, flgs, m_ptr);
393 /* Elemental Brand */
394 mult = mult_brand(mult, flgs, m_ptr);
397 if (p_ptr->pclass == CLASS_SAMURAI)
399 mult = mult_hissatsu(mult, flgs, m_ptr, mode);
403 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
405 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
406 p_ptr->redraw |= (PR_MANA);
407 mult = mult * 3 / 2 + 20;
410 /* Hack -- The Nothung cause special damage to Fafner */
411 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
416 if (mult > 150) mult = 150;
418 /* Return the total damage */
419 return (tdam * mult / 10);
424 * Search for hidden things
426 static void discover_hidden_things(int y, int x)
428 s16b this_o_idx, next_o_idx = 0;
432 /* Access the grid */
436 if (c_ptr->mimic && is_trap(c_ptr->feat))
442 msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
449 if (is_hidden_door(c_ptr))
452 msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
461 /* Scan all objects in the grid */
462 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
467 o_ptr = &o_list[this_o_idx];
469 /* Acquire next object */
470 next_o_idx = o_ptr->next_o_idx;
472 /* Skip non-chests */
473 if (o_ptr->tval != TV_CHEST) continue;
475 /* Skip non-trapped chests */
476 if (!chest_traps[o_ptr->pval]) continue;
479 if (!object_is_known(o_ptr))
482 msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
497 /* Start with base search ability */
498 chance = p_ptr->skill_srh;
500 /* Penalize various conditions */
501 if (p_ptr->blind || no_lite()) chance = chance / 10;
502 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
504 /* Search the nearby grids, which are always in bounds */
505 for (i = 0; i < 9; ++ i)
507 /* Sometimes, notice things */
508 if (randint0(100) < chance)
510 discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
517 * Helper routine for py_pickup() and py_pickup_floor().
519 * Add the given dungeon object to the character's inventory.
521 * Delete the object afterwards.
523 void py_pickup_aux(int o_idx)
529 * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
530 * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
532 * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
533 * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
535 char o_name[MAX_NLEN];
536 char old_name[MAX_NLEN];
540 char o_name[MAX_NLEN];
545 o_ptr = &o_list[o_idx];
548 /* Describe the object */
549 object_desc(old_name, o_ptr, OD_NAME_ONLY);
550 object_desc_kosuu(kazu_str, o_ptr);
551 hirottakazu = o_ptr->number;
553 /* Carry the object */
554 slot = inven_carry(o_ptr);
556 /* Get the object again */
557 o_ptr = &inventory[slot];
559 /* Delete the object */
560 delete_object_idx(o_idx);
562 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
564 bool old_known = identify_item(o_ptr);
566 /* Auto-inscription/destroy */
567 autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
569 /* If it is destroyed, don't pick it up */
570 if (o_ptr->marked & OM_AUTODESTROY) return;
573 /* Describe the object */
574 object_desc(o_name, o_ptr, 0);
578 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
580 msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name);
581 msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢");
582 msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name);
588 msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot));
592 if (o_ptr->number > hirottakazu) {
593 msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",
594 kazu_str, o_name, index_to_label(slot));
596 msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot));
600 strcpy(record_o_name, old_name);
602 msg_format("You have %s (%c).", o_name, index_to_label(slot));
603 strcpy(record_o_name, o_name);
608 check_find_art_quest_completion(o_ptr);
613 * Player "wants" to pick up an object or gold.
614 * Note that we ONLY handle things that can be picked up.
615 * See "move_player()" for handling of other things.
617 void carry(bool pickup)
619 cave_type *c_ptr = &cave[py][px];
621 s16b this_o_idx, next_o_idx = 0;
623 char o_name[MAX_NLEN];
625 /* Recenter the map around the player */
629 p_ptr->update |= (PU_MONSTERS);
632 p_ptr->redraw |= (PR_MAP);
635 p_ptr->window |= (PW_OVERHEAD);
640 /* Automatically pickup/destroy/inscribe items */
641 autopick_pickup_items(c_ptr);
644 #ifdef ALLOW_EASY_FLOOR
648 py_pickup_floor(pickup);
652 #endif /* ALLOW_EASY_FLOOR */
654 /* Scan the pile of objects */
655 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
660 o_ptr = &o_list[this_o_idx];
662 #ifdef ALLOW_EASY_SENSE /* TNB */
664 /* Option: Make item sensing easy */
667 /* Sense the object */
668 (void)sense_object(o_ptr);
671 #endif /* ALLOW_EASY_SENSE -- TNB */
673 /* Describe the object */
674 object_desc(o_name, o_ptr, 0);
676 /* Acquire next object */
677 next_o_idx = o_ptr->next_o_idx;
679 /* Hack -- disturb */
683 if (o_ptr->tval == TV_GOLD)
685 int value = (long)o_ptr->pval;
687 /* Delete the gold */
688 delete_object_idx(this_o_idx);
692 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
693 (long)value, o_name);
695 msg_format("You collect %ld gold pieces worth of %s.",
696 (long)value, o_name);
702 /* Collect the gold */
706 p_ptr->redraw |= (PR_GOLD);
709 p_ptr->window |= (PW_PLAYER);
712 /* Pick up objects */
715 /* Hack - some objects were handled in autopick_pickup_items(). */
716 if (o_ptr->marked & OM_NOMSG)
718 /* Clear the flag. */
719 o_ptr->marked &= ~OM_NOMSG;
721 /* Describe the object */
725 msg_format("%s¤¬¤¢¤ë¡£", o_name);
727 msg_format("You see %s.", o_name);
732 /* Note that the pack is too full */
733 else if (!inven_carry_okay(o_ptr))
736 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
738 msg_format("You have no room for %s.", o_name);
743 /* Pick up the item (if requested and allowed) */
748 /* Hack -- query every item */
749 if (carry_query_flag)
751 char out_val[MAX_NLEN+20];
753 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
755 sprintf(out_val, "Pick up %s? ", o_name);
758 okay = get_check(out_val);
761 /* Attempt to pick up an object. */
764 /* Pick up the object */
765 py_pickup_aux(this_o_idx);
774 * Determine if a trap affects the player.
775 * Always miss 5% of the time, Always hit 5% of the time.
776 * Otherwise, match trap power against player armor.
778 static int check_hit(int power)
782 /* Percentile dice */
785 /* Hack -- 5% hit, 5% miss */
786 if (k < 10) return (k < 5);
788 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
789 if (one_in_(20)) return (TRUE);
791 /* Paranoia -- No power */
792 if (power <= 0) return (FALSE);
795 ac = p_ptr->ac + p_ptr->to_a;
797 /* Power competes against Armor */
798 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
806 static void hit_trap_pit(int trap_feat_type)
810 cptr spike_name = "";
812 switch (trap_feat_type)
815 trap_name = _("Íî¤È¤··ê", "a pit trap");
817 case TRAP_SPIKED_PIT:
818 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
819 spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
821 case TRAP_POISON_PIT:
822 trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
823 spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
829 if (p_ptr->levitation)
831 msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
835 msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
840 /* Extra spike damage */
841 if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
844 msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
847 (void)set_cut(p_ptr->cut + randint1(dam));
849 if (trap_feat_type == TRAP_POISON_PIT) {
850 if (p_ptr->resist_pois || IS_OPPOSE_POIS())
852 msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
857 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
862 /* Take the damage */
863 take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
866 static bool hit_trap_dart(void)
872 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
874 take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
876 if (!CHECK_MULTISHADOW()) hit = TRUE;
880 msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
886 static void hit_trap_lose_stat(int stat)
894 static void hit_trap_slow(void)
898 set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
902 static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
904 msg_print(trap_message);
913 * Handle player hitting a real trap
915 static void hit_trap(bool break_trap)
920 /* Get the cave grid */
921 cave_type *c_ptr = &cave[y][x];
922 feature_type *f_ptr = &f_info[c_ptr->feat];
923 int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP;
926 cptr name = "¥È¥é¥Ã¥×";
928 cptr name = "a trap";
931 /* Disturb the player */
934 cave_alter_feat(y, x, FF_HIT_TRAP);
936 /* Analyze XXX XXX XXX */
937 switch (trap_feat_type)
941 if (p_ptr->levitation)
944 msg_print("Íî¤È¤·¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
946 msg_print("You fly over a trap door.");
953 msg_print("Íî¤È¤·¸Í¤ËÍî¤Á¤¿¡ª");
954 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
955 msg_print("¤¯¤Ã¤½¡Á¡ª");
957 msg_print("You have fallen through a trap door!");
965 name = "a trap door";
968 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
970 /* Still alive and autosave enabled */
971 if (autosave_l && (p_ptr->chp >= 0))
972 do_cmd_save_game(TRUE);
975 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "Íî¤È¤·¸Í¤ËÍî¤Á¤¿");
977 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You have fallen through a trap door!");
979 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
982 p_ptr->leaving = TRUE;
988 case TRAP_SPIKED_PIT:
989 case TRAP_POISON_PIT:
991 hit_trap_pit(trap_feat_type);
998 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1000 msg_print("There is a flash of shimmering light!");
1003 num = 2 + randint1(3);
1004 for (i = 0; i < num; i++)
1006 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1009 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1011 bool stop_ty = FALSE;
1016 stop_ty = activate_ty_curse(stop_ty, &count);
1026 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1028 msg_print("You hit a teleport trap!");
1031 teleport_player(100, TELEPORT_PASSIVE);
1038 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1040 msg_print("You are enveloped in flames!");
1043 dam = damroll(4, 6);
1045 (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
1047 (void)fire_dam(dam, "a fire trap", -1, FALSE);
1056 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1058 msg_print("You are splashed with acid!");
1061 dam = damroll(4, 6);
1063 (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
1065 (void)acid_dam(dam, "an acid trap", -1, FALSE);
1079 hit_trap_lose_stat(A_STR);
1085 hit_trap_lose_stat(A_DEX);
1091 hit_trap_lose_stat(A_CON);
1097 hit_trap_set_abnormal_status(
1098 _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
1099 p_ptr->resist_blind,
1100 set_blind, p_ptr->blind + randint0(50) + 25);
1106 hit_trap_set_abnormal_status(
1107 _("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
1109 set_confused, p_ptr->confused + randint0(20) + 10);
1115 hit_trap_set_abnormal_status(
1116 _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
1117 p_ptr->resist_pois || IS_OPPOSE_POIS(),
1118 set_poisoned, p_ptr->poisoned + randint0(20) + 10);
1125 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1127 msg_print("A strange white mist surrounds you!");
1130 if (!p_ptr->free_act)
1133 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1135 msg_print("You fall asleep.");
1139 if (ironman_nightmare)
1142 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1144 msg_print("A horrible vision enters your mind.");
1148 /* Pick a nightmare */
1149 get_mon_num_prep(get_nightmare, NULL);
1151 /* Have some nightmares */
1152 have_nightmare(get_mon_num(MAX_DEPTH));
1154 /* Remove the monster restriction */
1155 get_mon_num_prep(NULL, NULL);
1157 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1165 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1167 msg_print("There is a bright flash of light!");
1170 /* Make some new traps */
1171 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1179 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1181 msg_print("An alarm sounds!");
1184 aggravate_monsters(0);
1192 msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
1194 msg_print("Suddenly, surrounding walls are opened!");
1196 (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1197 (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1198 (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1199 aggravate_monsters(0);
1204 case TRAP_ARMAGEDDON:
1206 static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
1207 int evil_idx = 0, good_idx = 0;
1211 msg_print("ÆÍÁ³Å·³¦¤ÎÀïÁè¤Ë´¬¤¹þ¤Þ¤ì¤¿¡ª");
1213 msg_print("Suddenly, you are surrounded by immotal beings!");
1216 /* Summon Demons and Angels */
1217 for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
1219 num = levs[MIN(lev/10, 9)];
1220 for (i = 0; i < num; i++)
1222 int x1 = rand_spread(x, 7);
1223 int y1 = rand_spread(y, 5);
1225 /* Skip illegal grids */
1226 if (!in_bounds(y1, x1)) continue;
1228 /* Require line of projection */
1229 if (!projectable(py, px, y1, x1)) continue;
1231 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
1232 evil_idx = hack_m_idx_ii;
1234 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
1236 good_idx = hack_m_idx_ii;
1239 /* Let them fight each other */
1240 if (evil_idx && good_idx)
1242 monster_type *evil_ptr = &m_list[evil_idx];
1243 monster_type *good_ptr = &m_list[good_idx];
1244 evil_ptr->target_y = good_ptr->fy;
1245 evil_ptr->target_x = good_ptr->fx;
1246 good_ptr->target_y = evil_ptr->fy;
1247 good_ptr->target_x = evil_ptr->fx;
1257 msg_print("ÆÍÁ³Êɤ«¤é¿å¤¬°î¤ì½Ð¤·¤¿¡ª¥Ô¥é¥Ë¥¢¤¬¤¤¤ë¡ª");
1259 msg_print("Suddenly, the room is filled with water with piranhas!");
1262 /* Water fills room */
1263 fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
1265 /* Summon Piranhas */
1266 num = 1 + dun_level/20;
1267 for (i = 0; i < num; i++)
1269 (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
1275 if (break_trap && is_trap(c_ptr->feat))
1277 cave_alter_feat(y, x, FF_DISARM);
1279 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1281 msg_print("You destroyed the trap.");
1287 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
1288 int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
1290 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1292 if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
1295 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1297 /* Hack -- Get the "died from" name */
1298 monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1302 dam_func(aura_damage, mon_name, -1, TRUE);
1304 if (is_original_ap_and_seen(m_ptr))
1306 atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
1313 static void touch_zap_player(monster_type *m_ptr)
1315 touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1316 fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
1317 touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1318 cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
1319 touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1320 elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
1324 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1326 int k, bonus, chance;
1328 monster_type *m_ptr = &m_list[m_idx];
1329 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1338 case MUT2_SCOR_TAIL:
1365 atk_desc = "¥¯¥Á¥Ð¥·";
1376 atk_desc = "¾Ý¤ÎÉ¡";
1382 case MUT2_TENTACLES:
1389 atk_desc = "tentacles";
1394 dss = ddd = n_weight = 1;
1396 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1398 atk_desc = "undefined body part";
1403 /* Extract monster name (or "it") */
1404 monster_desc(m_name, m_ptr, 0);
1407 /* Calculate the "attack quality" */
1408 bonus = p_ptr->to_h_m;
1409 bonus += (p_ptr->lev * 6 / 5);
1410 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1413 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1419 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1421 msg_format("You hit %s with your %s.", m_name, atk_desc);
1425 k = damroll(ddd, dss);
1426 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1428 /* Apply the player damage bonuses */
1431 /* No negative damage */
1434 /* Modify the damage */
1435 k = mon_damage_mod(m_ptr, k, FALSE);
1437 /* Complex message */
1441 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1443 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1448 /* Anger the monster */
1449 if (k > 0) anger_monster(m_ptr);
1451 /* Damage, check for fear and mdeath */
1454 case MUT2_SCOR_TAIL:
1455 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1456 *mdeath = (m_ptr->r_idx == 0);
1459 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1462 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1465 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1467 case MUT2_TENTACLES:
1468 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1471 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1474 touch_zap_player(m_ptr);
1484 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1486 msg_format("You miss %s.", m_name);
1495 * Player attacks a (poor, defenseless) creature -RAK-
1497 * If no "weapon" is available, then "punch" the monster one time.
1499 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1501 int num = 0, k, bonus, chance, vir;
1503 cave_type *c_ptr = &cave[y][x];
1505 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1506 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1508 /* Access the weapon */
1509 object_type *o_ptr = &inventory[INVEN_RARM + hand];
1513 bool success_hit = FALSE;
1514 bool backstab = FALSE;
1515 bool vorpal_cut = FALSE;
1516 int chaos_effect = 0;
1517 bool stab_fleeing = FALSE;
1518 bool fuiuchi = FALSE;
1519 bool monk_attack = FALSE;
1520 bool do_quake = FALSE;
1522 bool drain_msg = TRUE;
1523 int drain_result = 0, drain_heal = 0;
1524 bool can_drain = FALSE;
1526 int drain_left = MAX_VAMPIRIC_DRAIN;
1527 u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1528 bool is_human = (r_ptr->d_char == 'p');
1529 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1530 bool zantetsu_mukou, e_j_mukou;
1532 switch (p_ptr->pclass)
1536 if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
1538 int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
1539 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1540 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1541 if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
1542 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1544 /* Can't backstab creatures that we can't see, right? */
1547 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1551 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1553 stab_fleeing = TRUE;
1559 case CLASS_FORCETRAINER:
1560 case CLASS_BERSERKER:
1561 if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
1565 if (!o_ptr->k_idx) /* Empty hand */
1567 if ((r_ptr->level + 10) > p_ptr->lev)
1569 if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1571 if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1572 p_ptr->skill_exp[GINOU_SUDE] += 40;
1573 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1574 p_ptr->skill_exp[GINOU_SUDE] += 5;
1575 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
1576 p_ptr->skill_exp[GINOU_SUDE] += 1;
1577 else if ((p_ptr->lev > 34))
1578 if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
1579 p_ptr->update |= (PU_BONUS);
1583 else if (object_is_melee_weapon(o_ptr))
1585 if ((r_ptr->level + 10) > p_ptr->lev)
1587 int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
1588 int sval = inventory[INVEN_RARM+hand].sval;
1589 int now_exp = p_ptr->weapon_exp[tval][sval];
1590 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
1593 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1594 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1595 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
1596 else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
1597 p_ptr->weapon_exp[tval][sval] += amount;
1598 p_ptr->update |= (PU_BONUS);
1603 /* Disturb the monster */
1604 (void)set_monster_csleep(c_ptr->m_idx, 0);
1606 /* Extract monster name (or "it") */
1607 monster_desc(m_name, m_ptr, 0);
1609 /* Calculate the "attack quality" */
1610 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
1611 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1612 if (mode == HISSATSU_IAI) chance += 60;
1613 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1615 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1617 vir = virtue_number(V_VALOUR);
1620 chance += (p_ptr->virtues[vir - 1]/10);
1623 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1624 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1626 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1627 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
1628 else num_blow = p_ptr->num_blow[hand];
1630 /* Hack -- DOKUBARI always hit once */
1631 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
1633 /* Attack once for each legal blow */
1634 while ((num++ < num_blow) && !p_ptr->is_dead)
1636 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1640 if (p_ptr->migite && p_ptr->hidarite)
1644 if (mode == HISSATSU_3DAN)
1649 success_hit = one_in_(n);
1651 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1652 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
1654 if (mode == HISSATSU_MAJIN)
1657 success_hit = FALSE;
1663 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1670 if (backstab) msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª", m_name);
1671 else if (fuiuchi) msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª", m_name);
1672 else if (stab_fleeing) msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª", m_name);
1673 else if (!monk_attack) msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
1675 if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name);
1676 else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name);
1677 else if (stab_fleeing) msg_format("You backstab the fleeing %s!", m_name);
1678 else if (!monk_attack) msg_format("You hit %s.", m_name);
1681 /* Hack -- bare hands do one damage */
1684 object_flags(o_ptr, flgs);
1686 /* Select a chaotic effect (50% chance) */
1687 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1690 chg_virtue(V_CHANCE, 1);
1692 if (randint1(5) < 3)
1694 /* Vampiric (20%) */
1697 else if (one_in_(250))
1702 else if (!one_in_(10))
1704 /* Confusion (26.892%) */
1707 else if (one_in_(2))
1709 /* Teleport away (1.494%) */
1714 /* Polymorph (1.494%) */
1719 /* Vampiric drain */
1720 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1722 /* Only drain "living" monsters */
1723 if (monster_living(r_ptr))
1729 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
1731 else vorpal_cut = FALSE;
1735 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1737 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1738 int resist_stun = 0;
1741 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1742 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1743 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1744 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1745 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1748 if (p_ptr->special_defense & KAMAE_BYAKKO)
1749 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
1750 else if (p_ptr->special_defense & KAMAE_SUZAKU)
1752 else if (p_ptr->special_defense & KAMAE_GENBU)
1755 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
1756 /* Attempt 'times' */
1757 for (times = 0; times < max_times; times++)
1761 ma_ptr = &ma_blows[randint0(MAX_MA)];
1762 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1763 else min_level = ma_ptr->min_level;
1765 while ((min_level > p_ptr->lev) ||
1766 (randint1(p_ptr->lev) < ma_ptr->chance));
1768 /* keep the highest level attack available we found */
1769 if ((ma_ptr->min_level > old_ptr->min_level) &&
1770 !p_ptr->stun && !p_ptr->confused)
1774 if (p_ptr->wizard && cheat_xtra)
1777 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
1779 msg_print("Attack re-selected.");
1789 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1790 else min_level = ma_ptr->min_level;
1791 k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
1792 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1794 if (ma_ptr->effect == MA_KNEE)
1796 if (r_ptr->flags1 & RF1_MALE)
1799 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
1801 msg_format("You hit %s in the groin with your knee!", m_name);
1805 special_effect = MA_KNEE;
1808 msg_format(ma_ptr->desc, m_name);
1811 else if (ma_ptr->effect == MA_SLOW)
1813 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1814 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1817 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
1819 msg_format("You kick %s in the ankle.", m_name);
1822 special_effect = MA_SLOW;
1824 else msg_format(ma_ptr->desc, m_name);
1830 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1833 msg_format(ma_ptr->desc, m_name);
1836 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1837 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
1839 weight += (p_ptr->magic_num1[0]/30);
1840 if (weight > 20) weight = 20;
1843 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
1845 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1848 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
1850 msg_format("%^s moans in agony!", m_name);
1853 stun_effect = 7 + randint1(13);
1857 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1859 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1860 (randint1(p_ptr->lev) > r_ptr->level) &&
1864 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
1866 msg_format("%^s starts limping slower.", m_name);
1869 m_ptr->mspeed -= 10;
1873 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1875 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1877 if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1880 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
1882 msg_format("%^s is stunned.", m_name);
1888 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
1890 msg_format("%^s is more stunned.", m_name);
1897 /* Handle normal weapon */
1898 else if (o_ptr->k_idx)
1900 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
1901 k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
1905 k *= (3 + (p_ptr->lev / 20));
1909 k = k*(5+(p_ptr->lev*2/25))/2;
1911 else if (stab_fleeing)
1916 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
1917 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
1922 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
1923 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
1931 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
1933 char chainsword_noise[1024];
1935 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
1937 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
1940 msg_print(chainsword_noise);
1944 if (o_ptr->name1 == ART_VORPAL_BLADE)
1947 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥ô¥©¡¼¥Ñ¥ë¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
1949 msg_print("Your Vorpal Blade goes snicker-snack!");
1955 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
1957 msg_format("Your weapon cuts deep into %s!", m_name);
1961 /* Try to increase the damage */
1962 while (one_in_(vorpal_chance))
1970 if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
1973 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
1975 msg_format("You cut %s in half!", m_name);
1983 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
1984 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
1985 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
1986 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
1987 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
1988 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
1989 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
1991 case 2: msg_format("You gouge %s!", m_name); break;
1992 case 3: msg_format("You maim %s!", m_name); break;
1993 case 4: msg_format("You carve %s!", m_name); break;
1994 case 5: msg_format("You cleave %s!", m_name); break;
1995 case 6: msg_format("You smite %s!", m_name); break;
1996 case 7: msg_format("You eviscerate %s!", m_name); break;
1997 default: msg_format("You shred %s!", m_name); break;
2001 drain_result = drain_result * 3 / 2;
2005 drain_result += o_ptr->to_d;
2008 /* Apply the player damage bonuses */
2009 k += p_ptr->to_d[hand];
2010 drain_result += p_ptr->to_d[hand];
2012 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2013 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
2014 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2016 /* No negative damage */
2019 if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
2027 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2029 msg_print("You cannot cut such a elastic thing!");
2037 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2039 msg_print("Spiders are difficult for you to deal with!");
2044 if (mode == HISSATSU_MINEUCHI)
2046 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2049 anger_monster(m_ptr);
2051 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2054 if (MON_STUNNED(m_ptr))
2057 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2059 msg_format("%s is more dazed.", m_name);
2067 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2069 msg_format("%s is dazed.", m_name);
2074 (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
2079 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2081 msg_format("%s is not effected.", m_name);
2086 /* Modify the damage */
2087 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))));
2088 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2090 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2094 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2096 msg_format("You hit %s on a fatal spot!", m_name);
2101 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)))
2103 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2104 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2109 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2111 msg_format("You critically injured %s!", m_name);
2114 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)))
2116 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2118 k = MAX(k*5, m_ptr->hp/2);
2121 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2123 msg_format("You fatally injured %s!", m_name);
2130 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2132 msg_format("You hit %s on a fatal spot!", m_name);
2138 /* Complex message */
2139 if (p_ptr->wizard || cheat_xtra)
2142 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2144 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2148 if (k <= 0) can_drain = FALSE;
2150 if (drain_result > m_ptr->hp)
2151 drain_result = m_ptr->hp;
2153 /* Damage, check for fear and death */
2154 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2157 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2159 if (p_ptr->migite && p_ptr->hidarite)
2161 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2162 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2166 energy_use = energy_use*num/p_ptr->num_blow[hand];
2169 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2171 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2173 msg_print("Sigh... Another trifling thing I've cut....");
2178 /* Anger the monster */
2179 if (k > 0) anger_monster(m_ptr);
2181 touch_zap_player(m_ptr);
2183 /* Are we draining it? A little note: If the monster is
2184 dead, the drain does not work... */
2186 if (can_drain && (drain_result > 0))
2188 if (o_ptr->name1 == ART_MURAMASA)
2192 int to_h = o_ptr->to_h;
2193 int to_d = o_ptr->to_d;
2197 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2201 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2204 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2207 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2209 msg_print("Muramasa sucked blood, and became more powerful!");
2218 if (drain_result > 5) /* Did we really hurt it? */
2220 drain_heal = damroll(2, drain_result / 6);
2223 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
2228 msg_format("Draining left: %d", drain_left);
2230 msg_format("Draining left: %d", drain_left);
2237 if (drain_heal < drain_left)
2239 drain_left -= drain_heal;
2243 drain_heal = drain_left;
2250 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2252 msg_format("Your weapon drains life from %s!", m_name);
2258 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2260 hp_player(drain_heal);
2261 /* We get to keep some of it! */
2265 m_ptr->maxhp -= (k+7)/8;
2266 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2267 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2273 /* Confusion attack */
2274 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
2276 /* Cancel glowing hands */
2277 if (p_ptr->special_attack & ATTACK_CONFUSE)
2279 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2281 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2283 msg_print("Your hands stop glowing.");
2285 p_ptr->redraw |= (PR_STATUS);
2289 /* Confuse the monster */
2290 if (r_ptr->flags3 & RF3_NO_CONF)
2292 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2295 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2297 msg_format("%^s is unaffected.", m_name);
2301 else if (randint0(100) < r_ptr->level)
2304 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2306 msg_format("%^s is unaffected.", m_name);
2313 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2315 msg_format("%^s appears confused.", m_name);
2318 (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
2322 else if (chaos_effect == 4)
2324 bool resists_tele = FALSE;
2326 if (r_ptr->flagsr & RFR_RES_TELE)
2328 if (r_ptr->flags1 & RF1_UNIQUE)
2330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2332 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2334 msg_format("%^s is unaffected!", m_name);
2337 resists_tele = TRUE;
2339 else if (r_ptr->level > randint1(100))
2341 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2343 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2345 msg_format("%^s resists!", m_name);
2348 resists_tele = TRUE;
2355 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2357 msg_format("%^s disappears!", m_name);
2360 teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE);
2361 num = num_blow + 1; /* Can't hit it anymore! */
2366 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2368 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2369 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2371 if (polymorph_monster(y, x))
2374 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2376 msg_format("%^s changes!", m_name);
2385 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2387 msg_format("%^s is unaffected.", m_name);
2391 /* Hack -- Get new monster */
2392 m_ptr = &m_list[c_ptr->m_idx];
2394 /* Oops, we need a different name... */
2395 monster_desc(m_name, m_ptr, 0);
2397 /* Hack -- Get new race */
2398 r_ptr = &r_info[m_ptr->r_idx];
2401 else if (o_ptr->name1 == ART_G_HAMMER)
2403 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2405 if (m_ptr->hold_o_idx)
2407 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2408 char o_name[MAX_NLEN];
2410 object_desc(o_name, q_ptr, OD_NAME_ONLY);
2411 q_ptr->held_m_idx = 0;
2412 q_ptr->marked = OM_TOUCHED;
2413 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2414 q_ptr->next_o_idx = 0;
2416 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2418 msg_format("You snatched %s.", o_name);
2428 backstab = FALSE; /* Clumsy! */
2429 fuiuchi = FALSE; /* Clumsy! */
2431 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2433 u32b flgs[TR_FLAG_SIZE];
2440 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2442 msg_format("You miss %s.", m_name);
2446 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2448 msg_print("Your scythe returns to you!");
2451 /* Extract the flags */
2452 object_flags(o_ptr, flgs);
2454 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2457 switch (p_ptr->mimic_form)
2460 switch (p_ptr->prace)
2467 case RACE_BARBARIAN:
2471 case RACE_HALF_TROLL:
2472 case RACE_HALF_OGRE:
2473 case RACE_HALF_GIANT:
2474 case RACE_HALF_TITAN:
2482 case RACE_DRACONIAN:
2489 case MIMIC_DEMON_LORD:
2496 if (p_ptr->align < 0 && mult < 20)
2498 if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
2500 if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
2502 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
2504 if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
2506 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
2509 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
2511 p_ptr->csp -= (1+(p_ptr->msp / 30));
2512 p_ptr->redraw |= (PR_MANA);
2513 mult = mult * 3 / 2 + 20;
2519 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2524 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
2526 msg_format("Your weapon cuts deep into yourself!");
2528 /* Try to increase the damage */
2536 k += (p_ptr->to_d[hand] + o_ptr->to_d);
2541 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
2543 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
2555 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2557 msg_format("You miss %s.", m_name);
2566 if (weak && !(*mdeath))
2569 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
2571 msg_format("%^s seems weakened.", m_name);
2574 if (drain_left != MAX_VAMPIRIC_DRAIN)
2578 chg_virtue(V_UNLIFE, 1);
2581 /* Mega-Hack -- apply earthquake brand */
2584 earthquake(py, px, 10);
2585 if (!cave[y][x].m_idx) *mdeath = TRUE;
2589 bool py_attack(int y, int x, int mode)
2592 bool mdeath = FALSE;
2593 bool stormbringer = FALSE;
2595 cave_type *c_ptr = &cave[y][x];
2596 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2597 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2600 /* Disturb the player */
2605 if (!p_ptr->migite && !p_ptr->hidarite &&
2606 !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2609 msg_format("%s¹¶·â¤Ç¤¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ" : "");
2611 msg_print("You cannot do attacking.");
2616 /* Extract monster name (or "it") */
2617 monster_desc(m_name, m_ptr, 0);
2621 /* Auto-Recall if possible and visible */
2622 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2624 /* Track a new monster */
2625 health_track(c_ptr->m_idx);
2628 if ((r_ptr->flags1 & RF1_FEMALE) &&
2629 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
2631 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
2634 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
2636 msg_print("I can not attack women!");
2642 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
2645 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
2647 msg_print("Something prevent you from attacking.");
2652 /* Stop if friendly */
2653 if (!is_hostile(m_ptr) &&
2654 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
2655 p_ptr->shero || !m_ptr->ml))
2657 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2658 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2662 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
2664 msg_format("Your black blade greedily attacks %s!", m_name);
2666 chg_virtue(V_INDIVIDUALISM, 1);
2667 chg_virtue(V_HONOUR, -1);
2668 chg_virtue(V_JUSTICE, -1);
2669 chg_virtue(V_COMPASSION, -1);
2671 else if (p_ptr->pclass != CLASS_BERSERKER)
2674 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
2676 if (get_check("Really hit it? "))
2679 chg_virtue(V_INDIVIDUALISM, 1);
2680 chg_virtue(V_HONOUR, -1);
2681 chg_virtue(V_JUSTICE, -1);
2682 chg_virtue(V_COMPASSION, -1);
2687 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
2689 msg_format("You stop to avoid hitting %s.", m_name);
2697 /* Handle player fear */
2703 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
2705 msg_format("You are too afraid to attack %s!", m_name);
2710 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
2712 msg_format ("There is something scary in your way!");
2715 /* Disturb the monster */
2716 (void)set_monster_csleep(c_ptr->m_idx, 0);
2722 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2724 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
2725 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
2728 if (p_ptr->migite && p_ptr->hidarite)
2730 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))
2732 if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2733 p_ptr->skill_exp[GINOU_NITOURYU] += 80;
2734 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2735 p_ptr->skill_exp[GINOU_NITOURYU] += 4;
2736 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2737 p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2738 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2739 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2740 p_ptr->update |= (PU_BONUS);
2744 /* Gain riding experience */
2747 int cur = p_ptr->skill_exp[GINOU_RIDING];
2748 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
2752 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
2753 int targetlevel = r_ptr->level;
2756 if ((cur / 200 - 5) < targetlevel)
2759 /* Extra experience */
2760 if ((cur / 100) < ridinglevel)
2762 if ((cur / 100 + 15) < ridinglevel)
2763 inc += 1 + (ridinglevel - (cur / 100 + 15));
2768 p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2770 p_ptr->update |= (PU_BONUS);
2774 riding_t_m_idx = c_ptr->m_idx;
2775 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
2776 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
2778 /* Mutations which yield extra 'natural' attacks */
2781 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
2782 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
2783 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
2784 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
2785 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
2786 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
2787 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
2788 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
2789 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
2790 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
2793 /* Hack -- delay fear messages */
2794 if (fear && m_ptr->ml && !mdeath)
2801 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
2803 msg_format("%^s flees in terror!", m_name);
2808 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
2810 set_action(ACTION_NONE);
2817 bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
2819 feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
2820 feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
2821 bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
2822 bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
2823 int pattern_type_cur, pattern_type_new;
2825 if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
2827 pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE;
2828 pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE;
2830 if (pattern_type_new == PATTERN_TILE_START)
2832 if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
2835 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
2837 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
2846 else if ((pattern_type_new == PATTERN_TILE_OLD) ||
2847 (pattern_type_new == PATTERN_TILE_END) ||
2848 (pattern_type_new == PATTERN_TILE_WRECKED))
2850 if (is_pattern_tile_cur)
2857 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
2859 msg_print("You must start walking the Pattern from the startpoint.");
2865 else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
2866 (pattern_type_cur == PATTERN_TILE_TELEPORT))
2870 else if (pattern_type_cur == PATTERN_TILE_START)
2872 if (is_pattern_tile_new)
2877 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
2879 msg_print("You must walk the Pattern in correct order.");
2885 else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
2886 (pattern_type_cur == PATTERN_TILE_END) ||
2887 (pattern_type_cur == PATTERN_TILE_WRECKED))
2889 if (!is_pattern_tile_new)
2892 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
2894 msg_print("You may not step off from the Pattern.");
2906 if (!is_pattern_tile_cur)
2909 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
2911 msg_print("You must start walking the Pattern from the startpoint.");
2918 byte ok_move = PATTERN_TILE_START;
2919 switch (pattern_type_cur)
2921 case PATTERN_TILE_1:
2922 ok_move = PATTERN_TILE_2;
2924 case PATTERN_TILE_2:
2925 ok_move = PATTERN_TILE_3;
2927 case PATTERN_TILE_3:
2928 ok_move = PATTERN_TILE_4;
2930 case PATTERN_TILE_4:
2931 ok_move = PATTERN_TILE_1;
2936 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
2938 msg_format("Funny Pattern walking, %d.", pattern_type_cur);
2941 return TRUE; /* Goof-up */
2944 if ((pattern_type_new == ok_move) ||
2945 (pattern_type_new == pattern_type_cur))
2949 if (!is_pattern_tile_new)
2951 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
2953 msg_print("You may not step off from the Pattern.");
2957 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
2959 msg_print("You must walk the Pattern in correct order.");
2969 bool player_can_enter(s16b feature, u16b mode)
2971 feature_type *f_ptr = &f_info[feature];
2973 if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
2976 if (have_flag(f_ptr->flags, FF_PATTERN))
2978 if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
2982 if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
2983 if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
2984 if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
2986 if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
2995 bool move_player_effect(int ny, int nx, u32b mpe_mode)
2997 cave_type *c_ptr = &cave[ny][nx];
2998 feature_type *f_ptr = &f_info[c_ptr->feat];
3000 if (!(mpe_mode & MPE_STAYING))
3004 cave_type *oc_ptr = &cave[oy][ox];
3005 int om_idx = oc_ptr->m_idx;
3006 int nm_idx = c_ptr->m_idx;
3008 /* Move the player */
3012 /* Hack -- For moving monster or riding player's moving */
3013 if (!(mpe_mode & MPE_DONT_SWAP_MON))
3015 /* Swap two monsters */
3016 c_ptr->m_idx = om_idx;
3017 oc_ptr->m_idx = nm_idx;
3019 if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
3021 monster_type *om_ptr = &m_list[om_idx];
3024 update_mon(om_idx, TRUE);
3027 if (nm_idx > 0) /* Monster on new spot */
3029 monster_type *nm_ptr = &m_list[nm_idx];
3032 update_mon(nm_idx, TRUE);
3036 /* Redraw old spot */
3039 /* Redraw new spot */
3042 /* Check for new panel (redraw map) */
3045 if (mpe_mode & MPE_FORGET_FLOW)
3049 /* Mega-Hack -- Forget the view */
3050 p_ptr->update |= (PU_UN_VIEW);
3053 p_ptr->redraw |= (PR_MAP);
3057 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
3060 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3062 /* Remove "unsafe" flag */
3063 if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
3065 /* For get everything when requested hehe I'm *NASTY* */
3066 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
3069 if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
3071 if (p_ptr->pclass == CLASS_NINJA)
3073 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
3074 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
3077 if ((p_ptr->action == ACTION_HAYAGAKE) &&
3078 (!have_flag(f_ptr->flags, FF_PROJECT) ||
3079 (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
3082 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
3084 msg_print("You cannot run in here.");
3086 set_action(ACTION_NONE);
3090 if (mpe_mode & MPE_ENERGY_USE)
3092 if (music_singing(MUSIC_WALL))
3094 (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE,
3095 PROJECT_KILL | PROJECT_ITEM, -1);
3097 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3100 /* Spontaneous Searching */
3101 if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
3106 /* Continuous Searching */
3107 if (p_ptr->action == ACTION_SEARCH)
3113 /* Handle "objects" */
3114 if (!(mpe_mode & MPE_DONT_PICKUP))
3116 carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
3119 /* Handle "store doors" */
3120 if (have_flag(f_ptr->flags, FF_STORE))
3126 /* Hack -- Enter store */
3127 command_new = SPECIAL_KEY_STORE;
3130 /* Handle "building doors" -KMW- */
3131 else if (have_flag(f_ptr->flags, FF_BLDG))
3137 /* Hack -- Enter building */
3138 command_new = SPECIAL_KEY_BUILDING;
3141 /* Handle quest areas -KMW- */
3142 else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3148 /* Hack -- Enter quest level */
3149 command_new = SPECIAL_KEY_QUEST;
3152 else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
3154 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
3156 complete_quest(p_ptr->inside_quest);
3159 leave_quest_check();
3161 p_ptr->inside_quest = c_ptr->special;
3166 p_ptr->leaving = TRUE;
3169 /* Set off a trap */
3170 else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
3176 if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
3180 msg_print("¥È¥é¥Ã¥×¤À¡ª");
3182 msg_print("You found a trap!");
3186 disclose_grid(py, px);
3190 hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
3192 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3195 /* Warn when leaving trap detected region */
3196 if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
3197 && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
3199 /* No duplicate warning */
3200 p_ptr->dtrap = FALSE;
3202 /* You are just on the edge */
3203 if (!(c_ptr->info & CAVE_UNSAFE))
3205 if (alert_trap_detect)
3208 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
3210 msg_print("*Leaving trap detect region!*");
3214 if (disturb_trap_detect) disturb(0, 1);
3218 return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
3222 bool trap_can_be_ignored(int feat)
3224 feature_type *f_ptr = &f_info[feat];
3226 if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE;
3228 switch (f_ptr->subtype)
3232 case TRAP_SPIKED_PIT:
3233 case TRAP_POISON_PIT:
3234 if (p_ptr->levitation) return TRUE;
3237 if (p_ptr->anti_tele) return TRUE;
3240 if (p_ptr->immune_fire) return TRUE;
3243 if (p_ptr->immune_acid) return TRUE;
3246 if (p_ptr->resist_blind) return TRUE;
3249 if (p_ptr->resist_conf) return TRUE;
3252 if (p_ptr->resist_pois) return TRUE;
3255 if (p_ptr->free_act) return TRUE;
3264 * Determine if a "boundary" grid is "floor mimic"
3266 #define boundary_floor(C, F, MF) \
3267 ((C)->mimic && permanent_wall(F) && \
3268 (have_flag((MF)->flags, FF_MOVE) || have_flag((MF)->flags, FF_CAN_FLY)) && \
3269 have_flag((MF)->flags, FF_PROJECT) && \
3270 !have_flag((MF)->flags, FF_OPEN))
3273 * Move player in the given direction, with the given "pickup" flag.
3275 * This routine should (probably) always induce energy expenditure.
3277 * Note that moving will *always* take a turn, and will *always* hit
3278 * any monster which might be in the destination grid. Previously,
3279 * moving into walls was "free" and did NOT hit invisible monsters.
3281 void move_player(int dir, bool do_pickup, bool break_trap)
3283 /* Find the result of moving */
3284 int y = py + ddy[dir];
3285 int x = px + ddx[dir];
3287 /* Examine the destination */
3288 cave_type *c_ptr = &cave[y][x];
3290 feature_type *f_ptr = &f_info[c_ptr->feat];
3292 monster_type *m_ptr;
3294 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
3295 monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
3299 bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
3300 bool p_can_kill_walls = FALSE;
3301 bool stormbringer = FALSE;
3303 bool oktomove = TRUE;
3304 bool do_past = FALSE;
3307 if (!dun_level && !p_ptr->wild_mode &&
3308 ((x == 0) || (x == MAX_WID - 1) ||
3309 (y == 0) || (y == MAX_HGT - 1)))
3311 /* Can the player enter the grid? */
3312 if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
3314 /* Hack: move to new area */
3315 if ((y == 0) && (x == 0))
3317 p_ptr->wilderness_y--;
3318 p_ptr->wilderness_x--;
3319 p_ptr->oldpy = cur_hgt - 2;
3320 p_ptr->oldpx = cur_wid - 2;
3321 ambush_flag = FALSE;
3324 else if ((y == 0) && (x == MAX_WID - 1))
3326 p_ptr->wilderness_y--;
3327 p_ptr->wilderness_x++;
3328 p_ptr->oldpy = cur_hgt - 2;
3330 ambush_flag = FALSE;
3333 else if ((y == MAX_HGT - 1) && (x == 0))
3335 p_ptr->wilderness_y++;
3336 p_ptr->wilderness_x--;
3338 p_ptr->oldpx = cur_wid - 2;
3339 ambush_flag = FALSE;
3342 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3344 p_ptr->wilderness_y++;
3345 p_ptr->wilderness_x++;
3348 ambush_flag = FALSE;
3353 p_ptr->wilderness_y--;
3354 p_ptr->oldpy = cur_hgt - 2;
3356 ambush_flag = FALSE;
3359 else if (y == MAX_HGT - 1)
3361 p_ptr->wilderness_y++;
3364 ambush_flag = FALSE;
3369 p_ptr->wilderness_x--;
3370 p_ptr->oldpx = cur_wid - 2;
3372 ambush_flag = FALSE;
3375 else if (x == MAX_WID - 1)
3377 p_ptr->wilderness_x++;
3380 ambush_flag = FALSE;
3383 p_ptr->leaving = TRUE;
3389 /* "Blocked" message appears later */
3390 /* oktomove = FALSE; */
3391 p_can_enter = FALSE;
3394 /* Get the monster */
3395 m_ptr = &m_list[c_ptr->m_idx];
3398 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3399 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3401 /* Player can not walk through "walls"... */
3402 /* unless in Shadow Form */
3403 p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
3404 (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
3405 !have_flag(f_ptr->flags, FF_PERMANENT);
3407 /* Hack -- attack monsters */
3408 if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
3410 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3412 /* Attack -- only if we can see it OR it is not in a wall */
3413 if (!is_hostile(m_ptr) &&
3414 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3415 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3416 pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls))
3418 /* Disturb the monster */
3419 (void)set_monster_csleep(c_ptr->m_idx, 0);
3421 /* Extract monster name (or "it") */
3422 monster_desc(m_name, m_ptr, 0);
3426 /* Auto-Recall if possible and visible */
3427 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
3429 /* Track a new monster */
3430 health_track(c_ptr->m_idx);
3434 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3439 else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0))
3446 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3448 msg_format("%^s is in your way!", m_name);
3455 /* now continue on to 'movement' */
3464 if (oktomove && p_ptr->riding)
3466 if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
3469 msg_print("Æ°¤±¤Ê¤¤¡ª");
3471 msg_print("Can't move!");
3477 else if (MON_MONFEAR(riding_m_ptr))
3481 /* Acquire the monster name */
3482 monster_desc(m_name, riding_m_ptr, 0);
3484 /* Dump a message */
3486 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3488 msg_format("%^s is too scared to control.", m_name);
3493 else if (p_ptr->riding_ryoute)
3498 else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
3502 else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
3506 else if (have_flag(f_ptr->flags, FF_WATER) &&
3507 !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
3508 (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
3511 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3513 msg_print("Can't swim.");
3519 else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
3522 msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(&cave[py][px])].name);
3524 msg_print("Can't land.");
3530 else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3533 msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3535 msg_print("Too hot to go through.");
3542 if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
3545 monster_desc(m_name, riding_m_ptr, 0);
3547 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3549 msg_format("You cannot control stunned %s!",m_name);
3560 else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
3563 msg_format("¶õ¤òÈô¤Ð¤Ê¤¤¤È%s¤Î¾å¤Ë¤Ï¹Ô¤±¤Ê¤¤¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
3565 msg_format("You need to fly to go through the %s.", f_name + f_info[get_feat_mimic(c_ptr)].name);
3574 * Player can move through trees and
3575 * has effective -10 speed
3576 * Rangers can move without penality
3578 else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
3580 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) energy_use *= 2;
3583 #ifdef ALLOW_EASY_DISARM /* TNB */
3585 /* Disarm a visible trap */
3586 else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
3588 if (!trap_can_be_ignored(c_ptr->feat))
3590 (void)do_cmd_disarm_aux(y, x, dir);
3595 #endif /* ALLOW_EASY_DISARM -- TNB */
3597 /* Player can not walk through "walls" unless in wraith form...*/
3598 else if (!p_can_enter && !p_can_kill_walls)
3600 /* Feature code (applying "mimic" field) */
3601 s16b feat = get_feat_mimic(c_ptr);
3602 feature_type *mimic_f_ptr = &f_info[feat];
3603 cptr name = f_name + mimic_f_ptr->name;
3607 /* Notice things in the dark */
3608 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3610 /* Boundary floor mimic */
3611 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3614 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
3616 msg_print("You feel you cannot go any more.");
3620 /* Wall (or secret door) */
3624 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
3626 msg_format("You feel %s %s blocking your way.",
3627 is_a_vowel(name[0]) ? "an" : "a", name);
3630 c_ptr->info |= (CAVE_MARK);
3638 /* Boundary floor mimic */
3639 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3642 msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
3644 msg_print("You cannot go any more.");
3647 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3651 /* Wall (or secret door) */
3654 #ifdef ALLOW_EASY_OPEN
3656 if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
3657 #endif /* ALLOW_EASY_OPEN */
3660 msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
3662 msg_format("There is %s %s blocking your way.",
3663 is_a_vowel(name[0]) ? "an" : "a", name);
3667 * Well, it makes sense that you lose time bumping into
3668 * a wall _if_ you are confused, stunned or blind; but
3669 * typing mistakes should not cost you a turn...
3671 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3676 /* Disturb the player */
3680 if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
3683 /* Normal movement */
3684 if (oktomove && !pattern_seq(py, px, y, x))
3686 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3691 /* To avoid a loop with running */
3697 /* Normal movement */
3700 u32b mpe_mode = MPE_ENERGY_USE;
3704 if (!process_warning(x, y))
3714 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
3716 msg_format("You push past %s.", m_name);
3720 /* Change oldpx and oldpy to place the player well when going back to big mode */
3721 if (p_ptr->wild_mode)
3723 if (ddy[dir] > 0) p_ptr->oldpy = 1;
3724 if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
3725 if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
3726 if (ddx[dir] > 0) p_ptr->oldpx = 1;
3727 if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
3728 if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
3731 if (p_can_kill_walls)
3733 cave_alter_feat(y, x, FF_HURT_DISI);
3735 /* Update some things -- similar to GF_KILL_WALL */
3736 p_ptr->update |= (PU_FLOW);
3740 /* sound(SOUND_WALK); */
3742 #ifdef ALLOW_EASY_DISARM /* TNB */
3744 if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
3746 #else /* ALLOW_EASY_DISARM -- TNB */
3748 if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
3750 #endif /* ALLOW_EASY_DISARM -- TNB */
3752 if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
3754 /* Move the player */
3755 (void)move_player_effect(y, x, mpe_mode);
3760 static bool ignore_avoid_run;
3763 * Hack -- Check for a "known wall" (see below)
3765 static int see_wall(int dir, int y, int x)
3769 /* Get the new location */
3773 /* Illegal grids are not known walls */
3774 if (!in_bounds2(y, x)) return (FALSE);
3777 c_ptr = &cave[y][x];
3779 /* Must be known to the player */
3780 if (c_ptr->info & (CAVE_MARK))
3782 /* Feature code (applying "mimic" field) */
3783 s16b feat = get_feat_mimic(c_ptr);
3784 feature_type *f_ptr = &f_info[feat];
3786 /* Wall grids are known walls */
3787 if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
3789 /* Don't run on a tree unless explicitly requested */
3790 if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
3793 /* Don't run in a wall */
3794 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
3795 return !have_flag(f_ptr->flags, FF_DOOR);
3803 * Hack -- Check for an "unknown corner" (see below)
3805 static int see_nothing(int dir, int y, int x)
3807 /* Get the new location */
3811 /* Illegal grids are unknown */
3812 if (!in_bounds2(y, x)) return (TRUE);
3814 /* Memorized grids are always known */
3815 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
3817 /* Viewable door/wall grids are known */
3818 if (player_can_see_bold(y, x)) return (FALSE);
3829 * The running algorithm: -CJS-
3831 * In the diagrams below, the player has just arrived in the
3832 * grid marked as '@', and he has just come from a grid marked
3833 * as 'o', and he is about to enter the grid marked as 'x'.
3835 * Of course, if the "requested" move was impossible, then you
3836 * will of course be blocked, and will stop.
3838 * Overview: You keep moving until something interesting happens.
3839 * If you are in an enclosed space, you follow corners. This is
3840 * the usual corridor scheme. If you are in an open space, you go
3841 * straight, but stop before entering enclosed space. This is
3842 * analogous to reaching doorways. If you have enclosed space on
3843 * one side only (that is, running along side a wall) stop if
3844 * your wall opens out, or your open space closes in. Either case
3845 * corresponds to a doorway.
3847 * What happens depends on what you can really SEE. (i.e. if you
3848 * have no light, then running along a dark corridor is JUST like
3849 * running in a dark room.) The algorithm works equally well in
3850 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
3852 * These conditions are kept in static memory:
3853 * find_openarea You are in the open on at least one
3855 * find_breakleft You have a wall on the left, and will
3857 * find_breakright You have a wall on the right, and will
3860 * To initialize these conditions, we examine the grids adjacent
3861 * to the grid marked 'x', two on each side (marked 'L' and 'R').
3862 * If either one of the two grids on a given side is seen to be
3863 * closed, then that side is considered to be closed. If both
3864 * sides are closed, then it is an enclosed (corridor) run.
3870 * Looking at more than just the immediate squares is
3871 * significant. Consider the following case. A run along the
3872 * corridor will stop just before entering the center point,
3873 * because a choice is clearly established. Running in any of
3874 * three available directions will be defined as a corridor run.
3875 * Note that a minor hack is inserted to make the angled corridor
3876 * entry (with one side blocked near and the other side blocked
3877 * further away from the runner) work correctly. The runner moves
3878 * diagonally, but then saves the previous direction as being
3879 * straight into the gap. Otherwise, the tail end of the other
3880 * entry would be perceived as an alternative on the next move.
3888 * Likewise, a run along a wall, and then into a doorway (two
3889 * runs) will work correctly. A single run rightwards from @ will
3890 * stop at 1. Another run right and down will enter the corridor
3891 * and make the corner, stopping at the 2.
3893 * ##################
3895 * ########### ######
3899 * After any move, the function area_affect is called to
3900 * determine the new surroundings, and the direction of
3901 * subsequent moves. It examines the current player location
3902 * (at which the runner has just arrived) and the previous
3903 * direction (from which the runner is considered to have come).
3905 * Moving one square in some direction places you adjacent to
3906 * three or five new squares (for straight and diagonal moves
3907 * respectively) to which you were not previously adjacent,
3908 * marked as '!' in the diagrams below.
3911 * .o@! (normal) .o.! (diagonal)
3912 * ...! (east) ..@! (south east)
3915 * You STOP if any of the new squares are interesting in any way:
3916 * for example, if they contain visible monsters or treasure.
3918 * You STOP if any of the newly adjacent squares seem to be open,
3919 * and you are also looking for a break on that side. (that is,
3920 * find_openarea AND find_break).
3922 * You STOP if any of the newly adjacent squares do NOT seem to be
3923 * open and you are in an open area, and that side was previously
3926 * Corners: If you are not in the open (i.e. you are in a corridor)
3927 * and there is only one way to go in the new squares, then turn in
3928 * that direction. If there are more than two new ways to go, STOP.
3929 * If there are two ways to go, and those ways are separated by a
3930 * square which does not seem to be open, then STOP.
3932 * Otherwise, we have a potential corner. There are two new open
3933 * squares, which are also adjacent. One of the new squares is
3934 * diagonally located, the other is straight on (as in the diagram).
3935 * We consider two more squares further out (marked below as ?).
3937 * We assign "option" to the straight-on grid, and "option2" to the
3938 * diagonal grid, and "check_dir" to the grid marked 's'.
3944 * If they are both seen to be closed, then it is seen that no benefit
3945 * is gained from moving straight. It is a known corner. To cut the
3946 * corner, go diagonally, otherwise go straight, but pretend you
3947 * stepped diagonally into that next location for a full view next
3948 * time. Conversely, if one of the ? squares is not seen to be closed,
3949 * then there is a potential choice. We check to see whether it is a
3950 * potential corner or an intersection/room entrance. If the square
3951 * two spaces straight ahead, and the space marked with 's' are both
3952 * unknown space, then it is a potential corner and enter if
3953 * find_examine is set, otherwise must stop because it is not a
3954 * corner. (find_examine option is removed and always is TRUE.)
3961 * Hack -- allow quick "cycling" through the legal directions
3963 static byte cycle[] =
3964 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
3967 * Hack -- map each direction into the "middle" of the "cycle[]" array
3969 static byte chome[] =
3970 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
3973 * The direction we are running
3975 static byte find_current;
3978 * The direction we came from
3980 static byte find_prevdir;
3983 * We are looking for open area
3985 static bool find_openarea;
3988 * We are looking for a break
3990 static bool find_breakright;
3991 static bool find_breakleft;
3996 * Initialize the running algorithm for a new direction.
3998 * Diagonal Corridor -- allow diaginal entry into corridors.
4000 * Blunt Corridor -- If there is a wall two spaces ahead and
4001 * we seem to be in a corridor, then force a turn into the side
4002 * corridor, must be moving straight into a corridor here. ???
4004 * Diagonal Corridor Blunt Corridor (?)
4009 static void run_init(int dir)
4011 int row, col, deepleft, deepright;
4012 int i, shortleft, shortright;
4015 /* Save the direction */
4018 /* Assume running straight */
4021 /* Assume looking for open area */
4022 find_openarea = TRUE;
4024 /* Assume not looking for breaks */
4025 find_breakright = find_breakleft = FALSE;
4027 /* Assume no nearby walls */
4028 deepleft = deepright = FALSE;
4029 shortright = shortleft = FALSE;
4034 /* Find the destination grid */
4035 row = py + ddy[dir];
4036 col = px + ddx[dir];
4038 ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN);
4040 /* Extract cycle index */
4043 /* Check for walls */
4044 if (see_wall(cycle[i+1], py, px))
4046 find_breakleft = TRUE;
4049 else if (see_wall(cycle[i+1], row, col))
4051 find_breakleft = TRUE;
4055 /* Check for walls */
4056 if (see_wall(cycle[i-1], py, px))
4058 find_breakright = TRUE;
4061 else if (see_wall(cycle[i-1], row, col))
4063 find_breakright = TRUE;
4067 /* Looking for a break */
4068 if (find_breakleft && find_breakright)
4070 /* Not looking for open area */
4071 find_openarea = FALSE;
4073 /* Hack -- allow angled corridor entry */
4076 if (deepleft && !deepright)
4078 find_prevdir = cycle[i - 1];
4080 else if (deepright && !deepleft)
4082 find_prevdir = cycle[i + 1];
4086 /* Hack -- allow blunt corridor entry */
4087 else if (see_wall(cycle[i], row, col))
4089 if (shortleft && !shortright)
4091 find_prevdir = cycle[i - 2];
4093 else if (shortright && !shortleft)
4095 find_prevdir = cycle[i + 2];
4103 * Update the current "run" path
4105 * Return TRUE if the running should be stopped
4107 static bool run_test(void)
4109 int prev_dir, new_dir, check_dir = 0;
4112 int option = 0, option2 = 0;
4115 feature_type *f_ptr;
4117 /* Where we came from */
4118 prev_dir = find_prevdir;
4121 /* Range of newly adjacent grids */
4122 max = (prev_dir & 0x01) + 1;
4124 /* break run when leaving trap detected region */
4125 if ((disturb_trap_detect || alert_trap_detect)
4126 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4128 /* No duplicate warning */
4129 p_ptr->dtrap = FALSE;
4131 /* You are just on the edge */
4132 if (!(cave[py][px].info & CAVE_UNSAFE))
4134 if (alert_trap_detect)
4137 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4139 msg_print("*Leaving trap detect region!*");
4143 if (disturb_trap_detect)
4151 /* Look at every newly adjacent square. */
4152 for (i = -max; i <= max; i++)
4154 s16b this_o_idx, next_o_idx = 0;
4157 new_dir = cycle[chome[prev_dir] + i];
4160 row = py + ddy[new_dir];
4161 col = px + ddx[new_dir];
4164 c_ptr = &cave[row][col];
4166 /* Feature code (applying "mimic" field) */
4167 feat = get_feat_mimic(c_ptr);
4168 f_ptr = &f_info[feat];
4170 /* Visible monsters abort running */
4173 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4175 /* Visible monster */
4176 if (m_ptr->ml) return (TRUE);
4179 /* Visible objects abort running */
4180 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4184 /* Acquire object */
4185 o_ptr = &o_list[this_o_idx];
4187 /* Acquire next object */
4188 next_o_idx = o_ptr->next_o_idx;
4190 /* Visible object */
4191 if (o_ptr->marked & OM_FOUND) return (TRUE);
4194 /* Assume unknown */
4197 /* Check memorized grids */
4198 if (c_ptr->info & (CAVE_MARK))
4200 bool notice = have_flag(f_ptr->flags, FF_NOTICE);
4202 if (notice && have_flag(f_ptr->flags, FF_MOVE))
4205 if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
4207 /* Option -- ignore */
4212 else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
4214 /* Option -- ignore */
4219 else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
4226 else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
4227 (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
4234 /* Interesting feature */
4235 if (notice) return (TRUE);
4237 /* The grid is "visible" */
4241 /* Analyze unknown grids and floors considering mimic */
4242 if (inv || !see_wall(0, row, col))
4244 /* Looking for open area */
4250 /* The first new direction. */
4256 /* Three new directions. Stop running. */
4262 /* Two non-adjacent new directions. Stop running. */
4263 else if (option != cycle[chome[prev_dir] + i - 1])
4268 /* Two new (adjacent) directions (case 1) */
4269 else if (new_dir & 0x01)
4271 check_dir = cycle[chome[prev_dir] + i - 2];
4275 /* Two new (adjacent) directions (case 2) */
4278 check_dir = cycle[chome[prev_dir] + i + 1];
4284 /* Obstacle, while looking for open area */
4291 /* Break to the right */
4292 find_breakright = TRUE;
4297 /* Break to the left */
4298 find_breakleft = TRUE;
4304 /* Looking for open area */
4307 /* Hack -- look again */
4308 for (i = -max; i < 0; i++)
4310 /* Unknown grid or non-wall */
4311 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4313 /* Looking to break right */
4314 if (find_breakright)
4323 /* Looking to break left */
4331 /* Hack -- look again */
4332 for (i = max; i > 0; i--)
4334 /* Unknown grid or non-wall */
4335 if (!see_wall(cycle[chome[prev_dir] + i], py, px))
4337 /* Looking to break left */
4347 /* Looking to break right */
4348 if (find_breakright)
4356 /* Not looking for open area */
4368 /* Primary option */
4369 find_current = option;
4371 /* No other options */
4372 find_prevdir = option;
4375 /* Two options, examining corners */
4378 /* Primary option */
4379 find_current = option;
4381 /* Hack -- allow curving */
4382 find_prevdir = option2;
4385 /* Two options, pick one */
4388 /* Get next location */
4389 row = py + ddy[option];
4390 col = px + ddx[option];
4392 /* Don't see that it is closed off. */
4393 /* This could be a potential corner or an intersection. */
4394 if (!see_wall(option, row, col) ||
4395 !see_wall(check_dir, row, col))
4397 /* Can not see anything ahead and in the direction we */
4398 /* are turning, assume that it is a potential corner. */
4399 if (see_nothing(option, row, col) &&
4400 see_nothing(option2, row, col))
4402 find_current = option;
4403 find_prevdir = option2;
4406 /* STOP: we are next to an intersection or a room */
4413 /* This corner is seen to be enclosed; we cut the corner. */
4416 find_current = option2;
4417 find_prevdir = option2;
4420 /* This corner is seen to be enclosed, and we */
4421 /* deliberately go the long way. */
4424 find_current = option;
4425 find_prevdir = option2;
4430 /* About to hit a known wall, stop */
4431 if (see_wall(find_current, py, px))
4443 * Take one step along the current "run" path
4445 void run_step(int dir)
4450 /* Ignore AVOID_RUN on a first step */
4451 ignore_avoid_run = TRUE;
4453 /* Hack -- do not start silly run */
4454 if (see_wall(dir, py, px))
4458 msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£");
4460 msg_print("You cannot run in that direction.");
4488 /* Decrease the run counter */
4489 if (--running <= 0) return;
4494 /* Move the player, using the "pickup" flag */
4495 #ifdef ALLOW_EASY_DISARM /* TNB */
4497 move_player(find_current, FALSE, FALSE);
4499 #else /* ALLOW_EASY_DISARM -- TNB */
4501 move_player(find_current, always_pickup, FALSE);
4503 #endif /* ALLOW_EASY_DISARM -- TNB */
4505 if (player_bold(p_ptr->run_py, p_ptr->run_px))
4516 * Test for traveling
4518 static int travel_test(int prev_dir)
4522 const cave_type *c_ptr;
4525 /* Cannot travel when blind */
4526 if (p_ptr->blind || no_lite())
4528 msg_print(_("Ìܤ¬¸«¤¨¤Ê¤¤¡ª", "You cannot see!"));
4532 /* break run when leaving trap detected region */
4533 if ((disturb_trap_detect || alert_trap_detect)
4534 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4536 /* No duplicate warning */
4537 p_ptr->dtrap = FALSE;
4539 /* You are just on the edge */
4540 if (!(cave[py][px].info & CAVE_UNSAFE))
4542 if (alert_trap_detect)
4545 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4547 msg_print("*Leaving trap detect region!*");
4551 if (disturb_trap_detect)
4559 /* Range of newly adjacent grids */
4560 max = (prev_dir & 0x01) + 1;
4562 /* Look at every newly adjacent square. */
4563 for (i = -max; i <= max; i++)
4566 int dir = cycle[chome[prev_dir] + i];
4569 int row = py + ddy[dir];
4570 int col = px + ddx[dir];
4573 c_ptr = &cave[row][col];
4575 /* Visible monsters abort running */
4578 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4580 /* Visible monster */
4581 if (m_ptr->ml) return (0);
4586 /* Travel cost of current grid */
4587 cost = travel.cost[py][px];
4589 /* Determine travel direction */
4590 for (i = 0; i < 8; ++ i) {
4591 int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]];
4593 if (dir_cost < cost)
4600 if (!new_dir) return (0);
4602 /* Access newly move grid */
4603 c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]];
4605 /* Close door abort traveling */
4606 if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
4608 /* Visible and unignorable trap abort tarveling */
4609 if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
4619 void travel_step(void)
4621 /* Get travel direction */
4622 travel.dir = travel_test(travel.dir);
4627 if (travel.run == 255)
4630 msg_print("Æ»¶Ú¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡ª");
4632 msg_print("No route is found!");
4634 travel.y = travel.x = 0;
4642 move_player(travel.dir, always_pickup, FALSE);
4644 if ((py == travel.y) && (px == travel.x))
4647 travel.y = travel.x = 0;
4649 else if (travel.run > 0)
4653 Term_xtra(TERM_XTRA_DELAY, delay_factor);