4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Angband game engine */
15 #define TY_CURSE_CHANCE 200
16 #define CHAINSWORD_NOISE 100
18 static bool load = TRUE;
19 static int wild_regen = 20;
22 * Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
24 static byte value_check_aux1(object_type *o_ptr)
27 if (artifact_p(o_ptr) || o_ptr->art_name)
30 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_TERRIBLE;
37 if (ego_item_p(o_ptr))
40 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_WORTHLESS;
43 return FEEL_EXCELLENT;
47 if (cursed_p(o_ptr)) return FEEL_CURSED;
50 if (broken_p(o_ptr)) return FEEL_BROKEN;
52 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
54 /* Good "armor" bonus */
55 if (o_ptr->to_a > 0) return FEEL_GOOD;
57 /* Good "weapon" bonus */
58 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
60 /* Default to "average" */
66 * Return a "feeling" (or NULL) about an item. Method 2 (Light).
68 static byte value_check_aux2(object_type *o_ptr)
70 /* Cursed items (all of them) */
71 if (cursed_p(o_ptr)) return FEEL_CURSED;
73 /* Broken items (all of them) */
74 if (broken_p(o_ptr)) return FEEL_BROKEN;
76 /* Artifacts -- except cursed/broken ones */
77 if (artifact_p(o_ptr) || o_ptr->art_name) return FEEL_UNCURSED;
79 /* Ego-Items -- except cursed/broken ones */
80 if (ego_item_p(o_ptr)) return FEEL_UNCURSED;
82 /* Good armor bonus */
83 if (o_ptr->to_a > 0) return FEEL_UNCURSED;
85 /* Good weapon bonuses */
86 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
94 static void sense_inventory_aux(int slot, bool heavy)
97 object_type *o_ptr = &inventory[slot];
98 char o_name[MAX_NLEN];
100 /* We know about it already, do not tell us again */
101 if (o_ptr->ident & (IDENT_SENSE))return;
103 /* It is fully known, no information needed */
104 if (object_known_p(o_ptr)) return;
106 /* Check for a feeling */
107 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
109 /* Skip non-feelings */
113 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
124 feel = FEEL_EXCELLENT;
130 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
132 feel = FEEL_UNCURSED;
137 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
143 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
150 feel = FEEL_WORTHLESS;
155 feel = FEEL_TERRIBLE;
161 /* Stop everything */
162 if (disturb_minor) disturb(0, 0);
164 /* Get an object description */
165 object_desc(o_name, o_ptr, FALSE, 0);
167 /* Message (equipment) */
168 if (slot >= INVEN_RARM)
171 msg_format("%s%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
172 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
174 msg_format("You feel the %s (%c) you are %s %s %s...",
175 o_name, index_to_label(slot), describe_use(slot),
176 ((o_ptr->number == 1) ? "is" : "are"),
177 game_inscriptions[feel]);
182 /* Message (inventory) */
186 msg_format("¥¶¥Ã¥¯¤ÎÃæ¤Î%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
187 o_name, index_to_label(slot),game_inscriptions[feel]);
189 msg_format("You feel the %s (%c) in your pack %s %s...",
190 o_name, index_to_label(slot),
191 ((o_ptr->number == 1) ? "is" : "are"),
192 game_inscriptions[feel]);
197 /* We have "felt" it */
198 o_ptr->ident |= (IDENT_SENSE);
200 /* Set the "inscription" */
201 o_ptr->feeling = feel;
203 /* Auto-inscription/destroy */
204 autopick_alter_item(slot, destroy_feeling);
206 /* Combine / Reorder the pack (later) */
207 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
210 p_ptr->window |= (PW_INVEN | PW_EQUIP);
216 * Sense the inventory
218 * Class 0 = Warrior --> fast and heavy
219 * Class 1 = Mage --> slow and light
220 * Class 2 = Priest --> fast but light
221 * Class 3 = Rogue --> okay and heavy
222 * Class 4 = Ranger --> slow but heavy (changed!)
223 * Class 5 = Paladin --> slow but heavy
225 static void sense_inventory1(void)
228 int plev = p_ptr->lev;
233 /*** Check for "sensing" ***/
235 /* No sensing when confused */
236 if (p_ptr->confused) return;
238 /* Analyze the class */
239 switch (p_ptr->pclass)
247 if (0 != randint0(9000L / (plev * plev + 40))) return;
259 if (0 != randint0(6000L / (plev * plev + 50))) return;
269 case CLASS_HIGH_MAGE:
271 case CLASS_MAGIC_EATER:
273 /* Very bad (light) sensing */
274 if (0 != randint0(240000L / (plev + 5))) return;
283 /* Good (light) sensing */
284 if (0 != randint0(10000L / (plev * plev + 40))) return;
294 if (0 != randint0(20000L / (plev * plev + 40))) return;
306 if (0 != randint0(95000L / (plev * plev + 40))) return;
318 if (0 != randint0(77777L / (plev * plev + 40))) return;
327 case CLASS_WARRIOR_MAGE:
331 if (0 != randint0(75000L / (plev * plev + 40))) return;
337 case CLASS_MINDCRAFTER:
339 case CLASS_BLUE_MAGE:
340 case CLASS_MIRROR_MASTER:
343 if (0 != randint0(55000L / (plev * plev + 40))) return;
349 case CLASS_CHAOS_WARRIOR:
352 if (0 != randint0(80000L / (plev * plev + 40))) return;
362 case CLASS_FORCETRAINER:
365 if (0 != randint0(20000L / (plev * plev + 40))) return;
374 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
383 case CLASS_BEASTMASTER:
386 if (0 != randint0(65000L / (plev * plev + 40))) return;
391 case CLASS_BERSERKER:
401 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
403 /*** Sense everything ***/
405 /* Check everything */
406 for (i = 0; i < INVEN_TOTAL; i++)
410 o_ptr = &inventory[i];
412 /* Skip empty slots */
413 if (!o_ptr->k_idx) continue;
415 /* Valid "tval" codes */
442 /* Skip non-sense machines */
445 /* Occasional failure on inventory items */
446 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
449 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
454 sense_inventory_aux(i, heavy);
459 static void sense_inventory2(void)
462 int plev = p_ptr->lev;
466 /*** Check for "sensing" ***/
468 /* No sensing when confused */
469 if (p_ptr->confused) return;
471 /* Analyze the class */
472 switch (p_ptr->pclass)
478 case CLASS_BERSERKER:
485 case CLASS_CHAOS_WARRIOR:
487 case CLASS_BEASTMASTER:
490 /* Very bad (light) sensing */
491 if (0 != randint0(240000L / (plev + 5))) return;
498 case CLASS_WARRIOR_MAGE:
503 if (0 != randint0(95000L / (plev * plev + 40))) return;
512 case CLASS_FORCETRAINER:
513 case CLASS_MINDCRAFTER:
516 if (0 != randint0(20000L / (plev * plev + 40))) return;
523 case CLASS_HIGH_MAGE:
525 case CLASS_MAGIC_EATER:
526 case CLASS_MIRROR_MASTER:
527 case CLASS_BLUE_MAGE:
530 if (0 != randint0(9000L / (plev * plev + 40))) return;
539 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
546 /*** Sense everything ***/
548 /* Check everything */
549 for (i = 0; i < INVEN_TOTAL; i++)
553 o_ptr = &inventory[i];
555 /* Skip empty slots */
556 if (!o_ptr->k_idx) continue;
558 /* Valid "tval" codes */
571 /* Skip non-sense machines */
574 /* Occasional failure on inventory items */
575 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
577 sense_inventory_aux(i, TRUE);
584 * Go to any level (ripped off from wiz_jump)
586 static void pattern_teleport(void)
593 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
595 if (get_check("Teleport level? "))
602 /* Only downward in ironman mode */
603 if (ironman_downward)
604 min_level = dun_level;
607 if (dungeon_type == DUNGEON_ANGBAND)
610 max_level = MAX_DEPTH - 1;
611 else if (dun_level == 100)
616 max_level = d_info[dungeon_type].maxdepth;
617 min_level = d_info[dungeon_type].mindepth;
622 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
624 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
629 sprintf(tmp_val, "%d", dun_level);
631 /* Ask for a level */
632 if (!get_string(ppp, tmp_val, 10)) return;
634 /* Extract request */
635 command_arg = atoi(tmp_val);
638 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
640 else if (get_check("Normal teleport? "))
644 teleport_player(200);
653 if (command_arg < min_level) command_arg = min_level;
656 if (command_arg > max_level) command_arg = max_level;
660 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
662 msg_format("You teleport to dungeon level %d.", command_arg);
666 if (autosave_l) do_cmd_save_game(TRUE);
669 dun_level = command_arg;
673 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
675 p_ptr->inside_quest = 0;
679 p_ptr->leaving = TRUE;
683 static void wreck_the_pattern(void)
685 int to_ruin = 0, r_y, r_x;
687 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
694 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
695 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
697 msg_print("You bleed on the Pattern!");
698 msg_print("Something terrible happens!");
704 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
706 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
710 to_ruin = randint1(45) + 35;
714 scatter(&r_y, &r_x, py, px, 4, 0);
716 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
717 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
719 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
723 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
727 /* Returns TRUE if we are on the Pattern... */
728 static bool pattern_effect(void)
730 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
731 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
734 if ((prace_is_(RACE_AMBERITE)) &&
735 (p_ptr->cut > 0) && one_in_(10))
740 if (cave[py][px].feat == FEAT_PATTERN_END)
742 (void)set_poisoned(0);
748 (void)do_res_stat(A_STR);
749 (void)do_res_stat(A_INT);
750 (void)do_res_stat(A_WIS);
751 (void)do_res_stat(A_DEX);
752 (void)do_res_stat(A_CON);
753 (void)do_res_stat(A_CHR);
754 (void)restore_level();
755 (void)hp_player(1000);
756 cave_set_feat(py, px, FEAT_PATTERN_OLD);
758 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
760 msg_print("This section of the Pattern looks less powerful.");
767 * We could make the healing effect of the
768 * Pattern center one-time only to avoid various kinds
769 * of abuse, like luring the win monster into fighting you
770 * in the middle of the pattern...
773 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
777 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
781 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
785 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
787 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
793 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
795 else if (!IS_INVULN())
797 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
799 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
812 * Regenerate hit points -RAK-
814 static void regenhp(int percent)
816 s32b new_chp, new_chp_frac;
819 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
820 if (p_ptr->action == ACTION_HAYAGAKE) return;
821 /* Save the old hitpoints */
822 old_chp = p_ptr->chp;
824 /* Extract the new hitpoints */
825 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
826 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
828 /* check for overflow */
829 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
830 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
831 if (new_chp_frac >= 0x10000L)
833 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
838 p_ptr->chp_frac = (u16b)new_chp_frac;
842 if (p_ptr->chp >= p_ptr->mhp)
844 p_ptr->chp = p_ptr->mhp;
849 if (old_chp != p_ptr->chp)
852 p_ptr->redraw |= (PR_HP);
855 p_ptr->window |= (PW_PLAYER);
863 * Regenerate mana points -RAK-
865 static void regenmana(int percent)
867 s32b new_mana, new_mana_frac;
869 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
871 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
872 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
873 old_csp = p_ptr->csp;
874 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
875 if (old_csp_msp && (new_mana > 0))
879 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
880 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
884 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
885 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
887 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
889 if (new_mana_frac >= 0x10000L)
891 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
896 p_ptr->csp_frac = (u16b)(new_mana_frac);
899 /* check for overflow */
906 /* Must set frac to zero even if equal */
907 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
909 p_ptr->csp = p_ptr->msp;
914 if (old_csp != p_ptr->csp)
917 p_ptr->redraw |= (PR_MANA);
920 p_ptr->window |= (PW_PLAYER);
921 p_ptr->window |= (PW_SPELL);
932 static void regenmagic(int percent)
937 for (i = 0; i < EATER_EXT*2; i++)
939 if (!p_ptr->magic_num2[i]) continue;
940 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
941 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
942 p_ptr->magic_num1[i] += new_mana;
944 /* Must set frac to zero even if equal */
945 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
947 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
951 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
953 if (!p_ptr->magic_num1[i]) continue;
954 if (!p_ptr->magic_num2[i]) continue;
955 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
956 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
967 * Regenerate the monsters (once per 100 game turns)
969 * XXX XXX XXX Should probably be done during monster turns.
971 static void regen_monsters(void)
976 /* Regenerate everyone */
977 for (i = 1; i < m_max; i++)
979 /* Check the i'th monster */
980 monster_type *m_ptr = &m_list[i];
981 monster_race *r_ptr = &r_info[m_ptr->r_idx];
984 /* Skip dead monsters */
985 if (!m_ptr->r_idx) continue;
987 /* Allow regeneration (if needed) */
988 if (m_ptr->hp < m_ptr->maxhp)
990 /* Hack -- Base regeneration */
991 frac = m_ptr->maxhp / 100;
993 /* Hack -- Minimal regeneration rate */
994 if (!frac) if (one_in_(2)) frac = 1;
996 /* Hack -- Some monsters regenerate quickly */
997 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
999 /* Hack -- Regenerate */
1002 /* Do not over-regenerate */
1003 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1005 /* Redraw (later) if needed */
1006 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1007 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1014 * Regenerate the captured monsters (once per 30 game turns)
1016 * XXX XXX XXX Should probably be done during monster turns.
1018 static void regen_captured_monsters(void)
1023 /* Regenerate everyone */
1024 for (i = 0; i < INVEN_TOTAL; i++)
1026 monster_race *r_ptr;
1027 object_type *o_ptr = &inventory[i];
1029 if (!o_ptr->k_idx) continue;
1030 if (o_ptr->tval != TV_CAPTURE) continue;
1031 if (!o_ptr->pval) continue;
1035 r_ptr = &r_info[o_ptr->pval];
1037 /* Allow regeneration (if needed) */
1038 if (o_ptr->xtra4 < o_ptr->xtra5)
1040 /* Hack -- Base regeneration */
1041 frac = o_ptr->xtra5 / 100;
1043 /* Hack -- Minimal regeneration rate */
1044 if (!frac) if (one_in_(2)) frac = 1;
1046 /* Hack -- Some monsters regenerate quickly */
1047 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1049 /* Hack -- Regenerate */
1050 o_ptr->xtra4 += frac;
1052 /* Do not over-regenerate */
1053 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1060 p_ptr->notice |= (PN_COMBINE);
1063 p_ptr->window |= (PW_INVEN);
1064 p_ptr->window |= (PW_EQUIP);
1071 * Process the counters of monsters (once per 10 game turns)
1073 * This function is to process monsters' counters same as player's.
1075 static void process_monsters_counters(void)
1078 monster_type *m_ptr;
1079 monster_race *r_ptr;
1081 u32b noise; /* Hack -- local "player stealth" value */
1083 /* Handle "leaving" */
1084 if (p_ptr->leaving) return;
1086 /* Hack -- calculate the "player noise" */
1087 noise = (1L << (30 - p_ptr->skill_stl));
1089 /* Process the monsters (backwards) */
1090 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1092 /* Access the monster */
1093 m_ptr = &m_list[m_idx];
1094 r_ptr = &r_info[m_ptr->r_idx];
1096 /* Ignore "dead" monsters */
1097 if (!m_ptr->r_idx) continue;
1099 /* Handle Invulnerability */
1100 if (m_ptr->invulner)
1102 /* Reduce by one, note if expires */
1105 if (!m_ptr->invulner)
1111 /* Acquire the monster name */
1112 monster_desc(m_name, m_ptr, 0);
1114 /* Dump a message */
1116 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1118 msg_format("%^s is no longer invulnerable.", m_name);
1121 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1122 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1124 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1131 /* Reduce by one, note if expires */
1134 if (!m_ptr->fast && m_ptr->ml)
1138 /* Acquire the monster name */
1139 monster_desc(m_name, m_ptr, 0);
1141 /* Dump a message */
1143 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1145 msg_format("%^s is no longer fast.", m_name);
1148 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1149 if (p_ptr->riding == m_idx)
1151 p_ptr->redraw |= (PR_UHEALTH);
1152 p_ptr->update |= (PU_BONUS);
1160 /* Reduce by one, note if expires */
1163 if (!m_ptr->slow && m_ptr->ml)
1167 /* Acquire the monster name */
1168 monster_desc(m_name, m_ptr, 0);
1170 /* Dump a message */
1172 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1174 msg_format("%^s is no longer slow.", m_name);
1177 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1178 if (p_ptr->riding == m_idx)
1180 p_ptr->redraw |= (PR_UHEALTH);
1181 p_ptr->update |= (PU_BONUS);
1186 /* Handle "sleep" */
1189 /* Assume does not wake up */
1192 /* Hack -- Require proximity */
1193 if (m_ptr->cdis < AAF_LIMIT)
1195 /* Handle "sensing radius" */
1196 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1198 /* We may wake up */
1202 /* Handle "sight" and "aggravation" */
1203 else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
1205 /* We may wake up */
1212 u32b notice = randint0(1024);
1214 /* Nightmare monsters are more alert */
1215 if (ironman_nightmare) notice /= 2;
1217 /* Hack -- See if monster "notices" player */
1218 if ((notice * notice * notice) <= noise)
1220 /* Hack -- amount of "waking" */
1221 /* Wake up faster near the player */
1222 int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
1224 /* Hack -- amount of "waking" is affected by speed of player */
1225 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1229 if (m_ptr->csleep > d)
1231 /* Monster wakes up "a little bit" */
1234 /* Notice the "not waking up" */
1237 /* Hack -- Count the ignores */
1238 if (r_ptr->r_ignore < MAX_UCHAR)
1248 /* Reset sleep counter */
1251 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1253 /* Notice the "waking up" */
1258 /* Acquire the monster name */
1259 monster_desc(m_name, m_ptr, 0);
1261 /* Dump a message */
1263 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1265 msg_format("%^s wakes up.", m_name);
1268 /* Redraw the health bar */
1269 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1270 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1272 /* Hack -- Count the wakings */
1273 if (r_ptr->r_wake < MAX_UCHAR)
1288 /* Make a "saving throw" against stun */
1289 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1295 /* Hack -- Recover from stun */
1296 if (m_ptr->stunned > d)
1298 /* Recover somewhat */
1299 m_ptr->stunned -= d;
1308 /* Message if visible */
1313 /* Acquire the monster name */
1314 monster_desc(m_name, m_ptr, 0);
1316 /* Dump a message */
1318 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1320 msg_format("%^s is no longer stunned.", m_name);
1323 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1324 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1329 /* Handle confusion */
1330 if (m_ptr->confused)
1332 /* Amount of "boldness" */
1333 int d = randint1(r_ptr->level / 20 + 1);
1335 /* Still confused */
1336 if (m_ptr->confused > d)
1338 /* Reduce the confusion */
1339 m_ptr->confused -= d;
1345 /* No longer confused */
1346 m_ptr->confused = 0;
1348 /* Message if visible */
1353 /* Acquire the monster name */
1354 monster_desc(m_name, m_ptr, 0);
1356 /* Dump a message */
1358 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1360 msg_format("%^s is no longer confused.", m_name);
1363 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1364 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1372 /* Amount of "boldness" */
1373 int d = randint1(r_ptr->level / 20 + 1);
1376 if (m_ptr->monfear > d)
1378 /* Reduce the fear */
1379 m_ptr->monfear -= d;
1382 /* Recover from fear, take note if seen */
1385 /* No longer afraid */
1395 /* Acquire the monster possessive */
1396 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1399 /* Acquire the monster name */
1400 monster_desc(m_name, m_ptr, 0);
1402 /* Dump a message */
1404 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1406 msg_format("%^s recovers %s courage.", m_name, m_poss);
1409 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1410 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1418 static void notice_lite_change(object_type *o_ptr)
1420 /* Hack -- notice interesting fuel steps */
1421 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1424 p_ptr->window |= (PW_EQUIP);
1427 /* Hack -- Special treatment when blind */
1430 /* Hack -- save some light for later */
1431 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1434 /* The light is now out */
1435 else if (o_ptr->xtra4 == 0)
1439 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1441 msg_print("Your light has gone out!");
1443 p_ptr->update |= (PU_BONUS);
1446 /* The light is getting dim */
1447 else if (o_ptr->name2 == EGO_LITE_LONG)
1449 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1450 && (turn % (TURNS_PER_TICK*2)))
1452 if (disturb_minor) disturb(0, 0);
1454 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1456 msg_print("Your light is growing faint.");
1462 /* The light is getting dim */
1463 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1465 if (disturb_minor) disturb(0, 0);
1467 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1469 msg_print("Your light is growing faint.");
1476 void leave_quest_check(void)
1478 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1479 leaving_quest = p_ptr->inside_quest;
1481 /* Leaving an 'only once' quest marks it as failed */
1482 if (leaving_quest &&
1483 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1484 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1486 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1487 quest[leaving_quest].complev = (byte)p_ptr->lev;
1488 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1490 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1491 if (record_rand_quest)
1492 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1494 /* Floor of random quest will be blocked */
1495 prepare_change_floor_mode(CFM_NO_RETURN);
1497 else if (record_fix_quest)
1498 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1504 * Forcibly pseudo-identify an object in the inventory
1507 * note: currently this function allows pseudo-id of any object,
1508 * including silly ones like potions & scrolls, which always
1509 * get '{average}'. This should be changed, either to stop such
1510 * items from being pseudo-id'd, or to allow psychometry to
1511 * detect whether the unidentified potion/scroll/etc is
1512 * good (Cure Light Wounds, Restore Strength, etc) or
1513 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1515 bool psychometry(void)
1519 char o_name[MAX_NLEN];
1524 item_tester_no_ryoute = TRUE;
1527 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1528 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1530 q = "Meditate on which item? ";
1531 s = "You have nothing appropriate.";
1534 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1536 /* Get the item (in the pack) */
1539 o_ptr = &inventory[item];
1542 /* Get the item (on the floor) */
1545 o_ptr = &o_list[0 - item];
1548 /* It is fully known, no information needed */
1549 if (object_known_p(o_ptr))
1552 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1554 msg_print("You cannot find out anything more about that.");
1560 /* Check for a feeling */
1561 feel = value_check_aux1(o_ptr);
1563 /* Get an object description */
1564 object_desc(o_name, o_ptr, FALSE, 0);
1566 /* Skip non-feelings */
1570 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1572 msg_format("You do not perceive anything unusual about the %s.", o_name);
1579 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1580 o_name, game_inscriptions[feel]);
1582 msg_format("You feel that the %s %s %s...",
1583 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1584 game_inscriptions[feel]);
1588 /* We have "felt" it */
1589 o_ptr->ident |= (IDENT_SENSE);
1592 o_ptr->feeling = feel;
1594 /* Combine / Reorder the pack (later) */
1595 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1598 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1600 /* Valid "tval" codes */
1601 switch (o_ptr->tval)
1629 /* Auto-inscription/destroy */
1630 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1632 /* Something happened */
1637 static void gere_music(s32b music)
1645 stun_monsters(damroll(p_ptr->lev/10,2));
1648 hp_player(damroll(2,6));
1651 project_hack(GF_TURN_ALL, p_ptr->lev);
1654 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1657 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1660 confuse_monsters(p_ptr->lev * 2);
1663 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1666 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1669 project(0, 0, py, px,
1670 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1673 dispel_monsters(randint1(p_ptr->lev * 3));
1674 dispel_evil(randint1(p_ptr->lev * 3));
1681 earthquake(py, px, 10);
1684 stasis_monsters(p_ptr->lev * 4);
1687 dispel_monsters(randint1(p_ptr->lev * 3));
1690 hp_player(damroll(15,10));
1694 case MUSIC_DETECT+19:
1696 case MUSIC_DETECT+11:
1697 case MUSIC_DETECT+12:
1698 case MUSIC_DETECT+13:
1699 case MUSIC_DETECT+14:
1700 case MUSIC_DETECT+15:
1701 case MUSIC_DETECT+16:
1702 case MUSIC_DETECT+17:
1703 case MUSIC_DETECT+18:
1704 map_area(DETECT_RAD_MAP);
1705 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1706 case MUSIC_DETECT+6:
1707 case MUSIC_DETECT+7:
1708 case MUSIC_DETECT+8:
1709 case MUSIC_DETECT+9:
1710 case MUSIC_DETECT+10:
1711 /* There are too many hidden treasure. So... */
1712 /* detect_treasure(DETECT_RAD_DEFAULT); */
1713 detect_objects_gold(DETECT_RAD_DEFAULT);
1714 detect_objects_normal(DETECT_RAD_DEFAULT);
1715 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1716 case MUSIC_DETECT+3:
1717 case MUSIC_DETECT+4:
1718 case MUSIC_DETECT+5:
1719 detect_monsters_invis(DETECT_RAD_DEFAULT);
1720 detect_monsters_normal(DETECT_RAD_DEFAULT);
1721 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1723 case MUSIC_DETECT+1:
1724 case MUSIC_DETECT+2:
1725 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1726 detect_doors(DETECT_RAD_DEFAULT);
1727 detect_stairs(DETECT_RAD_DEFAULT);
1728 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1734 * If player has inscribed the object with "!!", let him know when it's
1737 static void recharged_notice(object_type *o_ptr)
1739 char o_name[MAX_NLEN];
1743 /* No inscription */
1744 if (!o_ptr->inscription) return;
1747 s = my_strchr(quark_str(o_ptr->inscription), '!');
1749 /* Process notification request. */
1752 /* Find another '!' */
1755 /* Describe (briefly) */
1756 object_desc(o_name, o_ptr, FALSE, 0);
1758 /* Notify the player */
1760 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1762 if (o_ptr->number > 1)
1763 msg_format("Your %s are recharged.", o_name);
1765 msg_format("Your %s is recharged.", o_name);
1774 /* Keep looking for '!'s */
1775 s = my_strchr(s + 1, '!');
1780 static void check_music(void)
1786 /* Music singed by player */
1787 if (p_ptr->pclass != CLASS_BARD) return;
1788 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1790 spell = p_ptr->magic_num2[0];
1791 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1793 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1794 need_mana *= 0x8000;
1795 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1802 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1803 need_mana = (need_mana & 0xffff);
1804 if ((u32b)p_ptr->csp_frac < need_mana)
1807 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1811 p_ptr->csp_frac -= (u16b)need_mana;
1814 p_ptr->redraw |= PR_MANA;
1815 if (p_ptr->magic_num1[1])
1817 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1818 p_ptr->magic_num1[1] = 0;
1820 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1822 msg_print("You restart singing.");
1824 p_ptr->action = ACTION_SING;
1826 /* Recalculate bonuses */
1827 p_ptr->update |= (PU_BONUS | PU_HP);
1829 /* Redraw map and status bar */
1830 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1832 /* Update monsters */
1833 p_ptr->update |= (PU_MONSTERS);
1836 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1839 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1840 p_ptr->spell_exp[spell] += 5;
1841 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1842 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1843 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1844 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1845 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1846 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1848 gere_music(p_ptr->magic_num1[0]);
1851 /* Choose one of items that have cursed flag */
1852 static object_type *choose_cursed_obj_name(u32b flag)
1855 int choices[INVEN_TOTAL-INVEN_RARM];
1858 /* Paranoia -- Player has no warning-item */
1859 if (!(p_ptr->cursed & flag)) return NULL;
1861 /* Search Inventry */
1862 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1864 object_type *o_ptr = &inventory[i];
1866 if (o_ptr->curse_flags & flag)
1868 choices[number] = i;
1873 /* Choice one of them */
1874 return (&inventory[choices[randint0(number)]]);
1879 * Handle certain things once every 10 game turns
1881 static void process_world(void)
1885 bool cave_no_regen = FALSE;
1886 int upkeep_factor = 0;
1891 const int dec_count = (easy_band ? 2 : 1);
1893 int day, hour, min, prev_min;
1895 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1896 s32b tick = turn % len + len / 4;
1898 int quest_num = quest_number(dun_level);
1900 extract_day_hour_min(&day, &hour, &min);
1901 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1903 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1905 !(quest_num && (is_fixed_quest_idx(quest_num) &&
1906 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
1907 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
1908 !p_ptr->inside_battle)
1910 /* Announce feeling */
1913 /* Update the level indicator */
1914 p_ptr->redraw |= (PR_DEPTH);
1917 if (disturb_minor) disturb(0, 0);
1920 if (p_ptr->inside_battle && !p_ptr->leaving)
1927 /* Count all hostile monsters */
1928 for (i2 = 0; i2 < cur_wid; ++i2)
1929 for (j2 = 0; j2 < cur_hgt; j2++)
1930 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1933 win_m_idx = cave[j2][i2].m_idx;
1936 if (number_mon == 0)
1939 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1941 msg_print("They have kill each other at the same time.");
1944 p_ptr->energy_need = 0;
1947 else if ((number_mon-1) == 0)
1950 monster_type *wm_ptr;
1952 wm_ptr = &m_list[win_m_idx];
1954 monster_desc(m_name, wm_ptr, 0);
1956 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1958 msg_format("%s is winner!", m_name);
1962 if (win_m_idx == (sel_monster+1))
1965 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1967 msg_print("Congratulations.");
1970 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1972 msg_format("You received %d gold.", battle_odds);
1974 p_ptr->au += battle_odds;
1979 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1981 msg_print("You lost gold.");
1985 p_ptr->energy_need = 0;
1988 else if(turn - old_turn == 150*TURNS_PER_TICK)
1991 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
1993 msg_format("This battle have ended in a draw.");
1995 p_ptr->au += kakekin;
1997 p_ptr->energy_need = 0;
2002 /* Every 10 game turns */
2003 if (turn % TURNS_PER_TICK) return;
2005 /*** Check the Time and Load ***/
2007 if (!(turn % (50*TURNS_PER_TICK)))
2009 /* Check time and load */
2010 if ((0 != check_time()) || (0 != check_load()))
2013 if (closing_flag <= 2)
2018 /* Count warnings */
2023 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2024 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2026 msg_print("The gates to ANGBAND are closing...");
2027 msg_print("Please finish up and/or save your game.");
2037 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2039 msg_print("The gates to ANGBAND are now closed.");
2044 p_ptr->playing = FALSE;
2047 p_ptr->leaving = TRUE;
2052 /*** Attempt timed autosave ***/
2053 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2055 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2056 do_cmd_save_game(TRUE);
2062 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2064 msg_print("You hear noise.");
2068 /*** Handle the wilderness/town (sunshine) ***/
2070 /* While in town/wilderness */
2071 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2073 /* Hack -- Daybreak/Nighfall in town */
2074 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2078 /* Check for dawn */
2079 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2086 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2088 msg_print("The sun has risen.");
2091 /* Hack -- Scan the town */
2092 for (y = 0; y < cur_hgt; y++)
2094 for (x = 0; x < cur_wid; x++)
2096 /* Get the cave grid */
2097 c_ptr = &cave[y][x];
2100 c_ptr->info |= (CAVE_GLOW);
2102 /* Hack -- Memorize lit grids if allowed */
2103 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2105 /* Hack -- Notice spot */
2118 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2120 msg_print("The sun has fallen.");
2123 /* Hack -- Scan the town */
2124 for (y = 0; y < cur_hgt; y++)
2126 for (x = 0; x < cur_wid; x++)
2128 /* Get the cave grid */
2129 c_ptr = &cave[y][x];
2131 /* Feature code (applying "mimic" field) */
2132 feat = get_feat_mimic(c_ptr);
2134 if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
2137 c_ptr->info &= ~(CAVE_GLOW);
2139 if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
2141 /* Forget the normal floor grid */
2142 c_ptr->info &= ~(CAVE_MARK);
2144 /* Hack -- Notice spot */
2150 /* Glow deep lava and building entrances */
2151 glow_deep_lava_and_bldg();
2155 /* Update the monsters */
2156 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2159 p_ptr->redraw |= (PR_MAP);
2162 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2166 /* While in the dungeon (vanilla_town or lite_town mode only) */
2167 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
2169 /*** Shuffle the Storekeepers ***/
2171 /* Chance is only once a day (while in dungeon) */
2172 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
2174 /* Sometimes, shuffle the shop-keepers */
2175 if (one_in_(STORE_SHUFFLE))
2179 /* Pick a random shop (except home) */
2182 n = randint0(MAX_STORES);
2184 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2188 if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_info[FEAT_SHOP_HEAD + n].name);
2190 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_info[FEAT_SHOP_HEAD + n].name);
2200 /*** Process the monsters ***/
2202 /* Check for creature generation. */
2203 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2204 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2206 /* Make a new monster */
2207 (void)alloc_monster(MAX_SIGHT + 5, 0);
2210 /* Hack -- Check for creature regeneration */
2211 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2212 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2214 /* Hack -- Process the counters of all monsters */
2215 process_monsters_counters();
2218 /*** Damage over Time ***/
2220 /* Take damage from poison */
2221 if (p_ptr->poisoned && !IS_INVULN())
2225 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2227 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2233 /* (Vampires) Take damage from sunlight */
2234 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2236 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2238 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2242 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2243 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2245 msg_print("The sun's rays scorch your undead flesh!");
2246 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2249 cave_no_regen = TRUE;
2253 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2254 !p_ptr->resist_lite)
2256 object_type * o_ptr = &inventory[INVEN_LITE];
2257 char o_name [MAX_NLEN];
2258 char ouch [MAX_NLEN+40];
2260 /* Get an object description */
2261 object_desc(o_name, o_ptr, FALSE, 0);
2264 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2266 msg_format("The %s scorches your undead flesh!", o_name);
2270 cave_no_regen = TRUE;
2272 /* Get an object description */
2273 object_desc(o_name, o_ptr, TRUE, 0);
2276 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2278 sprintf(ouch, "wielding %s", o_name);
2281 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2285 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2286 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2288 int damage = 3000 + randint0(2000);
2290 if (prace_is_(RACE_ENT)) damage += damage/3;
2291 if (p_ptr->resist_fire) damage = damage / 3;
2292 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2293 damage = damage / 100 + (randint0(100) < (damage % 100));
2299 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2300 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2302 msg_print("The lava burns you!");
2303 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2306 cave_no_regen = TRUE;
2310 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2311 !IS_INVULN() && !p_ptr->immune_fire)
2313 int damage = 6000 + randint0(4000);
2318 if (p_ptr->resist_fire) damage = damage / 3;
2319 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2323 damage = damage / 5;
2326 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2327 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2329 message = "The heat burns you!";
2330 hit_from = "flying over deep lava";
2337 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2338 hit_from = "¿¼¤¤ÍÏ´äή";
2340 message = "The lava burns you!";
2341 hit_from = "deep lava";
2346 damage = damage / 100 + (randint0(100) < (damage % 100));
2351 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2353 cave_no_regen = TRUE;
2357 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2359 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2363 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2364 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2366 msg_print("You are drowning!");
2367 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2370 cave_no_regen = TRUE;
2377 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2379 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2380 if (prace_is_(RACE_ENT)) damage += damage / 3;
2381 if (p_ptr->resist_fire) damage = damage / 3;
2382 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2384 msg_print("Ç®¤¤¡ª");
2385 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2387 msg_print("It's hot!");
2388 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2391 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2393 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2394 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2395 if (p_ptr->resist_elec) damage = damage / 3;
2396 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2398 msg_print("Äˤ¤¡ª");
2399 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2401 msg_print("It hurts!");
2402 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2405 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2407 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2408 if (p_ptr->resist_cold) damage = damage / 3;
2409 if (IS_OPPOSE_COLD()) damage = damage / 3;
2411 msg_print("Î䤿¤¤¡ª");
2412 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2414 msg_print("It's cold!");
2415 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2420 /* Spectres -- take damage when moving through walls */
2422 * Added: ANYBODY takes damage if inside through walls
2423 * without wraith form -- NOTE: Spectres will never be
2424 * reduced below 0 hp by being inside a stone wall; others
2427 if (!cave_floor_bold(py, px))
2429 /* Player can walk through trees */
2430 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2434 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2435 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2439 cave_no_regen = TRUE;
2441 if (p_ptr->pass_wall)
2444 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2447 msg_print("Your molecules feel disrupted!");
2448 dam_desc = "density";
2455 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2456 dam_desc = "¹Å¤¤´ä";
2458 msg_print("You are being crushed!");
2459 dam_desc = "solid rock";
2464 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2470 if (min != prev_min)
2472 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2473 determine_today_mon(FALSE);
2477 /* Nightmare mode activates the TY_CURSE at midnight */
2478 if (ironman_nightmare)
2480 /* Require exact minute */
2481 if (min != prev_min)
2483 /* Every 15 minutes after 11:00 pm */
2484 if ((hour == 23) && !(min % 15))
2494 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2496 msg_print("You hear a distant bell toll ominously.");
2504 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2506 msg_print("A distant bell sounds twice.");
2514 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2516 msg_print("A distant bell sounds three times.");
2524 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2526 msg_print("A distant bell tolls four times.");
2534 /* TY_CURSE activates at mignight! */
2541 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2543 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2546 activate_ty_curse(FALSE, &count);
2551 /* Take damage from cuts */
2552 if (p_ptr->cut && !IS_INVULN())
2554 /* Mortal wound or Deep Gash */
2555 if (p_ptr->cut > 1000)
2560 else if (p_ptr->cut > 200)
2566 else if (p_ptr->cut > 100)
2571 else if (p_ptr->cut > 50)
2576 else if (p_ptr->cut > 25)
2581 else if (p_ptr->cut > 10)
2594 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2596 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2602 /*** Check the Food, and Regenerate ***/
2604 if (!p_ptr->inside_battle)
2606 /* Digest normally */
2607 if (p_ptr->food < PY_FOOD_MAX)
2609 /* Every 50 game turns */
2610 if (!(turn % (TURNS_PER_TICK*5)))
2612 /* Basic digestion rate based on speed */
2613 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2615 /* Regeneration takes more food */
2616 if (p_ptr->regenerate) i += 20;
2617 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2618 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2620 /* Slow digestion takes less food */
2621 if (p_ptr->slow_digest) i -= 5;
2623 /* Minimal digestion */
2625 /* Maximal digestion */
2626 if (i > 100) i = 100;
2628 /* Digest some food */
2629 (void)set_food(p_ptr->food - i);
2633 /* Digest quickly when gorged */
2636 /* Digest a lot of food */
2637 (void)set_food(p_ptr->food - 100);
2641 /* Starve to death (slowly) */
2642 if (p_ptr->food < PY_FOOD_STARVE)
2644 /* Calculate damage */
2645 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2649 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2651 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2656 /* Default regeneration */
2657 regen_amount = PY_REGEN_NORMAL;
2660 if (p_ptr->food < PY_FOOD_WEAK)
2662 /* Lower regeneration */
2663 if (p_ptr->food < PY_FOOD_STARVE)
2667 else if (p_ptr->food < PY_FOOD_FAINT)
2669 regen_amount = PY_REGEN_FAINT;
2673 regen_amount = PY_REGEN_WEAK;
2677 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2679 /* Faint occasionally */
2680 if (!p_ptr->paralyzed && (randint0(100) < 10))
2684 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2686 msg_print("You faint from the lack of food.");
2691 /* Hack -- faint (bypass free action) */
2692 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2698 /* Are we walking the pattern? */
2699 if (pattern_effect())
2701 cave_no_regen = TRUE;
2705 /* Regeneration ability */
2706 if (p_ptr->regenerate)
2708 regen_amount = regen_amount * 2;
2710 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2714 if (p_ptr->cursed & TRC_SLOW_REGEN)
2721 /* Searching or Resting */
2722 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2724 regen_amount = regen_amount * 2;
2727 upkeep_factor = calculate_upkeep();
2729 /* Regenerate the mana */
2730 /* if (p_ptr->csp < p_ptr->msp) */
2734 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2735 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2736 regenmana(upkeep_regen/100);
2738 #ifdef TRACK_FRIENDS
2742 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2744 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2748 #endif /* TRACK_FRIENDS */
2751 else if (p_ptr->action != ACTION_LEARN)
2753 regenmana(regen_amount);
2756 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2758 regenmagic(regen_amount);
2761 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2763 while (upkeep_factor > 100)
2766 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2768 msg_print("Such much pets cannot be controled at once!");
2771 do_cmd_pet_dismiss();
2773 upkeep_factor = calculate_upkeep();
2776 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2778 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2784 /* Poisoned or cut yields no healing */
2785 if (p_ptr->poisoned) regen_amount = 0;
2786 if (p_ptr->cut) regen_amount = 0;
2788 /* Special floor -- Pattern, in a wall -- yields no healing */
2789 if (cave_no_regen) regen_amount = 0;
2791 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2793 /* Regenerate Hit Points if needed */
2794 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2796 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2797 (cave[py][px].feat >= FEAT_PATTERN_START))
2799 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2803 regenhp(regen_amount);
2808 /*** Timeout Various Things ***/
2811 if (p_ptr->tim_mimic)
2813 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2816 /* Hack -- Hallucinating */
2819 (void)set_image(p_ptr->image - dec_count);
2825 (void)set_blind(p_ptr->blind - dec_count);
2828 /* Times see-invisible */
2829 if (p_ptr->tim_invis)
2831 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2842 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2845 /* Timed temporary elemental brands. -LM- */
2846 if (p_ptr->ele_attack)
2848 p_ptr->ele_attack--;
2850 /* Clear all temporary elemental brands. */
2851 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2854 /* Timed temporary elemental immune. -LM- */
2855 if (p_ptr->ele_immune)
2857 p_ptr->ele_immune--;
2859 /* Clear all temporary elemental brands. */
2860 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2863 /* Timed infra-vision */
2864 if (p_ptr->tim_infra)
2866 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2870 if (p_ptr->tim_stealth)
2872 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2875 /* Timed levitation */
2876 if (p_ptr->tim_ffall)
2878 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2881 /* Timed sh_touki */
2882 if (p_ptr->tim_sh_touki)
2884 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2888 if (p_ptr->tim_sh_fire)
2890 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2894 if (p_ptr->tim_sh_holy)
2896 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2900 if (p_ptr->tim_eyeeye)
2902 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2905 /* Timed resist-magic */
2906 if (p_ptr->resist_magic)
2908 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2911 /* Timed regeneration */
2912 if (p_ptr->tim_regen)
2914 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2917 /* Timed resist nether */
2918 if (p_ptr->tim_res_nether)
2920 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2923 /* Timed resist time */
2924 if (p_ptr->tim_res_time)
2926 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2930 if (p_ptr->tim_reflect)
2932 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2936 if (p_ptr->multishadow)
2938 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2941 /* Timed Robe of dust */
2942 if (p_ptr->dustrobe)
2944 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2947 /* Timed infra-vision */
2948 if (p_ptr->kabenuke)
2950 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2954 if (p_ptr->paralyzed)
2956 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2960 if (p_ptr->confused)
2962 (void)set_confused(p_ptr->confused - dec_count);
2968 (void)set_afraid(p_ptr->afraid - dec_count);
2974 (void)set_fast(p_ptr->fast - 1, TRUE);
2980 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2983 /* Protection from evil */
2984 if (p_ptr->protevil)
2986 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2989 /* Invulnerability */
2992 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2996 if (p_ptr->wraith_form)
2998 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3004 (void)set_hero(p_ptr->hero - 1, TRUE);
3010 (void)set_shero(p_ptr->shero - 1, TRUE);
3016 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3022 (void)set_shield(p_ptr->shield - 1, TRUE);
3026 if (p_ptr->tsubureru)
3028 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3032 if (p_ptr->magicdef)
3034 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3038 if (p_ptr->tsuyoshi)
3040 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3044 if (p_ptr->oppose_acid)
3046 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3049 /* Oppose Lightning */
3050 if (p_ptr->oppose_elec)
3052 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3056 if (p_ptr->oppose_fire)
3058 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3062 if (p_ptr->oppose_cold)
3064 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3068 if (p_ptr->oppose_pois)
3070 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3075 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3078 /*** Poison and Stun and Cut ***/
3081 if (p_ptr->poisoned)
3083 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3085 /* Apply some healing */
3086 (void)set_poisoned(p_ptr->poisoned - adjust);
3092 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3094 /* Apply some healing */
3095 (void)set_stun(p_ptr->stun - adjust);
3101 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3103 /* Hack -- Truly "mortal" wound */
3104 if (p_ptr->cut > 1000) adjust = 0;
3106 /* Apply some healing */
3107 (void)set_cut(p_ptr->cut - adjust);
3112 /*** Process Light ***/
3114 /* Check for light being wielded */
3115 o_ptr = &inventory[INVEN_LITE];
3117 /* Burn some fuel in the current lite */
3118 if (o_ptr->tval == TV_LITE)
3120 /* Hack -- Use some fuel (except on artifacts) */
3121 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3123 /* Decrease life-span */
3124 if (o_ptr->name2 == EGO_LITE_LONG)
3126 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3128 else o_ptr->xtra4--;
3130 /* Notice interesting fuel steps */
3131 notice_lite_change(o_ptr);
3135 /* Calculate torch radius */
3136 p_ptr->update |= (PU_TORCH);
3139 /*** Process mutation effects ***/
3140 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3142 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3146 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3147 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3149 msg_print("RAAAAGHH!");
3150 msg_print("You feel a fit of rage coming over you!");
3153 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3156 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3158 if (!p_ptr->resist_fear)
3162 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3164 msg_print("It's so dark... so scary!");
3167 set_afraid(p_ptr->afraid + 13 + randint1(26));
3171 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3173 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3178 /* Teleport player */
3180 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3182 msg_print("Your position suddenly seems very uncertain...");
3186 teleport_player(40);
3190 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3192 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3195 p_ptr->redraw |= PR_EXTRA;
3197 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3199 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3204 if (!p_ptr->resist_conf)
3206 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3209 if (!p_ptr->resist_chaos)
3214 if (one_in_(3)) lose_all_info();
3216 teleport_player(100);
3219 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3220 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3222 msg_print("You wake up somewhere with a sore head...");
3223 msg_print("You can't remember a thing, or how you got here!");
3232 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3234 msg_print("Thishcischs GooDSChtuff!");
3237 (void)set_image(p_ptr->image + randint0(150) + 150);
3243 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3245 if (!p_ptr->resist_chaos)
3248 p_ptr->redraw |= PR_EXTRA;
3249 (void)set_image(p_ptr->image + randint0(50) + 20);
3253 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3258 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3260 msg_print("BRRAAAP! Oops.");
3264 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3267 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3268 !p_ptr->anti_magic && one_in_(9000))
3273 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3275 msg_print("Magical energy flows through you! You must release it!");
3280 (void)get_hack_dir(&dire);
3281 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3284 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3285 !p_ptr->anti_magic && (randint1(6666) == 666))
3287 bool pet = one_in_(6);
3288 u32b mode = PM_ALLOW_GROUP;
3290 if (pet) mode |= PM_FORCE_PET;
3291 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3293 if (summon_specific((pet ? -1 : 0), py, px,
3294 dun_level, SUMMON_DEMON, mode))
3297 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3299 msg_print("You have attracted a demon!");
3306 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3312 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3314 msg_print("You feel less energetic.");
3317 if (p_ptr->fast > 0)
3323 set_slow(randint1(30) + 10, FALSE);
3329 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3331 msg_print("You feel more energetic.");
3334 if (p_ptr->slow > 0)
3340 set_fast(randint1(30) + 10, FALSE);
3345 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3349 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3351 msg_print("You suddenly feel almost lonely.");
3354 banish_monsters(100);
3355 if (!dun_level && p_ptr->town_num)
3359 /* Pick a random shop (except home) */
3362 n = randint0(MAX_STORES);
3364 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3367 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3369 msg_print("You see one of the shopkeepers running for the hills!");
3377 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3382 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3384 msg_print("A shadow passes over you.");
3389 /* Absorb light from the current possition */
3390 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
3395 o_ptr = &inventory[INVEN_LITE];
3397 /* Absorb some fuel in the current lite */
3398 if (o_ptr->tval == TV_LITE)
3400 /* Use some fuel (except on artifacts) */
3401 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3403 /* Heal the player a bit */
3404 hp_player(o_ptr->xtra4 / 20);
3406 /* Decrease life-span of lite */
3410 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3412 msg_print("You absorb energy from your light!");
3416 /* Notice interesting fuel steps */
3417 notice_lite_change(o_ptr);
3422 * Unlite the area (radius 10) around player and
3423 * do 50 points damage to every affected monster
3425 unlite_area(50, 10);
3428 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3429 !p_ptr->anti_magic && one_in_(7000))
3431 bool pet = one_in_(3);
3432 u32b mode = PM_ALLOW_GROUP;
3434 if (pet) mode |= PM_FORCE_PET;
3435 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3437 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3440 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3442 msg_print("You have attracted an animal!");
3449 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3450 !p_ptr->anti_magic && one_in_(8000))
3454 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3456 msg_print("You feel the world warping around you!");
3460 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3462 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3464 if (!lose_mutation(0))
3466 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3468 msg_print("You feel oddly normal.");
3472 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3476 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3478 msg_print("You feel insubstantial!");
3482 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3484 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3488 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3490 int which_stat = randint0(6);
3491 int sustained = FALSE;
3496 if (p_ptr->sustain_str) sustained = TRUE;
3499 if (p_ptr->sustain_int) sustained = TRUE;
3502 if (p_ptr->sustain_wis) sustained = TRUE;
3505 if (p_ptr->sustain_dex) sustained = TRUE;
3508 if (p_ptr->sustain_con) sustained = TRUE;
3511 if (p_ptr->sustain_chr) sustained = TRUE;
3515 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3517 msg_print("Invalid stat chosen!");
3527 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3529 msg_print("You can feel yourself wasting away!");
3533 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3536 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3537 !p_ptr->anti_magic && one_in_(3000))
3539 bool pet = one_in_(5);
3540 u32b mode = PM_ALLOW_GROUP;
3542 if (pet) mode |= PM_FORCE_PET;
3543 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3545 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3548 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3550 msg_print("You have attracted a dragon!");
3556 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3559 if (p_ptr->tim_esp > 0)
3562 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3564 msg_print("Your mind feels cloudy!");
3567 set_tim_esp(0, TRUE);
3572 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3574 msg_print("Your mind expands!");
3577 set_tim_esp(p_ptr->lev, FALSE);
3580 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3585 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3587 msg_print("Your stomach roils, and you lose your lunch!");
3591 set_food(PY_FOOD_WEAK);
3594 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3595 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3600 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3602 int danger_amount = 0;
3605 for (monster = 0; monster < m_max; monster++)
3607 monster_type *m_ptr = &m_list[monster];
3608 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3610 /* Paranoia -- Skip dead monsters */
3611 if (!m_ptr->r_idx) continue;
3613 if (r_ptr->level >= p_ptr->lev)
3615 danger_amount += r_ptr->level - p_ptr->lev + 1;
3619 if (danger_amount > 100)
3621 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3623 msg_print("You feel utterly terrified!");
3626 else if (danger_amount > 50)
3628 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3630 msg_print("You feel terrified!");
3633 else if (danger_amount > 20)
3635 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3637 msg_print("You feel very worried!");
3640 else if (danger_amount > 10)
3642 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3644 msg_print("You feel paranoid!");
3647 else if (danger_amount > 5)
3649 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3651 msg_print("You feel almost safe.");
3656 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3658 msg_print("You feel lonely.");
3662 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3667 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3669 msg_print("You feel invincible!");
3673 (void)set_invuln(randint1(8) + 8, FALSE);
3675 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3677 int wounds = p_ptr->mhp - p_ptr->chp;
3681 int healing = p_ptr->csp;
3683 if (healing > wounds)
3689 p_ptr->csp -= healing;
3692 p_ptr->redraw |= (PR_MANA);
3695 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3698 int wounds = p_ptr->msp - p_ptr->csp;
3702 int healing = p_ptr->chp;
3704 if (healing > wounds)
3709 p_ptr->csp += healing;
3712 p_ptr->redraw |= (PR_MANA);
3714 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3716 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3721 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3727 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3728 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3730 msg_print("You trip over your own feet!");
3731 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3736 if (buki_motteruka(INVEN_RARM))
3738 int slot = INVEN_RARM;
3739 o_ptr = &inventory[INVEN_RARM];
3740 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3742 o_ptr = &inventory[INVEN_LARM];
3745 if (!cursed_p(o_ptr))
3748 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3750 msg_print("You drop your weapon!");
3753 inven_drop(slot, 1);
3760 /*** Process Inventory ***/
3762 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3765 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3766 * can actually be useful!
3768 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3771 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3773 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3777 teleport_player(50);
3780 /* Make a chainsword noise */
3781 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3785 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3787 if (!get_rnd_line("chainswd.txt", 0, noise))
3790 disturb(FALSE, FALSE);
3793 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3796 (void)activate_ty_curse(FALSE, &count);
3798 /* Handle experience draining */
3799 if (p_ptr->prace != RACE_ANDROID &&
3800 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3802 p_ptr->exp -= (p_ptr->lev+1)/2;
3803 if (p_ptr->exp < 0) p_ptr->exp = 0;
3804 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3805 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3808 /* Add light curse (Later) */
3809 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3814 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3816 new_curse = get_curse(0, o_ptr);
3817 if (!(o_ptr->curse_flags & new_curse))
3819 char o_name[MAX_NLEN];
3821 object_desc(o_name, o_ptr, FALSE, 0);
3823 o_ptr->curse_flags |= new_curse;
3825 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3827 msg_format("There is a malignant black aura surrounding %s...", o_name);
3830 o_ptr->feeling = FEEL_NONE;
3832 p_ptr->update |= (PU_BONUS);
3835 /* Add heavy curse (Later) */
3836 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3841 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3843 new_curse = get_curse(1, o_ptr);
3844 if (!(o_ptr->curse_flags & new_curse))
3846 char o_name[MAX_NLEN];
3848 object_desc(o_name, o_ptr, FALSE, 0);
3850 o_ptr->curse_flags |= new_curse;
3852 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3854 msg_format("There is a malignant black aura surrounding %s...", o_name);
3857 o_ptr->feeling = FEEL_NONE;
3859 p_ptr->update |= (PU_BONUS);
3863 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3865 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3866 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3868 char o_name[MAX_NLEN];
3870 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3872 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3874 msg_format("%s have attracted an animal!", o_name);
3881 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3883 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3885 char o_name[MAX_NLEN];
3887 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3889 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3891 msg_format("%s have attracted a demon!", o_name);
3898 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3900 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3901 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3903 char o_name[MAX_NLEN];
3905 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3907 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3909 msg_format("%s have attracted an animal!", o_name);
3915 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3917 if (!p_ptr->resist_fear)
3921 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3923 msg_print("It's so dark... so scary!");
3926 set_afraid(p_ptr->afraid + 13 + randint1(26));
3929 /* Teleport player */
3930 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3934 /* Teleport player */
3935 teleport_player(40);
3937 /* Handle HP draining */
3938 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3940 char o_name[MAX_NLEN];
3942 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3944 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3946 msg_format("%s drains HP from you!", o_name);
3948 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3950 /* Handle mana draining */
3951 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3953 char o_name[MAX_NLEN];
3955 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3957 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3959 msg_format("%s drains mana from you!", o_name);
3961 p_ptr->csp -= MIN(p_ptr->lev, 50);
3965 p_ptr->csp_frac = 0;
3967 p_ptr->redraw |= PR_MANA;
3971 /* Rarely, take damage from the Jewel of Judgement */
3972 if (one_in_(999) && !p_ptr->anti_magic)
3974 object_type *o_ptr = &inventory[INVEN_LITE];
3976 if (o_ptr->name1 == ART_JUDGE)
3979 if (object_known_p(o_ptr))
3980 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3982 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3983 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3985 if (object_known_p(o_ptr))
3986 msg_print("The Jewel of Judgement drains life from you!");
3988 msg_print("Something drains life from you!");
3989 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3995 /* Process equipment */
3996 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3998 /* Get the object */
3999 o_ptr = &inventory[i];
4001 /* Skip non-objects */
4002 if (!o_ptr->k_idx) continue;
4004 /* Recharge activatable objects */
4005 if (o_ptr->timeout > 0)
4010 /* Notice changes */
4011 if (!o_ptr->timeout)
4013 recharged_notice(o_ptr);
4019 /* Notice changes */
4023 p_ptr->window |= (PW_EQUIP);
4028 * Recharge rods. Rods now use timeout to control charging status,
4029 * and each charging rod in a stack decreases the stack's timeout by
4030 * one per turn. -LM-
4032 for (j = 0, i = 0; i < INVEN_PACK; i++)
4034 o_ptr = &inventory[i];
4035 k_ptr = &k_info[o_ptr->k_idx];
4037 /* Skip non-objects */
4038 if (!o_ptr->k_idx) continue;
4040 /* Examine all charging rods or stacks of charging rods. */
4041 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4043 /* Determine how many rods are charging. */
4044 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4045 if (temp > o_ptr->number) temp = o_ptr->number;
4047 /* Decrease timeout by that number. */
4048 o_ptr->timeout -= temp;
4050 /* Boundary control. */
4051 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4053 /* Notice changes, provide message if object is inscribed. */
4054 if (!(o_ptr->timeout))
4056 recharged_notice(o_ptr);
4062 /* Notice changes */
4066 p_ptr->notice |= (PN_COMBINE);
4069 p_ptr->window |= (PW_INVEN);
4073 /* Feel the inventory */
4078 /*** Process Objects ***/
4080 /* Process objects */
4081 for (i = 1; i < o_max; i++)
4086 /* Skip dead objects */
4087 if (!o_ptr->k_idx) continue;
4089 /* Recharge rods on the ground. No messages. */
4090 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4093 o_ptr->timeout -= o_ptr->number;
4095 /* Boundary control. */
4096 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4101 /*** Involuntary Movement ***/
4103 /* Delayed Word-of-Recall */
4104 if (p_ptr->word_recall)
4107 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4108 * The player is yanked up/down as soon as
4109 * he loads the autosaved game.
4111 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4112 do_cmd_save_game(TRUE);
4114 /* Count down towards recall */
4115 p_ptr->word_recall--;
4117 p_ptr->redraw |= (PR_STATUS);
4119 /* Activate the recall */
4120 if (!p_ptr->word_recall)
4125 /* Determine the level */
4126 if (dun_level || p_ptr->inside_quest)
4129 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4131 msg_print("You feel yourself yanked upwards!");
4134 p_ptr->recall_dungeon = dungeon_type;
4136 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4141 leave_quest_check();
4143 p_ptr->inside_quest = 0;
4145 p_ptr->leaving = TRUE;
4150 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4152 msg_print("You feel yourself yanked downwards!");
4155 dungeon_type = p_ptr->recall_dungeon;
4158 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4161 dun_level = max_dlv[dungeon_type];
4162 if (dun_level < 1) dun_level = 1;
4164 /* Nightmare mode makes recall more dangerous */
4165 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4171 else if (dun_level < 99)
4173 dun_level = (dun_level + 99) / 2;
4175 else if (dun_level > 100)
4177 dun_level = d_info[dungeon_type].maxdepth - 1;
4181 if (p_ptr->wild_mode)
4183 p_ptr->wilderness_y = py;
4184 p_ptr->wilderness_x = px;
4188 /* Save player position */
4192 p_ptr->wild_mode = FALSE;
4195 p_ptr->leaving = TRUE;
4197 if (dungeon_type == DUNGEON_ANGBAND)
4199 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4201 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4202 (quest[i].status == QUEST_STATUS_TAKEN) &&
4203 (quest[i].level < dun_level))
4205 quest[i].status = QUEST_STATUS_FAILED;
4206 quest[i].complev = (byte)p_ptr->lev;
4207 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4214 sound(SOUND_TPLEVEL);
4219 /* Delayed Alter reality */
4220 if (p_ptr->alter_reality)
4222 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4223 do_cmd_save_game(TRUE);
4225 /* Count down towards alter */
4226 p_ptr->alter_reality--;
4228 p_ptr->redraw |= (PR_STATUS);
4230 /* Activate the alter reality */
4231 if (!p_ptr->alter_reality)
4236 /* Determine the level */
4237 if (!quest_number(dun_level) && dun_level)
4240 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4242 msg_print("The world changes!");
4246 p_ptr->leaving = TRUE;
4251 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4253 msg_print("The world seems to change for a moment!");
4258 sound(SOUND_TPLEVEL);
4266 * Verify use of "wizard" mode
4268 static bool enter_wizard_mode(void)
4270 /* Ask first time */
4271 if (!p_ptr->noscore)
4273 /* Wizard mode is not permitted */
4274 if (!allow_debug_opts)
4277 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4279 msg_print("Wizard mode is not permitted.");
4284 /* Mention effects */
4286 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4287 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4289 msg_print("Wizard mode is for debugging and experimenting.");
4290 msg_print("The game will not be scored if you enter wizard mode.");
4295 /* Verify request */
4297 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4299 if (!get_check("Are you sure you want to enter wizard mode? "))
4306 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4308 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4311 p_ptr->noscore |= 0x0002;
4322 * Verify use of "debug" commands
4324 static bool enter_debug_mode(void)
4326 /* Ask first time */
4327 if (!p_ptr->noscore)
4329 /* Debug mode is not permitted */
4330 if (!allow_debug_opts)
4333 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4335 msg_print("Use of debug command is not permitted.");
4340 /* Mention effects */
4342 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4343 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4345 msg_print("The debug commands are for debugging and experimenting.");
4346 msg_print("The game will not be scored if you use debug commands.");
4351 /* Verify request */
4353 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4355 if (!get_check("Are you sure you want to use debug commands? "))
4362 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4364 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4367 p_ptr->noscore |= 0x0008;
4375 * Hack -- Declare the Debug Routines
4377 extern void do_cmd_debug(void);
4379 #endif /* ALLOW_WIZARD */
4385 * Verify use of "borg" commands
4387 static bool enter_borg_mode(void)
4389 /* Ask first time */
4390 if (!(p_ptr->noscore & 0x0010))
4392 /* Mention effects */
4394 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4395 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4397 msg_print("The borg commands are for debugging and experimenting.");
4398 msg_print("The game will not be scored if you use borg commands.");
4403 /* Verify request */
4405 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4407 if (!get_check("Are you sure you want to use borg commands? "))
4414 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4416 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4419 p_ptr->noscore |= 0x0010;
4427 * Hack -- Declare the Ben Borg
4429 extern void do_cmd_borg(void);
4431 #endif /* ALLOW_BORG */
4436 * Parse and execute the current command
4437 * Give "Warning" on illegal commands.
4439 * XXX XXX XXX Make some "blocks"
4441 static void process_command(void)
4443 int old_now_message = now_message;
4445 #ifdef ALLOW_REPEAT /* TNB */
4447 /* Handle repeating the last command */
4450 #endif /* ALLOW_REPEAT -- TNB */
4454 /* Parse the command */
4455 switch (command_cmd)
4471 /*** Wizard Commands ***/
4473 /* Toggle Wizard Mode */
4478 p_ptr->wizard = FALSE;
4480 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4482 msg_print("Wizard mode off.");
4486 else if (enter_wizard_mode())
4488 p_ptr->wizard = TRUE;
4490 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4492 msg_print("Wizard mode on.");
4497 /* Update monsters */
4498 p_ptr->update |= (PU_MONSTERS);
4500 /* Redraw "title" */
4501 p_ptr->redraw |= (PR_TITLE);
4509 /* Special "debug" commands */
4512 /* Enter debug mode */
4513 if (enter_debug_mode())
4520 #endif /* ALLOW_WIZARD */
4525 /* Special "borg" commands */
4528 /* Enter borg mode */
4529 if (enter_borg_mode())
4531 if (!p_ptr->wild_mode) do_cmd_borg();
4537 #endif /* ALLOW_BORG */
4541 /*** Inventory Commands ***/
4543 /* Wear/wield equipment */
4546 if (!p_ptr->wild_mode) do_cmd_wield();
4550 /* Take off equipment */
4553 if (!p_ptr->wild_mode) do_cmd_takeoff();
4560 if (!p_ptr->wild_mode) do_cmd_drop();
4564 /* Destroy an item */
4571 /* Equipment list */
4578 /* Inventory list */
4586 /*** Various commands ***/
4588 /* Identify an object */
4595 /* Hack -- toggle windows */
4598 toggle_inven_equip();
4603 /*** Standard "Movement" Commands ***/
4608 if (!p_ptr->wild_mode) do_cmd_alter();
4615 if (!p_ptr->wild_mode) do_cmd_tunnel();
4619 /* Move (usually pick up things) */
4622 #ifdef ALLOW_EASY_DISARM /* TNB */
4626 #else /* ALLOW_EASY_DISARM -- TNB */
4628 do_cmd_walk(always_pickup);
4630 #endif /* ALLOW_EASY_DISARM -- TNB */
4635 /* Move (usually do not pick up) */
4638 #ifdef ALLOW_EASY_DISARM /* TNB */
4642 #else /* ALLOW_EASY_DISARM -- TNB */
4644 do_cmd_walk(!always_pickup);
4646 #endif /* ALLOW_EASY_DISARM -- TNB */
4652 /*** Running, Resting, Searching, Staying */
4654 /* Begin Running -- Arg is Max Distance */
4657 if (!p_ptr->wild_mode) do_cmd_run();
4661 /* Stay still (usually pick things up) */
4664 do_cmd_stay(always_pickup);
4668 /* Stay still (usually do not pick up) */
4671 do_cmd_stay(!always_pickup);
4675 /* Rest -- Arg is time */
4682 /* Search for traps/doors */
4689 /* Toggle search mode */
4692 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4693 else set_action(ACTION_SEARCH);
4698 /*** Stairs and Doors and Chests and Traps ***/
4701 case SPECIAL_KEY_STORE:
4703 if (!p_ptr->wild_mode) do_cmd_store();
4707 /* Enter building -KMW- */
4708 case SPECIAL_KEY_BUILDING:
4710 if (!p_ptr->wild_mode) do_cmd_bldg();
4714 /* Enter quest level -KMW- */
4715 case SPECIAL_KEY_QUEST:
4717 if (!p_ptr->wild_mode) do_cmd_quest();
4721 /* Go up staircase */
4724 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4731 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4733 msg_print("To flee the ambush you have to reach the edge of the map.");
4736 else if (p_ptr->food < PY_FOOD_WEAK)
4739 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4741 msg_print("You must eat something here.");
4746 if (change_wild_mode())
4759 /* Go down staircase */
4762 if(!p_ptr->wild_mode) do_cmd_go_down();
4765 p_ptr->wilderness_x = px;
4766 p_ptr->wilderness_y = py;
4772 /* Open a door or chest */
4775 if (!p_ptr->wild_mode) do_cmd_open();
4782 if (!p_ptr->wild_mode) do_cmd_close();
4786 /* Jam a door with spikes */
4789 if (!p_ptr->wild_mode) do_cmd_spike();
4796 if (!p_ptr->wild_mode) do_cmd_bash();
4800 /* Disarm a trap or chest */
4803 if (!p_ptr->wild_mode) do_cmd_disarm();
4808 /*** Magic and Prayers ***/
4810 /* Gain new spells/prayers */
4813 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4815 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4817 msg_print("You don't have to learn spells!");
4819 else if (p_ptr->pclass == CLASS_SAMURAI)
4820 do_cmd_gain_hissatsu();
4821 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4831 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4832 (p_ptr->pclass == CLASS_BERSERKER) ||
4833 (p_ptr->pclass == CLASS_NINJA) ||
4834 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4835 ) do_cmd_mind_browse();
4836 else if (p_ptr->pclass == CLASS_SMITH)
4838 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4839 do_cmd_magic_eater(TRUE);
4840 else do_cmd_browse();
4848 if (!p_ptr->wild_mode)
4850 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4853 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4855 msg_print("You cannot cast spells!");
4858 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4861 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4863 msg_print("The dungeon absorbs all attempted magic!");
4867 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4871 cptr which_power = "ËâË¡";
4873 cptr which_power = "magic";
4875 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4877 which_power = "ĶǽÎÏ";
4879 which_power = "psionic powers";
4881 else if (p_ptr->pclass == CLASS_IMITATOR)
4883 which_power = "¤â¤Î¤Þ¤Í";
4885 which_power = "imitation";
4887 else if (p_ptr->pclass == CLASS_SAMURAI)
4889 which_power = "ɬ»¦·õ";
4891 which_power = "hissatsu";
4893 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4895 which_power = "¶ÀËâË¡";
4897 which_power = "mirror magic";
4899 else if (p_ptr->pclass == CLASS_NINJA)
4901 which_power = "Ǧ½Ñ";
4903 which_power = "ninjutsu";
4905 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4907 which_power = "µ§¤ê";
4909 which_power = "prayer";
4913 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4915 msg_format("An anti-magic shell disrupts your %s!", which_power);
4919 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4922 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4924 msg_format("You cannot think directly!");
4930 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4931 (p_ptr->pclass == CLASS_BERSERKER) ||
4932 (p_ptr->pclass == CLASS_NINJA) ||
4933 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4936 else if (p_ptr->pclass == CLASS_IMITATOR)
4938 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4939 do_cmd_magic_eater(FALSE);
4940 else if (p_ptr->pclass == CLASS_SAMURAI)
4942 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4943 do_cmd_cast_learned();
4944 else if (p_ptr->pclass == CLASS_SMITH)
4953 /* Issue a pet command */
4956 if (!p_ptr->wild_mode) do_cmd_pet();
4960 /*** Use various objects ***/
4962 /* Inscribe an object */
4969 /* Uninscribe an object */
4972 do_cmd_uninscribe();
4976 /* Activate an artifact */
4979 if (!p_ptr->wild_mode)
4981 if (!p_ptr->inside_arena)
4986 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4988 msg_print("The arena absorbs all attempted magic!");
5004 /* Fuel your lantern/torch */
5014 if (!p_ptr->wild_mode) do_cmd_fire();
5021 if (!p_ptr->wild_mode)
5031 if (!p_ptr->wild_mode)
5033 if (!p_ptr->inside_arena)
5038 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5040 msg_print("The arena absorbs all attempted magic!");
5052 if (!p_ptr->wild_mode)
5054 if (p_ptr->inside_arena)
5057 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5059 msg_print("The arena absorbs all attempted magic!");
5064 else if (use_command && rogue_like_commands)
5076 /* Quaff a potion */
5079 if (!p_ptr->wild_mode)
5081 if (!p_ptr->inside_arena)
5082 do_cmd_quaff_potion();
5086 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5088 msg_print("The arena absorbs all attempted magic!");
5100 if (!p_ptr->wild_mode)
5102 if (!p_ptr->inside_arena)
5103 do_cmd_read_scroll();
5107 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5109 msg_print("The arena absorbs all attempted magic!");
5121 if (!p_ptr->wild_mode)
5123 if (p_ptr->inside_arena)
5126 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5128 msg_print("The arena absorbs all attempted magic!");
5133 else if (use_command && !rogue_like_commands)
5143 /* Use racial power */
5146 if (!p_ptr->wild_mode) do_cmd_racial_power();
5151 /*** Looking at Things (nearby or on map) ***/
5153 /* Full dungeon map */
5160 /* Locate player on map */
5174 /* Target monster or location */
5177 if (!p_ptr->wild_mode) do_cmd_target();
5183 /*** Help and Such ***/
5192 /* Identify symbol */
5195 do_cmd_query_symbol();
5199 /* Character description */
5202 do_cmd_change_name();
5207 /*** System Commands ***/
5209 /* Hack -- User interface */
5216 /* Single line from a pref file */
5225 do_cmd_reload_autopick();
5231 do_cmd_edit_autopick();
5235 /* Interact with macros */
5242 /* Interact with visuals */
5250 /* Interact with colors */
5258 /* Interact with options */
5266 /*** Misc Commands ***/
5282 /* Repeat level feeling */
5285 if (!p_ptr->wild_mode) do_cmd_feeling();
5289 /* Show previous message */
5292 do_cmd_message_one();
5296 /* Show previous messages */
5299 do_cmd_messages(old_now_message);
5303 /* Show quest status -KMW- */
5306 do_cmd_checkquest();
5310 /* Redraw the screen */
5313 now_message = old_now_message;
5318 #ifndef VERIFY_SAVEFILE
5320 /* Hack -- Save and don't quit */
5323 do_cmd_save_game(FALSE);
5327 #endif /* VERIFY_SAVEFILE */
5337 case SPECIAL_KEY_QUIT:
5339 do_cmd_save_and_exit();
5343 /* Quit (commit suicide) */
5356 /* Check artifacts, uniques, objects */
5363 /* Load "screen dump" */
5366 do_cmd_load_screen();
5370 /* Save "screen dump" */
5373 do_cmd_save_screen();
5377 /* Make random artifact list */
5380 spoil_random_artifact("randifact.txt");
5384 /* Hack -- Unknown command */
5387 if (flush_failure) flush();
5391 sound(SOUND_ILLEGAL);
5393 if (!get_rnd_line("error_j.txt", 0, error_m))
5395 if (!get_rnd_line("error.txt", 0, error_m))
5402 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5404 prt("Type '?' for help.", 0, 0);
5410 if (!energy_use && !now_message)
5411 now_message = old_now_message;
5417 static bool monster_tsuri(int r_idx)
5419 monster_race *r_ptr = &r_info[r_idx];
5421 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
5429 * Process the player
5431 * Notice the annoying code to handle "pack overflow", which
5432 * must come first just in case somebody manages to corrupt
5433 * the savefiles by clever use of menu commands or something.
5435 static void process_player(void)
5439 /*** Apply energy ***/
5444 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5446 msg_print("You feel different!");
5449 (void)gain_random_mutation(0);
5450 hack_mutation = FALSE;
5453 if (p_ptr->inside_battle)
5455 for(i = 1; i < m_max; i++)
5457 monster_type *m_ptr = &m_list[i];
5459 if (!m_ptr->r_idx) continue;
5461 /* Hack -- Detect monster */
5462 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5464 /* Update the monster */
5465 update_mon(i, FALSE);
5470 /* Give the player some energy */
5471 else if (!(load && p_ptr->energy_need <= 0))
5473 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5477 if (p_ptr->energy_need > 0) return;
5478 if (!command_rep) prt_time();
5480 /*** Check for interupts ***/
5482 /* Complete resting */
5489 if ((p_ptr->chp == p_ptr->mhp) &&
5490 (p_ptr->csp >= p_ptr->msp))
5492 set_action(ACTION_NONE);
5496 /* Complete resting */
5497 else if (resting == -2)
5500 if ((p_ptr->chp == p_ptr->mhp) &&
5501 (p_ptr->csp >= p_ptr->msp) &&
5502 !p_ptr->blind && !p_ptr->confused &&
5503 !p_ptr->poisoned && !p_ptr->afraid &&
5504 !p_ptr->stun && !p_ptr->cut &&
5505 !p_ptr->slow && !p_ptr->paralyzed &&
5506 !p_ptr->image && !p_ptr->word_recall &&
5507 !p_ptr->alter_reality)
5509 set_action(ACTION_NONE);
5514 if (p_ptr->action == ACTION_FISH)
5517 Term_xtra(TERM_XTRA_DELAY, 10);
5521 bool success = FALSE;
5522 get_mon_num_prep(monster_tsuri,NULL);
5523 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5525 if (r_idx && one_in_(2))
5528 y = py+ddy[tsuri_dir];
5529 x = px+ddx[tsuri_dir];
5530 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5533 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5535 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5537 msg_format("You have a good catch!", m_name);
5545 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5547 msg_print("Damn! The fish stole your bait!");
5554 /* Handle "abort" */
5557 /* Check for "player abort" (semi-efficiently for resting) */
5558 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5563 /* Check for a key */
5572 /* Hack -- Show a Message */
5574 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5576 msg_print("Canceled.");
5583 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5585 monster_type *m_ptr = &m_list[p_ptr->riding];
5586 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5595 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5597 /* Acquire the monster name */
5598 monster_desc(m_name, m_ptr, 0);
5600 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5602 msg_format("You have waked %s up.", m_name);
5604 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5605 p_ptr->redraw |= (PR_UHEALTH);
5612 /* Make a "saving throw" against stun */
5613 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5619 /* Hack -- Recover from stun */
5620 if (m_ptr->stunned > d)
5622 /* Recover somewhat */
5623 m_ptr->stunned -= d;
5634 /* Acquire the monster name */
5635 monster_desc(m_name, m_ptr, 0);
5637 /* Dump a message */
5639 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5641 msg_format("%^s is no longer stunned.", m_name);
5643 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5644 p_ptr->redraw |= (PR_UHEALTH);
5648 if (m_ptr->confused)
5652 /* Make a "saving throw" against stun */
5653 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5656 d = m_ptr->confused;
5659 /* Hack -- Recover from stun */
5660 if (m_ptr->confused > d)
5662 /* Recover somewhat */
5663 m_ptr->confused -= d;
5672 m_ptr->confused = 0;
5674 /* Acquire the monster name */
5675 monster_desc(m_name, m_ptr, 0);
5677 /* Dump a message */
5679 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5681 msg_format("%^s is no longer confused.", m_name);
5683 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5684 p_ptr->redraw |= (PR_UHEALTH);
5692 /* Make a "saving throw" against stun */
5693 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5699 /* Hack -- Recover from stun */
5700 if (m_ptr->monfear > d)
5702 /* Recover somewhat */
5703 m_ptr->monfear -= d;
5714 /* Acquire the monster name */
5715 monster_desc(m_name, m_ptr, 0);
5717 /* Dump a message */
5719 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5721 msg_format("%^s is no longer fear.", m_name);
5723 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5724 p_ptr->redraw |= (PR_UHEALTH);
5728 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5732 /* Handle the player song */
5733 if (!load) check_music();
5738 if (p_ptr->lightspeed)
5740 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5742 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5744 if (p_ptr->magic_num1[0] < 40)
5746 p_ptr->magic_num1[0] = 0;
5748 else p_ptr->magic_num1[0] -= 40;
5749 p_ptr->update |= (PU_BONUS);
5751 if (p_ptr->action == ACTION_LEARN)
5753 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5754 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5757 p_ptr->csp_frac = 0;
5758 set_action(ACTION_NONE);
5762 p_ptr->csp -= (s16b)(hoge >> 16);
5764 if (p_ptr->csp_frac < hoge)
5766 p_ptr->csp_frac += 0x10000L - hoge;
5770 p_ptr->csp_frac -= hoge;
5772 p_ptr->redraw |= PR_MANA;
5775 if (p_ptr->special_defense & KATA_MASK)
5777 if (p_ptr->special_defense & KATA_MUSOU)
5781 set_action(ACTION_NONE);
5786 p_ptr->redraw |= (PR_MANA);
5791 /*** Handle actual user input ***/
5793 /* Repeat until out of energy */
5794 while (p_ptr->energy_need <= 0)
5796 p_ptr->window |= PW_PLAYER;
5797 p_ptr->sutemi = FALSE;
5798 p_ptr->counter = FALSE;
5799 now_damaged = FALSE;
5801 /* Handle "p_ptr->notice" */
5804 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5807 /* Place the cursor on the player */
5808 move_cursor_relative(py, px);
5810 /* Refresh (optional) */
5811 if (fresh_before) Term_fresh();
5814 /* Hack -- Pack Overflow */
5815 if (inventory[INVEN_PACK].k_idx)
5817 int item = INVEN_PACK;
5819 char o_name[MAX_NLEN];
5823 /* Access the slot to be dropped */
5824 o_ptr = &inventory[item];
5831 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5833 msg_print("Your pack overflows!");
5838 object_desc(o_name, o_ptr, TRUE, 3);
5842 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5844 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5848 /* Drop it (carefully) near the player */
5849 (void)drop_near(o_ptr, 0, py, px);
5851 /* Modify, Describe, Optimize */
5852 inven_item_increase(item, -255);
5853 inven_item_describe(item);
5854 inven_item_optimize(item);
5856 /* Handle "p_ptr->notice" */
5859 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5864 /* Hack -- cancel "lurking browse mode" */
5865 if (!command_new) command_see = FALSE;
5868 /* Assume free turn */
5872 if (p_ptr->inside_battle)
5874 /* Place the cursor on the player */
5875 move_cursor_relative(py, px);
5877 command_cmd = SPECIAL_KEY_BUILDING;
5879 /* Process the command */
5883 /* Paralyzed or Knocked Out */
5884 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5891 else if (p_ptr->action == ACTION_REST)
5896 /* Reduce rest count */
5899 if (!resting) set_action(ACTION_NONE);
5901 /* Redraw the state */
5902 p_ptr->redraw |= (PR_STATE);
5910 else if (p_ptr->action == ACTION_FISH)
5923 /* Repeated command */
5924 else if (command_rep)
5926 /* Count this execution */
5929 /* Redraw the state */
5930 p_ptr->redraw |= (PR_STATE);
5935 /* Hack -- Assume messages were seen */
5938 /* Clear the top line */
5941 /* Process the command */
5945 /* Normal command */
5948 /* Place the cursor on the player */
5949 move_cursor_relative(py, px);
5952 /* Get a command (normal) */
5953 request_command(FALSE);
5956 /* Process the command */
5966 /* Use some energy */
5967 if (world_player || energy_use > 400)
5969 /* The Randomness is irrelevant */
5970 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5974 /* There is some randomness of needed energy */
5975 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5978 /* Hack -- constant hallucination */
5979 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5982 /* Shimmer monsters if needed */
5983 if (shimmer_monsters)
5985 /* Clear the flag */
5986 shimmer_monsters = FALSE;
5988 /* Shimmer multi-hued monsters */
5989 for (i = 1; i < m_max; i++)
5991 monster_type *m_ptr;
5992 monster_race *r_ptr;
5994 /* Access monster */
5997 /* Skip dead monsters */
5998 if (!m_ptr->r_idx) continue;
6000 /* Skip unseen monsters */
6001 if (!m_ptr->ml) continue;
6003 /* Access the monster race */
6004 r_ptr = &r_info[m_ptr->ap_r_idx];
6006 /* Skip non-multi-hued monsters */
6007 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6010 /* Reset the flag */
6011 shimmer_monsters = TRUE;
6013 /* Redraw regardless */
6014 lite_spot(m_ptr->fy, m_ptr->fx);
6019 /* Handle monster detection */
6020 if (repair_monsters)
6022 /* Reset the flag */
6023 repair_monsters = FALSE;
6025 /* Rotate detection flags */
6026 for (i = 1; i < m_max; i++)
6028 monster_type *m_ptr;
6030 /* Access monster */
6033 /* Skip dead monsters */
6034 if (!m_ptr->r_idx) continue;
6036 /* Nice monsters get mean */
6037 if (m_ptr->mflag & MFLAG_NICE)
6039 /* Nice monsters get mean */
6040 m_ptr->mflag &= ~(MFLAG_NICE);
6043 /* Handle memorized monsters */
6044 if (m_ptr->mflag2 & MFLAG2_MARK)
6046 /* Maintain detection */
6047 if (m_ptr->mflag2 & MFLAG2_SHOW)
6050 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6052 /* Still need repairs */
6053 repair_monsters = TRUE;
6056 /* Remove detection */
6060 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6062 /* Assume invisible */
6065 /* Update the monster */
6066 update_mon(i, FALSE);
6068 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6069 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6071 /* Redraw regardless */
6072 lite_spot(m_ptr->fy, m_ptr->fx);
6077 if (p_ptr->pclass == CLASS_IMITATOR)
6079 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6082 for (i = 0; i < p_ptr->mane_num; i++)
6084 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6085 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6089 p_ptr->redraw |= (PR_MANE);
6091 if (p_ptr->action == ACTION_LEARN)
6094 p_ptr->redraw |= (PR_STATE);
6097 if (world_player && (p_ptr->energy_need > - 1000))
6100 p_ptr->redraw |= (PR_MAP);
6102 /* Update monsters */
6103 p_ptr->update |= (PU_MONSTERS);
6106 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6109 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6111 msg_print("You feel time flowing around you once more.");
6114 world_player = FALSE;
6115 p_ptr->energy_need = ENERGY_NEED();
6117 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6122 /* Hack -- notice death */
6123 if (!p_ptr->playing || p_ptr->is_dead)
6125 world_player = FALSE;
6129 /* Handle "leaving" */
6130 if (p_ptr->leaving) break;
6133 /* Update scent trail */
6139 * Interact with the current dungeon level.
6141 * This function will not exit until the level is completed,
6142 * the user dies, or the game is terminated.
6144 static void dungeon(bool load_game)
6148 /* Set the base level */
6149 base_level = dun_level;
6151 /* Reset various flags */
6155 p_ptr->leaving = FALSE;
6157 /* Reset the "command" vars */
6160 #if 0 /* Don't reset here --- It's used for Arena */
6169 /* Cancel the target */
6173 ambush_flag = FALSE;
6175 /* Cancel the health bar */
6178 /* Check visual effects */
6179 shimmer_monsters = TRUE;
6180 shimmer_objects = TRUE;
6181 repair_monsters = TRUE;
6182 repair_objects = TRUE;
6188 /* Get index of current quest (if any) */
6189 quest_num = quest_number(dun_level);
6191 /* Inside a quest? */
6194 /* Mark the quest monster */
6195 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6198 /* Track maximum player level */
6199 if (p_ptr->max_plv < p_ptr->lev)
6201 p_ptr->max_plv = p_ptr->lev;
6205 /* Track maximum dungeon level (if not in quest -KMW-) */
6206 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6208 max_dlv[dungeon_type] = dun_level;
6209 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6212 /* Validate the panel */
6213 panel_bounds_center();
6215 /* Verify the panel */
6218 /* Flush messages */
6222 /* Enter "xtra" mode */
6223 character_xtra = TRUE;
6226 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6228 /* Redraw dungeon */
6229 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6232 p_ptr->redraw |= (PR_MAP);
6235 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6237 /* Update lite/view */
6238 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6240 /* Update monsters */
6241 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6243 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6246 /* Leave "xtra" mode */
6247 character_xtra = FALSE;
6250 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6252 /* Combine / Reorder the pack */
6253 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6255 /* Handle "p_ptr->notice" */
6258 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6264 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6265 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6266 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6268 if (p_ptr->inside_battle)
6272 p_ptr->energy_need = 0;
6278 msg_print("»î¹ç³«»Ï¡ª");
6280 msg_format("Ready..Fight!");
6286 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6287 p_ptr->magic_num1[0] = MUSIC_DETECT;
6289 /* Hack -- notice death or departure */
6290 if (!p_ptr->playing || p_ptr->is_dead) return;
6292 /* Print quest message if appropriate */
6293 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6295 quest_discovery(random_quest_number(dun_level));
6296 p_ptr->inside_quest = random_quest_number(dun_level);
6298 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6300 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6302 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6303 d_name+d_info[dungeon_type].name,
6304 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6306 msg_format("%^s lives in this level as the keeper of %s.",
6307 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6308 d_name+d_info[dungeon_type].name);
6312 /*** Process this dungeon level ***/
6314 /* Reset the monster generation level */
6315 monster_level = base_level;
6317 /* Reset the object generation level */
6318 object_level = base_level;
6322 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6323 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6324 p_ptr->energy_need = 0;
6326 /* Not leaving dungeon */
6327 p_ptr->leaving_dungeon = FALSE;
6332 /* Hack -- Compact the monster list occasionally */
6333 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6335 /* Hack -- Compress the monster list occasionally */
6336 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6339 /* Hack -- Compact the object list occasionally */
6340 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6342 /* Hack -- Compress the object list occasionally */
6343 if (o_cnt + 32 < o_max) compact_objects(0);
6346 /* Process the player */
6349 /* Handle "p_ptr->notice" */
6352 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6355 /* Hack -- Hilite the player */
6356 move_cursor_relative(py, px);
6358 /* Optional fresh */
6359 if (fresh_after) Term_fresh();
6361 /* Hack -- Notice death or departure */
6362 if (!p_ptr->playing || p_ptr->is_dead) break;
6364 /* Process all of the monsters */
6367 /* Handle "p_ptr->notice" */
6370 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6373 /* Hack -- Hilite the player */
6374 move_cursor_relative(py, px);
6376 /* Optional fresh */
6377 if (fresh_after) Term_fresh();
6379 /* Hack -- Notice death or departure */
6380 if (!p_ptr->playing || p_ptr->is_dead) break;
6383 /* Process the world */
6386 /* Handle "p_ptr->notice" */
6389 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6392 /* Hack -- Hilite the player */
6393 move_cursor_relative(py, px);
6395 /* Optional fresh */
6396 if (fresh_after) Term_fresh();
6398 /* Hack -- Notice death or departure */
6399 if (!p_ptr->playing || p_ptr->is_dead) break;
6401 /* Handle "leaving" */
6402 if (p_ptr->leaving) break;
6404 /* Count game turns */
6406 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6407 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6408 if (wild_regen) wild_regen--;
6411 /* Inside a quest and non-unique questor? */
6412 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6414 /* Un-mark the quest monster */
6415 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6418 /* Not save-and-quit and not dead? */
6419 if (p_ptr->playing && !p_ptr->is_dead)
6422 * Maintain Unique monsters and artifact, save current
6423 * floor, then prepare next floor
6427 /* Forget the flag */
6428 reinit_wilderness = FALSE;
6431 /* Write about current level on the play record once per level */
6437 * Load some "user pref files"
6439 * Modified by Arcum Dagsson to support
6440 * separate macro files for different realms.
6442 static void load_all_pref_files(void)
6447 /* Access the "user" pref file */
6448 sprintf(buf, "user.prf");
6450 /* Process that file */
6451 process_pref_file(buf);
6453 /* Access the "user" system pref file */
6454 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6456 /* Process that file */
6457 process_pref_file(buf);
6459 /* Access the "race" pref file */
6460 sprintf(buf, "%s.prf", rp_ptr->title);
6462 /* Process that file */
6463 process_pref_file(buf);
6465 /* Access the "class" pref file */
6466 sprintf(buf, "%s.prf", cp_ptr->title);
6468 /* Process that file */
6469 process_pref_file(buf);
6471 /* Access the "character" pref file */
6472 sprintf(buf, "%s.prf", player_base);
6474 /* Process that file */
6475 process_pref_file(buf);
6477 /* Access the "realm 1" pref file */
6478 if (p_ptr->realm1 != REALM_NONE)
6480 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6482 /* Process that file */
6483 process_pref_file(buf);
6486 /* Access the "realm 2" pref file */
6487 if (p_ptr->realm2 != REALM_NONE)
6489 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6491 /* Process that file */
6492 process_pref_file(buf);
6496 /* Load an autopick preference file */
6497 autopick_load_pref(FALSE);
6502 * Extract option variables from bit sets
6504 void extract_option_vars(void)
6508 for (i = 0; option_info[i].o_desc; i++)
6510 int os = option_info[i].o_set;
6511 int ob = option_info[i].o_bit;
6513 /* Set the "default" options */
6514 if (option_info[i].o_var)
6517 if (option_flag[os] & (1L << ob))
6520 (*option_info[i].o_var) = TRUE;
6527 (*option_info[i].o_var) = FALSE;
6535 * Determine bounty uniques
6537 void determine_bounty_uniques(void)
6540 monster_race *r_ptr;
6542 get_mon_num_prep(NULL, NULL);
6543 for (i = 0; i < MAX_KUBI; i++)
6547 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6548 r_ptr = &r_info[kubi_r_idx[i]];
6550 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6552 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6554 if (r_ptr->rarity > 100) continue;
6556 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6558 for (j = 0; j < i; j++)
6559 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6566 for (i = 0; i < MAX_KUBI - 1; i++)
6568 for (j = i; j < MAX_KUBI; j++)
6570 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6572 tmp = kubi_r_idx[i];
6573 kubi_r_idx[i] = kubi_r_idx[j];
6574 kubi_r_idx[j] = tmp;
6582 * Determine today's bounty monster
6583 * Note: conv_old is used if loaded 0.0.3 or older save file
6585 void determine_today_mon(bool conv_old)
6588 bool old_inside_battle = p_ptr->inside_battle;
6589 monster_race *r_ptr;
6593 for (i = 0; i < max_d_idx; i++)
6595 if (max_dlv[i] < d_info[i].mindepth) continue;
6596 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6599 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6601 p_ptr->inside_battle = TRUE;
6602 get_mon_num_prep(NULL, NULL);
6606 today_mon = get_mon_num(max_dl);
6607 r_ptr = &r_info[today_mon];
6609 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6610 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6611 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6612 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6613 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6614 if (r_ptr->rarity > 10) continue;
6618 p_ptr->today_mon = 0;
6619 p_ptr->inside_battle = old_inside_battle;
6624 * Actually play a game
6626 * If the "new_game" parameter is true, then, after loading the
6627 * savefile, we will commit suicide, if necessary, to allow the
6628 * player to start a new game.
6630 void play_game(bool new_game)
6633 bool load_game = TRUE;
6643 hack_mutation = FALSE;
6645 /* Hack -- Character is "icky" */
6646 character_icky = TRUE;
6648 /* Make sure main term is active */
6649 Term_activate(angband_term[0]);
6651 /* Initialise the resize hooks */
6652 angband_term[0]->resize_hook = resize_map;
6654 for (i = 1; i < 8; i++)
6656 /* Does the term exist? */
6657 if (angband_term[i])
6659 /* Add the redraw on resize hook */
6660 angband_term[i]->resize_hook = redraw_window;
6664 /* Hack -- turn off the cursor */
6665 (void)Term_set_cursor(0);
6668 /* Attempt to load */
6673 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6675 quit("broken savefile");
6680 /* Extract the options */
6681 extract_option_vars();
6683 /* Report waited score */
6684 if (p_ptr->wait_report_score)
6690 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6692 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6697 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6702 p_ptr->is_dead = TRUE;
6704 start_time = time(NULL);
6706 /* No suspending now */
6707 signals_ignore_tstp();
6709 /* Hack -- Character is now "icky" */
6710 character_icky = TRUE;
6712 /* Build the filename */
6713 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6715 /* Open the high score file, for reading/writing */
6716 highscore_fd = fd_open(buf, O_RDWR);
6718 /* Handle score, show Top scores */
6719 success = send_world_score(TRUE);
6722 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6724 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6728 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6730 prt("standing by for future registration...", 0, 0);
6736 p_ptr->wait_report_score = FALSE;
6739 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6741 if (!save_player()) msg_print("death save failed!");
6744 /* Shut the high score file */
6745 (void)fd_close(highscore_fd);
6747 /* Forget the high score fd */
6750 /* Allow suspending now */
6751 signals_handle_tstp();
6756 /* Nothing loaded */
6757 if (!character_loaded)
6759 /* Make new player */
6762 /* The dungeon is not ready */
6763 character_dungeon = FALSE;
6765 /* Prepare to init the RNG */
6768 /* Initialize the saved floors data */
6769 init_saved_floors(FALSE);
6772 /* Old game is loaded. But new game is requested. */
6775 /* Initialize the saved floors data */
6776 init_saved_floors(TRUE);
6779 /* Process old character */
6782 /* Process the player name */
6783 process_player_name(FALSE);
6792 seed = (time(NULL));
6796 /* Mutate the seed on Unix machines */
6797 seed = ((seed >> 3) * (getpid() << 1));
6801 /* Use the complex RNG */
6804 /* Seed the "complex" RNG */
6805 Rand_state_init(seed);
6808 /* Roll new character */
6811 /* The dungeon is not ready */
6812 character_dungeon = FALSE;
6816 p_ptr->inside_quest = 0;
6817 p_ptr->inside_arena = FALSE;
6818 p_ptr->inside_battle = FALSE;
6822 /* Hack -- seed for flavors */
6823 seed_flavor = randint0(0x10000000);
6825 /* Hack -- seed for town layout */
6826 seed_town = randint0(0x10000000);
6828 /* Roll up a new character */
6836 determine_bounty_uniques();
6837 determine_today_mon(FALSE);
6841 write_level = FALSE;
6844 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6846 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6850 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6851 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6853 if (p_ptr->riding == -1)
6856 for (i = m_max; i > 0; i--)
6858 if (player_bold(m_list[i].fy, m_list[i].fx))
6867 p_ptr->teleport_town = FALSE;
6868 p_ptr->sutemi = FALSE;
6869 world_monster = FALSE;
6870 now_damaged = FALSE;
6872 start_time = time(NULL) - 1;
6873 record_o_name[0] = '\0';
6875 /* Reset map panel */
6876 panel_row_min = cur_hgt;
6877 panel_col_min = cur_wid;
6879 /* Sexy gal gets bonus to maximum weapon skill of whip */
6880 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6881 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
6883 /* Fill the arrays of floors and walls in the good proportions */
6884 set_floor_and_wall(dungeon_type);
6886 /* Flavor the objects */
6894 /* Flash a message */
6896 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6898 prt("Please wait...", 0, 0);
6902 /* Flush the message */
6906 /* Hack -- Enter wizard mode */
6909 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6910 else if (p_ptr->is_dead) quit("Already dead.");
6913 /* Initialize the town-buildings if necessary */
6914 if (!dun_level && !p_ptr->inside_quest)
6916 /* Init the wilderness */
6918 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6921 init_flags = INIT_ONLY_BUILDINGS;
6923 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6928 /* Generate a dungeon level if needed */
6929 if (!character_dungeon)
6935 /* Character is now "complete" */
6936 character_generated = TRUE;
6939 /* Hack -- Character is no longer "icky" */
6940 character_icky = FALSE;
6948 sprintf(buf, "%s¤Ë¹ß¤êΩ¤Ã¤¿¡£", map_name());
6950 sprintf(buf, "You are standing in the %s.", map_name());
6952 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
6957 p_ptr->playing = TRUE;
6959 /* Reset the visual mappings */
6962 /* Load the "pref" files */
6963 load_all_pref_files();
6965 /* React to changes */
6966 Term_xtra(TERM_XTRA_REACT, 0);
6969 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6972 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6978 /* Set or clear "rogue_like_commands" if requested */
6979 if (arg_force_original) rogue_like_commands = FALSE;
6980 if (arg_force_roguelike) rogue_like_commands = TRUE;
6982 /* Hack -- Enforce "delayed death" */
6983 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6985 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6987 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6989 monster_type *m_ptr;
6990 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6991 monster_race *r_ptr = &r_info[pet_r_idx];
6992 place_monster_aux(0, py, px - 1, pet_r_idx,
6993 (PM_FORCE_PET | PM_NO_KAGE));
6994 m_ptr = &m_list[hack_m_idx_ii];
6995 m_ptr->mspeed = r_ptr->speed;
6996 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6997 m_ptr->max_maxhp = m_ptr->maxhp;
6998 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6999 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7005 /* Process the level */
7008 /* Handle "p_ptr->notice" */
7011 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7014 /* Cancel the target */
7017 /* Cancel the health bar */
7021 /* Forget the lite */
7024 /* Forget the view */
7027 /* Forget the view */
7030 /* Handle "quit and save" */
7031 if (!p_ptr->playing && !p_ptr->is_dead) break;
7033 /* Erase the old cave */
7035 if (!p_ptr->is_dead) wipe_m_list();
7043 /* Accidental Death */
7044 if (p_ptr->playing && p_ptr->is_dead)
7046 if (p_ptr->inside_arena)
7048 p_ptr->inside_arena = FALSE;
7049 if (p_ptr->arena_number > MAX_ARENA_MONS)
7050 p_ptr->arena_number++;
7052 p_ptr->arena_number = -1 - p_ptr->arena_number;
7053 p_ptr->is_dead = FALSE;
7055 p_ptr->chp_frac = 0;
7056 p_ptr->exit_bldg = TRUE;
7059 /* Leave through the exit */
7060 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
7062 /* prepare next floor */
7067 /* Mega-Hack -- Allow player to cheat death */
7069 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7071 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7075 /* Mark social class, reset age, if needed */
7076 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7082 p_ptr->noscore |= 0x0001;
7086 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7088 msg_print("You invoke wizard mode and cheat death.");
7094 /* Restore hit points */
7095 p_ptr->chp = p_ptr->mhp;
7096 p_ptr->chp_frac = 0;
7098 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7100 for (i = 0; i < EATER_EXT*2; i++)
7102 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7104 for (; i < EATER_EXT*3; i++)
7106 p_ptr->magic_num1[i] = 0;
7109 /* Restore spell points */
7110 p_ptr->csp = p_ptr->msp;
7111 p_ptr->csp_frac = 0;
7113 /* Hack -- Healing */
7115 (void)set_confused(0);
7116 (void)set_poisoned(0);
7117 (void)set_afraid(0);
7118 (void)set_paralyzed(0);
7123 /* Hack -- Prevent starvation */
7124 (void)set_food(PY_FOOD_MAX - 1);
7126 /* Hack -- cancel recall */
7127 if (p_ptr->word_recall)
7131 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7133 msg_print("A tension leaves the air around you...");
7138 /* Hack -- Prevent recall */
7139 p_ptr->word_recall = 0;
7140 p_ptr->redraw |= (PR_STATUS);
7143 /* Hack -- cancel alter */
7144 if (p_ptr->alter_reality)
7146 /* Hack -- Prevent alter */
7147 p_ptr->alter_reality = 0;
7148 p_ptr->redraw |= (PR_STATUS);
7151 /* Note cause of death XXX XXX XXX */
7153 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7155 (void)strcpy(p_ptr->died_from, "Cheating death");
7160 p_ptr->is_dead = FALSE;
7163 p_ptr->inside_arena = FALSE;
7164 p_ptr->inside_battle = FALSE;
7166 p_ptr->inside_quest = 0;
7167 p_ptr->recall_dungeon = dungeon_type;
7169 if (lite_town || vanilla_town)
7171 p_ptr->wilderness_y = 1;
7172 p_ptr->wilderness_x = 1;
7186 p_ptr->wilderness_y = 48;
7187 p_ptr->wilderness_x = 5;
7193 p_ptr->wild_mode = FALSE;
7195 p_ptr->leaving = TRUE;
7198 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7200 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7206 /* Handle "death" */
7207 if (p_ptr->is_dead) break;
7209 /* Make a new level */
7220 s32b turn_real(s32b hoge)
7222 switch (p_ptr->start_race)
7228 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);