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;
318 if (0 != randint0(77777L / (plev * plev + 40))) return;
327 case CLASS_WARRIOR_MAGE:
331 if (0 != randint0(75000L / (plev * plev + 40))) return;
337 case CLASS_MINDCRAFTER:
339 case CLASS_BLUE_MAGE:
340 case CLASS_MIRROR_MASTER:
343 if (0 != randint0(55000L / (plev * plev + 40))) return;
349 case CLASS_CHAOS_WARRIOR:
352 if (0 != randint0(80000L / (plev * plev + 40))) return;
362 case CLASS_FORCETRAINER:
365 if (0 != randint0(20000L / (plev * plev + 40))) return;
374 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
383 case CLASS_BEASTMASTER:
386 if (0 != randint0(65000L / (plev * plev + 40))) return;
391 case CLASS_BERSERKER:
401 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
403 /*** Sense everything ***/
405 /* Check everything */
406 for (i = 0; i < INVEN_TOTAL; i++)
410 o_ptr = &inventory[i];
412 /* Skip empty slots */
413 if (!o_ptr->k_idx) continue;
415 /* Valid "tval" codes */
442 /* Skip non-sense machines */
445 /* Occasional failure on inventory items */
446 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
449 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
454 sense_inventory_aux(i, heavy);
459 static void sense_inventory2(void)
462 int plev = p_ptr->lev;
466 /*** Check for "sensing" ***/
468 /* No sensing when confused */
469 if (p_ptr->confused) return;
471 /* Analyze the class */
472 switch (p_ptr->pclass)
478 case CLASS_BERSERKER:
485 case CLASS_CHAOS_WARRIOR:
487 case CLASS_BEASTMASTER:
490 /* Very bad (light) sensing */
491 if (0 != randint0(240000L / (plev + 5))) return;
498 case CLASS_WARRIOR_MAGE:
503 if (0 != randint0(95000L / (plev * plev + 40))) return;
512 case CLASS_FORCETRAINER:
513 case CLASS_MINDCRAFTER:
516 if (0 != randint0(20000L / (plev * plev + 40))) return;
523 case CLASS_HIGH_MAGE:
525 case CLASS_MAGIC_EATER:
526 case CLASS_MIRROR_MASTER:
527 case CLASS_BLUE_MAGE:
530 if (0 != randint0(9000L / (plev * plev + 40))) return;
539 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
546 /*** Sense everything ***/
548 /* Check everything */
549 for (i = 0; i < INVEN_TOTAL; i++)
553 o_ptr = &inventory[i];
555 /* Skip empty slots */
556 if (!o_ptr->k_idx) continue;
558 /* Valid "tval" codes */
571 /* Skip non-sense machines */
574 /* Occasional failure on inventory items */
575 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
577 sense_inventory_aux(i, TRUE);
584 * Go to any level (ripped off from wiz_jump)
586 static void pattern_teleport(void)
593 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
595 if (get_check("Teleport level? "))
602 /* Only downward in ironman mode */
603 if (ironman_downward)
604 min_level = dun_level;
607 if (dungeon_type == DUNGEON_ANGBAND)
610 max_level = MAX_DEPTH - 1;
611 else if (dun_level == 100)
616 max_level = d_info[dungeon_type].maxdepth;
617 min_level = d_info[dungeon_type].mindepth;
622 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
624 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
629 sprintf(tmp_val, "%d", dun_level);
631 /* Ask for a level */
632 if (!get_string(ppp, tmp_val, 10)) return;
634 /* Extract request */
635 command_arg = atoi(tmp_val);
638 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
640 else if (get_check("Normal teleport? "))
644 teleport_player(200, FALSE);
653 if (command_arg < min_level) command_arg = min_level;
656 if (command_arg > max_level) command_arg = max_level;
660 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
662 msg_format("You teleport to dungeon level %d.", command_arg);
666 if (autosave_l) do_cmd_save_game(TRUE);
669 dun_level = command_arg;
673 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
675 p_ptr->inside_quest = 0;
679 * Clear all saved floors
680 * and create a first saved floor
682 prepare_change_floor_mode(CFM_FIRST_FLOOR);
685 p_ptr->leaving = TRUE;
689 static void wreck_the_pattern(void)
691 int to_ruin = 0, r_y, r_x;
692 int pattern_type = f_info[cave[py][px].feat].power;
694 if (pattern_type == PATTERN_TILE_WRECKED)
701 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
702 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
704 msg_print("You bleed on the Pattern!");
705 msg_print("Something terrible happens!");
710 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
712 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
715 to_ruin = randint1(45) + 35;
719 scatter(&r_y, &r_x, py, px, 4, 0);
721 if (pattern_tile(r_y, r_x) &&
722 (f_info[cave[r_y][r_x].feat].power != PATTERN_TILE_WRECKED))
724 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
728 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
732 /* Returns TRUE if we are on the Pattern... */
733 static bool pattern_effect(void)
737 if (!pattern_tile(py, px)) return FALSE;
739 if ((prace_is_(RACE_AMBERITE)) &&
740 (p_ptr->cut > 0) && one_in_(10))
745 pattern_type = f_info[cave[py][px].feat].power;
747 switch (pattern_type)
749 case PATTERN_TILE_END:
750 (void)set_poisoned(0);
756 (void)do_res_stat(A_STR);
757 (void)do_res_stat(A_INT);
758 (void)do_res_stat(A_WIS);
759 (void)do_res_stat(A_DEX);
760 (void)do_res_stat(A_CON);
761 (void)do_res_stat(A_CHR);
762 (void)restore_level();
763 (void)hp_player(1000);
765 cave_set_feat(py, px, FEAT_PATTERN_OLD);
768 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
770 msg_print("This section of the Pattern looks less powerful.");
774 * We could make the healing effect of the
775 * Pattern center one-time only to avoid various kinds
776 * of abuse, like luring the win monster into fighting you
777 * in the middle of the pattern...
781 case PATTERN_TILE_OLD:
785 case PATTERN_TILE_TELEPORT:
789 case PATTERN_TILE_WRECKED:
792 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
794 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
799 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
801 else if (!IS_INVULN())
803 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
805 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
818 * Regenerate hit points -RAK-
820 static void regenhp(int percent)
826 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
827 if (p_ptr->action == ACTION_HAYAGAKE) return;
829 /* Save the old hitpoints */
830 old_chp = p_ptr->chp;
833 * Extract the new hitpoints
835 * 'percent' is the Regen factor in unit (1/2^16)
838 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
840 /* Convert the unit (1/2^16) to (1/2^32) */
841 s64b_LSHIFT(new_chp, new_chp_frac, 16);
844 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
848 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
850 p_ptr->chp = p_ptr->mhp;
855 if (old_chp != p_ptr->chp)
858 p_ptr->redraw |= (PR_HP);
861 p_ptr->window |= (PW_PLAYER);
869 * Regenerate mana points
871 static void regenmana(int percent)
873 s32b old_csp = p_ptr->csp;
876 * Excess mana will decay 32 times faster than normal
879 if (p_ptr->csp > p_ptr->msp)
881 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
883 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
885 /* Convert the unit (1/2^16) to (1/2^32) */
886 s64b_LSHIFT(decay, decay_frac, 16);
889 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
892 if (p_ptr->csp < p_ptr->msp)
894 p_ptr->csp = p_ptr->msp;
899 /* Regenerating mana (unless the player has excess mana) */
900 else if (percent > 0)
902 /* (percent/100) is the Regen factor in unit (1/2^16) */
904 u32b new_mana_frac = (p_ptr->msp * percent / 100 + PY_REGEN_MNBASE);
906 /* Convert the unit (1/2^16) to (1/2^32) */
907 s64b_LSHIFT(new_mana, new_mana_frac, 16);
910 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
912 /* Must set frac to zero even if equal */
913 if (p_ptr->csp >= p_ptr->msp)
915 p_ptr->csp = p_ptr->msp;
921 /* Reduce mana (even when the player has excess mana) */
924 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
925 s32b reduce_mana = 0;
926 u32b reduce_mana_frac = (p_ptr->msp * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
928 /* Convert the unit (1/2^16) to (1/2^32) */
929 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
932 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
944 if (old_csp != p_ptr->csp)
947 p_ptr->redraw |= (PR_MANA);
950 p_ptr->window |= (PW_PLAYER);
951 p_ptr->window |= (PW_SPELL);
962 static void regenmagic(int percent)
967 for (i = 0; i < EATER_EXT*2; i++)
969 if (!p_ptr->magic_num2[i]) continue;
970 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
971 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
972 p_ptr->magic_num1[i] += new_mana;
974 /* Check maximum charge */
975 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
977 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
981 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
983 if (!p_ptr->magic_num1[i]) continue;
984 if (!p_ptr->magic_num2[i]) continue;
985 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
986 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
997 * Regenerate the monsters (once per 100 game turns)
999 * XXX XXX XXX Should probably be done during monster turns.
1001 static void regen_monsters(void)
1006 /* Regenerate everyone */
1007 for (i = 1; i < m_max; i++)
1009 /* Check the i'th monster */
1010 monster_type *m_ptr = &m_list[i];
1011 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1014 /* Skip dead monsters */
1015 if (!m_ptr->r_idx) continue;
1017 /* Allow regeneration (if needed) */
1018 if (m_ptr->hp < m_ptr->maxhp)
1020 /* Hack -- Base regeneration */
1021 frac = m_ptr->maxhp / 100;
1023 /* Hack -- Minimal regeneration rate */
1024 if (!frac) if (one_in_(2)) frac = 1;
1026 /* Hack -- Some monsters regenerate quickly */
1027 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1029 /* Hack -- Regenerate */
1032 /* Do not over-regenerate */
1033 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1035 /* Redraw (later) if needed */
1036 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1037 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1044 * Regenerate the captured monsters (once per 30 game turns)
1046 * XXX XXX XXX Should probably be done during monster turns.
1048 static void regen_captured_monsters(void)
1053 /* Regenerate everyone */
1054 for (i = 0; i < INVEN_TOTAL; i++)
1056 monster_race *r_ptr;
1057 object_type *o_ptr = &inventory[i];
1059 if (!o_ptr->k_idx) continue;
1060 if (o_ptr->tval != TV_CAPTURE) continue;
1061 if (!o_ptr->pval) continue;
1065 r_ptr = &r_info[o_ptr->pval];
1067 /* Allow regeneration (if needed) */
1068 if (o_ptr->xtra4 < o_ptr->xtra5)
1070 /* Hack -- Base regeneration */
1071 frac = o_ptr->xtra5 / 100;
1073 /* Hack -- Minimal regeneration rate */
1074 if (!frac) if (one_in_(2)) frac = 1;
1076 /* Hack -- Some monsters regenerate quickly */
1077 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1079 /* Hack -- Regenerate */
1080 o_ptr->xtra4 += frac;
1082 /* Do not over-regenerate */
1083 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1090 p_ptr->notice |= (PN_COMBINE);
1093 p_ptr->window |= (PW_INVEN);
1094 p_ptr->window |= (PW_EQUIP);
1101 * Process the counters of monsters (once per 10 game turns)
1103 * These functions are to process monsters' counters same as player's.
1107 /* Handle "sleep" */
1108 static void process_monsters_csleep(void)
1111 monster_type *m_ptr;
1112 monster_race *r_ptr;
1114 s16b *cur_mproc_list = mproc_list[MPROC_CSLEEP];
1116 u32b noise; /* Hack -- local "player stealth" value */
1118 /* Hack -- calculate the "player noise" */
1119 noise = (1L << (30 - p_ptr->skill_stl));
1121 /* Process the monsters (backwards) */
1122 for (i = mproc_max[MPROC_CSLEEP] - 1; i >= 1; i--)
1124 /* Access the monster */
1125 m_idx = cur_mproc_list[i];
1126 m_ptr = &m_list[m_idx];
1127 r_ptr = &r_info[m_ptr->r_idx];
1128 see_m = is_seen(m_ptr);
1130 /* Assume does not wake up */
1133 /* Hack -- Require proximity */
1134 if (m_ptr->cdis < AAF_LIMIT)
1136 /* Handle "sensing radius" */
1137 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1139 /* We may wake up */
1143 /* Handle "sight" and "aggravation" */
1144 else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
1146 /* We may wake up */
1153 u32b notice = randint0(1024);
1155 /* Nightmare monsters are more alert */
1156 if (ironman_nightmare) notice /= 2;
1158 /* Hack -- See if monster "notices" player */
1159 if ((notice * notice * notice) <= noise)
1161 /* Hack -- amount of "waking" */
1162 /* Wake up faster near the player */
1163 int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
1165 /* Hack -- amount of "waking" is affected by speed of player */
1166 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1170 if (m_ptr->csleep > d)
1172 /* Monster wakes up "a little bit" */
1175 /* Notice the "not waking up" */
1176 if (is_original_ap_and_seen(m_ptr))
1178 /* Hack -- Count the ignores */
1179 if (r_ptr->r_ignore < MAX_UCHAR) r_ptr->r_ignore++;
1186 /* Reset sleep counter */
1188 mproc_remove(m_idx, i, MPROC_CSLEEP);
1189 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1191 /* Notice the "waking up" */
1196 /* Acquire the monster name */
1197 monster_desc(m_name, m_ptr, 0);
1199 /* Dump a message */
1201 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1203 msg_format("%^s wakes up.", m_name);
1209 /* Redraw the health bar */
1210 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1211 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1213 /* Hack -- Count the wakings */
1214 if ((r_ptr->r_wake < MAX_UCHAR) && is_original_ap(m_ptr))
1227 static void process_monsters_fast(void)
1230 monster_type *m_ptr;
1232 s16b *cur_mproc_list = mproc_list[MPROC_FAST];
1234 /* Process the monsters (backwards) */
1235 for (i = mproc_max[MPROC_FAST] - 1; i >= 1; i--)
1237 /* Access the monster */
1238 m_idx = cur_mproc_list[i];
1239 m_ptr = &m_list[m_idx];
1240 see_m = is_seen(m_ptr);
1242 /* Reduce by one, note if expires */
1247 mproc_remove(m_idx, i, MPROC_FAST);
1252 /* Acquire the monster name */
1253 monster_desc(m_name, m_ptr, 0);
1255 /* Dump a message */
1257 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1259 msg_format("%^s is no longer fast.", m_name);
1262 if (p_ptr->riding == m_idx) p_ptr->update |= (PU_BONUS);
1269 static void process_monsters_slow(void)
1272 monster_type *m_ptr;
1274 s16b *cur_mproc_list = mproc_list[MPROC_SLOW];
1276 /* Process the monsters (backwards) */
1277 for (i = mproc_max[MPROC_SLOW] - 1; i >= 1; i--)
1279 /* Access the monster */
1280 m_idx = cur_mproc_list[i];
1281 m_ptr = &m_list[m_idx];
1282 see_m = is_seen(m_ptr);
1284 /* Reduce by one, note if expires */
1289 mproc_remove(m_idx, i, MPROC_SLOW);
1294 /* Acquire the monster name */
1295 monster_desc(m_name, m_ptr, 0);
1297 /* Dump a message */
1299 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1301 msg_format("%^s is no longer slow.", m_name);
1304 if (p_ptr->riding == m_idx) p_ptr->update |= (PU_BONUS);
1311 static void process_monsters_stunned(void)
1314 monster_type *m_ptr;
1315 monster_race *r_ptr;
1317 s16b *cur_mproc_list = mproc_list[MPROC_STUNNED];
1319 /* Process the monsters (backwards) */
1320 for (i = mproc_max[MPROC_STUNNED] - 1; i >= 1; i--)
1322 /* Access the monster */
1323 m_idx = cur_mproc_list[i];
1324 m_ptr = &m_list[m_idx];
1325 r_ptr = &r_info[m_ptr->r_idx];
1326 see_m = is_seen(m_ptr);
1330 /* Make a "saving throw" against stun */
1331 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1337 /* Hack -- Recover from stun */
1338 if (m_ptr->stunned > d)
1340 /* Recover somewhat */
1341 m_ptr->stunned -= d;
1349 mproc_remove(m_idx, i, MPROC_STUNNED);
1351 /* Message if visible */
1356 /* Acquire the monster name */
1357 monster_desc(m_name, m_ptr, 0);
1359 /* Dump a message */
1361 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1363 msg_format("%^s is no longer stunned.", m_name);
1371 /* Handle confusion */
1372 static void process_monsters_confused(void)
1375 monster_type *m_ptr;
1376 monster_race *r_ptr;
1378 s16b *cur_mproc_list = mproc_list[MPROC_CONFUSED];
1380 /* Process the monsters (backwards) */
1381 for (i = mproc_max[MPROC_CONFUSED] - 1; i >= 1; i--)
1383 /* Access the monster */
1384 m_idx = cur_mproc_list[i];
1385 m_ptr = &m_list[m_idx];
1386 r_ptr = &r_info[m_ptr->r_idx];
1387 see_m = is_seen(m_ptr);
1389 /* Amount of "boldness" */
1390 d = randint1(r_ptr->level / 20 + 1);
1392 /* Still confused */
1393 if (m_ptr->confused > d)
1395 /* Reduce the confusion */
1396 m_ptr->confused -= d;
1402 /* No longer confused */
1403 m_ptr->confused = 0;
1404 mproc_remove(m_idx, i, MPROC_CONFUSED);
1406 /* Message if visible */
1411 /* Acquire the monster name */
1412 monster_desc(m_name, m_ptr, 0);
1414 /* Dump a message */
1416 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1418 msg_format("%^s is no longer confused.", m_name);
1427 static void process_monsters_monfear(void)
1430 monster_type *m_ptr;
1431 monster_race *r_ptr;
1433 s16b *cur_mproc_list = mproc_list[MPROC_MONFEAR];
1435 /* Process the monsters (backwards) */
1436 for (i = mproc_max[MPROC_MONFEAR] - 1; i >= 1; i--)
1438 /* Access the monster */
1439 m_idx = cur_mproc_list[i];
1440 m_ptr = &m_list[m_idx];
1441 r_ptr = &r_info[m_ptr->r_idx];
1442 see_m = is_seen(m_ptr);
1444 /* Amount of "boldness" */
1445 d = randint1(r_ptr->level / 20 + 1);
1448 if (m_ptr->monfear > d)
1450 /* Reduce the fear */
1451 m_ptr->monfear -= d;
1454 /* Recover from fear, take note if seen */
1457 /* No longer afraid */
1459 mproc_remove(m_idx, i, MPROC_MONFEAR);
1468 /* Acquire the monster possessive */
1469 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1472 /* Acquire the monster name */
1473 monster_desc(m_name, m_ptr, 0);
1475 /* Dump a message */
1477 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1479 msg_format("%^s recovers %s courage.", m_name, m_poss);
1484 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1485 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1492 /* Handle Invulnerability */
1493 static void process_monsters_invulner(void)
1496 monster_type *m_ptr;
1498 s16b *cur_mproc_list = mproc_list[MPROC_INVULNER];
1500 /* Process the monsters (backwards) */
1501 for (i = mproc_max[MPROC_INVULNER] - 1; i >= 1; i--)
1503 /* Access the monster */
1504 m_idx = cur_mproc_list[i];
1505 m_ptr = &m_list[m_idx];
1506 see_m = is_seen(m_ptr);
1508 /* Reduce by one, note if expires */
1511 if (!m_ptr->invulner)
1513 mproc_remove(m_idx, i, MPROC_INVULNER);
1518 /* Acquire the monster name */
1519 monster_desc(m_name, m_ptr, 0);
1521 /* Dump a message */
1523 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1525 msg_format("%^s is no longer invulnerable.", m_name);
1530 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1531 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1533 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1539 static void notice_lite_change(object_type *o_ptr)
1541 /* Hack -- notice interesting fuel steps */
1542 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1545 p_ptr->window |= (PW_EQUIP);
1548 /* Hack -- Special treatment when blind */
1551 /* Hack -- save some light for later */
1552 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1555 /* The light is now out */
1556 else if (o_ptr->xtra4 == 0)
1560 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1562 msg_print("Your light has gone out!");
1565 /* Recalculate torch radius */
1566 p_ptr->update |= (PU_TORCH);
1568 /* Some ego light lose its effects without fuel */
1569 p_ptr->update |= (PU_BONUS);
1572 /* The light is getting dim */
1573 else if (o_ptr->name2 == EGO_LITE_LONG)
1575 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1576 && (turn % (TURNS_PER_TICK*2)))
1578 if (disturb_minor) disturb(0, 0);
1580 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1582 msg_print("Your light is growing faint.");
1588 /* The light is getting dim */
1589 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1591 if (disturb_minor) disturb(0, 0);
1593 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1595 msg_print("Your light is growing faint.");
1602 void leave_quest_check(void)
1604 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1605 leaving_quest = p_ptr->inside_quest;
1607 /* Leaving an 'only once' quest marks it as failed */
1608 if (leaving_quest &&
1609 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1610 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1612 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1613 quest[leaving_quest].complev = (byte)p_ptr->lev;
1614 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1616 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1617 if (record_rand_quest)
1618 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1620 /* Floor of random quest will be blocked */
1621 prepare_change_floor_mode(CFM_NO_RETURN);
1623 else if (record_fix_quest)
1624 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1630 * Forcibly pseudo-identify an object in the inventory
1633 * note: currently this function allows pseudo-id of any object,
1634 * including silly ones like potions & scrolls, which always
1635 * get '{average}'. This should be changed, either to stop such
1636 * items from being pseudo-id'd, or to allow psychometry to
1637 * detect whether the unidentified potion/scroll/etc is
1638 * good (Cure Light Wounds, Restore Strength, etc) or
1639 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1641 bool psychometry(void)
1645 char o_name[MAX_NLEN];
1650 item_tester_no_ryoute = TRUE;
1653 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1654 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1656 q = "Meditate on which item? ";
1657 s = "You have nothing appropriate.";
1660 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1662 /* Get the item (in the pack) */
1665 o_ptr = &inventory[item];
1668 /* Get the item (on the floor) */
1671 o_ptr = &o_list[0 - item];
1674 /* It is fully known, no information needed */
1675 if (object_is_known(o_ptr))
1678 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1680 msg_print("You cannot find out anything more about that.");
1686 /* Check for a feeling */
1687 feel = value_check_aux1(o_ptr);
1689 /* Get an object description */
1690 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1692 /* Skip non-feelings */
1696 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1698 msg_format("You do not perceive anything unusual about the %s.", o_name);
1705 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1706 o_name, game_inscriptions[feel]);
1708 msg_format("You feel that the %s %s %s...",
1709 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1710 game_inscriptions[feel]);
1714 /* We have "felt" it */
1715 o_ptr->ident |= (IDENT_SENSE);
1718 o_ptr->feeling = feel;
1720 /* Combine / Reorder the pack (later) */
1721 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1724 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1726 /* Valid "tval" codes */
1727 switch (o_ptr->tval)
1755 /* Auto-inscription/destroy */
1756 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1758 /* Something happened */
1764 * If player has inscribed the object with "!!", let him know when it's
1767 static void recharged_notice(object_type *o_ptr)
1769 char o_name[MAX_NLEN];
1773 /* No inscription */
1774 if (!o_ptr->inscription) return;
1777 s = my_strchr(quark_str(o_ptr->inscription), '!');
1779 /* Process notification request. */
1782 /* Find another '!' */
1785 /* Describe (briefly) */
1786 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1788 /* Notify the player */
1790 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1792 if (o_ptr->number > 1)
1793 msg_format("Your %s are recharged.", o_name);
1795 msg_format("Your %s is recharged.", o_name);
1804 /* Keep looking for '!'s */
1805 s = my_strchr(s + 1, '!');
1810 static void check_music(void)
1815 u32b need_mana_frac;
1817 /* Music singed by player */
1818 if (p_ptr->pclass != CLASS_BARD) return;
1819 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1821 if (p_ptr->anti_magic)
1827 spell = p_ptr->magic_num2[0];
1828 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1830 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1834 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1836 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1843 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1845 p_ptr->redraw |= PR_MANA;
1846 if (p_ptr->magic_num1[1])
1848 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1849 p_ptr->magic_num1[1] = 0;
1851 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1853 msg_print("You restart singing.");
1855 p_ptr->action = ACTION_SING;
1857 /* Recalculate bonuses */
1858 p_ptr->update |= (PU_BONUS | PU_HP);
1860 /* Redraw map and status bar */
1861 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1863 /* Update monsters */
1864 p_ptr->update |= (PU_MONSTERS);
1867 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1870 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1871 p_ptr->spell_exp[spell] += 5;
1872 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1873 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1874 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1875 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1876 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1877 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1879 /* Do any effects of continual song */
1880 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1884 /* Choose one of items that have cursed flag */
1885 static object_type *choose_cursed_obj_name(u32b flag)
1888 int choices[INVEN_TOTAL-INVEN_RARM];
1891 /* Paranoia -- Player has no warning-item */
1892 if (!(p_ptr->cursed & flag)) return NULL;
1894 /* Search Inventry */
1895 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1897 object_type *o_ptr = &inventory[i];
1899 if (o_ptr->curse_flags & flag)
1901 choices[number] = i;
1906 /* Choice one of them */
1907 return (&inventory[choices[randint0(number)]]);
1912 * Handle timed damage and regeneration every 10 game turns
1914 static void process_world_aux_hp_and_sp(void)
1916 feature_type *f_ptr = &f_info[cave[py][px].feat];
1917 bool cave_no_regen = FALSE;
1918 int upkeep_factor = 0;
1921 /* Default regeneration */
1922 int regen_amount = PY_REGEN_NORMAL;
1925 /*** Damage over Time ***/
1927 /* Take damage from poison */
1928 if (p_ptr->poisoned && !IS_INVULN())
1932 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
1934 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1939 /* Take damage from cuts */
1940 if (p_ptr->cut && !IS_INVULN())
1944 /* Mortal wound or Deep Gash */
1945 if (p_ptr->cut > 1000)
1950 else if (p_ptr->cut > 200)
1956 else if (p_ptr->cut > 100)
1961 else if (p_ptr->cut > 50)
1966 else if (p_ptr->cut > 25)
1971 else if (p_ptr->cut > 10)
1984 take_hit(DAMAGE_NOESCAPE, dam, "Ã×Ì¿½ý", -1);
1986 take_hit(DAMAGE_NOESCAPE, dam, "a fatal wound", -1);
1992 /* (Vampires) Take damage from sunlight */
1993 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1995 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1997 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2001 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2002 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2004 msg_print("The sun's rays scorch your undead flesh!");
2005 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2008 cave_no_regen = TRUE;
2012 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2013 !p_ptr->resist_lite)
2015 object_type * o_ptr = &inventory[INVEN_LITE];
2016 char o_name [MAX_NLEN];
2017 char ouch [MAX_NLEN+40];
2019 /* Get an object description */
2020 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2023 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2025 msg_format("The %s scorches your undead flesh!", o_name);
2029 cave_no_regen = TRUE;
2031 /* Get an object description */
2032 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2035 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2037 sprintf(ouch, "wielding %s", o_name);
2040 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2044 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
2048 if (have_flag(f_ptr->flags, FF_DEEP))
2050 damage = 6000 + randint0(4000);
2052 else if (!p_ptr->levitation)
2054 damage = 3000 + randint0(2000);
2059 if (prace_is_(RACE_ENT)) damage += damage / 3;
2060 if (p_ptr->resist_fire) damage = damage / 3;
2061 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2063 if (p_ptr->levitation) damage = damage / 5;
2065 damage = damage / 100 + (randint0(100) < (damage % 100));
2067 if (p_ptr->levitation)
2070 msg_print("Ç®¤Ç²Ð½ý¤·¤¿¡ª");
2071 take_hit(DAMAGE_NOESCAPE, damage, format("%s¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
2073 msg_print("The heat burns you!");
2074 take_hit(DAMAGE_NOESCAPE, damage, format("flying over %s", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
2079 cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name;
2081 msg_format("%s¤Ç²Ð½ý¤·¤¿¡ª", name);
2083 msg_format("The %s burns you!", name);
2085 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
2088 cave_no_regen = TRUE;
2092 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
2093 !p_ptr->levitation && !p_ptr->can_swim)
2095 if (p_ptr->total_weight > weight_limit())
2099 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2100 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2102 msg_print("You are drowning!");
2103 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2106 cave_no_regen = TRUE;
2113 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2115 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2116 if (prace_is_(RACE_ENT)) damage += damage / 3;
2117 if (p_ptr->resist_fire) damage = damage / 3;
2118 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2120 msg_print("Ç®¤¤¡ª");
2121 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2123 msg_print("It's hot!");
2124 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2127 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2129 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2130 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2131 if (p_ptr->resist_elec) damage = damage / 3;
2132 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2134 msg_print("Äˤ¤¡ª");
2135 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2137 msg_print("It hurts!");
2138 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2141 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2143 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2144 if (p_ptr->resist_cold) damage = damage / 3;
2145 if (IS_OPPOSE_COLD()) damage = damage / 3;
2147 msg_print("Î䤿¤¤¡ª");
2148 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2150 msg_print("It's cold!");
2151 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2156 /* Spectres -- take damage when moving through walls */
2158 * Added: ANYBODY takes damage if inside through walls
2159 * without wraith form -- NOTE: Spectres will never be
2160 * reduced below 0 hp by being inside a stone wall; others
2163 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
2165 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2166 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2170 cave_no_regen = TRUE;
2172 if (p_ptr->pass_wall)
2175 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2178 msg_print("Your molecules feel disrupted!");
2179 dam_desc = "density";
2185 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2186 dam_desc = "¹Å¤¤´ä";
2188 msg_print("You are being crushed!");
2189 dam_desc = "solid rock";
2193 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2198 /*** handle regeneration ***/
2201 if (p_ptr->food < PY_FOOD_WEAK)
2203 /* Lower regeneration */
2204 if (p_ptr->food < PY_FOOD_STARVE)
2208 else if (p_ptr->food < PY_FOOD_FAINT)
2210 regen_amount = PY_REGEN_FAINT;
2214 regen_amount = PY_REGEN_WEAK;
2218 /* Are we walking the pattern? */
2219 if (pattern_effect())
2221 cave_no_regen = TRUE;
2225 /* Regeneration ability */
2226 if (p_ptr->regenerate)
2228 regen_amount = regen_amount * 2;
2230 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2234 if (p_ptr->cursed & TRC_SLOW_REGEN)
2241 /* Searching or Resting */
2242 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2244 regen_amount = regen_amount * 2;
2247 upkeep_factor = calculate_upkeep();
2249 /* No regeneration while special action */
2250 if ((p_ptr->action == ACTION_LEARN) ||
2251 (p_ptr->action == ACTION_HAYAGAKE) ||
2252 (p_ptr->special_defense & KATA_KOUKIJIN))
2254 upkeep_factor += 100;
2257 /* Regenerate the mana */
2258 upkeep_regen = (100 - upkeep_factor) * regen_amount;
2259 regenmana(upkeep_regen);
2262 /* Recharge magic eater's power */
2263 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2265 regenmagic(regen_amount);
2268 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2270 while (upkeep_factor > 100)
2273 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2275 msg_print("Too many pets to control at once!");
2278 do_cmd_pet_dismiss();
2280 upkeep_factor = calculate_upkeep();
2283 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2285 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2291 /* Poisoned or cut yields no healing */
2292 if (p_ptr->poisoned) regen_amount = 0;
2293 if (p_ptr->cut) regen_amount = 0;
2295 /* Special floor -- Pattern, in a wall -- yields no healing */
2296 if (cave_no_regen) regen_amount = 0;
2298 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2300 /* Regenerate Hit Points if needed */
2301 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2303 regenhp(regen_amount);
2309 * Handle timeout every 10 game turns
2311 static void process_world_aux_timeout(void)
2313 const int dec_count = (easy_band ? 2 : 1);
2315 /*** Timeout Various Things ***/
2318 if (p_ptr->tim_mimic)
2320 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2323 /* Hack -- Hallucinating */
2326 (void)set_image(p_ptr->image - dec_count);
2332 (void)set_blind(p_ptr->blind - dec_count);
2335 /* Times see-invisible */
2336 if (p_ptr->tim_invis)
2338 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2349 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2352 /* Timed temporary elemental brands. -LM- */
2353 if (p_ptr->ele_attack)
2355 p_ptr->ele_attack--;
2357 /* Clear all temporary elemental brands. */
2358 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2361 /* Timed temporary elemental immune. -LM- */
2362 if (p_ptr->ele_immune)
2364 p_ptr->ele_immune--;
2366 /* Clear all temporary elemental brands. */
2367 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2370 /* Timed infra-vision */
2371 if (p_ptr->tim_infra)
2373 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2377 if (p_ptr->tim_stealth)
2379 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2382 /* Timed levitation */
2383 if (p_ptr->tim_levitation)
2385 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
2388 /* Timed sh_touki */
2389 if (p_ptr->tim_sh_touki)
2391 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2395 if (p_ptr->tim_sh_fire)
2397 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2401 if (p_ptr->tim_sh_holy)
2403 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2407 if (p_ptr->tim_eyeeye)
2409 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2412 /* Timed resist-magic */
2413 if (p_ptr->resist_magic)
2415 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2418 /* Timed regeneration */
2419 if (p_ptr->tim_regen)
2421 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2424 /* Timed resist nether */
2425 if (p_ptr->tim_res_nether)
2427 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2430 /* Timed resist time */
2431 if (p_ptr->tim_res_time)
2433 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2437 if (p_ptr->tim_reflect)
2439 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2443 if (p_ptr->multishadow)
2445 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2448 /* Timed Robe of dust */
2449 if (p_ptr->dustrobe)
2451 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2454 /* Timed infra-vision */
2455 if (p_ptr->kabenuke)
2457 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2461 if (p_ptr->paralyzed)
2463 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2467 if (p_ptr->confused)
2469 (void)set_confused(p_ptr->confused - dec_count);
2475 (void)set_afraid(p_ptr->afraid - dec_count);
2481 (void)set_fast(p_ptr->fast - 1, TRUE);
2487 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2490 /* Protection from evil */
2491 if (p_ptr->protevil)
2493 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2496 /* Invulnerability */
2499 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2503 if (p_ptr->wraith_form)
2505 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2511 (void)set_hero(p_ptr->hero - 1, TRUE);
2517 (void)set_shero(p_ptr->shero - 1, TRUE);
2523 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2529 (void)set_shield(p_ptr->shield - 1, TRUE);
2533 if (p_ptr->tsubureru)
2535 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2539 if (p_ptr->magicdef)
2541 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2545 if (p_ptr->tsuyoshi)
2547 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2551 if (p_ptr->oppose_acid)
2553 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2556 /* Oppose Lightning */
2557 if (p_ptr->oppose_elec)
2559 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2563 if (p_ptr->oppose_fire)
2565 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2569 if (p_ptr->oppose_cold)
2571 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2575 if (p_ptr->oppose_pois)
2577 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2582 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2585 /*** Poison and Stun and Cut ***/
2588 if (p_ptr->poisoned)
2590 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2592 /* Apply some healing */
2593 (void)set_poisoned(p_ptr->poisoned - adjust);
2599 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2601 /* Apply some healing */
2602 (void)set_stun(p_ptr->stun - adjust);
2608 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2610 /* Hack -- Truly "mortal" wound */
2611 if (p_ptr->cut > 1000) adjust = 0;
2613 /* Apply some healing */
2614 (void)set_cut(p_ptr->cut - adjust);
2620 * Handle burning fuel every 10 game turns
2622 static void process_world_aux_light(void)
2624 /* Check for light being wielded */
2625 object_type *o_ptr = &inventory[INVEN_LITE];
2627 /* Burn some fuel in the current lite */
2628 if (o_ptr->tval == TV_LITE)
2630 /* Hack -- Use some fuel (except on artifacts) */
2631 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2633 /* Decrease life-span */
2634 if (o_ptr->name2 == EGO_LITE_LONG)
2636 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2638 else o_ptr->xtra4--;
2640 /* Notice interesting fuel steps */
2641 notice_lite_change(o_ptr);
2648 * Handle mutation effects once every 10 game turns
2650 static void process_world_aux_mutation(void)
2652 /* No mutation with effects */
2653 if (!p_ptr->muta2) return;
2655 /* No effect on monster arena */
2656 if (p_ptr->inside_battle) return;
2658 /* No effect on the global map */
2659 if (p_ptr->wild_mode) return;
2662 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2666 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
2667 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
2669 msg_print("RAAAAGHH!");
2670 msg_print("You feel a fit of rage coming over you!");
2673 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2676 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2678 if (!p_ptr->resist_fear)
2682 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
2684 msg_print("It's so dark... so scary!");
2687 set_afraid(p_ptr->afraid + 13 + randint1(26));
2691 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2693 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2698 /* Teleport player */
2700 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
2702 msg_print("Your position suddenly seems very uncertain...");
2706 teleport_player(40, TRUE);
2710 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2712 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2715 p_ptr->redraw |= PR_EXTRA;
2717 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
2719 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2724 if (!p_ptr->resist_conf)
2726 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2729 if (!p_ptr->resist_chaos)
2734 if (one_in_(3)) lose_all_info();
2736 teleport_player(100, TRUE);
2739 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
2740 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
2742 msg_print("You wake up somewhere with a sore head...");
2743 msg_print("You can't remember a thing, or how you got here!");
2752 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
2754 msg_print("Thishcischs GooDSChtuff!");
2757 (void)set_image(p_ptr->image + randint0(150) + 150);
2763 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2765 if (!p_ptr->resist_chaos)
2768 p_ptr->redraw |= PR_EXTRA;
2769 (void)set_image(p_ptr->image + randint0(50) + 20);
2773 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2778 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
2780 msg_print("BRRAAAP! Oops.");
2784 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2787 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2788 !p_ptr->anti_magic && one_in_(9000))
2793 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
2795 msg_print("Magical energy flows through you! You must release it!");
2800 (void)get_hack_dir(&dire);
2801 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2804 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2805 !p_ptr->anti_magic && (randint1(6666) == 666))
2807 bool pet = one_in_(6);
2808 u32b mode = PM_ALLOW_GROUP;
2810 if (pet) mode |= PM_FORCE_PET;
2811 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2813 if (summon_specific((pet ? -1 : 0), py, px,
2814 dun_level, SUMMON_DEMON, mode))
2817 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2819 msg_print("You have attracted a demon!");
2826 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2832 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2834 msg_print("You feel less energetic.");
2837 if (p_ptr->fast > 0)
2843 set_slow(randint1(30) + 10, FALSE);
2849 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2851 msg_print("You feel more energetic.");
2854 if (p_ptr->slow > 0)
2860 set_fast(randint1(30) + 10, FALSE);
2865 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2869 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
2871 msg_print("You suddenly feel almost lonely.");
2874 banish_monsters(100);
2875 if (!dun_level && p_ptr->town_num)
2879 /* Pick a random shop (except home) */
2882 n = randint0(MAX_STORES);
2884 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2887 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
2889 msg_print("You see one of the shopkeepers running for the hills!");
2897 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2902 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
2904 msg_print("A shadow passes over you.");
2909 /* Absorb light from the current possition */
2910 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2915 o_ptr = &inventory[INVEN_LITE];
2917 /* Absorb some fuel in the current lite */
2918 if (o_ptr->tval == TV_LITE)
2920 /* Use some fuel (except on artifacts) */
2921 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2923 /* Heal the player a bit */
2924 hp_player(o_ptr->xtra4 / 20);
2926 /* Decrease life-span of lite */
2930 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
2932 msg_print("You absorb energy from your light!");
2936 /* Notice interesting fuel steps */
2937 notice_lite_change(o_ptr);
2942 * Unlite the area (radius 10) around player and
2943 * do 50 points damage to every affected monster
2945 unlite_area(50, 10);
2948 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
2949 !p_ptr->anti_magic && one_in_(7000))
2951 bool pet = one_in_(3);
2952 u32b mode = PM_ALLOW_GROUP;
2954 if (pet) mode |= PM_FORCE_PET;
2955 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2957 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
2960 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
2962 msg_print("You have attracted an animal!");
2969 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
2970 !p_ptr->anti_magic && one_in_(8000))
2974 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
2976 msg_print("You feel the world warping around you!");
2980 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2982 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2984 if (!lose_mutation(0))
2986 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
2988 msg_print("You feel oddly normal.");
2992 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2996 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
2998 msg_print("You feel insubstantial!");
3002 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3004 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3008 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3010 int which_stat = randint0(6);
3011 int sustained = FALSE;
3016 if (p_ptr->sustain_str) sustained = TRUE;
3019 if (p_ptr->sustain_int) sustained = TRUE;
3022 if (p_ptr->sustain_wis) sustained = TRUE;
3025 if (p_ptr->sustain_dex) sustained = TRUE;
3028 if (p_ptr->sustain_con) sustained = TRUE;
3031 if (p_ptr->sustain_chr) sustained = TRUE;
3035 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3037 msg_print("Invalid stat chosen!");
3047 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3049 msg_print("You can feel yourself wasting away!");
3053 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3056 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3057 !p_ptr->anti_magic && one_in_(3000))
3059 bool pet = one_in_(5);
3060 u32b mode = PM_ALLOW_GROUP;
3062 if (pet) mode |= PM_FORCE_PET;
3063 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3065 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3068 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3070 msg_print("You have attracted a dragon!");
3076 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3079 if (p_ptr->tim_esp > 0)
3082 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3084 msg_print("Your mind feels cloudy!");
3087 set_tim_esp(0, TRUE);
3092 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3094 msg_print("Your mind expands!");
3097 set_tim_esp(p_ptr->lev, FALSE);
3100 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3105 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3107 msg_print("Your stomach roils, and you lose your lunch!");
3111 set_food(PY_FOOD_WEAK);
3114 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3115 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3120 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3122 int danger_amount = 0;
3125 for (monster = 0; monster < m_max; monster++)
3127 monster_type *m_ptr = &m_list[monster];
3128 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3130 /* Paranoia -- Skip dead monsters */
3131 if (!m_ptr->r_idx) continue;
3133 if (r_ptr->level >= p_ptr->lev)
3135 danger_amount += r_ptr->level - p_ptr->lev + 1;
3139 if (danger_amount > 100)
3141 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3143 msg_print("You feel utterly terrified!");
3146 else if (danger_amount > 50)
3148 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3150 msg_print("You feel terrified!");
3153 else if (danger_amount > 20)
3155 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3157 msg_print("You feel very worried!");
3160 else if (danger_amount > 10)
3162 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3164 msg_print("You feel paranoid!");
3167 else if (danger_amount > 5)
3169 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3171 msg_print("You feel almost safe.");
3176 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3178 msg_print("You feel lonely.");
3182 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3187 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3189 msg_print("You feel invincible!");
3193 (void)set_invuln(randint1(8) + 8, FALSE);
3195 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3197 int wounds = p_ptr->mhp - p_ptr->chp;
3201 int healing = p_ptr->csp;
3203 if (healing > wounds)
3209 p_ptr->csp -= healing;
3212 p_ptr->redraw |= (PR_MANA);
3215 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3218 int wounds = p_ptr->msp - p_ptr->csp;
3222 int healing = p_ptr->chp;
3224 if (healing > wounds)
3229 p_ptr->csp += healing;
3232 p_ptr->redraw |= (PR_MANA);
3234 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3236 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3241 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3244 object_type *o_ptr = NULL;
3248 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3249 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3251 msg_print("You trip over your own feet!");
3252 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3256 if (buki_motteruka(INVEN_RARM))
3259 o_ptr = &inventory[INVEN_RARM];
3261 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3263 o_ptr = &inventory[INVEN_LARM];
3267 else if (buki_motteruka(INVEN_LARM))
3269 o_ptr = &inventory[INVEN_LARM];
3273 if (slot && !object_is_cursed(o_ptr))
3276 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3278 msg_print("You drop your weapon!");
3280 inven_drop(slot, 1);
3287 * Handle curse effects once every 10 game turns
3289 static void process_world_aux_curse(void)
3291 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3294 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3295 * can actually be useful!
3297 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3299 char o_name[MAX_NLEN];
3303 /* Scan the equipment with random teleport ability */
3304 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3306 u32b flgs[TR_FLAG_SIZE];
3307 o_ptr = &inventory[i];
3309 /* Skip non-objects */
3310 if (!o_ptr->k_idx) continue;
3312 /* Extract the item flags */
3313 object_flags(o_ptr, flgs);
3315 if (have_flag(flgs, TR_TELEPORT)) break;
3318 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3321 msg_format("%s¤¬¥Æ¥ì¥Ý¡¼¥È¤ÎǽÎϤòȯư¤µ¤»¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", o_name);
3323 msg_format("Your %s is activating teleportation.", o_name);
3327 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3329 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3333 teleport_player(50, FALSE);
3338 msg_format("%s¤Ë{.}(¥Ô¥ê¥ª¥É)¤ÈÌäò¹ï¤à¤Èȯư¤òÍÞÀ©¤Ç¤¤Þ¤¹¡£", o_name);
3340 msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
3345 /* Make a chainsword noise */
3346 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3350 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3352 if (!get_rnd_line("chainswd.txt", 0, noise))
3355 disturb(FALSE, FALSE);
3358 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3361 (void)activate_ty_curse(FALSE, &count);
3363 /* Handle experience draining */
3364 if (p_ptr->prace != RACE_ANDROID &&
3365 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3367 p_ptr->exp -= (p_ptr->lev+1)/2;
3368 if (p_ptr->exp < 0) p_ptr->exp = 0;
3369 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3370 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3373 /* Add light curse (Later) */
3374 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3379 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3381 new_curse = get_curse(0, o_ptr);
3382 if (!(o_ptr->curse_flags & new_curse))
3384 char o_name[MAX_NLEN];
3386 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3388 o_ptr->curse_flags |= new_curse;
3390 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3392 msg_format("There is a malignant black aura surrounding your %s...", o_name);
3395 o_ptr->feeling = FEEL_NONE;
3397 p_ptr->update |= (PU_BONUS);
3400 /* Add heavy curse (Later) */
3401 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3406 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3408 new_curse = get_curse(1, o_ptr);
3409 if (!(o_ptr->curse_flags & new_curse))
3411 char o_name[MAX_NLEN];
3413 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3415 o_ptr->curse_flags |= new_curse;
3417 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3419 msg_format("There is a malignant black aura surrounding your %s...", o_name);
3422 o_ptr->feeling = FEEL_NONE;
3424 p_ptr->update |= (PU_BONUS);
3428 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3430 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3431 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3433 char o_name[MAX_NLEN];
3435 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3437 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3439 msg_format("Your %s have attracted an animal!", o_name);
3446 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3448 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3450 char o_name[MAX_NLEN];
3452 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3454 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3456 msg_format("Your %s have attracted a demon!", o_name);
3463 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3465 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3466 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3468 char o_name[MAX_NLEN];
3470 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3472 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3474 msg_format("Your %s have attracted an animal!", o_name);
3480 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3482 if (!p_ptr->resist_fear)
3486 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3488 msg_print("It's so dark... so scary!");
3491 set_afraid(p_ptr->afraid + 13 + randint1(26));
3494 /* Teleport player */
3495 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3499 /* Teleport player */
3500 teleport_player(40, TRUE);
3502 /* Handle HP draining */
3503 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3505 char o_name[MAX_NLEN];
3507 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3509 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3511 msg_format("Your %s drains HP from you!", o_name);
3513 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3515 /* Handle mana draining */
3516 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3518 char o_name[MAX_NLEN];
3520 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3522 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3524 msg_format("Your %s drains mana from you!", o_name);
3526 p_ptr->csp -= MIN(p_ptr->lev, 50);
3530 p_ptr->csp_frac = 0;
3532 p_ptr->redraw |= PR_MANA;
3536 /* Rarely, take damage from the Jewel of Judgement */
3537 if (one_in_(999) && !p_ptr->anti_magic)
3539 object_type *o_ptr = &inventory[INVEN_LITE];
3541 if (o_ptr->name1 == ART_JUDGE)
3544 if (object_is_known(o_ptr))
3545 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3547 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3548 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3550 if (object_is_known(o_ptr))
3551 msg_print("The Jewel of Judgement drains life from you!");
3553 msg_print("Something drains life from you!");
3554 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3562 * Handle recharging objects once every 10 game turns
3564 static void process_world_aux_recharge(void)
3569 /* Process equipment */
3570 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3572 /* Get the object */
3573 object_type *o_ptr = &inventory[i];
3575 /* Skip non-objects */
3576 if (!o_ptr->k_idx) continue;
3578 /* Recharge activatable objects */
3579 if (o_ptr->timeout > 0)
3584 /* Notice changes */
3585 if (!o_ptr->timeout)
3587 recharged_notice(o_ptr);
3593 /* Notice changes */
3597 p_ptr->window |= (PW_EQUIP);
3602 * Recharge rods. Rods now use timeout to control charging status,
3603 * and each charging rod in a stack decreases the stack's timeout by
3604 * one per turn. -LM-
3606 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
3608 object_type *o_ptr = &inventory[i];
3609 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3611 /* Skip non-objects */
3612 if (!o_ptr->k_idx) continue;
3614 /* Examine all charging rods or stacks of charging rods. */
3615 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3617 /* Determine how many rods are charging. */
3618 int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3619 if (temp > o_ptr->number) temp = o_ptr->number;
3621 /* Decrease timeout by that number. */
3622 o_ptr->timeout -= temp;
3624 /* Boundary control. */
3625 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3627 /* Notice changes, provide message if object is inscribed. */
3628 if (!(o_ptr->timeout))
3630 recharged_notice(o_ptr);
3634 /* One of the stack of rod is charged */
3635 else if (o_ptr->timeout % k_ptr->pval)
3642 /* Notice changes */
3646 p_ptr->window |= (PW_INVEN);
3650 /* Process objects on floor */
3651 for (i = 1; i < o_max; i++)
3654 object_type *o_ptr = &o_list[i];
3656 /* Skip dead objects */
3657 if (!o_ptr->k_idx) continue;
3659 /* Recharge rods on the ground. No messages. */
3660 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3663 o_ptr->timeout -= o_ptr->number;
3665 /* Boundary control. */
3666 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3673 * Handle involuntary movement once every 10 game turns
3675 static void process_world_aux_movement(void)
3677 /* Delayed Word-of-Recall */
3678 if (p_ptr->word_recall)
3681 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3682 * The player is yanked up/down as soon as
3683 * he loads the autosaved game.
3685 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3686 do_cmd_save_game(TRUE);
3688 /* Count down towards recall */
3689 p_ptr->word_recall--;
3691 p_ptr->redraw |= (PR_STATUS);
3693 /* Activate the recall */
3694 if (!p_ptr->word_recall)
3699 /* Determine the level */
3700 if (dun_level || p_ptr->inside_quest)
3703 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3705 msg_print("You feel yourself yanked upwards!");
3708 p_ptr->recall_dungeon = dungeon_type;
3710 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3715 leave_quest_check();
3717 p_ptr->inside_quest = 0;
3719 p_ptr->leaving = TRUE;
3724 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3726 msg_print("You feel yourself yanked downwards!");
3729 dungeon_type = p_ptr->recall_dungeon;
3732 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3735 dun_level = max_dlv[dungeon_type];
3736 if (dun_level < 1) dun_level = 1;
3738 /* Nightmare mode makes recall more dangerous */
3739 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3745 else if (dun_level < 99)
3747 dun_level = (dun_level + 99) / 2;
3749 else if (dun_level > 100)
3751 dun_level = d_info[dungeon_type].maxdepth - 1;
3755 if (p_ptr->wild_mode)
3757 p_ptr->wilderness_y = py;
3758 p_ptr->wilderness_x = px;
3762 /* Save player position */
3766 p_ptr->wild_mode = FALSE;
3769 * Clear all saved floors
3770 * and create a first saved floor
3772 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3775 p_ptr->leaving = TRUE;
3777 if (dungeon_type == DUNGEON_ANGBAND)
3781 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3783 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
3784 (quest[i].status == QUEST_STATUS_TAKEN) &&
3785 (quest[i].level < dun_level))
3787 quest[i].status = QUEST_STATUS_FAILED;
3788 quest[i].complev = (byte)p_ptr->lev;
3789 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
3796 sound(SOUND_TPLEVEL);
3801 /* Delayed Alter reality */
3802 if (p_ptr->alter_reality)
3804 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3805 do_cmd_save_game(TRUE);
3807 /* Count down towards alter */
3808 p_ptr->alter_reality--;
3810 p_ptr->redraw |= (PR_STATUS);
3812 /* Activate the alter reality */
3813 if (!p_ptr->alter_reality)
3818 /* Determine the level */
3819 if (!quest_number(dun_level) && dun_level)
3822 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
3824 msg_print("The world changes!");
3828 p_ptr->leaving = TRUE;
3833 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
3835 msg_print("The world seems to change for a moment!");
3840 sound(SOUND_TPLEVEL);
3847 * Count number of adjacent monsters
3849 static int get_monster_crowd_number(int m_idx)
3851 monster_type *m_ptr = &m_list[m_idx];
3857 for (i = 0; i < 7; i++)
3859 int ay = my + ddy_ddd[i];
3860 int ax = mx + ddx_ddd[i];
3862 if (!in_bounds(ay, ax)) continue;
3864 /* Count number of monsters */
3865 if (cave[ay][ax].m_idx > 0) count++;
3874 * Dungeon rating is no longer linear
3876 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3879 * Examine all monsters and unidentified objects,
3880 * and get the feeling of current dungeon floor
3882 static byte get_dungeon_feeling(void)
3884 const int base = 10;
3888 /* Hack -- no feeling in the town */
3889 if (!dun_level) return 0;
3891 /* Examine each monster */
3892 for (i = 1; i < m_max; i++)
3894 monster_type *m_ptr = &m_list[i];
3895 monster_race *r_ptr;
3898 /* Skip dead monsters */
3899 if (!m_ptr->r_idx) continue;
3902 if (is_pet(m_ptr)) continue;
3904 r_ptr = &r_info[m_ptr->r_idx];
3906 /* Unique monsters */
3907 if (r_ptr->flags1 & (RF1_UNIQUE))
3909 /* Nearly out-of-depth unique monsters */
3910 if (r_ptr->level + 10 > dun_level)
3912 /* Boost rating by twice delta-depth */
3913 delta += (r_ptr->level + 10 - dun_level) * 2 * base;
3918 /* Out-of-depth monsters */
3919 if (r_ptr->level > dun_level)
3921 /* Boost rating by delta-depth */
3922 delta += (r_ptr->level - dun_level) * base;
3926 /* Unusually crowded monsters get a little bit of rating boost */
3927 if (r_ptr->flags1 & RF1_FRIENDS)
3929 if (5 <= get_monster_crowd_number(i)) delta += 1;
3933 if (2 <= get_monster_crowd_number(i)) delta += 1;
3937 rating += RATING_BOOST(delta);
3940 /* Examine each unidentified object */
3941 for (i = 1; i < o_max; i++)
3943 object_type *o_ptr = &o_list[i];
3944 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3947 /* Skip dead objects */
3948 if (!o_ptr->k_idx) continue;
3950 /* Skip known objects */
3951 if (object_is_known(o_ptr)) continue;
3953 /* Skip pseudo-known objects */
3954 if (o_ptr->ident & IDENT_SENSE) continue;
3957 if (object_is_ego(o_ptr))
3959 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3961 delta += e_ptr->rating * base;
3965 if (object_is_artifact(o_ptr))
3967 s32b cost = object_value_real(o_ptr);
3970 if (cost > 10000L) delta += 10 * base;
3971 if (cost > 50000L) delta += 10 * base;
3972 if (cost > 100000L) delta += 10 * base;
3974 /* Special feeling */
3975 if (!preserve_mode) return 1;
3978 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3979 if (o_ptr->tval == TV_SHIELD &&
3980 o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3981 if (o_ptr->tval == TV_GLOVES &&
3982 o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3983 if (o_ptr->tval == TV_BOOTS &&
3984 o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3985 if (o_ptr->tval == TV_HELM &&
3986 o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3987 if (o_ptr->tval == TV_RING &&
3988 o_ptr->sval == SV_RING_SPEED &&
3989 !object_is_cursed(o_ptr)) delta += 25 * base;
3990 if (o_ptr->tval == TV_RING &&
3991 o_ptr->sval == SV_RING_LORDLY &&
3992 !object_is_cursed(o_ptr)) delta += 15 * base;
3993 if (o_ptr->tval == TV_AMULET &&
3994 o_ptr->sval == SV_AMULET_THE_MAGI &&
3995 !object_is_cursed(o_ptr)) delta += 15 * base;
3997 /* Out-of-depth objects */
3998 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
3999 k_ptr->level > dun_level)
4001 /* Rating increase */
4002 delta += (k_ptr->level - dun_level) * base;
4005 rating += RATING_BOOST(delta);
4009 if (rating > RATING_BOOST(1000)) return 2;
4010 if (rating > RATING_BOOST(800)) return 3;
4011 if (rating > RATING_BOOST(600)) return 4;
4012 if (rating > RATING_BOOST(400)) return 5;
4013 if (rating > RATING_BOOST(300)) return 6;
4014 if (rating > RATING_BOOST(200)) return 7;
4015 if (rating > RATING_BOOST(100)) return 8;
4016 if (rating > RATING_BOOST(0)) return 9;
4023 * Update dungeon feeling, and announce it if changed
4025 static void update_dungeon_feeling(void)
4031 /* No feeling on the surface */
4032 if (!dun_level) return;
4034 /* No feeling in the arena */
4035 if (p_ptr->inside_battle) return;
4037 /* Extract delay time */
4038 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
4040 /* Not yet felt anything */
4041 if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
4043 /* Extract quest number (if any) */
4044 quest_num = quest_number(dun_level);
4046 /* No feeling in a quest */
4048 (is_fixed_quest_idx(quest_num) &&
4049 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
4050 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
4053 /* Get new dungeon feeling */
4054 new_feeling = get_dungeon_feeling();
4056 /* Remember last time updated */
4057 p_ptr->feeling_turn = turn;
4060 if (p_ptr->feeling == new_feeling) return;
4062 /* Dungeon feeling is changed */
4063 p_ptr->feeling = new_feeling;
4065 /* Announce feeling */
4068 /* Update the level indicator */
4069 p_ptr->redraw |= (PR_DEPTH);
4072 if (disturb_minor) disturb(0, 0);
4077 * Handle certain things once every 10 game turns
4079 static void process_world(void)
4083 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
4084 s32b prev_turn_in_today = ((turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
4085 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
4087 extract_day_hour_min(&day, &hour, &min);
4089 /* Update dungeon feeling, and announce it if changed */
4090 update_dungeon_feeling();
4092 /*** Check monster arena ***/
4093 if (p_ptr->inside_battle && !p_ptr->leaving)
4099 /* Count all hostile monsters */
4100 for (i2 = 0; i2 < cur_wid; ++i2)
4101 for (j2 = 0; j2 < cur_hgt; j2++)
4103 cave_type *c_ptr = &cave[j2][i2];
4105 if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
4108 win_m_idx = c_ptr->m_idx;
4112 if (number_mon == 0)
4115 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
4117 msg_print("They have kill each other at the same time.");
4120 p_ptr->energy_need = 0;
4123 else if ((number_mon-1) == 0)
4126 monster_type *wm_ptr;
4128 wm_ptr = &m_list[win_m_idx];
4130 monster_desc(m_name, wm_ptr, 0);
4132 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
4134 msg_format("%s is winner!", m_name);
4138 if (win_m_idx == (sel_monster+1))
4141 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
4143 msg_print("Congratulations.");
4146 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
4148 msg_format("You received %d gold.", battle_odds);
4150 p_ptr->au += battle_odds;
4155 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
4157 msg_print("You lost gold.");
4161 p_ptr->energy_need = 0;
4164 else if (turn - old_turn == 150*TURNS_PER_TICK)
4167 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
4169 msg_format("This battle have ended in a draw.");
4171 p_ptr->au += kakekin;
4173 p_ptr->energy_need = 0;
4178 /* Every 10 game turns */
4179 if (turn % TURNS_PER_TICK) return;
4181 /*** Check the Time and Load ***/
4183 if (!(turn % (50*TURNS_PER_TICK)))
4185 /* Check time and load */
4186 if ((0 != check_time()) || (0 != check_load()))
4189 if (closing_flag <= 2)
4194 /* Count warnings */
4199 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
4200 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
4202 msg_print("The gates to ANGBAND are closing...");
4203 msg_print("Please finish up and/or save your game.");
4213 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
4215 msg_print("The gates to ANGBAND are now closed.");
4220 p_ptr->playing = FALSE;
4223 p_ptr->leaving = TRUE;
4228 /*** Attempt timed autosave ***/
4229 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
4231 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
4232 do_cmd_save_game(TRUE);
4235 if (mon_fight && !ignore_unview)
4238 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
4240 msg_print("You hear noise.");
4244 /*** Handle the wilderness/town (sunshine) ***/
4246 /* While in town/wilderness */
4247 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
4249 /* Hack -- Daybreak/Nighfall in town */
4250 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
4254 /* Check for dawn */
4255 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
4264 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
4266 msg_print("The sun has risen.");
4269 if (!p_ptr->wild_mode)
4271 /* Hack -- Scan the town */
4272 for (y = 0; y < cur_hgt; y++)
4274 for (x = 0; x < cur_wid; x++)
4276 /* Get the cave grid */
4277 cave_type *c_ptr = &cave[y][x];
4280 c_ptr->info |= (CAVE_GLOW);
4282 /* Hack -- Memorize lit grids if allowed */
4283 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
4285 /* Hack -- Notice spot */
4299 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
4301 msg_print("The sun has fallen.");
4304 if (!p_ptr->wild_mode)
4306 /* Hack -- Scan the town */
4307 for (y = 0; y < cur_hgt; y++)
4309 for (x = 0; x < cur_wid; x++)
4311 /* Get the cave grid */
4312 cave_type *c_ptr = &cave[y][x];
4314 /* Feature code (applying "mimic" field) */
4315 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
4317 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
4318 !have_flag(f_ptr->flags, FF_ENTRANCE))
4321 c_ptr->info &= ~(CAVE_GLOW);
4323 if (!have_flag(f_ptr->flags, FF_REMEMBER))
4325 /* Forget the normal floor grid */
4326 c_ptr->info &= ~(CAVE_MARK);
4328 /* Hack -- Notice spot */
4334 /* Glow deep lava and building entrances */
4335 glow_deep_lava_and_bldg();
4340 /* Update the monsters */
4341 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
4344 p_ptr->redraw |= (PR_MAP);
4347 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4349 if (p_ptr->special_defense & NINJA_S_STEALTH)
4351 if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
4356 /* While in the dungeon (vanilla_town or lite_town mode only) */
4357 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
4359 /*** Shuffle the Storekeepers ***/
4361 /* Chance is only once a day (while in dungeon) */
4362 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
4364 /* Sometimes, shuffle the shop-keepers */
4365 if (one_in_(STORE_SHUFFLE))
4369 /* Pick a random shop (except home and museum) */
4372 n = randint0(MAX_STORES);
4374 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
4376 /* Check every feature */
4377 for (i = 1; i < max_f_idx; i++)
4379 /* Access the index */
4380 feature_type *f_ptr = &f_info[i];
4382 /* Skip empty index */
4383 if (!f_ptr->name) continue;
4385 /* Skip non-store features */
4386 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
4388 /* Verify store type */
4389 if (f_ptr->power == n)
4393 if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_ptr->name);
4395 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_ptr->name);
4409 /*** Process the monsters ***/
4411 /* Check for creature generation. */
4412 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
4413 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
4415 /* Make a new monster */
4416 (void)alloc_monster(MAX_SIGHT + 5, 0);
4419 /* Hack -- Check for creature regeneration */
4420 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
4421 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
4423 if (!p_ptr->leaving)
4425 /* Hack -- Process the counters of monsters if needed */
4426 if (mproc_max[MPROC_CSLEEP] > 1) process_monsters_csleep();
4427 if (mproc_max[MPROC_FAST] > 1) process_monsters_fast();
4428 if (mproc_max[MPROC_SLOW] > 1) process_monsters_slow();
4429 if (mproc_max[MPROC_STUNNED] > 1) process_monsters_stunned();
4430 if (mproc_max[MPROC_CONFUSED] > 1) process_monsters_confused();
4431 if (mproc_max[MPROC_MONFEAR] > 1) process_monsters_monfear();
4432 if (mproc_max[MPROC_INVULNER] > 1) process_monsters_invulner();
4439 if (min != prev_min)
4441 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
4442 determine_today_mon(FALSE);
4447 * Nightmare mode activates the TY_CURSE at midnight
4449 * Require exact minute -- Don't activate multiple times in a minute
4451 if (ironman_nightmare && (min != prev_min))
4453 /* Every 15 minutes after 11:00 pm */
4454 if ((hour == 23) && !(min % 15))
4463 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
4465 msg_print("You hear a distant bell toll ominously.");
4471 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
4473 msg_print("A distant bell sounds twice.");
4479 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
4481 msg_print("A distant bell sounds three times.");
4487 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
4489 msg_print("A distant bell tolls four times.");
4495 /* TY_CURSE activates at mignight! */
4502 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
4504 msg_print("A distant bell tolls many times, fading into an deathly silence.");
4507 activate_ty_curse(FALSE, &count);
4512 /*** Check the Food, and Regenerate ***/
4514 if (!p_ptr->inside_battle)
4516 /* Digest quickly when gorged */
4517 if (p_ptr->food >= PY_FOOD_MAX)
4519 /* Digest a lot of food */
4520 (void)set_food(p_ptr->food - 100);
4523 /* Digest normally -- Every 50 game turns */
4524 else if (!(turn % (TURNS_PER_TICK*5)))
4526 /* Basic digestion rate based on speed */
4527 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
4529 /* Regeneration takes more food */
4530 if (p_ptr->regenerate)
4532 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
4534 if (p_ptr->cursed & TRC_FAST_DIGEST)
4537 /* Slow digestion takes less food */
4538 if (p_ptr->slow_digest)
4541 /* Minimal digestion */
4542 if (digestion < 1) digestion = 1;
4543 /* Maximal digestion */
4544 if (digestion > 100) digestion = 100;
4546 /* Digest some food */
4547 (void)set_food(p_ptr->food - digestion);
4552 if ((p_ptr->food < PY_FOOD_FAINT))
4554 /* Faint occasionally */
4555 if (!p_ptr->paralyzed && (randint0(100) < 10))
4559 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
4561 msg_print("You faint from the lack of food.");
4566 /* Hack -- faint (bypass free action) */
4567 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
4570 /* Starve to death (slowly) */
4571 if (p_ptr->food < PY_FOOD_STARVE)
4573 /* Calculate damage */
4574 int dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
4578 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "¶õÊ¢", -1);
4580 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "starvation", -1);
4588 /* Process timed damage and regeneration */
4589 process_world_aux_hp_and_sp();
4591 /* Process timeout */
4592 process_world_aux_timeout();
4595 process_world_aux_light();
4597 /* Process mutation effects */
4598 process_world_aux_mutation();
4600 /* Process curse effects */
4601 process_world_aux_curse();
4603 /* Process recharging */
4604 process_world_aux_recharge();
4606 /* Feel the inventory */
4610 /* Involuntary Movement */
4611 process_world_aux_movement();
4617 * Verify use of "wizard" mode
4619 static bool enter_wizard_mode(void)
4621 /* Ask first time */
4622 if (!p_ptr->noscore)
4624 /* Wizard mode is not permitted */
4625 if (!allow_debug_opts || arg_wizard)
4628 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4630 msg_print("Wizard mode is not permitted.");
4635 /* Mention effects */
4637 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4638 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4640 msg_print("Wizard mode is for debugging and experimenting.");
4641 msg_print("The game will not be scored if you enter wizard mode.");
4646 /* Verify request */
4648 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4650 if (!get_check("Are you sure you want to enter wizard mode? "))
4657 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4659 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4662 p_ptr->noscore |= 0x0002;
4673 * Verify use of "debug" commands
4675 static bool enter_debug_mode(void)
4677 /* Ask first time */
4678 if (!p_ptr->noscore)
4680 /* Debug mode is not permitted */
4681 if (!allow_debug_opts)
4684 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4686 msg_print("Use of debug command is not permitted.");
4691 /* Mention effects */
4693 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4694 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4696 msg_print("The debug commands are for debugging and experimenting.");
4697 msg_print("The game will not be scored if you use debug commands.");
4702 /* Verify request */
4704 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4706 if (!get_check("Are you sure you want to use debug commands? "))
4713 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4715 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4718 p_ptr->noscore |= 0x0008;
4726 * Hack -- Declare the Debug Routines
4728 extern void do_cmd_debug(void);
4730 #endif /* ALLOW_WIZARD */
4736 * Verify use of "borg" commands
4738 static bool enter_borg_mode(void)
4740 /* Ask first time */
4741 if (!(p_ptr->noscore & 0x0010))
4743 /* Mention effects */
4745 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4746 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4748 msg_print("The borg commands are for debugging and experimenting.");
4749 msg_print("The game will not be scored if you use borg commands.");
4754 /* Verify request */
4756 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4758 if (!get_check("Are you sure you want to use borg commands? "))
4765 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4767 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4770 p_ptr->noscore |= 0x0010;
4778 * Hack -- Declare the Ben Borg
4780 extern void do_cmd_borg(void);
4782 #endif /* ALLOW_BORG */
4787 * Parse and execute the current command
4788 * Give "Warning" on illegal commands.
4790 * XXX XXX XXX Make some "blocks"
4792 static void process_command(void)
4794 int old_now_message = now_message;
4796 #ifdef ALLOW_REPEAT /* TNB */
4798 /* Handle repeating the last command */
4801 #endif /* ALLOW_REPEAT -- TNB */
4805 /* Parse the command */
4806 switch (command_cmd)
4822 /*** Wizard Commands ***/
4824 /* Toggle Wizard Mode */
4829 p_ptr->wizard = FALSE;
4831 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4833 msg_print("Wizard mode off.");
4837 else if (enter_wizard_mode())
4839 p_ptr->wizard = TRUE;
4841 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4843 msg_print("Wizard mode on.");
4848 /* Update monsters */
4849 p_ptr->update |= (PU_MONSTERS);
4851 /* Redraw "title" */
4852 p_ptr->redraw |= (PR_TITLE);
4860 /* Special "debug" commands */
4863 /* Enter debug mode */
4864 if (enter_debug_mode())
4871 #endif /* ALLOW_WIZARD */
4876 /* Special "borg" commands */
4879 /* Enter borg mode */
4880 if (enter_borg_mode())
4882 if (!p_ptr->wild_mode) do_cmd_borg();
4888 #endif /* ALLOW_BORG */
4892 /*** Inventory Commands ***/
4894 /* Wear/wield equipment */
4897 if (!p_ptr->wild_mode) do_cmd_wield();
4901 /* Take off equipment */
4904 if (!p_ptr->wild_mode) do_cmd_takeoff();
4911 if (!p_ptr->wild_mode) do_cmd_drop();
4915 /* Destroy an item */
4922 /* Equipment list */
4929 /* Inventory list */
4937 /*** Various commands ***/
4939 /* Identify an object */
4946 /* Hack -- toggle windows */
4949 toggle_inven_equip();
4954 /*** Standard "Movement" Commands ***/
4959 if (!p_ptr->wild_mode) do_cmd_alter();
4966 if (!p_ptr->wild_mode) do_cmd_tunnel();
4970 /* Move (usually pick up things) */
4973 #ifdef ALLOW_EASY_DISARM /* TNB */
4977 #else /* ALLOW_EASY_DISARM -- TNB */
4979 do_cmd_walk(always_pickup);
4981 #endif /* ALLOW_EASY_DISARM -- TNB */
4986 /* Move (usually do not pick up) */
4989 #ifdef ALLOW_EASY_DISARM /* TNB */
4993 #else /* ALLOW_EASY_DISARM -- TNB */
4995 do_cmd_walk(!always_pickup);
4997 #endif /* ALLOW_EASY_DISARM -- TNB */
5003 /*** Running, Resting, Searching, Staying */
5005 /* Begin Running -- Arg is Max Distance */
5008 if (!p_ptr->wild_mode) do_cmd_run();
5012 /* Stay still (usually pick things up) */
5015 do_cmd_stay(always_pickup);
5019 /* Stay still (usually do not pick up) */
5022 do_cmd_stay(!always_pickup);
5026 /* Rest -- Arg is time */
5033 /* Search for traps/doors */
5040 /* Toggle search mode */
5043 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
5044 else set_action(ACTION_SEARCH);
5049 /*** Stairs and Doors and Chests and Traps ***/
5052 case SPECIAL_KEY_STORE:
5054 if (!p_ptr->wild_mode) do_cmd_store();
5058 /* Enter building -KMW- */
5059 case SPECIAL_KEY_BUILDING:
5061 if (!p_ptr->wild_mode) do_cmd_bldg();
5065 /* Enter quest level -KMW- */
5066 case SPECIAL_KEY_QUEST:
5068 if (!p_ptr->wild_mode) do_cmd_quest();
5072 /* Go up staircase */
5075 if (!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
5077 if (vanilla_town) break;
5082 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
5084 msg_print("To flee the ambush you have to reach the edge of the map.");
5089 if (p_ptr->food < PY_FOOD_WEAK)
5092 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
5094 msg_print("You must eat something here.");
5106 /* Go down staircase */
5109 if (p_ptr->wild_mode)
5117 /* Open a door or chest */
5120 if (!p_ptr->wild_mode) do_cmd_open();
5127 if (!p_ptr->wild_mode) do_cmd_close();
5131 /* Jam a door with spikes */
5134 if (!p_ptr->wild_mode) do_cmd_spike();
5141 if (!p_ptr->wild_mode) do_cmd_bash();
5145 /* Disarm a trap or chest */
5148 if (!p_ptr->wild_mode) do_cmd_disarm();
5153 /*** Magic and Prayers ***/
5155 /* Gain new spells/prayers */
5158 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
5160 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
5162 msg_print("You don't have to learn spells!");
5164 else if (p_ptr->pclass == CLASS_SAMURAI)
5165 do_cmd_gain_hissatsu();
5166 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
5176 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
5177 (p_ptr->pclass == CLASS_BERSERKER) ||
5178 (p_ptr->pclass == CLASS_NINJA) ||
5179 (p_ptr->pclass == CLASS_MIRROR_MASTER)
5180 ) do_cmd_mind_browse();
5181 else if (p_ptr->pclass == CLASS_SMITH)
5183 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
5184 do_cmd_magic_eater(TRUE);
5185 else do_cmd_browse();
5193 if (!p_ptr->wild_mode)
5195 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
5198 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
5200 msg_print("You cannot cast spells!");
5203 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
5206 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5208 msg_print("The dungeon absorbs all attempted magic!");
5212 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
5216 cptr which_power = "ËâË¡";
5218 cptr which_power = "magic";
5220 if (p_ptr->pclass == CLASS_MINDCRAFTER)
5222 which_power = "ĶǽÎÏ";
5224 which_power = "psionic powers";
5226 else if (p_ptr->pclass == CLASS_IMITATOR)
5228 which_power = "¤â¤Î¤Þ¤Í";
5230 which_power = "imitation";
5232 else if (p_ptr->pclass == CLASS_SAMURAI)
5234 which_power = "ɬ»¦·õ";
5236 which_power = "hissatsu";
5238 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
5240 which_power = "¶ÀËâË¡";
5242 which_power = "mirror magic";
5244 else if (p_ptr->pclass == CLASS_NINJA)
5246 which_power = "Ǧ½Ñ";
5248 which_power = "ninjutsu";
5250 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
5252 which_power = "µ§¤ê";
5254 which_power = "prayer";
5258 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
5260 msg_format("An anti-magic shell disrupts your %s!", which_power);
5264 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
5267 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
5269 msg_format("You cannot think directly!");
5275 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
5276 (p_ptr->pclass == CLASS_BERSERKER) ||
5277 (p_ptr->pclass == CLASS_NINJA) ||
5278 (p_ptr->pclass == CLASS_MIRROR_MASTER)
5281 else if (p_ptr->pclass == CLASS_IMITATOR)
5283 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
5284 do_cmd_magic_eater(FALSE);
5285 else if (p_ptr->pclass == CLASS_SAMURAI)
5287 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
5288 do_cmd_cast_learned();
5289 else if (p_ptr->pclass == CLASS_SMITH)
5298 /* Issue a pet command */
5301 if (!p_ptr->wild_mode) do_cmd_pet();
5305 /*** Use various objects ***/
5307 /* Inscribe an object */
5314 /* Uninscribe an object */
5317 do_cmd_uninscribe();
5321 /* Activate an artifact */
5324 if (!p_ptr->wild_mode)
5326 if (!p_ptr->inside_arena)
5331 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5333 msg_print("The arena absorbs all attempted magic!");
5349 /* Fuel your lantern/torch */
5359 if (!p_ptr->wild_mode) do_cmd_fire();
5366 if (!p_ptr->wild_mode)
5376 if (!p_ptr->wild_mode)
5378 if (!p_ptr->inside_arena)
5383 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5385 msg_print("The arena absorbs all attempted magic!");
5397 if (!p_ptr->wild_mode)
5399 if (p_ptr->inside_arena)
5402 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5404 msg_print("The arena absorbs all attempted magic!");
5409 else if (use_command && rogue_like_commands)
5421 /* Quaff a potion */
5424 if (!p_ptr->wild_mode)
5426 if (!p_ptr->inside_arena)
5427 do_cmd_quaff_potion();
5431 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5433 msg_print("The arena absorbs all attempted magic!");
5445 if (!p_ptr->wild_mode)
5447 if (!p_ptr->inside_arena)
5448 do_cmd_read_scroll();
5452 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5454 msg_print("The arena absorbs all attempted magic!");
5466 if (!p_ptr->wild_mode)
5468 if (p_ptr->inside_arena)
5471 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5473 msg_print("The arena absorbs all attempted magic!");
5478 else if (use_command && !rogue_like_commands)
5488 /* Use racial power */
5491 if (!p_ptr->wild_mode) do_cmd_racial_power();
5496 /*** Looking at Things (nearby or on map) ***/
5498 /* Full dungeon map */
5505 /* Locate player on map */
5519 /* Target monster or location */
5522 if (!p_ptr->wild_mode) do_cmd_target();
5528 /*** Help and Such ***/
5537 /* Identify symbol */
5540 do_cmd_query_symbol();
5544 /* Character description */
5547 do_cmd_change_name();
5552 /*** System Commands ***/
5554 /* Hack -- User interface */
5561 /* Single line from a pref file */
5570 do_cmd_reload_autopick();
5576 do_cmd_edit_autopick();
5580 /* Interact with macros */
5587 /* Interact with visuals */
5595 /* Interact with colors */
5603 /* Interact with options */
5611 /*** Misc Commands ***/
5627 /* Repeat level feeling */
5630 if (!p_ptr->wild_mode) do_cmd_feeling();
5634 /* Show previous message */
5637 do_cmd_message_one();
5641 /* Show previous messages */
5644 do_cmd_messages(old_now_message);
5648 /* Show quest status -KMW- */
5651 do_cmd_checkquest();
5655 /* Redraw the screen */
5658 now_message = old_now_message;
5663 #ifndef VERIFY_SAVEFILE
5665 /* Hack -- Save and don't quit */
5668 do_cmd_save_game(FALSE);
5672 #endif /* VERIFY_SAVEFILE */
5682 case SPECIAL_KEY_QUIT:
5684 do_cmd_save_and_exit();
5688 /* Quit (commit suicide) */
5701 /* Check artifacts, uniques, objects */
5708 /* Load "screen dump" */
5711 do_cmd_load_screen();
5715 /* Save "screen dump" */
5718 do_cmd_save_screen();
5722 /* Make random artifact list */
5725 spoil_random_artifact("randifact.txt");
5729 /* Hack -- Unknown command */
5732 if (flush_failure) flush();
5736 sound(SOUND_ILLEGAL);
5738 if (!get_rnd_line("error_j.txt", 0, error_m))
5740 if (!get_rnd_line("error.txt", 0, error_m))
5747 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5749 prt("Type '?' for help.", 0, 0);
5755 if (!energy_use && !now_message)
5756 now_message = old_now_message;
5762 static bool monster_tsuri(int r_idx)
5764 monster_race *r_ptr = &r_info[r_idx];
5766 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
5774 * Process the player
5776 * Notice the annoying code to handle "pack overflow", which
5777 * must come first just in case somebody manages to corrupt
5778 * the savefiles by clever use of menu commands or something.
5780 static void process_player(void)
5784 /*** Apply energy ***/
5789 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5791 msg_print("You feel different!");
5794 (void)gain_random_mutation(0);
5795 hack_mutation = FALSE;
5798 if (p_ptr->inside_battle)
5800 for(i = 1; i < m_max; i++)
5802 monster_type *m_ptr = &m_list[i];
5804 if (!m_ptr->r_idx) continue;
5806 /* Hack -- Detect monster */
5807 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5809 /* Update the monster */
5810 update_mon(i, FALSE);
5815 /* Give the player some energy */
5816 else if (!(load && p_ptr->energy_need <= 0))
5818 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5822 if (p_ptr->energy_need > 0) return;
5823 if (!command_rep) prt_time();
5825 /*** Check for interupts ***/
5827 /* Complete resting */
5834 if ((p_ptr->chp == p_ptr->mhp) &&
5835 (p_ptr->csp >= p_ptr->msp))
5837 set_action(ACTION_NONE);
5841 /* Complete resting */
5842 else if (resting == -2)
5845 if ((p_ptr->chp == p_ptr->mhp) &&
5846 (p_ptr->csp >= p_ptr->msp) &&
5847 !p_ptr->blind && !p_ptr->confused &&
5848 !p_ptr->poisoned && !p_ptr->afraid &&
5849 !p_ptr->stun && !p_ptr->cut &&
5850 !p_ptr->slow && !p_ptr->paralyzed &&
5851 !p_ptr->image && !p_ptr->word_recall &&
5852 !p_ptr->alter_reality)
5854 set_action(ACTION_NONE);
5859 if (p_ptr->action == ACTION_FISH)
5862 Term_xtra(TERM_XTRA_DELAY, 10);
5866 bool success = FALSE;
5867 get_mon_num_prep(monster_tsuri,NULL);
5868 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5870 if (r_idx && one_in_(2))
5873 y = py+ddy[tsuri_dir];
5874 x = px+ddx[tsuri_dir];
5875 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5878 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5880 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5882 msg_format("You have a good catch!", m_name);
5890 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5892 msg_print("Damn! The fish stole your bait!");
5899 /* Handle "abort" */
5902 /* Check for "player abort" (semi-efficiently for resting) */
5903 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5908 /* Check for a key */
5917 /* Hack -- Show a Message */
5919 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5921 msg_print("Canceled.");
5928 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5930 monster_type *m_ptr = &m_list[p_ptr->riding];
5931 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5939 mproc_remove(p_ptr->riding, m_ptr->mproc_idx[MPROC_CSLEEP], MPROC_CSLEEP);
5940 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5942 /* Acquire the monster name */
5943 monster_desc(m_name, m_ptr, 0);
5945 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5947 msg_format("You have waked %s up.", m_name);
5949 p_ptr->redraw |= (PR_UHEALTH);
5956 /* Make a "saving throw" against stun */
5957 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5963 /* Hack -- Recover from stun */
5964 if (m_ptr->stunned > d)
5966 /* Recover somewhat */
5967 m_ptr->stunned -= d;
5977 mproc_remove(p_ptr->riding, m_ptr->mproc_idx[MPROC_STUNNED], MPROC_STUNNED);
5979 /* Acquire the monster name */
5980 monster_desc(m_name, m_ptr, 0);
5982 /* Dump a message */
5984 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5986 msg_format("%^s is no longer stunned.", m_name);
5991 if (m_ptr->confused)
5995 /* Make a "saving throw" against stun */
5996 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5999 d = m_ptr->confused;
6002 /* Hack -- Recover from stun */
6003 if (m_ptr->confused > d)
6005 /* Recover somewhat */
6006 m_ptr->confused -= d;
6015 m_ptr->confused = 0;
6016 mproc_remove(p_ptr->riding, m_ptr->mproc_idx[MPROC_CONFUSED], MPROC_CONFUSED);
6018 /* Acquire the monster name */
6019 monster_desc(m_name, m_ptr, 0);
6021 /* Dump a message */
6023 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
6025 msg_format("%^s is no longer confused.", m_name);
6034 /* Make a "saving throw" against stun */
6035 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
6041 /* Hack -- Recover from stun */
6042 if (m_ptr->monfear > d)
6044 /* Recover somewhat */
6045 m_ptr->monfear -= d;
6055 mproc_remove(p_ptr->riding, m_ptr->mproc_idx[MPROC_MONFEAR], MPROC_MONFEAR);
6057 /* Acquire the monster name */
6058 monster_desc(m_name, m_ptr, 0);
6060 /* Dump a message */
6062 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
6064 msg_format("%^s is no longer fear.", m_name);
6066 p_ptr->redraw |= (PR_UHEALTH);
6070 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6074 /* Handle the player song */
6075 if (!load) check_music();
6080 if (p_ptr->lightspeed)
6082 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
6084 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
6086 if (p_ptr->magic_num1[0] < 40)
6088 p_ptr->magic_num1[0] = 0;
6090 else p_ptr->magic_num1[0] -= 40;
6091 p_ptr->update |= (PU_BONUS);
6093 if (p_ptr->action == ACTION_LEARN)
6096 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
6098 /* Convert the unit (1/2^16) to (1/2^32) */
6099 s64b_LSHIFT(cost, cost_frac, 16);
6102 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
6106 p_ptr->csp_frac = 0;
6107 set_action(ACTION_NONE);
6112 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
6114 p_ptr->redraw |= PR_MANA;
6117 if (p_ptr->special_defense & KATA_MASK)
6119 if (p_ptr->special_defense & KATA_MUSOU)
6123 set_action(ACTION_NONE);
6128 p_ptr->redraw |= (PR_MANA);
6133 /*** Handle actual user input ***/
6135 /* Repeat until out of energy */
6136 while (p_ptr->energy_need <= 0)
6138 p_ptr->window |= PW_PLAYER;
6139 p_ptr->sutemi = FALSE;
6140 p_ptr->counter = FALSE;
6141 now_damaged = FALSE;
6143 /* Handle "p_ptr->notice" */
6146 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6149 /* Place the cursor on the player */
6150 move_cursor_relative(py, px);
6152 /* Refresh (optional) */
6153 if (fresh_before) Term_fresh();
6156 /* Hack -- Pack Overflow */
6157 if (inventory[INVEN_PACK].k_idx)
6159 int item = INVEN_PACK;
6161 char o_name[MAX_NLEN];
6165 /* Access the slot to be dropped */
6166 o_ptr = &inventory[item];
6173 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
6175 msg_print("Your pack overflows!");
6180 object_desc(o_name, o_ptr, 0);
6184 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
6186 msg_format("You drop %s (%c).", o_name, index_to_label(item));
6190 /* Drop it (carefully) near the player */
6191 (void)drop_near(o_ptr, 0, py, px);
6193 /* Modify, Describe, Optimize */
6194 inven_item_increase(item, -255);
6195 inven_item_describe(item);
6196 inven_item_optimize(item);
6198 /* Handle "p_ptr->notice" */
6201 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6206 /* Hack -- cancel "lurking browse mode" */
6207 if (!command_new) command_see = FALSE;
6210 /* Assume free turn */
6214 if (p_ptr->inside_battle)
6216 /* Place the cursor on the player */
6217 move_cursor_relative(py, px);
6219 command_cmd = SPECIAL_KEY_BUILDING;
6221 /* Process the command */
6225 /* Paralyzed or Knocked Out */
6226 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
6233 else if (p_ptr->action == ACTION_REST)
6238 /* Reduce rest count */
6241 if (!resting) set_action(ACTION_NONE);
6243 /* Redraw the state */
6244 p_ptr->redraw |= (PR_STATE);
6252 else if (p_ptr->action == ACTION_FISH)
6265 /* Repeated command */
6266 else if (command_rep)
6268 /* Count this execution */
6271 /* Redraw the state */
6272 p_ptr->redraw |= (PR_STATE);
6277 /* Hack -- Assume messages were seen */
6280 /* Clear the top line */
6283 /* Process the command */
6287 /* Normal command */
6290 /* Place the cursor on the player */
6291 move_cursor_relative(py, px);
6294 /* Get a command (normal) */
6295 request_command(FALSE);
6298 /* Process the command */
6308 /* Use some energy */
6309 if (world_player || energy_use > 400)
6311 /* The Randomness is irrelevant */
6312 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
6316 /* There is some randomness of needed energy */
6317 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
6320 /* Hack -- constant hallucination */
6321 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
6324 /* Shimmer monsters if needed */
6325 if (shimmer_monsters)
6327 /* Clear the flag */
6328 shimmer_monsters = FALSE;
6330 /* Shimmer multi-hued monsters */
6331 for (i = 1; i < m_max; i++)
6333 monster_type *m_ptr;
6334 monster_race *r_ptr;
6336 /* Access monster */
6339 /* Skip dead monsters */
6340 if (!m_ptr->r_idx) continue;
6342 /* Skip unseen monsters */
6343 if (!m_ptr->ml) continue;
6345 /* Access the monster race */
6346 r_ptr = &r_info[m_ptr->ap_r_idx];
6348 /* Skip non-multi-hued monsters */
6349 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6352 /* Reset the flag */
6353 shimmer_monsters = TRUE;
6355 /* Redraw regardless */
6356 lite_spot(m_ptr->fy, m_ptr->fx);
6361 /* Handle monster detection */
6362 if (repair_monsters)
6364 /* Reset the flag */
6365 repair_monsters = FALSE;
6367 /* Rotate detection flags */
6368 for (i = 1; i < m_max; i++)
6370 monster_type *m_ptr;
6372 /* Access monster */
6375 /* Skip dead monsters */
6376 if (!m_ptr->r_idx) continue;
6378 /* Nice monsters get mean */
6379 if (m_ptr->mflag & MFLAG_NICE)
6381 /* Nice monsters get mean */
6382 m_ptr->mflag &= ~(MFLAG_NICE);
6385 /* Handle memorized monsters */
6386 if (m_ptr->mflag2 & MFLAG2_MARK)
6388 /* Maintain detection */
6389 if (m_ptr->mflag2 & MFLAG2_SHOW)
6392 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6394 /* Still need repairs */
6395 repair_monsters = TRUE;
6398 /* Remove detection */
6402 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6404 /* Assume invisible */
6407 /* Update the monster */
6408 update_mon(i, FALSE);
6410 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6411 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6413 /* Redraw regardless */
6414 lite_spot(m_ptr->fy, m_ptr->fx);
6419 if (p_ptr->pclass == CLASS_IMITATOR)
6421 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6424 for (i = 0; i < p_ptr->mane_num; i++)
6426 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6427 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6431 p_ptr->redraw |= (PR_MANE);
6433 if (p_ptr->action == ACTION_LEARN)
6436 p_ptr->redraw |= (PR_STATE);
6439 if (world_player && (p_ptr->energy_need > - 1000))
6442 p_ptr->redraw |= (PR_MAP);
6444 /* Update monsters */
6445 p_ptr->update |= (PU_MONSTERS);
6448 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6451 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6453 msg_print("You feel time flowing around you once more.");
6456 world_player = FALSE;
6457 p_ptr->energy_need = ENERGY_NEED();
6459 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6464 /* Hack -- notice death */
6465 if (!p_ptr->playing || p_ptr->is_dead)
6467 world_player = FALSE;
6471 /* Handle "leaving" */
6472 if (p_ptr->leaving) break;
6475 /* Update scent trail */
6481 * Interact with the current dungeon level.
6483 * This function will not exit until the level is completed,
6484 * the user dies, or the game is terminated.
6486 static void dungeon(bool load_game)
6490 /* Set the base level */
6491 base_level = dun_level;
6493 /* Reset various flags */
6497 p_ptr->leaving = FALSE;
6499 /* Reset the "command" vars */
6502 #if 0 /* Don't reset here --- It's used for Arena */
6511 /* Cancel the target */
6515 ambush_flag = FALSE;
6517 /* Cancel the health bar */
6520 /* Check visual effects */
6521 shimmer_monsters = TRUE;
6522 shimmer_objects = TRUE;
6523 repair_monsters = TRUE;
6524 repair_objects = TRUE;
6530 /* Get index of current quest (if any) */
6531 quest_num = quest_number(dun_level);
6533 /* Inside a quest? */
6536 /* Mark the quest monster */
6537 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6540 /* Track maximum player level */
6541 if (p_ptr->max_plv < p_ptr->lev)
6543 p_ptr->max_plv = p_ptr->lev;
6547 /* Track maximum dungeon level (if not in quest -KMW-) */
6548 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6550 max_dlv[dungeon_type] = dun_level;
6551 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6554 /* Validate the panel */
6555 panel_bounds_center();
6557 /* Verify the panel */
6560 /* Flush messages */
6564 /* Enter "xtra" mode */
6565 character_xtra = TRUE;
6568 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6570 /* Redraw dungeon */
6571 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6574 p_ptr->redraw |= (PR_MAP);
6577 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6579 /* Update lite/view */
6580 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6582 /* Update monsters */
6583 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6585 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6588 /* Leave "xtra" mode */
6589 character_xtra = FALSE;
6592 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6594 /* Combine / Reorder the pack */
6595 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6597 /* Handle "p_ptr->notice" */
6600 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6606 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6607 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6608 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6610 if (p_ptr->inside_battle)
6614 p_ptr->energy_need = 0;
6620 msg_print("»î¹ç³«»Ï¡ª");
6622 msg_format("Ready..Fight!");
6628 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6629 p_ptr->magic_num1[0] = MUSIC_DETECT;
6631 /* Hack -- notice death or departure */
6632 if (!p_ptr->playing || p_ptr->is_dead) return;
6634 /* Print quest message if appropriate */
6635 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6637 quest_discovery(random_quest_number(dun_level));
6638 p_ptr->inside_quest = random_quest_number(dun_level);
6640 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6642 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6644 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6645 d_name+d_info[dungeon_type].name,
6646 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6648 msg_format("%^s lives in this level as the keeper of %s.",
6649 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6650 d_name+d_info[dungeon_type].name);
6654 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
6656 /*** Process this dungeon level ***/
6658 /* Reset the monster generation level */
6659 monster_level = base_level;
6661 /* Reset the object generation level */
6662 object_level = base_level;
6666 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6667 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6668 p_ptr->energy_need = 0;
6670 /* Not leaving dungeon */
6671 p_ptr->leaving_dungeon = FALSE;
6676 /* Hack -- Compact the monster list occasionally */
6677 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6679 /* Hack -- Compress the monster list occasionally */
6680 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6683 /* Hack -- Compact the object list occasionally */
6684 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6686 /* Hack -- Compress the object list occasionally */
6687 if (o_cnt + 32 < o_max) compact_objects(0);
6690 /* Process the player */
6693 /* Handle "p_ptr->notice" */
6696 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6699 /* Hack -- Hilite the player */
6700 move_cursor_relative(py, px);
6702 /* Optional fresh */
6703 if (fresh_after) Term_fresh();
6705 /* Hack -- Notice death or departure */
6706 if (!p_ptr->playing || p_ptr->is_dead) break;
6708 /* Process all of the monsters */
6711 /* Handle "p_ptr->notice" */
6714 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6717 /* Hack -- Hilite the player */
6718 move_cursor_relative(py, px);
6720 /* Optional fresh */
6721 if (fresh_after) Term_fresh();
6723 /* Hack -- Notice death or departure */
6724 if (!p_ptr->playing || p_ptr->is_dead) break;
6727 /* Process the world */
6730 /* Handle "p_ptr->notice" */
6733 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6736 /* Hack -- Hilite the player */
6737 move_cursor_relative(py, px);
6739 /* Optional fresh */
6740 if (fresh_after) Term_fresh();
6742 /* Hack -- Notice death or departure */
6743 if (!p_ptr->playing || p_ptr->is_dead) break;
6745 /* Handle "leaving" */
6746 if (p_ptr->leaving) break;
6748 /* Count game turns */
6750 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6751 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6752 if (wild_regen) wild_regen--;
6755 /* Inside a quest and non-unique questor? */
6756 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6758 /* Un-mark the quest monster */
6759 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6762 /* Not save-and-quit and not dead? */
6763 if (p_ptr->playing && !p_ptr->is_dead)
6766 * Maintain Unique monsters and artifact, save current
6767 * floor, then prepare next floor
6771 /* Forget the flag */
6772 reinit_wilderness = FALSE;
6775 /* Write about current level on the play record once per level */
6781 * Load some "user pref files"
6783 * Modified by Arcum Dagsson to support
6784 * separate macro files for different realms.
6786 static void load_all_pref_files(void)
6790 /* Access the "user" pref file */
6791 sprintf(buf, "user.prf");
6793 /* Process that file */
6794 process_pref_file(buf);
6796 /* Access the "user" system pref file */
6797 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6799 /* Process that file */
6800 process_pref_file(buf);
6802 /* Access the "race" pref file */
6803 sprintf(buf, "%s.prf", rp_ptr->title);
6805 /* Process that file */
6806 process_pref_file(buf);
6808 /* Access the "class" pref file */
6809 sprintf(buf, "%s.prf", cp_ptr->title);
6811 /* Process that file */
6812 process_pref_file(buf);
6814 /* Access the "character" pref file */
6815 sprintf(buf, "%s.prf", player_base);
6817 /* Process that file */
6818 process_pref_file(buf);
6820 /* Access the "realm 1" pref file */
6821 if (p_ptr->realm1 != REALM_NONE)
6823 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6825 /* Process that file */
6826 process_pref_file(buf);
6829 /* Access the "realm 2" pref file */
6830 if (p_ptr->realm2 != REALM_NONE)
6832 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6834 /* Process that file */
6835 process_pref_file(buf);
6839 /* Load an autopick preference file */
6840 autopick_load_pref(FALSE);
6845 * Extract option variables from bit sets
6847 void extract_option_vars(void)
6851 for (i = 0; option_info[i].o_desc; i++)
6853 int os = option_info[i].o_set;
6854 int ob = option_info[i].o_bit;
6856 /* Set the "default" options */
6857 if (option_info[i].o_var)
6860 if (option_flag[os] & (1L << ob))
6863 (*option_info[i].o_var) = TRUE;
6870 (*option_info[i].o_var) = FALSE;
6878 * Determine bounty uniques
6880 void determine_bounty_uniques(void)
6883 monster_race *r_ptr;
6885 get_mon_num_prep(NULL, NULL);
6886 for (i = 0; i < MAX_KUBI; i++)
6890 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6891 r_ptr = &r_info[kubi_r_idx[i]];
6893 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6895 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6897 if (r_ptr->rarity > 100) continue;
6899 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6901 for (j = 0; j < i; j++)
6902 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6909 for (i = 0; i < MAX_KUBI - 1; i++)
6911 for (j = i; j < MAX_KUBI; j++)
6913 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6915 tmp = kubi_r_idx[i];
6916 kubi_r_idx[i] = kubi_r_idx[j];
6917 kubi_r_idx[j] = tmp;
6925 * Determine today's bounty monster
6926 * Note: conv_old is used if loaded 0.0.3 or older save file
6928 void determine_today_mon(bool conv_old)
6931 bool old_inside_battle = p_ptr->inside_battle;
6932 monster_race *r_ptr;
6936 for (i = 0; i < max_d_idx; i++)
6938 if (max_dlv[i] < d_info[i].mindepth) continue;
6939 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6942 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6944 p_ptr->inside_battle = TRUE;
6945 get_mon_num_prep(NULL, NULL);
6949 today_mon = get_mon_num(max_dl);
6950 r_ptr = &r_info[today_mon];
6952 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6953 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6954 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6955 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6956 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6957 if (r_ptr->rarity > 10) continue;
6961 p_ptr->today_mon = 0;
6962 p_ptr->inside_battle = old_inside_battle;
6967 * Actually play a game
6969 * If the "new_game" parameter is true, then, after loading the
6970 * savefile, we will commit suicide, if necessary, to allow the
6971 * player to start a new game.
6973 void play_game(bool new_game)
6976 bool load_game = TRUE;
6986 else if (chuukei_server)
6988 prepare_chuukei_hooks();
6992 hack_mutation = FALSE;
6994 /* Hack -- Character is "icky" */
6995 character_icky = TRUE;
6997 /* Make sure main term is active */
6998 Term_activate(angband_term[0]);
7000 /* Initialise the resize hooks */
7001 angband_term[0]->resize_hook = resize_map;
7003 for (i = 1; i < 8; i++)
7005 /* Does the term exist? */
7006 if (angband_term[i])
7008 /* Add the redraw on resize hook */
7009 angband_term[i]->resize_hook = redraw_window;
7013 /* Hack -- turn off the cursor */
7014 (void)Term_set_cursor(0);
7017 /* Attempt to load */
7022 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
7024 quit("broken savefile");
7029 /* Extract the options */
7030 extract_option_vars();
7032 /* Report waited score */
7033 if (p_ptr->wait_report_score)
7039 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
7041 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
7046 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
7051 p_ptr->is_dead = TRUE;
7053 start_time = time(NULL);
7055 /* No suspending now */
7056 signals_ignore_tstp();
7058 /* Hack -- Character is now "icky" */
7059 character_icky = TRUE;
7061 /* Build the filename */
7062 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
7064 /* Open the high score file, for reading/writing */
7065 highscore_fd = fd_open(buf, O_RDWR);
7067 /* Handle score, show Top scores */
7068 success = send_world_score(TRUE);
7071 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
7073 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
7077 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
7079 prt("standing by for future registration...", 0, 0);
7085 p_ptr->wait_report_score = FALSE;
7088 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
7090 if (!save_player()) msg_print("death save failed!");
7093 /* Shut the high score file */
7094 (void)fd_close(highscore_fd);
7096 /* Forget the high score fd */
7099 /* Allow suspending now */
7100 signals_handle_tstp();
7105 /* Nothing loaded */
7106 if (!character_loaded)
7108 /* Make new player */
7111 /* The dungeon is not ready */
7112 character_dungeon = FALSE;
7114 /* Prepare to init the RNG */
7117 /* Initialize the saved floors data */
7118 init_saved_floors(FALSE);
7121 /* Old game is loaded. But new game is requested. */
7124 /* Initialize the saved floors data */
7125 init_saved_floors(TRUE);
7128 /* Process old character */
7131 /* Process the player name */
7132 process_player_name(FALSE);
7141 seed = (time(NULL));
7145 /* Mutate the seed on Unix machines */
7146 seed = ((seed >> 3) * (getpid() << 1));
7150 /* Use the complex RNG */
7153 /* Seed the "complex" RNG */
7154 Rand_state_init(seed);
7157 /* Roll new character */
7160 /* The dungeon is not ready */
7161 character_dungeon = FALSE;
7165 p_ptr->inside_quest = 0;
7166 p_ptr->inside_arena = FALSE;
7167 p_ptr->inside_battle = FALSE;
7171 /* Hack -- seed for flavors */
7172 seed_flavor = randint0(0x10000000);
7174 /* Hack -- seed for town layout */
7175 seed_town = randint0(0x10000000);
7177 /* Roll up a new character */
7185 determine_bounty_uniques();
7186 determine_today_mon(FALSE);
7188 /* Initialize object array */
7193 write_level = FALSE;
7196 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
7198 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
7202 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
7203 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
7205 if (p_ptr->riding == -1)
7208 for (i = m_max; i > 0; i--)
7210 if (player_bold(m_list[i].fy, m_list[i].fx))
7219 p_ptr->teleport_town = FALSE;
7220 p_ptr->sutemi = FALSE;
7221 world_monster = FALSE;
7222 now_damaged = FALSE;
7224 start_time = time(NULL) - 1;
7225 record_o_name[0] = '\0';
7227 /* Reset map panel */
7228 panel_row_min = cur_hgt;
7229 panel_col_min = cur_wid;
7231 /* Sexy gal gets bonus to maximum weapon skill of whip */
7232 if (p_ptr->pseikaku == SEIKAKU_SEXY)
7233 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
7235 /* Fill the arrays of floors and walls in the good proportions */
7236 set_floor_and_wall(dungeon_type);
7238 /* Flavor the objects */
7241 /* Flash a message */
7243 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
7245 prt("Please wait...", 0, 0);
7249 /* Flush the message */
7253 /* Hack -- Enter wizard mode */
7256 if (enter_wizard_mode())
7258 p_ptr->wizard = TRUE;
7260 if (p_ptr->is_dead || !py || !px)
7262 /* Initialize the saved floors data */
7263 init_saved_floors(TRUE);
7266 p_ptr->inside_quest = 0;
7268 /* Avoid crash in update_view() */
7272 else if (p_ptr->is_dead)
7274 quit("Already dead.");
7278 /* Initialize the town-buildings if necessary */
7279 if (!dun_level && !p_ptr->inside_quest)
7281 /* Init the wilderness */
7283 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
7286 init_flags = INIT_ONLY_BUILDINGS;
7288 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
7293 /* Generate a dungeon level if needed */
7294 if (!character_dungeon)
7301 /* HACK -- Restore from panic-save */
7302 if (p_ptr->panic_save)
7304 /* No player? -- Try to regenerate floor */
7308 msg_print("¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¤¬¤ª¤«¤·¤¤¡£¥Õ¥í¥¢¤òºÆÀ¸À®¤·¤Þ¤¹¡£");
7310 msg_print("What a strange player location. Regenerate the dungeon floor.");
7315 /* Still no player? -- Try to locate random place */
7316 if (!py || !px) py = px = 10;
7318 /* No longer in panic */
7319 p_ptr->panic_save = 0;
7323 /* Character is now "complete" */
7324 character_generated = TRUE;
7327 /* Hack -- Character is no longer "icky" */
7328 character_icky = FALSE;
7336 sprintf(buf, "%s¤Ë¹ß¤êΩ¤Ã¤¿¡£", map_name());
7338 sprintf(buf, "You are standing in the %s.", map_name());
7340 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
7345 p_ptr->playing = TRUE;
7347 /* Reset the visual mappings */
7350 /* Load the "pref" files */
7351 load_all_pref_files();
7353 /* Give startup outfit (after loading pref files) */
7359 /* React to changes */
7360 Term_xtra(TERM_XTRA_REACT, 0);
7363 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
7366 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
7372 /* Set or clear "rogue_like_commands" if requested */
7373 if (arg_force_original) rogue_like_commands = FALSE;
7374 if (arg_force_roguelike) rogue_like_commands = TRUE;
7376 /* Hack -- Enforce "delayed death" */
7377 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
7379 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
7381 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
7383 monster_type *m_ptr;
7384 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
7385 monster_race *r_ptr = &r_info[pet_r_idx];
7386 place_monster_aux(0, py, px - 1, pet_r_idx,
7387 (PM_FORCE_PET | PM_NO_KAGE));
7388 m_ptr = &m_list[hack_m_idx_ii];
7389 m_ptr->mspeed = r_ptr->speed;
7390 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
7391 m_ptr->max_maxhp = m_ptr->maxhp;
7392 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
7393 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7399 /* Process the level */
7402 /* Handle "p_ptr->notice" */
7405 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7408 /* Cancel the target */
7411 /* Cancel the health bar */
7415 /* Forget the lite */
7418 /* Forget the view */
7421 /* Forget the view */
7424 /* Handle "quit and save" */
7425 if (!p_ptr->playing && !p_ptr->is_dead) break;
7427 /* Erase the old cave */
7429 if (!p_ptr->is_dead) wipe_m_list();
7437 /* Accidental Death */
7438 if (p_ptr->playing && p_ptr->is_dead)
7440 if (p_ptr->inside_arena)
7442 p_ptr->inside_arena = FALSE;
7443 if (p_ptr->arena_number > MAX_ARENA_MONS)
7444 p_ptr->arena_number++;
7446 p_ptr->arena_number = -1 - p_ptr->arena_number;
7447 p_ptr->is_dead = FALSE;
7449 p_ptr->chp_frac = 0;
7450 p_ptr->exit_bldg = TRUE;
7453 /* Leave through the exit */
7454 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
7456 /* prepare next floor */
7461 /* Mega-Hack -- Allow player to cheat death */
7463 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7465 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7468 /* Mark social class, reset age, if needed */
7469 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7475 p_ptr->noscore |= 0x0001;
7479 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7481 msg_print("You invoke wizard mode and cheat death.");
7485 /* Restore hit points */
7486 p_ptr->chp = p_ptr->mhp;
7487 p_ptr->chp_frac = 0;
7489 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7491 for (i = 0; i < EATER_EXT*2; i++)
7493 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7495 for (; i < EATER_EXT*3; i++)
7497 p_ptr->magic_num1[i] = 0;
7500 /* Restore spell points */
7501 p_ptr->csp = p_ptr->msp;
7502 p_ptr->csp_frac = 0;
7504 /* Hack -- cancel recall */
7505 if (p_ptr->word_recall)
7509 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7511 msg_print("A tension leaves the air around you...");
7516 /* Hack -- Prevent recall */
7517 p_ptr->word_recall = 0;
7518 p_ptr->redraw |= (PR_STATUS);
7521 /* Hack -- cancel alter */
7522 if (p_ptr->alter_reality)
7524 /* Hack -- Prevent alter */
7525 p_ptr->alter_reality = 0;
7526 p_ptr->redraw |= (PR_STATUS);
7529 /* Note cause of death XXX XXX XXX */
7531 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7533 (void)strcpy(p_ptr->died_from, "Cheating death");
7537 p_ptr->is_dead = FALSE;
7539 /* Hack -- Healing */
7541 (void)set_confused(0);
7542 (void)set_poisoned(0);
7543 (void)set_afraid(0);
7544 (void)set_paralyzed(0);
7549 /* Hack -- Prevent starvation */
7550 (void)set_food(PY_FOOD_MAX - 1);
7553 p_ptr->inside_arena = FALSE;
7554 p_ptr->inside_battle = FALSE;
7556 p_ptr->inside_quest = 0;
7557 p_ptr->recall_dungeon = dungeon_type;
7559 if (lite_town || vanilla_town)
7561 p_ptr->wilderness_y = 1;
7562 p_ptr->wilderness_x = 1;
7576 p_ptr->wilderness_y = 48;
7577 p_ptr->wilderness_x = 5;
7583 p_ptr->wild_mode = FALSE;
7584 p_ptr->leaving = TRUE;
7587 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7589 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7592 /* Prepare next floor */
7599 /* Handle "death" */
7600 if (p_ptr->is_dead) break;
7602 /* Make a new level */
7613 s32b turn_real(s32b hoge)
7615 switch (p_ptr->start_race)
7621 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);