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.
13 * The running algorithm: -CJS-
15 * In the diagrams below, the player has just arrived in the
16 * grid marked as '@', and he has just come from a grid marked
17 * as 'o', and he is about to enter the grid marked as 'x'.
19 * Of course, if the "requested" move was impossible, then you
20 * will of course be blocked, and will stop.
22 * Overview: You keep moving until something interesting happens.
23 * If you are in an enclosed space, you follow corners. This is
24 * the usual corridor scheme. If you are in an open space, you go
25 * straight, but stop before entering enclosed space. This is
26 * analogous to reaching doorways. If you have enclosed space on
27 * one side only (that is, running along side a wall) stop if
28 * your wall opens out, or your open space closes in. Either case
29 * corresponds to a doorway.
31 * What happens depends on what you can really SEE. (i.e. if you
32 * have no light, then running along a dark corridor is JUST like
33 * running in a dark room.) The algorithm works equally well in
34 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
36 * These conditions are kept in static memory:
37 * find_openarea You are in the open on at least one
39 * find_breakleft You have a wall on the left, and will
41 * find_breakright You have a wall on the right, and will
44 * To initialize these conditions, we examine the grids adjacent
45 * to the grid marked 'x', two on each side (marked 'L' and 'R').
46 * If either one of the two grids on a given side is seen to be
47 * closed, then that side is considered to be closed. If both
48 * sides are closed, then it is an enclosed (corridor) run.
54 * Looking at more than just the immediate squares is
55 * significant. Consider the following case. A run along the
56 * corridor will stop just before entering the center point,
57 * because a choice is clearly established. Running in any of
58 * three available directions will be defined as a corridor run.
59 * Note that a minor hack is inserted to make the angled corridor
60 * entry (with one side blocked near and the other side blocked
61 * further away from the runner) work correctly. The runner moves
62 * diagonally, but then saves the previous direction as being
63 * straight into the gap. Otherwise, the tail end of the other
64 * entry would be perceived as an alternative on the next move.
72 * Likewise, a run along a wall, and then into a doorway (two
73 * runs) will work correctly. A single run rightwards from \@ will
74 * stop at 1. Another run right and down will enter the corridor
75 * and make the corner, stopping at the 2.
77 * \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
79 * \#\#\#\#\#\#\#\#\#\#\# \#\#\#\#\#\#
81 * \#\#\#\#\#\#\#\#\#\#\#\#\#
83 * After any move, the function area_affect is called to
84 * determine the new surroundings, and the direction of
85 * subsequent moves. It examines the current player location
86 * (at which the runner has just arrived) and the previous
87 * direction (from which the runner is considered to have come).
89 * Moving one square in some direction places you adjacent to
90 * three or five new squares (for straight and diagonal moves
91 * respectively) to which you were not previously adjacent,
92 * marked as '!' in the diagrams below.
95 * .o@@! (normal) .o.! (diagonal)
96 * ...! (east) ..@@! (south east)
99 * You STOP if any of the new squares are interesting in any way:
100 * for example, if they contain visible monsters or treasure.
102 * You STOP if any of the newly adjacent squares seem to be open,
103 * and you are also looking for a break on that side. (that is,
104 * find_openarea AND find_break).
106 * You STOP if any of the newly adjacent squares do NOT seem to be
107 * open and you are in an open area, and that side was previously
110 * Corners: If you are not in the open (i.e. you are in a corridor)
111 * and there is only one way to go in the new squares, then turn in
112 * that direction. If there are more than two new ways to go, STOP.
113 * If there are two ways to go, and those ways are separated by a
114 * square which does not seem to be open, then STOP.
116 * Otherwise, we have a potential corner. There are two new open
117 * squares, which are also adjacent. One of the new squares is
118 * diagonally located, the other is straight on (as in the diagram).
119 * We consider two more squares further out (marked below as ?).
121 * We assign "option" to the straight-on grid, and "option2" to the
122 * diagonal grid, and "check_dir" to the grid marked 's'.
128 * If they are both seen to be closed, then it is seen that no benefit
129 * is gained from moving straight. It is a known corner. To cut the
130 * corner, go diagonally, otherwise go straight, but pretend you
131 * stepped diagonally into that next location for a full view next
132 * time. Conversely, if one of the ? squares is not seen to be closed,
133 * then there is a potential choice. We check to see whether it is a
134 * potential corner or an intersection/room entrance. If the square
135 * two spaces straight ahead, and the space marked with 's' are both
136 * unknown space, then it is a potential corner and enter if
137 * find_examine is set, otherwise must stop because it is not a
138 * corner. (find_examine option is removed and always is TRUE.)
144 #define MAX_VAMPIRIC_DRAIN 50 /*!< 吸血処理の最大回復HP */
148 * @brief プレイヤーからモンスターへの射撃命中判定 /
149 * Determine if the player "hits" a monster (normal combat).
150 * @param chance 基本命中値
151 * @param m_ptr モンスターの構造体参照ポインタ
152 * @param vis 目標を視界に捕らえているならばTRUEを指定
153 * @param o_name メッセージ表示時のモンスター名
154 * @return 命中と判定された場合TRUEを返す
155 * @note Always miss 5%, always hit 5%, otherwise random.
157 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
160 monster_race *r_ptr = &r_info[m_ptr->r_idx];
162 /* Percentile dice */
165 /* Snipers with high-concentration reduce instant miss percentage.*/
168 /* Hack -- Instant miss or hit */
169 if (k <= 5) return (FALSE);
170 if (k > 95) return (TRUE);
172 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
173 if (one_in_(20)) return (FALSE);
176 if (chance <= 0) return (FALSE);
181 ac *= (8 - p_ptr->concent);
185 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
187 /* Invisible monsters are harder to hit */
188 if (!vis) chance = (chance + 1) / 2;
190 /* Power competes against armor */
191 if (randint0(chance) < (ac * 3 / 4))
193 if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
197 /* Extract monster name */
198 monster_desc(m_name, m_ptr, 0);
199 msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
211 * @brief プレイヤーからモンスターへの打撃命中判定 /
212 * Determine if the player "hits" a monster (normal combat).
213 * @param chance 基本命中値
215 * @param vis 目標を視界に捕らえているならばTRUEを指定
216 * @return 命中と判定された場合TRUEを返す
217 * @note Always miss 5%, always hit 5%, otherwise random.
219 bool test_hit_norm(int chance, int ac, int vis)
223 /* Percentile dice */
226 /* Hack -- Instant miss or hit */
227 if (k < 10) return (k < 5);
229 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
230 if (one_in_(20)) return (FALSE);
232 /* Wimpy attack never hits */
233 if (chance <= 0) return (FALSE);
235 /* Penalize invisible targets */
236 if (!vis) chance = (chance + 1) / 2;
238 /* Power must defeat armor */
239 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
248 * @brief プレイヤーからモンスターへの射撃クリティカル判定 /
249 * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
250 * @param weight 矢弾の重量
251 * @param plus_ammo 矢弾の命中修正
252 * @param plus_bow 弓の命中修正
253 * @param dam 現在算出中のダメージ値
254 * @return クリティカル修正が入ったダメージ値
256 s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
259 object_type *j_ptr = &inventory[INVEN_BOW];
261 /* Extract "shot" power */
262 i = p_ptr->to_h_b + plus_ammo;
264 if (p_ptr->tval_ammo == TV_BOLT)
265 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
267 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
270 /* Snipers can shot more critically with crossbows */
271 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
272 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
274 /* Good bow makes more critical */
275 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
278 if (randint1(10000) <= i)
280 k = weight * randint1(500);
284 msg_print(_("手ごたえがあった!", "It was a good hit!"));
289 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
294 msg_print(_("会心の一撃だ!", "It was a superb hit!"));
305 * @brief プレイヤーからモンスターへの打撃クリティカル判定 /
306 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
307 * @param weight 矢弾の重量
308 * @param plus 武器の命中修正
309 * @param dam 現在算出中のダメージ値
310 * @param meichuu 打撃の基本命中力
311 * @param mode オプションフラグ
312 * @return クリティカル修正が入ったダメージ値
314 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
318 /* Extract "blow" power */
319 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
322 if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
324 k = weight + randint1(650);
325 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
329 msg_print(_("手ごたえがあった!", "It was a good hit!"));
335 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
340 msg_print(_("会心の一撃だ!", "It was a superb hit!"));
345 msg_print(_("最高の会心の一撃だ!", "It was a *GREAT* hit!"));
350 msg_print(_("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!"));
351 dam = ((7 * dam) / 2) + 25;
361 * @brief プレイヤー攻撃の種族スレイング倍率計算
362 * @param mult 算出前の基本倍率(/10倍)
363 * @param flgs スレイフラグ配列
364 * @param m_ptr 目標モンスターの構造体参照ポインタ
365 * @return スレイング加味後の倍率(/10倍)
367 static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
369 static const struct slay_table_t {
371 u32b affect_race_flag;
374 size_t r_flag_offset;
376 #define OFFSET(X) offsetof(monster_race, X)
377 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
378 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
379 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
380 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
381 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
382 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
383 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
384 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
385 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
386 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
387 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
388 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
389 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
390 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
391 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
392 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
393 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
394 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
395 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
396 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
400 monster_race* r_ptr = &r_info[m_ptr->r_idx];
402 for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++ i)
404 const struct slay_table_t* p = &slay_table[i];
406 if ((have_flag(flgs, p->slay_flag)) &&
407 (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
409 if (is_original_ap_and_seen(m_ptr))
411 atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
414 mult = MAX(mult, p->slay_mult);
422 * @brief プレイヤー攻撃の属性スレイング倍率計算
423 * @param mult 算出前の基本倍率(/10倍)
424 * @param flgs スレイフラグ配列
425 * @param m_ptr 目標モンスターの構造体参照ポインタ
426 * @return スレイング加味後の倍率(/10倍)
428 static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
430 static const struct brand_table_t {
435 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
436 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
437 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
438 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
439 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
442 monster_race* r_ptr = &r_info[m_ptr->r_idx];
444 for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++ i)
446 const struct brand_table_t* p = &brand_table[i];
448 if (have_flag(flgs, p->brand_flag))
450 /* Notice immunity */
451 if (r_ptr->flagsr & p->resist_mask)
453 if (is_original_ap_and_seen(m_ptr))
455 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
459 /* Otherwise, take the damage */
460 else if (r_ptr->flags3 & p->hurt_flag)
462 if (is_original_ap_and_seen(m_ptr))
464 r_ptr->r_flags3 |= p->hurt_flag;
467 mult = MAX(mult, 50);
471 mult = MAX(mult, 25);
480 * @brief ダメージにスレイ要素を加える総合処理ルーチン /
481 * Extract the "total damage" from a given object hitting a given monster.
482 * @param o_ptr 使用武器オブジェクトの構造体参照ポインタ
483 * @param tdam 現在算出途中のダメージ値
484 * @param m_ptr 目標モンスターの構造体参照ポインタ
486 * @param thrown 射撃処理ならばTRUEを指定する
487 * @return 総合的なスレイを加味したダメージ値
489 * Note that "flasks of oil" do NOT do fire damage, although they\n
490 * certainly could be made to do so. XXX XXX\n
492 * Note that most brands and slays are x3, except Slay Animal (x2),\n
493 * Slay Evil (x2), and Kill dragon (x5).\n
495 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
499 u32b flgs[TR_FLAG_SIZE];
501 /* Extract the flags */
502 object_flags(o_ptr, flgs);
503 torch_flags(o_ptr, flgs); /* torches has secret flags */
508 if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
509 if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
510 if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
511 if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
512 if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
515 /* Hex - Slay Good (Runesword) */
516 if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
518 /* Some "weapons" and "ammo" do extra damage */
531 mult = mult_slaying(mult, flgs, m_ptr);
533 /* Elemental Brand */
534 mult = mult_brand(mult, flgs, m_ptr);
537 if (p_ptr->pclass == CLASS_SAMURAI)
539 mult = mult_hissatsu(mult, flgs, m_ptr, mode);
543 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
545 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
546 p_ptr->redraw |= (PR_MANA);
547 mult = mult * 3 / 2 + 20;
550 /* Hack -- The Nothung cause special damage to Fafner */
551 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
556 if (mult > 150) mult = 150;
558 /* Return the total damage */
559 return (tdam * mult / 10);
564 * @brief 地形やその上のアイテムの隠された要素を明かす /
565 * Search for hidden things
566 * @param y 対象となるマスのY座標
567 * @param x 対象となるマスのX座標
570 static void discover_hidden_things(int y, int x)
572 s16b this_o_idx, next_o_idx = 0;
576 /* Access the grid */
580 if (c_ptr->mimic && is_trap(c_ptr->feat))
586 msg_print(_("トラップを発見した。", "You have found a trap."));
593 if (is_hidden_door(c_ptr))
596 msg_print(_("隠しドアを発見した。", "You have found a secret door."));
605 /* Scan all objects in the grid */
606 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
611 o_ptr = &o_list[this_o_idx];
613 /* Acquire next object */
614 next_o_idx = o_ptr->next_o_idx;
616 /* Skip non-chests */
617 if (o_ptr->tval != TV_CHEST) continue;
619 /* Skip non-trapped chests */
620 if (!chest_traps[o_ptr->pval]) continue;
623 if (!object_is_known(o_ptr))
626 msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
638 * @brief プレイヤーの探索処理判定
645 /* Start with base search ability */
646 chance = p_ptr->skill_srh;
648 /* Penalize various conditions */
649 if (p_ptr->blind || no_lite()) chance = chance / 10;
650 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
652 /* Search the nearby grids, which are always in bounds */
653 for (i = 0; i < 9; ++ i)
655 /* Sometimes, notice things */
656 if (randint0(100) < chance)
658 discover_hidden_things(p_ptr->y + ddy_ddd[i], p_ptr->x + ddx_ddd[i]);
665 * @brief プレイヤーがオブジェクトを拾った際のメッセージ表示処理 /
666 * Helper routine for py_pickup() and py_pickup_floor().
667 * @param o_idx 取得したオブジェクトの参照ID
670 * アイテムを拾った際に「2つのケーキを持っている」\n
671 * "You have two cakes." とアイテムを拾った後の合計のみの表示がオリジナル\n
673 * あるという指摘をうけたので、「~を拾った、~を持っている」という表示\n
675 * Add the given dungeon object to the character's inventory.\n
676 * Delete the object afterwards.\n
678 void py_pickup_aux(int o_idx)
683 char o_name[MAX_NLEN];
684 char old_name[MAX_NLEN];
688 char o_name[MAX_NLEN];
693 o_ptr = &o_list[o_idx];
696 /* Describe the object */
697 object_desc(old_name, o_ptr, OD_NAME_ONLY);
698 object_desc_kosuu(kazu_str, o_ptr);
699 hirottakazu = o_ptr->number;
701 /* Carry the object */
702 slot = inven_carry(o_ptr);
704 /* Get the object again */
705 o_ptr = &inventory[slot];
707 /* Delete the object */
708 delete_object_idx(o_idx);
710 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
712 bool old_known = identify_item(o_ptr);
714 /* Auto-inscription/destroy */
715 autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
717 /* If it is destroyed, don't pick it up */
718 if (o_ptr->marked & OM_AUTODESTROY) return;
721 /* Describe the object */
722 object_desc(o_name, o_ptr, 0);
726 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
728 msg_format("こうして、%sは『クリムゾン』を手に入れた。", p_ptr->name);
729 msg_print("しかし今、『混沌のサーペント』の放ったモンスターが、");
730 msg_format("%sに襲いかかる...", p_ptr->name);
736 msg_format("%s(%c)を持っている。",o_name, index_to_label(slot));
740 if (o_ptr->number > hirottakazu) {
741 msg_format("%s拾って、%s(%c)を持っている。",
742 kazu_str, o_name, index_to_label(slot));
744 msg_format("%s(%c)を拾った。", o_name, index_to_label(slot));
748 strcpy(record_o_name, old_name);
750 msg_format("You have %s (%c).", o_name, index_to_label(slot));
751 strcpy(record_o_name, o_name);
756 check_find_art_quest_completion(o_ptr);
761 * @brief プレイヤーがオブジェクト上に乗った際の表示処理
762 * @param pickup 自動拾い処理を行うならばTRUEとする
765 * Player "wants" to pick up an object or gold.
766 * Note that we ONLY handle things that can be picked up.
767 * See "move_player()" for handling of other things.
769 void carry(bool pickup)
771 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
773 s16b this_o_idx, next_o_idx = 0;
775 char o_name[MAX_NLEN];
777 /* Recenter the map around the player */
781 p_ptr->update |= (PU_MONSTERS);
784 p_ptr->redraw |= (PR_MAP);
787 p_ptr->window |= (PW_OVERHEAD);
792 /* Automatically pickup/destroy/inscribe items */
793 autopick_pickup_items(c_ptr);
796 #ifdef ALLOW_EASY_FLOOR
800 py_pickup_floor(pickup);
804 #endif /* ALLOW_EASY_FLOOR */
806 /* Scan the pile of objects */
807 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
812 o_ptr = &o_list[this_o_idx];
814 #ifdef ALLOW_EASY_SENSE /* TNB */
816 /* Option: Make item sensing easy */
819 /* Sense the object */
820 (void)sense_object(o_ptr);
823 #endif /* ALLOW_EASY_SENSE -- TNB */
825 /* Describe the object */
826 object_desc(o_name, o_ptr, 0);
828 /* Acquire next object */
829 next_o_idx = o_ptr->next_o_idx;
831 /* Hack -- disturb */
835 if (o_ptr->tval == TV_GOLD)
837 int value = (long)o_ptr->pval;
839 /* Delete the gold */
840 delete_object_idx(this_o_idx);
844 msg_format(" $%ld の価値がある%sを見つけた。",
845 (long)value, o_name);
847 msg_format("You collect %ld gold pieces worth of %s.",
848 (long)value, o_name);
854 /* Collect the gold */
858 p_ptr->redraw |= (PR_GOLD);
861 p_ptr->window |= (PW_PLAYER);
864 /* Pick up objects */
867 /* Hack - some objects were handled in autopick_pickup_items(). */
868 if (o_ptr->marked & OM_NOMSG)
870 /* Clear the flag. */
871 o_ptr->marked &= ~OM_NOMSG;
873 /* Describe the object */
876 msg_format(_("%sがある。", "You see %s."), o_name);
879 /* Note that the pack is too full */
880 else if (!inven_carry_okay(o_ptr))
882 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
885 /* Pick up the item (if requested and allowed) */
890 /* Hack -- query every item */
891 if (carry_query_flag)
893 char out_val[MAX_NLEN+20];
894 sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
895 okay = get_check(out_val);
898 /* Attempt to pick up an object. */
901 /* Pick up the object */
902 py_pickup_aux(this_o_idx);
911 * @brief プレイヤーへのトラップ命中判定 /
912 * Determine if a trap affects the player.
913 * @param power 基本回避難度
914 * @return トラップが命中した場合TRUEを返す。
916 * Always miss 5% of the time, Always hit 5% of the time.
917 * Otherwise, match trap power against player armor.
919 static int check_hit(int power)
923 /* Percentile dice */
926 /* Hack -- 5% hit, 5% miss */
927 if (k < 10) return (k < 5);
929 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
930 if (one_in_(20)) return (TRUE);
932 /* Paranoia -- No power */
933 if (power <= 0) return (FALSE);
936 ac = p_ptr->ac + p_ptr->to_a;
938 /* Power competes against Armor */
939 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
947 * @brief 落とし穴系トラップの判定とプレイヤーの被害処理
948 * @param trap_feat_type トラップの種別ID
951 static void hit_trap_pit(int trap_feat_type)
955 cptr spike_name = "";
957 switch (trap_feat_type)
960 trap_name = _("落とし穴", "a pit trap");
962 case TRAP_SPIKED_PIT:
963 trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit");
964 spike_name = _("スパイク", "spikes");
966 case TRAP_POISON_PIT:
967 trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit");
968 spike_name = _("毒を塗られたスパイク", "poisonous spikes");
974 if (p_ptr->levitation)
976 msg_format(_("%sを飛び越えた。", "You fly over %s."), trap_name);
980 msg_format(_("%sに落ちてしまった!", "You have fallen into %s!"), trap_name);
985 /* Extra spike damage */
986 if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
989 msg_format(_("%sが刺さった!", "You are impaled on %s!"), spike_name);
992 (void)set_cut(p_ptr->cut + randint1(dam));
994 if (trap_feat_type == TRAP_POISON_PIT) {
995 if (p_ptr->resist_pois || IS_OPPOSE_POIS())
997 msg_print(_("しかし毒の影響はなかった!", "The poison does not affect you!"));
1002 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
1007 /* Take the damage */
1008 take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
1012 * @brief ダーツ系トラップ(通常ダメージ)の判定とプレイヤーの被害処理
1013 * @return ダーツが命中した場合TRUEを返す
1015 static bool hit_trap_dart(void)
1021 msg_print(_("小さなダーツが飛んできて刺さった!", "A small dart hits you!"));
1023 take_hit(DAMAGE_ATTACK, damroll(1, 4), _("ダーツの罠", "a dart trap"), -1);
1025 if (!CHECK_MULTISHADOW()) hit = TRUE;
1029 msg_print(_("小さなダーツが飛んできた!が、運良く当たらなかった。", "A small dart barely misses you."));
1036 * @brief ダーツ系トラップ(通常ダメージ+能力値減少)の判定とプレイヤーの被害処理
1037 * @param stat 低下する能力値ID
1040 static void hit_trap_lose_stat(int stat)
1042 if (hit_trap_dart())
1049 * @brief ダーツ系トラップ(通常ダメージ+減速)の判定とプレイヤーの被害処理
1052 static void hit_trap_slow(void)
1054 if (hit_trap_dart())
1056 set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
1061 * @brief ダーツ系トラップ(通常ダメージ+状態異常)の判定とプレイヤーの被害処理
1062 * @param trap_message メッセージの補完文字列
1063 * @param resist 状態異常に抵抗する判定が出たならTRUE
1064 * @param set_status 状態異常を指定する関数ポインタ
1065 * @param turn 状態異常の追加ターン量
1068 static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int), int turn_aux)
1070 msg_print(trap_message);
1074 set_status(turn_aux);
1079 * @brief プレイヤーへのトラップ作動処理メインルーチン /
1080 * Handle player hitting a real trap
1081 * @param break_trap 作動後のトラップ破壊が確定しているならばTRUE
1084 static void hit_trap(bool break_trap)
1087 int x = p_ptr->x, y = p_ptr->y;
1089 /* Get the cave grid */
1090 cave_type *c_ptr = &cave[y][x];
1091 feature_type *f_ptr = &f_info[c_ptr->feat];
1092 int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP;
1093 cptr name = _("トラップ", "a trap");
1095 /* Disturb the player */
1098 cave_alter_feat(y, x, FF_HIT_TRAP);
1100 /* Analyze XXX XXX XXX */
1101 switch (trap_feat_type)
1105 if (p_ptr->levitation)
1107 msg_print(_("落とし戸を飛び越えた。", "You fly over a trap door."));
1111 msg_print(_("落とし戸に落ちた!", "You have fallen through a trap door!"));
1112 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1113 msg_print(_("くっそ~!", ""));
1116 dam = damroll(2, 8);
1117 name = _("落とし戸", "a trap door");
1119 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1121 /* Still alive and autosave enabled */
1122 if (autosave_l && (p_ptr->chp >= 0))
1123 do_cmd_save_game(TRUE);
1125 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("落とし戸に落ちた", "You have fallen through a trap door!"));
1126 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
1129 p_ptr->leaving = TRUE;
1135 case TRAP_SPIKED_PIT:
1136 case TRAP_POISON_PIT:
1138 hit_trap_pit(trap_feat_type);
1144 msg_print(_("何かがピカッと光った!", "There is a flash of shimmering light!"));
1145 num = 2 + randint1(3);
1146 for (i = 0; i < num; i++)
1148 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1151 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1153 bool stop_ty = FALSE;
1158 stop_ty = activate_ty_curse(stop_ty, &count);
1167 msg_print(_("テレポート・トラップにひっかかった!", "You hit a teleport trap!"));
1168 teleport_player(100, TELEPORT_PASSIVE);
1174 msg_print(_("炎に包まれた!", "You are enveloped in flames!"));
1175 dam = damroll(4, 6);
1176 (void)fire_dam(dam, _("炎のトラップ", "a fire trap"), -1, FALSE);
1182 msg_print(_("酸が吹きかけられた!", "You are splashed with acid!"));
1183 dam = damroll(4, 6);
1184 (void)acid_dam(dam, _("酸のトラップ", "an acid trap"), -1, FALSE);
1196 hit_trap_lose_stat(A_STR);
1202 hit_trap_lose_stat(A_DEX);
1208 hit_trap_lose_stat(A_CON);
1214 hit_trap_set_abnormal_status(
1215 _("黒いガスに包み込まれた!", "A black gas surrounds you!"),
1216 p_ptr->resist_blind,
1217 set_blind, p_ptr->blind + randint0(50) + 25);
1223 hit_trap_set_abnormal_status(
1224 _("きらめくガスに包み込まれた!", "A gas of scintillating colors surrounds you!"),
1226 set_confused, p_ptr->confused + randint0(20) + 10);
1232 hit_trap_set_abnormal_status(
1233 _("刺激的な緑色のガスに包み込まれた!", "A pungent green gas surrounds you!"),
1234 p_ptr->resist_pois || IS_OPPOSE_POIS(),
1235 set_poisoned, p_ptr->poisoned + randint0(20) + 10);
1241 msg_print(_("奇妙な白い霧に包まれた!", "A strange white mist surrounds you!"));
1242 if (!p_ptr->free_act)
1244 msg_print(_("あなたは眠りに就いた。", "You fall asleep."));
1246 if (ironman_nightmare)
1248 msg_print(_("身の毛もよだつ光景が頭に浮かんだ。", "A horrible vision enters your mind."));
1250 /* Have some nightmares */
1251 sanity_blast(NULL, FALSE);
1254 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1261 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
1262 /* Make some new traps */
1263 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1270 msg_print(_("けたたましい音が鳴り響いた!", "An alarm sounds!"));
1272 aggravate_monsters(0);
1279 msg_print(_("大音響と共にまわりの壁が崩れた!", "Suddenly, surrounding walls are opened!"));
1280 (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1281 (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1282 (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1283 aggravate_monsters(0);
1288 case TRAP_ARMAGEDDON:
1290 static int levs[10] = {0, 0, 20, 10, 5, 3, 2, 1, 1, 1};
1291 int evil_idx = 0, good_idx = 0;
1294 msg_print(_("突然天界の戦争に巻き込まれた!", "Suddenly, you are surrounded by immotal beings!"));
1296 /* Summon Demons and Angels */
1297 for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
1299 num = levs[MIN(lev/10, 9)];
1300 for (i = 0; i < num; i++)
1302 int x1 = rand_spread(x, 7);
1303 int y1 = rand_spread(y, 5);
1305 /* Skip illegal grids */
1306 if (!in_bounds(y1, x1)) continue;
1308 /* Require line of projection */
1309 if (!projectable(p_ptr->y, p_ptr->x, y1, x1)) continue;
1311 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
1312 evil_idx = hack_m_idx_ii;
1314 if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_GOOD, (PM_NO_PET)))
1316 good_idx = hack_m_idx_ii;
1319 /* Let them fight each other */
1320 if (evil_idx && good_idx)
1322 monster_type *evil_ptr = &m_list[evil_idx];
1323 monster_type *good_ptr = &m_list[good_idx];
1324 evil_ptr->target_y = good_ptr->fy;
1325 evil_ptr->target_x = good_ptr->fx;
1326 good_ptr->target_y = evil_ptr->fy;
1327 good_ptr->target_x = evil_ptr->fx;
1336 msg_print(_("突然壁から水が溢れ出した!ピラニアがいる!", "Suddenly, the room is filled with water with piranhas!"));
1338 /* Water fills room */
1339 fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
1341 /* Summon Piranhas */
1342 num = 1 + dun_level/20;
1343 for (i = 0; i < num; i++)
1345 (void)summon_specific(0, y, x, dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET));
1351 if (break_trap && is_trap(c_ptr->feat))
1353 cave_alter_feat(y, x, FF_DISARM);
1354 msg_print(_("トラップを粉砕した。", "You destroyed the trap."));
1360 * @brief 敵オーラによるプレイヤーのダメージ処理(補助)
1361 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1362 * @param immune ダメージを回避できる免疫フラグ
1363 * @param flags_offset オーラフラグ配列の参照オフセット
1364 * @param r_flags_offset モンスターの耐性配列の参照オフセット
1365 * @param aura_flag オーラフラグ配列
1366 * @param dam_func ダメージ処理を行う関数の参照ポインタ
1367 * @param message オーラダメージを受けた際のメッセージ
1370 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
1371 int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
1373 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1375 if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
1378 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1380 /* Hack -- Get the "died from" name */
1381 monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1385 dam_func(aura_damage, mon_name, -1, TRUE);
1387 if (is_original_ap_and_seen(m_ptr))
1389 atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
1397 * @brief 敵オーラによるプレイヤーのダメージ処理(メイン)
1398 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1401 static void touch_zap_player(monster_type *m_ptr)
1403 touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1404 fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!"));
1405 touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1406 cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!"));
1407 touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1408 elec_dam, _("電撃をくらった!", "You get zapped!"));
1413 * @brief プレイヤーの変異要素による打撃処理
1414 * @param m_idx 攻撃目標となったモンスターの参照ID
1415 * @param attack 変異要素による攻撃要素の種類
1416 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1417 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1420 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1422 int k, bonus, chance;
1424 monster_type *m_ptr = &m_list[m_idx];
1425 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1428 int dice_num, dice_side;
1434 case MUT2_SCOR_TAIL:
1438 atk_desc = _("尻尾", "tail");
1445 atk_desc = _("角", "horns");
1452 atk_desc = _("クチバシ", "beak");
1459 atk_desc = _("象の鼻", "trunk");
1462 case MUT2_TENTACLES:
1466 atk_desc = _("触手", "tentacles");
1470 dice_num = dice_side = n_weight = 1;
1471 atk_desc = _("未定義の部位", "undefined body part");
1475 /* Extract monster name (or "it") */
1476 monster_desc(m_name, m_ptr, 0);
1479 /* Calculate the "attack quality" */
1480 bonus = p_ptr->to_h_m;
1481 bonus += (p_ptr->lev * 6 / 5);
1482 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1485 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1489 msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
1491 k = damroll(dice_num, dice_side);
1492 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1494 /* Apply the player damage bonuses */
1497 /* No negative damage */
1500 /* Modify the damage */
1501 k = mon_damage_mod(m_ptr, k, FALSE);
1503 /* Complex message */
1504 msg_format_wizard(CHEAT_MONSTER,
1505 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
1506 k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1508 /* Anger the monster */
1509 if (k > 0) anger_monster(m_ptr);
1511 /* Damage, check for fear and mdeath */
1514 case MUT2_SCOR_TAIL:
1515 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1516 *mdeath = (m_ptr->r_idx == 0);
1519 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1522 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1525 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1527 case MUT2_TENTACLES:
1528 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1531 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1534 touch_zap_player(m_ptr);
1543 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1549 * @brief プレイヤーの打撃処理サブルーチン /
1550 * Player attacks a (poor, defenseless) creature -RAK-
1553 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1554 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1555 * @param hand 攻撃を行うための武器を持つ手
1556 * @param mode 発動中の剣術ID
1559 * If no "weapon" is available, then "punch" the monster one time.
1561 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1563 int num = 0, k, bonus, chance, vir;
1565 cave_type *c_ptr = &cave[y][x];
1567 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1568 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1570 /* Access the weapon */
1571 object_type *o_ptr = &inventory[INVEN_RARM + hand];
1575 bool success_hit = FALSE;
1576 bool backstab = FALSE;
1577 bool vorpal_cut = FALSE;
1578 int chaos_effect = 0;
1579 bool stab_fleeing = FALSE;
1580 bool fuiuchi = FALSE;
1581 bool monk_attack = FALSE;
1582 bool do_quake = FALSE;
1584 bool drain_msg = TRUE;
1585 int drain_result = 0, drain_heal = 0;
1586 bool can_drain = FALSE;
1588 int drain_left = MAX_VAMPIRIC_DRAIN;
1589 u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1590 bool is_human = (r_ptr->d_char == 'p');
1591 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1592 bool zantetsu_mukou, e_j_mukou;
1594 switch (p_ptr->pclass)
1598 if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
1600 int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
1601 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1602 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1603 if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
1604 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1606 /* Can't backstab creatures that we can't see, right? */
1609 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1613 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1615 stab_fleeing = TRUE;
1621 case CLASS_FORCETRAINER:
1622 case CLASS_BERSERKER:
1623 if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
1627 if (!o_ptr->k_idx) /* Empty hand */
1629 if ((r_ptr->level + 10) > p_ptr->lev)
1631 if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1633 if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1634 p_ptr->skill_exp[GINOU_SUDE] += 40;
1635 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1636 p_ptr->skill_exp[GINOU_SUDE] += 5;
1637 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
1638 p_ptr->skill_exp[GINOU_SUDE] += 1;
1639 else if ((p_ptr->lev > 34))
1640 if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
1641 p_ptr->update |= (PU_BONUS);
1645 else if (object_is_melee_weapon(o_ptr))
1647 if ((r_ptr->level + 10) > p_ptr->lev)
1649 int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
1650 int sval = inventory[INVEN_RARM+hand].sval;
1651 int now_exp = p_ptr->weapon_exp[tval][sval];
1652 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
1655 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1656 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1657 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
1658 else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
1659 p_ptr->weapon_exp[tval][sval] += amount;
1660 p_ptr->update |= (PU_BONUS);
1665 /* Disturb the monster */
1666 (void)set_monster_csleep(c_ptr->m_idx, 0);
1668 /* Extract monster name (or "it") */
1669 monster_desc(m_name, m_ptr, 0);
1671 /* Calculate the "attack quality" */
1672 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
1673 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1674 if (mode == HISSATSU_IAI) chance += 60;
1675 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1677 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1679 vir = virtue_number(V_VALOUR);
1682 chance += (p_ptr->virtues[vir - 1]/10);
1685 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1686 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1688 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1689 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
1690 else num_blow = p_ptr->num_blow[hand];
1692 /* Hack -- DOKUBARI always hit once */
1693 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
1695 /* Attack once for each legal blow */
1696 while ((num++ < num_blow) && !p_ptr->is_dead)
1698 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1702 if (p_ptr->migite && p_ptr->hidarite)
1706 if (mode == HISSATSU_3DAN)
1711 success_hit = one_in_(n);
1713 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1714 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
1716 if (mode == HISSATSU_MAJIN)
1719 success_hit = FALSE;
1725 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1732 if (backstab) msg_format("あなたは冷酷にも眠っている無力な%sを突き刺した!", m_name);
1733 else if (fuiuchi) msg_format("不意を突いて%sに強烈な一撃を喰らわせた!", m_name);
1734 else if (stab_fleeing) msg_format("逃げる%sを背中から突き刺した!", m_name);
1735 else if (!monk_attack) msg_format("%sを攻撃した。", m_name);
1737 if (backstab) msg_format("You cruelly stab the helpless, sleeping %s!", m_name);
1738 else if (fuiuchi) msg_format("You make surprise attack, and hit %s with a powerful blow!", m_name);
1739 else if (stab_fleeing) msg_format("You backstab the fleeing %s!", m_name);
1740 else if (!monk_attack) msg_format("You hit %s.", m_name);
1743 /* Hack -- bare hands do one damage */
1746 object_flags(o_ptr, flgs);
1748 /* Select a chaotic effect (50% chance) */
1749 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1752 chg_virtue(V_CHANCE, 1);
1754 if (randint1(5) < 3)
1756 /* Vampiric (20%) */
1759 else if (one_in_(250))
1764 else if (!one_in_(10))
1766 /* Confusion (26.892%) */
1769 else if (one_in_(2))
1771 /* Teleport away (1.494%) */
1776 /* Polymorph (1.494%) */
1781 /* Vampiric drain */
1782 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1784 /* Only drain "living" monsters */
1785 if (monster_living(r_ptr))
1791 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
1793 else vorpal_cut = FALSE;
1797 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1799 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1800 int resist_stun = 0;
1803 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1804 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1805 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1806 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1807 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1810 if (p_ptr->special_defense & KAMAE_BYAKKO)
1811 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
1812 else if (p_ptr->special_defense & KAMAE_SUZAKU)
1814 else if (p_ptr->special_defense & KAMAE_GENBU)
1817 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
1818 /* Attempt 'times' */
1819 for (times = 0; times < max_times; times++)
1823 ma_ptr = &ma_blows[randint0(MAX_MA)];
1824 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1825 else min_level = ma_ptr->min_level;
1827 while ((min_level > p_ptr->lev) ||
1828 (randint1(p_ptr->lev) < ma_ptr->chance));
1830 /* keep the highest level attack available we found */
1831 if ((ma_ptr->min_level > old_ptr->min_level) &&
1832 !p_ptr->stun && !p_ptr->confused)
1836 if (p_ptr->wizard && cheat_xtra)
1838 msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
1847 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1848 else min_level = ma_ptr->min_level;
1849 k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
1850 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1852 if (ma_ptr->effect == MA_KNEE)
1854 if (r_ptr->flags1 & RF1_MALE)
1856 msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), m_name);
1858 special_effect = MA_KNEE;
1861 msg_format(ma_ptr->desc, m_name);
1864 else if (ma_ptr->effect == MA_SLOW)
1866 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1867 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1869 msg_format(_("%sの足首に関節蹴りをくらわした!", "You kick %s in the ankle."), m_name);
1870 special_effect = MA_SLOW;
1872 else msg_format(ma_ptr->desc, m_name);
1878 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1881 msg_format(ma_ptr->desc, m_name);
1884 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1885 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
1887 weight += (p_ptr->magic_num1[0]/30);
1888 if (weight > 20) weight = 20;
1891 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
1893 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1895 msg_format(_("%^sは苦痛にうめいている!", "%^s moans in agony!"), m_name);
1896 stun_effect = 7 + randint1(13);
1900 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1902 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1903 (randint1(p_ptr->lev) > r_ptr->level) &&
1906 msg_format(_("%^sは足をひきずり始めた。", "%^s starts limping slower."), m_name);
1907 m_ptr->mspeed -= 10;
1911 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1913 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1915 if (set_monster_stunned(c_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1917 msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
1921 msg_format(_("%^sはさらにフラフラになった。", "%^s is more stunned."), m_name);
1927 /* Handle normal weapon */
1928 else if (o_ptr->k_idx)
1930 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
1931 k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
1935 k *= (3 + (p_ptr->lev / 20));
1939 k = k*(5+(p_ptr->lev*2/25))/2;
1941 else if (stab_fleeing)
1946 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
1947 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
1952 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
1953 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
1961 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
1963 char chainsword_noise[1024];
1964 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise))
1966 msg_print(chainsword_noise);
1970 if (o_ptr->name1 == ART_VORPAL_BLADE)
1972 msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!"));
1976 msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), m_name);
1979 /* Try to increase the damage */
1980 while (one_in_(vorpal_chance))
1988 if (((r_ptr->flagsr & RFR_RES_ALL) ? k/100 : k) > m_ptr->hp)
1990 msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), m_name);
1996 case 2: msg_format(_("%sを斬った!", "You gouge %s!"), m_name); break;
1997 case 3: msg_format(_("%sをぶった斬った!", "You maim %s!"), m_name); break;
1998 case 4: msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), m_name); break;
1999 case 5: msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), m_name); break;
2000 case 6: msg_format(_("%sを刺身にした!", "You smite %s!"), m_name); break;
2001 case 7: msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), m_name); break;
2002 default: msg_format(_("%sを細切れにした!", "You shred %s!"), m_name); break;
2005 drain_result = drain_result * 3 / 2;
2009 drain_result += o_ptr->to_d;
2012 /* Apply the player damage bonuses */
2013 k += p_ptr->to_d[hand];
2014 drain_result += p_ptr->to_d[hand];
2016 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2017 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(r_ptr)) k = 0;
2018 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2020 /* No negative damage */
2023 if ((mode == HISSATSU_ZANMA) && !(!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL)))
2030 msg_print(_("こんな軟らかいものは切れん!", "You cannot cut such a elastic thing!"));
2036 msg_print(_("蜘蛛は苦手だ!", "Spiders are difficult for you to deal with!"));
2040 if (mode == HISSATSU_MINEUCHI)
2042 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2045 anger_monster(m_ptr);
2047 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2050 if (MON_STUNNED(m_ptr))
2052 msg_format(_("%sはひどくもうろうとした。", "%s is more dazed."), m_name);
2057 msg_format(_("%s はもうろうとした。", "%s is dazed."), m_name);
2061 (void)set_monster_stunned(c_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
2065 msg_format(_("%s には効果がなかった。", "%s is not effected."), m_name);
2069 /* Modify the damage */
2070 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))));
2071 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2073 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2076 msg_format(_("%sの急所を突き刺した!", "You hit %s on a fatal spot!"), m_name);
2080 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)))
2082 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2083 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2087 msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), m_name);
2089 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)))
2091 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2093 k = MAX(k*5, m_ptr->hp/2);
2095 msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), m_name);
2100 msg_format(_("刃が%sの急所を貫いた!", "You hit %s on a fatal spot!"), m_name);
2105 msg_format_wizard(CHEAT_MONSTER,
2106 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), k,
2107 m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
2109 if (k <= 0) can_drain = FALSE;
2111 if (drain_result > m_ptr->hp)
2112 drain_result = m_ptr->hp;
2114 /* Damage, check for fear and death */
2115 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2118 if ((p_ptr->pclass == CLASS_BERSERKER) && p_ptr->energy_use)
2120 if (p_ptr->migite && p_ptr->hidarite)
2122 if (hand) p_ptr->energy_use = p_ptr->energy_use*3/5+p_ptr->energy_use*num*2/(p_ptr->num_blow[hand]*5);
2123 else p_ptr->energy_use = p_ptr->energy_use*num*3/(p_ptr->num_blow[hand]*5);
2127 p_ptr->energy_use = p_ptr->energy_use*num/p_ptr->num_blow[hand];
2130 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2131 msg_print(_("またつまらぬものを斬ってしまった...", "Sigh... Another trifling thing I've cut...."));
2135 /* Anger the monster */
2136 if (k > 0) anger_monster(m_ptr);
2138 touch_zap_player(m_ptr);
2140 /* Are we draining it? A little note: If the monster is
2141 dead, the drain does not work... */
2143 if (can_drain && (drain_result > 0))
2145 if (o_ptr->name1 == ART_MURAMASA)
2149 int to_h = o_ptr->to_h;
2150 int to_d = o_ptr->to_d;
2154 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2158 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2161 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2163 msg_print(_("妖刀は血を吸って強くなった!", "Muramasa sucked blood, and became more powerful!"));
2171 if (drain_result > 5) /* Did we really hurt it? */
2173 drain_heal = damroll(2, drain_result / 6);
2176 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
2180 msg_format(_("Draining left: %d", "Draining left: %d"), drain_left);
2185 if (drain_heal < drain_left)
2187 drain_left -= drain_heal;
2191 drain_heal = drain_left;
2197 msg_format(_("刃が%sから生命力を吸い取った!", "Your weapon drains life from %s!"), m_name);
2201 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2203 hp_player(drain_heal);
2204 /* We get to keep some of it! */
2208 m_ptr->maxhp -= (k+7)/8;
2209 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2210 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2216 /* Confusion attack */
2217 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
2219 /* Cancel glowing hands */
2220 if (p_ptr->special_attack & ATTACK_CONFUSE)
2222 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2223 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
2224 p_ptr->redraw |= (PR_STATUS);
2228 /* Confuse the monster */
2229 if (r_ptr->flags3 & RF3_NO_CONF)
2231 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2232 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2235 else if (randint0(100) < r_ptr->level)
2237 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2241 msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
2242 (void)set_monster_confused(c_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
2246 else if (chaos_effect == 4)
2248 bool resists_tele = FALSE;
2250 if (r_ptr->flagsr & RFR_RES_TELE)
2252 if (r_ptr->flags1 & RF1_UNIQUE)
2254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2255 msg_format(_("%^sには効果がなかった。", "%^s is unaffected!"), m_name);
2256 resists_tele = TRUE;
2258 else if (r_ptr->level > randint1(100))
2260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2261 msg_format(_("%^sは抵抗力を持っている!", "%^s resists!"), m_name);
2262 resists_tele = TRUE;
2268 msg_format(_("%^sは消えた!", "%^s disappears!"), m_name);
2269 teleport_away(c_ptr->m_idx, 50, TELEPORT_PASSIVE);
2270 num = num_blow + 1; /* Can't hit it anymore! */
2275 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2277 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2278 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2280 if (polymorph_monster(y, x))
2282 msg_format(_("%^sは変化した!", "%^s changes!"), m_name);
2288 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2291 /* Hack -- Get new monster */
2292 m_ptr = &m_list[c_ptr->m_idx];
2294 /* Oops, we need a different name... */
2295 monster_desc(m_name, m_ptr, 0);
2297 /* Hack -- Get new race */
2298 r_ptr = &r_info[m_ptr->r_idx];
2301 else if (o_ptr->name1 == ART_G_HAMMER)
2303 monster_type *target_ptr = &m_list[c_ptr->m_idx];
2305 if (target_ptr->hold_o_idx)
2307 object_type *q_ptr = &o_list[target_ptr->hold_o_idx];
2308 char o_name[MAX_NLEN];
2310 object_desc(o_name, q_ptr, OD_NAME_ONLY);
2311 q_ptr->held_m_idx = 0;
2312 q_ptr->marked = OM_TOUCHED;
2313 target_ptr->hold_o_idx = q_ptr->next_o_idx;
2314 q_ptr->next_o_idx = 0;
2315 msg_format(_("%sを奪った。", "You snatched %s."), o_name);
2324 backstab = FALSE; /* Clumsy! */
2325 fuiuchi = FALSE; /* Clumsy! */
2327 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2329 u32b flgs_aux[TR_FLAG_SIZE];
2335 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
2337 msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
2339 /* Extract the flags */
2340 object_flags(o_ptr, flgs_aux);
2342 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
2345 switch (p_ptr->mimic_form)
2348 switch (p_ptr->prace)
2355 case RACE_BARBARIAN:
2359 case RACE_HALF_TROLL:
2360 case RACE_HALF_OGRE:
2361 case RACE_HALF_GIANT:
2362 case RACE_HALF_TITAN:
2370 case RACE_DRACONIAN:
2377 case MIMIC_DEMON_LORD:
2384 if (p_ptr->align < 0 && mult < 20)
2386 if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
2388 if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
2390 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
2392 if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
2394 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
2397 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
2399 p_ptr->csp -= (1+(p_ptr->msp / 30));
2400 p_ptr->redraw |= (PR_MANA);
2401 mult = mult * 3 / 2 + 20;
2407 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2411 msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!"));
2412 /* Try to increase the damage */
2420 k += (p_ptr->to_d[hand] + o_ptr->to_d);
2423 take_hit(DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1);
2432 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
2440 if (weak && !(*mdeath))
2442 msg_format(_("%sは弱くなったようだ。", "%^s seems weakened."), m_name);
2444 if (drain_left != MAX_VAMPIRIC_DRAIN)
2448 chg_virtue(V_UNLIFE, 1);
2451 /* Mega-Hack -- apply earthquake brand */
2454 earthquake(p_ptr->y, p_ptr->x, 10);
2455 if (!cave[y][x].m_idx) *mdeath = TRUE;
2460 * @brief プレイヤーの打撃処理メインルーチン
2463 * @param mode 発動中の剣術ID
2464 * @return 実際に攻撃処理が行われた場合TRUEを返す。
2466 * If no "weapon" is available, then "punch" the monster one time.
2468 bool py_attack(int y, int x, int mode)
2471 bool mdeath = FALSE;
2472 bool stormbringer = FALSE;
2474 cave_type *c_ptr = &cave[y][x];
2475 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2476 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2479 /* Disturb the player */
2482 p_ptr->energy_use = 100;
2484 if (!p_ptr->migite && !p_ptr->hidarite &&
2485 !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2487 msg_format(_("%s攻撃できない。", "You cannot do attacking."),
2488 (empty_hands(FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : "");
2492 /* Extract monster name (or "it") */
2493 monster_desc(m_name, m_ptr, 0);
2497 /* Auto-Recall if possible and visible */
2498 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
2500 /* Track a new monster */
2501 health_track(c_ptr->m_idx);
2504 if ((r_ptr->flags1 & RF1_FEMALE) &&
2505 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
2507 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
2509 msg_print(_("拙者、おなごは斬れぬ!", "I can not attack women!"));
2514 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
2516 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
2520 /* Stop if friendly */
2521 if (!is_hostile(m_ptr) &&
2522 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
2523 p_ptr->shero || !m_ptr->ml))
2525 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2526 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2529 msg_format(_("黒い刃は強欲に%sを攻撃した!", "Your black blade greedily attacks %s!"), m_name);
2530 chg_virtue(V_INDIVIDUALISM, 1);
2531 chg_virtue(V_HONOUR, -1);
2532 chg_virtue(V_JUSTICE, -1);
2533 chg_virtue(V_COMPASSION, -1);
2535 else if (p_ptr->pclass != CLASS_BERSERKER)
2537 if (get_check(_("本当に攻撃しますか?", "Really hit it? ")))
2539 chg_virtue(V_INDIVIDUALISM, 1);
2540 chg_virtue(V_HONOUR, -1);
2541 chg_virtue(V_JUSTICE, -1);
2542 chg_virtue(V_COMPASSION, -1);
2546 msg_format(_("%sを攻撃するのを止めた。", "You stop to avoid hitting %s."), m_name);
2553 /* Handle player fear */
2558 msg_format(_("恐くて%sを攻撃できない!", "You are too afraid to attack %s!"), m_name);
2560 msg_format (_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
2562 /* Disturb the monster */
2563 (void)set_monster_csleep(c_ptr->m_idx, 0);
2569 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2571 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
2572 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
2575 if (p_ptr->migite && p_ptr->hidarite)
2577 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))
2579 if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2580 p_ptr->skill_exp[GINOU_NITOURYU] += 80;
2581 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2582 p_ptr->skill_exp[GINOU_NITOURYU] += 4;
2583 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2584 p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2585 else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2586 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
2587 p_ptr->update |= (PU_BONUS);
2591 /* Gain riding experience */
2594 int cur = p_ptr->skill_exp[GINOU_RIDING];
2595 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
2599 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
2600 int targetlevel = r_ptr->level;
2603 if ((cur / 200 - 5) < targetlevel)
2606 /* Extra experience */
2607 if ((cur / 100) < ridinglevel)
2609 if ((cur / 100 + 15) < ridinglevel)
2610 inc += 1 + (ridinglevel - (cur / 100 + 15));
2615 p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2617 p_ptr->update |= (PU_BONUS);
2621 riding_t_m_idx = c_ptr->m_idx;
2622 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
2623 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
2625 /* Mutations which yield extra 'natural' attacks */
2628 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
2629 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
2630 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
2631 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
2632 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
2633 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
2634 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
2635 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
2636 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
2637 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
2640 /* Hack -- delay fear messages */
2641 if (fear && m_ptr->ml && !mdeath)
2647 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2650 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
2652 set_action(ACTION_NONE);
2660 * @brief パターンによる移動制限処理
2661 * @param c_y プレイヤーの移動元Y座標
2662 * @param c_x プレイヤーの移動元X座標
2663 * @param n_y プレイヤーの移動先Y座標
2664 * @param n_x プレイヤーの移動先X座標
2665 * @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。
2667 bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
2669 feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
2670 feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
2671 bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
2672 bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
2673 int pattern_type_cur, pattern_type_new;
2675 if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
2677 pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->subtype : NOT_PATTERN_TILE;
2678 pattern_type_new = is_pattern_tile_new ? new_f_ptr->subtype : NOT_PATTERN_TILE;
2680 if (pattern_type_new == PATTERN_TILE_START)
2682 if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
2684 if (get_check(_("パターンの上を歩き始めると、全てを歩かなければなりません。いいですか?",
2685 "If you start walking the Pattern, you must walk the whole way. Ok? ")))
2693 else if ((pattern_type_new == PATTERN_TILE_OLD) ||
2694 (pattern_type_new == PATTERN_TILE_END) ||
2695 (pattern_type_new == PATTERN_TILE_WRECKED))
2697 if (is_pattern_tile_cur)
2703 msg_print(_("パターンの上を歩くにはスタート地点から歩き始めなくてはなりません。",
2704 "You must start walking the Pattern from the startpoint."));
2709 else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
2710 (pattern_type_cur == PATTERN_TILE_TELEPORT))
2714 else if (pattern_type_cur == PATTERN_TILE_START)
2716 if (is_pattern_tile_new)
2720 msg_print(_("パターンの上は正しい順序で歩かねばなりません。", "You must walk the Pattern in correct order."));
2724 else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
2725 (pattern_type_cur == PATTERN_TILE_END) ||
2726 (pattern_type_cur == PATTERN_TILE_WRECKED))
2728 if (!is_pattern_tile_new)
2730 msg_print(_("パターンを踏み外してはいけません。", "You may not step off from the Pattern."));
2740 if (!is_pattern_tile_cur)
2742 msg_print(_("パターンの上を歩くにはスタート地点から歩き始めなくてはなりません。",
2743 "You must start walking the Pattern from the startpoint."));
2749 byte ok_move = PATTERN_TILE_START;
2750 switch (pattern_type_cur)
2752 case PATTERN_TILE_1:
2753 ok_move = PATTERN_TILE_2;
2755 case PATTERN_TILE_2:
2756 ok_move = PATTERN_TILE_3;
2758 case PATTERN_TILE_3:
2759 ok_move = PATTERN_TILE_4;
2761 case PATTERN_TILE_4:
2762 ok_move = PATTERN_TILE_1;
2766 msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur);
2768 return TRUE; /* Goof-up */
2771 if ((pattern_type_new == ok_move) ||
2772 (pattern_type_new == pattern_type_cur))
2776 if (!is_pattern_tile_new)
2777 msg_print(_("パターンを踏み外してはいけません。", "You may not step off from the Pattern."));
2779 msg_print(_("パターンの上は正しい順序で歩かねばなりません。", "You must walk the Pattern in correct order."));
2789 * @brief プレイヤーが地形踏破可能かを返す
2790 * @param feature 判定したい地形ID
2791 * @param mode 移動に関するオプションフラグ
2792 * @return 移動可能ならばTRUEを返す
2794 bool player_can_enter(s16b feature, u16b mode)
2796 feature_type *f_ptr = &f_info[feature];
2798 if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
2801 if (have_flag(f_ptr->flags, FF_PATTERN))
2803 if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
2807 if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
2808 if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
2809 if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
2811 if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
2818 * @brief 移動に伴うプレイヤーのステータス変化処理
2821 * @param mpe_mode 移動オプションフラグ
2822 * @return プレイヤーが死亡やフロア離脱を行わず、実際に移動が可能ならばTRUEを返す。
2824 bool move_player_effect(int ny, int nx, u32b mpe_mode)
2826 cave_type *c_ptr = &cave[ny][nx];
2827 feature_type *f_ptr = &f_info[c_ptr->feat];
2829 if (!(mpe_mode & MPE_STAYING))
2833 cave_type *oc_ptr = &cave[oy][ox];
2834 int om_idx = oc_ptr->m_idx;
2835 int nm_idx = c_ptr->m_idx;
2837 /* Move the player */
2841 /* Hack -- For moving monster or riding player's moving */
2842 if (!(mpe_mode & MPE_DONT_SWAP_MON))
2844 /* Swap two monsters */
2845 c_ptr->m_idx = om_idx;
2846 oc_ptr->m_idx = nm_idx;
2848 if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
2850 monster_type *om_ptr = &m_list[om_idx];
2853 update_mon(om_idx, TRUE);
2856 if (nm_idx > 0) /* Monster on new spot */
2858 monster_type *nm_ptr = &m_list[nm_idx];
2861 update_mon(nm_idx, TRUE);
2865 /* Redraw old spot */
2868 /* Redraw new spot */
2871 /* Check for new panel (redraw map) */
2874 if (mpe_mode & MPE_FORGET_FLOW)
2878 /* Mega-Hack -- Forget the view */
2879 p_ptr->update |= (PU_UN_VIEW);
2882 p_ptr->redraw |= (PR_MAP);
2886 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
2889 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2891 /* Remove "unsafe" flag */
2892 if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
2894 /* For get everything when requested hehe I'm *NASTY* */
2895 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
2898 if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
2900 if (p_ptr->pclass == CLASS_NINJA)
2902 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
2903 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
2906 if ((p_ptr->action == ACTION_HAYAGAKE) &&
2907 (!have_flag(f_ptr->flags, FF_PROJECT) ||
2908 (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
2910 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
2911 set_action(ACTION_NONE);
2915 if (mpe_mode & MPE_ENERGY_USE)
2917 if (music_singing(MUSIC_WALL))
2919 (void)project(0, 0, p_ptr->y, p_ptr->x, (60 + p_ptr->lev), GF_DISINTEGRATE,
2920 PROJECT_KILL | PROJECT_ITEM, -1);
2922 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
2925 /* Spontaneous Searching */
2926 if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
2931 /* Continuous Searching */
2932 if (p_ptr->action == ACTION_SEARCH)
2938 /* Handle "objects" */
2939 if (!(mpe_mode & MPE_DONT_PICKUP))
2941 carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
2944 /* Handle "store doors" */
2945 if (have_flag(f_ptr->flags, FF_STORE))
2950 p_ptr->energy_use = 0;
2951 /* Hack -- Enter store */
2952 command_new = SPECIAL_KEY_STORE;
2955 /* Handle "building doors" -KMW- */
2956 else if (have_flag(f_ptr->flags, FF_BLDG))
2961 p_ptr->energy_use = 0;
2962 /* Hack -- Enter building */
2963 command_new = SPECIAL_KEY_BUILDING;
2966 /* Handle quest areas -KMW- */
2967 else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
2972 p_ptr->energy_use = 0;
2973 /* Hack -- Enter quest level */
2974 command_new = SPECIAL_KEY_QUEST;
2977 else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
2979 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
2981 complete_quest(p_ptr->inside_quest);
2984 leave_quest_check();
2986 p_ptr->inside_quest = c_ptr->special;
2991 p_ptr->leaving = TRUE;
2994 /* Set off a trap */
2995 else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
3001 if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
3004 msg_print(_("トラップだ!", "You found a trap!"));
3007 disclose_grid(p_ptr->y, p_ptr->x);
3011 hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
3013 if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
3016 /* Warn when leaving trap detected region */
3017 if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
3018 && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
3020 /* No duplicate warning */
3021 p_ptr->dtrap = FALSE;
3023 /* You are just on the edge */
3024 if (!(c_ptr->info & CAVE_UNSAFE))
3026 if (alert_trap_detect)
3028 msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
3031 if (disturb_trap_detect) disturb(0, 1);
3035 return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
3039 * @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す
3041 * @return トラップが自動的に無効ならばTRUEを返す
3043 bool trap_can_be_ignored(int feat)
3045 feature_type *f_ptr = &f_info[feat];
3047 if (!have_flag(f_ptr->flags, FF_TRAP)) return TRUE;
3049 switch (f_ptr->subtype)
3053 case TRAP_SPIKED_PIT:
3054 case TRAP_POISON_PIT:
3055 if (p_ptr->levitation) return TRUE;
3058 if (p_ptr->anti_tele) return TRUE;
3061 if (p_ptr->immune_fire) return TRUE;
3064 if (p_ptr->immune_acid) return TRUE;
3067 if (p_ptr->resist_blind) return TRUE;
3070 if (p_ptr->resist_conf) return TRUE;
3073 if (p_ptr->resist_pois) return TRUE;
3076 if (p_ptr->free_act) return TRUE;
3085 * Determine if a "boundary" grid is "floor mimic"
3087 #define boundary_floor(C, F, MF) \
3088 ((C)->mimic && permanent_wall(F) && \
3089 (have_flag((MF)->flags, FF_MOVE) || have_flag((MF)->flags, FF_CAN_FLY)) && \
3090 have_flag((MF)->flags, FF_PROJECT) && \
3091 !have_flag((MF)->flags, FF_OPEN))
3095 * @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す /
3096 * Move player in the given direction, with the given "pickup" flag.
3098 * @param do_pickup 罠解除を試みながらの移動ならばTRUE
3099 * @param break_trap トラップ粉砕処理を行うならばTRUE
3100 * @return 実際に移動が行われたならばTRUEを返す。
3102 * This routine should (probably) always induce energy expenditure.\n
3104 * Note that moving will *always* take a turn, and will *always* hit\n
3105 * any monster which might be in the destination grid. Previously,\n
3106 * moving into walls was "free" and did NOT hit invisible monsters.\n
3108 void move_player(int dir, bool do_pickup, bool break_trap)
3110 /* Find the result of moving */
3111 int y = p_ptr->y + ddy[dir];
3112 int x = p_ptr->x + ddx[dir];
3114 /* Examine the destination */
3115 cave_type *c_ptr = &cave[y][x];
3117 feature_type *f_ptr = &f_info[c_ptr->feat];
3119 monster_type *m_ptr;
3121 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
3122 monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
3126 bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
3127 bool p_can_kill_walls = FALSE;
3128 bool stormbringer = FALSE;
3130 bool oktomove = TRUE;
3131 bool do_past = FALSE;
3134 if (!dun_level && !p_ptr->wild_mode &&
3135 ((x == 0) || (x == MAX_WID - 1) ||
3136 (y == 0) || (y == MAX_HGT - 1)))
3138 /* Can the player enter the grid? */
3139 if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
3141 /* Hack: move to new area */
3142 if ((y == 0) && (x == 0))
3144 p_ptr->wilderness_y--;
3145 p_ptr->wilderness_x--;
3146 p_ptr->oldpy = cur_hgt - 2;
3147 p_ptr->oldpx = cur_wid - 2;
3148 ambush_flag = FALSE;
3151 else if ((y == 0) && (x == MAX_WID - 1))
3153 p_ptr->wilderness_y--;
3154 p_ptr->wilderness_x++;
3155 p_ptr->oldpy = cur_hgt - 2;
3157 ambush_flag = FALSE;
3160 else if ((y == MAX_HGT - 1) && (x == 0))
3162 p_ptr->wilderness_y++;
3163 p_ptr->wilderness_x--;
3165 p_ptr->oldpx = cur_wid - 2;
3166 ambush_flag = FALSE;
3169 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3171 p_ptr->wilderness_y++;
3172 p_ptr->wilderness_x++;
3175 ambush_flag = FALSE;
3180 p_ptr->wilderness_y--;
3181 p_ptr->oldpy = cur_hgt - 2;
3183 ambush_flag = FALSE;
3186 else if (y == MAX_HGT - 1)
3188 p_ptr->wilderness_y++;
3191 ambush_flag = FALSE;
3196 p_ptr->wilderness_x--;
3197 p_ptr->oldpx = cur_wid - 2;
3199 ambush_flag = FALSE;
3202 else if (x == MAX_WID - 1)
3204 p_ptr->wilderness_x++;
3207 ambush_flag = FALSE;
3210 p_ptr->leaving = TRUE;
3211 p_ptr->energy_use = 100;
3216 /* "Blocked" message appears later */
3217 /* oktomove = FALSE; */
3218 p_can_enter = FALSE;
3221 /* Get the monster */
3222 m_ptr = &m_list[c_ptr->m_idx];
3225 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3226 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3228 /* Player can not walk through "walls"... */
3229 /* unless in Shadow Form */
3230 p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
3231 (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
3232 !have_flag(f_ptr->flags, FF_PERMANENT);
3234 /* Hack -- attack monsters */
3235 if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
3237 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3239 /* Attack -- only if we can see it OR it is not in a wall */
3240 if (!is_hostile(m_ptr) &&
3241 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3242 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3243 pattern_seq(p_ptr->y, p_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
3245 /* Disturb the monster */
3246 (void)set_monster_csleep(c_ptr->m_idx, 0);
3248 /* Extract monster name (or "it") */
3249 monster_desc(m_name, m_ptr, 0);
3253 /* Auto-Recall if possible and visible */
3254 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
3256 /* Track a new monster */
3257 health_track(c_ptr->m_idx);
3261 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3266 else if (monster_can_cross_terrain(cave[p_ptr->y][p_ptr->x].feat, r_ptr, 0))
3272 msg_format(_("%^sが邪魔だ!", "%^s is in your way!"), m_name);
3273 p_ptr->energy_use = 0;
3277 /* now continue on to 'movement' */
3286 if (oktomove && p_ptr->riding)
3288 if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
3290 msg_print(_("動けない!", "Can't move!"));
3291 p_ptr->energy_use = 0;
3295 else if (MON_MONFEAR(riding_m_ptr))
3297 char steed_name[80];
3299 /* Acquire the monster name */
3300 monster_desc(steed_name, riding_m_ptr, 0);
3302 /* Dump a message */
3303 msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name);
3307 else if (p_ptr->riding_ryoute)
3312 else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
3316 else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
3320 else if (have_flag(f_ptr->flags, FF_WATER) &&
3321 !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
3322 (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
3324 msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(c_ptr)].name);
3325 p_ptr->energy_use = 0;
3329 else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
3331 msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name);
3332 p_ptr->energy_use = 0;
3336 else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3338 msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(c_ptr)].name);
3339 p_ptr->energy_use = 0;
3344 if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
3346 char steed_name[80];
3347 monster_desc(steed_name, riding_m_ptr, 0);
3348 msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name);
3358 else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
3360 msg_format(_("空を飛ばないと%sの上には行けない。", "You need to fly to go through the %s."), f_name + f_info[get_feat_mimic(c_ptr)].name);
3361 p_ptr->energy_use = 0;
3367 * Player can move through trees and
3368 * has effective -10 speed
3369 * Rangers can move without penality
3371 else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
3373 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2;
3376 #ifdef ALLOW_EASY_DISARM /* TNB */
3378 /* Disarm a visible trap */
3379 else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
3381 if (!trap_can_be_ignored(c_ptr->feat))
3383 (void)do_cmd_disarm_aux(y, x, dir);
3388 #endif /* ALLOW_EASY_DISARM -- TNB */
3390 /* Player can not walk through "walls" unless in wraith form...*/
3391 else if (!p_can_enter && !p_can_kill_walls)
3393 /* Feature code (applying "mimic" field) */
3394 s16b feat = get_feat_mimic(c_ptr);
3395 feature_type *mimic_f_ptr = &f_info[feat];
3396 cptr name = f_name + mimic_f_ptr->name;
3400 /* Notice things in the dark */
3401 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3403 /* Boundary floor mimic */
3404 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3406 msg_print(_("それ以上先には進めないようだ。", "You feel you cannot go any more."));
3409 /* Wall (or secret door) */
3413 msg_format("%sが行く手をはばんでいるようだ。", name);
3415 msg_format("You feel %s %s blocking your way.",
3416 is_a_vowel(name[0]) ? "an" : "a", name);
3419 c_ptr->info |= (CAVE_MARK);
3427 /* Boundary floor mimic */
3428 if (boundary_floor(c_ptr, f_ptr, mimic_f_ptr))
3430 msg_print(_("それ以上先には進めない。", "You cannot go any more."));
3431 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3432 p_ptr->energy_use = 0;
3435 /* Wall (or secret door) */
3438 #ifdef ALLOW_EASY_OPEN
3440 if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
3441 #endif /* ALLOW_EASY_OPEN */
3444 msg_format("%sが行く手をはばんでいる。", name);
3446 msg_format("There is %s %s blocking your way.",
3447 is_a_vowel(name[0]) ? "an" : "a", name);
3451 * Well, it makes sense that you lose time bumping into
3452 * a wall _if_ you are confused, stunned or blind; but
3453 * typing mistakes should not cost you a turn...
3455 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3456 p_ptr->energy_use = 0;
3460 /* Disturb the player */
3464 if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
3467 /* Normal movement */
3468 if (oktomove && !pattern_seq(p_ptr->y, p_ptr->x, y, x))
3470 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3472 p_ptr->energy_use = 0;
3475 /* To avoid a loop with running */
3481 /* Normal movement */
3484 u32b mpe_mode = MPE_ENERGY_USE;
3488 if (!process_warning(x, y))
3490 p_ptr->energy_use = 25;
3497 msg_format(_("%sを押し退けた。", "You push past %s."), m_name);
3500 /* Change oldpx and oldpy to place the player well when going back to big mode */
3501 if (p_ptr->wild_mode)
3503 if (ddy[dir] > 0) p_ptr->oldpy = 1;
3504 if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
3505 if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
3506 if (ddx[dir] > 0) p_ptr->oldpx = 1;
3507 if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
3508 if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
3511 if (p_can_kill_walls)
3513 cave_alter_feat(y, x, FF_HURT_DISI);
3515 /* Update some things -- similar to GF_KILL_WALL */
3516 p_ptr->update |= (PU_FLOW);
3520 /* sound(SOUND_WALK); */
3522 #ifdef ALLOW_EASY_DISARM /* TNB */
3524 if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
3526 #else /* ALLOW_EASY_DISARM -- TNB */
3528 if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
3530 #endif /* ALLOW_EASY_DISARM -- TNB */
3532 if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
3534 /* Move the player */
3535 (void)move_player_effect(y, x, mpe_mode);
3540 static bool ignore_avoid_run;
3543 * @brief ダッシュ移動処理中、移動先のマスが既知の壁かどうかを判定する /
3544 * Hack -- Check for a "known wall" (see below)
3545 * @param dir 想定する移動方向ID
3548 * @return 移動先が既知の壁ならばTRUE
3550 static int see_wall(int dir, int y, int x)
3554 /* Get the new location */
3558 /* Illegal grids are not known walls */
3559 if (!in_bounds2(y, x)) return (FALSE);
3562 c_ptr = &cave[y][x];
3564 /* Must be known to the player */
3565 if (c_ptr->info & (CAVE_MARK))
3567 /* Feature code (applying "mimic" field) */
3568 s16b feat = get_feat_mimic(c_ptr);
3569 feature_type *f_ptr = &f_info[feat];
3571 /* Wall grids are known walls */
3572 if (!player_can_enter(feat, 0)) return !have_flag(f_ptr->flags, FF_DOOR);
3574 /* Don't run on a tree unless explicitly requested */
3575 if (have_flag(f_ptr->flags, FF_AVOID_RUN) && !ignore_avoid_run)
3578 /* Don't run in a wall */
3579 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
3580 return !have_flag(f_ptr->flags, FF_DOOR);
3588 * @brief ダッシュ移動処理中、移動先のマスか未知の地形かどうかを判定する /
3589 * Hack -- Check for an "unknown corner" (see below)
3590 * @param dir 想定する移動方向ID
3593 * @return 移動先が未知の地形ならばTRUE
3595 static int see_nothing(int dir, int y, int x)
3597 /* Get the new location */
3601 /* Illegal grids are unknown */
3602 if (!in_bounds2(y, x)) return (TRUE);
3604 /* Memorized grids are always known */
3605 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
3607 /* Viewable door/wall grids are known */
3608 if (player_can_see_bold(y, x)) return (FALSE);
3620 * Hack -- allow quick "cycling" through the legal directions
3622 static byte cycle[] =
3623 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
3626 * Hack -- map each direction into the "middle" of the "cycle[]" array
3628 static byte chome[] =
3629 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
3632 * The direction we are running
3634 static byte find_current;
3637 * The direction we came from
3639 static byte find_prevdir;
3642 * We are looking for open area
3644 static bool find_openarea;
3647 * We are looking for a break
3649 static bool find_breakright;
3650 static bool find_breakleft;
3655 * @brief ダッシュ処理の導入 /
3656 * Initialize the running algorithm for a new direction.
3659 * Diagonal Corridor -- allow diaginal entry into corridors.\n
3661 * Blunt Corridor -- If there is a wall two spaces ahead and\n
3662 * we seem to be in a corridor, then force a turn into the side\n
3663 * corridor, must be moving straight into a corridor here. ???\n
3665 * Diagonal Corridor Blunt Corridor (?)\n
3670 static void run_init(int dir)
3672 int row, col, deepleft, deepright;
3673 int i, shortleft, shortright;
3676 /* Save the direction */
3679 /* Assume running straight */
3682 /* Assume looking for open area */
3683 find_openarea = TRUE;
3685 /* Assume not looking for breaks */
3686 find_breakright = find_breakleft = FALSE;
3688 /* Assume no nearby walls */
3689 deepleft = deepright = FALSE;
3690 shortright = shortleft = FALSE;
3692 p_ptr->run_py = p_ptr->y;
3693 p_ptr->run_px = p_ptr->x;
3695 /* Find the destination grid */
3696 row = p_ptr->y + ddy[dir];
3697 col = p_ptr->x + ddx[dir];
3699 ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN);
3701 /* Extract cycle index */
3704 /* Check for walls */
3705 if (see_wall(cycle[i+1], p_ptr->y, p_ptr->x))
3707 find_breakleft = TRUE;
3710 else if (see_wall(cycle[i+1], row, col))
3712 find_breakleft = TRUE;
3716 /* Check for walls */
3717 if (see_wall(cycle[i-1], p_ptr->y, p_ptr->x))
3719 find_breakright = TRUE;
3722 else if (see_wall(cycle[i-1], row, col))
3724 find_breakright = TRUE;
3728 /* Looking for a break */
3729 if (find_breakleft && find_breakright)
3731 /* Not looking for open area */
3732 find_openarea = FALSE;
3734 /* Hack -- allow angled corridor entry */
3737 if (deepleft && !deepright)
3739 find_prevdir = cycle[i - 1];
3741 else if (deepright && !deepleft)
3743 find_prevdir = cycle[i + 1];
3747 /* Hack -- allow blunt corridor entry */
3748 else if (see_wall(cycle[i], row, col))
3750 if (shortleft && !shortright)
3752 find_prevdir = cycle[i - 2];
3754 else if (shortright && !shortleft)
3756 find_prevdir = cycle[i + 2];
3764 * @brief ダッシュ移動が継続できるかどうかの判定 /
3765 * Update the current "run" path
3767 * ダッシュ移動が継続できるならばTRUEを返す。
3768 * Return TRUE if the running should be stopped
3770 static bool run_test(void)
3772 int prev_dir, new_dir, check_dir = 0;
3775 int option = 0, option2 = 0;
3778 feature_type *f_ptr;
3780 /* Where we came from */
3781 prev_dir = find_prevdir;
3784 /* Range of newly adjacent grids */
3785 max = (prev_dir & 0x01) + 1;
3787 /* break run when leaving trap detected region */
3788 if ((disturb_trap_detect || alert_trap_detect)
3789 && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
3791 /* No duplicate warning */
3792 p_ptr->dtrap = FALSE;
3794 /* You are just on the edge */
3795 if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
3797 if (alert_trap_detect)
3799 msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
3802 if (disturb_trap_detect)
3810 /* Look at every newly adjacent square. */
3811 for (i = -max; i <= max; i++)
3813 s16b this_o_idx, next_o_idx = 0;
3816 new_dir = cycle[chome[prev_dir] + i];
3819 row = p_ptr->y + ddy[new_dir];
3820 col = p_ptr->x + ddx[new_dir];
3823 c_ptr = &cave[row][col];
3825 /* Feature code (applying "mimic" field) */
3826 feat = get_feat_mimic(c_ptr);
3827 f_ptr = &f_info[feat];
3829 /* Visible monsters abort running */
3832 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3834 /* Visible monster */
3835 if (m_ptr->ml) return (TRUE);
3838 /* Visible objects abort running */
3839 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3843 /* Acquire object */
3844 o_ptr = &o_list[this_o_idx];
3846 /* Acquire next object */
3847 next_o_idx = o_ptr->next_o_idx;
3849 /* Visible object */
3850 if (o_ptr->marked & OM_FOUND) return (TRUE);
3853 /* Assume unknown */
3856 /* Check memorized grids */
3857 if (c_ptr->info & (CAVE_MARK))
3859 bool notice = have_flag(f_ptr->flags, FF_NOTICE);
3861 if (notice && have_flag(f_ptr->flags, FF_MOVE))
3864 if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
3866 /* Option -- ignore */
3871 else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
3873 /* Option -- ignore */
3878 else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
3885 else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
3886 (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
3893 /* Interesting feature */
3894 if (notice) return (TRUE);
3896 /* The grid is "visible" */
3900 /* Analyze unknown grids and floors considering mimic */
3901 if (inv || !see_wall(0, row, col))
3903 /* Looking for open area */
3909 /* The first new direction. */
3915 /* Three new directions. Stop running. */
3921 /* Two non-adjacent new directions. Stop running. */
3922 else if (option != cycle[chome[prev_dir] + i - 1])
3927 /* Two new (adjacent) directions (case 1) */
3928 else if (new_dir & 0x01)
3930 check_dir = cycle[chome[prev_dir] + i - 2];
3934 /* Two new (adjacent) directions (case 2) */
3937 check_dir = cycle[chome[prev_dir] + i + 1];
3943 /* Obstacle, while looking for open area */
3950 /* Break to the right */
3951 find_breakright = TRUE;
3956 /* Break to the left */
3957 find_breakleft = TRUE;
3963 /* Looking for open area */
3966 /* Hack -- look again */
3967 for (i = -max; i < 0; i++)
3969 /* Unknown grid or non-wall */
3970 if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x))
3972 /* Looking to break right */
3973 if (find_breakright)
3982 /* Looking to break left */
3990 /* Hack -- look again */
3991 for (i = max; i > 0; i--)
3993 /* Unknown grid or non-wall */
3994 if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x))
3996 /* Looking to break left */
4006 /* Looking to break right */
4007 if (find_breakright)
4015 /* Not looking for open area */
4027 /* Primary option */
4028 find_current = option;
4030 /* No other options */
4031 find_prevdir = option;
4034 /* Two options, examining corners */
4037 /* Primary option */
4038 find_current = option;
4040 /* Hack -- allow curving */
4041 find_prevdir = option2;
4044 /* Two options, pick one */
4047 /* Get next location */
4048 row = p_ptr->y + ddy[option];
4049 col = p_ptr->x + ddx[option];
4051 /* Don't see that it is closed off. */
4052 /* This could be a potential corner or an intersection. */
4053 if (!see_wall(option, row, col) ||
4054 !see_wall(check_dir, row, col))
4056 /* Can not see anything ahead and in the direction we */
4057 /* are turning, assume that it is a potential corner. */
4058 if (see_nothing(option, row, col) &&
4059 see_nothing(option2, row, col))
4061 find_current = option;
4062 find_prevdir = option2;
4065 /* STOP: we are next to an intersection or a room */
4072 /* This corner is seen to be enclosed; we cut the corner. */
4075 find_current = option2;
4076 find_prevdir = option2;
4079 /* This corner is seen to be enclosed, and we */
4080 /* deliberately go the long way. */
4083 find_current = option;
4084 find_prevdir = option2;
4089 /* About to hit a known wall, stop */
4090 if (see_wall(find_current, p_ptr->y, p_ptr->x))
4102 * @brief 継続的なダッシュ処理 /
4103 * Take one step along the current "run" path
4104 * @param dir 移動を試みる方向ID
4107 void run_step(int dir)
4112 /* Ignore AVOID_RUN on a first step */
4113 ignore_avoid_run = TRUE;
4115 /* Hack -- do not start silly run */
4116 if (see_wall(dir, p_ptr->y, p_ptr->x))
4119 msg_print(_("その方向には走れません。", "You cannot run in that direction."));
4146 /* Decrease the run counter */
4147 if (--running <= 0) return;
4150 p_ptr->energy_use = 100;
4152 /* Move the player, using the "pickup" flag */
4153 #ifdef ALLOW_EASY_DISARM /* TNB */
4155 move_player(find_current, FALSE, FALSE);
4157 #else /* ALLOW_EASY_DISARM -- TNB */
4159 move_player(find_current, always_pickup, FALSE);
4161 #endif /* ALLOW_EASY_DISARM -- TNB */
4163 if (player_bold(p_ptr->run_py, p_ptr->run_px))
4175 * @brief トラベル機能の判定処理 /
4176 * Test for traveling
4177 * @param prev_dir 前回移動を行った元の方角ID
4180 static int travel_test(int prev_dir)
4184 const cave_type *c_ptr;
4187 /* Cannot travel when blind */
4188 if (p_ptr->blind || no_lite())
4190 msg_print(_("目が見えない!", "You cannot see!"));
4194 /* break run when leaving trap detected region */
4195 if ((disturb_trap_detect || alert_trap_detect)
4196 && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
4198 /* No duplicate warning */
4199 p_ptr->dtrap = FALSE;
4201 /* You are just on the edge */
4202 if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
4204 if (alert_trap_detect)
4206 msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
4209 if (disturb_trap_detect)
4217 /* Range of newly adjacent grids */
4218 max = (prev_dir & 0x01) + 1;
4220 /* Look at every newly adjacent square. */
4221 for (i = -max; i <= max; i++)
4224 int dir = cycle[chome[prev_dir] + i];
4227 int row = p_ptr->y + ddy[dir];
4228 int col = p_ptr->x + ddx[dir];
4231 c_ptr = &cave[row][col];
4233 /* Visible monsters abort running */
4236 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4238 /* Visible monster */
4239 if (m_ptr->ml) return (0);
4244 /* Travel cost of current grid */
4245 cost = travel.cost[p_ptr->y][p_ptr->x];
4247 /* Determine travel direction */
4248 for (i = 0; i < 8; ++ i) {
4249 int dir_cost = travel.cost[p_ptr->y+ddy_ddd[i]][p_ptr->x+ddx_ddd[i]];
4251 if (dir_cost < cost)
4258 if (!new_dir) return (0);
4260 /* Access newly move grid */
4261 c_ptr = &cave[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]];
4263 /* Close door abort traveling */
4264 if (!easy_open && is_closed_door(c_ptr->feat)) return (0);
4266 /* Visible and unignorable trap abort tarveling */
4267 if (!c_ptr->mimic && !trap_can_be_ignored(c_ptr->feat)) return (0);
4275 * @brief トラベル機能の実装 /
4279 void travel_step(void)
4281 /* Get travel direction */
4282 travel.dir = travel_test(travel.dir);
4287 if (travel.run == 255)
4289 msg_print(_("道筋が見つかりません!", "No route is found!"));
4290 travel.y = travel.x = 0;
4296 p_ptr->energy_use = 100;
4298 move_player(travel.dir, always_pickup, FALSE);
4300 if ((p_ptr->y == travel.y) && (p_ptr->x == travel.x))
4303 travel.y = travel.x = 0;
4305 else if (travel.run > 0)
4309 Term_xtra(TERM_XTRA_DELAY, delay_factor);