3 /* Purpose: Movement commands (part 1) */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
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, int ac, int vis)
28 /* Hack -- Instant miss or hit */
29 if (k < 10) return (k < 5);
31 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
32 if (one_in_(20)) return (FALSE);
35 if (chance <= 0) return (FALSE);
37 /* Invisible monsters are harder to hit */
38 if (!vis) chance = (chance + 1) / 2;
40 /* Power competes against armor */
41 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
50 * Determine if the player "hits" a monster (normal combat).
52 * Note -- Always miss 5%, always hit 5%, otherwise random.
54 bool test_hit_norm(int chance, int ac, int vis)
61 /* Hack -- Instant miss or hit */
62 if (k < 10) return (k < 5);
64 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
65 if (one_in_(20)) return (FALSE);
67 /* Wimpy attack never hits */
68 if (chance <= 0) return (FALSE);
70 /* Penalize invisible targets */
71 if (!vis) chance = (chance + 1) / 2;
73 /* Power must defeat armor */
74 if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
83 * Critical hits (from objects thrown by player)
84 * Factor in item weight, total plusses, and player level.
86 s16b critical_shot(int weight, int plus, int dam)
90 /* Extract "shot" power */
91 i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2));
94 if (randint1(5000) <= i)
96 k = weight + randint1(500);
101 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
103 msg_print("It was a good hit!");
111 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
113 msg_print("It was a great hit!");
121 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
123 msg_print("It was a superb hit!");
136 * Critical hits (by player)
138 * Factor in weapon weight, total plusses, player level.
140 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
144 /* Extract "blow" power */
145 i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
148 if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
150 k = weight + randint1(650);
151 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
156 msg_print("¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
158 msg_print("It was a good hit!");
166 msg_print("¤«¤Ê¤ê¤Î¼ê¤´¤¿¤¨¤¬¤¢¤Ã¤¿¡ª");
168 msg_print("It was a great hit!");
176 msg_print("²ñ¿´¤Î°ì·â¤À¡ª");
178 msg_print("It was a superb hit!");
186 msg_print("ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
188 msg_print("It was a *GREAT* hit!");
196 msg_print("ÈæÎà¤Ê¤ºÇ¹â¤Î²ñ¿´¤Î°ì·â¤À¡ª");
198 msg_print("It was a *SUPERB* hit!");
201 dam = ((7 * dam) / 2) + 25;
211 * Extract the "total damage" from a given object hitting a given monster.
213 * Note that "flasks of oil" do NOT do fire damage, although they
214 * certainly could be made to do so. XXX XXX
216 * Note that most brands and slays are x3, except Slay Animal (x2),
217 * Slay Evil (x2), and Kill dragon (x5).
219 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode)
223 monster_race *r_ptr = &r_info[m_ptr->r_idx];
225 u32b flgs[TR_FLAG_SIZE];
227 /* Extract the flags */
228 object_flags(o_ptr, flgs);
230 /* Some "weapons" and "ammo" do extra damage */
242 if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
243 (r_ptr->flags3 & RF3_ANIMAL))
247 r_ptr->r_flags3 |= RF3_ANIMAL;
250 if (mult < 25) mult = 25;
254 if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
255 (r_ptr->flags3 & RF3_ANIMAL))
259 r_ptr->r_flags3 |= RF3_ANIMAL;
262 if (mult < 40) mult = 40;
266 if ((have_flag(flgs, TR_SLAY_EVIL)) &&
267 (r_ptr->flags3 & RF3_EVIL))
271 r_ptr->r_flags3 |= RF3_EVIL;
274 if (mult < 20) mult = 20;
278 if ((have_flag(flgs, TR_KILL_EVIL)) &&
279 (r_ptr->flags3 & RF3_EVIL))
283 r_ptr->r_flags3 |= RF3_EVIL;
286 if (mult < 35) mult = 35;
290 if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
291 (r_ptr->flags2 & RF2_HUMAN))
295 r_ptr->r_flags2 |= RF2_HUMAN;
298 if (mult < 25) mult = 25;
302 if ((have_flag(flgs, TR_KILL_HUMAN)) &&
303 (r_ptr->flags2 & RF2_HUMAN))
307 r_ptr->r_flags2 |= RF2_HUMAN;
310 if (mult < 40) mult = 40;
314 if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
315 (r_ptr->flags3 & RF3_UNDEAD))
319 r_ptr->r_flags3 |= RF3_UNDEAD;
322 if (mult < 30) mult = 30;
326 if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
327 (r_ptr->flags3 & RF3_UNDEAD))
331 r_ptr->r_flags3 |= RF3_UNDEAD;
334 if (mult < 50) mult = 50;
338 if ((have_flag(flgs, TR_SLAY_DEMON)) &&
339 (r_ptr->flags3 & RF3_DEMON))
343 r_ptr->r_flags3 |= RF3_DEMON;
346 if (mult < 30) mult = 30;
350 if ((have_flag(flgs, TR_KILL_DEMON)) &&
351 (r_ptr->flags3 & RF3_DEMON))
355 r_ptr->r_flags3 |= RF3_DEMON;
358 if (mult < 50) mult = 50;
362 if ((have_flag(flgs, TR_SLAY_ORC)) &&
363 (r_ptr->flags3 & RF3_ORC))
367 r_ptr->r_flags3 |= RF3_ORC;
370 if (mult < 30) mult = 30;
374 if ((have_flag(flgs, TR_KILL_ORC)) &&
375 (r_ptr->flags3 & RF3_ORC))
379 r_ptr->r_flags3 |= RF3_ORC;
382 if (mult < 50) mult = 50;
386 if ((have_flag(flgs, TR_SLAY_TROLL)) &&
387 (r_ptr->flags3 & RF3_TROLL))
391 r_ptr->r_flags3 |= RF3_TROLL;
394 if (mult < 30) mult = 30;
398 if ((have_flag(flgs, TR_KILL_TROLL)) &&
399 (r_ptr->flags3 & RF3_TROLL))
403 r_ptr->r_flags3 |= RF3_TROLL;
406 if (mult < 50) mult = 50;
410 if ((have_flag(flgs, TR_SLAY_GIANT)) &&
411 (r_ptr->flags3 & RF3_GIANT))
415 r_ptr->r_flags3 |= RF3_GIANT;
418 if (mult < 30) mult = 30;
419 if (o_ptr->name1 == ART_HRUNTING)
424 if ((have_flag(flgs, TR_KILL_GIANT)) &&
425 (r_ptr->flags3 & RF3_GIANT))
429 r_ptr->r_flags3 |= RF3_GIANT;
432 if (mult < 50) mult = 50;
436 if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
437 (r_ptr->flags3 & RF3_DRAGON))
441 r_ptr->r_flags3 |= RF3_DRAGON;
444 if (mult < 30) mult = 30;
448 if ((have_flag(flgs, TR_KILL_DRAGON)) &&
449 (r_ptr->flags3 & RF3_DRAGON))
453 r_ptr->r_flags3 |= RF3_DRAGON;
456 if (mult < 50) mult = 50;
458 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
463 if ((have_flag(flgs, TR_BRAND_ACID)) || (p_ptr->special_attack & (ATTACK_ACID)))
465 /* Notice immunity */
466 if (r_ptr->flags3 & RF3_IM_ACID)
470 r_ptr->r_flags3 |= RF3_IM_ACID;
474 /* Otherwise, take the damage */
477 if (mult < 25) mult = 25;
482 if ((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC)) || (mode == HISSATSU_ELEC))
484 /* Notice immunity */
485 if (r_ptr->flags3 & RF3_IM_ELEC)
489 r_ptr->r_flags3 |= RF3_IM_ELEC;
493 /* Otherwise, take the damage */
494 else if (((have_flag(flgs, TR_BRAND_ELEC)) || (p_ptr->special_attack & (ATTACK_ELEC))) && (mode == HISSATSU_ELEC))
496 if (mult < 70) mult = 70;
498 else if (mode == HISSATSU_ELEC)
500 if (mult < 50) mult = 50;
505 if (mult < 25) mult = 25;
510 if ((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE)) || (mode == HISSATSU_FIRE))
512 /* Notice immunity */
513 if (r_ptr->flags3 & RF3_IM_FIRE)
517 r_ptr->r_flags3 |= RF3_IM_FIRE;
521 /* Otherwise, take the damage */
522 else if (((have_flag(flgs, TR_BRAND_FIRE)) || (p_ptr->special_attack & (ATTACK_FIRE))) && (mode == HISSATSU_FIRE))
524 if (r_ptr->flags3 & RF3_HURT_FIRE)
526 if (mult < 70) mult = 70;
529 r_ptr->r_flags3 |= RF3_HURT_FIRE;
532 else if (mult < 35) mult = 35;
536 if (r_ptr->flags3 & RF3_HURT_FIRE)
538 if (mult < 50) mult = 50;
541 r_ptr->r_flags3 |= RF3_HURT_FIRE;
544 else if (mult < 25) mult = 25;
549 if ((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD)) || (mode == HISSATSU_COLD))
551 /* Notice immunity */
552 if (r_ptr->flags3 & RF3_IM_COLD)
556 r_ptr->r_flags3 |= RF3_IM_COLD;
559 /* Otherwise, take the damage */
560 else if (((have_flag(flgs, TR_BRAND_COLD)) || (p_ptr->special_attack & (ATTACK_COLD))) && (mode == HISSATSU_COLD))
562 if (r_ptr->flags3 & RF3_HURT_COLD)
564 if (mult < 70) mult = 70;
567 r_ptr->r_flags3 |= RF3_HURT_COLD;
570 else if (mult < 35) mult = 35;
574 if (r_ptr->flags3 & RF3_HURT_COLD)
576 if (mult < 50) mult = 50;
579 r_ptr->r_flags3 |= RF3_HURT_COLD;
582 else if (mult < 25) mult = 25;
587 if ((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS)) || (mode == HISSATSU_POISON))
589 /* Notice immunity */
590 if (r_ptr->flags3 & RF3_IM_POIS)
594 r_ptr->r_flags3 |= RF3_IM_POIS;
598 /* Otherwise, take the damage */
599 else if (((have_flag(flgs, TR_BRAND_POIS)) || (p_ptr->special_attack & (ATTACK_POIS))) && (mode == HISSATSU_POISON))
601 if (mult < 35) mult = 35;
605 if (mult < 25) mult = 25;
608 if ((mode == HISSATSU_ZANMA) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL))
610 if (mult < 15) mult = 25;
611 else if (mult < 50) mult = MIN(50, mult+20);
613 if (mode == HISSATSU_UNDEAD)
615 if (r_ptr->flags3 & RF3_UNDEAD)
619 r_ptr->r_flags3 |= RF3_UNDEAD;
621 if (mult == 10) mult = 70;
622 else if (mult < 140) mult = MIN(140, mult+60);
624 if (mult == 10) mult = 40;
625 else if (mult < 60) mult = MIN(60, mult+30);
627 if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && !(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
629 int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
630 if (mult < tmp) mult = tmp;
632 if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK))
636 r_ptr->r_flags3 |= RF3_HURT_ROCK;
638 if (mult == 10) mult = 40;
639 else if (mult < 60) mult = 60;
641 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
643 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
644 p_ptr->redraw |= (PR_MANA);
645 mult = mult * 3 / 2 + 20;
650 if (mult > 150) mult = 150;
652 /* Return the total damage */
653 return (tdam * mult / 10);
658 * Search for hidden things
664 s16b this_o_idx, next_o_idx = 0;
669 /* Start with base search ability */
670 chance = p_ptr->skill_srh;
672 /* Penalize various conditions */
673 if (p_ptr->blind || no_lite()) chance = chance / 10;
674 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
676 /* Search the nearby grids, which are always in bounds */
677 for (y = (py - 1); y <= (py + 1); y++)
679 for (x = (px - 1); x <= (px + 1); x++)
681 /* Sometimes, notice things */
682 if (randint0(100) < chance)
684 /* Access the grid */
688 if (c_ptr->info & CAVE_TRAP)
695 msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
697 msg_print("You have found a trap.");
705 /* Invisible wall opening trap */
706 if (c_ptr->feat == FEAT_INVIS)
708 /* Activate the trap */
709 cave_set_feat(y, x, FEAT_TRAP_OPEN);
713 msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
715 msg_print("You have found a trap.");
723 if (c_ptr->feat == FEAT_SECRET)
727 msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
729 msg_print("You have found a secret door.");
734 place_closed_door(y, x);
740 /* Scan all objects in the grid */
741 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
746 o_ptr = &o_list[this_o_idx];
748 /* Acquire next object */
749 next_o_idx = o_ptr->next_o_idx;
751 /* Skip non-chests */
752 if (o_ptr->tval != TV_CHEST) continue;
754 /* Skip non-trapped chests */
755 if (!chest_traps[o_ptr->pval]) continue;
758 if (!object_known_p(o_ptr))
762 msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
764 msg_print("You have discovered a trap on the chest!");
782 * Helper routine for py_pickup() and py_pickup_floor().
784 * Add the given dungeon object to the character's inventory.
786 * Delete the object afterwards.
788 void py_pickup_aux(int o_idx)
794 * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
795 * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
797 * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
798 * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
800 char o_name[MAX_NLEN];
801 char old_name[MAX_NLEN];
805 char o_name[MAX_NLEN];
810 o_ptr = &o_list[o_idx];
813 /* Describe the object */
814 object_desc(old_name, o_ptr, TRUE, 0);
815 object_desc_kosuu(kazu_str, o_ptr);
816 hirottakazu = o_ptr->number;
818 /* Carry the object */
819 slot = inven_carry(o_ptr);
821 /* Get the object again */
822 o_ptr = &inventory[slot];
824 /* Delete the object */
825 delete_object_idx(o_idx);
827 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) identify_item(o_ptr);
829 /* Describe the object */
830 object_desc(o_name, o_ptr, TRUE, 3);
834 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
836 msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name);
837 msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢");
838 msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name);
844 msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot));
848 if (o_ptr->number > hirottakazu) {
849 msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",
850 kazu_str, o_name, index_to_label(slot));
852 msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot));
856 strcpy(record_o_name, old_name);
858 msg_format("You have %s (%c).", o_name, index_to_label(slot));
859 strcpy(record_o_name, o_name);
864 /* Check if completed a quest */
865 for (i = 0; i < max_quests; i++)
867 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
868 (quest[i].status == QUEST_STATUS_TAKEN) &&
869 (quest[i].k_idx == o_ptr->name1))
871 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
872 quest[i].status = QUEST_STATUS_COMPLETED;
873 quest[i].complev = (byte)p_ptr->lev;
875 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
877 msg_print("You completed your quest!");
887 * Player "wants" to pick up an object or gold.
888 * Note that we ONLY handle things that can be picked up.
889 * See "move_player()" for handling of other things.
891 void carry(int pickup)
893 cave_type *c_ptr = &cave[py][px];
895 s16b this_o_idx, next_o_idx = 0;
897 char o_name[MAX_NLEN];
899 /* Recenter the map around the player */
903 p_ptr->update |= (PU_MONSTERS);
906 p_ptr->redraw |= (PR_MAP);
909 p_ptr->window |= (PW_OVERHEAD);
914 /* Automatically pickup/destroy/inscribe items */
915 auto_pickup_items(c_ptr);
918 #ifdef ALLOW_EASY_FLOOR
922 py_pickup_floor(pickup);
926 #endif /* ALLOW_EASY_FLOOR */
928 /* Scan the pile of objects */
929 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
934 o_ptr = &o_list[this_o_idx];
936 #ifdef ALLOW_EASY_SENSE /* TNB */
938 /* Option: Make item sensing easy */
941 /* Sense the object */
942 (void)sense_object(o_ptr);
945 #endif /* ALLOW_EASY_SENSE -- TNB */
947 /* Describe the object */
948 object_desc(o_name, o_ptr, TRUE, 3);
950 /* Acquire next object */
951 next_o_idx = o_ptr->next_o_idx;
953 /* Hack -- disturb */
957 if (o_ptr->tval == TV_GOLD)
959 int value = (long)o_ptr->pval;
961 /* Delete the gold */
962 delete_object_idx(this_o_idx);
966 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
967 (long)value, o_name);
969 msg_format("You collect %ld gold pieces worth of %s.",
970 (long)value, o_name);
976 /* Collect the gold */
980 p_ptr->redraw |= (PR_GOLD);
983 p_ptr->window |= (PW_PLAYER);
986 /* Pick up objects */
989 /* Hack - some objects were handled in auto_pickup_items(). */
990 if (o_ptr->marked & OM_NOMSG)
992 /* Clear the flag. */
993 o_ptr->marked &= ~OM_NOMSG;
995 /* Describe the object */
1000 msg_format("%s¤¬¤¢¤ë¡£", o_name);
1002 msg_format("You see %s.", o_name);
1007 /* Note that the pack is too full */
1008 else if (!inven_carry_okay(o_ptr))
1011 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
1013 msg_format("You have no room for %s.", o_name);
1018 /* Pick up the item (if requested and allowed) */
1023 /* Hack -- query every item */
1024 if (carry_query_flag)
1026 char out_val[MAX_NLEN+20];
1028 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
1030 sprintf(out_val, "Pick up %s? ", o_name);
1033 okay = get_check(out_val);
1036 /* Attempt to pick up an object. */
1039 /* Pick up the object */
1040 py_pickup_aux(this_o_idx);
1049 * Determine if a trap affects the player.
1050 * Always miss 5% of the time, Always hit 5% of the time.
1051 * Otherwise, match trap power against player armor.
1053 static int check_hit(int power)
1057 /* Percentile dice */
1060 /* Hack -- 5% hit, 5% miss */
1061 if (k < 10) return (k < 5);
1063 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1064 if (one_in_(20)) return (TRUE);
1066 /* Paranoia -- No power */
1067 if (power <= 0) return (FALSE);
1070 ac = p_ptr->ac + p_ptr->to_a;
1072 /* Power competes against Armor */
1073 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
1082 * Handle player hitting a real trap
1084 static void hit_trap(bool break_trap)
1092 cptr name = "¥È¥é¥Ã¥×";
1094 cptr name = "a trap";
1099 /* Disturb the player */
1102 /* Get the cave grid */
1103 c_ptr = &cave[y][x];
1105 /* Analyze XXX XXX XXX */
1106 switch (c_ptr->feat)
1108 case FEAT_TRAP_TRAPDOOR:
1113 msg_print("Í¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
1115 msg_print("You fly over a trap door.");
1122 msg_print("Í¸Í¤ËÍî¤Á¤¿¡ª");
1123 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1124 msg_print("¤¯¤Ã¤½¡Á¡ª");
1126 msg_print("You have fallen through a trap door!");
1130 dam = damroll(2, 8);
1134 name = "a trap door";
1137 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1139 /* Still alive and autosave enabled */
1140 if (autosave_l && (p_ptr->chp >= 0))
1141 do_cmd_save_game(TRUE);
1144 do_cmd_write_nikki(NIKKI_STAIR, 1, "Í¸Í¤ËÍî¤Á¤¿");
1146 do_cmd_write_nikki(NIKKI_STAIR, 1, "You have fallen through a trap door!");
1151 p_ptr->leaving = TRUE;
1161 msg_print("Í·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1163 msg_print("You fly over a pit trap.");
1170 msg_print("Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1172 msg_print("You have fallen into a pit!");
1175 dam = damroll(2, 6);
1179 name = "a pit trap";
1182 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1187 case FEAT_TRAP_SPIKED_PIT:
1192 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1194 msg_print("You fly over a spiked pit.");
1201 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1203 msg_print("You fall into a spiked pit!");
1211 name = "a pit trap";
1214 dam = damroll(2, 6);
1216 /* Extra spike damage */
1217 if (randint0(100) < 50)
1220 msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1222 msg_print("You are impaled!");
1227 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1229 name = "a spiked pit";
1233 (void)set_cut(p_ptr->cut + randint1(dam));
1236 /* Take the damage */
1237 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1242 case FEAT_TRAP_POISON_PIT:
1247 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1249 msg_print("You fly over a spiked pit.");
1256 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1258 msg_print("You fall into a spiked pit!");
1263 dam = damroll(2, 6);
1268 name = "a pit trap";
1272 /* Extra spike damage */
1273 if (randint0(100) < 50)
1276 msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1278 msg_print("You are impaled on poisonous spikes!");
1283 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1285 name = "a spiked pit";
1290 (void)set_cut(p_ptr->cut + randint1(dam));
1292 if (p_ptr->resist_pois || p_ptr->oppose_pois)
1295 msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
1297 msg_print("The poison does not affect you!");
1305 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
1309 /* Take the damage */
1310 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1316 case FEAT_TRAP_TY_CURSE:
1319 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1321 msg_print("There is a flash of shimmering light!");
1324 c_ptr->info &= ~(CAVE_MARK);
1325 cave_set_feat(y, x, floor_type[randint0(100)]);
1326 num = 2 + randint1(3);
1327 for (i = 0; i < num; i++)
1329 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1332 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1334 bool stop_ty = FALSE;
1339 stop_ty = activate_ty_curse(stop_ty, &count);
1346 case FEAT_TRAP_TELEPORT:
1349 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1351 msg_print("You hit a teleport trap!");
1354 teleport_player(100);
1358 case FEAT_TRAP_FIRE:
1361 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1363 msg_print("You are enveloped in flames!");
1366 dam = damroll(4, 6);
1368 (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
1370 (void)fire_dam(dam, "a fire trap", -1);
1376 case FEAT_TRAP_ACID:
1379 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1381 msg_print("You are splashed with acid!");
1384 dam = damroll(4, 6);
1386 (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
1388 (void)acid_dam(dam, "an acid trap", -1);
1394 case FEAT_TRAP_SLOW:
1399 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1401 msg_print("A small dart hits you!");
1404 dam = damroll(1, 4);
1405 take_hit(DAMAGE_ATTACK, dam, name, -1);
1406 (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
1411 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1413 msg_print("A small dart barely misses you.");
1420 case FEAT_TRAP_LOSE_STR:
1425 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1427 msg_print("A small dart hits you!");
1430 dam = damroll(1, 4);
1432 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1434 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1437 (void)do_dec_stat(A_STR);
1442 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1444 msg_print("A small dart barely misses you.");
1451 case FEAT_TRAP_LOSE_DEX:
1456 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1458 msg_print("A small dart hits you!");
1461 dam = damroll(1, 4);
1463 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1465 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1468 (void)do_dec_stat(A_DEX);
1473 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1475 msg_print("A small dart barely misses you.");
1482 case FEAT_TRAP_LOSE_CON:
1487 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1489 msg_print("A small dart hits you!");
1492 dam = damroll(1, 4);
1494 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1496 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1499 (void)do_dec_stat(A_CON);
1504 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1506 msg_print("A small dart barely misses you.");
1513 case FEAT_TRAP_BLIND:
1516 msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1518 msg_print("A black gas surrounds you!");
1521 if (!p_ptr->resist_blind)
1523 (void)set_blind(p_ptr->blind + randint0(50) + 25);
1528 case FEAT_TRAP_CONFUSE:
1531 msg_print("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1533 msg_print("A gas of scintillating colors surrounds you!");
1536 if (!p_ptr->resist_conf)
1538 (void)set_confused(p_ptr->confused + randint0(20) + 10);
1543 case FEAT_TRAP_POISON:
1546 msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1548 msg_print("A pungent green gas surrounds you!");
1551 if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
1553 (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
1558 case FEAT_TRAP_SLEEP:
1561 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1563 msg_print("A strange white mist surrounds you!");
1566 if (!p_ptr->free_act)
1569 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1571 msg_print("You fall asleep.");
1575 if (ironman_nightmare)
1578 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1580 msg_print("A horrible vision enters your mind.");
1584 /* Pick a nightmare */
1585 get_mon_num_prep(get_nightmare, NULL);
1587 /* Have some nightmares */
1588 have_nightmare(get_mon_num(MAX_DEPTH));
1590 /* Remove the monster restriction */
1591 get_mon_num_prep(NULL, NULL);
1593 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1598 case FEAT_TRAP_TRAPS:
1601 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1603 msg_print("There is a bright flash of light!");
1607 /* Destroy this trap */
1608 cave_set_feat(y, x, floor_type[randint0(100)]);
1610 /* Make some new traps */
1611 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1616 case FEAT_TRAP_ALARM:
1619 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1621 msg_print("An alarm sounds!");
1624 aggravate_monsters(0);
1629 case FEAT_TRAP_OPEN:
1632 msg_print("Âç²»¶Á¤È¶¦¤Ë¤Þ¤ï¤ê¤ÎÊɤ¬Êø¤ì¤¿¡ª");
1634 msg_print("Suddenly, surrounding walls are opened!");
1636 (void)project(0, 3, y, x, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1637 (void)project(0, 3, y, x - 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1638 (void)project(0, 3, y, x + 4, 0, GF_DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE, -1);
1639 aggravate_monsters(0);
1644 if (break_trap && is_trap(c_ptr->feat))
1646 cave_set_feat(y, x, floor_type[randint0(100)]);
1648 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1650 msg_print("You destroyed the trap.");
1656 static void touch_zap_player(monster_type *m_ptr)
1658 int aura_damage = 0;
1659 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1661 if (r_ptr->flags2 & RF2_AURA_FIRE)
1663 if (!p_ptr->immune_fire)
1667 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1669 /* Hack -- Get the "died from" name */
1670 monster_desc(aura_dam, m_ptr, 0x288);
1673 msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
1675 msg_print("You are suddenly very hot!");
1679 if (p_ptr->oppose_fire) aura_damage = (aura_damage + 2) / 3;
1680 if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
1682 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1683 r_ptr->r_flags2 |= RF2_AURA_FIRE;
1688 if (r_ptr->flags3 & RF3_AURA_COLD)
1690 if (!p_ptr->immune_cold)
1694 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1696 /* Hack -- Get the "died from" name */
1697 monster_desc(aura_dam, m_ptr, 0x288);
1700 msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
1702 msg_print("You are suddenly very cold!");
1706 if (p_ptr->oppose_cold) aura_damage = (aura_damage + 2) / 3;
1707 if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
1709 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1710 r_ptr->r_flags3 |= RF3_AURA_COLD;
1715 if (r_ptr->flags2 & RF2_AURA_ELEC)
1717 if (!p_ptr->immune_elec)
1721 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1723 /* Hack -- Get the "died from" name */
1724 monster_desc(aura_dam, m_ptr, 0x288);
1726 if (p_ptr->oppose_elec) aura_damage = (aura_damage + 2) / 3;
1727 if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
1730 msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
1732 msg_print("You get zapped!");
1735 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1736 r_ptr->r_flags2 |= RF2_AURA_ELEC;
1743 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1745 int k, bonus, chance;
1747 monster_type *m_ptr = &m_list[m_idx];
1748 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1757 case MUT2_SCOR_TAIL:
1784 atk_desc = "¥¯¥Á¥Ð¥·";
1795 atk_desc = "¾Ý¤ÎÉ¡";
1801 case MUT2_TENTACLES:
1808 atk_desc = "tentacles";
1813 dss = ddd = n_weight = 1;
1815 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1817 atk_desc = "undefined body part";
1822 /* Extract monster name (or "it") */
1823 monster_desc(m_name, m_ptr, 0);
1826 /* Calculate the "attack quality" */
1827 bonus = p_ptr->to_h_m;
1828 bonus += (p_ptr->lev * 6 / 5);
1829 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1832 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1838 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1840 msg_format("You hit %s with your %s.", m_name, atk_desc);
1844 k = damroll(ddd, dss);
1845 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1847 /* Apply the player damage bonuses */
1850 /* No negative damage */
1853 /* Modify the damage */
1854 k = mon_damage_mod(m_ptr, k, FALSE);
1856 /* Complex message */
1860 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1862 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1867 /* Anger the monster */
1868 if (k > 0) anger_monster(m_ptr);
1870 /* Damage, check for fear and mdeath */
1873 case MUT2_SCOR_TAIL:
1874 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1875 *mdeath = (m_ptr->r_idx == 0);
1878 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1881 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1884 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1886 case MUT2_TENTACLES:
1887 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1890 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1893 touch_zap_player(m_ptr);
1903 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1905 msg_format("You miss %s.", m_name);
1914 * Player attacks a (poor, defenseless) creature -RAK-
1916 * If no "weapon" is available, then "punch" the monster one time.
1918 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1920 int num = 0, k, bonus, chance, vir;
1922 cave_type *c_ptr = &cave[y][x];
1924 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1925 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1931 bool success_hit = FALSE;
1932 bool old_success_hit = FALSE;
1933 bool backstab = FALSE;
1934 bool vorpal_cut = FALSE;
1935 int chaos_effect = 0;
1936 bool stab_fleeing = FALSE;
1937 bool fuiuchi = FALSE;
1938 bool do_quake = FALSE;
1940 bool drain_msg = TRUE;
1941 int drain_result = 0, drain_heal = 0;
1942 bool can_drain = FALSE;
1944 int drain_left = MAX_VAMPIRIC_DRAIN;
1945 u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1946 bool is_human = (r_ptr->d_char == 'p');
1947 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1948 bool zantetsu_mukou, e_j_mukou;
1952 if (((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) && inventory[INVEN_RARM+hand].tval)
1954 int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
1955 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1956 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1957 if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
1958 if (m_ptr->csleep && m_ptr->ml)
1960 /* Can't backstab creatures that we can't see, right? */
1963 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
1967 else if (m_ptr->monfear && m_ptr->ml)
1969 stab_fleeing = TRUE;
1973 if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
1975 if ((r_ptr->level + 10) > p_ptr->lev)
1977 if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1979 if (p_ptr->skill_exp[GINOU_SUDE] < 4000)
1980 p_ptr->skill_exp[GINOU_SUDE]+=40;
1981 else if((p_ptr->skill_exp[GINOU_SUDE] < 6000))
1982 p_ptr->skill_exp[GINOU_SUDE]+=5;
1983 else if((p_ptr->skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
1984 p_ptr->skill_exp[GINOU_SUDE]+=1;
1985 else if((p_ptr->skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
1986 if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE]+=1;
1987 p_ptr->update |= (PU_BONUS);
1993 if ((r_ptr->level + 10) > p_ptr->lev)
1995 int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
1996 int sval = inventory[INVEN_RARM+hand].sval;
1997 int now_exp = p_ptr->weapon_exp[tval][sval];
1998 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
2001 if (now_exp < 4000) amount = 80;
2002 else if(now_exp < 6000) amount = 10;
2003 else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1;
2004 else if((p_ptr->lev > 34) && one_in_(2)) amount = 1;
2005 p_ptr->weapon_exp[tval][sval] += amount;
2006 p_ptr->update |= (PU_BONUS);
2011 /* Disturb the monster */
2013 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
2014 p_ptr->update |= (PU_MON_LITE);
2016 /* Extract monster name (or "it") */
2017 monster_desc(m_name, m_ptr, 0);
2019 /* Access the weapon */
2020 o_ptr = &inventory[INVEN_RARM+hand];
2022 /* Calculate the "attack quality" */
2023 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
2024 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
2025 if (mode == HISSATSU_IAI) chance += 60;
2026 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
2028 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
2030 vir = virtue_number(V_VALOUR);
2033 chance += (p_ptr->virtues[vir - 1]/10);
2036 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
2037 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
2039 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
2040 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
2041 else num_blow = p_ptr->num_blow[hand];
2043 /* Attack once for each legal blow */
2044 while ((num++ < num_blow) && !p_ptr->is_dead)
2046 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2048 if (p_ptr->migite && p_ptr->hidarite)
2050 success_hit = one_in_(2);
2052 else success_hit = TRUE;
2054 else if (mode == HISSATSU_MAJIN)
2059 success_hit = FALSE;
2060 old_success_hit = success_hit;
2062 else success_hit = old_success_hit;
2064 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flags3 & RF3_RES_ALL))) success_hit = TRUE;
2065 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
2070 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
2078 msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª",
2080 msg_format("You cruelly stab the helpless, sleeping %s!",
2086 msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª",
2088 msg_format("You make surprise attack, and hit %s with a powerful blow!",
2092 else if (stab_fleeing)
2094 msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª",
2096 msg_format("You backstab the fleeing %s!",
2102 if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1)))
2104 msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
2106 msg_format("You hit %s.", m_name);
2111 /* Hack -- bare hands do one damage */
2114 object_flags(o_ptr, flgs);
2116 /* Select a chaotic effect (50% chance) */
2117 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
2120 chg_virtue(V_CHANCE, 1);
2122 if (randint1(5) < 3)
2124 /* Vampiric (20%) */
2127 else if (one_in_(250))
2132 else if (!one_in_(10))
2134 /* Confusion (26.892%) */
2137 else if (one_in_(2))
2139 /* Teleport away (1.494%) */
2144 /* Polymorph (1.494%) */
2149 /* Vampiric drain */
2150 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
2152 /* Only drain "living" monsters */
2153 if (monster_living(r_ptr))
2159 if ((have_flag(flgs, TR_VORPAL)) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
2161 else vorpal_cut = FALSE;
2163 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
2165 int special_effect = 0, stun_effect = 0, times = 0, max_times;
2167 martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
2168 int resist_stun = 0;
2171 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
2172 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
2173 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
2174 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
2175 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
2178 if (p_ptr->special_defense & KAMAE_BYAKKO)
2179 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
2180 else if (p_ptr->special_defense & KAMAE_SUZAKU)
2182 else if (p_ptr->special_defense & KAMAE_GENBU)
2185 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
2186 /* Attempt 'times' */
2187 for (times = 0; times < max_times; times++)
2191 ma_ptr = &ma_blows[randint0(MAX_MA)];
2192 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
2193 else min_level = ma_ptr->min_level;
2195 while ((min_level > p_ptr->lev) ||
2196 (randint1(p_ptr->lev) < ma_ptr->chance));
2198 /* keep the highest level attack available we found */
2199 if ((ma_ptr->min_level > old_ptr->min_level) &&
2200 !p_ptr->stun && !p_ptr->confused)
2204 if (p_ptr->wizard && cheat_xtra)
2207 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
2209 msg_print("Attack re-selected.");
2220 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
2221 else min_level = ma_ptr->min_level;
2222 k = damroll(ma_ptr->dd, ma_ptr->ds);
2223 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
2225 if (ma_ptr->effect == MA_KNEE)
2227 if (r_ptr->flags1 & RF1_MALE)
2230 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2232 msg_format("You hit %s in the groin with your knee!", m_name);
2236 special_effect = MA_KNEE;
2239 msg_format(ma_ptr->desc, m_name);
2242 else if (ma_ptr->effect == MA_SLOW)
2244 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
2245 strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
2248 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2250 msg_format("You kick %s in the ankle.", m_name);
2253 special_effect = MA_SLOW;
2255 else msg_format(ma_ptr->desc, m_name);
2261 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
2264 msg_format(ma_ptr->desc, m_name);
2267 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
2268 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
2270 weight += (p_ptr->magic_num1[0]/30);
2271 if (weight > 20) weight = 20;
2274 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
2276 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2279 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
2281 msg_format("%^s moans in agony!", m_name);
2284 stun_effect = 7 + randint1(13);
2288 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2290 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2291 (randint1(p_ptr->lev) > r_ptr->level) &&
2295 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
2297 msg_format("%^s starts limping slower.", m_name);
2300 m_ptr->mspeed -= 10;
2304 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2306 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
2310 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2312 msg_format("%^s is more stunned.", m_name);
2317 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2319 msg_format("%^s is stunned.", m_name);
2323 m_ptr->stunned += stun_effect;
2328 /* Handle normal weapon */
2329 else if (o_ptr->k_idx)
2331 k = damroll(o_ptr->dd, o_ptr->ds);
2334 if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
2336 k += damroll(2, o_ptr->ds);
2340 k = tot_dam_aux(o_ptr, k, m_ptr, mode);
2344 k *= (3 + (p_ptr->lev / 20));
2348 k = k*(5+(p_ptr->lev*2/25))/2;
2350 else if (stab_fleeing)
2355 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
2356 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
2361 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
2362 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2370 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
2372 char chainsword_noise[1024];
2374 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
2376 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
2380 msg_print(chainsword_noise);
2384 if (o_ptr->name1 == ART_VORPAL_BLADE)
2387 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥Ü¡¼¥Ñ¥ë¡¦¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
2389 msg_print("Your Vorpal Blade goes snicker-snack!");
2396 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
2398 msg_format("Your weapon cuts deep into %s!", m_name);
2403 /* Try to increase the damage */
2404 while (one_in_(vorpal_chance))
2412 if (((r_ptr->flags3 & RF3_RES_ALL) ? k/100 : k) > m_ptr->hp)
2415 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
2417 msg_format("You cut %s in half!", m_name);
2426 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
2428 case 2: msg_format("You gouge %s!", m_name); break;
2432 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
2434 case 3: msg_format("You maim %s!", m_name); break;
2438 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
2440 case 4: msg_format("You carve %s!", m_name); break;
2444 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
2446 case 5: msg_format("You cleave %s!", m_name); break;
2450 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
2452 case 6: msg_format("You smite %s!", m_name); break;
2456 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
2458 case 7: msg_format("You eviscerate %s!", m_name); break;
2462 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
2464 default: msg_format("You shred %s!", m_name); break;
2469 drain_result = drain_result * 3 / 2;
2473 drain_result += o_ptr->to_d;
2476 /* Apply the player damage bonuses */
2477 k += p_ptr->to_d[hand];
2478 drain_result += p_ptr->to_d[hand];
2480 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2481 if ((mode == HISSATSU_SEKIRYUKA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON | RF3_NONLIVING))) k = 0;
2482 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2484 /* No negative damage */
2487 if ((mode == HISSATSU_ZANMA) && !((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL)))
2495 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2497 msg_print("You cannot cut such a elastic thing!");
2505 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2507 msg_print("Spiders are difficult for you to deal with!");
2512 if (mode == HISSATSU_MINEUCHI)
2514 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2517 anger_monster(m_ptr);
2519 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2525 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2527 msg_format("%s is more dazed.", m_name);
2535 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2537 msg_format("%s is dazed.", m_name);
2542 m_ptr->stunned = (tmp < 200) ? tmp : 200;
2547 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2549 msg_format("%s is not effected.", m_name);
2554 /* Modify the damage */
2555 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))));
2556 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2558 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2562 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2564 msg_format("You hit %s on a fatal spot!", m_name);
2569 else if ((p_ptr->pclass == CLASS_NINJA) && (!p_ptr->icky_wield[hand]) && ((p_ptr->cur_lite <= 0) || one_in_(7)))
2571 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2572 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2577 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2579 msg_format("You critically injured %s!", m_name);
2582 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)))
2584 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2586 k = MAX(k*5, m_ptr->hp/2);
2589 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2591 msg_format("You fatally injured %s!", m_name);
2598 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2600 msg_format("You hit %s on a fatal spot!", m_name);
2606 /* Complex message */
2607 if (p_ptr->wizard || cheat_xtra)
2610 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2612 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2617 if (k <= 0) can_drain = FALSE;
2619 if (drain_result > m_ptr->hp)
2620 drain_result = m_ptr->hp;
2622 /* Damage, check for fear and death */
2623 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2626 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2628 if (p_ptr->migite && p_ptr->hidarite)
2630 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2631 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2635 energy_use = energy_use*num/p_ptr->num_blow[hand];
2638 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2640 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2642 msg_print("Sign..Another trifling thing I've cut....");
2647 /* Anger the monster */
2648 if (k > 0) anger_monster(m_ptr);
2650 touch_zap_player(m_ptr);
2652 /* Are we draining it? A little note: If the monster is
2653 dead, the drain does not work... */
2655 if (can_drain && (drain_result > 0))
2657 if (o_ptr->name1 == ART_MURAMASA)
2661 int to_h = o_ptr->to_h;
2662 int to_d = o_ptr->to_d;
2666 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2670 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2673 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2676 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2678 msg_print("Muramasa sucked blood, and became more powerful!");
2687 if (drain_result > 5) /* Did we really hurt it? */
2689 drain_heal = damroll(2, drain_result / 6);
2694 msg_format("Draining left: %d", drain_left);
2696 msg_format("Draining left: %d", drain_left);
2703 if (drain_heal < drain_left)
2705 drain_left -= drain_heal;
2709 drain_heal = drain_left;
2716 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2718 msg_format("Your weapon drains life from %s!", m_name);
2724 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2726 hp_player(drain_heal);
2727 /* We get to keep some of it! */
2731 m_ptr->maxhp -= (k+7)/8;
2732 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2738 /* Confusion attack */
2739 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF))
2741 /* Cancel glowing hands */
2742 if (p_ptr->special_attack & ATTACK_CONFUSE)
2744 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2746 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2748 msg_print("Your hands stop glowing.");
2750 p_ptr->redraw |= (PR_STATUS);
2754 /* Confuse the monster */
2755 if (r_ptr->flags3 & RF3_NO_CONF)
2759 r_ptr->r_flags3 |= RF3_NO_CONF;
2763 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2765 msg_format("%^s is unaffected.", m_name);
2769 else if (randint0(100) < r_ptr->level)
2772 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2774 msg_format("%^s is unaffected.", m_name);
2781 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2783 msg_format("%^s appears confused.", m_name);
2786 m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
2790 else if (chaos_effect == 4)
2792 bool resists_tele = FALSE;
2794 if (r_ptr->flags3 & RF3_RES_TELE)
2796 if (r_ptr->flags1 & RF1_UNIQUE)
2798 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2800 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2802 msg_format("%^s is unaffected!", m_name);
2805 resists_tele = TRUE;
2807 else if (r_ptr->level > randint1(100))
2809 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2811 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2813 msg_format("%^s resists!", m_name);
2816 resists_tele = TRUE;
2823 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2825 msg_format("%^s disappears!", m_name);
2828 teleport_away(c_ptr->m_idx, 50, FALSE);
2829 num = p_ptr->num_blow[hand] + 1; /* Can't hit it anymore! */
2834 else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
2835 (randint1(90) > r_ptr->level))
2837 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2838 !(r_ptr->flags4 & RF4_BR_CHAO) &&
2839 !(r_ptr->flags1 & RF1_QUESTOR))
2841 if (polymorph_monster(y, x))
2844 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2846 msg_format("%^s changes!", m_name);
2850 /* Hack -- Get new monster */
2851 m_ptr = &m_list[c_ptr->m_idx];
2853 /* Oops, we need a different name... */
2854 monster_desc(m_name, m_ptr, 0);
2856 /* Hack -- Get new race */
2857 r_ptr = &r_info[m_ptr->r_idx];
2865 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2867 msg_format("%^s is unaffected.", m_name);
2873 else if (o_ptr->name1 == ART_G_HAMMER)
2875 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2877 if (m_ptr->hold_o_idx)
2879 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2880 char o_name[MAX_NLEN];
2882 object_desc(o_name, q_ptr, TRUE, 0);
2883 q_ptr->held_m_idx = 0;
2885 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2886 q_ptr->next_o_idx = 0;
2888 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2890 msg_format("You snatched %s.", o_name);
2900 backstab = FALSE; /* Clumsy! */
2901 fuiuchi = FALSE; /* Clumsy! */
2903 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2905 u32b flgs[TR_FLAG_SIZE];
2912 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2914 msg_format("You miss %s.", m_name);
2918 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2920 msg_print("Your scythe returns to you!");
2923 /* Extract the flags */
2924 object_flags(o_ptr, flgs);
2926 k = damroll(o_ptr->dd, o_ptr->ds);
2929 switch (p_ptr->mimic_form)
2932 switch (p_ptr->prace)
2941 case RACE_HALF_TROLL:
2942 case RACE_HALF_OGRE:
2943 case RACE_HALF_GIANT:
2944 case RACE_HALF_TITAN:
2952 case RACE_DRACONIAN:
2959 case MIMIC_DEMON_LORD:
2966 if (p_ptr->align < 0 && mult < 20)
2968 if (!(p_ptr->resist_acid || p_ptr->oppose_acid) && (mult < 25))
2970 if (!(p_ptr->resist_elec || p_ptr->oppose_elec) && (mult < 25))
2972 if (!(p_ptr->resist_fire || p_ptr->oppose_fire) && (mult < 25))
2974 if (!(p_ptr->resist_cold || p_ptr->oppose_cold) && (mult < 25))
2976 if (!(p_ptr->resist_pois || p_ptr->oppose_pois) && (mult < 25))
2979 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
2981 p_ptr->csp -= (1+(p_ptr->msp / 30));
2982 p_ptr->redraw |= (PR_MANA);
2983 mult = mult * 3 / 2 + 20;
2989 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2994 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
2996 msg_format("Your weapon cuts deep into yourself!");
2998 /* Try to increase the damage */
3006 k += (p_ptr->to_d[hand] + o_ptr->to_d);
3011 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
3013 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
3025 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
3027 msg_format("You miss %s.", m_name);
3036 if (weak && !(*mdeath))
3039 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
3041 msg_format("%^s seems weakened.", m_name);
3044 if (drain_left != MAX_VAMPIRIC_DRAIN)
3048 chg_virtue(V_UNLIFE, 1);
3051 /* Mega-Hack -- apply earthquake brand */
3054 earthquake(py, px, 10);
3055 if (!cave[y][x].m_idx) *mdeath = TRUE;
3059 bool py_attack(int y, int x, int mode)
3062 bool mdeath = FALSE;
3063 bool stormbringer = FALSE;
3065 cave_type *c_ptr = &cave[y][x];
3066 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3069 /* Disturb the player */
3074 if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
3076 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3077 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3080 /* Extract monster name (or "it") */
3081 monster_desc(m_name, m_ptr, 0);
3083 /* Auto-Recall if possible and visible */
3084 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
3086 /* Track a new monster */
3087 if (m_ptr->ml) health_track(c_ptr->m_idx);
3089 if ((r_info[m_ptr->r_idx].flags1 & RF1_FEMALE) &&
3090 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
3092 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
3095 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
3097 msg_print("I can not attack women!");
3103 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
3106 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
3108 msg_print("Something prevent you from attacking.");
3113 /* Stop if friendly */
3114 if (!is_hostile(m_ptr) &&
3115 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
3116 p_ptr->shero || !m_ptr->ml))
3118 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3119 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3123 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
3125 msg_format("Your black blade greedily attacks %s!", m_name);
3127 chg_virtue(V_INDIVIDUALISM, 1);
3128 chg_virtue(V_HONOUR, -1);
3129 chg_virtue(V_JUSTICE, -1);
3130 chg_virtue(V_COMPASSION, -1);
3132 else if (p_ptr->pclass != CLASS_BERSERKER)
3135 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
3137 if (get_check("Really hit it? "))
3140 chg_virtue(V_INDIVIDUALISM, 1);
3141 chg_virtue(V_HONOUR, -1);
3142 chg_virtue(V_JUSTICE, -1);
3143 chg_virtue(V_COMPASSION, -1);
3148 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
3150 msg_format("You stop to avoid hitting %s.", m_name);
3158 /* Handle player fear */
3164 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
3166 msg_format("You are too afraid to attack %s!", m_name);
3171 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
3173 msg_format ("There is something scary in your way!");
3176 /* Disturb the monster */
3178 p_ptr->update |= (PU_MON_LITE);
3184 if (p_ptr->migite && p_ptr->hidarite)
3186 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_info[m_ptr->r_idx].level))
3188 if (p_ptr->skill_exp[GINOU_NITOURYU] < 4000)
3189 p_ptr->skill_exp[GINOU_NITOURYU]+=80;
3190 else if(p_ptr->skill_exp[GINOU_NITOURYU] < 6000)
3191 p_ptr->skill_exp[GINOU_NITOURYU]+=4;
3192 else if(p_ptr->skill_exp[GINOU_NITOURYU] < 7000)
3193 p_ptr->skill_exp[GINOU_NITOURYU]+=1;
3194 else if(p_ptr->skill_exp[GINOU_NITOURYU] < 8000)
3195 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU]+=1;
3196 p_ptr->update |= (PU_BONUS);
3202 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
3203 if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (p_ptr->skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel))
3204 p_ptr->skill_exp[GINOU_RIDING]++;
3205 if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (p_ptr->skill_exp[GINOU_RIDING]/100 < ridinglevel))
3207 if (ridinglevel*100 > (p_ptr->skill_exp[GINOU_RIDING] + 1500))
3208 p_ptr->skill_exp[GINOU_RIDING] += (1+(ridinglevel - p_ptr->skill_exp[GINOU_RIDING]/100 - 15));
3209 else p_ptr->skill_exp[GINOU_RIDING]++;
3211 p_ptr->update |= (PU_BONUS);
3214 riding_t_m_idx = c_ptr->m_idx;
3215 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
3216 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
3218 /* Mutations which yield extra 'natural' attacks */
3221 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
3222 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
3223 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
3224 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
3225 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
3226 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
3227 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
3228 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
3229 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
3230 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
3233 /* Hack -- delay fear messages */
3234 if (fear && m_ptr->ml && !mdeath)
3241 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
3243 msg_format("%^s flees in terror!", m_name);
3248 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
3250 set_action(ACTION_NONE);
3257 static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
3259 if (!pattern_tile(c_y, c_x) && !pattern_tile(n_y, n_x))
3262 if (cave[n_y][n_x].feat == FEAT_PATTERN_START)
3264 if (!pattern_tile(c_y, c_x) &&
3265 !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
3268 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
3270 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
3280 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_OLD) ||
3281 (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
3282 (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
3284 if (pattern_tile(c_y, c_x))
3291 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3293 msg_print("You must start walking the Pattern from the startpoint.");
3299 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
3300 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
3304 else if (cave[c_y][c_x].feat == FEAT_PATTERN_START)
3306 if (pattern_tile(n_y, n_x))
3311 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3313 msg_print("You must walk the Pattern in correct order.");
3319 else if ((cave[c_y][c_x].feat == FEAT_PATTERN_OLD) ||
3320 (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
3321 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
3323 if (!pattern_tile(n_y, n_x))
3326 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3328 msg_print("You may not step off from the Pattern.");
3340 if (!pattern_tile(c_y, c_x))
3343 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3345 msg_print("You must start walking the Pattern from the startpoint.");
3352 byte ok_move = FEAT_PATTERN_START;
3353 switch (cave[c_y][c_x].feat)
3355 case FEAT_PATTERN_1:
3356 ok_move = FEAT_PATTERN_2;
3358 case FEAT_PATTERN_2:
3359 ok_move = FEAT_PATTERN_3;
3361 case FEAT_PATTERN_3:
3362 ok_move = FEAT_PATTERN_4;
3364 case FEAT_PATTERN_4:
3365 ok_move = FEAT_PATTERN_1;
3370 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]);
3372 msg_format("Funny Pattern walking, %d.", cave[c_y][c_x]);
3375 return TRUE; /* Goof-up */
3378 if ((cave[n_y][n_x].feat == ok_move) ||
3379 (cave[n_y][n_x].feat == cave[c_y][c_x].feat))
3383 if (!pattern_tile(n_y, n_x))
3385 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3387 msg_print("You may not step off from the Pattern.");
3392 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3394 msg_print("You must walk the Pattern in correct order.");
3406 bool player_can_enter(byte feature)
3410 /* Player can not walk through "walls" unless in Shadow Form */
3411 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3418 case FEAT_DEEP_WATER:
3419 case FEAT_SHAL_LAVA:
3420 case FEAT_DEEP_LAVA:
3443 case FEAT_WALL_EXTRA:
3444 case FEAT_WALL_INNER:
3445 case FEAT_WALL_OUTER:
3446 case FEAT_WALL_SOLID:
3453 return (!dun_level && p_ptr->ffall);
3455 case FEAT_PERM_EXTRA:
3456 case FEAT_PERM_INNER:
3457 case FEAT_PERM_OUTER:
3458 case FEAT_PERM_SOLID:
3469 * Move player in the given direction, with the given "pickup" flag.
3471 * This routine should (probably) always induce energy expenditure.
3473 * Note that moving will *always* take a turn, and will *always* hit
3474 * any monster which might be in the destination grid. Previously,
3475 * moving into walls was "free" and did NOT hit invisible monsters.
3477 void move_player(int dir, int do_pickup, bool break_trap)
3482 monster_type *m_ptr;
3486 bool p_can_pass_walls = FALSE;
3487 bool stormbringer = FALSE;
3489 bool oktomove = TRUE;
3490 bool do_past = FALSE;
3492 /* Find the result of moving */
3496 /* Examine the destination */
3497 c_ptr = &cave[y][x];
3501 if (!dun_level && !p_ptr->wild_mode &&
3502 ((x == 0) || (x == MAX_WID - 1) ||
3503 (y == 0) || (y == MAX_HGT - 1)))
3505 /* Can the player enter the grid? */
3506 if (c_ptr->mimic && player_can_enter(c_ptr->mimic))
3508 /* Hack: move to new area */
3509 if ((y == 0) && (x == 0))
3511 p_ptr->wilderness_y--;
3512 p_ptr->wilderness_x--;
3513 p_ptr->oldpy = cur_hgt - 2;
3514 p_ptr->oldpx = cur_wid - 2;
3515 ambush_flag = FALSE;
3518 else if ((y == 0) && (x == MAX_WID - 1))
3520 p_ptr->wilderness_y--;
3521 p_ptr->wilderness_x++;
3522 p_ptr->oldpy = cur_hgt - 2;
3524 ambush_flag = FALSE;
3527 else if ((y == MAX_HGT - 1) && (x == 0))
3529 p_ptr->wilderness_y++;
3530 p_ptr->wilderness_x--;
3532 p_ptr->oldpx = cur_wid - 2;
3533 ambush_flag = FALSE;
3536 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3538 p_ptr->wilderness_y++;
3539 p_ptr->wilderness_x++;
3542 ambush_flag = FALSE;
3547 p_ptr->wilderness_y--;
3548 p_ptr->oldpy = cur_hgt - 2;
3550 ambush_flag = FALSE;
3553 else if (y == MAX_HGT - 1)
3555 p_ptr->wilderness_y++;
3558 ambush_flag = FALSE;
3563 p_ptr->wilderness_x--;
3564 p_ptr->oldpx = cur_wid - 2;
3566 ambush_flag = FALSE;
3569 else if (x == MAX_WID - 1)
3571 p_ptr->wilderness_x++;
3574 ambush_flag = FALSE;
3577 p_ptr->leftbldg = TRUE;
3578 p_ptr->leaving = TRUE;
3587 /* Get the monster */
3588 m_ptr = &m_list[c_ptr->m_idx];
3591 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3592 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3594 /* Player can not walk through "walls"... */
3595 /* unless in Shadow Form */
3596 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3597 p_can_pass_walls = TRUE;
3598 if ((cave[y][x].feat >= FEAT_PERM_EXTRA) &&
3599 (cave[y][x].feat <= FEAT_PERM_SOLID))
3601 p_can_pass_walls = FALSE;
3606 cave[py][px].m_idx = 0;
3609 /* Hack -- attack monsters */
3610 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
3613 /* Attack -- only if we can see it OR it is not in a wall */
3614 if (!is_hostile(m_ptr) &&
3615 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3616 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3617 (pattern_seq(py, px, y, x)) &&
3618 ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
3621 p_ptr->update |= (PU_MON_LITE);
3623 /* Extract monster name (or "it") */
3624 monster_desc(m_name, m_ptr, 0);
3626 /* Auto-Recall if possible and visible */
3627 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
3629 /* Track a new monster */
3630 if (m_ptr->ml) health_track(c_ptr->m_idx);
3633 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3638 else if (monster_can_cross_terrain(cave[py][px].feat, &r_info[m_ptr->r_idx]) &&
3639 (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
3640 (r_info[m_ptr->r_idx].flags2 & RF2_PASS_WALL)))
3647 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3649 msg_format("%^s is in your way!", m_name);
3656 /* now continue on to 'movement' */
3669 else if ((c_ptr->feat == FEAT_DARK_PIT) && !p_ptr->ffall)
3672 msg_print("Îö¤±Ìܤò²£Àڤ뤳¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
3674 msg_print("You can't cross the chasm.");
3682 else if (c_ptr->feat == FEAT_MOUNTAIN)
3684 if (dun_level || !p_ptr->ffall)
3687 msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
3689 msg_print("You can't climb the mountains!");
3698 * Player can move through trees and
3699 * has effective -10 speed
3700 * Rangers can move without penality
3702 else if (c_ptr->feat == FEAT_TREES)
3705 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
3708 else if ((c_ptr->feat >= FEAT_QUEST_ENTER) &&
3709 (c_ptr->feat <= FEAT_QUEST_EXIT))
3714 #ifdef ALLOW_EASY_DISARM /* TNB */
3716 /* Disarm a visible trap */
3717 else if ((do_pickup != easy_disarm) && is_trap(c_ptr->feat))
3719 bool ignore = FALSE;
3720 switch (c_ptr->feat)
3722 case FEAT_TRAP_TRAPDOOR:
3724 case FEAT_TRAP_SPIKED_PIT:
3725 case FEAT_TRAP_POISON_PIT:
3726 if (p_ptr->ffall) ignore = TRUE;
3728 case FEAT_TRAP_TELEPORT:
3729 if (p_ptr->anti_tele) ignore = TRUE;
3731 case FEAT_TRAP_FIRE:
3732 if (p_ptr->immune_fire) ignore = TRUE;
3734 case FEAT_TRAP_ACID:
3735 if (p_ptr->immune_acid) ignore = TRUE;
3737 case FEAT_TRAP_BLIND:
3738 if (p_ptr->resist_blind) ignore = TRUE;
3740 case FEAT_TRAP_CONFUSE:
3741 if (p_ptr->resist_conf) ignore = TRUE;
3743 case FEAT_TRAP_POISON:
3744 if (p_ptr->resist_pois) ignore = TRUE;
3746 case FEAT_TRAP_SLEEP:
3747 if (p_ptr->free_act) ignore = TRUE;
3753 (void)do_cmd_disarm_aux(y, x, dir);
3758 #endif /* ALLOW_EASY_DISARM -- TNB */
3759 else if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags1 & RF1_NEVER_MOVE))
3762 msg_print("Æ°¤±¤Ê¤¤¡ª");
3764 msg_print("Can't move!");
3771 else if (p_ptr->riding && m_list[p_ptr->riding].monfear)
3775 /* Acquire the monster name */
3776 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3778 /* Dump a message */
3780 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3782 msg_format("%^s is too scared to control.", m_name);
3788 else if (p_ptr->riding && p_ptr->riding_ryoute)
3794 else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
3797 msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
3799 msg_print("Can't land.");
3806 else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
3809 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3811 msg_print("Can't swim.");
3818 else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & (RF2_AURA_FIRE)) && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY))) && (c_ptr->feat == FEAT_SHAL_WATER))
3821 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3823 msg_print("Can't swim.");
3830 else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flags3 & (RF3_IM_FIRE))) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
3833 msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3835 msg_print("Too hot to go through.");
3842 else if (p_ptr->riding && m_list[p_ptr->riding].stunned && one_in_(2))
3845 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3847 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3849 msg_format("You cannot control stunned %s!",m_name);
3855 /* Player can not walk through "walls" unless in wraith form...*/
3856 else if ((!cave_floor_bold(y, x)) &&
3857 (!p_can_pass_walls))
3861 /* Disturb the player */
3864 /* Notice things in the dark */
3865 if ((!(c_ptr->info & (CAVE_MARK))) &&
3866 (p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
3869 if (c_ptr->feat == FEAT_RUBBLE)
3872 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3874 msg_print("You feel some rubble blocking your way.");
3877 c_ptr->info |= (CAVE_MARK);
3882 else if (c_ptr->feat < FEAT_SECRET)
3885 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3887 msg_print("You feel a closed door blocking your way.");
3890 c_ptr->info |= (CAVE_MARK);
3894 /* Wall (or secret door) */
3898 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3900 msg_print("You feel a wall blocking your way.");
3903 c_ptr->info |= (CAVE_MARK);
3912 if (c_ptr->feat == FEAT_RUBBLE)
3915 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3917 msg_print("There is rubble blocking your way.");
3921 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3925 * Well, it makes sense that you lose time bumping into
3926 * a wall _if_ you are confused, stunned or blind; but
3927 * typing mistakes should not cost you a turn...
3931 else if (c_ptr->feat < FEAT_SECRET)
3933 #ifdef ALLOW_EASY_OPEN
3935 if (easy_open && easy_open_door(y, x)) return;
3937 #endif /* ALLOW_EASY_OPEN */
3940 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3942 msg_print("There is a closed door blocking your way.");
3946 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3950 /* Wall (or secret door) */
3954 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3956 msg_print("There is a wall blocking your way.");
3960 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3966 sound(SOUND_HITWALL);
3969 /* Normal movement */
3970 if (!pattern_seq(py, px, y, x))
3972 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3977 /* To avoid a loop with running */
3983 /* Normal movement */
3990 if(!process_frakir(x,y))
4000 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
4002 msg_format("You push past %s.", m_name);
4007 cave[py][px].m_idx = c_ptr->m_idx;
4009 update_mon(cave[py][px].m_idx, TRUE);
4012 /* Change oldpx and oldpy to place the player well when going back to big mode */
4013 if (p_ptr->wild_mode)
4015 if(ddy[dir] > 0) p_ptr->oldpy = 1;
4016 if(ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
4017 if(ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
4018 if(ddx[dir] > 0) p_ptr->oldpx = 1;
4019 if(ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
4020 if(ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
4023 /* Save old location */
4027 /* Move the player */
4031 if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
4033 if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
4035 /* Forget the wall */
4036 cave[py][px].info &= ~(CAVE_MARK);
4039 cave_set_feat(py, px, floor_type[randint0(100)]);
4042 if (music_singing(MUSIC_WALL))
4044 project(0, 0, py, px,
4045 (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
4047 else if (p_ptr->kill_wall)
4049 if (cave_valid_bold(py, px) &&
4050 (cave[py][px].feat < FEAT_PATTERN_START ||
4051 cave[py][px].feat > FEAT_PATTERN_XTRA2) &&
4052 (cave[py][px].feat < FEAT_DEEP_WATER ||
4053 cave[py][px].feat > FEAT_GRASS))
4055 if (cave[py][px].feat == FEAT_TREES)
4056 cave_set_feat(py, px, FEAT_GRASS);
4059 cave[py][px].feat = floor_type[randint0(100)];
4062 /* Update some things -- similar to GF_KILL_WALL */
4063 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
4066 /* Redraw new spot */
4069 /* Redraw old spot */
4073 /* sound(SOUND_WALK); */
4075 /* Check for new panel (redraw map) */
4078 /* For get everything when requested hehe I'm *NASTY* */
4079 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
4084 if ((p_ptr->pclass == CLASS_NINJA))
4086 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
4087 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
4089 if ((p_ptr->action == ACTION_HAYAGAKE) && !cave_floor_bold(py, px))
4092 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
4094 msg_print("You cannot run in wall.");
4096 set_action(ACTION_NONE);
4100 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
4102 /* Update the monsters */
4103 p_ptr->update |= (PU_DISTANCE);
4106 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4108 /* Spontaneous Searching */
4109 if ((p_ptr->skill_fos >= 50) ||
4110 (0 == randint0(50 - p_ptr->skill_fos)))
4115 /* Continuous Searching */
4116 if (p_ptr->action == ACTION_SEARCH)
4121 /* Handle "objects" */
4123 #ifdef ALLOW_EASY_DISARM /* TNB */
4125 carry(do_pickup != always_pickup);
4127 #else /* ALLOW_EASY_DISARM -- TNB */
4131 #endif /* ALLOW_EASY_DISARM -- TNB */
4133 /* Handle "store doors" */
4134 if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
4135 (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
4136 (c_ptr->feat == FEAT_MUSEUM))
4142 /* Hack -- Enter store */
4143 command_new = SPECIAL_KEY_STORE;
4146 /* Handle "building doors" -KMW- */
4147 else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
4148 (c_ptr->feat <= FEAT_BLDG_TAIL))
4154 /* Hack -- Enter building */
4155 command_new = SPECIAL_KEY_BUILDING;
4158 /* Handle quest areas -KMW- */
4159 else if (cave[y][x].feat == FEAT_QUEST_ENTER)
4165 /* Hack -- Enter quest level */
4166 command_new = SPECIAL_KEY_QUEST;
4169 else if (cave[y][x].feat == FEAT_QUEST_EXIT)
4171 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
4173 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
4174 quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
4175 quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
4177 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
4179 msg_print("You accomplished your quest!");
4185 leave_quest_check();
4187 p_ptr->inside_quest = cave[y][x].special;
4191 p_ptr->leaving = TRUE;
4194 /* Discover invisible traps */
4195 else if (c_ptr->info & CAVE_TRAP)
4202 msg_print("¥È¥é¥Ã¥×¤À¡ª");
4204 msg_print("You found a trap!");
4212 hit_trap(break_trap);
4215 /* Discover invisible wall opening trap */
4216 else if (c_ptr->feat == FEAT_INVIS)
4218 c_ptr->feat = FEAT_TRAP_OPEN;
4225 msg_print("¥È¥é¥Ã¥×¤À¡ª");
4227 msg_print("You found a trap!");
4231 hit_trap(break_trap);
4234 /* Set off an visible trap */
4235 else if (is_trap(c_ptr->feat))
4241 hit_trap(break_trap);
4244 /* Warn when leaving trap detected region */
4245 if ((disturb_trap_detect || alert_trap_detect)
4246 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4248 /* No duplicate warning */
4249 p_ptr->dtrap = FALSE;
4251 /* You are just on the edge */
4252 if (!(cave[py][px].info & CAVE_UNSAFE))
4254 if (alert_trap_detect)
4257 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4259 msg_print("*Leaving trap detect region!*");
4263 if (disturb_trap_detect)
4273 m_list[p_ptr->riding].fy = py;
4274 m_list[p_ptr->riding].fx = px;
4275 cave[py][px].m_idx = p_ptr->riding;
4276 update_mon(cave[py][px].m_idx, TRUE);
4277 p_ptr->update |= (PU_MON_LITE);
4283 * Hack -- Check for a "known wall" (see below)
4285 static int see_wall(int dir, int y, int x)
4287 /* Get the new location */
4291 /* Illegal grids are not known walls */
4292 if (!in_bounds2(y, x)) return (FALSE);
4294 /* Non-wall grids are not known walls */
4295 if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
4297 if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
4298 (cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
4300 if ((cave[y][x].feat >= FEAT_SHOP_HEAD) &&
4301 (cave[y][x].feat <= FEAT_SHOP_TAIL)) return (FALSE);
4303 if (cave[y][x].feat == FEAT_DEEP_GRASS) return (FALSE);
4304 if (cave[y][x].feat == FEAT_FLOWER) return (FALSE);
4306 if (cave[y][x].feat == FEAT_MUSEUM) return (FALSE);
4308 if ((cave[y][x].feat >= FEAT_BLDG_HEAD) &&
4309 (cave[y][x].feat <= FEAT_BLDG_TAIL)) return (FALSE);
4311 /* if (cave[y][x].feat == FEAT_TREES) return (FALSE); */
4313 /* Must be known to the player */
4314 if (!(cave[y][x].info & (CAVE_MARK))) return (FALSE);
4316 if (cave[y][x].feat >= FEAT_TOWN) return (FALSE);
4324 * Hack -- Check for an "unknown corner" (see below)
4326 static int see_nothing(int dir, int y, int x)
4328 /* Get the new location */
4332 /* Illegal grids are unknown */
4333 if (!in_bounds2(y, x)) return (TRUE);
4335 /* Memorized grids are always known */
4336 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
4338 /* Non-floor grids are unknown */
4339 if (!cave_floor_bold(y, x)) return (TRUE);
4341 /* Viewable door/wall grids are known */
4342 if (player_can_see_bold(y, x)) return (FALSE);
4353 * The running algorithm: -CJS-
4355 * In the diagrams below, the player has just arrived in the
4356 * grid marked as '@', and he has just come from a grid marked
4357 * as 'o', and he is about to enter the grid marked as 'x'.
4359 * Of course, if the "requested" move was impossible, then you
4360 * will of course be blocked, and will stop.
4362 * Overview: You keep moving until something interesting happens.
4363 * If you are in an enclosed space, you follow corners. This is
4364 * the usual corridor scheme. If you are in an open space, you go
4365 * straight, but stop before entering enclosed space. This is
4366 * analogous to reaching doorways. If you have enclosed space on
4367 * one side only (that is, running along side a wall) stop if
4368 * your wall opens out, or your open space closes in. Either case
4369 * corresponds to a doorway.
4371 * What happens depends on what you can really SEE. (i.e. if you
4372 * have no light, then running along a dark corridor is JUST like
4373 * running in a dark room.) The algorithm works equally well in
4374 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
4376 * These conditions are kept in static memory:
4377 * find_openarea You are in the open on at least one
4379 * find_breakleft You have a wall on the left, and will
4381 * find_breakright You have a wall on the right, and will
4384 * To initialize these conditions, we examine the grids adjacent
4385 * to the grid marked 'x', two on each side (marked 'L' and 'R').
4386 * If either one of the two grids on a given side is seen to be
4387 * closed, then that side is considered to be closed. If both
4388 * sides are closed, then it is an enclosed (corridor) run.
4394 * Looking at more than just the immediate squares is
4395 * significant. Consider the following case. A run along the
4396 * corridor will stop just before entering the center point,
4397 * because a choice is clearly established. Running in any of
4398 * three available directions will be defined as a corridor run.
4399 * Note that a minor hack is inserted to make the angled corridor
4400 * entry (with one side blocked near and the other side blocked
4401 * further away from the runner) work correctly. The runner moves
4402 * diagonally, but then saves the previous direction as being
4403 * straight into the gap. Otherwise, the tail end of the other
4404 * entry would be perceived as an alternative on the next move.
4412 * Likewise, a run along a wall, and then into a doorway (two
4413 * runs) will work correctly. A single run rightwards from @ will
4414 * stop at 1. Another run right and down will enter the corridor
4415 * and make the corner, stopping at the 2.
4417 * ##################
4419 * ########### ######
4423 * After any move, the function area_affect is called to
4424 * determine the new surroundings, and the direction of
4425 * subsequent moves. It examines the current player location
4426 * (at which the runner has just arrived) and the previous
4427 * direction (from which the runner is considered to have come).
4429 * Moving one square in some direction places you adjacent to
4430 * three or five new squares (for straight and diagonal moves
4431 * respectively) to which you were not previously adjacent,
4432 * marked as '!' in the diagrams below.
4435 * .o@! (normal) .o.! (diagonal)
4436 * ...! (east) ..@! (south east)
4439 * You STOP if any of the new squares are interesting in any way:
4440 * for example, if they contain visible monsters or treasure.
4442 * You STOP if any of the newly adjacent squares seem to be open,
4443 * and you are also looking for a break on that side. (that is,
4444 * find_openarea AND find_break).
4446 * You STOP if any of the newly adjacent squares do NOT seem to be
4447 * open and you are in an open area, and that side was previously
4450 * Corners: If you are not in the open (i.e. you are in a corridor)
4451 * and there is only one way to go in the new squares, then turn in
4452 * that direction. If there are more than two new ways to go, STOP.
4453 * If there are two ways to go, and those ways are separated by a
4454 * square which does not seem to be open, then STOP.
4456 * Otherwise, we have a potential corner. There are two new open
4457 * squares, which are also adjacent. One of the new squares is
4458 * diagonally located, the other is straight on (as in the diagram).
4459 * We consider two more squares further out (marked below as ?).
4461 * We assign "option" to the straight-on grid, and "option2" to the
4462 * diagonal grid, and "check_dir" to the grid marked 's'.
4468 * If they are both seen to be closed, then it is seen that no benefit
4469 * is gained from moving straight. It is a known corner. To cut the
4470 * corner, go diagonally, otherwise go straight, but pretend you
4471 * stepped diagonally into that next location for a full view next
4472 * time. Conversely, if one of the ? squares is not seen to be closed,
4473 * then there is a potential choice. We check to see whether it is a
4474 * potential corner or an intersection/room entrance. If the square
4475 * two spaces straight ahead, and the space marked with 's' are both
4476 * unknown space, then it is a potential corner and enter if
4477 * find_examine is set, otherwise must stop because it is not a
4485 * Hack -- allow quick "cycling" through the legal directions
4487 static byte cycle[] =
4488 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
4491 * Hack -- map each direction into the "middle" of the "cycle[]" array
4493 static byte chome[] =
4494 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
4497 * The direction we are running
4499 static byte find_current;
4502 * The direction we came from
4504 static byte find_prevdir;
4507 * We are looking for open area
4509 static bool find_openarea;
4512 * We are looking for a break
4514 static bool find_breakright;
4515 static bool find_breakleft;
4520 * Initialize the running algorithm for a new direction.
4522 * Diagonal Corridor -- allow diaginal entry into corridors.
4524 * Blunt Corridor -- If there is a wall two spaces ahead and
4525 * we seem to be in a corridor, then force a turn into the side
4526 * corridor, must be moving straight into a corridor here. ???
4528 * Diagonal Corridor Blunt Corridor (?)
4533 static void run_init(int dir)
4535 int row, col, deepleft, deepright;
4536 int i, shortleft, shortright;
4539 /* Save the direction */
4542 /* Assume running straight */
4545 /* Assume looking for open area */
4546 find_openarea = TRUE;
4548 /* Assume not looking for breaks */
4549 find_breakright = find_breakleft = FALSE;
4551 /* Assume no nearby walls */
4552 deepleft = deepright = FALSE;
4553 shortright = shortleft = FALSE;
4558 /* Find the destination grid */
4559 row = py + ddy[dir];
4560 col = px + ddx[dir];
4562 /* Extract cycle index */
4565 /* Check for walls */
4566 if (see_wall(cycle[i+1], py, px))
4568 find_breakleft = TRUE;
4571 else if (see_wall(cycle[i+1], row, col))
4573 find_breakleft = TRUE;
4577 /* Check for walls */
4578 if (see_wall(cycle[i-1], py, px))
4580 find_breakright = TRUE;
4583 else if (see_wall(cycle[i-1], row, col))
4585 find_breakright = TRUE;
4589 /* Looking for a break */
4590 if (find_breakleft && find_breakright)
4592 /* Not looking for open area */
4593 find_openarea = FALSE;
4595 /* Hack -- allow angled corridor entry */
4598 if (deepleft && !deepright)
4600 find_prevdir = cycle[i - 1];
4602 else if (deepright && !deepleft)
4604 find_prevdir = cycle[i + 1];
4608 /* Hack -- allow blunt corridor entry */
4609 else if (see_wall(cycle[i], row, col))
4611 if (shortleft && !shortright)
4613 find_prevdir = cycle[i - 2];
4615 else if (shortright && !shortleft)
4617 find_prevdir = cycle[i + 2];
4625 * Update the current "run" path
4627 * Return TRUE if the running should be stopped
4629 static bool run_test(void)
4631 int prev_dir, new_dir, check_dir = 0;
4634 int option = 0, option2 = 0;
4637 /* Where we came from */
4638 prev_dir = find_prevdir;
4641 /* Range of newly adjacent grids */
4642 max = (prev_dir & 0x01) + 1;
4644 /* break run when leaving trap detected region */
4645 if ((disturb_trap_detect || alert_trap_detect)
4646 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4648 /* No duplicate warning */
4649 p_ptr->dtrap = FALSE;
4651 /* You are just on the edge */
4652 if (!(cave[py][px].info & CAVE_UNSAFE))
4654 if (alert_trap_detect)
4657 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4659 msg_print("*Leaving trap detect region!*");
4663 if (disturb_trap_detect)
4671 /* Look at every newly adjacent square. */
4672 for (i = -max; i <= max; i++)
4674 s16b this_o_idx, next_o_idx = 0;
4678 new_dir = cycle[chome[prev_dir] + i];
4681 row = py + ddy[new_dir];
4682 col = px + ddx[new_dir];
4685 c_ptr = &cave[row][col];
4688 /* Visible monsters abort running */
4691 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4693 /* Visible monster */
4694 if (m_ptr->ml) return (TRUE);
4697 /* Visible objects abort running */
4698 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4702 /* Acquire object */
4703 o_ptr = &o_list[this_o_idx];
4705 /* Acquire next object */
4706 next_o_idx = o_ptr->next_o_idx;
4708 /* Visible object */
4709 if (o_ptr->marked) return (TRUE);
4713 /* Assume unknown */
4716 /* Check memorized grids */
4717 if (c_ptr->info & (CAVE_MARK))
4721 /* Examine the terrain */
4722 switch (c_ptr->feat)
4737 /* Hidden treasure */
4741 /* Known treasure (almost uninteresting) */
4747 case FEAT_WALL_EXTRA:
4748 case FEAT_WALL_INNER:
4749 case FEAT_WALL_OUTER:
4750 case FEAT_WALL_SOLID:
4751 case FEAT_PERM_EXTRA:
4752 case FEAT_PERM_INNER:
4753 case FEAT_PERM_OUTER:
4754 case FEAT_PERM_SOLID:
4755 /* dirt, grass, trees, ... */
4756 case FEAT_SHAL_WATER:
4759 case FEAT_DEEP_GRASS:
4772 /* quest features */
4773 case FEAT_QUEST_ENTER:
4774 case FEAT_QUEST_EXIT:
4783 case FEAT_DEEP_LAVA:
4784 case FEAT_SHAL_LAVA:
4787 if (p_ptr->invuln || p_ptr->immune_fire) notice = FALSE;
4793 case FEAT_DEEP_WATER:
4796 if (p_ptr->ffall || p_ptr->total_weight<= (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]]*(p_ptr->pclass == CLASS_BERSERKER ? 150 : 100))/2)) notice = FALSE;
4806 /* Option -- ignore */
4807 if (find_ignore_doors) notice = FALSE;
4816 case FEAT_LESS_LESS:
4817 case FEAT_MORE_MORE:
4820 /* Option -- ignore */
4821 if (find_ignore_stairs) notice = FALSE;
4828 /* Interesting feature */
4829 if (notice) return (TRUE);
4831 /* The grid is "visible" */
4835 /* Analyze unknown grids and floors */
4836 /* if (inv || cave_floor_bold(row, col) || */
4837 /* (cave[row][col].feat == FEAT_TREES)) */
4838 if (inv || cave_floor_bold(row, col))
4840 /* Looking for open area */
4846 /* The first new direction. */
4852 /* Three new directions. Stop running. */
4858 /* Two non-adjacent new directions. Stop running. */
4859 else if (option != cycle[chome[prev_dir] + i - 1])
4864 /* Two new (adjacent) directions (case 1) */
4865 else if (new_dir & 0x01)
4867 check_dir = cycle[chome[prev_dir] + i - 2];
4871 /* Two new (adjacent) directions (case 2) */
4874 check_dir = cycle[chome[prev_dir] + i + 1];
4880 /* Obstacle, while looking for open area */
4887 /* Break to the right */
4888 find_breakright = TRUE;
4893 /* Break to the left */
4894 find_breakleft = TRUE;
4901 /* Looking for open area */
4904 /* Hack -- look again */
4905 for (i = -max; i < 0; i++)
4907 new_dir = cycle[chome[prev_dir] + i];
4909 row = py + ddy[new_dir];
4910 col = px + ddx[new_dir];
4913 c_ptr = &cave[row][col];
4915 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4916 if (!(c_ptr->info & (CAVE_MARK)) ||
4917 ((c_ptr->feat < FEAT_SECRET) ||
4918 (c_ptr->feat == FEAT_FLOWER) ||
4919 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4920 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4921 (c_ptr->feat <= FEAT_GRASS))))
4924 /* Looking to break right */
4925 if (find_breakright)
4934 /* Looking to break left */
4942 /* Hack -- look again */
4943 for (i = max; i > 0; i--)
4945 new_dir = cycle[chome[prev_dir] + i];
4947 row = py + ddy[new_dir];
4948 col = px + ddx[new_dir];
4951 c_ptr = &cave[row][col];
4953 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4954 if (!(c_ptr->info & (CAVE_MARK)) ||
4955 ((c_ptr->feat < FEAT_SECRET) ||
4956 (c_ptr->feat == FEAT_FLOWER) ||
4957 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4958 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4959 (c_ptr->feat <= FEAT_GRASS))))
4962 /* Looking to break left */
4972 /* Looking to break right */
4973 if (find_breakright)
4982 /* Not looking for open area */
4994 /* Primary option */
4995 find_current = option;
4997 /* No other options */
4998 find_prevdir = option;
5001 /* Two options, examining corners */
5002 else if (find_examine && !find_cut)
5004 /* Primary option */
5005 find_current = option;
5007 /* Hack -- allow curving */
5008 find_prevdir = option2;
5011 /* Two options, pick one */
5014 /* Get next location */
5015 row = py + ddy[option];
5016 col = px + ddx[option];
5018 /* Don't see that it is closed off. */
5019 /* This could be a potential corner or an intersection. */
5020 if (!see_wall(option, row, col) ||
5021 !see_wall(check_dir, row, col))
5023 /* Can not see anything ahead and in the direction we */
5024 /* are turning, assume that it is a potential corner. */
5026 see_nothing(option, row, col) &&
5027 see_nothing(option2, row, col))
5029 find_current = option;
5030 find_prevdir = option2;
5033 /* STOP: we are next to an intersection or a room */
5040 /* This corner is seen to be enclosed; we cut the corner. */
5043 find_current = option2;
5044 find_prevdir = option2;
5047 /* This corner is seen to be enclosed, and we */
5048 /* deliberately go the long way. */
5051 find_current = option;
5052 find_prevdir = option2;
5058 /* About to hit a known wall, stop */
5059 if (see_wall(find_current, py, px))
5072 * Take one step along the current "run" path
5074 void run_step(int dir)
5079 /* Hack -- do not start silly run */
5080 if (see_wall(dir, py, px) &&
5081 (cave[py+ddy[dir]][px+ddx[dir]].feat != FEAT_TREES))
5085 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¹Ô¤±¤Þ¤»¤ó¡£");
5087 msg_print("You cannot run in that direction.");
5098 /* Calculate torch radius */
5099 p_ptr->update |= (PU_TORCH);
5119 /* Decrease the run counter */
5120 if (--running <= 0) return;
5125 /* Move the player, using the "pickup" flag */
5126 #ifdef ALLOW_EASY_DISARM /* TNB */
5128 move_player(find_current, FALSE, FALSE);
5130 #else /* ALLOW_EASY_DISARM -- TNB */
5132 move_player(find_current, always_pickup, FALSE);
5134 #endif /* ALLOW_EASY_DISARM -- TNB */
5136 if ((py == p_ptr->run_py) && (px == p_ptr->run_px))