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 (object_is_artifact(o_ptr))
30 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_TERRIBLE;
37 if (object_is_ego(o_ptr))
40 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_WORTHLESS;
43 return FEEL_EXCELLENT;
47 if (object_is_cursed(o_ptr)) return FEEL_CURSED;
50 if (object_is_broken(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 (object_is_cursed(o_ptr)) return FEEL_CURSED;
73 /* Broken items (all of them) */
74 if (object_is_broken(o_ptr)) return FEEL_BROKEN;
76 /* Artifacts -- except cursed/broken ones */
77 if (object_is_artifact(o_ptr)) return FEEL_UNCURSED;
79 /* Ego-Items -- except cursed/broken ones */
80 if (object_is_ego(o_ptr)) return FEEL_UNCURSED;
82 /* Good armor bonus */
83 if (o_ptr->to_a > 0) return FEEL_UNCURSED;
85 /* Good weapon bonuses */
86 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
94 static void sense_inventory_aux(int slot, bool heavy)
97 object_type *o_ptr = &inventory[slot];
98 char o_name[MAX_NLEN];
100 /* We know about it already, do not tell us again */
101 if (o_ptr->ident & (IDENT_SENSE))return;
103 /* It is fully known, no information needed */
104 if (object_is_known(o_ptr)) return;
106 /* Check for a feeling */
107 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
109 /* Skip non-feelings */
113 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
124 feel = FEEL_EXCELLENT;
130 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
132 feel = FEEL_UNCURSED;
137 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
143 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
150 feel = FEEL_WORTHLESS;
155 feel = FEEL_TERRIBLE;
161 /* Stop everything */
162 if (disturb_minor) disturb(0, 0);
164 /* Get an object description */
165 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
167 /* Message (equipment) */
168 if (slot >= INVEN_RARM)
171 msg_format("%s%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
172 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
174 msg_format("You feel the %s (%c) you are %s %s %s...",
175 o_name, index_to_label(slot), describe_use(slot),
176 ((o_ptr->number == 1) ? "is" : "are"),
177 game_inscriptions[feel]);
182 /* Message (inventory) */
186 msg_format("¥¶¥Ã¥¯¤ÎÃæ¤Î%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
187 o_name, index_to_label(slot),game_inscriptions[feel]);
189 msg_format("You feel the %s (%c) in your pack %s %s...",
190 o_name, index_to_label(slot),
191 ((o_ptr->number == 1) ? "is" : "are"),
192 game_inscriptions[feel]);
197 /* We have "felt" it */
198 o_ptr->ident |= (IDENT_SENSE);
200 /* Set the "inscription" */
201 o_ptr->feeling = feel;
203 /* Auto-inscription/destroy */
204 autopick_alter_item(slot, destroy_feeling);
206 /* Combine / Reorder the pack (later) */
207 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
210 p_ptr->window |= (PW_INVEN | PW_EQUIP);
216 * Sense the inventory
218 * Class 0 = Warrior --> fast and heavy
219 * Class 1 = Mage --> slow and light
220 * Class 2 = Priest --> fast but light
221 * Class 3 = Rogue --> okay and heavy
222 * Class 4 = Ranger --> slow but heavy (changed!)
223 * Class 5 = Paladin --> slow but heavy
225 static void sense_inventory1(void)
228 int plev = p_ptr->lev;
233 /*** Check for "sensing" ***/
235 /* No sensing when confused */
236 if (p_ptr->confused) return;
238 /* Analyze the class */
239 switch (p_ptr->pclass)
247 if (0 != randint0(9000L / (plev * plev + 40))) return;
259 if (0 != randint0(6000L / (plev * plev + 50))) return;
269 case CLASS_HIGH_MAGE:
271 case CLASS_MAGIC_EATER:
273 /* Very bad (light) sensing */
274 if (0 != randint0(240000L / (plev + 5))) return;
283 /* Good (light) sensing */
284 if (0 != randint0(10000L / (plev * plev + 40))) return;
294 if (0 != randint0(20000L / (plev * plev + 40))) return;
306 if (0 != randint0(95000L / (plev * plev + 40))) return;
319 if (0 != randint0(77777L / (plev * plev + 40))) return;
328 case CLASS_WARRIOR_MAGE:
332 if (0 != randint0(75000L / (plev * plev + 40))) return;
338 case CLASS_MINDCRAFTER:
340 case CLASS_BLUE_MAGE:
341 case CLASS_MIRROR_MASTER:
344 if (0 != randint0(55000L / (plev * plev + 40))) return;
350 case CLASS_CHAOS_WARRIOR:
353 if (0 != randint0(80000L / (plev * plev + 40))) return;
363 case CLASS_FORCETRAINER:
366 if (0 != randint0(20000L / (plev * plev + 40))) return;
375 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
384 case CLASS_BEASTMASTER:
387 if (0 != randint0(65000L / (plev * plev + 40))) return;
392 case CLASS_BERSERKER:
402 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
404 /*** Sense everything ***/
406 /* Check everything */
407 for (i = 0; i < INVEN_TOTAL; i++)
411 o_ptr = &inventory[i];
413 /* Skip empty slots */
414 if (!o_ptr->k_idx) continue;
416 /* Valid "tval" codes */
443 /* Skip non-sense machines */
446 /* Occasional failure on inventory items */
447 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
450 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
455 sense_inventory_aux(i, heavy);
460 static void sense_inventory2(void)
463 int plev = p_ptr->lev;
467 /*** Check for "sensing" ***/
469 /* No sensing when confused */
470 if (p_ptr->confused) return;
472 /* Analyze the class */
473 switch (p_ptr->pclass)
479 case CLASS_BERSERKER:
487 case CLASS_CHAOS_WARRIOR:
489 case CLASS_BEASTMASTER:
492 /* Very bad (light) sensing */
493 if (0 != randint0(240000L / (plev + 5))) return;
500 case CLASS_WARRIOR_MAGE:
505 if (0 != randint0(95000L / (plev * plev + 40))) return;
514 case CLASS_FORCETRAINER:
515 case CLASS_MINDCRAFTER:
518 if (0 != randint0(20000L / (plev * plev + 40))) return;
525 case CLASS_HIGH_MAGE:
527 case CLASS_MAGIC_EATER:
528 case CLASS_MIRROR_MASTER:
529 case CLASS_BLUE_MAGE:
532 if (0 != randint0(9000L / (plev * plev + 40))) return;
541 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
548 /*** Sense everything ***/
550 /* Check everything */
551 for (i = 0; i < INVEN_TOTAL; i++)
555 o_ptr = &inventory[i];
557 /* Skip empty slots */
558 if (!o_ptr->k_idx) continue;
560 /* Valid "tval" codes */
573 /* Skip non-sense machines */
576 /* Occasional failure on inventory items */
577 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
579 sense_inventory_aux(i, TRUE);
586 * Go to any level (ripped off from wiz_jump)
588 static void pattern_teleport(void)
595 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
597 if (get_check("Teleport level? "))
604 /* Only downward in ironman mode */
605 if (ironman_downward)
606 min_level = dun_level;
609 if (dungeon_type == DUNGEON_ANGBAND)
612 max_level = MAX_DEPTH - 1;
613 else if (dun_level == 100)
618 max_level = d_info[dungeon_type].maxdepth;
619 min_level = d_info[dungeon_type].mindepth;
624 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
626 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
631 sprintf(tmp_val, "%d", dun_level);
633 /* Ask for a level */
634 if (!get_string(ppp, tmp_val, 10)) return;
636 /* Extract request */
637 command_arg = atoi(tmp_val);
640 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
642 else if (get_check("Normal teleport? "))
645 teleport_player(200, 0L);
654 if (command_arg < min_level) command_arg = min_level;
657 if (command_arg > max_level) command_arg = max_level;
661 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
663 msg_format("You teleport to dungeon level %d.", command_arg);
667 if (autosave_l) do_cmd_save_game(TRUE);
670 dun_level = command_arg;
674 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
676 p_ptr->inside_quest = 0;
680 * Clear all saved floors
681 * and create a first saved floor
683 prepare_change_floor_mode(CFM_FIRST_FLOOR);
686 p_ptr->leaving = TRUE;
690 static void wreck_the_pattern(void)
692 int to_ruin = 0, r_y, r_x;
693 int pattern_type = f_info[cave[py][px].feat].subtype;
695 if (pattern_type == PATTERN_TILE_WRECKED)
702 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
703 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
705 msg_print("You bleed on the Pattern!");
706 msg_print("Something terrible happens!");
711 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
713 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 (pattern_tile(r_y, r_x) &&
723 (f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
725 cave_set_feat(r_y, r_x, feat_pattern_corrupted);
729 cave_set_feat(py, px, feat_pattern_corrupted);
733 /* Returns TRUE if we are on the Pattern... */
734 static bool pattern_effect(void)
738 if (!pattern_tile(py, px)) return FALSE;
740 if ((prace_is_(RACE_AMBERITE)) &&
741 (p_ptr->cut > 0) && one_in_(10))
746 pattern_type = f_info[cave[py][px].feat].subtype;
748 switch (pattern_type)
750 case PATTERN_TILE_END:
751 (void)set_poisoned(0);
757 (void)do_res_stat(A_STR);
758 (void)do_res_stat(A_INT);
759 (void)do_res_stat(A_WIS);
760 (void)do_res_stat(A_DEX);
761 (void)do_res_stat(A_CON);
762 (void)do_res_stat(A_CHR);
763 (void)restore_level();
764 (void)hp_player(1000);
766 cave_set_feat(py, px, feat_pattern_old);
769 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
771 msg_print("This section of the Pattern looks less powerful.");
775 * We could make the healing effect of the
776 * Pattern center one-time only to avoid various kinds
777 * of abuse, like luring the win monster into fighting you
778 * in the middle of the pattern...
782 case PATTERN_TILE_OLD:
786 case PATTERN_TILE_TELEPORT:
790 case PATTERN_TILE_WRECKED:
793 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
795 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
800 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
802 else if (!IS_INVULN())
804 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
806 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
819 * Regenerate hit points -RAK-
821 static void regenhp(int percent)
827 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
828 if (p_ptr->action == ACTION_HAYAGAKE) return;
830 /* Save the old hitpoints */
831 old_chp = p_ptr->chp;
834 * Extract the new hitpoints
836 * 'percent' is the Regen factor in unit (1/2^16)
839 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
841 /* Convert the unit (1/2^16) to (1/2^32) */
842 s64b_LSHIFT(new_chp, new_chp_frac, 16);
845 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
849 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
851 p_ptr->chp = p_ptr->mhp;
856 if (old_chp != p_ptr->chp)
859 p_ptr->redraw |= (PR_HP);
862 p_ptr->window |= (PW_PLAYER);
870 * Regenerate mana points
872 static void regenmana(int upkeep_factor, int regen_amount)
874 s32b old_csp = p_ptr->csp;
875 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
878 * Excess mana will decay 32 times faster than normal
881 if (p_ptr->csp > p_ptr->msp)
883 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
885 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
887 /* Convert the unit (1/2^16) to (1/2^32) */
888 s64b_LSHIFT(decay, decay_frac, 16);
891 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
894 if (p_ptr->csp < p_ptr->msp)
896 p_ptr->csp = p_ptr->msp;
901 /* Regenerating mana (unless the player has excess mana) */
902 else if (regen_rate > 0)
904 /* (percent/100) is the Regen factor in unit (1/2^16) */
906 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
908 /* Convert the unit (1/2^16) to (1/2^32) */
909 s64b_LSHIFT(new_mana, new_mana_frac, 16);
912 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
914 /* Must set frac to zero even if equal */
915 if (p_ptr->csp >= p_ptr->msp)
917 p_ptr->csp = p_ptr->msp;
923 /* Reduce mana (even when the player has excess mana) */
926 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
927 s32b reduce_mana = 0;
928 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
930 /* Convert the unit (1/2^16) to (1/2^32) */
931 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
934 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
946 if (old_csp != p_ptr->csp)
949 p_ptr->redraw |= (PR_MANA);
952 p_ptr->window |= (PW_PLAYER);
953 p_ptr->window |= (PW_SPELL);
963 * regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
965 static void regenmagic(int regen_amount)
970 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
972 for (i = 0; i < EATER_EXT*2; i++)
974 if (!p_ptr->magic_num2[i]) continue;
975 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
977 /* Increase remaining charge number like float value */
978 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
979 p_ptr->magic_num1[i] += new_mana;
981 /* Check maximum charge */
982 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
984 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
988 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
990 if (!p_ptr->magic_num1[i]) continue;
991 if (!p_ptr->magic_num2[i]) continue;
993 /* Decrease remaining period for charging */
994 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
995 / (dev * 16 * PY_REGEN_NORMAL);
996 p_ptr->magic_num1[i] -= new_mana;
998 /* Check minimum remaining period for charging */
999 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1010 * Regenerate the monsters (once per 100 game turns)
1012 * XXX XXX XXX Should probably be done during monster turns.
1014 static void regen_monsters(void)
1019 /* Regenerate everyone */
1020 for (i = 1; i < m_max; i++)
1022 /* Check the i'th monster */
1023 monster_type *m_ptr = &m_list[i];
1024 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1027 /* Skip dead monsters */
1028 if (!m_ptr->r_idx) continue;
1030 /* Allow regeneration (if needed) */
1031 if (m_ptr->hp < m_ptr->maxhp)
1033 /* Hack -- Base regeneration */
1034 frac = m_ptr->maxhp / 100;
1036 /* Hack -- Minimal regeneration rate */
1037 if (!frac) if (one_in_(2)) frac = 1;
1039 /* Hack -- Some monsters regenerate quickly */
1040 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1042 /* Hack -- Regenerate */
1045 /* Do not over-regenerate */
1046 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1048 /* Redraw (later) if needed */
1049 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1050 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1057 * Regenerate the captured monsters (once per 30 game turns)
1059 * XXX XXX XXX Should probably be done during monster turns.
1061 static void regen_captured_monsters(void)
1066 /* Regenerate everyone */
1067 for (i = 0; i < INVEN_TOTAL; i++)
1069 monster_race *r_ptr;
1070 object_type *o_ptr = &inventory[i];
1072 if (!o_ptr->k_idx) continue;
1073 if (o_ptr->tval != TV_CAPTURE) continue;
1074 if (!o_ptr->pval) continue;
1078 r_ptr = &r_info[o_ptr->pval];
1080 /* Allow regeneration (if needed) */
1081 if (o_ptr->xtra4 < o_ptr->xtra5)
1083 /* Hack -- Base regeneration */
1084 frac = o_ptr->xtra5 / 100;
1086 /* Hack -- Minimal regeneration rate */
1087 if (!frac) if (one_in_(2)) frac = 1;
1089 /* Hack -- Some monsters regenerate quickly */
1090 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1092 /* Hack -- Regenerate */
1093 o_ptr->xtra4 += frac;
1095 /* Do not over-regenerate */
1096 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1103 p_ptr->notice |= (PN_COMBINE);
1106 p_ptr->window |= (PW_INVEN);
1107 p_ptr->window |= (PW_EQUIP);
1113 static void notice_lite_change(object_type *o_ptr)
1115 /* Hack -- notice interesting fuel steps */
1116 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1119 p_ptr->window |= (PW_EQUIP);
1122 /* Hack -- Special treatment when blind */
1125 /* Hack -- save some light for later */
1126 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1129 /* The light is now out */
1130 else if (o_ptr->xtra4 == 0)
1134 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1136 msg_print("Your light has gone out!");
1139 /* Recalculate torch radius */
1140 p_ptr->update |= (PU_TORCH);
1142 /* Some ego light lose its effects without fuel */
1143 p_ptr->update |= (PU_BONUS);
1146 /* The light is getting dim */
1147 else if (o_ptr->name2 == EGO_LITE_LONG)
1149 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1150 && (turn % (TURNS_PER_TICK*2)))
1152 if (disturb_minor) disturb(0, 1);
1154 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1156 msg_print("Your light is growing faint.");
1162 /* The light is getting dim */
1163 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1165 if (disturb_minor) disturb(0, 1);
1167 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1169 msg_print("Your light is growing faint.");
1176 void leave_quest_check(void)
1178 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1179 leaving_quest = p_ptr->inside_quest;
1181 /* Leaving an 'only once' quest marks it as failed */
1182 if (leaving_quest &&
1183 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1184 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1186 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1187 quest[leaving_quest].complev = (byte)p_ptr->lev;
1189 /* Additional settings */
1190 switch (quest[leaving_quest].type)
1192 case QUEST_TYPE_TOWER:
1193 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1194 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1196 case QUEST_TYPE_FIND_ARTIFACT:
1197 a_info[quest[leaving_quest].k_idx].gen_flags &= ~(TRG_QUESTITEM);
1199 case QUEST_TYPE_RANDOM:
1200 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1202 /* Floor of random quest will be blocked */
1203 prepare_change_floor_mode(CFM_NO_RETURN);
1207 /* Record finishing a quest */
1208 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1210 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1214 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1219 void leave_tower_check(void)
1221 leaving_quest = p_ptr->inside_quest;
1222 /* Check for Tower Quest */
1223 if (leaving_quest &&
1224 (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
1225 (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
1227 if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
1229 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1230 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1237 * Forcibly pseudo-identify an object in the inventory
1240 * note: currently this function allows pseudo-id of any object,
1241 * including silly ones like potions & scrolls, which always
1242 * get '{average}'. This should be changed, either to stop such
1243 * items from being pseudo-id'd, or to allow psychometry to
1244 * detect whether the unidentified potion/scroll/etc is
1245 * good (Cure Light Wounds, Restore Strength, etc) or
1246 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1248 bool psychometry(void)
1252 char o_name[MAX_NLEN];
1257 item_tester_no_ryoute = TRUE;
1260 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1261 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1263 q = "Meditate on which item? ";
1264 s = "You have nothing appropriate.";
1267 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1269 /* Get the item (in the pack) */
1272 o_ptr = &inventory[item];
1275 /* Get the item (on the floor) */
1278 o_ptr = &o_list[0 - item];
1281 /* It is fully known, no information needed */
1282 if (object_is_known(o_ptr))
1285 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1287 msg_print("You cannot find out anything more about that.");
1293 /* Check for a feeling */
1294 feel = value_check_aux1(o_ptr);
1296 /* Get an object description */
1297 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1299 /* Skip non-feelings */
1303 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1305 msg_format("You do not perceive anything unusual about the %s.", o_name);
1312 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1313 o_name, game_inscriptions[feel]);
1315 msg_format("You feel that the %s %s %s...",
1316 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1317 game_inscriptions[feel]);
1321 /* We have "felt" it */
1322 o_ptr->ident |= (IDENT_SENSE);
1325 o_ptr->feeling = feel;
1327 /* Player touches it */
1328 o_ptr->marked |= OM_TOUCHED;
1330 /* Combine / Reorder the pack (later) */
1331 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1334 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1336 /* Valid "tval" codes */
1337 switch (o_ptr->tval)
1365 /* Auto-inscription/destroy */
1366 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1368 /* Something happened */
1374 * If player has inscribed the object with "!!", let him know when it's
1377 static void recharged_notice(object_type *o_ptr)
1379 char o_name[MAX_NLEN];
1383 /* No inscription */
1384 if (!o_ptr->inscription) return;
1387 s = my_strchr(quark_str(o_ptr->inscription), '!');
1389 /* Process notification request. */
1392 /* Find another '!' */
1395 /* Describe (briefly) */
1396 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1398 /* Notify the player */
1400 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1402 if (o_ptr->number > 1)
1403 msg_format("Your %s are recharged.", o_name);
1405 msg_format("Your %s is recharged.", o_name);
1414 /* Keep looking for '!'s */
1415 s = my_strchr(s + 1, '!');
1420 static void check_music(void)
1422 const magic_type *s_ptr;
1425 u32b need_mana_frac;
1427 /* Music singed by player */
1428 if (p_ptr->pclass != CLASS_BARD) return;
1429 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1431 if (p_ptr->anti_magic)
1437 spell = p_ptr->magic_num2[0];
1438 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1440 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1444 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1446 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1453 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1455 p_ptr->redraw |= PR_MANA;
1456 if (p_ptr->magic_num1[1])
1458 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1459 p_ptr->magic_num1[1] = 0;
1461 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1463 msg_print("You restart singing.");
1465 p_ptr->action = ACTION_SING;
1467 /* Recalculate bonuses */
1468 p_ptr->update |= (PU_BONUS | PU_HP);
1470 /* Redraw map and status bar */
1471 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1473 /* Update monsters */
1474 p_ptr->update |= (PU_MONSTERS);
1477 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1480 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1481 p_ptr->spell_exp[spell] += 5;
1482 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1483 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1484 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1485 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1486 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1487 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1489 /* Do any effects of continual song */
1490 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1494 /* Choose one of items that have cursed flag */
1495 static object_type *choose_cursed_obj_name(u32b flag)
1498 int choices[INVEN_TOTAL-INVEN_RARM];
1501 /* Paranoia -- Player has no warning-item */
1502 if (!(p_ptr->cursed & flag)) return NULL;
1504 /* Search Inventry */
1505 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1507 object_type *o_ptr = &inventory[i];
1509 if (o_ptr->curse_flags & flag)
1511 choices[number] = i;
1514 else if ((flag == TRC_ADD_L_CURSE) || (flag == TRC_ADD_H_CURSE))
1516 u32b cf = (flag == TRC_ADD_L_CURSE) ? TR_ADD_L_CURSE : TR_ADD_H_CURSE;
1518 object_flags(o_ptr, flgs);
1519 if (have_flag(flgs, cf))
1521 choices[number] = i;
1527 /* Choice one of them */
1528 return (&inventory[choices[randint0(number)]]);
1533 * Handle timed damage and regeneration every 10 game turns
1535 static void process_world_aux_hp_and_sp(void)
1537 feature_type *f_ptr = &f_info[cave[py][px].feat];
1538 bool cave_no_regen = FALSE;
1539 int upkeep_factor = 0;
1541 /* Default regeneration */
1542 int regen_amount = PY_REGEN_NORMAL;
1545 /*** Damage over Time ***/
1547 /* Take damage from poison */
1548 if (p_ptr->poisoned && !IS_INVULN())
1552 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
1554 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1559 /* Take damage from cuts */
1560 if (p_ptr->cut && !IS_INVULN())
1564 /* Mortal wound or Deep Gash */
1565 if (p_ptr->cut > 1000)
1570 else if (p_ptr->cut > 200)
1576 else if (p_ptr->cut > 100)
1581 else if (p_ptr->cut > 50)
1586 else if (p_ptr->cut > 25)
1591 else if (p_ptr->cut > 10)
1604 take_hit(DAMAGE_NOESCAPE, dam, "Ã×Ì¿½ý", -1);
1606 take_hit(DAMAGE_NOESCAPE, dam, "a fatal wound", -1);
1612 /* (Vampires) Take damage from sunlight */
1613 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1615 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1617 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1621 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
1622 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
1624 msg_print("The sun's rays scorch your undead flesh!");
1625 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
1628 cave_no_regen = TRUE;
1632 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1633 !p_ptr->resist_lite)
1635 object_type * o_ptr = &inventory[INVEN_LITE];
1636 char o_name [MAX_NLEN];
1637 char ouch [MAX_NLEN+40];
1639 /* Get an object description */
1640 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1643 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
1645 msg_format("The %s scorches your undead flesh!", o_name);
1649 cave_no_regen = TRUE;
1651 /* Get an object description */
1652 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1655 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
1657 sprintf(ouch, "wielding %s", o_name);
1660 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1664 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1668 if (have_flag(f_ptr->flags, FF_DEEP))
1670 damage = 6000 + randint0(4000);
1672 else if (!p_ptr->levitation)
1674 damage = 3000 + randint0(2000);
1679 if (prace_is_(RACE_ENT)) damage += damage / 3;
1680 if (p_ptr->resist_fire) damage = damage / 3;
1681 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1683 if (p_ptr->levitation) damage = damage / 5;
1685 damage = damage / 100 + (randint0(100) < (damage % 100));
1687 if (p_ptr->levitation)
1690 msg_print("Ç®¤Ç²Ð½ý¤·¤¿¡ª");
1691 take_hit(DAMAGE_NOESCAPE, damage, format("%s¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1693 msg_print("The heat burns you!");
1694 take_hit(DAMAGE_NOESCAPE, damage, format("flying over %s", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1699 cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name;
1701 msg_format("%s¤Ç²Ð½ý¤·¤¿¡ª", name);
1703 msg_format("The %s burns you!", name);
1705 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1708 cave_no_regen = TRUE;
1712 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1713 !p_ptr->levitation && !p_ptr->can_swim)
1715 if (p_ptr->total_weight > weight_limit())
1719 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
1720 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
1722 msg_print("You are drowning!");
1723 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
1726 cave_no_regen = TRUE;
1733 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1735 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1736 if (prace_is_(RACE_ENT)) damage += damage / 3;
1737 if (p_ptr->resist_fire) damage = damage / 3;
1738 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1740 msg_print("Ç®¤¤¡ª");
1741 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
1743 msg_print("It's hot!");
1744 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
1747 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1749 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1750 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1751 if (p_ptr->resist_elec) damage = damage / 3;
1752 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1754 msg_print("Äˤ¤¡ª");
1755 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
1757 msg_print("It hurts!");
1758 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
1761 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1763 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1764 if (p_ptr->resist_cold) damage = damage / 3;
1765 if (IS_OPPOSE_COLD()) damage = damage / 3;
1767 msg_print("Î䤿¤¤¡ª");
1768 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
1770 msg_print("It's cold!");
1771 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
1776 /* Spectres -- take damage when moving through walls */
1778 * Added: ANYBODY takes damage if inside through walls
1779 * without wraith form -- NOTE: Spectres will never be
1780 * reduced below 0 hp by being inside a stone wall; others
1783 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1785 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
1786 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1790 cave_no_regen = TRUE;
1792 if (p_ptr->pass_wall)
1795 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
1798 msg_print("Your molecules feel disrupted!");
1799 dam_desc = "density";
1805 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
1806 dam_desc = "¹Å¤¤´ä";
1808 msg_print("You are being crushed!");
1809 dam_desc = "solid rock";
1813 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1818 /*** handle regeneration ***/
1821 if (p_ptr->food < PY_FOOD_WEAK)
1823 /* Lower regeneration */
1824 if (p_ptr->food < PY_FOOD_STARVE)
1828 else if (p_ptr->food < PY_FOOD_FAINT)
1830 regen_amount = PY_REGEN_FAINT;
1834 regen_amount = PY_REGEN_WEAK;
1838 /* Are we walking the pattern? */
1839 if (pattern_effect())
1841 cave_no_regen = TRUE;
1845 /* Regeneration ability */
1846 if (p_ptr->regenerate)
1848 regen_amount = regen_amount * 2;
1850 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1854 if (p_ptr->cursed & TRC_SLOW_REGEN)
1861 /* Searching or Resting */
1862 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1864 regen_amount = regen_amount * 2;
1867 upkeep_factor = calculate_upkeep();
1869 /* No regeneration while special action */
1870 if ((p_ptr->action == ACTION_LEARN) ||
1871 (p_ptr->action == ACTION_HAYAGAKE) ||
1872 (p_ptr->special_defense & KATA_KOUKIJIN))
1874 upkeep_factor += 100;
1877 /* Regenerate the mana */
1878 regenmana(upkeep_factor, regen_amount);
1881 /* Recharge magic eater's power */
1882 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1884 regenmagic(regen_amount);
1887 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1889 while (upkeep_factor > 100)
1892 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
1894 msg_print("Too many pets to control at once!");
1897 do_cmd_pet_dismiss();
1899 upkeep_factor = calculate_upkeep();
1902 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
1904 msg_format("Upkeep: %d%% mana.", upkeep_factor);
1910 /* Poisoned or cut yields no healing */
1911 if (p_ptr->poisoned) regen_amount = 0;
1912 if (p_ptr->cut) regen_amount = 0;
1914 /* Special floor -- Pattern, in a wall -- yields no healing */
1915 if (cave_no_regen) regen_amount = 0;
1917 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
1919 /* Regenerate Hit Points if needed */
1920 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1922 regenhp(regen_amount);
1928 * Handle timeout every 10 game turns
1930 static void process_world_aux_timeout(void)
1932 const int dec_count = (easy_band ? 2 : 1);
1934 /*** Timeout Various Things ***/
1937 if (p_ptr->tim_mimic)
1939 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1942 /* Hack -- Hallucinating */
1945 (void)set_image(p_ptr->image - dec_count);
1951 (void)set_blind(p_ptr->blind - dec_count);
1954 /* Times see-invisible */
1955 if (p_ptr->tim_invis)
1957 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1968 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1971 /* Timed temporary elemental brands. -LM- */
1972 if (p_ptr->ele_attack)
1974 p_ptr->ele_attack--;
1976 /* Clear all temporary elemental brands. */
1977 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1980 /* Timed temporary elemental immune. -LM- */
1981 if (p_ptr->ele_immune)
1983 p_ptr->ele_immune--;
1985 /* Clear all temporary elemental brands. */
1986 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1989 /* Timed infra-vision */
1990 if (p_ptr->tim_infra)
1992 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1996 if (p_ptr->tim_stealth)
1998 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2001 /* Timed levitation */
2002 if (p_ptr->tim_levitation)
2004 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
2007 /* Timed sh_touki */
2008 if (p_ptr->tim_sh_touki)
2010 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2014 if (p_ptr->tim_sh_fire)
2016 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2020 if (p_ptr->tim_sh_holy)
2022 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2026 if (p_ptr->tim_eyeeye)
2028 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2031 /* Timed resist-magic */
2032 if (p_ptr->resist_magic)
2034 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2037 /* Timed regeneration */
2038 if (p_ptr->tim_regen)
2040 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2043 /* Timed resist nether */
2044 if (p_ptr->tim_res_nether)
2046 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2049 /* Timed resist time */
2050 if (p_ptr->tim_res_time)
2052 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2056 if (p_ptr->tim_reflect)
2058 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2062 if (p_ptr->multishadow)
2064 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2067 /* Timed Robe of dust */
2068 if (p_ptr->dustrobe)
2070 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2073 /* Timed infra-vision */
2074 if (p_ptr->kabenuke)
2076 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2080 if (p_ptr->paralyzed)
2082 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2086 if (p_ptr->confused)
2088 (void)set_confused(p_ptr->confused - dec_count);
2094 (void)set_afraid(p_ptr->afraid - dec_count);
2100 (void)set_fast(p_ptr->fast - 1, TRUE);
2106 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2109 /* Protection from evil */
2110 if (p_ptr->protevil)
2112 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2115 /* Invulnerability */
2118 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2122 if (p_ptr->wraith_form)
2124 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2130 (void)set_hero(p_ptr->hero - 1, TRUE);
2136 (void)set_shero(p_ptr->shero - 1, TRUE);
2142 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2148 (void)set_shield(p_ptr->shield - 1, TRUE);
2152 if (p_ptr->tsubureru)
2154 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2158 if (p_ptr->magicdef)
2160 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2164 if (p_ptr->tsuyoshi)
2166 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2170 if (p_ptr->oppose_acid)
2172 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2175 /* Oppose Lightning */
2176 if (p_ptr->oppose_elec)
2178 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2182 if (p_ptr->oppose_fire)
2184 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2188 if (p_ptr->oppose_cold)
2190 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2194 if (p_ptr->oppose_pois)
2196 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2201 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2204 /*** Poison and Stun and Cut ***/
2207 if (p_ptr->poisoned)
2209 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2211 /* Apply some healing */
2212 (void)set_poisoned(p_ptr->poisoned - adjust);
2218 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2220 /* Apply some healing */
2221 (void)set_stun(p_ptr->stun - adjust);
2227 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2229 /* Hack -- Truly "mortal" wound */
2230 if (p_ptr->cut > 1000) adjust = 0;
2232 /* Apply some healing */
2233 (void)set_cut(p_ptr->cut - adjust);
2239 * Handle burning fuel every 10 game turns
2241 static void process_world_aux_light(void)
2243 /* Check for light being wielded */
2244 object_type *o_ptr = &inventory[INVEN_LITE];
2246 /* Burn some fuel in the current lite */
2247 if (o_ptr->tval == TV_LITE)
2249 /* Hack -- Use some fuel (except on artifacts) */
2250 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2252 /* Decrease life-span */
2253 if (o_ptr->name2 == EGO_LITE_LONG)
2255 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2257 else o_ptr->xtra4--;
2259 /* Notice interesting fuel steps */
2260 notice_lite_change(o_ptr);
2267 * Handle mutation effects once every 10 game turns
2269 static void process_world_aux_mutation(void)
2271 /* No mutation with effects */
2272 if (!p_ptr->muta2) return;
2274 /* No effect on monster arena */
2275 if (p_ptr->inside_battle) return;
2277 /* No effect on the global map */
2278 if (p_ptr->wild_mode) return;
2281 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2285 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
2286 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
2288 msg_print("RAAAAGHH!");
2289 msg_print("You feel a fit of rage coming over you!");
2292 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2293 (void)set_afraid(0);
2296 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2298 if (!p_ptr->resist_fear)
2302 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
2304 msg_print("It's so dark... so scary!");
2307 set_afraid(p_ptr->afraid + 13 + randint1(26));
2311 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2313 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2318 /* Teleport player */
2320 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
2322 msg_print("Your position suddenly seems very uncertain...");
2326 teleport_player(40, TELEPORT_PASSIVE);
2330 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2332 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2335 p_ptr->redraw |= PR_EXTRA;
2337 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
2339 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2344 if (!p_ptr->resist_conf)
2346 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2349 if (!p_ptr->resist_chaos)
2354 if (one_in_(3)) lose_all_info();
2356 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2359 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
2360 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
2362 msg_print("You wake up somewhere with a sore head...");
2363 msg_print("You can't remember a thing, or how you got here!");
2372 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
2374 msg_print("Thishcischs GooDSChtuff!");
2377 (void)set_image(p_ptr->image + randint0(150) + 150);
2383 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2385 if (!p_ptr->resist_chaos)
2388 p_ptr->redraw |= PR_EXTRA;
2389 (void)set_image(p_ptr->image + randint0(50) + 20);
2393 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2398 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
2400 msg_print("BRRAAAP! Oops.");
2404 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2407 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2408 !p_ptr->anti_magic && one_in_(9000))
2413 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
2415 msg_print("Magical energy flows through you! You must release it!");
2420 (void)get_hack_dir(&dire);
2421 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2424 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2425 !p_ptr->anti_magic && (randint1(6666) == 666))
2427 bool pet = one_in_(6);
2428 u32b mode = PM_ALLOW_GROUP;
2430 if (pet) mode |= PM_FORCE_PET;
2431 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2433 if (summon_specific((pet ? -1 : 0), py, px,
2434 dun_level, SUMMON_DEMON, mode))
2437 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2439 msg_print("You have attracted a demon!");
2446 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2452 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2454 msg_print("You feel less energetic.");
2457 if (p_ptr->fast > 0)
2463 set_slow(randint1(30) + 10, FALSE);
2469 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2471 msg_print("You feel more energetic.");
2474 if (p_ptr->slow > 0)
2480 set_fast(randint1(30) + 10, FALSE);
2485 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2489 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
2491 msg_print("You suddenly feel almost lonely.");
2494 banish_monsters(100);
2495 if (!dun_level && p_ptr->town_num)
2499 /* Pick a random shop (except home) */
2502 n = randint0(MAX_STORES);
2504 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2507 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
2509 msg_print("You see one of the shopkeepers running for the hills!");
2517 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2522 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
2524 msg_print("A shadow passes over you.");
2529 /* Absorb light from the current possition */
2530 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2535 o_ptr = &inventory[INVEN_LITE];
2537 /* Absorb some fuel in the current lite */
2538 if (o_ptr->tval == TV_LITE)
2540 /* Use some fuel (except on artifacts) */
2541 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2543 /* Heal the player a bit */
2544 hp_player(o_ptr->xtra4 / 20);
2546 /* Decrease life-span of lite */
2550 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
2552 msg_print("You absorb energy from your light!");
2556 /* Notice interesting fuel steps */
2557 notice_lite_change(o_ptr);
2562 * Unlite the area (radius 10) around player and
2563 * do 50 points damage to every affected monster
2565 unlite_area(50, 10);
2568 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
2569 !p_ptr->anti_magic && one_in_(7000))
2571 bool pet = one_in_(3);
2572 u32b mode = PM_ALLOW_GROUP;
2574 if (pet) mode |= PM_FORCE_PET;
2575 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2577 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
2580 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
2582 msg_print("You have attracted an animal!");
2589 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
2590 !p_ptr->anti_magic && one_in_(8000))
2594 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
2596 msg_print("You feel the world warping around you!");
2600 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2602 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2604 if (!lose_mutation(0))
2606 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
2608 msg_print("You feel oddly normal.");
2612 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2616 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
2618 msg_print("You feel insubstantial!");
2622 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2624 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2628 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2630 int which_stat = randint0(6);
2631 int sustained = FALSE;
2636 if (p_ptr->sustain_str) sustained = TRUE;
2639 if (p_ptr->sustain_int) sustained = TRUE;
2642 if (p_ptr->sustain_wis) sustained = TRUE;
2645 if (p_ptr->sustain_dex) sustained = TRUE;
2648 if (p_ptr->sustain_con) sustained = TRUE;
2651 if (p_ptr->sustain_chr) sustained = TRUE;
2655 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
2657 msg_print("Invalid stat chosen!");
2667 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
2669 msg_print("You can feel yourself wasting away!");
2673 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2676 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
2677 !p_ptr->anti_magic && one_in_(3000))
2679 bool pet = one_in_(5);
2680 u32b mode = PM_ALLOW_GROUP;
2682 if (pet) mode |= PM_FORCE_PET;
2683 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2685 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
2688 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2690 msg_print("You have attracted a dragon!");
2696 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
2699 if (p_ptr->tim_esp > 0)
2702 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
2704 msg_print("Your mind feels cloudy!");
2707 set_tim_esp(0, TRUE);
2712 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
2714 msg_print("Your mind expands!");
2717 set_tim_esp(p_ptr->lev, FALSE);
2720 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
2725 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
2727 msg_print("Your stomach roils, and you lose your lunch!");
2731 set_food(PY_FOOD_WEAK);
2732 if (music_singing_any()) stop_singing();
2733 if (hex_spelling_any()) stop_hex_spell_all();
2736 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
2737 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2742 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2744 int danger_amount = 0;
2747 for (monster = 0; monster < m_max; monster++)
2749 monster_type *m_ptr = &m_list[monster];
2750 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2752 /* Paranoia -- Skip dead monsters */
2753 if (!m_ptr->r_idx) continue;
2755 if (r_ptr->level >= p_ptr->lev)
2757 danger_amount += r_ptr->level - p_ptr->lev + 1;
2761 if (danger_amount > 100)
2763 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
2765 msg_print("You feel utterly terrified!");
2768 else if (danger_amount > 50)
2770 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
2772 msg_print("You feel terrified!");
2775 else if (danger_amount > 20)
2777 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
2779 msg_print("You feel very worried!");
2782 else if (danger_amount > 10)
2784 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
2786 msg_print("You feel paranoid!");
2789 else if (danger_amount > 5)
2791 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
2793 msg_print("You feel almost safe.");
2798 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
2800 msg_print("You feel lonely.");
2804 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
2809 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
2811 msg_print("You feel invincible!");
2815 (void)set_invuln(randint1(8) + 8, FALSE);
2817 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2819 int wounds = p_ptr->mhp - p_ptr->chp;
2823 int healing = p_ptr->csp;
2825 if (healing > wounds)
2831 p_ptr->csp -= healing;
2834 p_ptr->redraw |= (PR_MANA);
2837 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
2840 int wounds = p_ptr->msp - p_ptr->csp;
2844 int healing = p_ptr->chp;
2846 if (healing > wounds)
2851 p_ptr->csp += healing;
2854 p_ptr->redraw |= (PR_MANA);
2856 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
2858 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
2863 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2866 object_type *o_ptr = NULL;
2870 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
2871 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
2873 msg_print("You trip over your own feet!");
2874 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
2878 if (buki_motteruka(INVEN_RARM))
2881 o_ptr = &inventory[INVEN_RARM];
2883 if (buki_motteruka(INVEN_LARM) && one_in_(2))
2885 o_ptr = &inventory[INVEN_LARM];
2889 else if (buki_motteruka(INVEN_LARM))
2891 o_ptr = &inventory[INVEN_LARM];
2895 if (slot && !object_is_cursed(o_ptr))
2898 msg_print("Éð´ï¤òÍî¤È¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
2900 msg_print("You drop your weapon!");
2902 inven_drop(slot, 1);
2908 * Handle curse effects once every 10 game turns
2910 static void process_world_aux_curse(void)
2912 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2915 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2916 * can actually be useful!
2918 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2920 char o_name[MAX_NLEN];
2922 int i, i_keep = 0, count = 0;
2924 /* Scan the equipment with random teleport ability */
2925 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2927 u32b flgs[TR_FLAG_SIZE];
2928 o_ptr = &inventory[i];
2930 /* Skip non-objects */
2931 if (!o_ptr->k_idx) continue;
2933 /* Extract the item flags */
2934 object_flags(o_ptr, flgs);
2936 if (have_flag(flgs, TR_TELEPORT))
2938 /* {.} will stop random teleportation. */
2939 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2942 if (one_in_(count)) i_keep = i;
2947 o_ptr = &inventory[i_keep];
2948 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2951 msg_format("%s¤¬¥Æ¥ì¥Ý¡¼¥È¤ÎǽÎϤòȯư¤µ¤»¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", o_name);
2953 msg_format("Your %s is activating teleportation.", o_name);
2957 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
2959 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
2963 teleport_player(50, 0L);
2968 msg_format("%s¤Ë{.}(¥Ô¥ê¥ª¥É)¤ÈÌäò¹ï¤à¤Èȯư¤òÍÞÀ©¤Ç¤¤Þ¤¹¡£", o_name);
2970 msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
2975 /* Make a chainsword noise */
2976 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2980 if (!get_rnd_line("chainswd_j.txt", 0, noise))
2982 if (!get_rnd_line("chainswd.txt", 0, noise))
2985 disturb(FALSE, FALSE);
2988 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2991 (void)activate_ty_curse(FALSE, &count);
2993 /* Handle experience draining */
2994 if (p_ptr->prace != RACE_ANDROID &&
2995 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2997 p_ptr->exp -= (p_ptr->lev+1)/2;
2998 if (p_ptr->exp < 0) p_ptr->exp = 0;
2999 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3000 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3003 /* Add light curse (Later) */
3004 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3009 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3011 new_curse = get_curse(0, o_ptr);
3012 if (!(o_ptr->curse_flags & new_curse))
3014 char o_name[MAX_NLEN];
3016 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3018 o_ptr->curse_flags |= new_curse;
3020 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3022 msg_format("There is a malignant black aura surrounding your %s...", o_name);
3025 o_ptr->feeling = FEEL_NONE;
3027 p_ptr->update |= (PU_BONUS);
3030 /* Add heavy curse (Later) */
3031 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3036 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3038 new_curse = get_curse(1, o_ptr);
3039 if (!(o_ptr->curse_flags & new_curse))
3041 char o_name[MAX_NLEN];
3043 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3045 o_ptr->curse_flags |= new_curse;
3047 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3049 msg_format("There is a malignant black aura surrounding your %s...", o_name);
3052 o_ptr->feeling = FEEL_NONE;
3054 p_ptr->update |= (PU_BONUS);
3058 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3060 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3061 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3063 char o_name[MAX_NLEN];
3065 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3067 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3069 msg_format("Your %s have attracted an animal!", o_name);
3076 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3078 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3080 char o_name[MAX_NLEN];
3082 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3084 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3086 msg_format("Your %s have attracted a demon!", o_name);
3093 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3095 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3096 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3098 char o_name[MAX_NLEN];
3100 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3102 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3104 msg_format("Your %s have attracted an animal!", o_name);
3110 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3112 if (!p_ptr->resist_fear)
3116 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3118 msg_print("It's so dark... so scary!");
3121 set_afraid(p_ptr->afraid + 13 + randint1(26));
3124 /* Teleport player */
3125 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3129 /* Teleport player */
3130 teleport_player(40, TELEPORT_PASSIVE);
3132 /* Handle HP draining */
3133 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3135 char o_name[MAX_NLEN];
3137 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3139 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3141 msg_format("Your %s drains HP from you!", o_name);
3143 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3145 /* Handle mana draining */
3146 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
3148 char o_name[MAX_NLEN];
3150 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3152 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3154 msg_format("Your %s drains mana from you!", o_name);
3156 p_ptr->csp -= MIN(p_ptr->lev, 50);
3160 p_ptr->csp_frac = 0;
3162 p_ptr->redraw |= PR_MANA;
3166 /* Rarely, take damage from the Jewel of Judgement */
3167 if (one_in_(999) && !p_ptr->anti_magic)
3169 object_type *o_ptr = &inventory[INVEN_LITE];
3171 if (o_ptr->name1 == ART_JUDGE)
3174 if (object_is_known(o_ptr))
3175 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3177 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3178 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3180 if (object_is_known(o_ptr))
3181 msg_print("The Jewel of Judgement drains life from you!");
3183 msg_print("Something drains life from you!");
3184 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3192 * Handle recharging objects once every 10 game turns
3194 static void process_world_aux_recharge(void)
3199 /* Process equipment */
3200 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3202 /* Get the object */
3203 object_type *o_ptr = &inventory[i];
3205 /* Skip non-objects */
3206 if (!o_ptr->k_idx) continue;
3208 /* Recharge activatable objects */
3209 if (o_ptr->timeout > 0)
3214 /* Notice changes */
3215 if (!o_ptr->timeout)
3217 recharged_notice(o_ptr);
3223 /* Notice changes */
3227 p_ptr->window |= (PW_EQUIP);
3232 * Recharge rods. Rods now use timeout to control charging status,
3233 * and each charging rod in a stack decreases the stack's timeout by
3234 * one per turn. -LM-
3236 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
3238 object_type *o_ptr = &inventory[i];
3239 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3241 /* Skip non-objects */
3242 if (!o_ptr->k_idx) continue;
3244 /* Examine all charging rods or stacks of charging rods. */
3245 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3247 /* Determine how many rods are charging. */
3248 int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3249 if (temp > o_ptr->number) temp = o_ptr->number;
3251 /* Decrease timeout by that number. */
3252 o_ptr->timeout -= temp;
3254 /* Boundary control. */
3255 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3257 /* Notice changes, provide message if object is inscribed. */
3258 if (!(o_ptr->timeout))
3260 recharged_notice(o_ptr);
3264 /* One of the stack of rod is charged */
3265 else if (o_ptr->timeout % k_ptr->pval)
3272 /* Notice changes */
3276 p_ptr->window |= (PW_INVEN);
3280 /* Process objects on floor */
3281 for (i = 1; i < o_max; i++)
3284 object_type *o_ptr = &o_list[i];
3286 /* Skip dead objects */
3287 if (!o_ptr->k_idx) continue;
3289 /* Recharge rods on the ground. No messages. */
3290 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3293 o_ptr->timeout -= o_ptr->number;
3295 /* Boundary control. */
3296 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3303 * Handle involuntary movement once every 10 game turns
3305 static void process_world_aux_movement(void)
3307 /* Delayed Word-of-Recall */
3308 if (p_ptr->word_recall)
3311 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3312 * The player is yanked up/down as soon as
3313 * he loads the autosaved game.
3315 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3316 do_cmd_save_game(TRUE);
3318 /* Count down towards recall */
3319 p_ptr->word_recall--;
3321 p_ptr->redraw |= (PR_STATUS);
3323 /* Activate the recall */
3324 if (!p_ptr->word_recall)
3329 /* Determine the level */
3330 if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
3332 msg_print(_("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
3333 "You feel yourself yanked upwards!"));
3335 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
3337 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3342 leave_quest_check();
3343 leave_tower_check();
3345 p_ptr->inside_quest = 0;
3347 p_ptr->leaving = TRUE;
3351 msg_print(_("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
3352 "You feel yourself yanked downwards!"));
3354 dungeon_type = p_ptr->recall_dungeon;
3357 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3360 dun_level = max_dlv[dungeon_type];
3361 if (dun_level < 1) dun_level = 1;
3363 /* Nightmare mode makes recall more dangerous */
3364 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3370 else if (dun_level < 99)
3372 dun_level = (dun_level + 99) / 2;
3374 else if (dun_level > 100)
3376 dun_level = d_info[dungeon_type].maxdepth - 1;
3380 if (p_ptr->wild_mode)
3382 p_ptr->wilderness_y = py;
3383 p_ptr->wilderness_x = px;
3387 /* Save player position */
3391 p_ptr->wild_mode = FALSE;
3394 * Clear all saved floors
3395 * and create a first saved floor
3397 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3400 p_ptr->leaving = TRUE;
3402 if (dungeon_type == DUNGEON_ANGBAND)
3406 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3408 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
3409 (quest[i].status == QUEST_STATUS_TAKEN) &&
3410 (quest[i].level < dun_level))
3412 quest[i].status = QUEST_STATUS_FAILED;
3413 quest[i].complev = (byte)p_ptr->lev;
3414 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
3421 sound(SOUND_TPLEVEL);
3426 /* Delayed Alter reality */
3427 if (p_ptr->alter_reality)
3429 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3430 do_cmd_save_game(TRUE);
3432 /* Count down towards alter */
3433 p_ptr->alter_reality--;
3435 p_ptr->redraw |= (PR_STATUS);
3437 /* Activate the alter reality */
3438 if (!p_ptr->alter_reality)
3443 /* Determine the level */
3444 if (!quest_number(dun_level) && dun_level)
3447 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
3449 msg_print("The world changes!");
3453 * Clear all saved floors
3454 * and create a first saved floor
3456 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3459 p_ptr->leaving = TRUE;
3464 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
3466 msg_print("The world seems to change for a moment!");
3471 sound(SOUND_TPLEVEL);
3478 * Count number of adjacent monsters
3480 static int get_monster_crowd_number(int m_idx)
3482 monster_type *m_ptr = &m_list[m_idx];
3488 for (i = 0; i < 7; i++)
3490 int ay = my + ddy_ddd[i];
3491 int ax = mx + ddx_ddd[i];
3493 if (!in_bounds(ay, ax)) continue;
3495 /* Count number of monsters */
3496 if (cave[ay][ax].m_idx > 0) count++;
3505 * Dungeon rating is no longer linear
3507 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3510 * Examine all monsters and unidentified objects,
3511 * and get the feeling of current dungeon floor
3513 static byte get_dungeon_feeling(void)
3515 const int base = 10;
3519 /* Hack -- no feeling in the town */
3520 if (!dun_level) return 0;
3522 /* Examine each monster */
3523 for (i = 1; i < m_max; i++)
3525 monster_type *m_ptr = &m_list[i];
3526 monster_race *r_ptr;
3529 /* Skip dead monsters */
3530 if (!m_ptr->r_idx) continue;
3533 if (is_pet(m_ptr)) continue;
3535 r_ptr = &r_info[m_ptr->r_idx];
3537 /* Unique monsters */
3538 if (r_ptr->flags1 & (RF1_UNIQUE))
3540 /* Nearly out-of-depth unique monsters */
3541 if (r_ptr->level + 10 > dun_level)
3543 /* Boost rating by twice delta-depth */
3544 delta += (r_ptr->level + 10 - dun_level) * 2 * base;
3549 /* Out-of-depth monsters */
3550 if (r_ptr->level > dun_level)
3552 /* Boost rating by delta-depth */
3553 delta += (r_ptr->level - dun_level) * base;
3557 /* Unusually crowded monsters get a little bit of rating boost */
3558 if (r_ptr->flags1 & RF1_FRIENDS)
3560 if (5 <= get_monster_crowd_number(i)) delta += 1;
3564 if (2 <= get_monster_crowd_number(i)) delta += 1;
3568 rating += RATING_BOOST(delta);
3571 /* Examine each unidentified object */
3572 for (i = 1; i < o_max; i++)
3574 object_type *o_ptr = &o_list[i];
3575 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3578 /* Skip dead objects */
3579 if (!o_ptr->k_idx) continue;
3581 /* Skip known objects */
3582 if (object_is_known(o_ptr))
3585 if (o_ptr->marked & OM_TOUCHED) continue;
3588 /* Skip pseudo-known objects */
3589 if (o_ptr->ident & IDENT_SENSE) continue;
3592 if (object_is_ego(o_ptr))
3594 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3596 delta += e_ptr->rating * base;
3600 if (object_is_artifact(o_ptr))
3602 s32b cost = object_value_real(o_ptr);
3605 if (cost > 10000L) delta += 10 * base;
3606 if (cost > 50000L) delta += 10 * base;
3607 if (cost > 100000L) delta += 10 * base;
3609 /* Special feeling */
3610 if (!preserve_mode) return 1;
3613 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3614 if (o_ptr->tval == TV_SHIELD &&
3615 o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3616 if (o_ptr->tval == TV_GLOVES &&
3617 o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3618 if (o_ptr->tval == TV_BOOTS &&
3619 o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3620 if (o_ptr->tval == TV_HELM &&
3621 o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3622 if (o_ptr->tval == TV_RING &&
3623 o_ptr->sval == SV_RING_SPEED &&
3624 !object_is_cursed(o_ptr)) delta += 25 * base;
3625 if (o_ptr->tval == TV_RING &&
3626 o_ptr->sval == SV_RING_LORDLY &&
3627 !object_is_cursed(o_ptr)) delta += 15 * base;
3628 if (o_ptr->tval == TV_AMULET &&
3629 o_ptr->sval == SV_AMULET_THE_MAGI &&
3630 !object_is_cursed(o_ptr)) delta += 15 * base;
3632 /* Out-of-depth objects */
3633 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
3634 k_ptr->level > dun_level)
3636 /* Rating increase */
3637 delta += (k_ptr->level - dun_level) * base;
3640 rating += RATING_BOOST(delta);
3644 if (rating > RATING_BOOST(1000)) return 2;
3645 if (rating > RATING_BOOST(800)) return 3;
3646 if (rating > RATING_BOOST(600)) return 4;
3647 if (rating > RATING_BOOST(400)) return 5;
3648 if (rating > RATING_BOOST(300)) return 6;
3649 if (rating > RATING_BOOST(200)) return 7;
3650 if (rating > RATING_BOOST(100)) return 8;
3651 if (rating > RATING_BOOST(0)) return 9;
3658 * Update dungeon feeling, and announce it if changed
3660 static void update_dungeon_feeling(void)
3666 /* No feeling on the surface */
3667 if (!dun_level) return;
3669 /* No feeling in the arena */
3670 if (p_ptr->inside_battle) return;
3672 /* Extract delay time */
3673 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
3675 /* Not yet felt anything */
3676 if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3678 /* Extract quest number (if any) */
3679 quest_num = quest_number(dun_level);
3681 /* No feeling in a quest */
3683 (is_fixed_quest_idx(quest_num) &&
3684 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3685 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3688 /* Get new dungeon feeling */
3689 new_feeling = get_dungeon_feeling();
3691 /* Remember last time updated */
3692 p_ptr->feeling_turn = turn;
3695 if (p_ptr->feeling == new_feeling) return;
3697 /* Dungeon feeling is changed */
3698 p_ptr->feeling = new_feeling;
3700 /* Announce feeling */
3703 /* Update the level indicator */
3704 p_ptr->redraw |= (PR_DEPTH);
3707 if (disturb_minor) disturb(0, 0);
3712 * Handle certain things once every 10 game turns
3714 static void process_world(void)
3718 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3719 s32b prev_turn_in_today = ((turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3720 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3722 extract_day_hour_min(&day, &hour, &min);
3724 /* Update dungeon feeling, and announce it if changed */
3725 update_dungeon_feeling();
3727 /*** Check monster arena ***/
3728 if (p_ptr->inside_battle && !p_ptr->leaving)
3734 /* Count all hostile monsters */
3735 for (i2 = 0; i2 < cur_wid; ++i2)
3736 for (j2 = 0; j2 < cur_hgt; j2++)
3738 cave_type *c_ptr = &cave[j2][i2];
3740 if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
3743 win_m_idx = c_ptr->m_idx;
3747 if (number_mon == 0)
3750 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
3752 msg_print("They have kill each other at the same time.");
3755 p_ptr->energy_need = 0;
3758 else if ((number_mon-1) == 0)
3761 monster_type *wm_ptr;
3763 wm_ptr = &m_list[win_m_idx];
3765 monster_desc(m_name, wm_ptr, 0);
3767 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
3769 msg_format("%s is winner!", m_name);
3773 if (win_m_idx == (sel_monster+1))
3776 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
3778 msg_print("Congratulations.");
3781 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
3783 msg_format("You received %d gold.", battle_odds);
3785 p_ptr->au += battle_odds;
3790 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
3792 msg_print("You lost gold.");
3796 p_ptr->energy_need = 0;
3799 else if (turn - old_turn == 150*TURNS_PER_TICK)
3802 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
3804 msg_format("This battle have ended in a draw.");
3806 p_ptr->au += kakekin;
3808 p_ptr->energy_need = 0;
3813 /* Every 10 game turns */
3814 if (turn % TURNS_PER_TICK) return;
3816 /*** Check the Time and Load ***/
3818 if (!(turn % (50*TURNS_PER_TICK)))
3820 /* Check time and load */
3821 if ((0 != check_time()) || (0 != check_load()))
3824 if (closing_flag <= 2)
3829 /* Count warnings */
3834 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
3835 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
3837 msg_print("The gates to ANGBAND are closing...");
3838 msg_print("Please finish up and/or save your game.");
3848 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
3850 msg_print("The gates to ANGBAND are now closed.");
3855 p_ptr->playing = FALSE;
3858 p_ptr->leaving = TRUE;
3863 /*** Attempt timed autosave ***/
3864 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3866 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3867 do_cmd_save_game(TRUE);
3870 if (mon_fight && !ignore_unview)
3873 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
3875 msg_print("You hear noise.");
3879 /*** Handle the wilderness/town (sunshine) ***/
3881 /* While in town/wilderness */
3882 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3884 /* Hack -- Daybreak/Nighfall in town */
3885 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3889 /* Check for dawn */
3890 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
3899 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
3901 msg_print("The sun has risen.");
3904 if (!p_ptr->wild_mode)
3906 /* Hack -- Scan the town */
3907 for (y = 0; y < cur_hgt; y++)
3909 for (x = 0; x < cur_wid; x++)
3911 /* Get the cave grid */
3912 cave_type *c_ptr = &cave[y][x];
3915 c_ptr->info |= (CAVE_GLOW);
3917 /* Hack -- Memorize lit grids if allowed */
3918 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
3920 /* Hack -- Notice spot */
3934 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
3936 msg_print("The sun has fallen.");
3939 if (!p_ptr->wild_mode)
3941 /* Hack -- Scan the town */
3942 for (y = 0; y < cur_hgt; y++)
3944 for (x = 0; x < cur_wid; x++)
3946 /* Get the cave grid */
3947 cave_type *c_ptr = &cave[y][x];
3949 /* Feature code (applying "mimic" field) */
3950 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
3952 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
3953 !have_flag(f_ptr->flags, FF_ENTRANCE))
3956 c_ptr->info &= ~(CAVE_GLOW);
3958 if (!have_flag(f_ptr->flags, FF_REMEMBER))
3960 /* Forget the normal floor grid */
3961 c_ptr->info &= ~(CAVE_MARK);
3963 /* Hack -- Notice spot */
3969 /* Glow deep lava and building entrances */
3970 glow_deep_lava_and_bldg();
3975 /* Update the monsters */
3976 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3979 p_ptr->redraw |= (PR_MAP);
3982 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3984 if (p_ptr->special_defense & NINJA_S_STEALTH)
3986 if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
3991 /* While in the dungeon (vanilla_town or lite_town mode only) */
3992 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
3994 /*** Shuffle the Storekeepers ***/
3996 /* Chance is only once a day (while in dungeon) */
3997 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
3999 /* Sometimes, shuffle the shop-keepers */
4000 if (one_in_(STORE_SHUFFLE))
4004 /* Pick a random shop (except home and museum) */
4007 n = randint0(MAX_STORES);
4009 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
4011 /* Check every feature */
4012 for (i = 1; i < max_f_idx; i++)
4014 /* Access the index */
4015 feature_type *f_ptr = &f_info[i];
4017 /* Skip empty index */
4018 if (!f_ptr->name) continue;
4020 /* Skip non-store features */
4021 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
4023 /* Verify store type */
4024 if (f_ptr->subtype == n)
4028 if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_ptr->name);
4030 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_ptr->name);
4044 /*** Process the monsters ***/
4046 /* Check for creature generation. */
4047 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
4048 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
4050 /* Make a new monster */
4051 (void)alloc_monster(MAX_SIGHT + 5, 0);
4054 /* Hack -- Check for creature regeneration */
4055 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
4056 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
4058 if (!p_ptr->leaving)
4062 /* Hack -- Process the counters of monsters if needed */
4063 for (i = 0; i < MAX_MTIMED; i++)
4065 if (mproc_max[i] > 0) process_monsters_mtimed(i);
4073 if (min != prev_min)
4075 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
4076 determine_today_mon(FALSE);
4081 * Nightmare mode activates the TY_CURSE at midnight
4083 * Require exact minute -- Don't activate multiple times in a minute
4085 if (ironman_nightmare && (min != prev_min))
4087 /* Every 15 minutes after 11:00 pm */
4088 if ((hour == 23) && !(min % 15))
4097 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
4099 msg_print("You hear a distant bell toll ominously.");
4105 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
4107 msg_print("A distant bell sounds twice.");
4113 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
4115 msg_print("A distant bell sounds three times.");
4121 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
4123 msg_print("A distant bell tolls four times.");
4129 /* TY_CURSE activates at midnight! */
4136 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
4138 msg_print("A distant bell tolls many times, fading into an deathly silence.");
4141 activate_ty_curse(FALSE, &count);
4146 /*** Check the Food, and Regenerate ***/
4148 if (!p_ptr->inside_battle)
4150 /* Digest quickly when gorged */
4151 if (p_ptr->food >= PY_FOOD_MAX)
4153 /* Digest a lot of food */
4154 (void)set_food(p_ptr->food - 100);
4157 /* Digest normally -- Every 50 game turns */
4158 else if (!(turn % (TURNS_PER_TICK*5)))
4160 /* Basic digestion rate based on speed */
4161 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
4163 /* Regeneration takes more food */
4164 if (p_ptr->regenerate)
4166 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
4168 if (p_ptr->cursed & TRC_FAST_DIGEST)
4171 /* Slow digestion takes less food */
4172 if (p_ptr->slow_digest)
4175 /* Minimal digestion */
4176 if (digestion < 1) digestion = 1;
4177 /* Maximal digestion */
4178 if (digestion > 100) digestion = 100;
4180 /* Digest some food */
4181 (void)set_food(p_ptr->food - digestion);
4186 if ((p_ptr->food < PY_FOOD_FAINT))
4188 /* Faint occasionally */
4189 if (!p_ptr->paralyzed && (randint0(100) < 10))
4193 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
4195 msg_print("You faint from the lack of food.");
4200 /* Hack -- faint (bypass free action) */
4201 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
4204 /* Starve to death (slowly) */
4205 if (p_ptr->food < PY_FOOD_STARVE)
4207 /* Calculate damage */
4208 int dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
4212 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "¶õÊ¢", -1);
4214 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "starvation", -1);
4222 /* Process timed damage and regeneration */
4223 process_world_aux_hp_and_sp();
4225 /* Process timeout */
4226 process_world_aux_timeout();
4229 process_world_aux_light();
4231 /* Process mutation effects */
4232 process_world_aux_mutation();
4234 /* Process curse effects */
4235 process_world_aux_curse();
4237 /* Process recharging */
4238 process_world_aux_recharge();
4240 /* Feel the inventory */
4244 /* Involuntary Movement */
4245 process_world_aux_movement();
4251 * Verify use of "wizard" mode
4253 static bool enter_wizard_mode(void)
4255 /* Ask first time */
4256 if (!p_ptr->noscore)
4258 /* Wizard mode is not permitted */
4259 if (!allow_debug_opts || arg_wizard)
4262 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4264 msg_print("Wizard mode is not permitted.");
4269 /* Mention effects */
4271 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4272 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4274 msg_print("Wizard mode is for debugging and experimenting.");
4275 msg_print("The game will not be scored if you enter wizard mode.");
4280 /* Verify request */
4282 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4284 if (!get_check("Are you sure you want to enter wizard mode? "))
4291 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4293 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4296 p_ptr->noscore |= 0x0002;
4307 * Verify use of "debug" commands
4309 static bool enter_debug_mode(void)
4311 /* Ask first time */
4312 if (!p_ptr->noscore)
4314 /* Debug mode is not permitted */
4315 if (!allow_debug_opts)
4318 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4320 msg_print("Use of debug command is not permitted.");
4325 /* Mention effects */
4327 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4328 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4330 msg_print("The debug commands are for debugging and experimenting.");
4331 msg_print("The game will not be scored if you use debug commands.");
4336 /* Verify request */
4338 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4340 if (!get_check("Are you sure you want to use debug commands? "))
4347 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4349 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4352 p_ptr->noscore |= 0x0008;
4360 * Hack -- Declare the Debug Routines
4362 extern void do_cmd_debug(void);
4364 #endif /* ALLOW_WIZARD */
4370 * Verify use of "borg" commands
4372 static bool enter_borg_mode(void)
4374 /* Ask first time */
4375 if (!(p_ptr->noscore & 0x0010))
4377 /* Mention effects */
4379 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4380 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4382 msg_print("The borg commands are for debugging and experimenting.");
4383 msg_print("The game will not be scored if you use borg commands.");
4388 /* Verify request */
4390 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4392 if (!get_check("Are you sure you want to use borg commands? "))
4399 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4401 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4404 p_ptr->noscore |= 0x0010;
4412 * Hack -- Declare the Ben Borg
4414 extern void do_cmd_borg(void);
4416 #endif /* ALLOW_BORG */
4421 * Parse and execute the current command
4422 * Give "Warning" on illegal commands.
4424 * XXX XXX XXX Make some "blocks"
4426 static void process_command(void)
4428 int old_now_message = now_message;
4430 #ifdef ALLOW_REPEAT /* TNB */
4432 /* Handle repeating the last command */
4435 #endif /* ALLOW_REPEAT -- TNB */
4440 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
4441 reset_concent = TRUE;
4443 /* Parse the command */
4444 switch (command_cmd)
4460 /*** Wizard Commands ***/
4462 /* Toggle Wizard Mode */
4467 p_ptr->wizard = FALSE;
4469 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4471 msg_print("Wizard mode off.");
4475 else if (enter_wizard_mode())
4477 p_ptr->wizard = TRUE;
4479 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4481 msg_print("Wizard mode on.");
4486 /* Update monsters */
4487 p_ptr->update |= (PU_MONSTERS);
4489 /* Redraw "title" */
4490 p_ptr->redraw |= (PR_TITLE);
4498 /* Special "debug" commands */
4501 /* Enter debug mode */
4502 if (enter_debug_mode())
4509 #endif /* ALLOW_WIZARD */
4514 /* Special "borg" commands */
4517 /* Enter borg mode */
4518 if (enter_borg_mode())
4520 if (!p_ptr->wild_mode) do_cmd_borg();
4526 #endif /* ALLOW_BORG */
4530 /*** Inventory Commands ***/
4532 /* Wear/wield equipment */
4535 if (!p_ptr->wild_mode) do_cmd_wield();
4539 /* Take off equipment */
4542 if (!p_ptr->wild_mode) do_cmd_takeoff();
4549 if (!p_ptr->wild_mode) do_cmd_drop();
4553 /* Destroy an item */
4560 /* Equipment list */
4567 /* Inventory list */
4575 /*** Various commands ***/
4577 /* Identify an object */
4584 /* Hack -- toggle windows */
4587 toggle_inven_equip();
4592 /*** Standard "Movement" Commands ***/
4597 if (!p_ptr->wild_mode) do_cmd_alter();
4604 if (!p_ptr->wild_mode) do_cmd_tunnel();
4608 /* Move (usually pick up things) */
4611 #ifdef ALLOW_EASY_DISARM /* TNB */
4615 #else /* ALLOW_EASY_DISARM -- TNB */
4617 do_cmd_walk(always_pickup);
4619 #endif /* ALLOW_EASY_DISARM -- TNB */
4624 /* Move (usually do not pick up) */
4627 #ifdef ALLOW_EASY_DISARM /* TNB */
4631 #else /* ALLOW_EASY_DISARM -- TNB */
4633 do_cmd_walk(!always_pickup);
4635 #endif /* ALLOW_EASY_DISARM -- TNB */
4641 /*** Running, Resting, Searching, Staying */
4643 /* Begin Running -- Arg is Max Distance */
4646 if (!p_ptr->wild_mode) do_cmd_run();
4650 /* Stay still (usually pick things up) */
4653 do_cmd_stay(always_pickup);
4657 /* Stay still (usually do not pick up) */
4660 do_cmd_stay(!always_pickup);
4664 /* Rest -- Arg is time */
4671 /* Search for traps/doors */
4678 /* Toggle search mode */
4681 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4682 else set_action(ACTION_SEARCH);
4687 /*** Stairs and Doors and Chests and Traps ***/
4690 case SPECIAL_KEY_STORE:
4692 if (!p_ptr->wild_mode) do_cmd_store();
4696 /* Enter building -KMW- */
4697 case SPECIAL_KEY_BUILDING:
4699 if (!p_ptr->wild_mode) do_cmd_bldg();
4703 /* Enter quest level -KMW- */
4704 case SPECIAL_KEY_QUEST:
4706 if (!p_ptr->wild_mode) do_cmd_quest();
4710 /* Go up staircase */
4713 if (!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4715 if (vanilla_town) break;
4720 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4722 msg_print("To flee the ambush you have to reach the edge of the map.");
4727 if (p_ptr->food < PY_FOOD_WEAK)
4730 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4732 msg_print("You must eat something here.");
4744 /* Go down staircase */
4747 if (p_ptr->wild_mode)
4755 /* Open a door or chest */
4758 if (!p_ptr->wild_mode) do_cmd_open();
4765 if (!p_ptr->wild_mode) do_cmd_close();
4769 /* Jam a door with spikes */
4772 if (!p_ptr->wild_mode) do_cmd_spike();
4779 if (!p_ptr->wild_mode) do_cmd_bash();
4783 /* Disarm a trap or chest */
4786 if (!p_ptr->wild_mode) do_cmd_disarm();
4791 /*** Magic and Prayers ***/
4793 /* Gain new spells/prayers */
4796 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4798 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4800 msg_print("You don't have to learn spells!");
4802 else if (p_ptr->pclass == CLASS_SAMURAI)
4803 do_cmd_gain_hissatsu();
4804 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4814 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4815 (p_ptr->pclass == CLASS_BERSERKER) ||
4816 (p_ptr->pclass == CLASS_NINJA) ||
4817 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4818 ) do_cmd_mind_browse();
4819 else if (p_ptr->pclass == CLASS_SMITH)
4821 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4822 do_cmd_magic_eater(TRUE, FALSE);
4823 else if (p_ptr->pclass == CLASS_SNIPER)
4824 do_cmd_snipe_browse();
4825 else do_cmd_browse();
4833 if (!p_ptr->wild_mode)
4835 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4838 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4840 msg_print("You cannot cast spells!");
4843 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4846 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4848 msg_print("The dungeon absorbs all attempted magic!");
4852 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4856 cptr which_power = "ËâË¡";
4858 cptr which_power = "magic";
4860 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4862 which_power = "ĶǽÎÏ";
4864 which_power = "psionic powers";
4866 else if (p_ptr->pclass == CLASS_IMITATOR)
4868 which_power = "¤â¤Î¤Þ¤Í";
4870 which_power = "imitation";
4872 else if (p_ptr->pclass == CLASS_SAMURAI)
4874 which_power = "ɬ»¦·õ";
4876 which_power = "hissatsu";
4878 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4880 which_power = "¶ÀËâË¡";
4882 which_power = "mirror magic";
4884 else if (p_ptr->pclass == CLASS_NINJA)
4886 which_power = "Ǧ½Ñ";
4888 which_power = "ninjutsu";
4890 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4892 which_power = "µ§¤ê";
4894 which_power = "prayer";
4898 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4900 msg_format("An anti-magic shell disrupts your %s!", which_power);
4904 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4907 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4909 msg_format("You cannot think directly!");
4915 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4916 (p_ptr->pclass == CLASS_BERSERKER) ||
4917 (p_ptr->pclass == CLASS_NINJA) ||
4918 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4921 else if (p_ptr->pclass == CLASS_IMITATOR)
4923 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4924 do_cmd_magic_eater(FALSE, FALSE);
4925 else if (p_ptr->pclass == CLASS_SAMURAI)
4927 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4928 do_cmd_cast_learned();
4929 else if (p_ptr->pclass == CLASS_SMITH)
4931 else if (p_ptr->pclass == CLASS_SNIPER)
4940 /* Issue a pet command */
4943 if (!p_ptr->wild_mode) do_cmd_pet();
4947 /*** Use various objects ***/
4949 /* Inscribe an object */
4956 /* Uninscribe an object */
4959 do_cmd_uninscribe();
4963 /* Activate an artifact */
4966 if (!p_ptr->wild_mode)
4968 if (!p_ptr->inside_arena)
4973 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4975 msg_print("The arena absorbs all attempted magic!");
4991 /* Fuel your lantern/torch */
5001 if (!p_ptr->wild_mode) do_cmd_fire();
5008 if (!p_ptr->wild_mode)
5018 if (!p_ptr->wild_mode)
5020 if (!p_ptr->inside_arena)
5025 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5027 msg_print("The arena absorbs all attempted magic!");
5039 if (!p_ptr->wild_mode)
5041 if (p_ptr->inside_arena)
5044 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5046 msg_print("The arena absorbs all attempted magic!");
5051 else if (use_command && rogue_like_commands)
5063 /* Quaff a potion */
5066 if (!p_ptr->wild_mode)
5068 if (!p_ptr->inside_arena)
5069 do_cmd_quaff_potion();
5073 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5075 msg_print("The arena absorbs all attempted magic!");
5087 if (!p_ptr->wild_mode)
5089 if (!p_ptr->inside_arena)
5090 do_cmd_read_scroll();
5094 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5096 msg_print("The arena absorbs all attempted magic!");
5108 if (!p_ptr->wild_mode)
5110 if (p_ptr->inside_arena)
5113 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5115 msg_print("The arena absorbs all attempted magic!");
5120 else if (use_command && !rogue_like_commands)
5130 /* Use racial power */
5133 if (!p_ptr->wild_mode) do_cmd_racial_power();
5138 /*** Looking at Things (nearby or on map) ***/
5140 /* Full dungeon map */
5147 /* Locate player on map */
5161 /* Target monster or location */
5164 if (!p_ptr->wild_mode) do_cmd_target();
5170 /*** Help and Such ***/
5179 /* Identify symbol */
5182 do_cmd_query_symbol();
5186 /* Character description */
5189 do_cmd_change_name();
5194 /*** System Commands ***/
5196 /* Hack -- User interface */
5203 /* Single line from a pref file */
5212 do_cmd_reload_autopick();
5218 do_cmd_edit_autopick();
5222 /* Interact with macros */
5229 /* Interact with visuals */
5237 /* Interact with colors */
5245 /* Interact with options */
5249 (void)combine_and_reorder_home(STORE_HOME);
5254 /*** Misc Commands ***/
5270 /* Repeat level feeling */
5273 if (!p_ptr->wild_mode) do_cmd_feeling();
5277 /* Show previous message */
5280 do_cmd_message_one();
5284 /* Show previous messages */
5287 do_cmd_messages(old_now_message);
5291 /* Show quest status -KMW- */
5294 do_cmd_checkquest();
5298 /* Redraw the screen */
5301 now_message = old_now_message;
5306 #ifndef VERIFY_SAVEFILE
5308 /* Hack -- Save and don't quit */
5311 do_cmd_save_game(FALSE);
5315 #endif /* VERIFY_SAVEFILE */
5325 case SPECIAL_KEY_QUIT:
5327 do_cmd_save_and_exit();
5331 /* Quit (commit suicide) */
5344 /* Check artifacts, uniques, objects */
5351 /* Load "screen dump" */
5354 do_cmd_load_screen();
5358 /* Save "screen dump" */
5361 do_cmd_save_screen();
5365 /* Record/stop "Movie" */
5368 prepare_movie_hooks();
5372 /* Make random artifact list */
5375 spoil_random_artifact("randifact.txt");
5382 if (!p_ptr->wild_mode) do_cmd_travel();
5383 if (p_ptr->special_defense & KATA_MUSOU)
5385 set_action(ACTION_NONE);
5391 /* Hack -- Unknown command */
5394 if (flush_failure) flush();
5398 sound(SOUND_ILLEGAL);
5400 if (!get_rnd_line("error_j.txt", 0, error_m))
5402 if (!get_rnd_line("error.txt", 0, error_m))
5409 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5411 prt("Type '?' for help.", 0, 0);
5417 if (!energy_use && !now_message)
5418 now_message = old_now_message;
5424 static bool monster_tsuri(int r_idx)
5426 monster_race *r_ptr = &r_info[r_idx];
5428 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
5435 /* Hack -- Pack Overflow */
5436 static void pack_overflow(void)
5438 if (inventory[INVEN_PACK].k_idx)
5440 char o_name[MAX_NLEN];
5443 /* Is auto-destroy done? */
5445 if (!inventory[INVEN_PACK].k_idx) return;
5447 /* Access the slot to be dropped */
5448 o_ptr = &inventory[INVEN_PACK];
5455 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5457 msg_print("Your pack overflows!");
5461 object_desc(o_name, o_ptr, 0);
5465 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(INVEN_PACK));
5467 msg_format("You drop %s (%c).", o_name, index_to_label(INVEN_PACK));
5470 /* Drop it (carefully) near the player */
5471 (void)drop_near(o_ptr, 0, py, px);
5473 /* Modify, Describe, Optimize */
5474 inven_item_increase(INVEN_PACK, -255);
5475 inven_item_describe(INVEN_PACK);
5476 inven_item_optimize(INVEN_PACK);
5478 /* Handle "p_ptr->notice" */
5481 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5487 * process the effects per 100 energy at player speed.
5489 static void process_upkeep_with_speed(void)
5491 /* Give the player some energy */
5492 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
5494 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5498 if (p_ptr->enchant_energy_need > 0) return;
5500 while (p_ptr->enchant_energy_need <= 0)
5502 /* Handle the player song */
5503 if (!load) check_music();
5505 /* Hex - Handle the hex spells */
5506 if (!load) check_hex();
5507 if (!load) revenge_spell();
5509 /* There is some randomness of needed energy */
5510 p_ptr->enchant_energy_need += ENERGY_NEED();
5516 * Process the player
5518 * Notice the annoying code to handle "pack overflow", which
5519 * must come first just in case somebody manages to corrupt
5520 * the savefiles by clever use of menu commands or something.
5522 static void process_player(void)
5526 /*** Apply energy ***/
5531 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5533 msg_print("You feel different!");
5536 (void)gain_random_mutation(0);
5537 hack_mutation = FALSE;
5540 if (p_ptr->inside_battle)
5542 for(i = 1; i < m_max; i++)
5544 monster_type *m_ptr = &m_list[i];
5546 if (!m_ptr->r_idx) continue;
5548 /* Hack -- Detect monster */
5549 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5551 /* Update the monster */
5552 update_mon(i, FALSE);
5557 /* Give the player some energy */
5558 else if (!(load && p_ptr->energy_need <= 0))
5560 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5564 if (p_ptr->energy_need > 0) return;
5565 if (!command_rep) prt_time();
5567 /*** Check for interupts ***/
5569 /* Complete resting */
5576 if ((p_ptr->chp == p_ptr->mhp) &&
5577 (p_ptr->csp >= p_ptr->msp))
5579 set_action(ACTION_NONE);
5583 /* Complete resting */
5584 else if (resting == -2)
5587 if ((p_ptr->chp == p_ptr->mhp) &&
5588 (p_ptr->csp >= p_ptr->msp) &&
5589 !p_ptr->blind && !p_ptr->confused &&
5590 !p_ptr->poisoned && !p_ptr->afraid &&
5591 !p_ptr->stun && !p_ptr->cut &&
5592 !p_ptr->slow && !p_ptr->paralyzed &&
5593 !p_ptr->image && !p_ptr->word_recall &&
5594 !p_ptr->alter_reality)
5596 set_action(ACTION_NONE);
5601 if (p_ptr->action == ACTION_FISH)
5604 Term_xtra(TERM_XTRA_DELAY, 10);
5608 bool success = FALSE;
5609 get_mon_num_prep(monster_tsuri,NULL);
5610 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5612 if (r_idx && one_in_(2))
5615 y = py+ddy[tsuri_dir];
5616 x = px+ddx[tsuri_dir];
5617 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5620 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5622 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5624 msg_format("You have a good catch!", m_name);
5632 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5634 msg_print("Damn! The fish stole your bait!");
5641 /* Handle "abort" */
5644 /* Check for "player abort" (semi-efficiently for resting) */
5645 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5650 /* Check for a key */
5659 /* Hack -- Show a Message */
5661 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5663 msg_print("Canceled.");
5670 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5672 monster_type *m_ptr = &m_list[p_ptr->riding];
5673 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5675 if (MON_CSLEEP(m_ptr))
5680 (void)set_monster_csleep(p_ptr->riding, 0);
5682 /* Acquire the monster name */
5683 monster_desc(m_name, m_ptr, 0);
5685 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5687 msg_format("You have waked %s up.", m_name);
5691 if (MON_STUNNED(m_ptr))
5693 /* Hack -- Recover from stun */
5694 if (set_monster_stunned(p_ptr->riding,
5695 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
5699 /* Acquire the monster name */
5700 monster_desc(m_name, m_ptr, 0);
5702 /* Dump a message */
5704 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5706 msg_format("%^s is no longer stunned.", m_name);
5711 if (MON_CONFUSED(m_ptr))
5713 /* Hack -- Recover from confusion */
5714 if (set_monster_confused(p_ptr->riding,
5715 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
5719 /* Acquire the monster name */
5720 monster_desc(m_name, m_ptr, 0);
5722 /* Dump a message */
5724 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5726 msg_format("%^s is no longer confused.", m_name);
5731 if (MON_MONFEAR(m_ptr))
5733 /* Hack -- Recover from fear */
5734 if (set_monster_monfear(p_ptr->riding,
5735 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
5739 /* Acquire the monster name */
5740 monster_desc(m_name, m_ptr, 0);
5742 /* Dump a message */
5744 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5746 msg_format("%^s is no longer fear.", m_name);
5751 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5758 if (p_ptr->lightspeed)
5760 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5762 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5764 if (p_ptr->magic_num1[0] < 40)
5766 p_ptr->magic_num1[0] = 0;
5768 else p_ptr->magic_num1[0] -= 40;
5769 p_ptr->update |= (PU_BONUS);
5771 if (p_ptr->action == ACTION_LEARN)
5774 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
5776 /* Convert the unit (1/2^16) to (1/2^32) */
5777 s64b_LSHIFT(cost, cost_frac, 16);
5780 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
5784 p_ptr->csp_frac = 0;
5785 set_action(ACTION_NONE);
5790 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
5792 p_ptr->redraw |= PR_MANA;
5795 if (p_ptr->special_defense & KATA_MASK)
5797 if (p_ptr->special_defense & KATA_MUSOU)
5801 set_action(ACTION_NONE);
5806 p_ptr->redraw |= (PR_MANA);
5811 /*** Handle actual user input ***/
5813 /* Repeat until out of energy */
5814 while (p_ptr->energy_need <= 0)
5816 p_ptr->window |= PW_PLAYER;
5817 p_ptr->sutemi = FALSE;
5818 p_ptr->counter = FALSE;
5819 now_damaged = FALSE;
5821 /* Handle "p_ptr->notice" */
5824 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5827 /* Place the cursor on the player */
5828 move_cursor_relative(py, px);
5830 /* Refresh (optional) */
5831 if (fresh_before) Term_fresh();
5834 /* Hack -- Pack Overflow */
5838 /* Hack -- cancel "lurking browse mode" */
5839 if (!command_new) command_see = FALSE;
5842 /* Assume free turn */
5846 if (p_ptr->inside_battle)
5848 /* Place the cursor on the player */
5849 move_cursor_relative(py, px);
5851 command_cmd = SPECIAL_KEY_BUILDING;
5853 /* Process the command */
5857 /* Paralyzed or Knocked Out */
5858 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5865 else if (p_ptr->action == ACTION_REST)
5870 /* Reduce rest count */
5873 if (!resting) set_action(ACTION_NONE);
5875 /* Redraw the state */
5876 p_ptr->redraw |= (PR_STATE);
5884 else if (p_ptr->action == ACTION_FISH)
5899 else if (travel.run)
5906 /* Repeated command */
5907 else if (command_rep)
5909 /* Count this execution */
5912 /* Redraw the state */
5913 p_ptr->redraw |= (PR_STATE);
5918 /* Hack -- Assume messages were seen */
5921 /* Clear the top line */
5924 /* Process the command */
5928 /* Normal command */
5931 /* Place the cursor on the player */
5932 move_cursor_relative(py, px);
5935 /* Get a command (normal) */
5936 request_command(FALSE);
5939 /* Process the command */
5944 /* Hack -- Pack Overflow */
5953 /* Use some energy */
5954 if (world_player || energy_use > 400)
5956 /* The Randomness is irrelevant */
5957 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5961 /* There is some randomness of needed energy */
5962 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5965 /* Hack -- constant hallucination */
5966 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5969 /* Shimmer monsters if needed */
5970 if (shimmer_monsters)
5972 /* Clear the flag */
5973 shimmer_monsters = FALSE;
5975 /* Shimmer multi-hued monsters */
5976 for (i = 1; i < m_max; i++)
5978 monster_type *m_ptr;
5979 monster_race *r_ptr;
5981 /* Access monster */
5984 /* Skip dead monsters */
5985 if (!m_ptr->r_idx) continue;
5987 /* Skip unseen monsters */
5988 if (!m_ptr->ml) continue;
5990 /* Access the monster race */
5991 r_ptr = &r_info[m_ptr->ap_r_idx];
5993 /* Skip non-multi-hued monsters */
5994 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5997 /* Reset the flag */
5998 shimmer_monsters = TRUE;
6000 /* Redraw regardless */
6001 lite_spot(m_ptr->fy, m_ptr->fx);
6006 /* Handle monster detection */
6007 if (repair_monsters)
6009 /* Reset the flag */
6010 repair_monsters = FALSE;
6012 /* Rotate detection flags */
6013 for (i = 1; i < m_max; i++)
6015 monster_type *m_ptr;
6017 /* Access monster */
6020 /* Skip dead monsters */
6021 if (!m_ptr->r_idx) continue;
6023 /* Nice monsters get mean */
6024 if (m_ptr->mflag & MFLAG_NICE)
6026 /* Nice monsters get mean */
6027 m_ptr->mflag &= ~(MFLAG_NICE);
6030 /* Handle memorized monsters */
6031 if (m_ptr->mflag2 & MFLAG2_MARK)
6033 /* Maintain detection */
6034 if (m_ptr->mflag2 & MFLAG2_SHOW)
6037 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6039 /* Still need repairs */
6040 repair_monsters = TRUE;
6043 /* Remove detection */
6047 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6049 /* Assume invisible */
6052 /* Update the monster */
6053 update_mon(i, FALSE);
6055 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6056 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6058 /* Redraw regardless */
6059 lite_spot(m_ptr->fy, m_ptr->fx);
6064 if (p_ptr->pclass == CLASS_IMITATOR)
6066 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6069 for (i = 0; i < p_ptr->mane_num; i++)
6071 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6072 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6076 p_ptr->redraw |= (PR_IMITATION);
6078 if (p_ptr->action == ACTION_LEARN)
6081 p_ptr->redraw |= (PR_STATE);
6084 if (world_player && (p_ptr->energy_need > - 1000))
6087 p_ptr->redraw |= (PR_MAP);
6089 /* Update monsters */
6090 p_ptr->update |= (PU_MONSTERS);
6093 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6096 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6098 msg_print("You feel time flowing around you once more.");
6101 world_player = FALSE;
6102 p_ptr->energy_need = ENERGY_NEED();
6104 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6109 /* Hack -- notice death */
6110 if (!p_ptr->playing || p_ptr->is_dead)
6112 world_player = FALSE;
6117 if (energy_use && reset_concent) reset_concentration(TRUE);
6119 /* Handle "leaving" */
6120 if (p_ptr->leaving) break;
6123 /* Update scent trail */
6129 * Interact with the current dungeon level.
6131 * This function will not exit until the level is completed,
6132 * the user dies, or the game is terminated.
6134 static void dungeon(bool load_game)
6138 /* Set the base level */
6139 base_level = dun_level;
6141 /* Reset various flags */
6145 p_ptr->leaving = FALSE;
6147 /* Reset the "command" vars */
6150 #if 0 /* Don't reset here --- It's used for Arena */
6159 /* Cancel the target */
6163 ambush_flag = FALSE;
6165 /* Cancel the health bar */
6168 /* Check visual effects */
6169 shimmer_monsters = TRUE;
6170 shimmer_objects = TRUE;
6171 repair_monsters = TRUE;
6172 repair_objects = TRUE;
6178 /* Get index of current quest (if any) */
6179 quest_num = quest_number(dun_level);
6181 /* Inside a quest? */
6184 /* Mark the quest monster */
6185 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6188 /* Track maximum player level */
6189 if (p_ptr->max_plv < p_ptr->lev)
6191 p_ptr->max_plv = p_ptr->lev;
6195 /* Track maximum dungeon level (if not in quest -KMW-) */
6196 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6198 max_dlv[dungeon_type] = dun_level;
6199 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6202 (void)calculate_upkeep();
6204 /* Validate the panel */
6205 panel_bounds_center();
6207 /* Verify the panel */
6210 /* Flush messages */
6214 /* Enter "xtra" mode */
6215 character_xtra = TRUE;
6218 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6220 /* Redraw dungeon */
6221 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6224 p_ptr->redraw |= (PR_MAP);
6227 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6229 /* Update lite/view */
6230 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6232 /* Update monsters */
6233 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6235 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6238 /* Leave "xtra" mode */
6239 character_xtra = FALSE;
6242 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6244 /* Combine / Reorder the pack */
6245 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6247 /* Handle "p_ptr->notice" */
6250 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6256 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6257 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6258 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6260 if (p_ptr->inside_battle)
6264 p_ptr->energy_need = 0;
6270 msg_print("»î¹ç³«»Ï¡ª");
6272 msg_format("Ready..Fight!");
6278 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6279 p_ptr->magic_num1[0] = MUSIC_DETECT;
6281 /* Hack -- notice death or departure */
6282 if (!p_ptr->playing || p_ptr->is_dead) return;
6284 /* Print quest message if appropriate */
6285 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6287 quest_discovery(random_quest_number(dun_level));
6288 p_ptr->inside_quest = random_quest_number(dun_level);
6290 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6292 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6294 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6295 d_name+d_info[dungeon_type].name,
6296 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6298 msg_format("%^s lives in this level as the keeper of %s.",
6299 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6300 d_name+d_info[dungeon_type].name);
6304 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
6306 /*** Process this dungeon level ***/
6308 /* Reset the monster generation level */
6309 monster_level = base_level;
6311 /* Reset the object generation level */
6312 object_level = base_level;
6316 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6317 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6318 p_ptr->energy_need = 0;
6320 /* Not leaving dungeon */
6321 p_ptr->leaving_dungeon = FALSE;
6323 /* Initialize monster process */
6329 /* Hack -- Compact the monster list occasionally */
6330 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6332 /* Hack -- Compress the monster list occasionally */
6333 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6336 /* Hack -- Compact the object list occasionally */
6337 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6339 /* Hack -- Compress the object list occasionally */
6340 if (o_cnt + 32 < o_max) compact_objects(0);
6343 /* Process the player */
6346 process_upkeep_with_speed();
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 */
6406 if (dungeon_turn < dungeon_turn_limit)
6408 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6409 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6412 prevent_turn_overflow();
6414 if (wild_regen) wild_regen--;
6417 /* Inside a quest and non-unique questor? */
6418 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6420 /* Un-mark the quest monster */
6421 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6424 /* Not save-and-quit and not dead? */
6425 if (p_ptr->playing && !p_ptr->is_dead)
6428 * Maintain Unique monsters and artifact, save current
6429 * floor, then prepare next floor
6433 /* Forget the flag */
6434 reinit_wilderness = FALSE;
6437 /* Write about current level on the play record once per level */
6443 * Load some "user pref files"
6445 * Modified by Arcum Dagsson to support
6446 * separate macro files for different realms.
6448 static void load_all_pref_files(void)
6452 /* Access the "user" pref file */
6453 sprintf(buf, "user.prf");
6455 /* Process that file */
6456 process_pref_file(buf);
6458 /* Access the "user" system pref file */
6459 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6461 /* Process that file */
6462 process_pref_file(buf);
6464 /* Access the "race" pref file */
6465 sprintf(buf, "%s.prf", rp_ptr->title);
6467 /* Process that file */
6468 process_pref_file(buf);
6470 /* Access the "class" pref file */
6471 sprintf(buf, "%s.prf", cp_ptr->title);
6473 /* Process that file */
6474 process_pref_file(buf);
6476 /* Access the "character" pref file */
6477 sprintf(buf, "%s.prf", player_base);
6479 /* Process that file */
6480 process_pref_file(buf);
6482 /* Access the "realm 1" pref file */
6483 if (p_ptr->realm1 != REALM_NONE)
6485 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6487 /* Process that file */
6488 process_pref_file(buf);
6491 /* Access the "realm 2" pref file */
6492 if (p_ptr->realm2 != REALM_NONE)
6494 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6496 /* Process that file */
6497 process_pref_file(buf);
6501 /* Load an autopick preference file */
6502 autopick_load_pref(FALSE);
6507 * Extract option variables from bit sets
6509 void extract_option_vars(void)
6513 for (i = 0; option_info[i].o_desc; i++)
6515 int os = option_info[i].o_set;
6516 int ob = option_info[i].o_bit;
6518 /* Set the "default" options */
6519 if (option_info[i].o_var)
6522 if (option_flag[os] & (1L << ob))
6525 (*option_info[i].o_var) = TRUE;
6532 (*option_info[i].o_var) = FALSE;
6540 * Determine bounty uniques
6542 void determine_bounty_uniques(void)
6545 monster_race *r_ptr;
6547 get_mon_num_prep(NULL, NULL);
6548 for (i = 0; i < MAX_KUBI; i++)
6552 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6553 r_ptr = &r_info[kubi_r_idx[i]];
6555 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6557 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6559 if (r_ptr->rarity > 100) continue;
6561 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6563 for (j = 0; j < i; j++)
6564 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6571 for (i = 0; i < MAX_KUBI - 1; i++)
6573 for (j = i; j < MAX_KUBI; j++)
6575 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6577 tmp = kubi_r_idx[i];
6578 kubi_r_idx[i] = kubi_r_idx[j];
6579 kubi_r_idx[j] = tmp;
6587 * Determine today's bounty monster
6588 * Note: conv_old is used if loaded 0.0.3 or older save file
6590 void determine_today_mon(bool conv_old)
6593 bool old_inside_battle = p_ptr->inside_battle;
6594 monster_race *r_ptr;
6598 for (i = 0; i < max_d_idx; i++)
6600 if (max_dlv[i] < d_info[i].mindepth) continue;
6601 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6604 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6606 p_ptr->inside_battle = TRUE;
6607 get_mon_num_prep(NULL, NULL);
6611 today_mon = get_mon_num(max_dl);
6612 r_ptr = &r_info[today_mon];
6614 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6615 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6616 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6617 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6618 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6619 if (r_ptr->rarity > 10) continue;
6623 p_ptr->today_mon = 0;
6624 p_ptr->inside_battle = old_inside_battle;
6629 * Actually play a game
6631 * If the "new_game" parameter is true, then, after loading the
6632 * savefile, we will commit suicide, if necessary, to allow the
6633 * player to start a new game.
6635 void play_game(bool new_game)
6638 bool load_game = TRUE;
6639 bool init_random_seed = FALSE;
6649 else if (chuukei_server)
6651 prepare_chuukei_hooks();
6662 hack_mutation = FALSE;
6664 /* Hack -- Character is "icky" */
6665 character_icky = TRUE;
6667 /* Make sure main term is active */
6668 Term_activate(angband_term[0]);
6670 /* Initialise the resize hooks */
6671 angband_term[0]->resize_hook = resize_map;
6673 for (i = 1; i < 8; i++)
6675 /* Does the term exist? */
6676 if (angband_term[i])
6678 /* Add the redraw on resize hook */
6679 angband_term[i]->resize_hook = redraw_window;
6683 /* Hack -- turn off the cursor */
6684 (void)Term_set_cursor(0);
6687 /* Attempt to load */
6692 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6694 quit("broken savefile");
6699 /* Extract the options */
6700 extract_option_vars();
6702 /* Report waited score */
6703 if (p_ptr->wait_report_score)
6709 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6711 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6716 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6721 p_ptr->is_dead = TRUE;
6723 start_time = time(NULL);
6725 /* No suspending now */
6726 signals_ignore_tstp();
6728 /* Hack -- Character is now "icky" */
6729 character_icky = TRUE;
6731 /* Build the filename */
6732 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6734 /* Open the high score file, for reading/writing */
6735 highscore_fd = fd_open(buf, O_RDWR);
6737 /* Handle score, show Top scores */
6738 success = send_world_score(TRUE);
6741 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6743 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6747 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6749 prt("standing by for future registration...", 0, 0);
6755 p_ptr->wait_report_score = FALSE;
6758 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6760 if (!save_player()) msg_print("death save failed!");
6763 /* Shut the high score file */
6764 (void)fd_close(highscore_fd);
6766 /* Forget the high score fd */
6769 /* Allow suspending now */
6770 signals_handle_tstp();
6775 creating_savefile = new_game;
6777 /* Nothing loaded */
6778 if (!character_loaded)
6780 /* Make new player */
6783 /* The dungeon is not ready */
6784 character_dungeon = FALSE;
6786 /* Prepare to init the RNG */
6787 init_random_seed = TRUE;
6789 /* Initialize the saved floors data */
6790 init_saved_floors(FALSE);
6793 /* Old game is loaded. But new game is requested. */
6796 /* Initialize the saved floors data */
6797 init_saved_floors(TRUE);
6800 /* Process old character */
6803 /* Process the player name */
6804 process_player_name(FALSE);
6808 if (init_random_seed)
6813 seed = (time(NULL));
6817 /* Mutate the seed on Unix machines */
6818 seed = ((seed >> 3) * (getpid() << 1));
6823 Rand_state_init(seed);
6826 /* Roll new character */
6829 /* The dungeon is not ready */
6830 character_dungeon = FALSE;
6834 p_ptr->inside_quest = 0;
6835 p_ptr->inside_arena = FALSE;
6836 p_ptr->inside_battle = FALSE;
6840 /* Hack -- seed for flavors */
6841 seed_flavor = randint0(0x10000000);
6843 /* Hack -- seed for town layout */
6844 seed_town = randint0(0x10000000);
6846 /* Roll up a new character */
6854 determine_bounty_uniques();
6855 determine_today_mon(FALSE);
6857 /* Initialize object array */
6862 write_level = FALSE;
6865 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6867 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6871 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6872 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6874 if (p_ptr->riding == -1)
6877 for (i = m_max; i > 0; i--)
6879 if (player_bold(m_list[i].fy, m_list[i].fx))
6888 creating_savefile = FALSE;
6890 p_ptr->teleport_town = FALSE;
6891 p_ptr->sutemi = FALSE;
6892 world_monster = FALSE;
6893 now_damaged = FALSE;
6895 start_time = time(NULL) - 1;
6896 record_o_name[0] = '\0';
6898 /* Reset map panel */
6899 panel_row_min = cur_hgt;
6900 panel_col_min = cur_wid;
6902 /* Sexy gal gets bonus to maximum weapon skill of whip */
6903 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6904 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
6906 /* Fill the arrays of floors and walls in the good proportions */
6907 set_floor_and_wall(dungeon_type);
6909 /* Flavor the objects */
6912 /* Flash a message */
6914 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6916 prt("Please wait...", 0, 0);
6920 /* Flush the message */
6924 /* Hack -- Enter wizard mode */
6927 if (enter_wizard_mode())
6929 p_ptr->wizard = TRUE;
6931 if (p_ptr->is_dead || !py || !px)
6933 /* Initialize the saved floors data */
6934 init_saved_floors(TRUE);
6937 p_ptr->inside_quest = 0;
6939 /* Avoid crash in update_view() */
6943 else if (p_ptr->is_dead)
6945 quit("Already dead.");
6949 /* Initialize the town-buildings if necessary */
6950 if (!dun_level && !p_ptr->inside_quest)
6952 /* Init the wilderness */
6954 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6957 init_flags = INIT_ONLY_BUILDINGS;
6959 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6964 /* Generate a dungeon level if needed */
6965 if (!character_dungeon)
6972 /* HACK -- Restore from panic-save */
6973 if (p_ptr->panic_save)
6975 /* No player? -- Try to regenerate floor */
6979 msg_print("¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¤¬¤ª¤«¤·¤¤¡£¥Õ¥í¥¢¤òºÆÀ¸À®¤·¤Þ¤¹¡£");
6981 msg_print("What a strange player location. Regenerate the dungeon floor.");
6986 /* Still no player? -- Try to locate random place */
6987 if (!py || !px) py = px = 10;
6989 /* No longer in panic */
6990 p_ptr->panic_save = 0;
6994 /* Character is now "complete" */
6995 character_generated = TRUE;
6998 /* Hack -- Character is no longer "icky" */
6999 character_icky = FALSE;
7007 sprintf(buf, "%s¤Ë¹ß¤êΩ¤Ã¤¿¡£", map_name());
7009 sprintf(buf, "You are standing in the %s.", map_name());
7011 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
7016 p_ptr->playing = TRUE;
7018 /* Reset the visual mappings */
7021 /* Load the "pref" files */
7022 load_all_pref_files();
7024 /* Give startup outfit (after loading pref files) */
7030 /* React to changes */
7031 Term_xtra(TERM_XTRA_REACT, 0);
7034 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
7037 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
7043 /* Set or clear "rogue_like_commands" if requested */
7044 if (arg_force_original) rogue_like_commands = FALSE;
7045 if (arg_force_roguelike) rogue_like_commands = TRUE;
7047 /* Hack -- Enforce "delayed death" */
7048 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
7050 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
7052 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
7054 monster_type *m_ptr;
7055 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
7056 monster_race *r_ptr = &r_info[pet_r_idx];
7057 place_monster_aux(0, py, px - 1, pet_r_idx,
7058 (PM_FORCE_PET | PM_NO_KAGE));
7059 m_ptr = &m_list[hack_m_idx_ii];
7060 m_ptr->mspeed = r_ptr->speed;
7061 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
7062 m_ptr->max_maxhp = m_ptr->maxhp;
7063 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
7064 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7067 (void)combine_and_reorder_home(STORE_HOME);
7068 (void)combine_and_reorder_home(STORE_MUSEUM);
7073 /* Process the level */
7076 /* Handle "p_ptr->notice" */
7079 /* Hack -- prevent "icky" message */
7080 character_xtra = TRUE;
7082 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7085 character_xtra = FALSE;
7087 /* Cancel the target */
7090 /* Cancel the health bar */
7094 /* Forget the lite */
7097 /* Forget the view */
7100 /* Forget the view */
7103 /* Handle "quit and save" */
7104 if (!p_ptr->playing && !p_ptr->is_dead) break;
7106 /* Erase the old cave */
7108 if (!p_ptr->is_dead) wipe_m_list();
7116 /* Accidental Death */
7117 if (p_ptr->playing && p_ptr->is_dead)
7119 if (p_ptr->inside_arena)
7121 p_ptr->inside_arena = FALSE;
7122 if (p_ptr->arena_number > MAX_ARENA_MONS)
7123 p_ptr->arena_number++;
7125 p_ptr->arena_number = -1 - p_ptr->arena_number;
7126 p_ptr->is_dead = FALSE;
7128 p_ptr->chp_frac = 0;
7129 p_ptr->exit_bldg = TRUE;
7132 /* Leave through the exit */
7133 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
7135 /* prepare next floor */
7140 /* Mega-Hack -- Allow player to cheat death */
7142 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7144 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7147 /* Mark social class, reset age, if needed */
7148 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7154 p_ptr->noscore |= 0x0001;
7158 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7160 msg_print("You invoke wizard mode and cheat death.");
7164 /* Restore hit points */
7165 p_ptr->chp = p_ptr->mhp;
7166 p_ptr->chp_frac = 0;
7168 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7170 for (i = 0; i < EATER_EXT*2; i++)
7172 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7174 for (; i < EATER_EXT*3; i++)
7176 p_ptr->magic_num1[i] = 0;
7179 /* Restore spell points */
7180 p_ptr->csp = p_ptr->msp;
7181 p_ptr->csp_frac = 0;
7183 /* Hack -- cancel recall */
7184 if (p_ptr->word_recall)
7188 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7190 msg_print("A tension leaves the air around you...");
7195 /* Hack -- Prevent recall */
7196 p_ptr->word_recall = 0;
7197 p_ptr->redraw |= (PR_STATUS);
7200 /* Hack -- cancel alter */
7201 if (p_ptr->alter_reality)
7203 /* Hack -- Prevent alter */
7204 p_ptr->alter_reality = 0;
7205 p_ptr->redraw |= (PR_STATUS);
7208 /* Note cause of death XXX XXX XXX */
7210 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7212 (void)strcpy(p_ptr->died_from, "Cheating death");
7216 p_ptr->is_dead = FALSE;
7218 /* Hack -- Healing */
7220 (void)set_confused(0);
7221 (void)set_poisoned(0);
7222 (void)set_afraid(0);
7223 (void)set_paralyzed(0);
7228 /* Hack -- Prevent starvation */
7229 (void)set_food(PY_FOOD_MAX - 1);
7232 p_ptr->inside_arena = FALSE;
7233 p_ptr->inside_battle = FALSE;
7235 p_ptr->inside_quest = 0;
7236 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
7238 if (lite_town || vanilla_town)
7240 p_ptr->wilderness_y = 1;
7241 p_ptr->wilderness_x = 1;
7255 p_ptr->wilderness_y = 48;
7256 p_ptr->wilderness_x = 5;
7262 p_ptr->wild_mode = FALSE;
7263 p_ptr->leaving = TRUE;
7266 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7268 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7271 /* Prepare next floor */
7278 /* Handle "death" */
7279 if (p_ptr->is_dead) break;
7281 /* Make a new level */
7292 s32b turn_real(s32b hoge)
7294 switch (p_ptr->start_race)
7300 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
7307 * ¥¿¡¼¥ó¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤ËÂФ¹¤ëÂнè
7308 * ¥¿¡¼¥óµÚ¤Ó¥¿¡¼¥ó¤òµÏ¿¤¹¤ëÊÑ¿ô¤ò¥¿¡¼¥ó¤Î¸Â³¦¤Î1ÆüÁ°¤Þ¤Ç´¬¤Ì᤹.
7310 void prevent_turn_overflow(void)
7312 int rollback_days, i, j;
7313 s32b rollback_turns;
7315 if (turn < turn_limit) return;
7317 rollback_days = 1 + (turn - turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
7318 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
7320 if (turn > rollback_turns) turn -= rollback_turns;
7321 else turn = 1; /* Paranoia */
7322 if (old_turn > rollback_turns) old_turn -= rollback_turns;
7324 if (old_battle > rollback_turns) old_battle -= rollback_turns;
7325 else old_battle = 1;
7326 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
7327 else p_ptr->feeling_turn = 1;
7329 for (i = 1; i < max_towns; i++)
7331 for (j = 0; j < MAX_STORES; j++)
7333 store_type *st_ptr = &town[i].store[j];
7335 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
7337 st_ptr->last_visit -= rollback_turns;
7338 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
7341 if (st_ptr->store_open)
7343 st_ptr->store_open -= rollback_turns;
7344 if (st_ptr->store_open < 1) st_ptr->store_open = 1;