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!");
774 bool can_player_destroy_object(object_type *o_ptr)
776 /* Artifacts cannot be destroyed */
777 if (artifact_p(o_ptr) || o_ptr->art_name)
779 byte feel = FEEL_SPECIAL;
781 /* Hack -- Handle icky artifacts */
782 if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
784 /* Hack -- inscribe the artifact */
785 o_ptr->feeling = feel;
787 /* We have "felt" it (again) */
788 o_ptr->ident |= (IDENT_SENSE);
790 /* Combine the pack */
791 p_ptr->notice |= (PN_COMBINE);
793 /* Redraw equippy chars */
794 p_ptr->redraw |= (PR_EQUIPPY);
797 p_ptr->window |= (PW_INVEN | PW_EQUIP);
807 * Easy auto-pick inscription
809 static bool is_autopick2( object_type *o_ptr) {
813 if (!o_ptr->inscription) return (FALSE);
816 s = strchr(quark_str(o_ptr->inscription), '=');
818 /* Process inscription */
821 /* Auto-pickup on "=g" */
822 if (s[1] == 'g') return (TRUE);
824 /* Find another '=' */
825 s = strchr(s + 1, '=');
828 /* Don't auto pickup */
833 * Automatically destroy items in this grid.
835 static bool is_opt_confirm_destroy(object_type *o_ptr)
837 if (!destroy_items) return FALSE;
839 /* Known to be worthless? */
841 if (object_value(o_ptr) > 0) return FALSE;
844 if ((o_ptr->tval >= TV_SHOT) && (o_ptr->tval <= TV_DRAG_ARMOR)) return FALSE;
847 if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
851 if (o_ptr->tval == TV_CORPSE
852 && object_is_shoukinkubi(o_ptr)) return FALSE;
856 if (o_ptr->tval == TV_CORPSE) return FALSE;
859 if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
861 if (o_ptr->tval == TV_GOLD) return FALSE;
867 * Automatically pickup/destroy items in this grid.
869 static void auto_pickup_items(cave_type *c_ptr)
871 s16b this_o_idx, next_o_idx = 0;
872 s16b inscribe_flags(object_type *o_ptr, cptr out_val);
874 char o_name[MAX_NLEN];
877 /* Scan the pile of objects */
878 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
881 object_type *o_ptr = &o_list[this_o_idx];
883 /* Acquire next object */
884 next_o_idx = o_ptr->next_o_idx;
885 idx = is_autopick(o_ptr);
887 if (idx >= 0 && autopick_list[idx].insc && !o_ptr->inscription)
888 o_ptr->inscription = inscribe_flags(o_ptr, autopick_list[idx].insc);
890 if (is_autopick2(o_ptr) ||
891 (idx >= 0 && (autopick_list[idx].action & DO_AUTOPICK)))
895 if (!inven_carry_okay(o_ptr)){
896 /* Describe the object */
897 object_desc(o_name, o_ptr, TRUE, 3);
900 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
902 msg_format("You have no room for %s.", o_name);
906 py_pickup_aux(this_o_idx);
911 else if ((idx == -1 && is_opt_confirm_destroy(o_ptr)) ||
912 (!always_pickup && (idx != -1 && (autopick_list[idx].action & DO_AUTODESTROY))))
915 /* Describe the object (with {terrible/special}) */
916 object_desc(o_name, o_ptr, TRUE, 3);
918 if (!can_player_destroy_object(o_ptr))
922 msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
924 msg_format("You cannot auto-destroy %s.", o_name);
930 autopick_free_entry(&autopick_entry_last_destroyed);
931 autopick_entry_from_object(&autopick_entry_last_destroyed, o_ptr);
933 /* Destroy the item */
934 delete_object_idx(this_o_idx);
936 /* Print a message */
938 msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
940 msg_format("Auto-destroying %s.", o_name);
950 * Player "wants" to pick up an object or gold.
951 * Note that we ONLY handle things that can be picked up.
952 * See "move_player()" for handling of other things.
954 void carry(int pickup)
956 cave_type *c_ptr = &cave[py][px];
958 s16b this_o_idx, next_o_idx = 0;
960 char o_name[MAX_NLEN];
962 /* Recenter the map around the player */
966 p_ptr->update |= (PU_MONSTERS);
969 p_ptr->redraw |= (PR_MAP);
972 p_ptr->window |= (PW_OVERHEAD);
977 /* Automatically pickup/destroy/inscribe items */
978 auto_pickup_items(c_ptr);
981 #ifdef ALLOW_EASY_FLOOR
985 py_pickup_floor(pickup);
989 #endif /* ALLOW_EASY_FLOOR */
991 /* Scan the pile of objects */
992 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
997 o_ptr = &o_list[this_o_idx];
999 #ifdef ALLOW_EASY_SENSE /* TNB */
1001 /* Option: Make item sensing easy */
1004 /* Sense the object */
1005 (void)sense_object(o_ptr);
1008 #endif /* ALLOW_EASY_SENSE -- TNB */
1010 /* Describe the object */
1011 object_desc(o_name, o_ptr, TRUE, 3);
1013 /* Acquire next object */
1014 next_o_idx = o_ptr->next_o_idx;
1016 /* Hack -- disturb */
1020 if (o_ptr->tval == TV_GOLD)
1022 int value = (long)o_ptr->pval;
1024 /* Delete the gold */
1025 delete_object_idx(this_o_idx);
1029 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
1030 (long)value, o_name);
1032 msg_format("You collect %ld gold pieces worth of %s.",
1033 (long)value, o_name);
1039 /* Collect the gold */
1043 p_ptr->redraw |= (PR_GOLD);
1046 p_ptr->window |= (PW_PLAYER);
1049 /* Pick up objects */
1052 /* Describe the object */
1057 msg_format("%s¤¬¤¢¤ë¡£", o_name);
1059 msg_format("You see %s.", o_name);
1064 /* Note that the pack is too full */
1065 else if (!inven_carry_okay(o_ptr))
1068 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
1070 msg_format("You have no room for %s.", o_name);
1075 /* Pick up the item (if requested and allowed) */
1080 /* Hack -- query every item */
1081 if (carry_query_flag)
1083 char out_val[MAX_NLEN+20];
1085 sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
1087 sprintf(out_val, "Pick up %s? ", o_name);
1090 okay = get_check(out_val);
1093 /* Attempt to pick up an object. */
1096 /* Pick up the object */
1097 py_pickup_aux(this_o_idx);
1106 * Determine if a trap affects the player.
1107 * Always miss 5% of the time, Always hit 5% of the time.
1108 * Otherwise, match trap power against player armor.
1110 static int check_hit(int power)
1114 /* Percentile dice */
1117 /* Hack -- 5% hit, 5% miss */
1118 if (k < 10) return (k < 5);
1120 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1121 if (one_in_(20)) return (TRUE);
1123 /* Paranoia -- No power */
1124 if (power <= 0) return (FALSE);
1127 ac = p_ptr->ac + p_ptr->to_a;
1129 /* Power competes against Armor */
1130 if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
1139 * Handle player hitting a real trap
1141 static void hit_trap(bool break_trap)
1149 cptr name = "¥È¥é¥Ã¥×";
1151 cptr name = "a trap";
1156 /* Disturb the player */
1159 /* Get the cave grid */
1160 c_ptr = &cave[y][x];
1162 /* Analyze XXX XXX XXX */
1163 switch (c_ptr->feat)
1165 case FEAT_TRAP_TRAPDOOR:
1170 msg_print("Í¸Í¤òÈô¤Ó±Û¤¨¤¿¡£");
1172 msg_print("You fly over a trap door.");
1179 msg_print("Í¸Í¤ËÍî¤Á¤¿¡ª");
1180 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1181 msg_print("¤¯¤Ã¤½¡Á¡ª");
1183 msg_print("You have fallen through a trap door!");
1187 dam = damroll(2, 8);
1191 name = "a trap door";
1194 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1196 /* Still alive and autosave enabled */
1197 if (autosave_l && (p_ptr->chp >= 0))
1198 do_cmd_save_game(TRUE);
1201 do_cmd_write_nikki(NIKKI_STAIR, 1, "Í¸Í¤ËÍî¤Á¤¿");
1203 do_cmd_write_nikki(NIKKI_STAIR, 1, "You have fallen through a trap door!");
1208 p_ptr->leaving = TRUE;
1218 msg_print("Í·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1220 msg_print("You fly over a pit trap.");
1227 msg_print("Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1229 msg_print("You have fallen into a pit!");
1232 dam = damroll(2, 6);
1236 name = "a pit trap";
1239 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1244 case FEAT_TRAP_SPIKED_PIT:
1249 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1251 msg_print("You fly over a spiked pit.");
1258 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1260 msg_print("You fall into a spiked pit!");
1268 name = "a pit trap";
1271 dam = damroll(2, 6);
1273 /* Extra spike damage */
1274 if (randint0(100) < 50)
1277 msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1279 msg_print("You are impaled!");
1284 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1286 name = "a spiked pit";
1290 (void)set_cut(p_ptr->cut + randint1(dam));
1293 /* Take the damage */
1294 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1299 case FEAT_TRAP_POISON_PIT:
1304 msg_print("¥È¥²¤Î¤¢¤ëÍ·ê¤òÈô¤Ó±Û¤¨¤¿¡£");
1306 msg_print("You fly over a spiked pit.");
1313 msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Í·ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
1315 msg_print("You fall into a spiked pit!");
1320 dam = damroll(2, 6);
1325 name = "a pit trap";
1329 /* Extra spike damage */
1330 if (randint0(100) < 50)
1333 msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
1335 msg_print("You are impaled on poisonous spikes!");
1340 name = "¥È¥²¤Î¤¢¤ëÍ·ê";
1342 name = "a spiked pit";
1347 (void)set_cut(p_ptr->cut + randint1(dam));
1349 if (p_ptr->resist_pois || p_ptr->oppose_pois)
1352 msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
1354 msg_print("The poison does not affect you!");
1362 (void)set_poisoned(p_ptr->poisoned + randint1(dam));
1366 /* Take the damage */
1367 take_hit(DAMAGE_NOESCAPE, dam, name, -1);
1373 case FEAT_TRAP_TY_CURSE:
1376 msg_print("²¿¤«¤¬¥Ô¥«¥Ã¤È¸÷¤Ã¤¿¡ª");
1378 msg_print("There is a flash of shimmering light!");
1381 c_ptr->info &= ~(CAVE_MARK);
1382 cave_set_feat(y, x, floor_type[randint0(100)]);
1383 num = 2 + randint1(3);
1384 for (i = 0; i < num; i++)
1386 (void)summon_specific(0, y, x, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
1389 if (dun_level > randint1(100)) /* No nasty effect for low levels */
1391 bool stop_ty = FALSE;
1396 stop_ty = activate_ty_curse(stop_ty, &count);
1403 case FEAT_TRAP_TELEPORT:
1406 msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
1408 msg_print("You hit a teleport trap!");
1411 teleport_player(100);
1415 case FEAT_TRAP_FIRE:
1418 msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1420 msg_print("You are enveloped in flames!");
1423 dam = damroll(4, 6);
1425 fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
1427 fire_dam(dam, "a fire trap", -1);
1433 case FEAT_TRAP_ACID:
1436 msg_print("»À¤¬¿á¤¤«¤±¤é¤ì¤¿¡ª");
1438 msg_print("You are splashed with acid!");
1441 dam = damroll(4, 6);
1443 acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
1445 acid_dam(dam, "an acid trap", -1);
1451 case FEAT_TRAP_SLOW:
1456 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1458 msg_print("A small dart hits you!");
1461 dam = damroll(1, 4);
1462 take_hit(DAMAGE_ATTACK, dam, name, -1);
1463 (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
1468 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1470 msg_print("A small dart barely misses you.");
1477 case FEAT_TRAP_LOSE_STR:
1482 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1484 msg_print("A small dart hits you!");
1487 dam = damroll(1, 4);
1489 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1491 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1494 (void)do_dec_stat(A_STR);
1499 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1501 msg_print("A small dart barely misses you.");
1508 case FEAT_TRAP_LOSE_DEX:
1513 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1515 msg_print("A small dart hits you!");
1518 dam = damroll(1, 4);
1520 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1522 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1525 (void)do_dec_stat(A_DEX);
1530 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1532 msg_print("A small dart barely misses you.");
1539 case FEAT_TRAP_LOSE_CON:
1544 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤Æ»É¤µ¤Ã¤¿¡ª");
1546 msg_print("A small dart hits you!");
1549 dam = damroll(1, 4);
1551 take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
1553 take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
1556 (void)do_dec_stat(A_CON);
1561 msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
1563 msg_print("A small dart barely misses you.");
1570 case FEAT_TRAP_BLIND:
1573 msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1575 msg_print("A black gas surrounds you!");
1578 if (!p_ptr->resist_blind)
1580 (void)set_blind(p_ptr->blind + randint0(50) + 25);
1585 case FEAT_TRAP_CONFUSE:
1588 msg_print("¤¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1590 msg_print("A gas of scintillating colors surrounds you!");
1593 if (!p_ptr->resist_conf)
1595 (void)set_confused(p_ptr->confused + randint0(20) + 10);
1600 case FEAT_TRAP_POISON:
1603 msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
1605 msg_print("A pungent green gas surrounds you!");
1608 if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
1610 (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
1615 case FEAT_TRAP_SLEEP:
1618 msg_print("´ñ̯¤ÊÇò¤¤Ì¸¤ËÊñ¤Þ¤ì¤¿¡ª");
1620 msg_print("A strange white mist surrounds you!");
1623 if (!p_ptr->free_act)
1626 msg_print("¤¢¤Ê¤¿¤Ï̲¤ê¤Ë½¢¤¤¤¿¡£");
1628 msg_print("You fall asleep.");
1632 if (ironman_nightmare)
1635 msg_print("¿È¤ÎÌÓ¤â¤è¤À¤Ä¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤À¡£");
1637 msg_print("A horrible vision enters your mind.");
1641 /* Pick a nightmare */
1642 get_mon_num_prep(get_nightmare, NULL);
1644 /* Have some nightmares */
1645 have_nightmare(get_mon_num(MAX_DEPTH));
1647 /* Remove the monster restriction */
1648 get_mon_num_prep(NULL, NULL);
1650 (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
1655 case FEAT_TRAP_TRAPS:
1658 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
1660 msg_print("There is a bright flash of light!");
1664 /* Destroy this trap */
1665 cave_set_feat(y, x, floor_type[randint0(100)]);
1667 /* Make some new traps */
1668 project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
1673 case FEAT_TRAP_ALARM:
1676 msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
1678 msg_print("An alarm sounds!");
1681 aggravate_monsters(0);
1686 if (break_trap && is_trap(c_ptr->feat))
1688 cave_set_feat(y, x, floor_type[randint0(100)]);
1690 msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
1692 msg_print("You destroyed the trap.");
1698 void touch_zap_player(monster_type *m_ptr)
1700 int aura_damage = 0;
1701 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1703 if (r_ptr->flags2 & RF2_AURA_FIRE)
1705 if (!p_ptr->immune_fire)
1709 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1711 /* Hack -- Get the "died from" name */
1712 monster_desc(aura_dam, m_ptr, 0x288);
1715 msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
1717 msg_print("You are suddenly very hot!");
1721 if (p_ptr->oppose_fire) aura_damage = (aura_damage + 2) / 3;
1722 if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
1724 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1725 r_ptr->r_flags2 |= RF2_AURA_FIRE;
1730 if (r_ptr->flags3 & RF3_AURA_COLD)
1732 if (!p_ptr->immune_cold)
1736 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1738 /* Hack -- Get the "died from" name */
1739 monster_desc(aura_dam, m_ptr, 0x288);
1742 msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
1744 msg_print("You are suddenly very cold!");
1748 if (p_ptr->oppose_cold) aura_damage = (aura_damage + 2) / 3;
1749 if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
1751 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1752 r_ptr->r_flags3 |= RF3_AURA_COLD;
1757 if (r_ptr->flags2 & RF2_AURA_ELEC)
1759 if (!p_ptr->immune_elec)
1763 aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1765 /* Hack -- Get the "died from" name */
1766 monster_desc(aura_dam, m_ptr, 0x288);
1768 if (p_ptr->oppose_elec) aura_damage = (aura_damage + 2) / 3;
1769 if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
1772 msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
1774 msg_print("You get zapped!");
1777 take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
1778 r_ptr->r_flags2 |= RF2_AURA_ELEC;
1785 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
1787 int k, bonus, chance;
1789 monster_type *m_ptr = &m_list[m_idx];
1790 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1799 case MUT2_SCOR_TAIL:
1826 atk_desc = "¥¯¥Á¥Ð¥·";
1837 atk_desc = "¾Ý¤ÎÉ¡";
1843 case MUT2_TENTACLES:
1850 atk_desc = "tentacles";
1855 dss = ddd = n_weight = 1;
1857 atk_desc = "̤ÄêµÁ¤ÎÉô°Ì";
1859 atk_desc = "undefined body part";
1864 /* Extract monster name (or "it") */
1865 monster_desc(m_name, m_ptr, 0);
1868 /* Calculate the "attack quality" */
1869 bonus = p_ptr->to_h_m;
1870 bonus += (p_ptr->lev * 6 / 5);
1871 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1874 if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
1880 msg_format("%s¤ò%s¤Ç¹¶·â¤·¤¿¡£", m_name, atk_desc);
1882 msg_format("You hit %s with your %s.", m_name, atk_desc);
1886 k = damroll(ddd, dss);
1887 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
1889 /* Apply the player damage bonuses */
1892 /* No negative damage */
1895 /* Modify the damage */
1896 k = mon_damage_mod(m_ptr, k, FALSE);
1898 /* Complex message */
1902 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
1904 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
1909 /* Anger the monster */
1910 if (k > 0) anger_monster(m_ptr);
1912 /* Damage, check for fear and mdeath */
1915 case MUT2_SCOR_TAIL:
1916 project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL | PROJECT_NO_REF, -1);
1917 *mdeath = (m_ptr->r_idx == 0);
1920 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1923 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1926 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1928 case MUT2_TENTACLES:
1929 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1932 *mdeath = mon_take_hit(m_idx, k, fear, NULL);
1935 touch_zap_player(m_ptr);
1945 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
1947 msg_format("You miss %s.", m_name);
1956 * Player attacks a (poor, defenseless) creature -RAK-
1958 * If no "weapon" is available, then "punch" the monster one time.
1960 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
1962 int num = 0, k, bonus, chance, vir;
1964 cave_type *c_ptr = &cave[y][x];
1966 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1967 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1973 bool success_hit = FALSE;
1974 bool old_success_hit = FALSE;
1975 bool backstab = FALSE;
1976 bool vorpal_cut = FALSE;
1977 int chaos_effect = 0;
1978 bool stab_fleeing = FALSE;
1979 bool fuiuchi = FALSE;
1980 bool do_quake = FALSE;
1982 bool drain_msg = TRUE;
1983 int drain_result = 0, drain_heal = 0;
1984 bool can_drain = FALSE;
1986 int drain_left = MAX_VAMPIRIC_DRAIN;
1987 u32b f1, f2, f3; /* A massive hack -- life-draining weapons */
1988 bool is_human = (r_ptr->d_char == 'p');
1989 bool is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
1990 bool zantetsu_mukou, e_j_mukou;
1994 if (((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) && inventory[INVEN_RARM+hand].tval)
1996 int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
1997 if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1998 if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1999 if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
2000 if (m_ptr->csleep && m_ptr->ml)
2002 /* Can't backstab creatures that we can't see, right? */
2005 else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
2009 else if (m_ptr->monfear && m_ptr->ml)
2011 stab_fleeing = TRUE;
2015 if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
2017 if ((r_ptr->level + 10) > p_ptr->lev)
2019 if (skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
2021 if (skill_exp[GINOU_SUDE] < 4000)
2022 skill_exp[GINOU_SUDE]+=40;
2023 else if((skill_exp[GINOU_SUDE] < 6000))
2024 skill_exp[GINOU_SUDE]+=5;
2025 else if((skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
2026 skill_exp[GINOU_SUDE]+=1;
2027 else if((skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
2028 if (one_in_(3)) skill_exp[GINOU_SUDE]+=1;
2029 p_ptr->update |= (PU_BONUS);
2035 if ((r_ptr->level + 10) > p_ptr->lev)
2037 int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
2038 int sval = inventory[INVEN_RARM+hand].sval;
2039 int now_exp = weapon_exp[tval][sval];
2040 if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
2043 if (now_exp < 4000) amount = 80;
2044 else if(now_exp < 6000) amount = 10;
2045 else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1;
2046 else if((p_ptr->lev > 34) && one_in_(2)) amount = 1;
2047 weapon_exp[tval][sval] += amount;
2048 p_ptr->update |= (PU_BONUS);
2053 /* Disturb the monster */
2055 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
2056 p_ptr->update |= (PU_MON_LITE);
2058 /* Extract monster name (or "it") */
2059 monster_desc(m_name, m_ptr, 0);
2061 /* Access the weapon */
2062 o_ptr = &inventory[INVEN_RARM+hand];
2064 /* Calculate the "attack quality" */
2065 bonus = p_ptr->to_h[hand] + o_ptr->to_h;
2066 chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
2067 if (mode == HISSATSU_IAI) chance += 60;
2068 if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
2070 if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
2072 vir = virtue_number(V_VALOUR);
2075 chance += (p_ptr->virtues[vir - 1]/10);
2078 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
2079 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
2081 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
2082 else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand]+2;
2083 else num_blow = p_ptr->num_blow[hand];
2085 /* Attack once for each legal blow */
2086 while ((num++ < num_blow) && !death)
2088 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2090 if (p_ptr->migite && p_ptr->hidarite)
2092 success_hit = one_in_(2);
2094 else success_hit = TRUE;
2096 else if (mode == HISSATSU_MAJIN)
2101 success_hit = FALSE;
2102 old_success_hit = success_hit;
2104 else success_hit = old_success_hit;
2106 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flags3 & RF3_RES_ALL))) success_hit = TRUE;
2107 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
2112 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
2120 msg_format("¤¢¤Ê¤¿¤ÏÎä¹ó¤Ë¤â̲¤Ã¤Æ¤¤¤ë̵ÎϤÊ%s¤òÆͤ»É¤·¤¿¡ª",
2122 msg_format("You cruelly stab the helpless, sleeping %s!",
2128 msg_format("ÉÔ°Õ¤òÆͤ¤¤Æ%s¤Ë¶¯Îõ¤Ê°ì·â¤ò¶ô¤é¤ï¤»¤¿¡ª",
2130 msg_format("You make surprise attack, and hit %s with a powerful blow!",
2134 else if (stab_fleeing)
2136 msg_format("ƨ¤²¤ë%s¤òÇØÃ椫¤éÆͤ»É¤·¤¿¡ª",
2138 msg_format("You backstab the fleeing %s!",
2144 if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1)))
2146 msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
2148 msg_format("You hit %s.", m_name);
2153 /* Hack -- bare hands do one damage */
2156 object_flags(o_ptr, &f1, &f2, &f3);
2158 /* Select a chaotic effect (50% chance) */
2159 if ((f1 & TR1_CHAOTIC) && one_in_(2))
2162 chg_virtue(V_CHANCE, 1);
2164 if (randint1(5) < 3)
2166 /* Vampiric (20%) */
2169 else if (one_in_(250))
2174 else if (!one_in_(10))
2176 /* Confusion (26.892%) */
2179 else if (one_in_(2))
2181 /* Teleport away (1.494%) */
2186 /* Polymorph (1.494%) */
2191 /* Vampiric drain */
2192 if ((f1 & TR1_VAMPIRIC) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN))
2194 /* Only drain "living" monsters */
2195 if (monster_living(r_ptr))
2201 if ((f1 & TR1_VORPAL) && (randint1(vorpal_chance*3/2) == 1) && !zantetsu_mukou)
2203 else vorpal_cut = FALSE;
2205 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
2207 int special_effect = 0, stun_effect = 0, times = 0, max_times;
2209 martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
2210 int resist_stun = 0;
2213 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
2214 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
2215 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
2216 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
2217 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
2220 if (p_ptr->special_defense & KAMAE_BYAKKO)
2221 max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
2222 else if (p_ptr->special_defense & KAMAE_SUZAKU)
2224 else if (p_ptr->special_defense & KAMAE_GENBU)
2227 max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
2228 /* Attempt 'times' */
2229 for (times = 0; times < max_times; times++)
2233 ma_ptr = &ma_blows[randint0(MAX_MA)];
2234 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
2235 else min_level = ma_ptr->min_level;
2237 while ((min_level > p_ptr->lev) ||
2238 (randint1(p_ptr->lev) < ma_ptr->chance));
2240 /* keep the highest level attack available we found */
2241 if ((ma_ptr->min_level > old_ptr->min_level) &&
2242 !p_ptr->stun && !p_ptr->confused)
2246 if (wizard && cheat_xtra)
2249 msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£");
2251 msg_print("Attack re-selected.");
2262 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
2263 else min_level = ma_ptr->min_level;
2264 k = damroll(ma_ptr->dd, ma_ptr->ds);
2265 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
2267 if (ma_ptr->effect == MA_KNEE)
2269 if (r_ptr->flags1 & RF1_MALE)
2272 msg_format("%s¤Ë¶âŪɨ½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2274 msg_format("You hit %s in the groin with your knee!", m_name);
2278 special_effect = MA_KNEE;
2281 msg_format(ma_ptr->desc, m_name);
2284 else if (ma_ptr->effect == MA_SLOW)
2286 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
2287 strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
2290 msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
2292 msg_format("You kick %s in the ankle.", m_name);
2295 special_effect = MA_SLOW;
2297 else msg_format(ma_ptr->desc, m_name);
2303 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
2306 msg_format(ma_ptr->desc, m_name);
2309 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
2310 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
2312 weight += (p_ptr->magic_num1[0]/30);
2313 if (weight > 20) weight = 20;
2316 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
2318 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2321 msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤Æ¤¤¤ë¡ª", m_name);
2323 msg_format("%^s moans in agony!", m_name);
2326 stun_effect = 7 + randint1(13);
2330 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2332 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2333 (randint1(p_ptr->lev) > r_ptr->level) &&
2337 msg_format("%^s¤Ï¤ò¤Ò¤¤º¤ê»Ï¤á¤¿¡£", m_name);
2339 msg_format("%^s starts limping slower.", m_name);
2342 m_ptr->mspeed -= 10;
2346 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
2348 if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
2352 msg_format("%^s¤Ï¤µ¤é¤Ë¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2354 msg_format("%^s is more stunned.", m_name);
2359 msg_format("%^s¤Ï¥Õ¥é¥Õ¥é¤Ë¤Ê¤Ã¤¿¡£", m_name);
2361 msg_format("%^s is stunned.", m_name);
2365 m_ptr->stunned += stun_effect;
2370 /* Handle normal weapon */
2371 else if (o_ptr->k_idx)
2373 k = damroll(o_ptr->dd, o_ptr->ds);
2376 if((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
2378 k += damroll(2, o_ptr->ds);
2382 k = tot_dam_aux(o_ptr, k, m_ptr, mode);
2386 k *= (3 + (p_ptr->lev / 20));
2390 k = k*(5+(p_ptr->lev*2/25))/2;
2392 else if (stab_fleeing)
2397 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
2398 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
2403 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
2404 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
2412 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
2414 char chainsword_noise[1024];
2416 if (!get_rnd_line("chainswd_j.txt", 0, chainsword_noise))
2418 if (!get_rnd_line("chainswd.txt", 0, chainsword_noise))
2422 msg_print(chainsword_noise);
2426 if (o_ptr->name1 == ART_VORPAL_BLADE)
2429 msg_print("Ìܤˤâ»ß¤Þ¤é¤Ì¥Ü¡¼¥Ñ¥ë¡¦¥Ö¥ì¡¼¥É¡¢¼êÏ£¤ÎÁá¶È¡ª");
2431 msg_print("Your Vorpal Blade goes snicker-snack!");
2438 msg_format("%s¤ò¥°¥Ã¥µ¥êÀÚ¤êÎö¤¤¤¿¡ª", m_name);
2440 msg_format("Your weapon cuts deep into %s!", m_name);
2445 /* Try to increase the damage */
2446 while (one_in_(vorpal_chance))
2454 if (((r_ptr->flags3 & RF3_RES_ALL) ? k/100 : k) > m_ptr->hp)
2457 msg_format("%s¤ò¿¿¤ÃÆó¤Ä¤Ë¤·¤¿¡ª", m_name);
2459 msg_format("You cut %s in half!", m_name);
2468 case 2: msg_format("%s¤ò»Â¤Ã¤¿¡ª", m_name); break;
2470 case 2: msg_format("You gouge %s!", m_name); break;
2474 case 3: msg_format("%s¤ò¤Ö¤Ã¤¿»Â¤Ã¤¿¡ª", m_name); break;
2476 case 3: msg_format("You maim %s!", m_name); break;
2480 case 4: msg_format("%s¤ò¥á¥Ã¥¿»Â¤ê¤Ë¤·¤¿¡ª", m_name); break;
2482 case 4: msg_format("You carve %s!", m_name); break;
2486 case 5: msg_format("%s¤ò¥á¥Ã¥¿¥á¥¿¤Ë»Â¤Ã¤¿¡ª", m_name); break;
2488 case 5: msg_format("You cleave %s!", m_name); break;
2492 case 6: msg_format("%s¤ò»É¿È¤Ë¤·¤¿¡ª", m_name); break;
2494 case 6: msg_format("You smite %s!", m_name); break;
2498 case 7: msg_format("%s¤ò»Â¤Ã¤Æ»Â¤Ã¤Æ»Â¤ê¤Þ¤¯¤Ã¤¿¡ª", m_name); break;
2500 case 7: msg_format("You eviscerate %s!", m_name); break;
2504 default: msg_format("%s¤òºÙÀÚ¤ì¤Ë¤·¤¿¡ª", m_name); break;
2506 default: msg_format("You shred %s!", m_name); break;
2511 drain_result = drain_result * 3 / 2;
2515 drain_result += o_ptr->to_d;
2518 /* Apply the player damage bonuses */
2519 k += p_ptr->to_d[hand];
2520 drain_result += p_ptr->to_d[hand];
2522 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
2523 if ((mode == HISSATSU_SEKIRYUKA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON | RF3_NONLIVING))) k = 0;
2524 if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
2526 /* No negative damage */
2529 if ((mode == HISSATSU_ZANMA) && !((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) && (r_ptr->flags3 & RF3_EVIL)))
2537 msg_print("¤³¤ó¤ÊÆð¤é¤«¤¤¤â¤Î¤ÏÀÚ¤ì¤ó¡ª");
2539 msg_print("You cannot cut such a elastic thing!");
2547 msg_print("ÃØéá¤Ï¶ì¼ê¤À¡ª");
2549 msg_print("Spiders are difficult for you to deal with!");
2554 if (mode == HISSATSU_MINEUCHI)
2556 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
2559 anger_monster(m_ptr);
2561 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
2567 msg_format("%s¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2569 msg_format("%s is more dazed.", m_name);
2577 msg_format("%s ¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£", m_name);
2579 msg_format("%s is dazed.", m_name);
2584 m_ptr->stunned = (tmp < 200) ? tmp : 200;
2589 msg_format("%s ¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2591 msg_format("%s is not effected.", m_name);
2596 /* Modify the damage */
2597 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))));
2598 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
2600 if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
2604 msg_format("%s¤ÎµÞ½ê¤òÆͤ»É¤·¤¿¡ª", m_name);
2606 msg_format("You hit %s on a fatal spot!", m_name);
2611 else if ((p_ptr->pclass == CLASS_NINJA) && (!p_ptr->icky_wield[hand]) && ((p_ptr->cur_lite <= 0) || one_in_(7)))
2613 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
2614 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
2619 msg_format("¿Ï¤¬%s¤Ë¿¼¡¹¤ÈÆͤ»É¤µ¤Ã¤¿¡ª", m_name);
2621 msg_format("You critically injured %s!", m_name);
2624 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)))
2626 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
2628 k = MAX(k*5, m_ptr->hp/2);
2631 msg_format("%s¤ËÃ×Ì¿½ý¤òÉé¤ï¤»¤¿¡ª", m_name);
2633 msg_format("You fatally injured %s!", m_name);
2640 msg_format("¿Ï¤¬%s¤ÎµÞ½ê¤ò´Ó¤¤¤¿¡ª", m_name);
2642 msg_format("You hit %s on a fatal spot!", m_name);
2648 /* Complex message */
2649 if (wizard || cheat_xtra)
2652 msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp);
2654 msg_format("You do %d (out of %d) damage.", k, m_ptr->hp);
2659 if (k <= 0) can_drain = FALSE;
2661 if (drain_result > m_ptr->hp)
2662 drain_result = m_ptr->hp;
2664 /* Damage, check for fear and death */
2665 if (mon_take_hit(c_ptr->m_idx, k, fear, NULL))
2668 if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use)
2670 if (p_ptr->migite && p_ptr->hidarite)
2672 if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5);
2673 else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5);
2677 energy_use = energy_use*num/p_ptr->num_blow[hand];
2680 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
2682 msg_print("¤Þ¤¿¤Ä¤Þ¤é¤Ì¤â¤Î¤ò»Â¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2684 msg_print("Sign..Another trifling thing I've cut....");
2689 /* Anger the monster */
2690 if (k > 0) anger_monster(m_ptr);
2692 touch_zap_player(m_ptr);
2694 /* Are we draining it? A little note: If the monster is
2695 dead, the drain does not work... */
2697 if (can_drain && (drain_result > 0))
2699 if (o_ptr->name1 == ART_MURAMASA)
2703 int to_h = o_ptr->to_h;
2704 int to_d = o_ptr->to_d;
2708 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
2712 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
2715 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
2718 msg_print("ÍÅÅá¤Ï·ì¤òµÛ¤Ã¤Æ¶¯¤¯¤Ê¤Ã¤¿¡ª");
2720 msg_print("Muramasa sucked blood, and became more powerful!");
2729 if (drain_result > 5) /* Did we really hurt it? */
2731 drain_heal = damroll(2, drain_result / 6);
2736 msg_format("Draining left: %d", drain_left);
2738 msg_format("Draining left: %d", drain_left);
2745 if (drain_heal < drain_left)
2747 drain_left -= drain_heal;
2751 drain_heal = drain_left;
2758 msg_format("¿Ï¤¬%s¤«¤éÀ¸Ì¿ÎϤòµÛ¤¤¼è¤Ã¤¿¡ª", m_name);
2760 msg_format("Your weapon drains life from %s!", m_name);
2766 drain_heal = (drain_heal * mutant_regenerate_mod) / 100;
2768 hp_player(drain_heal);
2769 /* We get to keep some of it! */
2773 m_ptr->maxhp -= (k+7)/8;
2774 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2780 /* Confusion attack */
2781 if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF))
2783 /* Cancel glowing hands */
2784 if (p_ptr->special_attack & ATTACK_CONFUSE)
2786 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
2788 msg_print("¼ê¤Îµ±¤¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2790 msg_print("Your hands stop glowing.");
2792 p_ptr->redraw |= (PR_STATUS);
2796 /* Confuse the monster */
2797 if (r_ptr->flags3 & RF3_NO_CONF)
2801 r_ptr->r_flags3 |= RF3_NO_CONF;
2805 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2807 msg_format("%^s is unaffected.", m_name);
2811 else if (randint0(100) < r_ptr->level)
2814 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2816 msg_format("%^s is unaffected.", m_name);
2823 msg_format("%^s¤Ïº®Í𤷤¿¤è¤¦¤À¡£", m_name);
2825 msg_format("%^s appears confused.", m_name);
2828 m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
2832 else if (chaos_effect == 4)
2834 bool resists_tele = FALSE;
2836 if (r_ptr->flags3 & RF3_RES_TELE)
2838 if (r_ptr->flags1 & RF1_UNIQUE)
2840 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2842 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2844 msg_format("%^s is unaffected!", m_name);
2847 resists_tele = TRUE;
2849 else if (r_ptr->level > randint1(100))
2851 if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
2853 msg_format("%^s¤ÏÄñ¹³ÎϤò»ý¤Ã¤Æ¤¤¤ë¡ª", m_name);
2855 msg_format("%^s resists!", m_name);
2858 resists_tele = TRUE;
2865 msg_format("%^s¤Ï¾Ã¤¨¤¿¡ª", m_name);
2867 msg_format("%^s disappears!", m_name);
2870 teleport_away(c_ptr->m_idx, 50, FALSE);
2871 num = p_ptr->num_blow[hand] + 1; /* Can't hit it anymore! */
2876 else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
2877 (randint1(90) > r_ptr->level))
2879 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
2880 !(r_ptr->flags4 & RF4_BR_CHAO) &&
2881 !(r_ptr->flags1 & RF1_QUESTOR))
2883 if (polymorph_monster(y, x))
2886 msg_format("%^s¤ÏÊѲ½¤·¤¿¡ª", m_name);
2888 msg_format("%^s changes!", m_name);
2892 /* Hack -- Get new monster */
2893 m_ptr = &m_list[c_ptr->m_idx];
2895 /* Oops, we need a different name... */
2896 monster_desc(m_name, m_ptr, 0);
2898 /* Hack -- Get new race */
2899 r_ptr = &r_info[m_ptr->r_idx];
2907 msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
2909 msg_format("%^s is unaffected.", m_name);
2915 else if (o_ptr->name1 == ART_G_HAMMER)
2917 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2919 if (m_ptr->hold_o_idx)
2921 object_type *q_ptr = &o_list[m_ptr->hold_o_idx];
2922 char o_name[MAX_NLEN];
2924 object_desc(o_name, q_ptr, TRUE, 0);
2925 q_ptr->held_m_idx = 0;
2926 q_ptr->marked = FALSE;
2927 m_ptr->hold_o_idx = q_ptr->next_o_idx;
2928 q_ptr->next_o_idx = 0;
2930 msg_format("%s¤òÃ¥¤Ã¤¿¡£", o_name);
2932 msg_format("You snatched %s.", o_name);
2942 backstab = FALSE; /* Clumsy! */
2943 fuiuchi = FALSE; /* Clumsy! */
2945 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
2954 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
2956 msg_format("You miss %s.", m_name);
2960 msg_print("¿¶¤ê²ó¤·¤¿Âç³ù¤¬¼«Ê¬¼«¿È¤ËÊ֤äƤ¤¿¡ª");
2962 msg_print("Your scythe returns to you!");
2965 /* Extract the flags */
2966 object_flags(o_ptr, &f1, &f2, &f3);
2968 k = damroll(o_ptr->dd, o_ptr->ds);
2971 switch (p_ptr->mimic_form)
2974 switch (p_ptr->prace)
2980 case RACE_HALF_TROLL:
2981 case RACE_HALF_OGRE:
2982 case RACE_HALF_GIANT:
2983 case RACE_HALF_TITAN:
2993 case RACE_DRACONIAN:
3000 case MIMIC_DEMON_LORD:
3007 if (p_ptr->align < 0 && mult < 2)
3009 if (!(p_ptr->resist_acid || p_ptr->oppose_acid) && (mult < 3))
3010 mult = mult * 5 / 2;
3011 if (!(p_ptr->resist_elec || p_ptr->oppose_elec) && (mult < 3))
3012 mult = mult * 5 / 2;
3013 if (!(p_ptr->resist_fire || p_ptr->oppose_fire) && (mult < 3))
3014 mult = mult * 5 / 2;
3015 if (!(p_ptr->resist_cold || p_ptr->oppose_cold) && (mult < 3))
3016 mult = mult * 5 / 2;
3017 if (!(p_ptr->resist_pois || p_ptr->oppose_pois) && (mult < 3))
3018 mult = mult * 5 / 2;
3020 if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEAPON) && (p_ptr->csp > (p_ptr->msp / 30)))
3022 p_ptr->csp -= (1+(p_ptr->msp / 30));
3023 p_ptr->redraw |= (PR_MANA);
3024 mult = mult * 7 / 2;
3029 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
3034 msg_format("¥°¥Ã¥µ¥êÀÚ¤êÎö¤«¤ì¤¿¡ª");
3036 msg_format("Your weapon cuts deep into yourself!");
3038 /* Try to increase the damage */
3046 k += (p_ptr->to_d[hand] + o_ptr->to_d);
3049 take_hit(DAMAGE_FORCE, k, "»à¤ÎÂç³ù", -1);
3051 take_hit(DAMAGE_FORCE, k, "Death scythe", -1);
3063 msg_format("¥ß¥¹¡ª %s¤Ë¤«¤ï¤µ¤ì¤¿¡£", m_name);
3065 msg_format("You miss %s.", m_name);
3074 if (weak && !(*mdeath))
3077 msg_format("%s¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£", m_name);
3079 msg_format("%^s seems weakened.", m_name);
3082 if (drain_left != MAX_VAMPIRIC_DRAIN)
3086 chg_virtue(V_UNLIFE, 1);
3089 /* Mega-Hack -- apply earthquake brand */
3092 earthquake(py, px, 10);
3093 if (!cave[y][x].m_idx) *mdeath = TRUE;
3097 bool py_attack(int y, int x, int mode)
3100 bool mdeath = FALSE;
3101 bool stormbringer = FALSE;
3103 cave_type *c_ptr = &cave[y][x];
3104 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3107 /* Disturb the player */
3112 if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
3114 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3115 if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3118 /* Extract monster name (or "it") */
3119 monster_desc(m_name, m_ptr, 0);
3121 /* Auto-Recall if possible and visible */
3122 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
3124 /* Track a new monster */
3125 if (m_ptr->ml) health_track(c_ptr->m_idx);
3127 if ((r_info[m_ptr->r_idx].flags1 & RF1_FEMALE) &&
3128 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
3130 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
3133 msg_print("ÀÛ¼Ô¡¢¤ª¤Ê¤´¤Ï»Â¤ì¤Ì¡ª");
3135 msg_print("I can not attack women!");
3141 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
3144 msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£");
3146 msg_print("Something prevent you from attacking.");
3151 /* Stop if friendly */
3152 if (!is_hostile(m_ptr) &&
3153 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
3154 p_ptr->shero || !m_ptr->ml))
3156 if (inventory[INVEN_RARM].art_name)
3158 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3160 if (inventory[INVEN_LARM].art_name)
3162 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
3167 msg_format("¹õ¤¤¿Ï¤Ï¶¯ÍߤË%s¤ò¹¶·â¤·¤¿¡ª", m_name);
3169 msg_format("Your black blade greedily attacks %s!", m_name);
3171 chg_virtue(V_INDIVIDUALISM, 1);
3172 chg_virtue(V_HONOUR, -1);
3173 chg_virtue(V_JUSTICE, -1);
3174 chg_virtue(V_COMPASSION, -1);
3176 else if (p_ptr->pclass != CLASS_BERSERKER)
3179 if (get_check("ËÜÅö¤Ë¹¶·â¤·¤Þ¤¹¤«¡©"))
3181 if (get_check("Really hit it? "))
3184 chg_virtue(V_INDIVIDUALISM, 1);
3185 chg_virtue(V_HONOUR, -1);
3186 chg_virtue(V_JUSTICE, -1);
3187 chg_virtue(V_COMPASSION, -1);
3192 msg_format("%s¤ò¹¶·â¤¹¤ë¤Î¤ò»ß¤á¤¿¡£", m_name);
3194 msg_format("You stop to avoid hitting %s.", m_name);
3202 /* Handle player fear */
3208 msg_format("¶²¤¯¤Æ%s¤ò¹¶·â¤Ç¤¤Ê¤¤¡ª", m_name);
3210 msg_format("You are too afraid to attack %s!", m_name);
3215 msg_format ("¤½¤Ã¤Á¤Ë¤Ï²¿¤«¶²¤¤¤â¤Î¤¬¤¤¤ë¡ª");
3217 msg_format ("There is something scary in your way!");
3220 /* Disturb the monster */
3222 p_ptr->update |= (PU_MON_LITE);
3228 if (p_ptr->migite && p_ptr->hidarite)
3230 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))
3232 if (skill_exp[GINOU_NITOURYU] < 4000)
3233 skill_exp[GINOU_NITOURYU]+=80;
3234 else if(skill_exp[GINOU_NITOURYU] < 6000)
3235 skill_exp[GINOU_NITOURYU]+=4;
3236 else if(skill_exp[GINOU_NITOURYU] < 7000)
3237 skill_exp[GINOU_NITOURYU]+=1;
3238 else if(skill_exp[GINOU_NITOURYU] < 8000)
3239 if (one_in_(3)) skill_exp[GINOU_NITOURYU]+=1;
3240 p_ptr->update |= (PU_BONUS);
3246 int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
3247 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))
3248 skill_exp[GINOU_RIDING]++;
3249 if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (skill_exp[GINOU_RIDING]/100 < ridinglevel))
3251 if (ridinglevel*100 > (skill_exp[GINOU_RIDING] + 1500))
3252 skill_exp[GINOU_RIDING] += (1+(ridinglevel - skill_exp[GINOU_RIDING]/100 - 15));
3253 else skill_exp[GINOU_RIDING]++;
3255 p_ptr->update |= (PU_BONUS);
3258 riding_t_m_idx = c_ptr->m_idx;
3259 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
3260 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
3262 /* Mutations which yield extra 'natural' attacks */
3265 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
3266 natural_attack(c_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
3267 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
3268 natural_attack(c_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
3269 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
3270 natural_attack(c_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
3271 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
3272 natural_attack(c_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
3273 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
3274 natural_attack(c_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
3277 /* Hack -- delay fear messages */
3278 if (fear && m_ptr->ml && !mdeath)
3285 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
3287 msg_format("%^s flees in terror!", m_name);
3292 if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
3294 set_action(ACTION_NONE);
3301 static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
3303 if (!pattern_tile(c_y, c_x) && !pattern_tile(n_y, n_x))
3306 if (cave[n_y][n_x].feat == FEAT_PATTERN_START)
3308 if (!pattern_tile(c_y, c_x) &&
3309 !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
3312 if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤻Ϥá¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
3314 if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
3324 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_OLD) ||
3325 (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
3326 (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
3328 if (pattern_tile(c_y, c_x))
3335 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3337 msg_print("You must start walking the Pattern from the startpoint.");
3343 else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
3344 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
3348 else if (cave[c_y][c_x].feat == FEAT_PATTERN_START)
3350 if (pattern_tile(n_y, n_x))
3355 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3357 msg_print("You must walk the Pattern in correct order.");
3363 else if ((cave[c_y][c_x].feat == FEAT_PATTERN_OLD) ||
3364 (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
3365 (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
3367 if (!pattern_tile(n_y, n_x))
3370 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3372 msg_print("You may not step off from the Pattern.");
3384 if (!pattern_tile(c_y, c_x))
3387 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤻Ϥá¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
3389 msg_print("You must start walking the Pattern from the startpoint.");
3396 byte ok_move = FEAT_PATTERN_START;
3397 switch (cave[c_y][c_x].feat)
3399 case FEAT_PATTERN_1:
3400 ok_move = FEAT_PATTERN_2;
3402 case FEAT_PATTERN_2:
3403 ok_move = FEAT_PATTERN_3;
3405 case FEAT_PATTERN_3:
3406 ok_move = FEAT_PATTERN_4;
3408 case FEAT_PATTERN_4:
3409 ok_move = FEAT_PATTERN_1;
3414 msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]);
3416 msg_format("Funny Pattern walking, %d.", cave[c_y][c_x]);
3419 return TRUE; /* Goof-up */
3422 if ((cave[n_y][n_x].feat == ok_move) ||
3423 (cave[n_y][n_x].feat == cave[c_y][c_x].feat))
3427 if (!pattern_tile(n_y, n_x))
3429 msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
3431 msg_print("You may not step off from the Pattern.");
3436 msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
3438 msg_print("You must walk the Pattern in correct order.");
3450 bool player_can_enter(byte feature)
3454 /* Player can not walk through "walls" unless in Shadow Form */
3455 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3462 case FEAT_DEEP_WATER:
3463 case FEAT_SHAL_LAVA:
3464 case FEAT_DEEP_LAVA:
3487 case FEAT_WALL_EXTRA:
3488 case FEAT_WALL_INNER:
3489 case FEAT_WALL_OUTER:
3490 case FEAT_WALL_SOLID:
3497 return (!dun_level && p_ptr->ffall);
3499 case FEAT_PERM_EXTRA:
3500 case FEAT_PERM_INNER:
3501 case FEAT_PERM_OUTER:
3502 case FEAT_PERM_SOLID:
3513 * Move player in the given direction, with the given "pickup" flag.
3515 * This routine should (probably) always induce energy expenditure.
3517 * Note that moving will *always* take a turn, and will *always* hit
3518 * any monster which might be in the destination grid. Previously,
3519 * moving into walls was "free" and did NOT hit invisible monsters.
3521 void move_player(int dir, int do_pickup, bool break_trap)
3526 monster_type *m_ptr;
3530 bool p_can_pass_walls = FALSE;
3531 bool stormbringer = FALSE;
3533 bool oktomove = TRUE;
3534 bool do_past = FALSE;
3536 /* Find the result of moving */
3540 /* Examine the destination */
3541 c_ptr = &cave[y][x];
3545 if (!dun_level && !p_ptr->wild_mode &&
3546 ((x == 0) || (x == MAX_WID - 1) ||
3547 (y == 0) || (y == MAX_HGT - 1)))
3549 /* Can the player enter the grid? */
3550 if (c_ptr->mimic && player_can_enter(c_ptr->mimic))
3552 /* Hack: move to new area */
3553 if ((y == 0) && (x == 0))
3555 p_ptr->wilderness_y--;
3556 p_ptr->wilderness_x--;
3557 p_ptr->oldpy = cur_hgt - 2;
3558 p_ptr->oldpx = cur_wid - 2;
3559 ambush_flag = FALSE;
3562 else if ((y == 0) && (x == MAX_WID - 1))
3564 p_ptr->wilderness_y--;
3565 p_ptr->wilderness_x++;
3566 p_ptr->oldpy = cur_hgt - 2;
3568 ambush_flag = FALSE;
3571 else if ((y == MAX_HGT - 1) && (x == 0))
3573 p_ptr->wilderness_y++;
3574 p_ptr->wilderness_x--;
3576 p_ptr->oldpx = cur_wid - 2;
3577 ambush_flag = FALSE;
3580 else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
3582 p_ptr->wilderness_y++;
3583 p_ptr->wilderness_x++;
3586 ambush_flag = FALSE;
3591 p_ptr->wilderness_y--;
3592 p_ptr->oldpy = cur_hgt - 2;
3594 ambush_flag = FALSE;
3597 else if (y == MAX_HGT - 1)
3599 p_ptr->wilderness_y++;
3602 ambush_flag = FALSE;
3607 p_ptr->wilderness_x--;
3608 p_ptr->oldpx = cur_wid - 2;
3610 ambush_flag = FALSE;
3613 else if (x == MAX_WID - 1)
3615 p_ptr->wilderness_x++;
3618 ambush_flag = FALSE;
3621 p_ptr->leftbldg = TRUE;
3622 p_ptr->leaving = TRUE;
3631 /* Get the monster */
3632 m_ptr = &m_list[c_ptr->m_idx];
3635 if (inventory[INVEN_RARM].art_name)
3637 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER)
3638 stormbringer = TRUE;
3640 else if (inventory[INVEN_LARM].art_name)
3642 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER)
3643 stormbringer = TRUE;
3646 /* Player can not walk through "walls"... */
3647 /* unless in Shadow Form */
3648 if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
3649 p_can_pass_walls = TRUE;
3650 if ((cave[y][x].feat >= FEAT_PERM_EXTRA) &&
3651 (cave[y][x].feat <= FEAT_PERM_SOLID))
3653 p_can_pass_walls = FALSE;
3658 cave[py][px].m_idx = 0;
3661 /* Hack -- attack monsters */
3662 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
3665 /* Attack -- only if we can see it OR it is not in a wall */
3666 if (!is_hostile(m_ptr) &&
3667 !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
3668 ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
3669 (pattern_seq(py, px, y, x)) &&
3670 ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
3673 p_ptr->update |= (PU_MON_LITE);
3675 /* Extract monster name (or "it") */
3676 monster_desc(m_name, m_ptr, 0);
3678 /* Auto-Recall if possible and visible */
3679 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
3681 /* Track a new monster */
3682 if (m_ptr->ml) health_track(c_ptr->m_idx);
3685 if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
3690 else if (monster_can_cross_terrain(cave[py][px].feat, &r_info[m_ptr->r_idx]) &&
3691 (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
3692 (r_info[m_ptr->r_idx].flags2 & RF2_PASS_WALL)))
3699 msg_format("%^s¤¬¼ÙËâ¤À¡ª", m_name);
3701 msg_format("%^s is in your way!", m_name);
3708 /* now continue on to 'movement' */
3721 else if ((c_ptr->feat == FEAT_DARK_PIT) && !p_ptr->ffall)
3724 msg_print("Îö¤±Ìܤò²£Àڤ뤳¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
3726 msg_print("You can't cross the chasm.");
3734 else if (c_ptr->feat == FEAT_MOUNTAIN)
3736 if (dun_level || !p_ptr->ffall)
3739 msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
3741 msg_print("You can't climb the mountains!");
3750 * Player can move through trees and
3751 * has effective -10 speed
3752 * Rangers can move without penality
3754 else if (c_ptr->feat == FEAT_TREES)
3757 if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
3760 else if ((c_ptr->feat >= FEAT_QUEST_ENTER) &&
3761 (c_ptr->feat <= FEAT_QUEST_EXIT))
3766 #ifdef ALLOW_EASY_DISARM /* TNB */
3768 /* Disarm a visible trap */
3769 else if ((do_pickup != easy_disarm) && is_trap(c_ptr->feat))
3771 bool ignore = FALSE;
3772 switch (c_ptr->feat)
3774 case FEAT_TRAP_TRAPDOOR:
3776 case FEAT_TRAP_SPIKED_PIT:
3777 case FEAT_TRAP_POISON_PIT:
3778 if (p_ptr->ffall) ignore = TRUE;
3780 case FEAT_TRAP_TELEPORT:
3781 if (p_ptr->anti_tele) ignore = TRUE;
3783 case FEAT_TRAP_FIRE:
3784 if (p_ptr->immune_fire) ignore = TRUE;
3786 case FEAT_TRAP_ACID:
3787 if (p_ptr->immune_acid) ignore = TRUE;
3789 case FEAT_TRAP_BLIND:
3790 if (p_ptr->resist_blind) ignore = TRUE;
3792 case FEAT_TRAP_CONFUSE:
3793 if (p_ptr->resist_conf) ignore = TRUE;
3795 case FEAT_TRAP_POISON:
3796 if (p_ptr->resist_pois) ignore = TRUE;
3798 case FEAT_TRAP_SLEEP:
3799 if (p_ptr->free_act) ignore = TRUE;
3805 (void)do_cmd_disarm_aux(y, x, dir);
3810 #endif /* ALLOW_EASY_DISARM -- TNB */
3811 else if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags1 & RF1_NEVER_MOVE))
3814 msg_print("Æ°¤±¤Ê¤¤¡ª");
3816 msg_print("Can't move!");
3823 else if (p_ptr->riding && m_list[p_ptr->riding].monfear)
3827 /* Acquire the monster name */
3828 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3830 /* Dump a message */
3832 msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤¤Ê¤¤¡£", m_name);
3834 msg_format("%^s is too scared to control.", m_name);
3840 else if (p_ptr->riding && p_ptr->riding_ryoute)
3846 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))
3849 msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
3851 msg_print("Can't land.");
3858 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))
3861 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3863 msg_print("Can't swim.");
3870 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))
3873 msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3875 msg_print("Can't swim.");
3882 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)))
3885 msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
3887 msg_print("Too hot to go through.");
3894 else if (p_ptr->riding && m_list[p_ptr->riding].stunned && one_in_(2))
3897 monster_desc(m_name, &m_list[p_ptr->riding], 0);
3899 msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
3901 msg_format("You cannot control stunned %s!",m_name);
3907 /* Player can not walk through "walls" unless in wraith form...*/
3908 else if ((!cave_floor_bold(y, x)) &&
3909 (!p_can_pass_walls))
3913 /* Disturb the player */
3916 /* Notice things in the dark */
3917 if ((!(c_ptr->info & (CAVE_MARK))) &&
3918 (p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
3921 if (c_ptr->feat == FEAT_RUBBLE)
3924 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3926 msg_print("You feel some rubble blocking your way.");
3929 c_ptr->info |= (CAVE_MARK);
3934 else if (c_ptr->feat < FEAT_SECRET)
3937 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3939 msg_print("You feel a closed door blocking your way.");
3942 c_ptr->info |= (CAVE_MARK);
3946 /* Wall (or secret door) */
3950 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
3952 msg_print("You feel a wall blocking your way.");
3955 c_ptr->info |= (CAVE_MARK);
3964 if (c_ptr->feat == FEAT_RUBBLE)
3967 msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3969 msg_print("There is rubble blocking your way.");
3973 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
3977 * Well, it makes sense that you lose time bumping into
3978 * a wall _if_ you are confused, stunned or blind; but
3979 * typing mistakes should not cost you a turn...
3983 else if (c_ptr->feat < FEAT_SECRET)
3985 #ifdef ALLOW_EASY_OPEN
3987 if (easy_open && easy_open_door(y, x)) return;
3989 #endif /* ALLOW_EASY_OPEN */
3992 msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
3994 msg_print("There is a closed door blocking your way.");
3998 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
4002 /* Wall (or secret door) */
4006 msg_print("Êɤ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
4008 msg_print("There is a wall blocking your way.");
4012 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
4018 sound(SOUND_HITWALL);
4021 /* Normal movement */
4022 if (!pattern_seq(py, px, y, x))
4024 if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
4029 /* To avoid a loop with running */
4035 /* Normal movement */
4042 if(!process_frakir(x,y))
4052 msg_format("%s¤ò²¡¤·Âऱ¤¿¡£", m_name);
4054 msg_format("You push past %s.", m_name);
4059 cave[py][px].m_idx = c_ptr->m_idx;
4061 update_mon(cave[py][px].m_idx, TRUE);
4064 /* Change oldpx and oldpy to place the player well when going back to big mode */
4065 if (p_ptr->wild_mode)
4067 if(ddy[dir] > 0) p_ptr->oldpy = 1;
4068 if(ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
4069 if(ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
4070 if(ddx[dir] > 0) p_ptr->oldpx = 1;
4071 if(ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
4072 if(ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
4075 /* Save old location */
4079 /* Move the player */
4083 if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
4085 if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
4087 /* Forget the wall */
4088 cave[py][px].info &= ~(CAVE_MARK);
4091 cave_set_feat(py, px, floor_type[randint0(100)]);
4094 if (music_singing(MUSIC_WALL))
4096 project(0, 0, py, px,
4097 (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
4099 else if (p_ptr->kill_wall)
4101 if (cave_valid_bold(py, px) &&
4102 (cave[py][px].feat < FEAT_PATTERN_START ||
4103 cave[py][px].feat > FEAT_PATTERN_XTRA2) &&
4104 (cave[py][px].feat < FEAT_DEEP_WATER ||
4105 cave[py][px].feat > FEAT_GRASS))
4107 if (cave[py][px].feat == FEAT_TREES)
4108 cave_set_feat(py, px, FEAT_GRASS);
4111 cave[py][px].feat = floor_type[randint0(100)];
4112 cave[py][px].info &= ~(CAVE_MASK);
4113 cave[py][px].info |= CAVE_FLOOR;
4116 /* Update some things -- similar to GF_KILL_WALL */
4117 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
4120 /* Redraw new spot */
4123 /* Redraw old spot */
4127 /* sound(SOUND_WALK); */
4129 /* Check for new panel (redraw map) */
4132 /* For get everything when requested hehe I'm *NASTY* */
4133 if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
4138 if ((p_ptr->pclass == CLASS_NINJA))
4140 if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
4141 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
4143 if ((p_ptr->action == ACTION_HAYAGAKE) && !cave_floor_bold(py, px))
4146 msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
4148 msg_print("You cannot run in wall.");
4150 set_action(ACTION_NONE);
4154 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
4156 /* Update the monsters */
4157 p_ptr->update |= (PU_DISTANCE);
4160 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4162 /* Spontaneous Searching */
4163 if ((p_ptr->skill_fos >= 50) ||
4164 (0 == randint0(50 - p_ptr->skill_fos)))
4169 /* Continuous Searching */
4170 if (p_ptr->action == ACTION_SEARCH)
4175 /* Handle "objects" */
4177 #ifdef ALLOW_EASY_DISARM /* TNB */
4179 carry(do_pickup != always_pickup);
4181 #else /* ALLOW_EASY_DISARM -- TNB */
4185 #endif /* ALLOW_EASY_DISARM -- TNB */
4187 /* Handle "store doors" */
4188 if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
4189 (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
4190 (c_ptr->feat == FEAT_MUSEUM))
4196 /* Hack -- Enter store */
4200 /* Handle "building doors" -KMW- */
4201 else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
4202 (c_ptr->feat <= FEAT_BLDG_TAIL))
4208 /* Hack -- Enter building */
4212 /* Handle quest areas -KMW- */
4213 else if (cave[y][x].feat == FEAT_QUEST_ENTER)
4219 /* Hack -- Enter quest level */
4223 else if (cave[y][x].feat == FEAT_QUEST_EXIT)
4225 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
4227 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
4228 quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
4229 quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
4231 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
4233 msg_print("You accomplished your quest!");
4239 leave_quest_check();
4241 p_ptr->inside_quest = cave[y][x].special;
4245 p_ptr->leaving = TRUE;
4248 /* Discover invisible traps */
4249 else if (c_ptr->info & CAVE_TRAP)
4256 msg_print("¥È¥é¥Ã¥×¤À¡ª");
4258 msg_print("You found a trap!");
4266 hit_trap(break_trap);
4269 /* Set off an visible trap */
4270 else if (is_trap(c_ptr->feat))
4276 hit_trap(break_trap);
4279 /* Warn when leaving trap detected region */
4280 if (disturb_trap_detect && p_ptr->dtrap_x && p_ptr->dtrap_y && p_ptr->dtrap_rad)
4282 if (distance(py, px, p_ptr->dtrap_y, p_ptr->dtrap_x) >= p_ptr->dtrap_rad)
4288 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4290 msg_print("*Leaving trap detect region!*");
4300 m_list[p_ptr->riding].fy = py;
4301 m_list[p_ptr->riding].fx = px;
4302 cave[py][px].m_idx = p_ptr->riding;
4303 update_mon(cave[py][px].m_idx, TRUE);
4304 p_ptr->update |= (PU_MON_LITE);
4310 * Hack -- Check for a "known wall" (see below)
4312 static int see_wall(int dir, int y, int x)
4314 /* Get the new location */
4318 /* Illegal grids are not known walls */
4319 if (!in_bounds2(y, x)) return (FALSE);
4321 /* Non-wall grids are not known walls */
4322 if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
4324 if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
4325 (cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
4327 if ((cave[y][x].feat >= FEAT_SHOP_HEAD) &&
4328 (cave[y][x].feat <= FEAT_SHOP_TAIL)) return (FALSE);
4330 if (cave[y][x].feat == FEAT_DEEP_GRASS) return (FALSE);
4331 if (cave[y][x].feat == FEAT_FLOWER) return (FALSE);
4333 if (cave[y][x].feat == FEAT_MUSEUM) return (FALSE);
4335 if ((cave[y][x].feat >= FEAT_BLDG_HEAD) &&
4336 (cave[y][x].feat <= FEAT_BLDG_TAIL)) return (FALSE);
4338 /* if (cave[y][x].feat == FEAT_TREES) return (FALSE); */
4340 /* Must be known to the player */
4341 if (!(cave[y][x].info & (CAVE_MARK))) return (FALSE);
4343 if (cave[y][x].feat >= FEAT_TOWN) return (FALSE);
4351 * Hack -- Check for an "unknown corner" (see below)
4353 static int see_nothing(int dir, int y, int x)
4355 /* Get the new location */
4359 /* Illegal grids are unknown */
4360 if (!in_bounds2(y, x)) return (TRUE);
4362 /* Memorized grids are always known */
4363 if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
4365 /* Non-floor grids are unknown */
4366 if (!cave_floor_bold(y, x)) return (TRUE);
4368 /* Viewable door/wall grids are known */
4369 if (player_can_see_bold(y, x)) return (FALSE);
4380 * The running algorithm: -CJS-
4382 * In the diagrams below, the player has just arrived in the
4383 * grid marked as '@', and he has just come from a grid marked
4384 * as 'o', and he is about to enter the grid marked as 'x'.
4386 * Of course, if the "requested" move was impossible, then you
4387 * will of course be blocked, and will stop.
4389 * Overview: You keep moving until something interesting happens.
4390 * If you are in an enclosed space, you follow corners. This is
4391 * the usual corridor scheme. If you are in an open space, you go
4392 * straight, but stop before entering enclosed space. This is
4393 * analogous to reaching doorways. If you have enclosed space on
4394 * one side only (that is, running along side a wall) stop if
4395 * your wall opens out, or your open space closes in. Either case
4396 * corresponds to a doorway.
4398 * What happens depends on what you can really SEE. (i.e. if you
4399 * have no light, then running along a dark corridor is JUST like
4400 * running in a dark room.) The algorithm works equally well in
4401 * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
4403 * These conditions are kept in static memory:
4404 * find_openarea You are in the open on at least one
4406 * find_breakleft You have a wall on the left, and will
4408 * find_breakright You have a wall on the right, and will
4411 * To initialize these conditions, we examine the grids adjacent
4412 * to the grid marked 'x', two on each side (marked 'L' and 'R').
4413 * If either one of the two grids on a given side is seen to be
4414 * closed, then that side is considered to be closed. If both
4415 * sides are closed, then it is an enclosed (corridor) run.
4421 * Looking at more than just the immediate squares is
4422 * significant. Consider the following case. A run along the
4423 * corridor will stop just before entering the center point,
4424 * because a choice is clearly established. Running in any of
4425 * three available directions will be defined as a corridor run.
4426 * Note that a minor hack is inserted to make the angled corridor
4427 * entry (with one side blocked near and the other side blocked
4428 * further away from the runner) work correctly. The runner moves
4429 * diagonally, but then saves the previous direction as being
4430 * straight into the gap. Otherwise, the tail end of the other
4431 * entry would be perceived as an alternative on the next move.
4439 * Likewise, a run along a wall, and then into a doorway (two
4440 * runs) will work correctly. A single run rightwards from @ will
4441 * stop at 1. Another run right and down will enter the corridor
4442 * and make the corner, stopping at the 2.
4444 * ##################
4446 * ########### ######
4450 * After any move, the function area_affect is called to
4451 * determine the new surroundings, and the direction of
4452 * subsequent moves. It examines the current player location
4453 * (at which the runner has just arrived) and the previous
4454 * direction (from which the runner is considered to have come).
4456 * Moving one square in some direction places you adjacent to
4457 * three or five new squares (for straight and diagonal moves
4458 * respectively) to which you were not previously adjacent,
4459 * marked as '!' in the diagrams below.
4462 * .o@! (normal) .o.! (diagonal)
4463 * ...! (east) ..@! (south east)
4466 * You STOP if any of the new squares are interesting in any way:
4467 * for example, if they contain visible monsters or treasure.
4469 * You STOP if any of the newly adjacent squares seem to be open,
4470 * and you are also looking for a break on that side. (that is,
4471 * find_openarea AND find_break).
4473 * You STOP if any of the newly adjacent squares do NOT seem to be
4474 * open and you are in an open area, and that side was previously
4477 * Corners: If you are not in the open (i.e. you are in a corridor)
4478 * and there is only one way to go in the new squares, then turn in
4479 * that direction. If there are more than two new ways to go, STOP.
4480 * If there are two ways to go, and those ways are separated by a
4481 * square which does not seem to be open, then STOP.
4483 * Otherwise, we have a potential corner. There are two new open
4484 * squares, which are also adjacent. One of the new squares is
4485 * diagonally located, the other is straight on (as in the diagram).
4486 * We consider two more squares further out (marked below as ?).
4488 * We assign "option" to the straight-on grid, and "option2" to the
4489 * diagonal grid, and "check_dir" to the grid marked 's'.
4495 * If they are both seen to be closed, then it is seen that no benefit
4496 * is gained from moving straight. It is a known corner. To cut the
4497 * corner, go diagonally, otherwise go straight, but pretend you
4498 * stepped diagonally into that next location for a full view next
4499 * time. Conversely, if one of the ? squares is not seen to be closed,
4500 * then there is a potential choice. We check to see whether it is a
4501 * potential corner or an intersection/room entrance. If the square
4502 * two spaces straight ahead, and the space marked with 's' are both
4503 * unknown space, then it is a potential corner and enter if
4504 * find_examine is set, otherwise must stop because it is not a
4512 * Hack -- allow quick "cycling" through the legal directions
4514 static byte cycle[] =
4515 { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
4518 * Hack -- map each direction into the "middle" of the "cycle[]" array
4520 static byte chome[] =
4521 { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
4524 * The direction we are running
4526 static byte find_current;
4529 * The direction we came from
4531 static byte find_prevdir;
4534 * We are looking for open area
4536 static bool find_openarea;
4539 * We are looking for a break
4541 static bool find_breakright;
4542 static bool find_breakleft;
4547 * Initialize the running algorithm for a new direction.
4549 * Diagonal Corridor -- allow diaginal entry into corridors.
4551 * Blunt Corridor -- If there is a wall two spaces ahead and
4552 * we seem to be in a corridor, then force a turn into the side
4553 * corridor, must be moving straight into a corridor here. ???
4555 * Diagonal Corridor Blunt Corridor (?)
4560 static void run_init(int dir)
4562 int row, col, deepleft, deepright;
4563 int i, shortleft, shortright;
4566 /* Save the direction */
4569 /* Assume running straight */
4572 /* Assume looking for open area */
4573 find_openarea = TRUE;
4575 /* Assume not looking for breaks */
4576 find_breakright = find_breakleft = FALSE;
4578 /* Assume no nearby walls */
4579 deepleft = deepright = FALSE;
4580 shortright = shortleft = FALSE;
4585 /* Find the destination grid */
4586 row = py + ddy[dir];
4587 col = px + ddx[dir];
4589 /* Extract cycle index */
4592 /* Check for walls */
4593 if (see_wall(cycle[i+1], py, px))
4595 find_breakleft = TRUE;
4598 else if (see_wall(cycle[i+1], row, col))
4600 find_breakleft = TRUE;
4604 /* Check for walls */
4605 if (see_wall(cycle[i-1], py, px))
4607 find_breakright = TRUE;
4610 else if (see_wall(cycle[i-1], row, col))
4612 find_breakright = TRUE;
4616 /* Looking for a break */
4617 if (find_breakleft && find_breakright)
4619 /* Not looking for open area */
4620 find_openarea = FALSE;
4622 /* Hack -- allow angled corridor entry */
4625 if (deepleft && !deepright)
4627 find_prevdir = cycle[i - 1];
4629 else if (deepright && !deepleft)
4631 find_prevdir = cycle[i + 1];
4635 /* Hack -- allow blunt corridor entry */
4636 else if (see_wall(cycle[i], row, col))
4638 if (shortleft && !shortright)
4640 find_prevdir = cycle[i - 2];
4642 else if (shortright && !shortleft)
4644 find_prevdir = cycle[i + 2];
4652 * Update the current "run" path
4654 * Return TRUE if the running should be stopped
4656 static bool run_test(void)
4658 int prev_dir, new_dir, check_dir = 0;
4661 int option = 0, option2 = 0;
4664 /* Where we came from */
4665 prev_dir = find_prevdir;
4668 /* Range of newly adjacent grids */
4669 max = (prev_dir & 0x01) + 1;
4671 /* break run when leaving trap detected region */
4672 if (disturb_trap_detect && p_ptr->dtrap_x && p_ptr->dtrap_y && p_ptr->dtrap_rad)
4674 if (distance(py, px, p_ptr->dtrap_y, p_ptr->dtrap_x) >= p_ptr->dtrap_rad)
4680 msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
4682 msg_print("*Leaving trap detect region!*");
4690 /* Look at every newly adjacent square. */
4691 for (i = -max; i <= max; i++)
4693 s16b this_o_idx, next_o_idx = 0;
4697 new_dir = cycle[chome[prev_dir] + i];
4700 row = py + ddy[new_dir];
4701 col = px + ddx[new_dir];
4704 c_ptr = &cave[row][col];
4707 /* Visible monsters abort running */
4710 monster_type *m_ptr = &m_list[c_ptr->m_idx];
4712 /* Visible monster */
4713 if (m_ptr->ml) return (TRUE);
4716 /* Visible objects abort running */
4717 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4721 /* Acquire object */
4722 o_ptr = &o_list[this_o_idx];
4724 /* Acquire next object */
4725 next_o_idx = o_ptr->next_o_idx;
4727 /* Visible object */
4728 if (o_ptr->marked) return (TRUE);
4732 /* Assume unknown */
4735 /* Check memorized grids */
4736 if (c_ptr->info & (CAVE_MARK))
4740 /* Examine the terrain */
4741 switch (c_ptr->feat)
4756 /* Hidden treasure */
4760 /* Known treasure (almost uninteresting) */
4766 case FEAT_WALL_EXTRA:
4767 case FEAT_WALL_INNER:
4768 case FEAT_WALL_OUTER:
4769 case FEAT_WALL_SOLID:
4770 case FEAT_PERM_EXTRA:
4771 case FEAT_PERM_INNER:
4772 case FEAT_PERM_OUTER:
4773 case FEAT_PERM_SOLID:
4774 /* dirt, grass, trees, ... */
4775 case FEAT_SHAL_WATER:
4778 case FEAT_DEEP_GRASS:
4791 /* quest features */
4792 case FEAT_QUEST_ENTER:
4793 case FEAT_QUEST_EXIT:
4802 case FEAT_DEEP_LAVA:
4803 case FEAT_SHAL_LAVA:
4806 if (p_ptr->invuln || p_ptr->immune_fire) notice = FALSE;
4812 case FEAT_DEEP_WATER:
4815 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;
4825 /* Option -- ignore */
4826 if (find_ignore_doors) notice = FALSE;
4835 case FEAT_LESS_LESS:
4836 case FEAT_MORE_MORE:
4839 /* Option -- ignore */
4840 if (find_ignore_stairs) notice = FALSE;
4847 /* Interesting feature */
4848 if (notice) return (TRUE);
4850 /* The grid is "visible" */
4854 /* Analyze unknown grids and floors */
4855 /* if (inv || cave_floor_bold(row, col) || */
4856 /* (cave[row][col].feat == FEAT_TREES)) */
4857 if (inv || cave_floor_bold(row, col))
4859 /* Looking for open area */
4865 /* The first new direction. */
4871 /* Three new directions. Stop running. */
4877 /* Two non-adjacent new directions. Stop running. */
4878 else if (option != cycle[chome[prev_dir] + i - 1])
4883 /* Two new (adjacent) directions (case 1) */
4884 else if (new_dir & 0x01)
4886 check_dir = cycle[chome[prev_dir] + i - 2];
4890 /* Two new (adjacent) directions (case 2) */
4893 check_dir = cycle[chome[prev_dir] + i + 1];
4899 /* Obstacle, while looking for open area */
4906 /* Break to the right */
4907 find_breakright = TRUE;
4912 /* Break to the left */
4913 find_breakleft = TRUE;
4920 /* Looking for open area */
4923 /* Hack -- look again */
4924 for (i = -max; i < 0; i++)
4926 new_dir = cycle[chome[prev_dir] + i];
4928 row = py + ddy[new_dir];
4929 col = px + ddx[new_dir];
4932 c_ptr = &cave[row][col];
4934 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4935 if (!(c_ptr->info & (CAVE_MARK)) ||
4936 ((c_ptr->feat < FEAT_SECRET) ||
4937 (c_ptr->feat == FEAT_FLOWER) ||
4938 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4939 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4940 (c_ptr->feat <= FEAT_GRASS))))
4943 /* Looking to break right */
4944 if (find_breakright)
4953 /* Looking to break left */
4961 /* Hack -- look again */
4962 for (i = max; i > 0; i--)
4964 new_dir = cycle[chome[prev_dir] + i];
4966 row = py + ddy[new_dir];
4967 col = px + ddx[new_dir];
4970 c_ptr = &cave[row][col];
4972 /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
4973 if (!(c_ptr->info & (CAVE_MARK)) ||
4974 ((c_ptr->feat < FEAT_SECRET) ||
4975 (c_ptr->feat == FEAT_FLOWER) ||
4976 (c_ptr->feat == FEAT_DEEP_GRASS) ||
4977 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
4978 (c_ptr->feat <= FEAT_GRASS))))
4981 /* Looking to break left */
4991 /* Looking to break right */
4992 if (find_breakright)
5001 /* Not looking for open area */
5013 /* Primary option */
5014 find_current = option;
5016 /* No other options */
5017 find_prevdir = option;
5020 /* Two options, examining corners */
5021 else if (find_examine && !find_cut)
5023 /* Primary option */
5024 find_current = option;
5026 /* Hack -- allow curving */
5027 find_prevdir = option2;
5030 /* Two options, pick one */
5033 /* Get next location */
5034 row = py + ddy[option];
5035 col = px + ddx[option];
5037 /* Don't see that it is closed off. */
5038 /* This could be a potential corner or an intersection. */
5039 if (!see_wall(option, row, col) ||
5040 !see_wall(check_dir, row, col))
5042 /* Can not see anything ahead and in the direction we */
5043 /* are turning, assume that it is a potential corner. */
5045 see_nothing(option, row, col) &&
5046 see_nothing(option2, row, col))
5048 find_current = option;
5049 find_prevdir = option2;
5052 /* STOP: we are next to an intersection or a room */
5059 /* This corner is seen to be enclosed; we cut the corner. */
5062 find_current = option2;
5063 find_prevdir = option2;
5066 /* This corner is seen to be enclosed, and we */
5067 /* deliberately go the long way. */
5070 find_current = option;
5071 find_prevdir = option2;
5077 /* About to hit a known wall, stop */
5078 if (see_wall(find_current, py, px))
5091 * Take one step along the current "run" path
5093 void run_step(int dir)
5098 /* Hack -- do not start silly run */
5099 if (see_wall(dir, py, px) &&
5100 (cave[py+ddy[dir]][px+ddx[dir]].feat != FEAT_TREES))
5104 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¹Ô¤±¤Þ¤»¤ó¡£");
5106 msg_print("You cannot run in that direction.");
5117 /* Calculate torch radius */
5118 p_ptr->update |= (PU_TORCH);
5138 /* Decrease the run counter */
5139 if (--running <= 0) return;
5144 /* Move the player, using the "pickup" flag */
5145 #ifdef ALLOW_EASY_DISARM /* TNB */
5147 move_player(find_current, FALSE, FALSE);
5149 #else /* ALLOW_EASY_DISARM -- TNB */
5151 move_player(find_current, always_pickup, FALSE);
5153 #endif /* ALLOW_EASY_DISARM -- TNB */
5155 if ((py == p_ptr->run_py) && (px == p_ptr->run_px))