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];
101 /* We know about it already, do not tell us again */
102 if (o_ptr->ident & (IDENT_SENSE))return;
104 /* It is fully known, no information needed */
105 if (object_known_p(o_ptr)) return;
107 /* Check for a feeling */
108 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
110 /* Skip non-feelings */
114 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
125 feel = FEEL_EXCELLENT;
131 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
133 feel = FEEL_UNCURSED;
138 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
144 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
151 feel = FEEL_WORTHLESS;
156 feel = FEEL_TERRIBLE;
162 /* Stop everything */
163 if (disturb_minor) disturb(0, 0);
165 /* Get an object description */
166 object_desc(o_name, o_ptr, FALSE, 0);
168 /* Message (equipment) */
169 if (slot >= INVEN_RARM)
172 msg_format("%s%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
173 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
175 msg_format("You feel the %s (%c) you are %s %s %s...",
176 o_name, index_to_label(slot), describe_use(slot),
177 ((o_ptr->number == 1) ? "is" : "are"),
178 game_inscriptions[feel]);
183 /* Message (inventory) */
187 msg_format("¥¶¥Ã¥¯¤ÎÃæ¤Î%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
188 o_name, index_to_label(slot),game_inscriptions[feel]);
190 msg_format("You feel the %s (%c) in your pack %s %s...",
191 o_name, index_to_label(slot),
192 ((o_ptr->number == 1) ? "is" : "are"),
193 game_inscriptions[feel]);
198 /* We have "felt" it */
199 o_ptr->ident |= (IDENT_SENSE);
201 /* Set the "inscription" */
202 o_ptr->feeling = feel;
204 /* Auto-inscription/destroy */
205 idx = is_autopick(o_ptr);
206 auto_inscribe_item(slot, idx);
208 auto_destroy_item(slot, idx);
210 /* Combine / Reorder the pack (later) */
211 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
214 p_ptr->window |= (PW_INVEN | PW_EQUIP);
220 * Sense the inventory
222 * Class 0 = Warrior --> fast and heavy
223 * Class 1 = Mage --> slow and light
224 * Class 2 = Priest --> fast but light
225 * Class 3 = Rogue --> okay and heavy
226 * Class 4 = Ranger --> slow but heavy (changed!)
227 * Class 5 = Paladin --> slow but heavy
229 static void sense_inventory1(void)
232 int plev = p_ptr->lev;
237 /*** Check for "sensing" ***/
239 /* No sensing when confused */
240 if (p_ptr->confused) return;
242 /* Analyze the class */
243 switch (p_ptr->pclass)
251 if (0 != randint0(9000L / (plev * plev + 40))) return;
263 if (0 != randint0(6000L / (plev * plev + 50))) return;
273 case CLASS_HIGH_MAGE:
275 case CLASS_MAGIC_EATER:
277 /* Very bad (light) sensing */
278 if (0 != randint0(240000L / (plev + 5))) return;
287 /* Good (light) sensing */
288 if (0 != randint0(10000L / (plev * plev + 40))) return;
298 if (0 != randint0(20000L / (plev * plev + 40))) return;
310 if (0 != randint0(95000L / (plev * plev + 40))) return;
322 if (0 != randint0(77777L / (plev * plev + 40))) return;
331 case CLASS_WARRIOR_MAGE:
335 if (0 != randint0(75000L / (plev * plev + 40))) return;
341 case CLASS_MINDCRAFTER:
343 case CLASS_BLUE_MAGE:
344 case CLASS_MIRROR_MASTER:
347 if (0 != randint0(55000L / (plev * plev + 40))) return;
353 case CLASS_CHAOS_WARRIOR:
356 if (0 != randint0(80000L / (plev * plev + 40))) return;
366 case CLASS_FORCETRAINER:
369 if (0 != randint0(20000L / (plev * plev + 40))) return;
378 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
387 case CLASS_BEASTMASTER:
390 if (0 != randint0(65000L / (plev * plev + 40))) return;
395 case CLASS_BERSERKER:
405 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
407 /*** Sense everything ***/
409 /* Check everything */
410 for (i = 0; i < INVEN_TOTAL; i++)
414 o_ptr = &inventory[i];
416 /* Skip empty slots */
417 if (!o_ptr->k_idx) continue;
419 /* Valid "tval" codes */
446 /* Skip non-sense machines */
449 /* Occasional failure on inventory items */
450 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
453 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
458 sense_inventory_aux(i, heavy);
463 static void sense_inventory2(void)
466 int plev = p_ptr->lev;
470 /*** Check for "sensing" ***/
472 /* No sensing when confused */
473 if (p_ptr->confused) return;
475 /* Analyze the class */
476 switch (p_ptr->pclass)
482 case CLASS_BERSERKER:
489 case CLASS_CHAOS_WARRIOR:
491 case CLASS_BEASTMASTER:
494 /* Very bad (light) sensing */
495 if (0 != randint0(240000L / (plev + 5))) return;
502 case CLASS_WARRIOR_MAGE:
507 if (0 != randint0(95000L / (plev * plev + 40))) return;
516 case CLASS_FORCETRAINER:
517 case CLASS_MINDCRAFTER:
520 if (0 != randint0(20000L / (plev * plev + 40))) return;
527 case CLASS_HIGH_MAGE:
529 case CLASS_MAGIC_EATER:
530 case CLASS_MIRROR_MASTER:
531 case CLASS_BLUE_MAGE:
534 if (0 != randint0(9000L / (plev * plev + 40))) return;
543 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
550 /*** Sense everything ***/
552 /* Check everything */
553 for (i = 0; i < INVEN_TOTAL; i++)
557 o_ptr = &inventory[i];
559 /* Skip empty slots */
560 if (!o_ptr->k_idx) continue;
562 /* Valid "tval" codes */
575 /* Skip non-sense machines */
578 /* Occasional failure on inventory items */
579 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
581 sense_inventory_aux(i, TRUE);
588 * Go to any level (ripped off from wiz_jump)
590 static void pattern_teleport(void)
597 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
599 if (get_check("Teleport level? "))
606 /* Only downward in ironman mode */
607 if (ironman_downward)
608 min_level = dun_level;
611 if (dungeon_type == DUNGEON_ANGBAND)
614 max_level = MAX_DEPTH - 1;
615 else if (dun_level == 100)
620 max_level = d_info[dungeon_type].maxdepth;
621 min_level = d_info[dungeon_type].mindepth;
626 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
628 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
633 sprintf(tmp_val, "%d", dun_level);
635 /* Ask for a level */
636 if (!get_string(ppp, tmp_val, 10)) return;
638 /* Extract request */
639 command_arg = atoi(tmp_val);
642 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
644 else if (get_check("Normal teleport? "))
648 teleport_player(200);
657 if (command_arg < min_level) command_arg = min_level;
660 if (command_arg > max_level) command_arg = max_level;
664 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
666 msg_format("You teleport to dungeon level %d.", command_arg);
670 if (autosave_l) do_cmd_save_game(TRUE);
673 dun_level = command_arg;
674 prepare_change_floor_mode(CFM_CLEAR_ALL);
678 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
680 p_ptr->inside_quest = 0;
681 p_ptr->leftbldg = FALSE;
685 p_ptr->leaving = TRUE;
689 static void wreck_the_pattern(void)
691 int to_ruin = 0, r_y, r_x;
693 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
700 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
701 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
703 msg_print("You bleed on the Pattern!");
704 msg_print("Something terrible happens!");
710 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
712 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
716 to_ruin = randint1(45) + 35;
720 scatter(&r_y, &r_x, py, px, 4, 0);
722 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
723 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
725 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
729 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
733 /* Returns TRUE if we are on the Pattern... */
734 static bool pattern_effect(void)
736 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
737 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
740 if ((prace_is_(RACE_AMBERITE)) &&
741 (p_ptr->cut > 0) && one_in_(10))
746 if (cave[py][px].feat == FEAT_PATTERN_END)
748 (void)set_poisoned(0);
754 (void)do_res_stat(A_STR);
755 (void)do_res_stat(A_INT);
756 (void)do_res_stat(A_WIS);
757 (void)do_res_stat(A_DEX);
758 (void)do_res_stat(A_CON);
759 (void)do_res_stat(A_CHR);
760 (void)restore_level();
761 (void)hp_player(1000);
762 cave_set_feat(py, px, FEAT_PATTERN_OLD);
764 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
766 msg_print("This section of the Pattern looks less powerful.");
773 * We could make the healing effect of the
774 * Pattern center one-time only to avoid various kinds
775 * of abuse, like luring the win monster into fighting you
776 * in the middle of the pattern...
779 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
783 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
787 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
791 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
793 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
799 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
801 else if (!IS_INVULN())
803 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
805 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
818 * Regenerate hit points -RAK-
820 static void regenhp(int percent)
822 s32b new_chp, new_chp_frac;
825 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
826 if (p_ptr->action == ACTION_HAYAGAKE) return;
827 /* Save the old hitpoints */
828 old_chp = p_ptr->chp;
830 /* Extract the new hitpoints */
831 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
832 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
834 /* check for overflow */
835 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
836 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
837 if (new_chp_frac >= 0x10000L)
839 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
844 p_ptr->chp_frac = (u16b)new_chp_frac;
848 if (p_ptr->chp >= p_ptr->mhp)
850 p_ptr->chp = p_ptr->mhp;
855 if (old_chp != p_ptr->chp)
858 p_ptr->redraw |= (PR_HP);
861 p_ptr->window |= (PW_PLAYER);
869 * Regenerate mana points -RAK-
871 static void regenmana(int percent)
873 s32b new_mana, new_mana_frac;
875 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
877 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
878 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
879 old_csp = p_ptr->csp;
880 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
881 if (old_csp_msp && (new_mana > 0))
885 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
886 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
890 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
891 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
893 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
895 if (new_mana_frac >= 0x10000L)
897 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
902 p_ptr->csp_frac = (u16b)(new_mana_frac);
905 /* check for overflow */
912 /* Must set frac to zero even if equal */
913 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
915 p_ptr->csp = p_ptr->msp;
920 if (old_csp != p_ptr->csp)
923 p_ptr->redraw |= (PR_MANA);
926 p_ptr->window |= (PW_PLAYER);
927 p_ptr->window |= (PW_SPELL);
938 static void regenmagic(int percent)
943 for (i = 0; i < EATER_EXT*2; i++)
945 if (!p_ptr->magic_num2[i]) continue;
946 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
947 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
948 p_ptr->magic_num1[i] += new_mana;
950 /* Must set frac to zero even if equal */
951 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
953 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
957 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
959 if (!p_ptr->magic_num1[i]) continue;
960 if (!p_ptr->magic_num2[i]) continue;
961 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
962 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
973 * Regenerate the monsters (once per 100 game turns)
975 * XXX XXX XXX Should probably be done during monster turns.
977 static void regen_monsters(void)
982 /* Regenerate everyone */
983 for (i = 1; i < m_max; i++)
985 /* Check the i'th monster */
986 monster_type *m_ptr = &m_list[i];
987 monster_race *r_ptr = &r_info[m_ptr->r_idx];
990 /* Skip dead monsters */
991 if (!m_ptr->r_idx) continue;
993 /* Allow regeneration (if needed) */
994 if (m_ptr->hp < m_ptr->maxhp)
996 /* Hack -- Base regeneration */
997 frac = m_ptr->maxhp / 100;
999 /* Hack -- Minimal regeneration rate */
1000 if (!frac) if (one_in_(2)) frac = 1;
1002 /* Hack -- Some monsters regenerate quickly */
1003 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1005 /* Hack -- Regenerate */
1008 /* Do not over-regenerate */
1009 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1011 /* Redraw (later) if needed */
1012 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1013 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1020 * Regenerate the captured monsters (once per 30 game turns)
1022 * XXX XXX XXX Should probably be done during monster turns.
1024 static void regen_captured_monsters(void)
1029 /* Regenerate everyone */
1030 for (i = 0; i < INVEN_TOTAL; i++)
1032 monster_race *r_ptr;
1033 object_type *o_ptr = &inventory[i];
1035 if (!o_ptr->k_idx) continue;
1036 if (o_ptr->tval != TV_CAPTURE) continue;
1037 if (!o_ptr->pval) continue;
1041 r_ptr = &r_info[o_ptr->pval];
1043 /* Allow regeneration (if needed) */
1044 if (o_ptr->xtra4 < o_ptr->xtra5)
1046 /* Hack -- Base regeneration */
1047 frac = o_ptr->xtra5 / 100;
1049 /* Hack -- Minimal regeneration rate */
1050 if (!frac) if (one_in_(2)) frac = 1;
1052 /* Hack -- Some monsters regenerate quickly */
1053 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1055 /* Hack -- Regenerate */
1056 o_ptr->xtra4 += frac;
1058 /* Do not over-regenerate */
1059 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1066 p_ptr->notice |= (PN_COMBINE);
1069 p_ptr->window |= (PW_INVEN);
1070 p_ptr->window |= (PW_EQUIP);
1077 * Process the counters of monsters (once per 10 game turns)
1079 * This function is to process monsters' counters same as player's.
1081 static void process_monsters_counters(void)
1084 monster_type *m_ptr;
1085 monster_race *r_ptr;
1087 u32b noise; /* Hack -- local "player stealth" value */
1089 /* Handle "leaving" */
1090 if (p_ptr->leaving) return;
1092 /* Hack -- calculate the "player noise" */
1093 noise = (1L << (30 - p_ptr->skill_stl));
1095 /* Process the monsters (backwards) */
1096 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1098 /* Access the monster */
1099 m_ptr = &m_list[m_idx];
1100 r_ptr = &r_info[m_ptr->r_idx];
1102 /* Ignore "dead" monsters */
1103 if (!m_ptr->r_idx) continue;
1105 /* Handle Invulnerability */
1106 if (m_ptr->invulner)
1108 /* Reduce by one, note if expires */
1111 if (!m_ptr->invulner)
1117 /* Acquire the monster name */
1118 monster_desc(m_name, m_ptr, 0);
1120 /* Dump a message */
1122 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1124 msg_format("%^s is no longer invulnerable.", m_name);
1127 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1128 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1130 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1137 /* Reduce by one, note if expires */
1140 if (!m_ptr->fast && m_ptr->ml)
1144 /* Acquire the monster name */
1145 monster_desc(m_name, m_ptr, 0);
1147 /* Dump a message */
1149 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1151 msg_format("%^s is no longer fast.", m_name);
1154 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1155 if (p_ptr->riding == m_idx)
1157 p_ptr->redraw |= (PR_UHEALTH);
1158 p_ptr->update |= (PU_BONUS);
1166 /* Reduce by one, note if expires */
1169 if (!m_ptr->slow && m_ptr->ml)
1173 /* Acquire the monster name */
1174 monster_desc(m_name, m_ptr, 0);
1176 /* Dump a message */
1178 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1180 msg_format("%^s is no longer slow.", m_name);
1183 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1184 if (p_ptr->riding == m_idx)
1186 p_ptr->redraw |= (PR_UHEALTH);
1187 p_ptr->update |= (PU_BONUS);
1192 /* Handle "sleep" */
1195 /* Assume does not wake up */
1198 /* Hack -- Require proximity */
1199 if (m_ptr->cdis < AAF_LIMIT)
1201 /* Handle "sensing radius" */
1202 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1204 /* We may wake up */
1208 /* Handle "sight" and "aggravation" */
1209 else if ((m_ptr->cdis <= MAX_SIGHT) &&
1210 (player_has_los_bold(m_ptr->fy, m_ptr->fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
1212 /* We may wake up */
1221 /* Hack -- handle non-aggravation */
1222 if (!(p_ptr->cursed & TRC_AGGRAVATE)) notice = randint0(1024);
1224 /* Nightmare monsters are more alert */
1225 if (ironman_nightmare) notice /= 2;
1227 /* Hack -- See if monster "notices" player */
1228 if ((notice * notice * notice) <= noise)
1230 /* Hack -- amount of "waking" */
1233 /* Hack -- handle aggravation */
1234 if (p_ptr->cursed & TRC_AGGRAVATE)
1240 /* Wake up faster near the player */
1241 if (m_ptr->cdis < AAF_LIMIT / 2) d = (AAF_LIMIT / m_ptr->cdis);
1243 /* Hack -- amount of "waking" is affected by speed of player */
1244 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1249 if (m_ptr->csleep > d)
1251 /* Monster wakes up "a little bit" */
1254 /* Notice the "not waking up" */
1257 /* Hack -- Count the ignores */
1258 if (r_ptr->r_ignore < MAX_UCHAR)
1268 /* Reset sleep counter */
1271 /* Notice the "waking up" */
1276 /* Acquire the monster name */
1277 monster_desc(m_name, m_ptr, 0);
1279 /* Dump a message */
1281 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1283 msg_format("%^s wakes up.", m_name);
1286 /* Redraw the health bar */
1287 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1288 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1290 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
1291 p_ptr->update |= (PU_MON_LITE);
1293 /* Hack -- Count the wakings */
1294 if (r_ptr->r_wake < MAX_UCHAR)
1309 /* Make a "saving throw" against stun */
1310 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1316 /* Hack -- Recover from stun */
1317 if (m_ptr->stunned > d)
1319 /* Recover somewhat */
1320 m_ptr->stunned -= d;
1329 /* Message if visible */
1334 /* Acquire the monster name */
1335 monster_desc(m_name, m_ptr, 0);
1337 /* Dump a message */
1339 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1341 msg_format("%^s is no longer stunned.", m_name);
1344 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1345 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1350 /* Handle confusion */
1351 if (m_ptr->confused)
1353 /* Amount of "boldness" */
1354 int d = randint1(r_ptr->level / 20 + 1);
1356 /* Still confused */
1357 if (m_ptr->confused > d)
1359 /* Reduce the confusion */
1360 m_ptr->confused -= d;
1366 /* No longer confused */
1367 m_ptr->confused = 0;
1369 /* Message if visible */
1374 /* Acquire the monster name */
1375 monster_desc(m_name, m_ptr, 0);
1377 /* Dump a message */
1379 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1381 msg_format("%^s is no longer confused.", m_name);
1384 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1385 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1393 /* Amount of "boldness" */
1394 int d = randint1(r_ptr->level / 20 + 1);
1397 if (m_ptr->monfear > d)
1399 /* Reduce the fear */
1400 m_ptr->monfear -= d;
1403 /* Recover from fear, take note if seen */
1406 /* No longer afraid */
1415 /* Acquire the monster name/poss */
1416 monster_desc(m_name, m_ptr, 0);
1417 monster_desc(m_poss, m_ptr, 0x22);
1419 /* Dump a message */
1421 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1423 msg_format("%^s recovers %s courage.", m_name, m_poss);
1426 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1427 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1435 static void notice_lite_change(object_type *o_ptr)
1437 /* Hack -- notice interesting fuel steps */
1438 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1441 p_ptr->window |= (PW_EQUIP);
1444 /* Hack -- Special treatment when blind */
1447 /* Hack -- save some light for later */
1448 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1451 /* The light is now out */
1452 else if (o_ptr->xtra4 == 0)
1456 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1458 msg_print("Your light has gone out!");
1460 p_ptr->update |= (PU_BONUS);
1463 /* The light is getting dim */
1464 else if (o_ptr->name2 == EGO_LITE_LONG)
1466 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1467 && (turn % (TURNS_PER_TICK*2)))
1469 if (disturb_minor) disturb(0, 0);
1471 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1473 msg_print("Your light is growing faint.");
1479 /* The light is getting dim */
1480 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1482 if (disturb_minor) disturb(0, 0);
1484 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1486 msg_print("Your light is growing faint.");
1493 void leave_quest_check(void)
1495 /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
1496 leaving_quest = p_ptr->inside_quest;
1498 /* Leaving an 'only once' quest marks it as failed */
1499 if (leaving_quest &&
1500 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1501 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1503 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1504 quest[leaving_quest].complev = (byte)p_ptr->lev;
1505 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1507 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1508 if (record_rand_quest)
1509 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1511 /* Floor of random quest will be blocked */
1512 prepare_change_floor_mode(CFM_NO_RETURN);
1514 else if (record_fix_quest)
1515 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1521 * Forcibly pseudo-identify an object in the inventory
1524 * note: currently this function allows pseudo-id of any object,
1525 * including silly ones like potions & scrolls, which always
1526 * get '{average}'. This should be changed, either to stop such
1527 * items from being pseudo-id'd, or to allow psychometry to
1528 * detect whether the unidentified potion/scroll/etc is
1529 * good (Cure Light Wounds, Restore Strength, etc) or
1530 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1532 bool psychometry(void)
1536 char o_name[MAX_NLEN];
1542 item_tester_no_ryoute = TRUE;
1545 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1546 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1548 q = "Meditate on which item? ";
1549 s = "You have nothing appropriate.";
1552 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1554 /* Get the item (in the pack) */
1557 o_ptr = &inventory[item];
1560 /* Get the item (on the floor) */
1563 o_ptr = &o_list[0 - item];
1566 /* It is fully known, no information needed */
1567 if (object_known_p(o_ptr))
1570 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1572 msg_print("You cannot find out anything more about that.");
1578 /* Check for a feeling */
1579 feel = value_check_aux1(o_ptr);
1581 /* Get an object description */
1582 object_desc(o_name, o_ptr, FALSE, 0);
1584 /* Skip non-feelings */
1588 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1590 msg_format("You do not perceive anything unusual about the %s.", o_name);
1597 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1598 o_name, game_inscriptions[feel]);
1600 msg_format("You feel that the %s %s %s...",
1601 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1602 game_inscriptions[feel]);
1606 /* We have "felt" it */
1607 o_ptr->ident |= (IDENT_SENSE);
1610 o_ptr->feeling = feel;
1612 /* Combine / Reorder the pack (later) */
1613 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1616 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1618 /* Valid "tval" codes */
1619 switch (o_ptr->tval)
1647 /* Auto-inscription/destroy */
1648 idx = is_autopick(o_ptr);
1649 auto_inscribe_item(item, idx);
1650 if (okay && destroy_feeling)
1651 auto_destroy_item(item, idx);
1653 /* Something happened */
1658 static void gere_music(s32b music)
1666 stun_monsters(damroll(p_ptr->lev/10,2));
1669 hp_player(damroll(2,6));
1672 project_hack(GF_TURN_ALL, p_ptr->lev);
1675 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1678 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1681 confuse_monsters(p_ptr->lev * 2);
1684 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1687 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1690 project(0, 0, py, px,
1691 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1694 dispel_monsters(randint1(p_ptr->lev * 3));
1695 dispel_evil(randint1(p_ptr->lev * 3));
1702 earthquake(py, px, 10);
1705 stasis_monsters(p_ptr->lev * 4);
1708 dispel_monsters(randint1(p_ptr->lev * 3));
1711 hp_player(damroll(15,10));
1715 case MUSIC_DETECT+19:
1717 case MUSIC_DETECT+11:
1718 case MUSIC_DETECT+12:
1719 case MUSIC_DETECT+13:
1720 case MUSIC_DETECT+14:
1721 case MUSIC_DETECT+15:
1722 case MUSIC_DETECT+16:
1723 case MUSIC_DETECT+17:
1724 case MUSIC_DETECT+18:
1725 map_area(DETECT_RAD_MAP);
1726 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1727 case MUSIC_DETECT+6:
1728 case MUSIC_DETECT+7:
1729 case MUSIC_DETECT+8:
1730 case MUSIC_DETECT+9:
1731 case MUSIC_DETECT+10:
1732 /* There are too many hidden treasure. So... */
1733 /* detect_treasure(DETECT_RAD_DEFAULT); */
1734 detect_objects_gold(DETECT_RAD_DEFAULT);
1735 detect_objects_normal(DETECT_RAD_DEFAULT);
1736 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1737 case MUSIC_DETECT+3:
1738 case MUSIC_DETECT+4:
1739 case MUSIC_DETECT+5:
1740 detect_monsters_invis(DETECT_RAD_DEFAULT);
1741 detect_monsters_normal(DETECT_RAD_DEFAULT);
1742 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1744 case MUSIC_DETECT+1:
1745 case MUSIC_DETECT+2:
1746 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1747 detect_doors(DETECT_RAD_DEFAULT);
1748 detect_stairs(DETECT_RAD_DEFAULT);
1749 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1755 * If player has inscribed the object with "!!", let him know when it's
1758 static void recharged_notice(object_type *o_ptr)
1760 char o_name[MAX_NLEN];
1764 /* No inscription */
1765 if (!o_ptr->inscription) return;
1768 s = strchr(quark_str(o_ptr->inscription), '!');
1770 /* Process notification request. */
1773 /* Find another '!' */
1776 /* Describe (briefly) */
1777 object_desc(o_name, o_ptr, FALSE, 0);
1779 /* Notify the player */
1781 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1783 if (o_ptr->number > 1)
1784 msg_format("Your %s are recharged.", o_name);
1786 msg_format("Your %s is recharged.", o_name);
1795 /* Keep looking for '!'s */
1796 s = strchr(s + 1, '!');
1801 static void check_music(void)
1807 /* Music singed by player */
1808 if (p_ptr->pclass != CLASS_BARD) return;
1809 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1811 spell = p_ptr->magic_num2[0];
1812 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1814 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1815 need_mana *= 0x8000;
1816 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1823 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1824 need_mana = (need_mana & 0xffff);
1825 if ((u32b)p_ptr->csp_frac < need_mana)
1828 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1832 p_ptr->csp_frac -= (u16b)need_mana;
1835 p_ptr->redraw |= PR_MANA;
1836 if (p_ptr->magic_num1[1])
1838 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1839 p_ptr->magic_num1[1] = 0;
1841 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1843 msg_print("You restart singing.");
1845 p_ptr->action = ACTION_SING;
1847 /* Recalculate bonuses */
1848 p_ptr->update |= (PU_BONUS | PU_HP);
1850 /* Redraw map and status bar */
1851 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1853 /* Update monsters */
1854 p_ptr->update |= (PU_MONSTERS);
1857 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1860 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1861 p_ptr->spell_exp[spell] += 5;
1862 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1863 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1864 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1865 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1866 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1867 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1869 gere_music(p_ptr->magic_num1[0]);
1872 /* Choose one of items that have cursed flag */
1873 static object_type *choose_cursed_obj_name(u32b flag)
1876 int choices[INVEN_TOTAL-INVEN_RARM];
1879 /* Paranoia -- Player has no warning-item */
1880 if (!(p_ptr->cursed & flag)) return NULL;
1882 /* Search Inventry */
1883 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1885 object_type *o_ptr = &inventory[i];
1887 if (o_ptr->curse_flags & flag)
1889 choices[number] = i;
1894 /* Choice one of them */
1895 return (&inventory[choices[randint0(number)]]);
1900 * Handle certain things once every 10 game turns
1902 static void process_world(void)
1906 bool cave_no_regen = FALSE;
1907 int upkeep_factor = 0;
1912 const int dec_count = (easy_band ? 2 : 1);
1914 int day, hour, min, prev_min;
1916 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1917 s32b tick = turn % len + len / 4;
1919 extract_day_hour_min(&day, &hour, &min);
1920 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1922 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1924 !(quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) &&
1925 !(p_ptr->inside_battle))
1928 if (p_ptr->inside_battle && !p_ptr->leaving)
1935 /* Count all hostile monsters */
1936 for (i2 = 0; i2 < cur_wid; ++i2)
1937 for (j2 = 0; j2 < cur_hgt; j2++)
1938 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1941 win_m_idx = cave[j2][i2].m_idx;
1944 if (number_mon == 0)
1947 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1949 msg_print("They have kill each other at the same time.");
1952 p_ptr->energy_need = 0;
1955 else if ((number_mon-1) == 0)
1958 monster_type *wm_ptr;
1960 wm_ptr = &m_list[win_m_idx];
1962 monster_desc(m_name, wm_ptr, 0);
1964 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1966 msg_format("%s is winner!", m_name);
1970 if (win_m_idx == (sel_monster+1))
1973 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1975 msg_print("Congratulations.");
1978 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1980 msg_format("You received %d gold.", battle_odds);
1982 p_ptr->au += battle_odds;
1987 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1989 msg_print("You lost gold.");
1993 p_ptr->energy_need = 0;
1996 else if(turn - old_turn == 150*TURNS_PER_TICK)
1999 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
2001 msg_format("This battle have ended in a draw.");
2003 p_ptr->au += kakekin;
2005 p_ptr->energy_need = 0;
2010 /* Every 10 game turns */
2011 if (turn % TURNS_PER_TICK) return;
2013 /*** Check the Time and Load ***/
2015 if (!(turn % (50*TURNS_PER_TICK)))
2017 /* Check time and load */
2018 if ((0 != check_time()) || (0 != check_load()))
2021 if (closing_flag <= 2)
2026 /* Count warnings */
2031 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2032 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2034 msg_print("The gates to ANGBAND are closing...");
2035 msg_print("Please finish up and/or save your game.");
2045 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2047 msg_print("The gates to ANGBAND are now closed.");
2052 p_ptr->playing = FALSE;
2055 p_ptr->leaving = TRUE;
2060 /*** Attempt timed autosave ***/
2061 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2063 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2064 do_cmd_save_game(TRUE);
2070 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2072 msg_print("You hear noise.");
2076 /*** Handle the wilderness/town (sunshine) ***/
2078 /* While in town/wilderness */
2079 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2081 /* Hack -- Daybreak/Nighfall in town */
2082 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2086 /* Check for dawn */
2087 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2094 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2096 msg_print("The sun has risen.");
2100 /* Hack -- Scan the town */
2101 for (y = 0; y < cur_hgt; y++)
2103 for (x = 0; x < cur_wid; x++)
2105 /* Get the cave grid */
2106 c_ptr = &cave[y][x];
2109 c_ptr->info |= (CAVE_GLOW);
2111 /* Hack -- Memorize lit grids if allowed */
2112 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2114 /* Hack -- Notice spot */
2125 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2127 msg_print("The sun has fallen.");
2131 /* Hack -- Scan the town */
2132 for (y = 0; y < cur_hgt; y++)
2134 for (x = 0; x < cur_wid; x++)
2136 /* Get the cave grid */
2137 c_ptr = &cave[y][x];
2139 /* Darken "boring" features */
2140 if ((c_ptr->feat <= FEAT_INVIS) ||
2141 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
2142 (c_ptr->feat <= FEAT_MOUNTAIN) &&
2143 (c_ptr->feat != FEAT_MUSEUM)) ||
2144 (x == 0) || (x == cur_wid-1) ||
2145 (y == 0) || (y == cur_hgt-1))
2147 /* Forget the grid */
2148 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
2150 /* Hack -- Notice spot */
2155 /* Glow deep lava */
2160 /* Update the monsters */
2161 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2164 p_ptr->redraw |= (PR_MAP);
2167 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2171 /* Set back the rewards once a day */
2172 /* Only used for reward in thief's guild for now */
2173 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2177 /* Reset the rewards */
2178 for (n = 0; n < MAX_BACT; n++)
2180 p_ptr->rewards[n] = FALSE;
2185 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2187 if (cheat_xtra) msg_print("Rewards reset.");
2193 /*** Process the monsters ***/
2195 /* Check for creature generation. */
2196 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2197 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2199 /* Make a new monster */
2200 (void)alloc_monster(MAX_SIGHT + 5, 0);
2203 /* Hack -- Check for creature regeneration */
2204 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2205 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2207 /* Hack -- Process the counters of all monsters */
2208 process_monsters_counters();
2211 /*** Damage over Time ***/
2213 /* Take damage from poison */
2214 if (p_ptr->poisoned && !IS_INVULN())
2218 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2220 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2226 /* (Vampires) Take damage from sunlight */
2227 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2229 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2231 if (cave[py][px].info & CAVE_GLOW)
2235 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2236 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2238 msg_print("The sun's rays scorch your undead flesh!");
2239 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2242 cave_no_regen = TRUE;
2246 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2247 !p_ptr->resist_lite)
2249 object_type * o_ptr = &inventory[INVEN_LITE];
2250 char o_name [MAX_NLEN];
2251 char ouch [MAX_NLEN+40];
2253 /* Get an object description */
2254 object_desc(o_name, o_ptr, FALSE, 0);
2257 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2259 msg_format("The %s scorches your undead flesh!", o_name);
2263 cave_no_regen = TRUE;
2265 /* Get an object description */
2266 object_desc(o_name, o_ptr, TRUE, 0);
2269 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2271 sprintf(ouch, "wielding %s", o_name);
2274 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2278 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2279 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2281 int damage = 3000 + randint0(2000);
2283 if (prace_is_(RACE_ENT)) damage += damage/3;
2284 if (p_ptr->resist_fire) damage = damage / 3;
2285 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2286 damage = damage / 100 + (randint0(100) < (damage % 100));
2292 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2293 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2295 msg_print("The lava burns you!");
2296 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2299 cave_no_regen = TRUE;
2303 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2304 !IS_INVULN() && !p_ptr->immune_fire)
2306 int damage = 6000 + randint0(4000);
2311 if (p_ptr->resist_fire) damage = damage / 3;
2312 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2316 damage = damage / 5;
2319 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2320 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2322 message = "The heat burns you!";
2323 hit_from = "flying over deep lava";
2330 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2331 hit_from = "¿¼¤¤ÍÏ´äή";
2333 message = "The lava burns you!";
2334 hit_from = "deep lava";
2339 damage = damage / 100 + (randint0(100) < (damage % 100));
2344 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2346 cave_no_regen = TRUE;
2350 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2352 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2356 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2357 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2359 msg_print("You are drowning!");
2360 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2363 cave_no_regen = TRUE;
2370 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2372 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2373 if (prace_is_(RACE_ENT)) damage += damage / 3;
2374 if (p_ptr->resist_fire) damage = damage / 3;
2375 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2377 msg_print("Ç®¤¤¡ª");
2378 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2380 msg_print("It's hot!");
2381 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2384 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2386 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2387 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2388 if (p_ptr->resist_elec) damage = damage / 3;
2389 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2391 msg_print("Äˤ¤¡ª");
2392 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2394 msg_print("It hurts!");
2395 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2398 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2400 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2401 if (p_ptr->resist_cold) damage = damage / 3;
2402 if (IS_OPPOSE_COLD()) damage = damage / 3;
2404 msg_print("Î䤿¤¤¡ª");
2405 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2407 msg_print("It's cold!");
2408 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2413 /* Spectres -- take damage when moving through walls */
2415 * Added: ANYBODY takes damage if inside through walls
2416 * without wraith form -- NOTE: Spectres will never be
2417 * reduced below 0 hp by being inside a stone wall; others
2420 if (!cave_floor_bold(py, px))
2422 /* Player can walk through trees */
2423 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2427 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2428 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2432 cave_no_regen = TRUE;
2434 if (p_ptr->pass_wall)
2437 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2440 msg_print("Your molecules feel disrupted!");
2441 dam_desc = "density";
2448 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2449 dam_desc = "¹Å¤¤´ä";
2451 msg_print("You are being crushed!");
2452 dam_desc = "solid rock";
2457 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2463 monster_race *r_ptr;
2465 if (min != prev_min)
2468 bool old_inside_battle = p_ptr->inside_battle;
2470 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2472 p_ptr->inside_battle = TRUE;
2473 get_mon_num_prep(NULL,NULL);
2475 for (i = 0; i < max_d_idx; i++)
2477 if (max_dlv[i] < d_info[i].mindepth) continue;
2478 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2482 today_mon = get_mon_num(max_dl);
2483 r_ptr = &r_info[today_mon];
2485 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2486 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2487 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2488 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2489 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2490 if (r_ptr->rarity > 10) continue;
2491 if (r_ptr->level == 0) continue;
2494 p_ptr->today_mon = 0;
2495 p_ptr->inside_battle = old_inside_battle;
2499 /* Nightmare mode activates the TY_CURSE at midnight */
2500 if (ironman_nightmare)
2502 /* Require exact minute */
2503 if (min != prev_min)
2505 /* Every 15 minutes after 11:00 pm */
2506 if ((hour == 23) && !(min % 15))
2516 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2518 msg_print("You hear a distant bell toll ominously.");
2526 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2528 msg_print("A distant bell sounds twice.");
2536 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2538 msg_print("A distant bell sounds three times.");
2546 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2548 msg_print("A distant bell tolls four times.");
2556 /* TY_CURSE activates at mignight! */
2563 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2565 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2568 activate_ty_curse(FALSE, &count);
2573 /* Take damage from cuts */
2574 if (p_ptr->cut && !IS_INVULN())
2576 /* Mortal wound or Deep Gash */
2577 if (p_ptr->cut > 1000)
2582 else if (p_ptr->cut > 200)
2588 else if (p_ptr->cut > 100)
2593 else if (p_ptr->cut > 50)
2598 else if (p_ptr->cut > 25)
2603 else if (p_ptr->cut > 10)
2616 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2618 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2624 /*** Check the Food, and Regenerate ***/
2626 if (!p_ptr->inside_battle)
2628 /* Digest normally */
2629 if (p_ptr->food < PY_FOOD_MAX)
2631 /* Every 50 game turns */
2632 if (!(turn % (TURNS_PER_TICK*5)))
2634 /* Basic digestion rate based on speed */
2635 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2637 /* Regeneration takes more food */
2638 if (p_ptr->regenerate) i += 20;
2639 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2640 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2642 /* Slow digestion takes less food */
2643 if (p_ptr->slow_digest) i -= 5;
2645 /* Minimal digestion */
2647 /* Maximal digestion */
2648 if (i > 100) i = 100;
2650 /* Digest some food */
2651 (void)set_food(p_ptr->food - i);
2655 /* Digest quickly when gorged */
2658 /* Digest a lot of food */
2659 (void)set_food(p_ptr->food - 100);
2663 /* Starve to death (slowly) */
2664 if (p_ptr->food < PY_FOOD_STARVE)
2666 /* Calculate damage */
2667 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2671 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2673 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2678 /* Default regeneration */
2679 regen_amount = PY_REGEN_NORMAL;
2682 if (p_ptr->food < PY_FOOD_WEAK)
2684 /* Lower regeneration */
2685 if (p_ptr->food < PY_FOOD_STARVE)
2689 else if (p_ptr->food < PY_FOOD_FAINT)
2691 regen_amount = PY_REGEN_FAINT;
2695 regen_amount = PY_REGEN_WEAK;
2699 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2701 /* Faint occasionally */
2702 if (!p_ptr->paralyzed && (randint0(100) < 10))
2706 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2708 msg_print("You faint from the lack of food.");
2713 /* Hack -- faint (bypass free action) */
2714 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2720 /* Are we walking the pattern? */
2721 if (pattern_effect())
2723 cave_no_regen = TRUE;
2727 /* Regeneration ability */
2728 if (p_ptr->regenerate)
2730 regen_amount = regen_amount * 2;
2732 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2736 if (p_ptr->cursed & TRC_SLOW_REGEN)
2743 /* Searching or Resting */
2744 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2746 regen_amount = regen_amount * 2;
2749 upkeep_factor = calculate_upkeep();
2751 /* Regenerate the mana */
2752 /* if (p_ptr->csp < p_ptr->msp) */
2756 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2757 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2758 regenmana(upkeep_regen/100);
2760 #ifdef TRACK_FRIENDS
2764 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2766 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2770 #endif /* TRACK_FRIENDS */
2773 else if (p_ptr->action != ACTION_LEARN)
2775 regenmana(regen_amount);
2778 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2780 regenmagic(regen_amount);
2783 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2785 while (upkeep_factor > 100)
2788 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2790 msg_print("Such much pets cannot be controled at once!");
2793 do_cmd_pet_dismiss();
2795 upkeep_factor = calculate_upkeep();
2798 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2800 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2806 /* Poisoned or cut yields no healing */
2807 if (p_ptr->poisoned) regen_amount = 0;
2808 if (p_ptr->cut) regen_amount = 0;
2810 /* Special floor -- Pattern, in a wall -- yields no healing */
2811 if (cave_no_regen) regen_amount = 0;
2813 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2815 /* Regenerate Hit Points if needed */
2816 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2818 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2819 (cave[py][px].feat >= FEAT_PATTERN_START))
2821 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2825 regenhp(regen_amount);
2830 /*** Timeout Various Things ***/
2833 if (p_ptr->tim_mimic)
2835 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2838 /* Hack -- Hallucinating */
2841 (void)set_image(p_ptr->image - dec_count);
2847 (void)set_blind(p_ptr->blind - dec_count);
2850 /* Times see-invisible */
2851 if (p_ptr->tim_invis)
2853 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2864 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2867 /* Timed temporary elemental brands. -LM- */
2868 if (p_ptr->ele_attack)
2870 p_ptr->ele_attack--;
2872 /* Clear all temporary elemental brands. */
2873 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2876 /* Timed temporary elemental immune. -LM- */
2877 if (p_ptr->ele_immune)
2879 p_ptr->ele_immune--;
2881 /* Clear all temporary elemental brands. */
2882 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2885 /* Timed infra-vision */
2886 if (p_ptr->tim_infra)
2888 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2892 if (p_ptr->tim_stealth)
2894 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2897 /* Timed levitation */
2898 if (p_ptr->tim_ffall)
2900 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2903 /* Timed sh_touki */
2904 if (p_ptr->tim_sh_touki)
2906 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2910 if (p_ptr->tim_sh_fire)
2912 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2916 if (p_ptr->tim_sh_holy)
2918 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2922 if (p_ptr->tim_eyeeye)
2924 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2927 /* Timed resist-magic */
2928 if (p_ptr->resist_magic)
2930 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2933 /* Timed regeneration */
2934 if (p_ptr->tim_regen)
2936 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2939 /* Timed resist nether */
2940 if (p_ptr->tim_res_nether)
2942 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2945 /* Timed resist time */
2946 if (p_ptr->tim_res_time)
2948 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2952 if (p_ptr->tim_reflect)
2954 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2958 if (p_ptr->multishadow)
2960 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2963 /* Timed Robe of dust */
2964 if (p_ptr->dustrobe)
2966 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2969 /* Timed infra-vision */
2970 if (p_ptr->kabenuke)
2972 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2976 if (p_ptr->paralyzed)
2978 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2982 if (p_ptr->confused)
2984 (void)set_confused(p_ptr->confused - dec_count);
2990 (void)set_afraid(p_ptr->afraid - dec_count);
2996 (void)set_fast(p_ptr->fast - 1, TRUE);
3002 (void)set_slow(p_ptr->slow - dec_count, TRUE);
3005 /* Protection from evil */
3006 if (p_ptr->protevil)
3008 (void)set_protevil(p_ptr->protevil - 1, TRUE);
3011 /* Invulnerability */
3014 (void)set_invuln(p_ptr->invuln - 1, TRUE);
3018 if (p_ptr->wraith_form)
3020 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3026 (void)set_hero(p_ptr->hero - 1, TRUE);
3032 (void)set_shero(p_ptr->shero - 1, TRUE);
3038 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3044 (void)set_shield(p_ptr->shield - 1, TRUE);
3048 if (p_ptr->tsubureru)
3050 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3054 if (p_ptr->magicdef)
3056 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3060 if (p_ptr->tsuyoshi)
3062 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3066 if (p_ptr->oppose_acid)
3068 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3071 /* Oppose Lightning */
3072 if (p_ptr->oppose_elec)
3074 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3078 if (p_ptr->oppose_fire)
3080 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3084 if (p_ptr->oppose_cold)
3086 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3090 if (p_ptr->oppose_pois)
3092 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3097 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3100 /*** Poison and Stun and Cut ***/
3103 if (p_ptr->poisoned)
3105 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3107 /* Apply some healing */
3108 (void)set_poisoned(p_ptr->poisoned - adjust);
3114 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3116 /* Apply some healing */
3117 (void)set_stun(p_ptr->stun - adjust);
3123 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3125 /* Hack -- Truly "mortal" wound */
3126 if (p_ptr->cut > 1000) adjust = 0;
3128 /* Apply some healing */
3129 (void)set_cut(p_ptr->cut - adjust);
3134 /*** Process Light ***/
3136 /* Check for light being wielded */
3137 o_ptr = &inventory[INVEN_LITE];
3139 /* Burn some fuel in the current lite */
3140 if (o_ptr->tval == TV_LITE)
3142 /* Hack -- Use some fuel (except on artifacts) */
3143 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3145 /* Decrease life-span */
3146 if (o_ptr->name2 == EGO_LITE_LONG)
3148 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3150 else o_ptr->xtra4--;
3152 /* Notice interesting fuel steps */
3153 notice_lite_change(o_ptr);
3157 /* Calculate torch radius */
3158 p_ptr->update |= (PU_TORCH);
3161 /*** Process mutation effects ***/
3162 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3164 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3168 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3169 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3171 msg_print("RAAAAGHH!");
3172 msg_print("You feel a fit of rage coming over you!");
3175 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3178 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3180 if (!p_ptr->resist_fear)
3184 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3186 msg_print("It's so dark... so scary!");
3189 set_afraid(p_ptr->afraid + 13 + randint1(26));
3193 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3195 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3200 /* Teleport player */
3202 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3204 msg_print("Your position suddenly seems very uncertain...");
3208 teleport_player(40);
3212 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3214 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3217 p_ptr->redraw |= PR_EXTRA;
3219 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3221 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3226 if (!p_ptr->resist_conf)
3228 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3231 if (!p_ptr->resist_chaos)
3236 if (one_in_(3)) lose_all_info();
3238 teleport_player(100);
3241 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3242 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3244 msg_print("You wake up somewhere with a sore head...");
3245 msg_print("You can't remember a thing, or how you got here!");
3254 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3256 msg_print("Thishcischs GooDSChtuff!");
3259 (void)set_image(p_ptr->image + randint0(150) + 150);
3265 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3267 if (!p_ptr->resist_chaos)
3270 p_ptr->redraw |= PR_EXTRA;
3271 (void)set_image(p_ptr->image + randint0(50) + 20);
3275 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3280 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3282 msg_print("BRRAAAP! Oops.");
3286 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3289 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3290 !p_ptr->anti_magic && one_in_(9000))
3295 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3297 msg_print("Magical energy flows through you! You must release it!");
3302 (void)get_hack_dir(&dire);
3303 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3306 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3307 !p_ptr->anti_magic && (randint1(6666) == 666))
3309 bool pet = one_in_(6);
3310 u32b mode = PM_ALLOW_GROUP;
3312 if (pet) mode |= PM_FORCE_PET;
3313 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3315 if (summon_specific((pet ? -1 : 0), py, px,
3316 dun_level, SUMMON_DEMON, mode))
3319 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3321 msg_print("You have attracted a demon!");
3328 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3334 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3336 msg_print("You feel less energetic.");
3339 if (p_ptr->fast > 0)
3345 set_slow(randint1(30) + 10, FALSE);
3351 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3353 msg_print("You feel more energetic.");
3356 if (p_ptr->slow > 0)
3362 set_fast(randint1(30) + 10, FALSE);
3367 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3371 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3373 msg_print("You suddenly feel almost lonely.");
3376 banish_monsters(100);
3377 if (!dun_level && p_ptr->town_num)
3380 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3382 msg_print("You see one of the shopkeepers running for the hills!");
3385 store_shuffle(randint0(MAX_STORES));
3390 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3395 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3397 msg_print("A shadow passes over you.");
3402 /* Absorb light from the current possition */
3403 if (cave[py][px].info & CAVE_GLOW)
3408 o_ptr = &inventory[INVEN_LITE];
3410 /* Absorb some fuel in the current lite */
3411 if (o_ptr->tval == TV_LITE)
3413 /* Use some fuel (except on artifacts) */
3414 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3416 /* Heal the player a bit */
3417 hp_player(o_ptr->xtra4 / 20);
3419 /* Decrease life-span of lite */
3423 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3425 msg_print("You absorb energy from your light!");
3429 /* Notice interesting fuel steps */
3430 notice_lite_change(o_ptr);
3435 * Unlite the area (radius 10) around player and
3436 * do 50 points damage to every affected monster
3438 unlite_area(50, 10);
3441 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3442 !p_ptr->anti_magic && one_in_(7000))
3444 bool pet = one_in_(3);
3445 u32b mode = PM_ALLOW_GROUP;
3447 if (pet) mode |= PM_FORCE_PET;
3448 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3450 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3453 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3455 msg_print("You have attracted an animal!");
3462 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3463 !p_ptr->anti_magic && one_in_(8000))
3467 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3469 msg_print("You feel the world warping around you!");
3473 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3475 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3477 if (!lose_mutation(0))
3479 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3481 msg_print("You feel oddly normal.");
3485 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3489 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3491 msg_print("You feel insubstantial!");
3495 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3497 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3501 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3503 int which_stat = randint0(6);
3504 int sustained = FALSE;
3509 if (p_ptr->sustain_str) sustained = TRUE;
3512 if (p_ptr->sustain_int) sustained = TRUE;
3515 if (p_ptr->sustain_wis) sustained = TRUE;
3518 if (p_ptr->sustain_dex) sustained = TRUE;
3521 if (p_ptr->sustain_con) sustained = TRUE;
3524 if (p_ptr->sustain_chr) sustained = TRUE;
3528 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3530 msg_print("Invalid stat chosen!");
3540 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3542 msg_print("You can feel yourself wasting away!");
3546 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3549 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3550 !p_ptr->anti_magic && one_in_(3000))
3552 bool pet = one_in_(5);
3553 u32b mode = PM_ALLOW_GROUP;
3555 if (pet) mode |= PM_FORCE_PET;
3556 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3558 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3561 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3563 msg_print("You have attracted a dragon!");
3569 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3572 if (p_ptr->tim_esp > 0)
3575 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3577 msg_print("Your mind feels cloudy!");
3580 set_tim_esp(0, TRUE);
3585 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3587 msg_print("Your mind expands!");
3590 set_tim_esp(p_ptr->lev, FALSE);
3593 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3598 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3600 msg_print("Your stomach roils, and you lose your lunch!");
3604 set_food(PY_FOOD_WEAK);
3607 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3608 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3613 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3615 int danger_amount = 0;
3618 for (monster = 0; monster < m_max; monster++)
3620 monster_type *m_ptr = &m_list[monster];
3621 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3623 /* Paranoia -- Skip dead monsters */
3624 if (!m_ptr->r_idx) continue;
3626 if (r_ptr->level >= p_ptr->lev)
3628 danger_amount += r_ptr->level - p_ptr->lev + 1;
3632 if (danger_amount > 100)
3634 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3636 msg_print("You feel utterly terrified!");
3639 else if (danger_amount > 50)
3641 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3643 msg_print("You feel terrified!");
3646 else if (danger_amount > 20)
3648 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3650 msg_print("You feel very worried!");
3653 else if (danger_amount > 10)
3655 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3657 msg_print("You feel paranoid!");
3660 else if (danger_amount > 5)
3662 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3664 msg_print("You feel almost safe.");
3669 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3671 msg_print("You feel lonely.");
3675 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3680 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3682 msg_print("You feel invincible!");
3686 (void)set_invuln(randint1(8) + 8, FALSE);
3688 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3690 int wounds = p_ptr->mhp - p_ptr->chp;
3694 int healing = p_ptr->csp;
3696 if (healing > wounds)
3702 p_ptr->csp -= healing;
3705 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3708 int wounds = p_ptr->msp - p_ptr->csp;
3712 int healing = p_ptr->chp;
3714 if (healing > wounds)
3719 p_ptr->csp += healing;
3721 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3723 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3728 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3734 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3735 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3737 msg_print("You trip over your own feet!");
3738 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3743 if (buki_motteruka(INVEN_RARM))
3745 int slot = INVEN_RARM;
3746 o_ptr = &inventory[INVEN_RARM];
3747 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3749 o_ptr = &inventory[INVEN_LARM];
3752 if (!cursed_p(o_ptr))
3755 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3757 msg_print("You drop your weapon!");
3760 inven_drop(slot, 1);
3767 /*** Process Inventory ***/
3769 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3772 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3773 * can actually be useful!
3775 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3778 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3780 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3784 teleport_player(50);
3787 /* Make a chainsword noise */
3788 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3792 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3794 if (!get_rnd_line("chainswd.txt", 0, noise))
3797 disturb(FALSE, FALSE);
3800 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3803 (void)activate_ty_curse(FALSE, &count);
3805 /* Handle experience draining */
3806 if (p_ptr->prace != RACE_ANDROID &&
3807 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3809 p_ptr->exp -= (p_ptr->lev+1)/2;
3810 if (p_ptr->exp < 0) p_ptr->exp = 0;
3811 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3812 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3815 /* Add light curse (Later) */
3816 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3821 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3823 new_curse = get_curse(0, o_ptr);
3824 if (!(o_ptr->curse_flags & new_curse))
3826 char o_name[MAX_NLEN];
3828 object_desc(o_name, o_ptr, FALSE, 0);
3830 o_ptr->curse_flags |= new_curse;
3832 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3834 msg_format("There is a malignant black aura surrounding %s...", o_name);
3837 o_ptr->feeling = FEEL_NONE;
3839 p_ptr->update |= (PU_BONUS);
3842 /* Add heavy curse (Later) */
3843 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3848 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3850 new_curse = get_curse(1, o_ptr);
3851 if (!(o_ptr->curse_flags & new_curse))
3853 char o_name[MAX_NLEN];
3855 object_desc(o_name, o_ptr, FALSE, 0);
3857 o_ptr->curse_flags |= new_curse;
3859 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3861 msg_format("There is a malignant black aura surrounding %s...", o_name);
3864 o_ptr->feeling = FEEL_NONE;
3866 p_ptr->update |= (PU_BONUS);
3870 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3872 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3873 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3875 char o_name[MAX_NLEN];
3877 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3879 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3881 msg_format("%s have attracted an animal!", o_name);
3888 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3890 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3892 char o_name[MAX_NLEN];
3894 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3896 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3898 msg_format("%s have attracted a demon!", o_name);
3905 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3907 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3908 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3910 char o_name[MAX_NLEN];
3912 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3914 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3916 msg_format("%s have attracted an animal!", o_name);
3922 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3924 if (!p_ptr->resist_fear)
3928 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3930 msg_print("It's so dark... so scary!");
3933 set_afraid(p_ptr->afraid + 13 + randint1(26));
3936 /* Teleport player */
3937 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3941 /* Teleport player */
3942 teleport_player(40);
3944 /* Handle HP draining */
3945 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3947 char o_name[MAX_NLEN];
3949 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3951 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3953 msg_format("%s drains HP from you!", o_name);
3955 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3957 /* Handle mana draining */
3958 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3960 char o_name[MAX_NLEN];
3962 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3964 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3966 msg_format("%s drains mana from you!", o_name);
3968 p_ptr->csp -= MIN(p_ptr->lev, 50);
3972 p_ptr->csp_frac = 0;
3974 p_ptr->redraw |= PR_MANA;
3978 /* Rarely, take damage from the Jewel of Judgement */
3979 if (one_in_(999) && !p_ptr->anti_magic)
3981 object_type *o_ptr = &inventory[INVEN_LITE];
3983 if (o_ptr->name1 == ART_JUDGE)
3986 if (object_known_p(o_ptr))
3987 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3989 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3990 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3992 if (object_known_p(o_ptr))
3993 msg_print("The Jewel of Judgement drains life from you!");
3995 msg_print("Something drains life from you!");
3996 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
4002 /* Process equipment */
4003 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
4005 /* Get the object */
4006 o_ptr = &inventory[i];
4008 /* Skip non-objects */
4009 if (!o_ptr->k_idx) continue;
4011 /* Recharge activatable objects */
4012 if (o_ptr->timeout > 0)
4017 /* Notice changes */
4018 if (!o_ptr->timeout)
4020 recharged_notice(o_ptr);
4026 /* Notice changes */
4030 p_ptr->window |= (PW_EQUIP);
4035 * Recharge rods. Rods now use timeout to control charging status,
4036 * and each charging rod in a stack decreases the stack's timeout by
4037 * one per turn. -LM-
4039 for (j = 0, i = 0; i < INVEN_PACK; i++)
4041 o_ptr = &inventory[i];
4042 k_ptr = &k_info[o_ptr->k_idx];
4044 /* Skip non-objects */
4045 if (!o_ptr->k_idx) continue;
4047 /* Examine all charging rods or stacks of charging rods. */
4048 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4050 /* Determine how many rods are charging. */
4051 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4052 if (temp > o_ptr->number) temp = o_ptr->number;
4054 /* Decrease timeout by that number. */
4055 o_ptr->timeout -= temp;
4057 /* Boundary control. */
4058 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4060 /* Notice changes, provide message if object is inscribed. */
4061 if (!(o_ptr->timeout))
4063 recharged_notice(o_ptr);
4069 /* Notice changes */
4073 p_ptr->notice |= (PN_COMBINE);
4076 p_ptr->window |= (PW_INVEN);
4080 /* Feel the inventory */
4085 /*** Process Objects ***/
4087 /* Process objects */
4088 for (i = 1; i < o_max; i++)
4093 /* Skip dead objects */
4094 if (!o_ptr->k_idx) continue;
4096 /* Recharge rods on the ground. No messages. */
4097 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4100 o_ptr->timeout -= o_ptr->number;
4102 /* Boundary control. */
4103 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4108 /*** Involuntary Movement ***/
4110 /* Delayed Word-of-Recall */
4111 if (p_ptr->word_recall)
4114 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4115 * The player is yanked up/down as soon as
4116 * he loads the autosaved game.
4118 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4119 do_cmd_save_game(TRUE);
4121 /* Count down towards recall */
4122 p_ptr->word_recall--;
4124 p_ptr->redraw |= (PR_STATUS);
4126 /* Activate the recall */
4127 if (!p_ptr->word_recall)
4132 /* Determine the level */
4133 if (dun_level || p_ptr->inside_quest)
4136 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4138 msg_print("You feel yourself yanked upwards!");
4141 p_ptr->recall_dungeon = dungeon_type;
4143 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4147 prepare_change_floor_mode(CFM_CLEAR_ALL);
4149 leave_quest_check();
4151 p_ptr->inside_quest = 0;
4152 p_ptr->leaving = TRUE;
4157 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4159 msg_print("You feel yourself yanked downwards!");
4162 dungeon_type = p_ptr->recall_dungeon;
4165 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4168 dun_level = max_dlv[dungeon_type];
4169 if (dun_level < 1) dun_level = 1;
4171 /* Nightmare mode makes recall more dangerous */
4172 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4178 else if (dun_level < 99)
4180 dun_level = (dun_level + 99) / 2;
4182 else if (dun_level > 100)
4184 dun_level = d_info[dungeon_type].maxdepth - 1;
4188 if (p_ptr->wild_mode)
4190 p_ptr->wilderness_y = py;
4191 p_ptr->wilderness_x = px;
4195 /* Save player position */
4199 p_ptr->wild_mode = FALSE;
4201 prepare_change_floor_mode(CFM_CLEAR_ALL);
4204 p_ptr->leaving = TRUE;
4206 if (dungeon_type == DUNGEON_ANGBAND)
4208 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4210 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4211 (quest[i].status == QUEST_STATUS_TAKEN) &&
4212 (quest[i].level < dun_level))
4214 quest[i].status = QUEST_STATUS_FAILED;
4215 quest[i].complev = (byte)p_ptr->lev;
4216 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4223 sound(SOUND_TPLEVEL);
4228 /* Delayed Alter reality */
4229 if (p_ptr->alter_reality)
4231 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4232 do_cmd_save_game(TRUE);
4234 /* Count down towards alter */
4235 p_ptr->alter_reality--;
4237 p_ptr->redraw |= (PR_STATUS);
4239 /* Activate the alter reality */
4240 if (!p_ptr->alter_reality)
4245 /* Determine the level */
4246 if (!quest_number(dun_level) && dun_level)
4249 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4251 msg_print("The world changes!");
4254 prepare_change_floor_mode(CFM_CLEAR_ALL);
4257 p_ptr->leaving = TRUE;
4262 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4264 msg_print("The world seems to change for a moment!");
4269 sound(SOUND_TPLEVEL);
4277 * Verify use of "wizard" mode
4279 static bool enter_wizard_mode(void)
4281 /* Ask first time */
4282 if (!p_ptr->noscore)
4284 /* Wizard mode is not permitted */
4285 if (!allow_debug_opts)
4288 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4290 msg_print("Wizard mode is not permitted.");
4295 /* Mention effects */
4297 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4298 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4300 msg_print("Wizard mode is for debugging and experimenting.");
4301 msg_print("The game will not be scored if you enter wizard mode.");
4306 /* Verify request */
4308 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4310 if (!get_check("Are you sure you want to enter wizard mode? "))
4317 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4319 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4322 p_ptr->noscore |= 0x0002;
4333 * Verify use of "debug" commands
4335 static bool enter_debug_mode(void)
4337 /* Ask first time */
4338 if (!p_ptr->noscore)
4340 /* Debug mode is not permitted */
4341 if (!allow_debug_opts)
4344 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4346 msg_print("Use of debug command is not permitted.");
4351 /* Mention effects */
4353 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4354 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4356 msg_print("The debug commands are for debugging and experimenting.");
4357 msg_print("The game will not be scored if you use debug commands.");
4362 /* Verify request */
4364 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4366 if (!get_check("Are you sure you want to use debug commands? "))
4373 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4375 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4378 p_ptr->noscore |= 0x0008;
4386 * Hack -- Declare the Debug Routines
4388 extern void do_cmd_debug(void);
4390 #endif /* ALLOW_WIZARD */
4396 * Verify use of "borg" commands
4398 static bool enter_borg_mode(void)
4400 /* Ask first time */
4401 if (!(p_ptr->noscore & 0x0010))
4403 /* Mention effects */
4405 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4406 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4408 msg_print("The borg commands are for debugging and experimenting.");
4409 msg_print("The game will not be scored if you use borg commands.");
4414 /* Verify request */
4416 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4418 if (!get_check("Are you sure you want to use borg commands? "))
4425 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4427 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4430 p_ptr->noscore |= 0x0010;
4438 * Hack -- Declare the Ben Borg
4440 extern void do_cmd_borg(void);
4442 #endif /* ALLOW_BORG */
4447 * Parse and execute the current command
4448 * Give "Warning" on illegal commands.
4450 * XXX XXX XXX Make some "blocks"
4452 static void process_command(void)
4454 int old_now_message = now_message;
4456 #ifdef ALLOW_REPEAT /* TNB */
4458 /* Handle repeating the last command */
4461 #endif /* ALLOW_REPEAT -- TNB */
4465 /* Parse the command */
4466 switch (command_cmd)
4482 /*** Wizard Commands ***/
4484 /* Toggle Wizard Mode */
4489 p_ptr->wizard = FALSE;
4491 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4493 msg_print("Wizard mode off.");
4497 else if (enter_wizard_mode())
4499 p_ptr->wizard = TRUE;
4501 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4503 msg_print("Wizard mode on.");
4508 /* Update monsters */
4509 p_ptr->update |= (PU_MONSTERS);
4511 /* Redraw "title" */
4512 p_ptr->redraw |= (PR_TITLE);
4520 /* Special "debug" commands */
4523 /* Enter debug mode */
4524 if (enter_debug_mode())
4531 #endif /* ALLOW_WIZARD */
4536 /* Special "borg" commands */
4539 /* Enter borg mode */
4540 if (enter_borg_mode())
4542 if (!p_ptr->wild_mode) do_cmd_borg();
4548 #endif /* ALLOW_BORG */
4552 /*** Inventory Commands ***/
4554 /* Wear/wield equipment */
4557 if (!p_ptr->wild_mode) do_cmd_wield();
4561 /* Take off equipment */
4564 if (!p_ptr->wild_mode) do_cmd_takeoff();
4571 if (!p_ptr->wild_mode) do_cmd_drop();
4575 /* Destroy an item */
4582 /* Equipment list */
4589 /* Inventory list */
4597 /*** Various commands ***/
4599 /* Identify an object */
4606 /* Hack -- toggle windows */
4609 toggle_inven_equip();
4614 /*** Standard "Movement" Commands ***/
4619 if (!p_ptr->wild_mode) do_cmd_alter();
4626 if (!p_ptr->wild_mode) do_cmd_tunnel();
4630 /* Move (usually pick up things) */
4633 #ifdef ALLOW_EASY_DISARM /* TNB */
4637 #else /* ALLOW_EASY_DISARM -- TNB */
4639 do_cmd_walk(always_pickup);
4641 #endif /* ALLOW_EASY_DISARM -- TNB */
4646 /* Move (usually do not pick up) */
4649 #ifdef ALLOW_EASY_DISARM /* TNB */
4653 #else /* ALLOW_EASY_DISARM -- TNB */
4655 do_cmd_walk(!always_pickup);
4657 #endif /* ALLOW_EASY_DISARM -- TNB */
4663 /*** Running, Resting, Searching, Staying */
4665 /* Begin Running -- Arg is Max Distance */
4668 if (!p_ptr->wild_mode) do_cmd_run();
4672 /* Stay still (usually pick things up) */
4675 do_cmd_stay(always_pickup);
4679 /* Stay still (usually do not pick up) */
4682 do_cmd_stay(!always_pickup);
4686 /* Rest -- Arg is time */
4693 /* Search for traps/doors */
4700 /* Toggle search mode */
4703 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4704 else set_action(ACTION_SEARCH);
4709 /*** Stairs and Doors and Chests and Traps ***/
4712 case SPECIAL_KEY_STORE:
4714 if (!p_ptr->wild_mode) do_cmd_store();
4718 /* Enter building -KMW- */
4719 case SPECIAL_KEY_BUILDING:
4721 if (!p_ptr->wild_mode) do_cmd_bldg();
4725 /* Enter quest level -KMW- */
4726 case SPECIAL_KEY_QUEST:
4728 if (!p_ptr->wild_mode) do_cmd_quest();
4732 /* Go up staircase */
4735 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4742 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4744 msg_print("To flee the ambush you have to reach the edge of the map.");
4747 else if (p_ptr->food < PY_FOOD_WEAK)
4750 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4752 msg_print("You must eat something here.");
4757 if (change_wild_mode())
4770 /* Go down staircase */
4773 if(!p_ptr->wild_mode) do_cmd_go_down();
4776 p_ptr->wilderness_x = px;
4777 p_ptr->wilderness_y = py;
4783 /* Open a door or chest */
4786 if (!p_ptr->wild_mode) do_cmd_open();
4793 if (!p_ptr->wild_mode) do_cmd_close();
4797 /* Jam a door with spikes */
4800 if (!p_ptr->wild_mode) do_cmd_spike();
4807 if (!p_ptr->wild_mode) do_cmd_bash();
4811 /* Disarm a trap or chest */
4814 if (!p_ptr->wild_mode) do_cmd_disarm();
4819 /*** Magic and Prayers ***/
4821 /* Gain new spells/prayers */
4824 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4826 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4828 msg_print("You don't have to learn spells!");
4830 else if (p_ptr->pclass == CLASS_SAMURAI)
4831 do_cmd_gain_hissatsu();
4832 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4842 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4843 (p_ptr->pclass == CLASS_BERSERKER) ||
4844 (p_ptr->pclass == CLASS_NINJA) ||
4845 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4846 ) do_cmd_mind_browse();
4847 else if (p_ptr->pclass == CLASS_SMITH)
4849 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4850 do_cmd_magic_eater(TRUE);
4851 else do_cmd_browse();
4859 if (!p_ptr->wild_mode)
4861 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4864 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4866 msg_print("You cannot cast spells!");
4869 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4872 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4874 msg_print("The dungeon absorbs all attempted magic!");
4878 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4882 cptr which_power = "ËâË¡";
4884 cptr which_power = "magic";
4886 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4888 which_power = "ĶǽÎÏ";
4890 which_power = "psionic powers";
4892 else if (p_ptr->pclass == CLASS_IMITATOR)
4894 which_power = "¤â¤Î¤Þ¤Í";
4896 which_power = "imitation";
4898 else if (p_ptr->pclass == CLASS_SAMURAI)
4900 which_power = "ɬ»¦·õ";
4902 which_power = "hissatsu";
4904 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4906 which_power = "¶ÀËâË¡";
4908 which_power = "mirror magic";
4910 else if (p_ptr->pclass == CLASS_NINJA)
4912 which_power = "Ǧ½Ñ";
4914 which_power = "ninjutsu";
4916 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4918 which_power = "µ§¤ê";
4920 which_power = "prayer";
4924 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4926 msg_format("An anti-magic shell disrupts your %s!", which_power);
4930 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4933 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4935 msg_format("You cannot think directly!");
4941 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4942 (p_ptr->pclass == CLASS_BERSERKER) ||
4943 (p_ptr->pclass == CLASS_NINJA) ||
4944 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4947 else if (p_ptr->pclass == CLASS_IMITATOR)
4949 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4950 do_cmd_magic_eater(FALSE);
4951 else if (p_ptr->pclass == CLASS_SAMURAI)
4953 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4954 do_cmd_cast_learned();
4955 else if (p_ptr->pclass == CLASS_SMITH)
4964 /* Issue a pet command */
4967 if (!p_ptr->wild_mode) do_cmd_pet();
4971 /*** Use various objects ***/
4973 /* Inscribe an object */
4980 /* Uninscribe an object */
4983 do_cmd_uninscribe();
4987 /* Activate an artifact */
4990 if (!p_ptr->wild_mode)
4992 if (!p_ptr->inside_arena)
4997 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4999 msg_print("The arena absorbs all attempted magic!");
5015 /* Fuel your lantern/torch */
5025 if (!p_ptr->wild_mode) do_cmd_fire();
5032 if (!p_ptr->wild_mode)
5042 if (!p_ptr->wild_mode)
5044 if (!p_ptr->inside_arena)
5049 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5051 msg_print("The arena absorbs all attempted magic!");
5063 if (!p_ptr->wild_mode)
5065 if (p_ptr->inside_arena)
5068 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5070 msg_print("The arena absorbs all attempted magic!");
5075 else if (use_command && rogue_like_commands)
5087 /* Quaff a potion */
5090 if (!p_ptr->wild_mode)
5092 if (!p_ptr->inside_arena)
5093 do_cmd_quaff_potion();
5097 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5099 msg_print("The arena absorbs all attempted magic!");
5111 if (!p_ptr->wild_mode)
5113 if (!p_ptr->inside_arena)
5114 do_cmd_read_scroll();
5118 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5120 msg_print("The arena absorbs all attempted magic!");
5132 if (!p_ptr->wild_mode)
5134 if (p_ptr->inside_arena)
5137 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5139 msg_print("The arena absorbs all attempted magic!");
5144 else if (use_command && !rogue_like_commands)
5154 /* Use racial power */
5157 if (!p_ptr->wild_mode) do_cmd_racial_power();
5162 /*** Looking at Things (nearby or on map) ***/
5164 /* Full dungeon map */
5171 /* Locate player on map */
5185 /* Target monster or location */
5188 if (!p_ptr->wild_mode) do_cmd_target();
5194 /*** Help and Such ***/
5203 /* Identify symbol */
5206 do_cmd_query_symbol();
5210 /* Character description */
5213 do_cmd_change_name();
5218 /*** System Commands ***/
5220 /* Hack -- User interface */
5227 /* Single line from a pref file */
5242 do_cmd_edit_autopick();
5246 /* Interact with macros */
5253 /* Interact with visuals */
5261 /* Interact with colors */
5269 /* Interact with options */
5277 /*** Misc Commands ***/
5293 /* Repeat level feeling */
5296 if (!p_ptr->wild_mode) do_cmd_feeling();
5300 /* Show previous message */
5303 do_cmd_message_one();
5307 /* Show previous messages */
5310 do_cmd_messages(old_now_message);
5314 /* Show quest status -KMW- */
5317 do_cmd_checkquest();
5321 /* Redraw the screen */
5324 now_message = old_now_message;
5329 #ifndef VERIFY_SAVEFILE
5331 /* Hack -- Save and don't quit */
5334 do_cmd_save_game(FALSE);
5338 #endif /* VERIFY_SAVEFILE */
5348 case SPECIAL_KEY_QUIT:
5350 do_cmd_save_and_exit();
5354 /* Quit (commit suicide) */
5367 /* Check artifacts, uniques, objects */
5374 /* Load "screen dump" */
5377 do_cmd_load_screen();
5381 /* Save "screen dump" */
5384 do_cmd_save_screen();
5388 /* Make random artifact list */
5391 spoil_random_artifact("randifact.txt");
5395 /* Hack -- Unknown command */
5398 if (flush_failure) flush();
5402 sound(SOUND_ILLEGAL);
5404 if (!get_rnd_line("error_j.txt", 0, error_m))
5406 if (!get_rnd_line("error.txt", 0, error_m))
5413 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5415 prt("Type '?' for help.", 0, 0);
5421 if (!energy_use && !now_message)
5422 now_message = old_now_message;
5428 static bool monster_tsuri(int r_idx)
5430 monster_race *r_ptr = &r_info[r_idx];
5432 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5440 * Process the player
5442 * Notice the annoying code to handle "pack overflow", which
5443 * must come first just in case somebody manages to corrupt
5444 * the savefiles by clever use of menu commands or something.
5446 static void process_player(void)
5450 /*** Apply energy ***/
5455 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5457 msg_print("You feel different!");
5460 (void)gain_random_mutation(0);
5461 hack_mutation = FALSE;
5464 if (p_ptr->inside_battle)
5466 for(i = 1; i < m_max; i++)
5468 monster_type *m_ptr = &m_list[i];
5470 if (!m_ptr->r_idx) continue;
5472 /* Hack -- Detect monster */
5473 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5475 /* Update the monster */
5476 update_mon(i, FALSE);
5481 /* Give the player some energy */
5482 else if (!(load && p_ptr->energy_need <= 0))
5484 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5488 if (p_ptr->energy_need > 0) return;
5489 if (!command_rep) prt_time();
5491 /*** Check for interupts ***/
5493 /* Complete resting */
5500 if ((p_ptr->chp == p_ptr->mhp) &&
5501 (p_ptr->csp >= p_ptr->msp))
5503 set_action(ACTION_NONE);
5507 /* Complete resting */
5508 else if (resting == -2)
5511 if ((p_ptr->chp == p_ptr->mhp) &&
5512 (p_ptr->csp >= p_ptr->msp) &&
5513 !p_ptr->blind && !p_ptr->confused &&
5514 !p_ptr->poisoned && !p_ptr->afraid &&
5515 !p_ptr->stun && !p_ptr->cut &&
5516 !p_ptr->slow && !p_ptr->paralyzed &&
5517 !p_ptr->image && !p_ptr->word_recall &&
5518 !p_ptr->alter_reality)
5520 set_action(ACTION_NONE);
5525 if (p_ptr->action == ACTION_FISH)
5528 Term_xtra(TERM_XTRA_DELAY, 10);
5532 bool success = FALSE;
5533 get_mon_num_prep(monster_tsuri,NULL);
5534 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5536 if (r_idx && one_in_(2))
5539 y = py+ddy[tsuri_dir];
5540 x = px+ddx[tsuri_dir];
5541 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5544 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5546 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5548 msg_format("You have a good catch!", m_name);
5556 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5558 msg_print("Damn! The fish stole your bait!");
5565 /* Handle "abort" */
5568 /* Check for "player abort" (semi-efficiently for resting) */
5569 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5574 /* Check for a key */
5583 /* Hack -- Show a Message */
5585 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5587 msg_print("Canceled.");
5594 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5596 monster_type *m_ptr = &m_list[p_ptr->riding];
5605 /* Acquire the monster name */
5606 monster_desc(m_name, m_ptr, 0);
5608 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5610 msg_format("You have waked %s up.", m_name);
5612 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5613 p_ptr->redraw |= (PR_UHEALTH);
5620 /* Make a "saving throw" against stun */
5621 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5627 /* Hack -- Recover from stun */
5628 if (m_ptr->stunned > d)
5630 /* Recover somewhat */
5631 m_ptr->stunned -= d;
5642 /* Acquire the monster name */
5643 monster_desc(m_name, m_ptr, 0);
5645 /* Dump a message */
5647 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5649 msg_format("%^s is no longer stunned.", m_name);
5651 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5652 p_ptr->redraw |= (PR_UHEALTH);
5656 if (m_ptr->confused)
5660 /* Make a "saving throw" against stun */
5661 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5664 d = m_ptr->confused;
5667 /* Hack -- Recover from stun */
5668 if (m_ptr->confused > d)
5670 /* Recover somewhat */
5671 m_ptr->confused -= d;
5680 m_ptr->confused = 0;
5682 /* Acquire the monster name */
5683 monster_desc(m_name, m_ptr, 0);
5685 /* Dump a message */
5687 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5689 msg_format("%^s is no longer confused.", m_name);
5691 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5692 p_ptr->redraw |= (PR_UHEALTH);
5700 /* Make a "saving throw" against stun */
5701 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5707 /* Hack -- Recover from stun */
5708 if (m_ptr->monfear > d)
5710 /* Recover somewhat */
5711 m_ptr->monfear -= d;
5722 /* Acquire the monster name */
5723 monster_desc(m_name, m_ptr, 0);
5725 /* Dump a message */
5727 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5729 msg_format("%^s is no longer fear.", m_name);
5731 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5732 p_ptr->redraw |= (PR_UHEALTH);
5736 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5740 /* Handle the player song */
5741 if (!load) check_music();
5746 if (p_ptr->lightspeed)
5748 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5750 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5752 if (p_ptr->magic_num1[0] < 40)
5754 p_ptr->magic_num1[0] = 0;
5756 else p_ptr->magic_num1[0] -= 40;
5757 p_ptr->update |= (PU_BONUS);
5759 if (p_ptr->action == ACTION_LEARN)
5761 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5762 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5765 p_ptr->csp_frac = 0;
5766 set_action(ACTION_NONE);
5770 p_ptr->csp -= (s16b)(hoge >> 16);
5772 if (p_ptr->csp_frac < hoge)
5774 p_ptr->csp_frac += 0x10000L - hoge;
5778 p_ptr->csp_frac -= hoge;
5780 p_ptr->redraw |= PR_MANA;
5783 if (p_ptr->special_defense & KATA_MASK)
5785 if (p_ptr->special_defense & KATA_MUSOU)
5789 set_action(ACTION_NONE);
5794 p_ptr->redraw |= (PR_MANA);
5799 /*** Handle actual user input ***/
5801 /* Repeat until out of energy */
5802 while (p_ptr->energy_need <= 0)
5804 p_ptr->window |= PW_PLAYER;
5805 p_ptr->sutemi = FALSE;
5806 p_ptr->counter = FALSE;
5807 now_damaged = FALSE;
5809 /* Handle "p_ptr->notice" */
5812 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5815 /* Place the cursor on the player */
5816 move_cursor_relative(py, px);
5818 /* Refresh (optional) */
5819 if (fresh_before) Term_fresh();
5822 /* Hack -- Pack Overflow */
5823 if (inventory[INVEN_PACK].k_idx)
5825 int item = INVEN_PACK;
5827 char o_name[MAX_NLEN];
5831 /* Access the slot to be dropped */
5832 o_ptr = &inventory[item];
5839 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5841 msg_print("Your pack overflows!");
5846 object_desc(o_name, o_ptr, TRUE, 3);
5850 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5852 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5856 /* Drop it (carefully) near the player */
5857 (void)drop_near(o_ptr, 0, py, px);
5859 /* Modify, Describe, Optimize */
5860 inven_item_increase(item, -255);
5861 inven_item_describe(item);
5862 inven_item_optimize(item);
5864 /* Handle "p_ptr->notice" */
5867 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5872 /* Hack -- cancel "lurking browse mode" */
5873 if (!command_new) command_see = FALSE;
5876 /* Assume free turn */
5880 if (p_ptr->inside_battle)
5882 /* Place the cursor on the player */
5883 move_cursor_relative(py, px);
5885 command_cmd = SPECIAL_KEY_BUILDING;
5887 /* Process the command */
5891 /* Paralyzed or Knocked Out */
5892 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5899 else if (p_ptr->action == ACTION_REST)
5904 /* Reduce rest count */
5907 if (!resting) set_action(ACTION_NONE);
5909 /* Redraw the state */
5910 p_ptr->redraw |= (PR_STATE);
5918 else if (p_ptr->action == ACTION_FISH)
5931 /* Repeated command */
5932 else if (command_rep)
5934 /* Count this execution */
5937 /* Redraw the state */
5938 p_ptr->redraw |= (PR_STATE);
5943 /* Hack -- Assume messages were seen */
5946 /* Clear the top line */
5949 /* Process the command */
5953 /* Normal command */
5956 /* Place the cursor on the player */
5957 move_cursor_relative(py, px);
5960 /* Get a command (normal) */
5961 request_command(FALSE);
5964 /* Process the command */
5974 /* Use some energy */
5975 if (world_player || energy_use > 400)
5977 /* The Randomness is irrelevant */
5978 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5982 /* There is some randomness of needed energy */
5983 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5986 /* Hack -- constant hallucination */
5987 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5990 /* Shimmer monsters if needed */
5991 if (shimmer_monsters)
5993 /* Clear the flag */
5994 shimmer_monsters = FALSE;
5996 /* Shimmer multi-hued monsters */
5997 for (i = 1; i < m_max; i++)
5999 monster_type *m_ptr;
6000 monster_race *r_ptr;
6002 /* Access monster */
6005 /* Skip dead monsters */
6006 if (!m_ptr->r_idx) continue;
6008 /* Access the monster race */
6009 r_ptr = &r_info[m_ptr->r_idx];
6011 /* Skip non-multi-hued monsters */
6012 if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue;
6014 /* Reset the flag */
6015 shimmer_monsters = TRUE;
6017 /* Redraw regardless */
6018 lite_spot(m_ptr->fy, m_ptr->fx);
6023 /* Handle monster detection */
6024 if (repair_monsters)
6026 /* Reset the flag */
6027 repair_monsters = FALSE;
6029 /* Rotate detection flags */
6030 for (i = 1; i < m_max; i++)
6032 monster_type *m_ptr;
6034 /* Access monster */
6037 /* Skip dead monsters */
6038 if (!m_ptr->r_idx) continue;
6040 /* Nice monsters get mean */
6041 if (m_ptr->mflag & MFLAG_NICE)
6043 /* Nice monsters get mean */
6044 m_ptr->mflag &= ~(MFLAG_NICE);
6047 /* Handle memorized monsters */
6048 if (m_ptr->mflag2 & MFLAG2_MARK)
6050 /* Maintain detection */
6051 if (m_ptr->mflag2 & MFLAG2_SHOW)
6054 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6056 /* Still need repairs */
6057 repair_monsters = TRUE;
6060 /* Remove detection */
6064 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6066 /* Assume invisible */
6069 /* Update the monster */
6070 update_mon(i, FALSE);
6072 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6073 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6075 /* Redraw regardless */
6076 lite_spot(m_ptr->fy, m_ptr->fx);
6081 if (p_ptr->pclass == CLASS_IMITATOR)
6083 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6086 for (i = 0; i < p_ptr->mane_num; i++)
6088 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6089 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6093 p_ptr->redraw |= (PR_MANE);
6095 if (p_ptr->action == ACTION_LEARN)
6098 p_ptr->redraw |= (PR_STATE);
6101 if (world_player && (p_ptr->energy_need > - 1000))
6104 p_ptr->redraw |= (PR_MAP);
6106 /* Update monsters */
6107 p_ptr->update |= (PU_MONSTERS);
6110 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6113 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6115 msg_print("You feel time flowing around you once more.");
6118 world_player = FALSE;
6119 p_ptr->energy_need = ENERGY_NEED();
6121 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6126 /* Hack -- notice death */
6127 if (!p_ptr->playing || p_ptr->is_dead)
6129 world_player = FALSE;
6133 /* Handle "leaving" */
6134 if (p_ptr->leaving) break;
6137 /* Update scent trail */
6143 * Interact with the current dungeon level.
6145 * This function will not exit until the level is completed,
6146 * the user dies, or the game is terminated.
6148 static void dungeon(bool load_game)
6152 /* Set the base level */
6153 base_level = dun_level;
6155 /* Reset various flags */
6159 p_ptr->leaving = FALSE;
6161 /* Reset the "command" vars */
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_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6266 if (p_ptr->inside_battle)
6270 p_ptr->energy_need = 0;
6277 msg_print("»î¹ç³«»Ï¡ª");
6279 msg_format("Ready..Fight!");
6285 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6286 p_ptr->magic_num1[0] = MUSIC_DETECT;
6288 /* Hack -- notice death or departure */
6289 if (!p_ptr->playing || p_ptr->is_dead) return;
6291 /* Print quest message if appropriate */
6292 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6294 quest_discovery(random_quest_number(dun_level));
6295 p_ptr->inside_quest = random_quest_number(dun_level);
6297 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6299 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6301 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6302 d_name+d_info[dungeon_type].name,
6303 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6305 msg_format("%^s lives in this level as the keeper of %s.",
6306 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6307 d_name+d_info[dungeon_type].name);
6311 /*** Process this dungeon level ***/
6313 /* Reset the monster generation level */
6314 monster_level = base_level;
6316 /* Reset the object generation level */
6317 object_level = base_level;
6321 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6322 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6323 p_ptr->energy_need = 0;
6325 /* Not leaving dungeon */
6326 p_ptr->leaving_dungeon = FALSE;
6331 /* Hack -- Compact the monster list occasionally */
6332 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6334 /* Hack -- Compress the monster list occasionally */
6335 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6338 /* Hack -- Compact the object list occasionally */
6339 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6341 /* Hack -- Compress the object list occasionally */
6342 if (o_cnt + 32 < o_max) compact_objects(0);
6345 /* Process the player */
6348 /* Handle "p_ptr->notice" */
6351 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6354 /* Hack -- Hilite the player */
6355 move_cursor_relative(py, px);
6357 /* Optional fresh */
6358 if (fresh_after) Term_fresh();
6360 /* Hack -- Notice death or departure */
6361 if (!p_ptr->playing || p_ptr->is_dead) break;
6363 /* Process all of the monsters */
6366 /* Handle "p_ptr->notice" */
6369 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6372 /* Hack -- Hilite the player */
6373 move_cursor_relative(py, px);
6375 /* Optional fresh */
6376 if (fresh_after) Term_fresh();
6378 /* Hack -- Notice death or departure */
6379 if (!p_ptr->playing || p_ptr->is_dead) break;
6382 /* Process the world */
6385 /* Handle "p_ptr->notice" */
6388 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6391 /* Hack -- Hilite the player */
6392 move_cursor_relative(py, px);
6394 /* Optional fresh */
6395 if (fresh_after) Term_fresh();
6397 /* Hack -- Notice death or departure */
6398 if (!p_ptr->playing || p_ptr->is_dead) break;
6400 /* Handle "leaving" */
6401 if (p_ptr->leaving) break;
6403 /* Count game turns */
6405 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6406 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6407 if (wild_regen) wild_regen--;
6410 /* Inside a quest and non-unique questor? */
6411 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6413 /* Un-mark the quest monster */
6414 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6417 /* Not save-and-quit and not dead? */
6418 if (p_ptr->playing && !p_ptr->is_dead)
6421 * Maintain Unique monsters and artifact, save current
6422 * floor, then prepare next floor
6426 /* Forget the flag */
6427 reinit_wilderness = FALSE;
6430 /* Write about current level on the play record once per level */
6436 * Load some "user pref files"
6438 * Modified by Arcum Dagsson to support
6439 * separate macro files for different realms.
6441 static void load_all_pref_files(void)
6446 /* Access the "user" pref file */
6447 sprintf(buf, "user.prf");
6449 /* Process that file */
6450 process_pref_file(buf);
6452 /* Access the "user" system pref file */
6453 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6455 /* Process that file */
6456 process_pref_file(buf);
6458 /* Access the "race" pref file */
6459 sprintf(buf, "%s.prf", rp_ptr->title);
6461 /* Process that file */
6462 process_pref_file(buf);
6464 /* Access the "class" pref file */
6465 sprintf(buf, "%s.prf", cp_ptr->title);
6467 /* Process that file */
6468 process_pref_file(buf);
6470 /* Access the "character" pref file */
6471 sprintf(buf, "%s.prf", player_base);
6473 /* Process that file */
6474 process_pref_file(buf);
6476 /* Free old entries */
6480 sprintf(buf, "picktype-%s.prf", player_base);
6482 sprintf(buf, "pickpref-%s.prf", player_base);
6485 err = process_pickpref_file(buf);
6487 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6491 process_pickpref_file("picktype.prf");
6493 process_pickpref_file("pickpref.prf");
6497 /* Access the "realm 1" pref file */
6498 if (p_ptr->realm1 != REALM_NONE)
6500 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6502 /* Process that file */
6503 process_pref_file(buf);
6506 /* Access the "realm 2" pref file */
6507 if (p_ptr->realm2 != REALM_NONE)
6509 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6511 /* Process that file */
6512 process_pref_file(buf);
6518 * Actually play a game
6520 * If the "new_game" parameter is true, then, after loading the
6521 * savefile, we will commit suicide, if necessary, to allow the
6522 * player to start a new game.
6524 void play_game(bool new_game)
6527 bool load_game = TRUE;
6537 hack_mutation = FALSE;
6539 /* Hack -- Character is "icky" */
6540 character_icky = TRUE;
6542 /* Make sure main term is active */
6543 Term_activate(angband_term[0]);
6545 /* Initialise the resize hooks */
6546 angband_term[0]->resize_hook = resize_map;
6548 for (i = 1; i < 8; i++)
6550 /* Does the term exist? */
6551 if (angband_term[i])
6553 /* Add the redraw on resize hook */
6554 angband_term[i]->resize_hook = redraw_window;
6558 /* Hack -- turn off the cursor */
6559 (void)Term_set_cursor(0);
6562 /* Attempt to load */
6567 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6569 quit("broken savefile");
6574 /* Extract the options */
6575 for (i = 0; option_info[i].o_desc; i++)
6577 int os = option_info[i].o_set;
6578 int ob = option_info[i].o_bit;
6580 /* Set the "default" options */
6581 if (option_info[i].o_var)
6584 if (option_flag[os] & (1L << ob))
6587 (*option_info[i].o_var) = TRUE;
6594 (*option_info[i].o_var) = FALSE;
6599 /* Report waited score */
6600 if (p_ptr->wait_report_score)
6606 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6608 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6613 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6618 p_ptr->is_dead = TRUE;
6620 start_time = time(NULL);
6622 /* No suspending now */
6623 signals_ignore_tstp();
6625 /* Hack -- Character is now "icky" */
6626 character_icky = TRUE;
6628 /* Build the filename */
6629 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6631 /* Open the high score file, for reading/writing */
6632 highscore_fd = fd_open(buf, O_RDWR);
6634 /* Handle score, show Top scores */
6635 success = send_world_score(TRUE);
6638 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6640 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6644 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6646 prt("standing by for future registration...", 0, 0);
6652 p_ptr->wait_report_score = FALSE;
6655 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6657 if (!save_player()) msg_print("death save failed!");
6660 /* Shut the high score file */
6661 (void)fd_close(highscore_fd);
6663 /* Forget the high score fd */
6666 /* Allow suspending now */
6667 signals_handle_tstp();
6672 /* Nothing loaded */
6673 if (!character_loaded)
6675 /* Make new player */
6678 /* The dungeon is not ready */
6679 character_dungeon = FALSE;
6681 /* Prepare to init the RNG */
6684 /* Initialize the saved floors data */
6685 init_saved_floors();
6688 /* Old game is loaded. But new game is requested. */
6691 /* Delete expanded temporal files */
6692 clear_saved_floor_files();
6695 /* Process old character */
6698 /* Process the player name */
6699 process_player_name(FALSE);
6708 seed = (time(NULL));
6712 /* Mutate the seed on Unix machines */
6713 seed = ((seed >> 3) * (getpid() << 1));
6717 /* Use the complex RNG */
6720 /* Seed the "complex" RNG */
6721 Rand_state_init(seed);
6724 /* Roll new character */
6727 monster_race *r_ptr;
6729 /* The dungeon is not ready */
6730 character_dungeon = FALSE;
6734 p_ptr->inside_quest = 0;
6735 p_ptr->inside_arena = FALSE;
6736 p_ptr->inside_battle = FALSE;
6740 /* Hack -- seed for flavors */
6741 seed_flavor = randint0(0x10000000);
6743 /* Hack -- seed for town layout */
6744 seed_town = randint0(0x10000000);
6746 /* Roll up a new character */
6753 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6755 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6759 get_mon_num_prep(NULL, NULL);
6760 for (i = 0; i < MAX_KUBI; i++)
6766 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6767 r_ptr = &r_info[kubi_r_idx[i]];
6769 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6771 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6772 if (r_ptr->rarity > 100) continue;
6774 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6776 for (j = 0; j < i; j++)
6777 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6782 for (i = 0; i < MAX_KUBI -1; i++)
6785 for (j = i; j < MAX_KUBI; j++)
6787 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6789 tmp = kubi_r_idx[i];
6790 kubi_r_idx[i] = kubi_r_idx[j];
6791 kubi_r_idx[j] = tmp;
6796 p_ptr->inside_battle = TRUE;
6799 today_mon = get_mon_num(3);
6800 r_ptr = &r_info[today_mon];
6802 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6803 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6804 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6805 if (r_ptr->rarity > 10) continue;
6806 if (r_ptr->level == 0) continue;
6809 p_ptr->inside_battle = FALSE;
6813 write_level = FALSE;
6816 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6818 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6822 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6823 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6825 if (p_ptr->riding == -1)
6828 for(i = m_max; i > 0; i--)
6830 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6839 p_ptr->teleport_town = FALSE;
6840 p_ptr->sutemi = FALSE;
6841 world_monster = FALSE;
6842 now_damaged = FALSE;
6844 start_time = time(NULL) - 1;
6845 record_o_name[0] = '\0';
6847 /* Reset map panel */
6848 panel_row_min = cur_hgt;
6849 panel_col_min = cur_wid;
6851 /* Sexy gal gets bonus to maximum weapon skill of whip */
6852 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6853 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6855 /* Fill the arrays of floors and walls in the good proportions */
6856 set_floor_and_wall(dungeon_type);
6858 /* Flavor the objects */
6866 /* Flash a message */
6868 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6870 prt("Please wait...", 0, 0);
6874 /* Flush the message */
6878 /* Hack -- Enter wizard mode */
6881 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6882 else if (p_ptr->is_dead) quit("Already dead.");
6885 /* Initialize the town-buildings if necessary */
6886 if (!dun_level && !p_ptr->inside_quest)
6888 /* Init the wilderness */
6890 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6893 init_flags = INIT_ONLY_BUILDINGS;
6895 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6900 /* Generate a dungeon level if needed */
6901 if (!character_dungeon) change_floor();
6904 /* Character is now "complete" */
6905 character_generated = TRUE;
6908 /* Hack -- Character is no longer "icky" */
6909 character_icky = FALSE;
6913 p_ptr->playing = TRUE;
6915 /* Reset the visual mappings */
6918 /* Load the "pref" files */
6919 load_all_pref_files();
6921 /* React to changes */
6922 Term_xtra(TERM_XTRA_REACT, 0);
6925 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6928 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6934 /* Set or clear "rogue_like_commands" if requested */
6935 if (arg_force_original) rogue_like_commands = FALSE;
6936 if (arg_force_roguelike) rogue_like_commands = TRUE;
6938 /* Hack -- Enforce "delayed death" */
6939 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6941 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6943 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6945 monster_type *m_ptr;
6946 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6947 monster_race *r_ptr = &r_info[pet_r_idx];
6948 place_monster_aux(0, py, px - 1, pet_r_idx,
6949 (PM_FORCE_PET | PM_NO_KAGE));
6950 m_ptr = &m_list[hack_m_idx_ii];
6951 m_ptr->mspeed = r_ptr->speed;
6952 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6953 m_ptr->max_maxhp = m_ptr->maxhp;
6954 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6955 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6961 /* Process the level */
6964 /* Handle "p_ptr->notice" */
6967 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6970 /* Cancel the target */
6973 /* Cancel the health bar */
6977 /* Forget the lite */
6980 /* Forget the view */
6983 /* Forget the view */
6986 /* Handle "quit and save" */
6987 if (!p_ptr->playing && !p_ptr->is_dead) break;
6989 /* Erase the old cave */
6991 if (!p_ptr->is_dead) wipe_m_list();
6999 /* Accidental Death */
7000 if (p_ptr->playing && p_ptr->is_dead)
7002 if (p_ptr->inside_arena)
7004 p_ptr->inside_arena = FALSE;
7005 if(p_ptr->arena_number > MAX_ARENA_MONS)
7006 p_ptr->arena_number++;
7008 p_ptr->arena_number = 99;
7009 p_ptr->is_dead = FALSE;
7011 p_ptr->chp_frac = 0;
7012 p_ptr->exit_bldg = TRUE;
7017 /* Mega-Hack -- Allow player to cheat death */
7019 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7021 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7025 /* Mark social class, reset age, if needed */
7026 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7032 p_ptr->noscore |= 0x0001;
7036 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7038 msg_print("You invoke wizard mode and cheat death.");
7044 /* Restore hit points */
7045 p_ptr->chp = p_ptr->mhp;
7046 p_ptr->chp_frac = 0;
7048 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7050 for (i = 0; i < EATER_EXT*2; i++)
7052 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7054 for (; i < EATER_EXT*3; i++)
7056 p_ptr->magic_num1[i] = 0;
7059 /* Restore spell points */
7060 p_ptr->csp = p_ptr->msp;
7061 p_ptr->csp_frac = 0;
7063 /* Hack -- Healing */
7065 (void)set_confused(0);
7066 (void)set_poisoned(0);
7067 (void)set_afraid(0);
7068 (void)set_paralyzed(0);
7073 /* Hack -- Prevent starvation */
7074 (void)set_food(PY_FOOD_MAX - 1);
7076 /* Hack -- cancel recall */
7077 if (p_ptr->word_recall)
7081 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7083 msg_print("A tension leaves the air around you...");
7088 /* Hack -- Prevent recall */
7089 p_ptr->word_recall = 0;
7090 p_ptr->redraw |= (PR_STATUS);
7093 /* Hack -- cancel alter */
7094 if (p_ptr->alter_reality)
7096 /* Hack -- Prevent alter */
7097 p_ptr->alter_reality = 0;
7098 p_ptr->redraw |= (PR_STATUS);
7101 /* Note cause of death XXX XXX XXX */
7103 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7105 (void)strcpy(p_ptr->died_from, "Cheating death");
7110 p_ptr->is_dead = FALSE;
7113 p_ptr->inside_arena = FALSE;
7114 p_ptr->inside_battle = FALSE;
7116 p_ptr->inside_quest = 0;
7117 p_ptr->recall_dungeon = dungeon_type;
7119 if (lite_town || vanilla_town)
7121 p_ptr->wilderness_y = 1;
7122 p_ptr->wilderness_x = 1;
7136 p_ptr->wilderness_y = 48;
7137 p_ptr->wilderness_x = 5;
7143 p_ptr->wild_mode = FALSE;
7144 p_ptr->leaving = TRUE;
7147 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7149 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7155 /* Handle "death" */
7156 if (p_ptr->is_dead) break;
7158 /* Make a new level */
7169 s32b turn_real(s32b hoge)
7171 switch (p_ptr->start_race)
7177 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);