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];
227 /* Extract the flags */
228 object_flags(o_ptr, &f1, &f2, &f3);
230 /* Some "weapons" and "ammo" do extra damage */
242 if ((f1 & TR1_SLAY_ANIMAL) &&
243 (r_ptr->flags3 & RF3_ANIMAL))
247 r_ptr->r_flags3 |= RF3_ANIMAL;
250 if (mult < 25) mult = 25;
254 if ((f1 & TR1_SLAY_EVIL) &&
255 (r_ptr->flags3 & RF3_EVIL))
259 r_ptr->r_flags3 |= RF3_EVIL;
262 if (mult < 20) mult = 20;
266 if ((f3 & TR3_SLAY_HUMAN) &&
267 (r_ptr->flags2 & RF2_HUMAN))
271 r_ptr->r_flags2 |= RF2_HUMAN;
274 if (mult < 25) mult = 25;
278 if ((f1 & TR1_SLAY_UNDEAD) &&
279 (r_ptr->flags3 & RF3_UNDEAD))
283 r_ptr->r_flags3 |= RF3_UNDEAD;
286 if (mult < 30) mult = 30;
290 if ((f1 & TR1_SLAY_DEMON) &&
291 (r_ptr->flags3 & RF3_DEMON))
295 r_ptr->r_flags3 |= RF3_DEMON;
298 if (mult < 30) mult = 30;
302 if ((f1 & TR1_SLAY_ORC) &&
303 (r_ptr->flags3 & RF3_ORC))
307 r_ptr->r_flags3 |= RF3_ORC;
310 if (mult < 30) mult = 30;
314 if ((f1 & TR1_SLAY_TROLL) &&
315 (r_ptr->flags3 & RF3_TROLL))
319 r_ptr->r_flags3 |= RF3_TROLL;
322 if (mult < 30) mult = 30;
326 if ((f1 & TR1_SLAY_GIANT) &&
327 (r_ptr->flags3 & RF3_GIANT))
331 r_ptr->r_flags3 |= RF3_GIANT;
334 if (mult < 30) mult = 30;
335 if (o_ptr->name1 == ART_HRUNTING)
340 if ((f1 & TR1_SLAY_DRAGON) &&
341 (r_ptr->flags3 & RF3_DRAGON))
345 r_ptr->r_flags3 |= RF3_DRAGON;
348 if (mult < 30) mult = 30;
352 if ((f1 & TR1_KILL_DRAGON) &&
353 (r_ptr->flags3 & RF3_DRAGON))
357 r_ptr->r_flags3 |= RF3_DRAGON;
360 if (mult < 50) mult = 50;
362 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
367 if ((f1 & TR1_BRAND_ACID) || (p_ptr->special_attack & (ATTACK_ACID)))
369 /* Notice immunity */
370 if (r_ptr->flags3 & RF3_IM_ACID)
374 r_ptr->r_flags3 |= RF3_IM_ACID;
378 /* Otherwise, take the damage */
381 if (mult < 25) mult = 25;
386 if ((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC)) || (mode == HISSATSU_ELEC))
388 /* Notice immunity */
389 if (r_ptr->flags3 & RF3_IM_ELEC)
393 r_ptr->r_flags3 |= RF3_IM_ELEC;
397 /* Otherwise, take the damage */
398 else if (((f1 & TR1_BRAND_ELEC) || (p_ptr->special_attack & (ATTACK_ELEC))) && (mode == HISSATSU_ELEC))
400 if (mult < 70) mult = 70;
402 else if (mode == HISSATSU_ELEC)
404 if (mult < 50) mult = 50;
409 if (mult < 25) mult = 25;
414 if ((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE)) || (mode == HISSATSU_FIRE))
416 /* Notice immunity */
417 if (r_ptr->flags3 & RF3_IM_FIRE)
421 r_ptr->r_flags3 |= RF3_IM_FIRE;
425 /* Otherwise, take the damage */
426 else if (((f1 & TR1_BRAND_FIRE) || (p_ptr->special_attack & (ATTACK_FIRE))) && (mode == HISSATSU_FIRE))
428 if (r_ptr->flags3 & RF3_HURT_FIRE)
430 if (mult < 70) mult = 70;
433 r_ptr->r_flags3 |= RF3_HURT_FIRE;
436 else if (mult < 35) mult = 35;
440 if (r_ptr->flags3 & RF3_HURT_FIRE)
442 if (mult < 50) mult = 50;
445 r_ptr->r_flags3 |= RF3_HURT_FIRE;
448 else if (mult < 25) mult = 25;
453 if ((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD)) || (mode == HISSATSU_COLD))
455 /* Notice immunity */
456 if (r_ptr->flags3 & RF3_IM_COLD)
460 r_ptr->r_flags3 |= RF3_IM_COLD;
463 /* Otherwise, take the damage */
464 else if (((f1 & TR1_BRAND_COLD) || (p_ptr->special_attack & (ATTACK_COLD))) && (mode == HISSATSU_COLD))
466 if (r_ptr->flags3 & RF3_HURT_COLD)
468 if (mult < 70) mult = 70;
471 r_ptr->r_flags3 |= RF3_HURT_COLD;
474 else if (mult < 35) mult = 35;
478 if (r_ptr->flags3 & RF3_HURT_COLD)
480 if (mult < 50) mult = 50;
483 r_ptr->r_flags3 |= RF3_HURT_COLD;
486 else if (mult < 25) mult = 25;
491 if ((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS)) || (mode == HISSATSU_POISON))
493 /* Notice immunity */
494 if (r_ptr->flags3 & RF3_IM_POIS)
498 r_ptr->r_flags3 |= RF3_IM_POIS;
502 /* Otherwise, take the damage */
503 else if (((f1 & TR1_BRAND_POIS) || (p_ptr->special_attack & (ATTACK_POIS))) && (mode == HISSATSU_POISON))
505 if (mult < 35) mult = 35;
509 if (mult < 25) mult = 25;
512 if ((mode == HISSATSU_ZANMA) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL))
514 if (mult < 15) mult = 25;
515 else if (mult < 50) mult = MIN(50, mult+20);
517 if (mode == HISSATSU_UNDEAD)
519 if (r_ptr->flags3 & RF3_UNDEAD)
523 r_ptr->r_flags3 |= RF3_UNDEAD;
525 if (mult == 10) mult = 70;
526 else if (mult < 140) mult = MIN(140, mult+60);
528 if (mult == 10) mult = 40;
529 else if (mult < 60) mult = MIN(60, mult+30);
531 if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && !(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
533 int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
534 if (mult < tmp) mult = tmp;
536 if ((mode == HISSATSU_HAGAN) && (r_ptr->flags3 & RF3_HURT_ROCK))
540 r_ptr->r_flags3 |= RF3_HURT_ROCK;
542 if (mult == 10) mult = 40;
543 else if (mult < 60) mult = 60;
545 if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
547 p_ptr->csp -= (1+(o_ptr->dd * o_ptr->ds / 5));
548 p_ptr->redraw |= (PR_MANA);
549 mult = MIN(60, mult * 7 / 2);
554 if (mult > 150) mult = 150;
556 /* Return the total damage */
557 return (tdam * mult / 10);
562 * Search for hidden things
568 s16b this_o_idx, next_o_idx = 0;
573 /* Start with base search ability */
574 chance = p_ptr->skill_srh;
576 /* Penalize various conditions */
577 if (p_ptr->blind || no_lite()) chance = chance / 10;
578 if (p_ptr->confused || p_ptr->image) chance = chance / 10;
580 /* Search the nearby grids, which are always in bounds */
581 for (y = (py - 1); y <= (py + 1); y++)
583 for (x = (px - 1); x <= (px + 1); x++)
585 /* Sometimes, notice things */
586 if (randint0(100) < chance)
588 /* Access the grid */
592 if (c_ptr->info & CAVE_TRAP)
599 msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
601 msg_print("You have found a trap.");
610 if (c_ptr->feat == FEAT_SECRET)
614 msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
616 msg_print("You have found a secret door.");
621 place_closed_door(y, x);
627 /* Scan all objects in the grid */
628 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
633 o_ptr = &o_list[this_o_idx];
635 /* Acquire next object */
636 next_o_idx = o_ptr->next_o_idx;
638 /* Skip non-chests */
639 if (o_ptr->tval != TV_CHEST) continue;
641 /* Skip non-trapped chests */
642 if (!chest_traps[o_ptr->pval]) continue;
645 if (!object_known_p(o_ptr))
649 msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
651 msg_print("You have discovered a trap on the chest!");
669 * Helper routine for py_pickup() and py_pickup_floor().
671 * Add the given dungeon object to the character's inventory.
673 * Delete the object afterwards.
675 void py_pickup_aux(int o_idx)
681 * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥¤ò»ý¤Ã¤Æ¤¤¤ë¡×
682 * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
684 * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
685 * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
687 char o_name[MAX_NLEN];
688 char old_name[MAX_NLEN];
691 extern char *object_desc_kosuu(char *t, object_type *o_ptr);
693 char o_name[MAX_NLEN];
698 o_ptr = &o_list[o_idx];
701 /* Describe the object */
702 object_desc(old_name, o_ptr, TRUE, 0);
703 object_desc_kosuu(kazu_str, o_ptr);
704 hirottakazu = o_ptr->number;
706 /* Carry the object */
707 slot = inven_carry(o_ptr);
709 /* Get the object again */
710 o_ptr = &inventory[slot];
712 /* Delete the object */
713 delete_object_idx(o_idx);
715 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) identify_item(o_ptr);
717 /* Describe the object */
718 object_desc(o_name, o_ptr, TRUE, 3);
722 if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
724 msg_format("¤³¤¦¤·¤Æ¡¢%s¤Ï¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¼ê¤ËÆþ¤ì¤¿¡£", player_name);
725 msg_print("¤·¤«¤·º£¡¢¡Øº®Æ٤Υµ¡¼¥Ú¥ó¥È¡Ù¤ÎÊü¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤¬¡¢");
726 msg_format("%s¤Ë½±¤¤¤«¤«¤ë¡¥¡¥¡¥", player_name);
732 msg_format("%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",o_name, index_to_label(slot));
736 if (o_ptr->number > hirottakazu) {
737 msg_format("%s½¦¤Ã¤Æ¡¢%s(%c)¤ò»ý¤Ã¤Æ¤¤¤ë¡£",
738 kazu_str, o_name, index_to_label(slot));
740 msg_format("%s(%c)¤ò½¦¤Ã¤¿¡£", o_name, index_to_label(slot));
744 strcpy(record_o_name, old_name);
746 msg_format("You have %s (%c).", o_name, index_to_label(slot));
747 strcpy(record_o_name, o_name);
752 /* Check if completed a quest */
753 for (i = 0; i < max_quests; i++)
755 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
756 (quest[i].status == QUEST_STATUS_TAKEN) &&
757 (quest[i].k_idx == o_ptr->name1))
759 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
760 quest[i].status = QUEST_STATUS_COMPLETED;
761 quest[i].complev = (byte)p_ptr->lev;
763 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
765 msg_print("You completed your quest!");
775 * Player "wants" to pick up an object or gold.
776 * Note that we ONLY handle things that can be picked up.
777 * See "move_player()" for handling of other things.
779 void carry(int pickup)
781 cave_type *c_ptr = &cave[py][px];
783 s16b this_o_idx, next_o_idx = 0;
785 char o_name[MAX_NLEN];
787 /* Recenter the map around the player */
791 p_ptr->update |= (PU_MONSTERS);
794 p_ptr->redraw |= (PR_MAP);
797 p_ptr->window |= (PW_OVERHEAD);
802 /* Automatically pickup/destroy/inscribe items */
803 auto_pickup_items(c_ptr);
806 #ifdef ALLOW_EASY_FLOOR
810 py_pickup_floor(pickup);
814 #endif /* ALLOW_EASY_FLOOR */
816 /* Scan the pile of objects */
817 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
822 o_ptr = &o_list[this_o_idx];
824 #ifdef ALLOW_EASY_SENSE /* TNB */
826 /* Option: Make item sensing easy */
829 /* Sense the object */
830 (void)sense_object(o_ptr);
833 #endif /* ALLOW_EASY_SENSE -- TNB */
835 /* Describe the object */
836 object_desc(o_name, o_ptr, TRUE, 3);
838 /* Acquire next object */
839 next_o_idx = o_ptr->next_o_idx;
841 /* Hack -- disturb */
845 if (o_ptr->tval == TV_GOLD)
847 int value = (long)o_ptr->pval;
849 /* Delete the gold */
850 delete_object_idx(this_o_idx);
854 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
855 (long)value, o_name);
857 msg_format("You collect %ld gold pieces worth of %s.",
858 (long)value, o_name);
864 /* Collect the gold */
868 p_ptr->redraw |= (PR_GOLD);
871 p_ptr->window |= (PW_PLAYER);
874 /* Pick up objects */
877 /* Describe the object */
882 msg_format("%s¤¬¤¢¤ë¡£", o_name);
884 msg_format("You see %s.", o_name);
889 /* Note that the pack is too full */
890 else if (!inven_carry_okay(o_ptr))
893 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
895 msg_format("You have no room for %s.", o_name);
900 /* Pick up the item (if requested and allowed) */
905 /* Hack -- query every item */
906 if (carry_query_flag)
908 char out_val[MAX_NLEN+20];
910 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
912 sprintf(out_val, "Pick up %s? ", o_name);
915 okay = get_check(out_val);
918 /* Attempt to pick up an object. */
921 /* Pick up the object */
922 py_pickup_aux(this_o_idx);
931 * Determine if a trap affects the player.
932 * Always miss 5% of the time, Always hit 5% of the time.
933 * Otherwise, match trap power against player armor.
935 static int check_hit(int power)
939 /* Percentile dice */
942 /* Hack -- 5% hit, 5% miss */
943 if (k < 10) return (k < 5);
945 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
946 if (one_in_(20)) return (TRUE);
948 /* Paranoia -- No power */
949 if (power <= 0) return (FALSE);
952 ac = p_ptr->ac + p_ptr->to_a;
954 /* Power competes against Armor */
955 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
964 * Handle player hitting a real trap
966 static void hit_trap(bool break_trap)
974 cptr name = "¥È¥é¥Ã¥×";
976 cptr name = "a trap";
981 /* Disturb the player */
984 /* Get the cave grid */
987 /* Analyze XXX XXX XXX */
990 case FEAT_TRAP_TRAPDOOR:
995 msg_print("Í¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
997 msg_print("You fly over a trap door.");
1004 msg_print("Í¸Í¤ËÍî¤Á¤¿¡ª");
1005 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1006 msg_print("¤¯¤Ã¤½¡Á¡ª");
1008 msg_print("You have fallen through a trap door!");
1012 dam = damroll(2, 8);
1016 name = "a trap door";
1019 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1021 /* Still alive and autosave enabled */
1022 if (autosave_l && (p_ptr->chp >= 0))
1023 do_cmd_save_game(TRUE);
1026 do_cmd_write_nikki(NIKKI_STAIR, 1, "Í¸Í¤ËÍî¤Á¤¿");
1028 do_cmd_write_nikki(NIKKI_STAIR, 1, "You have fallen through a trap door!");
1033 p_ptr->leaving = TRUE;
1043 msg_print("Í·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1045 msg_print("You fly over a pit trap.");
1052 msg_print("Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1054 msg_print("You have fallen into a pit!");
1057 dam = damroll(2, 6);
1061 name = "a pit trap";
1064 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1069 case FEAT_TRAP_SPIKED_PIT:
1074 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1076 msg_print("You fly over a spiked pit.");
1083 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1085 msg_print("You fall into a spiked pit!");
1093 name = "a pit trap";
1096 dam = damroll(2, 6);
1098 /* Extra spike damage */
1099 if (randint0(100) < 50)
1102 msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1104 msg_print("You are impaled!");
1109 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1111 name = "a spiked pit";
1115 (void)set_cut(p_ptr->cut + randint1(dam));
1118 /* Take the damage */
1119 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1124 case FEAT_TRAP_POISON_PIT:
1129 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1131 msg_print("You fly over a spiked pit.");
1138 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1140 msg_print("You fall into a spiked pit!");
1145 dam = damroll(2, 6);
1150 name = "a pit trap";
1154 /* Extra spike damage */
1155 if (randint0(100) < 50)
1158 msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1160 msg_print("You are impaled on poisonous spikes!");
1165 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1167 name = "a spiked pit";
1172 (void)set_cut(p_ptr->cut + randint1(dam));
1174 if (p_ptr->resist_pois || p_ptr->oppose_pois)
1177 msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
1179 msg_print("The poison does not affect you!");
1187 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
1191 /* Take the damage */
1192 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1198 case FEAT_TRAP_TY_CURSE:
1201 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1203 msg_print("There is a flash of shimmering light!");
1206 c_ptr->info &= ~(CAVE_MARK);
1207 cave_set_feat(y, x, floor_type[randint0(100)]);
1208 num = 2 + randint1(3);
1209 for (i = 0; i < num; i++)
1211 (void)summon_specific(0, y, x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1214 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1216 bool stop_ty = FALSE;
1221 stop_ty = activate_ty_curse(stop_ty, &count);
1228 case FEAT_TRAP_TELEPORT:
1231 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1233 msg_print("You hit a teleport trap!");
1236 teleport_player(100);
1240 case FEAT_TRAP_FIRE:
1243 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1245 msg_print("You are enveloped in flames!");
1248 dam = damroll(4, 6);
1250 fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
1252 fire_dam(dam, "a fire trap", -1);
1258 case FEAT_TRAP_ACID:
1261 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1263 msg_print("You are splashed with acid!");
1266 dam = damroll(4, 6);
1268 acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
1270 acid_dam(dam, "an acid trap", -1);
1276 case FEAT_TRAP_SLOW:
1281 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1283 msg_print("A small dart hits you!");
1286 dam = damroll(1, 4);
1287 take_hit(DAMAGE_ATTACK, dam, name, -1);
1288 (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
1293 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1295 msg_print("A small dart barely misses you.");
1302 case FEAT_TRAP_LOSE_STR:
1307 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1309 msg_print("A small dart hits you!");
1312 dam = damroll(1, 4);
1314 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1316 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1319 (void)do_dec_stat(A_STR);
1324 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1326 msg_print("A small dart barely misses you.");
1333 case FEAT_TRAP_LOSE_DEX:
1338 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1340 msg_print("A small dart hits you!");
1343 dam = damroll(1, 4);
1345 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1347 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1350 (void)do_dec_stat(A_DEX);
1355 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1357 msg_print("A small dart barely misses you.");
1364 case FEAT_TRAP_LOSE_CON:
1369 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1371 msg_print("A small dart hits you!");
1374 dam = damroll(1, 4);
1376 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1378 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1381 (void)do_dec_stat(A_CON);
1386 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1388 msg_print("A small dart barely misses you.");
1395 case FEAT_TRAP_BLIND:
1398 msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1400 msg_print("A black gas surrounds you!");
1403 if (!p_ptr->resist_blind)
1405 (void)set_blind(p_ptr->blind + randint0(50) + 25);
1410 case FEAT_TRAP_CONFUSE:
1413 msg_print("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1415 msg_print("A gas of scintillating colors surrounds you!");
1418 if (!p_ptr->resist_conf)
1420 (void)set_confused(p_ptr->confused + randint0(20) + 10);
1425 case FEAT_TRAP_POISON:
1428 msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1430 msg_print("A pungent green gas surrounds you!");
1433 if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
1435 (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
1440 case FEAT_TRAP_SLEEP:
1443 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1445 msg_print("A strange white mist surrounds you!");
1448 if (!p_ptr->free_act)
1451 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1453 msg_print("You fall asleep.");
1457 if (ironman_nightmare)
1460 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1462 msg_print("A horrible vision enters your mind.");
1466 /* Pick a nightmare */
1467 get_mon_num_prep(get_nightmare, NULL);
1469 /* Have some nightmares */
1470 have_nightmare(get_mon_num(MAX_DEPTH));
1472 /* Remove the monster restriction */
1473 get_mon_num_prep(NULL, NULL);
1475 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1480 case FEAT_TRAP_TRAPS:
1483 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1485 msg_print("There is a bright flash of light!");
1489 /* Destroy this trap */
1490 cave_set_feat(y, x, floor_type[randint0(100)]);
1492 /* Make some new traps */
1493 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1498 case FEAT_TRAP_ALARM:
1501 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1503 msg_print("An alarm sounds!");
1506 aggravate_monsters(0);
1511 if (break_trap && is_trap(c_ptr->feat))
1513 cave_set_feat(y, x, floor_type[randint0(100)]);
1515 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1517 msg_print("You destroyed the trap.");
1523 void touch_zap_player(monster_type *m_ptr)
1525 int aura_damage = 0;
1526 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1528 if (r_ptr->flags2 & RF2_AURA_FIRE)
1530 if (!p_ptr->immune_fire)
1534 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1536 /* Hack -- Get the "died from" name */
1537 monster_desc(aura_dam, m_ptr, 0x288);
1540 msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
1542 msg_print("You are suddenly very hot!");
1546 if (p_ptr->oppose_fire) aura_damage = (aura_damage + 2) / 3;
1547 if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
1549 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1550 r_ptr->r_flags2 |= RF2_AURA_FIRE;
1555 if (r_ptr->flags3 & RF3_AURA_COLD)
1557 if (!p_ptr->immune_cold)
1561 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1563 /* Hack -- Get the "died from" name */
1564 monster_desc(aura_dam, m_ptr, 0x288);
1567 msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
1569 msg_print("You are suddenly very cold!");
1573 if (p_ptr->oppose_cold) aura_damage = (aura_damage + 2) / 3;
1574 if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
1576 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1577 r_ptr->r_flags3 |= RF3_AURA_COLD;
1582 if (r_ptr->flags2 & RF2_AURA_ELEC)
1584 if (!p_ptr->immune_elec)
1588 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1590 /* Hack -- Get the "died from" name */
1591 monster_desc(aura_dam, m_ptr, 0x288);
1593 if (p_ptr->oppose_elec) aura_damage = (aura_damage + 2) / 3;
1594 if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
1597 msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
1599 msg_print("You get zapped!");
1602 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1603 r_ptr->r_flags2 |= RF2_AURA_ELEC;
1610 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1612 int k, bonus, chance;
1614 monster_type *m_ptr = &m_list[m_idx];
1615 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1624 case MUT2_SCOR_TAIL:
1651 atk_desc = "¥¯¥Á¥Ð¥·";
1662 atk_desc = "¾Ý¤ÎÉ¡";
1668 case MUT2_TENTACLES:
1675 atk_desc = "tentacles";
1680 dss = ddd = n_weight = 1;
1682 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1684 atk_desc = "undefined body part";
1689 /* Extract monster name (or "it") */
1690 monster_desc(m_name, m_ptr, 0);
1693 /* Calculate the "attack quality" */
1694 bonus = p_ptr->to_h_m;
1695 bonus += (p_ptr->lev * 6 / 5);
1696 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1699 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1705 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1707 msg_format("You hit %s with your %s.", m_name, atk_desc);
1711 k = damroll(ddd, dss);
1712 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1714 /* Apply the player damage bonuses */
1717 /* No negative damage */
1720 /* Modify the damage */
1721 k = mon_damage_mod(m_ptr, k, FALSE);
1723 /* Complex message */
1727 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1729 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1734 /* Anger the monster */
1735 if (k > 0) anger_monster(m_ptr);
1737 /* Damage, check for fear and mdeath */
1740 case MUT2_SCOR_TAIL:
1741 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL | PROJECT_NO_REF, -1);
1742 *mdeath = (m_ptr->r_idx == 0);
1745 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1748 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1751 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1753 case MUT2_TENTACLES:
1754 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1757 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1760 touch_zap_player(m_ptr);
1770 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1772 msg_format("You miss %s.", m_name);
1781 * Player attacks a (poor, defenseless) creature -RAK-
1783 * If no "weapon" is available, then "punch" the monster one time.
1785 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1787 int num = 0, k, bonus, chance, vir;
1789 cave_type *c_ptr = &cave[y][x];
1791 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1792 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1798 bool success_hit = FALSE;
1799 bool old_success_hit = FALSE;
1800 bool backstab = FALSE;
1801 bool vorpal_cut = FALSE;
1802 int chaos_effect = 0;
1803 bool stab_fleeing = FALSE;
1804 bool fuiuchi = FALSE;
1805 bool do_quake = FALSE;
1807 bool drain_msg = TRUE;
1808 int drain_result = 0, drain_heal = 0;
1809 bool can_drain = FALSE;
1811 int drain_left = MAX_VAMPIRIC_DRAIN;
1812 u32b f1, f2, f3; /* A massive hack -- life-draining weapons */
1813 bool is_human = (r_ptr->d_char == 'p');
1814 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1815 bool zantetsu_mukou, e_j_mukou;
1819 if (((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) && inventory[INVEN_RARM+hand].tval)
1821 int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
1822 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1823 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1824 if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
1825 if (m_ptr->csleep && m_ptr->ml)
1827 /* Can't backstab creatures that we can't see, right? */
1830 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
1834 else if (m_ptr->monfear && m_ptr->ml)
1836 stab_fleeing = TRUE;
1840 if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
1842 if ((r_ptr->level + 10) > p_ptr->lev)
1844 if (skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
1846 if (skill_exp[GINOU_SUDE] < 4000)
1847 skill_exp[GINOU_SUDE]+=40;
1848 else if((skill_exp[GINOU_SUDE] < 6000))
1849 skill_exp[GINOU_SUDE]+=5;
1850 else if((skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
1851 skill_exp[GINOU_SUDE]+=1;
1852 else if((skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
1853 if (one_in_(3)) skill_exp[GINOU_SUDE]+=1;
1854 p_ptr->update |= (PU_BONUS);
1860 if ((r_ptr->level + 10) > p_ptr->lev)
1862 int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
1863 int sval = inventory[INVEN_RARM+hand].sval;
1864 int now_exp = weapon_exp[tval][sval];
1865 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
1868 if (now_exp < 4000) amount = 80;
1869 else if(now_exp < 6000) amount = 10;
1870 else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1;
1871 else if((p_ptr->lev > 34) && one_in_(2)) amount = 1;
1872 weapon_exp[tval][sval] += amount;
1873 p_ptr->update |= (PU_BONUS);
1878 /* Disturb the monster */
1880 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
1881 p_ptr->update |= (PU_MON_LITE);
1883 /* Extract monster name (or "it") */
1884 monster_desc(m_name, m_ptr, 0);
1886 /* Access the weapon */
1887 o_ptr = &inventory[INVEN_RARM+hand];
1889 /* Calculate the "attack quality" */
1890 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
1891 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1892 if (mode == HISSATSU_IAI) chance += 60;
1893 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1895 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1897 vir = virtue_number(V_VALOUR);
1900 chance += (p_ptr->virtues[vir - 1]/10);
1903 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1904 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1906 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1907 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
1908 else num_blow = p_ptr->num_blow[hand];
1910 /* Attack once for each legal blow */
1911 while ((num++ < num_blow) && !death)
1913 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1915 if (p_ptr->migite && p_ptr->hidarite)
1917 success_hit = one_in_(2);
1919 else success_hit = TRUE;
1921 else if (mode == HISSATSU_MAJIN)
1926 success_hit = FALSE;
1927 old_success_hit = success_hit;
1929 else success_hit = old_success_hit;
1931 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flags3 & RF3_RES_ALL))) success_hit = TRUE;
1932 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
1937 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1945 msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª",
1947 msg_format("You cruelly stab the helpless, sleeping %s!",
1953 msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª",
1955 msg_format("You make surprise attack, and hit %s with a powerful blow!",
1959 else if (stab_fleeing)
1961 msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª",
1963 msg_format("You backstab the fleeing %s!",
1969 if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1)))
1971 msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
1973 msg_format("You hit %s.", m_name);
1978 /* Hack -- bare hands do one damage */
1981 object_flags(o_ptr, &f1, &f2, &f3);
1983 /* Select a chaotic effect (50% chance) */
1984 if ((f1 & TR1_CHAOTIC) && one_in_(2))
1987 chg_virtue(V_CHANCE, 1);
1989 if (randint1(5) < 3)
1991 /* Vampiric (20%) */
1994 else if (one_in_(250))
1999 else if (!one_in_(10))
2001 /* Confusion (26.892%) */
2004 else if (one_in_(2))
2006 /* Teleport away (1.494%) */
2011 /* Polymorph (1.494%) */
2016 /* Vampiric drain */
2017 if ((f1 & TR1_VAMPIRIC) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
2019 /* Only drain "living" monsters */
2020 if (monster_living(r_ptr))
2026 if ((f1 & TR1_VORPAL) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
2028 else vorpal_cut = FALSE;
2030 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
2032 int special_effect = 0, stun_effect = 0, times = 0, max_times;
2034 martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
2035 int resist_stun = 0;
2038 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
2039 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
2040 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
2041 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
2042 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
2045 if (p_ptr->special_defense & KAMAE_BYAKKO)
2046 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
2047 else if (p_ptr->special_defense & KAMAE_SUZAKU)
2049 else if (p_ptr->special_defense & KAMAE_GENBU)
2052 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
2053 /* Attempt 'times' */
2054 for (times = 0; times < max_times; times++)
2058 ma_ptr = &ma_blows[randint0(MAX_MA)];
2059 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
2060 else min_level = ma_ptr->min_level;
2062 while ((min_level > p_ptr->lev) ||
2063 (randint1(p_ptr->lev) < ma_ptr->chance));
2065 /* keep the highest level attack available we found */
2066 if ((ma_ptr->min_level > old_ptr->min_level) &&
2067 !p_ptr->stun && !p_ptr->confused)
2071 if (wizard && cheat_xtra)
2074 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
2076 msg_print("Attack re-selected.");
2087 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
2088 else min_level = ma_ptr->min_level;
2089 k = damroll(ma_ptr->dd, ma_ptr->ds);
2090 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
2092 if (ma_ptr->effect == MA_KNEE)
2094 if (r_ptr->flags1 & RF1_MALE)
2097 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2099 msg_format("You hit %s in the groin with your knee!", m_name);
2103 special_effect = MA_KNEE;
2106 msg_format(ma_ptr->desc, m_name);
2109 else if (ma_ptr->effect == MA_SLOW)
2111 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
2112 strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
2115 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2117 msg_format("You kick %s in the ankle.", m_name);
2120 special_effect = MA_SLOW;
2122 else msg_format(ma_ptr->desc, m_name);
2128 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
2131 msg_format(ma_ptr->desc, m_name);
2134 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
2135 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
2137 weight += (p_ptr->magic_num1[0]/30);
2138 if (weight > 20) weight = 20;
2141 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
2143 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2146 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
2148 msg_format("%^s moans in agony!", m_name);
2151 stun_effect = 7 + randint1(13);
2155 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2157 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2158 (randint1(p_ptr->lev) > r_ptr->level) &&
2162 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
2164 msg_format("%^s starts limping slower.", m_name);
2167 m_ptr->mspeed -= 10;
2171 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2173 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
2177 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2179 msg_format("%^s is more stunned.", m_name);
2184 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2186 msg_format("%^s is stunned.", m_name);
2190 m_ptr->stunned += stun_effect;
2195 /* Handle normal weapon */
2196 else if (o_ptr->k_idx)
2198 k = damroll(o_ptr->dd, o_ptr->ds);
2201 if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
2203 k += damroll(2, o_ptr->ds);
2207 k = tot_dam_aux(o_ptr, k, m_ptr, mode);
2211 k *= (3 + (p_ptr->lev / 20));
2215 k = k*(5+(p_ptr->lev*2/25))/2;
2217 else if (stab_fleeing)
2222 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
2223 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
2228 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
2229 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2237 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
2239 char chainsword_noise[1024];
2241 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
2243 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
2247 msg_print(chainsword_noise);
2251 if (o_ptr->name1 == ART_VORPAL_BLADE)
2254 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥Ü¡¼¥Ñ¥ë¡¦¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
2256 msg_print("Your Vorpal Blade goes snicker-snack!");
2263 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
2265 msg_format("Your weapon cuts deep into %s!", m_name);
2270 /* Try to increase the damage */
2271 while (one_in_(vorpal_chance))
2279 if (((r_ptr->flags3 & RF3_RES_ALL) ? k/100 : k) > m_ptr->hp)
2282 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
2284 msg_format("You cut %s in half!", m_name);
2293 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
2295 case 2: msg_format("You gouge %s!", m_name); break;
2299 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
2301 case 3: msg_format("You maim %s!", m_name); break;
2305 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
2307 case 4: msg_format("You carve %s!", m_name); break;
2311 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
2313 case 5: msg_format("You cleave %s!", m_name); break;
2317 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
2319 case 6: msg_format("You smite %s!", m_name); break;
2323 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
2325 case 7: msg_format("You eviscerate %s!", m_name); break;
2329 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
2331 default: msg_format("You shred %s!", m_name); break;
2336 drain_result = drain_result * 3 / 2;
2340 drain_result += o_ptr->to_d;
2343 /* Apply the player damage bonuses */
2344 k += p_ptr->to_d[hand];
2345 drain_result += p_ptr->to_d[hand];
2347 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2348 if ((mode == HISSATSU_SEKIRYUKA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON | RF3_NONLIVING))) k = 0;
2349 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2351 /* No negative damage */
2354 if ((mode == HISSATSU_ZANMA) && !((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL)))
2362 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2364 msg_print("You cannot cut such a elastic thing!");
2372 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2374 msg_print("Spiders are difficult for you to deal with!");
2379 if (mode == HISSATSU_MINEUCHI)
2381 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2384 anger_monster(m_ptr);
2386 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2392 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2394 msg_format("%s is more dazed.", m_name);
2402 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2404 msg_format("%s is dazed.", m_name);
2409 m_ptr->stunned = (tmp < 200) ? tmp : 200;
2414 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2416 msg_format("%s is not effected.", m_name);
2421 /* Modify the damage */
2422 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))));
2423 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2425 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2429 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2431 msg_format("You hit %s on a fatal spot!", m_name);
2436 else if ((p_ptr->pclass == CLASS_NINJA) && (!p_ptr->icky_wield[hand]) && ((p_ptr->cur_lite <= 0) || one_in_(7)))
2438 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2439 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2444 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2446 msg_format("You critically injured %s!", m_name);
2449 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)))
2451 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2453 k = MAX(k*5, m_ptr->hp/2);
2456 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2458 msg_format("You fatally injured %s!", m_name);
2465 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2467 msg_format("You hit %s on a fatal spot!", m_name);
2473 /* Complex message */
2474 if (wizard || cheat_xtra)
2477 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2479 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2484 if (k <= 0) can_drain = FALSE;
2486 if (drain_result > m_ptr->hp)
2487 drain_result = m_ptr->hp;
2489 /* Damage, check for fear and death */
2490 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2493 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2495 if (p_ptr->migite && p_ptr->hidarite)
2497 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2498 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2502 energy_use = energy_use*num/p_ptr->num_blow[hand];
2505 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2507 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2509 msg_print("Sign..Another trifling thing I've cut....");
2514 /* Anger the monster */
2515 if (k > 0) anger_monster(m_ptr);
2517 touch_zap_player(m_ptr);
2519 /* Are we draining it? A little note: If the monster is
2520 dead, the drain does not work... */
2522 if (can_drain && (drain_result > 0))
2524 if (o_ptr->name1 == ART_MURAMASA)
2528 int to_h = o_ptr->to_h;
2529 int to_d = o_ptr->to_d;
2533 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2537 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2540 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2543 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2545 msg_print("Muramasa sucked blood, and became more powerful!");
2554 if (drain_result > 5) /* Did we really hurt it? */
2556 drain_heal = damroll(2, drain_result / 6);
2561 msg_format("Draining left: %d", drain_left);
2563 msg_format("Draining left: %d", drain_left);
2570 if (drain_heal < drain_left)
2572 drain_left -= drain_heal;
2576 drain_heal = drain_left;
2583 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2585 msg_format("Your weapon drains life from %s!", m_name);
2591 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2593 hp_player(drain_heal);
2594 /* We get to keep some of it! */
2598 m_ptr->maxhp -= (k+7)/8;
2599 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2605 /* Confusion attack */
2606 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF))
2608 /* Cancel glowing hands */
2609 if (p_ptr->special_attack & ATTACK_CONFUSE)
2611 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2613 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2615 msg_print("Your hands stop glowing.");
2617 p_ptr->redraw |= (PR_STATUS);
2621 /* Confuse the monster */
2622 if (r_ptr->flags3 & RF3_NO_CONF)
2626 r_ptr->r_flags3 |= RF3_NO_CONF;
2630 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2632 msg_format("%^s is unaffected.", m_name);
2636 else if (randint0(100) < r_ptr->level)
2639 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2641 msg_format("%^s is unaffected.", m_name);
2648 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2650 msg_format("%^s appears confused.", m_name);
2653 m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
2657 else if (chaos_effect == 4)
2659 bool resists_tele = FALSE;
2661 if (r_ptr->flags3 & RF3_RES_TELE)
2663 if (r_ptr->flags1 & RF1_UNIQUE)
2665 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2667 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2669 msg_format("%^s is unaffected!", m_name);
2672 resists_tele = TRUE;
2674 else if (r_ptr->level > randint1(100))
2676 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2678 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2680 msg_format("%^s resists!", m_name);
2683 resists_tele = TRUE;
2690 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2692 msg_format("%^s disappears!", m_name);
2695 teleport_away(c_ptr->m_idx, 50, FALSE);
2696 num = p_ptr->num_blow[hand] + 1; /* Can't hit it anymore! */
2701 else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
2702 (randint1(90) > r_ptr->level))
2704 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2705 !(r_ptr->flags4 & RF4_BR_CHAO) &&
2706 !(r_ptr->flags1 & RF1_QUESTOR))
2708 if (polymorph_monster(y, x))
2711 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2713 msg_format("%^s changes!", m_name);
2717 /* Hack -- Get new monster */
2718 m_ptr = &m_list[c_ptr->m_idx];
2720 /* Oops, we need a different name... */
2721 monster_desc(m_name, m_ptr, 0);
2723 /* Hack -- Get new race */
2724 r_ptr = &r_info[m_ptr->r_idx];
2732 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2734 msg_format("%^s is unaffected.", m_name);
2740 else if (o_ptr->name1 == ART_G_HAMMER)
2742 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2744 if (m_ptr->hold_o_idx)
2746 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2747 char o_name[MAX_NLEN];
2749 object_desc(o_name, q_ptr, TRUE, 0);
2750 q_ptr->held_m_idx = 0;
2751 q_ptr->marked = FALSE;
2752 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2753 q_ptr->next_o_idx = 0;
2755 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2757 msg_format("You snatched %s.", o_name);
2767 backstab = FALSE; /* Clumsy! */
2768 fuiuchi = FALSE; /* Clumsy! */
2770 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2779 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2781 msg_format("You miss %s.", m_name);
2785 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2787 msg_print("Your scythe returns to you!");
2790 /* Extract the flags */
2791 object_flags(o_ptr, &f1, &f2, &f3);
2793 k = damroll(o_ptr->dd, o_ptr->ds);
2796 switch (p_ptr->mimic_form)
2799 switch (p_ptr->prace)
2809 case RACE_HALF_TROLL:
2810 case RACE_HALF_OGRE:
2811 case RACE_HALF_GIANT:
2812 case RACE_HALF_TITAN:
2822 case RACE_DRACONIAN:
2829 case MIMIC_DEMON_LORD:
2836 if (p_ptr->align < 0 && mult < 20)
2838 if (!(p_ptr->resist_acid || p_ptr->oppose_acid) && (mult < 25))
2840 if (!(p_ptr->resist_elec || p_ptr->oppose_elec) && (mult < 25))
2842 if (!(p_ptr->resist_fire || p_ptr->oppose_fire) && (mult < 25))
2844 if (!(p_ptr->resist_cold || p_ptr->oppose_cold) && (mult < 25))
2846 if (!(p_ptr->resist_pois || p_ptr->oppose_pois) && (mult < 25))
2849 if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (p_ptr->msp / 30)))
2851 p_ptr->csp -= (1+(p_ptr->msp / 30));
2852 p_ptr->redraw |= (PR_MANA);
2859 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2864 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
2866 msg_format("Your weapon cuts deep into yourself!");
2868 /* Try to increase the damage */
2876 k += (p_ptr->to_d[hand] + o_ptr->to_d);
2879 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
2881 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
2893 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2895 msg_format("You miss %s.", m_name);
2904 if (weak && !(*mdeath))
2907 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
2909 msg_format("%^s seems weakened.", m_name);
2912 if (drain_left != MAX_VAMPIRIC_DRAIN)
2916 chg_virtue(V_UNLIFE, 1);
2919 /* Mega-Hack -- apply earthquake brand */
2922 earthquake(py, px, 10);
2923 if (!cave[y][x].m_idx) *mdeath = TRUE;
2927 bool py_attack(int y, int x, int mode)
2930 bool mdeath = FALSE;
2931 bool stormbringer = FALSE;
2933 cave_type *c_ptr = &cave[y][x];
2934 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2937 /* Disturb the player */
2942 if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
2944 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
2945 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
2948 /* Extract monster name (or "it") */
2949 monster_desc(m_name, m_ptr, 0);
2951 /* Auto-Recall if possible and visible */
2952 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
2954 /* Track a new monster */
2955 if (m_ptr->ml) health_track(c_ptr->m_idx);
2957 if ((r_info[m_ptr->r_idx].flags1 & RF1_FEMALE) &&
2958 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
2960 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
2963 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
2965 msg_print("I can not attack women!");
2971 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
2974 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
2976 msg_print("Something prevent you from attacking.");
2981 /* Stop if friendly */
2982 if (!is_hostile(m_ptr) &&
2983 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
2984 p_ptr->shero || !m_ptr->ml))
2986 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2987 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2991 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
2993 msg_format("Your black blade greedily attacks %s!", m_name);
2995 chg_virtue(V_INDIVIDUALISM, 1);
2996 chg_virtue(V_HONOUR, -1);
2997 chg_virtue(V_JUSTICE, -1);
2998 chg_virtue(V_COMPASSION, -1);
3000 else if (p_ptr->pclass != CLASS_BERSERKER)
3003 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
3005 if (get_check("Really hit it? "))
3008 chg_virtue(V_INDIVIDUALISM, 1);
3009 chg_virtue(V_HONOUR, -1);
3010 chg_virtue(V_JUSTICE, -1);
3011 chg_virtue(V_COMPASSION, -1);
3016 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
3018 msg_format("You stop to avoid hitting %s.", m_name);
3026 /* Handle player fear */
3032 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
3034 msg_format("You are too afraid to attack %s!", m_name);
3039 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
3041 msg_format ("There is something scary in your way!");
3044 /* Disturb the monster */
3046 p_ptr->update |= (PU_MON_LITE);
3052 if (p_ptr->migite && p_ptr->hidarite)
3054 if ((skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
3056 if (skill_exp[GINOU_NITOURYU] < 4000)
3057 skill_exp[GINOU_NITOURYU]+=80;
3058 else if(skill_exp[GINOU_NITOURYU] < 6000)
3059 skill_exp[GINOU_NITOURYU]+=4;
3060 else if(skill_exp[GINOU_NITOURYU] < 7000)
3061 skill_exp[GINOU_NITOURYU]+=1;
3062 else if(skill_exp[GINOU_NITOURYU] < 8000)
3063 if (one_in_(3)) skill_exp[GINOU_NITOURYU]+=1;
3064 p_ptr->update |= (PU_BONUS);
3070 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
3071 if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel))
3072 skill_exp[GINOU_RIDING]++;
3073 if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (skill_exp[GINOU_RIDING]/100 < ridinglevel))
3075 if (ridinglevel*100 > (skill_exp[GINOU_RIDING] + 1500))
3076 skill_exp[GINOU_RIDING] += (1+(ridinglevel - skill_exp[GINOU_RIDING]/100 - 15));
3077 else skill_exp[GINOU_RIDING]++;
3079 p_ptr->update |= (PU_BONUS);
3082 riding_t_m_idx = c_ptr->m_idx;
3083 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
3084 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
3086 /* Mutations which yield extra 'natural' attacks */
3089 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
3090 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
3091 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
3092 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
3093 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
3094 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
3095 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
3096 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
3097 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
3098 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
3101 /* Hack -- delay fear messages */
3102 if (fear && m_ptr->ml && !mdeath)
3109 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
3111 msg_format("%^s flees in terror!", m_name);
3116 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
3118 set_action(ACTION_NONE);
3125 static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
3127 if (!pattern_tile(c_y, c_x) && !pattern_tile(n_y, n_x))
3130 if (cave[n_y][n_x].feat == FEAT_PATTERN_START)
3132 if (!pattern_tile(c_y, c_x) &&
3133 !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
3136 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
3138 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
3148 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_OLD) ||
3149 (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
3150 (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
3152 if (pattern_tile(c_y, c_x))
3159 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3161 msg_print("You must start walking the Pattern from the startpoint.");
3167 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
3168 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
3172 else if (cave[c_y][c_x].feat == FEAT_PATTERN_START)
3174 if (pattern_tile(n_y, n_x))
3179 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3181 msg_print("You must walk the Pattern in correct order.");
3187 else if ((cave[c_y][c_x].feat == FEAT_PATTERN_OLD) ||
3188 (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
3189 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
3191 if (!pattern_tile(n_y, n_x))
3194 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3196 msg_print("You may not step off from the Pattern.");
3208 if (!pattern_tile(c_y, c_x))
3211 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3213 msg_print("You must start walking the Pattern from the startpoint.");
3220 byte ok_move = FEAT_PATTERN_START;
3221 switch (cave[c_y][c_x].feat)
3223 case FEAT_PATTERN_1:
3224 ok_move = FEAT_PATTERN_2;
3226 case FEAT_PATTERN_2:
3227 ok_move = FEAT_PATTERN_3;
3229 case FEAT_PATTERN_3:
3230 ok_move = FEAT_PATTERN_4;
3232 case FEAT_PATTERN_4:
3233 ok_move = FEAT_PATTERN_1;
3238 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]);
3240 msg_format("Funny Pattern walking, %d.", cave[c_y][c_x]);
3243 return TRUE; /* Goof-up */
3246 if ((cave[n_y][n_x].feat == ok_move) ||
3247 (cave[n_y][n_x].feat == cave[c_y][c_x].feat))
3251 if (!pattern_tile(n_y, n_x))
3253 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3255 msg_print("You may not step off from the Pattern.");
3260 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3262 msg_print("You must walk the Pattern in correct order.");
3274 bool player_can_enter(byte feature)
3278 /* Player can not walk through "walls" unless in Shadow Form */
3279 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3286 case FEAT_DEEP_WATER:
3287 case FEAT_SHAL_LAVA:
3288 case FEAT_DEEP_LAVA:
3311 case FEAT_WALL_EXTRA:
3312 case FEAT_WALL_INNER:
3313 case FEAT_WALL_OUTER:
3314 case FEAT_WALL_SOLID:
3321 return (!dun_level && p_ptr->ffall);
3323 case FEAT_PERM_EXTRA:
3324 case FEAT_PERM_INNER:
3325 case FEAT_PERM_OUTER:
3326 case FEAT_PERM_SOLID:
3337 * Move player in the given direction, with the given "pickup" flag.
3339 * This routine should (probably) always induce energy expenditure.
3341 * Note that moving will *always* take a turn, and will *always* hit
3342 * any monster which might be in the destination grid. Previously,
3343 * moving into walls was "free" and did NOT hit invisible monsters.
3345 void move_player(int dir, int do_pickup, bool break_trap)
3350 monster_type *m_ptr;
3354 bool p_can_pass_walls = FALSE;
3355 bool stormbringer = FALSE;
3357 bool oktomove = TRUE;
3358 bool do_past = FALSE;
3360 /* Find the result of moving */
3364 /* Examine the destination */
3365 c_ptr = &cave[y][x];
3369 if (!dun_level && !p_ptr->wild_mode &&
3370 ((x == 0) || (x == MAX_WID - 1) ||
3371 (y == 0) || (y == MAX_HGT - 1)))
3373 /* Can the player enter the grid? */
3374 if (c_ptr->mimic && player_can_enter(c_ptr->mimic))
3376 /* Hack: move to new area */
3377 if ((y == 0) && (x == 0))
3379 p_ptr->wilderness_y--;
3380 p_ptr->wilderness_x--;
3381 p_ptr->oldpy = cur_hgt - 2;
3382 p_ptr->oldpx = cur_wid - 2;
3383 ambush_flag = FALSE;
3386 else if ((y == 0) && (x == MAX_WID - 1))
3388 p_ptr->wilderness_y--;
3389 p_ptr->wilderness_x++;
3390 p_ptr->oldpy = cur_hgt - 2;
3392 ambush_flag = FALSE;
3395 else if ((y == MAX_HGT - 1) && (x == 0))
3397 p_ptr->wilderness_y++;
3398 p_ptr->wilderness_x--;
3400 p_ptr->oldpx = cur_wid - 2;
3401 ambush_flag = FALSE;
3404 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3406 p_ptr->wilderness_y++;
3407 p_ptr->wilderness_x++;
3410 ambush_flag = FALSE;
3415 p_ptr->wilderness_y--;
3416 p_ptr->oldpy = cur_hgt - 2;
3418 ambush_flag = FALSE;
3421 else if (y == MAX_HGT - 1)
3423 p_ptr->wilderness_y++;
3426 ambush_flag = FALSE;
3431 p_ptr->wilderness_x--;
3432 p_ptr->oldpx = cur_wid - 2;
3434 ambush_flag = FALSE;
3437 else if (x == MAX_WID - 1)
3439 p_ptr->wilderness_x++;
3442 ambush_flag = FALSE;
3445 p_ptr->leftbldg = TRUE;
3446 p_ptr->leaving = TRUE;
3455 /* Get the monster */
3456 m_ptr = &m_list[c_ptr->m_idx];
3459 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3460 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3462 /* Player can not walk through "walls"... */
3463 /* unless in Shadow Form */
3464 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3465 p_can_pass_walls = TRUE;
3466 if ((cave[y][x].feat >= FEAT_PERM_EXTRA) &&
3467 (cave[y][x].feat <= FEAT_PERM_SOLID))
3469 p_can_pass_walls = FALSE;
3474 cave[py][px].m_idx = 0;
3477 /* Hack -- attack monsters */
3478 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
3481 /* Attack -- only if we can see it OR it is not in a wall */
3482 if (!is_hostile(m_ptr) &&
3483 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3484 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3485 (pattern_seq(py, px, y, x)) &&
3486 ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
3489 p_ptr->update |= (PU_MON_LITE);
3491 /* Extract monster name (or "it") */
3492 monster_desc(m_name, m_ptr, 0);
3494 /* Auto-Recall if possible and visible */
3495 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
3497 /* Track a new monster */
3498 if (m_ptr->ml) health_track(c_ptr->m_idx);
3501 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3506 else if (monster_can_cross_terrain(cave[py][px].feat, &r_info[m_ptr->r_idx]) &&
3507 (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
3508 (r_info[m_ptr->r_idx].flags2 & RF2_PASS_WALL)))
3515 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3517 msg_format("%^s is in your way!", m_name);
3524 /* now continue on to 'movement' */
3537 else if ((c_ptr->feat == FEAT_DARK_PIT) && !p_ptr->ffall)
3540 msg_print("Îö¤±Ìܤò²£Àڤ뤳¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
3542 msg_print("You can't cross the chasm.");
3550 else if (c_ptr->feat == FEAT_MOUNTAIN)
3552 if (dun_level || !p_ptr->ffall)
3555 msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
3557 msg_print("You can't climb the mountains!");
3566 * Player can move through trees and
3567 * has effective -10 speed
3568 * Rangers can move without penality
3570 else if (c_ptr->feat == FEAT_TREES)
3573 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
3576 else if ((c_ptr->feat >= FEAT_QUEST_ENTER) &&
3577 (c_ptr->feat <= FEAT_QUEST_EXIT))
3582 #ifdef ALLOW_EASY_DISARM /* TNB */
3584 /* Disarm a visible trap */
3585 else if ((do_pickup != easy_disarm) && is_trap(c_ptr->feat))
3587 bool ignore = FALSE;
3588 switch (c_ptr->feat)
3590 case FEAT_TRAP_TRAPDOOR:
3592 case FEAT_TRAP_SPIKED_PIT:
3593 case FEAT_TRAP_POISON_PIT:
3594 if (p_ptr->ffall) ignore = TRUE;
3596 case FEAT_TRAP_TELEPORT:
3597 if (p_ptr->anti_tele) ignore = TRUE;
3599 case FEAT_TRAP_FIRE:
3600 if (p_ptr->immune_fire) ignore = TRUE;
3602 case FEAT_TRAP_ACID:
3603 if (p_ptr->immune_acid) ignore = TRUE;
3605 case FEAT_TRAP_BLIND:
3606 if (p_ptr->resist_blind) ignore = TRUE;
3608 case FEAT_TRAP_CONFUSE:
3609 if (p_ptr->resist_conf) ignore = TRUE;
3611 case FEAT_TRAP_POISON:
3612 if (p_ptr->resist_pois) ignore = TRUE;
3614 case FEAT_TRAP_SLEEP:
3615 if (p_ptr->free_act) ignore = TRUE;
3621 (void)do_cmd_disarm_aux(y, x, dir);
3626 #endif /* ALLOW_EASY_DISARM -- TNB */
3627 else if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags1 & RF1_NEVER_MOVE))
3630 msg_print("Æ°¤±¤Ê¤¤¡ª");
3632 msg_print("Can't move!");
3639 else if (p_ptr->riding && m_list[p_ptr->riding].monfear)
3643 /* Acquire the monster name */
3644 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3646 /* Dump a message */
3648 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3650 msg_format("%^s is too scared to control.", m_name);
3656 else if (p_ptr->riding && p_ptr->riding_ryoute)
3662 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))
3665 msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
3667 msg_print("Can't land.");
3674 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))
3677 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3679 msg_print("Can't swim.");
3686 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))
3689 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3691 msg_print("Can't swim.");
3698 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)))
3701 msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3703 msg_print("Too hot to go through.");
3710 else if (p_ptr->riding && m_list[p_ptr->riding].stunned && one_in_(2))
3713 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3715 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3717 msg_format("You cannot control stunned %s!",m_name);
3723 /* Player can not walk through "walls" unless in wraith form...*/
3724 else if ((!cave_floor_bold(y, x)) &&
3725 (!p_can_pass_walls))
3729 /* Disturb the player */
3732 /* Notice things in the dark */
3733 if ((!(c_ptr->info & (CAVE_MARK))) &&
3734 (p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
3737 if (c_ptr->feat == FEAT_RUBBLE)
3740 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3742 msg_print("You feel some rubble blocking your way.");
3745 c_ptr->info |= (CAVE_MARK);
3750 else if (c_ptr->feat < FEAT_SECRET)
3753 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3755 msg_print("You feel a closed door blocking your way.");
3758 c_ptr->info |= (CAVE_MARK);
3762 /* Wall (or secret door) */
3766 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3768 msg_print("You feel a wall blocking your way.");
3771 c_ptr->info |= (CAVE_MARK);
3780 if (c_ptr->feat == FEAT_RUBBLE)
3783 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3785 msg_print("There is rubble blocking your way.");
3789 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3793 * Well, it makes sense that you lose time bumping into
3794 * a wall _if_ you are confused, stunned or blind; but
3795 * typing mistakes should not cost you a turn...
3799 else if (c_ptr->feat < FEAT_SECRET)
3801 #ifdef ALLOW_EASY_OPEN
3803 if (easy_open && easy_open_door(y, x)) return;
3805 #endif /* ALLOW_EASY_OPEN */
3808 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3810 msg_print("There is a closed door blocking your way.");
3814 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3818 /* Wall (or secret door) */
3822 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3824 msg_print("There is a wall blocking your way.");
3828 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3834 sound(SOUND_HITWALL);
3837 /* Normal movement */
3838 if (!pattern_seq(py, px, y, x))
3840 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3845 /* To avoid a loop with running */
3851 /* Normal movement */
3858 if(!process_frakir(x,y))
3868 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
3870 msg_format("You push past %s.", m_name);
3875 cave[py][px].m_idx = c_ptr->m_idx;
3877 update_mon(cave[py][px].m_idx, TRUE);
3880 /* Change oldpx and oldpy to place the player well when going back to big mode */
3881 if (p_ptr->wild_mode)
3883 if(ddy[dir] > 0) p_ptr->oldpy = 1;
3884 if(ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
3885 if(ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
3886 if(ddx[dir] > 0) p_ptr->oldpx = 1;
3887 if(ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
3888 if(ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
3891 /* Save old location */
3895 /* Move the player */
3899 if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
3901 if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
3903 /* Forget the wall */
3904 cave[py][px].info &= ~(CAVE_MARK);
3907 cave_set_feat(py, px, floor_type[randint0(100)]);
3910 if (music_singing(MUSIC_WALL))
3912 project(0, 0, py, px,
3913 (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
3915 else if (p_ptr->kill_wall)
3917 if (cave_valid_bold(py, px) &&
3918 (cave[py][px].feat < FEAT_PATTERN_START ||
3919 cave[py][px].feat > FEAT_PATTERN_XTRA2) &&
3920 (cave[py][px].feat < FEAT_DEEP_WATER ||
3921 cave[py][px].feat > FEAT_GRASS))
3923 if (cave[py][px].feat == FEAT_TREES)
3924 cave_set_feat(py, px, FEAT_GRASS);
3927 cave[py][px].feat = floor_type[randint0(100)];
3930 /* Update some things -- similar to GF_KILL_WALL */
3931 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
3934 /* Redraw new spot */
3937 /* Redraw old spot */
3941 /* sound(SOUND_WALK); */
3943 /* Check for new panel (redraw map) */
3946 /* For get everything when requested hehe I'm *NASTY* */
3947 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
3952 if ((p_ptr->pclass == CLASS_NINJA))
3954 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
3955 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
3957 if ((p_ptr->action == ACTION_HAYAGAKE) && !cave_floor_bold(py, px))
3960 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
3962 msg_print("You cannot run in wall.");
3964 set_action(ACTION_NONE);
3968 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
3970 /* Update the monsters */
3971 p_ptr->update |= (PU_DISTANCE);
3974 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3976 /* Spontaneous Searching */
3977 if ((p_ptr->skill_fos >= 50) ||
3978 (0 == randint0(50 - p_ptr->skill_fos)))
3983 /* Continuous Searching */
3984 if (p_ptr->action == ACTION_SEARCH)
3989 /* Handle "objects" */
3991 #ifdef ALLOW_EASY_DISARM /* TNB */
3993 carry(do_pickup != always_pickup);
3995 #else /* ALLOW_EASY_DISARM -- TNB */
3999 #endif /* ALLOW_EASY_DISARM -- TNB */
4001 /* Handle "store doors" */
4002 if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
4003 (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
4004 (c_ptr->feat == FEAT_MUSEUM))
4010 /* Hack -- Enter store */
4014 /* Handle "building doors" -KMW- */
4015 else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
4016 (c_ptr->feat <= FEAT_BLDG_TAIL))
4022 /* Hack -- Enter building */
4026 /* Handle quest areas -KMW- */
4027 else if (cave[y][x].feat == FEAT_QUEST_ENTER)
4033 /* Hack -- Enter quest level */
4037 else if (cave[y][x].feat == FEAT_QUEST_EXIT)
4039 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
4041 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
4042 quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
4043 quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
4045 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
4047 msg_print("You accomplished your quest!");
4053 leave_quest_check();
4055 p_ptr->inside_quest = cave[y][x].special;
4059 p_ptr->leaving = TRUE;
4062 /* Discover invisible traps */
4063 else if (c_ptr->info & CAVE_TRAP)
4070 msg_print("¥È¥é¥Ã¥×¤À¡ª");
4072 msg_print("You found a trap!");
4080 hit_trap(break_trap);
4083 /* Set off an visible trap */
4084 else if (is_trap(c_ptr->feat))
4090 hit_trap(break_trap);
4093 /* Warn when leaving trap detected region */
4094 if ((disturb_trap_detect || alert_trap_detect)
4095 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4097 /* No duplicate warning */
4098 p_ptr->dtrap = FALSE;
4100 /* You are just on the edge */
4101 if (cave[py][px].info & CAVE_DETECT)
4103 if (alert_trap_detect)
4106 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4108 msg_print("*Leaving trap detect region!*");
4112 if (disturb_trap_detect)
4122 m_list[p_ptr->riding].fy = py;
4123 m_list[p_ptr->riding].fx = px;
4124 cave[py][px].m_idx = p_ptr->riding;
4125 update_mon(cave[py][px].m_idx, TRUE);
4126 p_ptr->update |= (PU_MON_LITE);
4132 * Hack -- Check for a "known wall" (see below)
4134 static int see_wall(int dir, int y, int x)
4136 /* Get the new location */
4140 /* Illegal grids are not known walls */
4141 if (!in_bounds2(y, x)) return (FALSE);
4143 /* Non-wall grids are not known walls */
4144 if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
4146 if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
4147 (cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
4149 if ((cave[y][x].feat >= FEAT_SHOP_HEAD) &&
4150 (cave[y][x].feat <= FEAT_SHOP_TAIL)) return (FALSE);
4152 if (cave[y][x].feat == FEAT_DEEP_GRASS) return (FALSE);
4153 if (cave[y][x].feat == FEAT_FLOWER) return (FALSE);
4155 if (cave[y][x].feat == FEAT_MUSEUM) return (FALSE);
4157 if ((cave[y][x].feat >= FEAT_BLDG_HEAD) &&
4158 (cave[y][x].feat <= FEAT_BLDG_TAIL)) return (FALSE);
4160 /* if (cave[y][x].feat == FEAT_TREES) return (FALSE); */
4162 /* Must be known to the player */
4163 if (!(cave[y][x].info & (CAVE_MARK))) return (FALSE);
4165 if (cave[y][x].feat >= FEAT_TOWN) return (FALSE);
4173 * Hack -- Check for an "unknown corner" (see below)
4175 static int see_nothing(int dir, int y, int x)
4177 /* Get the new location */
4181 /* Illegal grids are unknown */
4182 if (!in_bounds2(y, x)) return (TRUE);
4184 /* Memorized grids are always known */
4185 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
4187 /* Non-floor grids are unknown */
4188 if (!cave_floor_bold(y, x)) return (TRUE);
4190 /* Viewable door/wall grids are known */
4191 if (player_can_see_bold(y, x)) return (FALSE);
4202 * The running algorithm: -CJS-
4204 * In the diagrams below, the player has just arrived in the
4205 * grid marked as '@', and he has just come from a grid marked
4206 * as 'o', and he is about to enter the grid marked as 'x'.
4208 * Of course, if the "requested" move was impossible, then you
4209 * will of course be blocked, and will stop.
4211 * Overview: You keep moving until something interesting happens.
4212 * If you are in an enclosed space, you follow corners. This is
4213 * the usual corridor scheme. If you are in an open space, you go
4214 * straight, but stop before entering enclosed space. This is
4215 * analogous to reaching doorways. If you have enclosed space on
4216 * one side only (that is, running along side a wall) stop if
4217 * your wall opens out, or your open space closes in. Either case
4218 * corresponds to a doorway.
4220 * What happens depends on what you can really SEE. (i.e. if you
4221 * have no light, then running along a dark corridor is JUST like
4222 * running in a dark room.) The algorithm works equally well in
4223 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
4225 * These conditions are kept in static memory:
4226 * find_openarea You are in the open on at least one
4228 * find_breakleft You have a wall on the left, and will
4230 * find_breakright You have a wall on the right, and will
4233 * To initialize these conditions, we examine the grids adjacent
4234 * to the grid marked 'x', two on each side (marked 'L' and 'R').
4235 * If either one of the two grids on a given side is seen to be
4236 * closed, then that side is considered to be closed. If both
4237 * sides are closed, then it is an enclosed (corridor) run.
4243 * Looking at more than just the immediate squares is
4244 * significant. Consider the following case. A run along the
4245 * corridor will stop just before entering the center point,
4246 * because a choice is clearly established. Running in any of
4247 * three available directions will be defined as a corridor run.
4248 * Note that a minor hack is inserted to make the angled corridor
4249 * entry (with one side blocked near and the other side blocked
4250 * further away from the runner) work correctly. The runner moves
4251 * diagonally, but then saves the previous direction as being
4252 * straight into the gap. Otherwise, the tail end of the other
4253 * entry would be perceived as an alternative on the next move.
4261 * Likewise, a run along a wall, and then into a doorway (two
4262 * runs) will work correctly. A single run rightwards from @ will
4263 * stop at 1. Another run right and down will enter the corridor
4264 * and make the corner, stopping at the 2.
4266 * ##################
4268 * ########### ######
4272 * After any move, the function area_affect is called to
4273 * determine the new surroundings, and the direction of
4274 * subsequent moves. It examines the current player location
4275 * (at which the runner has just arrived) and the previous
4276 * direction (from which the runner is considered to have come).
4278 * Moving one square in some direction places you adjacent to
4279 * three or five new squares (for straight and diagonal moves
4280 * respectively) to which you were not previously adjacent,
4281 * marked as '!' in the diagrams below.
4284 * .o@! (normal) .o.! (diagonal)
4285 * ...! (east) ..@! (south east)
4288 * You STOP if any of the new squares are interesting in any way:
4289 * for example, if they contain visible monsters or treasure.
4291 * You STOP if any of the newly adjacent squares seem to be open,
4292 * and you are also looking for a break on that side. (that is,
4293 * find_openarea AND find_break).
4295 * You STOP if any of the newly adjacent squares do NOT seem to be
4296 * open and you are in an open area, and that side was previously
4299 * Corners: If you are not in the open (i.e. you are in a corridor)
4300 * and there is only one way to go in the new squares, then turn in
4301 * that direction. If there are more than two new ways to go, STOP.
4302 * If there are two ways to go, and those ways are separated by a
4303 * square which does not seem to be open, then STOP.
4305 * Otherwise, we have a potential corner. There are two new open
4306 * squares, which are also adjacent. One of the new squares is
4307 * diagonally located, the other is straight on (as in the diagram).
4308 * We consider two more squares further out (marked below as ?).
4310 * We assign "option" to the straight-on grid, and "option2" to the
4311 * diagonal grid, and "check_dir" to the grid marked 's'.
4317 * If they are both seen to be closed, then it is seen that no benefit
4318 * is gained from moving straight. It is a known corner. To cut the
4319 * corner, go diagonally, otherwise go straight, but pretend you
4320 * stepped diagonally into that next location for a full view next
4321 * time. Conversely, if one of the ? squares is not seen to be closed,
4322 * then there is a potential choice. We check to see whether it is a
4323 * potential corner or an intersection/room entrance. If the square
4324 * two spaces straight ahead, and the space marked with 's' are both
4325 * unknown space, then it is a potential corner and enter if
4326 * find_examine is set, otherwise must stop because it is not a
4334 * Hack -- allow quick "cycling" through the legal directions
4336 static byte cycle[] =
4337 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
4340 * Hack -- map each direction into the "middle" of the "cycle[]" array
4342 static byte chome[] =
4343 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
4346 * The direction we are running
4348 static byte find_current;
4351 * The direction we came from
4353 static byte find_prevdir;
4356 * We are looking for open area
4358 static bool find_openarea;
4361 * We are looking for a break
4363 static bool find_breakright;
4364 static bool find_breakleft;
4369 * Initialize the running algorithm for a new direction.
4371 * Diagonal Corridor -- allow diaginal entry into corridors.
4373 * Blunt Corridor -- If there is a wall two spaces ahead and
4374 * we seem to be in a corridor, then force a turn into the side
4375 * corridor, must be moving straight into a corridor here. ???
4377 * Diagonal Corridor Blunt Corridor (?)
4382 static void run_init(int dir)
4384 int row, col, deepleft, deepright;
4385 int i, shortleft, shortright;
4388 /* Save the direction */
4391 /* Assume running straight */
4394 /* Assume looking for open area */
4395 find_openarea = TRUE;
4397 /* Assume not looking for breaks */
4398 find_breakright = find_breakleft = FALSE;
4400 /* Assume no nearby walls */
4401 deepleft = deepright = FALSE;
4402 shortright = shortleft = FALSE;
4407 /* Find the destination grid */
4408 row = py + ddy[dir];
4409 col = px + ddx[dir];
4411 /* Extract cycle index */
4414 /* Check for walls */
4415 if (see_wall(cycle[i+1], py, px))
4417 find_breakleft = TRUE;
4420 else if (see_wall(cycle[i+1], row, col))
4422 find_breakleft = TRUE;
4426 /* Check for walls */
4427 if (see_wall(cycle[i-1], py, px))
4429 find_breakright = TRUE;
4432 else if (see_wall(cycle[i-1], row, col))
4434 find_breakright = TRUE;
4438 /* Looking for a break */
4439 if (find_breakleft && find_breakright)
4441 /* Not looking for open area */
4442 find_openarea = FALSE;
4444 /* Hack -- allow angled corridor entry */
4447 if (deepleft && !deepright)
4449 find_prevdir = cycle[i - 1];
4451 else if (deepright && !deepleft)
4453 find_prevdir = cycle[i + 1];
4457 /* Hack -- allow blunt corridor entry */
4458 else if (see_wall(cycle[i], row, col))
4460 if (shortleft && !shortright)
4462 find_prevdir = cycle[i - 2];
4464 else if (shortright && !shortleft)
4466 find_prevdir = cycle[i + 2];
4474 * Update the current "run" path
4476 * Return TRUE if the running should be stopped
4478 static bool run_test(void)
4480 int prev_dir, new_dir, check_dir = 0;
4483 int option = 0, option2 = 0;
4486 /* Where we came from */
4487 prev_dir = find_prevdir;
4490 /* Range of newly adjacent grids */
4491 max = (prev_dir & 0x01) + 1;
4493 /* break run when leaving trap detected region */
4494 if ((disturb_trap_detect || alert_trap_detect)
4495 && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
4497 /* No duplicate warning */
4498 p_ptr->dtrap = FALSE;
4500 /* You are just on the edge */
4501 if (cave[py][px].info & CAVE_DETECT)
4503 if (alert_trap_detect)
4506 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4508 msg_print("*Leaving trap detect region!*");
4512 if (disturb_trap_detect)
4520 /* Look at every newly adjacent square. */
4521 for (i = -max; i <= max; i++)
4523 s16b this_o_idx, next_o_idx = 0;
4527 new_dir = cycle[chome[prev_dir] + i];
4530 row = py + ddy[new_dir];
4531 col = px + ddx[new_dir];
4534 c_ptr = &cave[row][col];
4537 /* Visible monsters abort running */
4540 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4542 /* Visible monster */
4543 if (m_ptr->ml) return (TRUE);
4546 /* Visible objects abort running */
4547 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4551 /* Acquire object */
4552 o_ptr = &o_list[this_o_idx];
4554 /* Acquire next object */
4555 next_o_idx = o_ptr->next_o_idx;
4557 /* Visible object */
4558 if (o_ptr->marked) return (TRUE);
4562 /* Assume unknown */
4565 /* Check memorized grids */
4566 if (c_ptr->info & (CAVE_MARK))
4570 /* Examine the terrain */
4571 switch (c_ptr->feat)
4586 /* Hidden treasure */
4590 /* Known treasure (almost uninteresting) */
4596 case FEAT_WALL_EXTRA:
4597 case FEAT_WALL_INNER:
4598 case FEAT_WALL_OUTER:
4599 case FEAT_WALL_SOLID:
4600 case FEAT_PERM_EXTRA:
4601 case FEAT_PERM_INNER:
4602 case FEAT_PERM_OUTER:
4603 case FEAT_PERM_SOLID:
4604 /* dirt, grass, trees, ... */
4605 case FEAT_SHAL_WATER:
4608 case FEAT_DEEP_GRASS:
4621 /* quest features */
4622 case FEAT_QUEST_ENTER:
4623 case FEAT_QUEST_EXIT:
4632 case FEAT_DEEP_LAVA:
4633 case FEAT_SHAL_LAVA:
4636 if (p_ptr->invuln || p_ptr->immune_fire) notice = FALSE;
4642 case FEAT_DEEP_WATER:
4645 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;
4655 /* Option -- ignore */
4656 if (find_ignore_doors) notice = FALSE;
4665 case FEAT_LESS_LESS:
4666 case FEAT_MORE_MORE:
4669 /* Option -- ignore */
4670 if (find_ignore_stairs) notice = FALSE;
4677 /* Interesting feature */
4678 if (notice) return (TRUE);
4680 /* The grid is "visible" */
4684 /* Analyze unknown grids and floors */
4685 /* if (inv || cave_floor_bold(row, col) || */
4686 /* (cave[row][col].feat == FEAT_TREES)) */
4687 if (inv || cave_floor_bold(row, col))
4689 /* Looking for open area */
4695 /* The first new direction. */
4701 /* Three new directions. Stop running. */
4707 /* Two non-adjacent new directions. Stop running. */
4708 else if (option != cycle[chome[prev_dir] + i - 1])
4713 /* Two new (adjacent) directions (case 1) */
4714 else if (new_dir & 0x01)
4716 check_dir = cycle[chome[prev_dir] + i - 2];
4720 /* Two new (adjacent) directions (case 2) */
4723 check_dir = cycle[chome[prev_dir] + i + 1];
4729 /* Obstacle, while looking for open area */
4736 /* Break to the right */
4737 find_breakright = TRUE;
4742 /* Break to the left */
4743 find_breakleft = TRUE;
4750 /* Looking for open area */
4753 /* Hack -- look again */
4754 for (i = -max; i < 0; i++)
4756 new_dir = cycle[chome[prev_dir] + i];
4758 row = py + ddy[new_dir];
4759 col = px + ddx[new_dir];
4762 c_ptr = &cave[row][col];
4764 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4765 if (!(c_ptr->info & (CAVE_MARK)) ||
4766 ((c_ptr->feat < FEAT_SECRET) ||
4767 (c_ptr->feat == FEAT_FLOWER) ||
4768 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4769 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4770 (c_ptr->feat <= FEAT_GRASS))))
4773 /* Looking to break right */
4774 if (find_breakright)
4783 /* Looking to break left */
4791 /* Hack -- look again */
4792 for (i = max; i > 0; i--)
4794 new_dir = cycle[chome[prev_dir] + i];
4796 row = py + ddy[new_dir];
4797 col = px + ddx[new_dir];
4800 c_ptr = &cave[row][col];
4802 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4803 if (!(c_ptr->info & (CAVE_MARK)) ||
4804 ((c_ptr->feat < FEAT_SECRET) ||
4805 (c_ptr->feat == FEAT_FLOWER) ||
4806 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4807 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4808 (c_ptr->feat <= FEAT_GRASS))))
4811 /* Looking to break left */
4821 /* Looking to break right */
4822 if (find_breakright)
4831 /* Not looking for open area */
4843 /* Primary option */
4844 find_current = option;
4846 /* No other options */
4847 find_prevdir = option;
4850 /* Two options, examining corners */
4851 else if (find_examine && !find_cut)
4853 /* Primary option */
4854 find_current = option;
4856 /* Hack -- allow curving */
4857 find_prevdir = option2;
4860 /* Two options, pick one */
4863 /* Get next location */
4864 row = py + ddy[option];
4865 col = px + ddx[option];
4867 /* Don't see that it is closed off. */
4868 /* This could be a potential corner or an intersection. */
4869 if (!see_wall(option, row, col) ||
4870 !see_wall(check_dir, row, col))
4872 /* Can not see anything ahead and in the direction we */
4873 /* are turning, assume that it is a potential corner. */
4875 see_nothing(option, row, col) &&
4876 see_nothing(option2, row, col))
4878 find_current = option;
4879 find_prevdir = option2;
4882 /* STOP: we are next to an intersection or a room */
4889 /* This corner is seen to be enclosed; we cut the corner. */
4892 find_current = option2;
4893 find_prevdir = option2;
4896 /* This corner is seen to be enclosed, and we */
4897 /* deliberately go the long way. */
4900 find_current = option;
4901 find_prevdir = option2;
4907 /* About to hit a known wall, stop */
4908 if (see_wall(find_current, py, px))
4921 * Take one step along the current "run" path
4923 void run_step(int dir)
4928 /* Hack -- do not start silly run */
4929 if (see_wall(dir, py, px) &&
4930 (cave[py+ddy[dir]][px+ddx[dir]].feat != FEAT_TREES))
4934 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¹Ô¤±¤Þ¤»¤ó¡£");
4936 msg_print("You cannot run in that direction.");
4947 /* Calculate torch radius */
4948 p_ptr->update |= (PU_TORCH);
4968 /* Decrease the run counter */
4969 if (--running <= 0) return;
4974 /* Move the player, using the "pickup" flag */
4975 #ifdef ALLOW_EASY_DISARM /* TNB */
4977 move_player(find_current, FALSE, FALSE);
4979 #else /* ALLOW_EASY_DISARM -- TNB */
4981 move_player(find_current, always_pickup, FALSE);
4983 #endif /* ALLOW_EASY_DISARM -- TNB */
4985 if ((py == p_ptr->run_py) && (px == p_ptr->run_px))