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? "))
643 teleport_player(200, 0L);
652 if (command_arg < min_level) command_arg = min_level;
655 if (command_arg > max_level) command_arg = max_level;
659 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
661 msg_format("You teleport to dungeon level %d.", command_arg);
665 if (autosave_l) do_cmd_save_game(TRUE);
668 dun_level = command_arg;
672 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
674 p_ptr->inside_quest = 0;
678 * Clear all saved floors
679 * and create a first saved floor
681 prepare_change_floor_mode(CFM_FIRST_FLOOR);
684 p_ptr->leaving = TRUE;
688 static void wreck_the_pattern(void)
690 int to_ruin = 0, r_y, r_x;
691 int pattern_type = f_info[cave[py][px].feat].power;
693 if (pattern_type == PATTERN_TILE_WRECKED)
700 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
701 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
703 msg_print("You bleed on the Pattern!");
704 msg_print("Something terrible happens!");
709 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
711 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
714 to_ruin = randint1(45) + 35;
718 scatter(&r_y, &r_x, py, px, 4, 0);
720 if (pattern_tile(r_y, r_x) &&
721 (f_info[cave[r_y][r_x].feat].power != PATTERN_TILE_WRECKED))
723 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
727 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
731 /* Returns TRUE if we are on the Pattern... */
732 static bool pattern_effect(void)
736 if (!pattern_tile(py, px)) return FALSE;
738 if ((prace_is_(RACE_AMBERITE)) &&
739 (p_ptr->cut > 0) && one_in_(10))
744 pattern_type = f_info[cave[py][px].feat].power;
746 switch (pattern_type)
748 case PATTERN_TILE_END:
749 (void)set_poisoned(0);
755 (void)do_res_stat(A_STR);
756 (void)do_res_stat(A_INT);
757 (void)do_res_stat(A_WIS);
758 (void)do_res_stat(A_DEX);
759 (void)do_res_stat(A_CON);
760 (void)do_res_stat(A_CHR);
761 (void)restore_level();
762 (void)hp_player(1000);
764 cave_set_feat(py, px, FEAT_PATTERN_OLD);
767 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
769 msg_print("This section of the Pattern looks less powerful.");
773 * We could make the healing effect of the
774 * Pattern center one-time only to avoid various kinds
775 * of abuse, like luring the win monster into fighting you
776 * in the middle of the pattern...
780 case PATTERN_TILE_OLD:
784 case PATTERN_TILE_TELEPORT:
788 case PATTERN_TILE_WRECKED:
791 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
793 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
798 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
800 else if (!IS_INVULN())
802 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
804 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
817 * Regenerate hit points -RAK-
819 static void regenhp(int percent)
825 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
826 if (p_ptr->action == ACTION_HAYAGAKE) return;
828 /* Save the old hitpoints */
829 old_chp = p_ptr->chp;
832 * Extract the new hitpoints
834 * 'percent' is the Regen factor in unit (1/2^16)
837 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
839 /* Convert the unit (1/2^16) to (1/2^32) */
840 s64b_LSHIFT(new_chp, new_chp_frac, 16);
843 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
847 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
849 p_ptr->chp = p_ptr->mhp;
854 if (old_chp != p_ptr->chp)
857 p_ptr->redraw |= (PR_HP);
860 p_ptr->window |= (PW_PLAYER);
868 * Regenerate mana points
870 static void regenmana(int percent)
872 s32b old_csp = p_ptr->csp;
875 * Excess mana will decay 32 times faster than normal
878 if (p_ptr->csp > p_ptr->msp)
880 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
882 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
884 /* Convert the unit (1/2^16) to (1/2^32) */
885 s64b_LSHIFT(decay, decay_frac, 16);
888 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
891 if (p_ptr->csp < p_ptr->msp)
893 p_ptr->csp = p_ptr->msp;
898 /* Regenerating mana (unless the player has excess mana) */
899 else if (percent > 0)
901 /* (percent/100) is the Regen factor in unit (1/2^16) */
903 u32b new_mana_frac = (p_ptr->msp * percent / 100 + PY_REGEN_MNBASE);
905 /* Convert the unit (1/2^16) to (1/2^32) */
906 s64b_LSHIFT(new_mana, new_mana_frac, 16);
909 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
911 /* Must set frac to zero even if equal */
912 if (p_ptr->csp >= p_ptr->msp)
914 p_ptr->csp = p_ptr->msp;
920 /* Reduce mana (even when the player has excess mana) */
923 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
924 s32b reduce_mana = 0;
925 u32b reduce_mana_frac = (p_ptr->msp * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
927 /* Convert the unit (1/2^16) to (1/2^32) */
928 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
931 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
943 if (old_csp != p_ptr->csp)
946 p_ptr->redraw |= (PR_MANA);
949 p_ptr->window |= (PW_PLAYER);
950 p_ptr->window |= (PW_SPELL);
961 static void regenmagic(int percent)
966 for (i = 0; i < EATER_EXT*2; i++)
968 if (!p_ptr->magic_num2[i]) continue;
969 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
970 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
971 p_ptr->magic_num1[i] += new_mana;
973 /* Check maximum charge */
974 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
976 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
980 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
982 if (!p_ptr->magic_num1[i]) continue;
983 if (!p_ptr->magic_num2[i]) continue;
984 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
985 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
996 * Regenerate the monsters (once per 100 game turns)
998 * XXX XXX XXX Should probably be done during monster turns.
1000 static void regen_monsters(void)
1005 /* Regenerate everyone */
1006 for (i = 1; i < m_max; i++)
1008 /* Check the i'th monster */
1009 monster_type *m_ptr = &m_list[i];
1010 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1013 /* Skip dead monsters */
1014 if (!m_ptr->r_idx) continue;
1016 /* Allow regeneration (if needed) */
1017 if (m_ptr->hp < m_ptr->maxhp)
1019 /* Hack -- Base regeneration */
1020 frac = m_ptr->maxhp / 100;
1022 /* Hack -- Minimal regeneration rate */
1023 if (!frac) if (one_in_(2)) frac = 1;
1025 /* Hack -- Some monsters regenerate quickly */
1026 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1028 /* Hack -- Regenerate */
1031 /* Do not over-regenerate */
1032 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1034 /* Redraw (later) if needed */
1035 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1036 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1043 * Regenerate the captured monsters (once per 30 game turns)
1045 * XXX XXX XXX Should probably be done during monster turns.
1047 static void regen_captured_monsters(void)
1052 /* Regenerate everyone */
1053 for (i = 0; i < INVEN_TOTAL; i++)
1055 monster_race *r_ptr;
1056 object_type *o_ptr = &inventory[i];
1058 if (!o_ptr->k_idx) continue;
1059 if (o_ptr->tval != TV_CAPTURE) continue;
1060 if (!o_ptr->pval) continue;
1064 r_ptr = &r_info[o_ptr->pval];
1066 /* Allow regeneration (if needed) */
1067 if (o_ptr->xtra4 < o_ptr->xtra5)
1069 /* Hack -- Base regeneration */
1070 frac = o_ptr->xtra5 / 100;
1072 /* Hack -- Minimal regeneration rate */
1073 if (!frac) if (one_in_(2)) frac = 1;
1075 /* Hack -- Some monsters regenerate quickly */
1076 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1078 /* Hack -- Regenerate */
1079 o_ptr->xtra4 += frac;
1081 /* Do not over-regenerate */
1082 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1089 p_ptr->notice |= (PN_COMBINE);
1092 p_ptr->window |= (PW_INVEN);
1093 p_ptr->window |= (PW_EQUIP);
1099 static void notice_lite_change(object_type *o_ptr)
1101 /* Hack -- notice interesting fuel steps */
1102 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1105 p_ptr->window |= (PW_EQUIP);
1108 /* Hack -- Special treatment when blind */
1111 /* Hack -- save some light for later */
1112 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1115 /* The light is now out */
1116 else if (o_ptr->xtra4 == 0)
1120 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1122 msg_print("Your light has gone out!");
1125 /* Recalculate torch radius */
1126 p_ptr->update |= (PU_TORCH);
1128 /* Some ego light lose its effects without fuel */
1129 p_ptr->update |= (PU_BONUS);
1132 /* The light is getting dim */
1133 else if (o_ptr->name2 == EGO_LITE_LONG)
1135 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1136 && (turn % (TURNS_PER_TICK*2)))
1138 if (disturb_minor) disturb(0, 0);
1140 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1142 msg_print("Your light is growing faint.");
1148 /* The light is getting dim */
1149 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1151 if (disturb_minor) disturb(0, 0);
1153 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1155 msg_print("Your light is growing faint.");
1162 void leave_quest_check(void)
1164 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1165 leaving_quest = p_ptr->inside_quest;
1167 /* Leaving an 'only once' quest marks it as failed */
1168 if (leaving_quest &&
1169 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1170 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1172 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1173 quest[leaving_quest].complev = (byte)p_ptr->lev;
1174 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1176 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1177 if (record_rand_quest)
1178 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1180 /* Floor of random quest will be blocked */
1181 prepare_change_floor_mode(CFM_NO_RETURN);
1183 else if (record_fix_quest)
1184 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1190 * Forcibly pseudo-identify an object in the inventory
1193 * note: currently this function allows pseudo-id of any object,
1194 * including silly ones like potions & scrolls, which always
1195 * get '{average}'. This should be changed, either to stop such
1196 * items from being pseudo-id'd, or to allow psychometry to
1197 * detect whether the unidentified potion/scroll/etc is
1198 * good (Cure Light Wounds, Restore Strength, etc) or
1199 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1201 bool psychometry(void)
1205 char o_name[MAX_NLEN];
1210 item_tester_no_ryoute = TRUE;
1213 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1214 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1216 q = "Meditate on which item? ";
1217 s = "You have nothing appropriate.";
1220 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1222 /* Get the item (in the pack) */
1225 o_ptr = &inventory[item];
1228 /* Get the item (on the floor) */
1231 o_ptr = &o_list[0 - item];
1234 /* It is fully known, no information needed */
1235 if (object_is_known(o_ptr))
1238 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1240 msg_print("You cannot find out anything more about that.");
1246 /* Check for a feeling */
1247 feel = value_check_aux1(o_ptr);
1249 /* Get an object description */
1250 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1252 /* Skip non-feelings */
1256 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1258 msg_format("You do not perceive anything unusual about the %s.", o_name);
1265 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1266 o_name, game_inscriptions[feel]);
1268 msg_format("You feel that the %s %s %s...",
1269 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1270 game_inscriptions[feel]);
1274 /* We have "felt" it */
1275 o_ptr->ident |= (IDENT_SENSE);
1278 o_ptr->feeling = feel;
1280 /* Combine / Reorder the pack (later) */
1281 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1284 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1286 /* Valid "tval" codes */
1287 switch (o_ptr->tval)
1315 /* Auto-inscription/destroy */
1316 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1318 /* Something happened */
1324 * If player has inscribed the object with "!!", let him know when it's
1327 static void recharged_notice(object_type *o_ptr)
1329 char o_name[MAX_NLEN];
1333 /* No inscription */
1334 if (!o_ptr->inscription) return;
1337 s = my_strchr(quark_str(o_ptr->inscription), '!');
1339 /* Process notification request. */
1342 /* Find another '!' */
1345 /* Describe (briefly) */
1346 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1348 /* Notify the player */
1350 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1352 if (o_ptr->number > 1)
1353 msg_format("Your %s are recharged.", o_name);
1355 msg_format("Your %s is recharged.", o_name);
1364 /* Keep looking for '!'s */
1365 s = my_strchr(s + 1, '!');
1370 static void check_music(void)
1375 u32b need_mana_frac;
1377 /* Music singed by player */
1378 if (p_ptr->pclass != CLASS_BARD) return;
1379 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1381 if (p_ptr->anti_magic)
1387 spell = p_ptr->magic_num2[0];
1388 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1390 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1394 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1396 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1403 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1405 p_ptr->redraw |= PR_MANA;
1406 if (p_ptr->magic_num1[1])
1408 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1409 p_ptr->magic_num1[1] = 0;
1411 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1413 msg_print("You restart singing.");
1415 p_ptr->action = ACTION_SING;
1417 /* Recalculate bonuses */
1418 p_ptr->update |= (PU_BONUS | PU_HP);
1420 /* Redraw map and status bar */
1421 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1423 /* Update monsters */
1424 p_ptr->update |= (PU_MONSTERS);
1427 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1430 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1431 p_ptr->spell_exp[spell] += 5;
1432 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1433 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1434 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1435 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1436 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1437 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1439 /* Do any effects of continual song */
1440 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1444 /* Choose one of items that have cursed flag */
1445 static object_type *choose_cursed_obj_name(u32b flag)
1448 int choices[INVEN_TOTAL-INVEN_RARM];
1451 /* Paranoia -- Player has no warning-item */
1452 if (!(p_ptr->cursed & flag)) return NULL;
1454 /* Search Inventry */
1455 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1457 object_type *o_ptr = &inventory[i];
1459 if (o_ptr->curse_flags & flag)
1461 choices[number] = i;
1466 /* Choice one of them */
1467 return (&inventory[choices[randint0(number)]]);
1472 * Handle timed damage and regeneration every 10 game turns
1474 static void process_world_aux_hp_and_sp(void)
1476 feature_type *f_ptr = &f_info[cave[py][px].feat];
1477 bool cave_no_regen = FALSE;
1478 int upkeep_factor = 0;
1481 /* Default regeneration */
1482 int regen_amount = PY_REGEN_NORMAL;
1485 /*** Damage over Time ***/
1487 /* Take damage from poison */
1488 if (p_ptr->poisoned && !IS_INVULN())
1492 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
1494 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1499 /* Take damage from cuts */
1500 if (p_ptr->cut && !IS_INVULN())
1504 /* Mortal wound or Deep Gash */
1505 if (p_ptr->cut > 1000)
1510 else if (p_ptr->cut > 200)
1516 else if (p_ptr->cut > 100)
1521 else if (p_ptr->cut > 50)
1526 else if (p_ptr->cut > 25)
1531 else if (p_ptr->cut > 10)
1544 take_hit(DAMAGE_NOESCAPE, dam, "Ã×Ì¿½ý", -1);
1546 take_hit(DAMAGE_NOESCAPE, dam, "a fatal wound", -1);
1552 /* (Vampires) Take damage from sunlight */
1553 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1555 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1557 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1561 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
1562 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
1564 msg_print("The sun's rays scorch your undead flesh!");
1565 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
1568 cave_no_regen = TRUE;
1572 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1573 !p_ptr->resist_lite)
1575 object_type * o_ptr = &inventory[INVEN_LITE];
1576 char o_name [MAX_NLEN];
1577 char ouch [MAX_NLEN+40];
1579 /* Get an object description */
1580 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1583 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
1585 msg_format("The %s scorches your undead flesh!", o_name);
1589 cave_no_regen = TRUE;
1591 /* Get an object description */
1592 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1595 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
1597 sprintf(ouch, "wielding %s", o_name);
1600 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1604 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1608 if (have_flag(f_ptr->flags, FF_DEEP))
1610 damage = 6000 + randint0(4000);
1612 else if (!p_ptr->levitation)
1614 damage = 3000 + randint0(2000);
1619 if (prace_is_(RACE_ENT)) damage += damage / 3;
1620 if (p_ptr->resist_fire) damage = damage / 3;
1621 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1623 if (p_ptr->levitation) damage = damage / 5;
1625 damage = damage / 100 + (randint0(100) < (damage % 100));
1627 if (p_ptr->levitation)
1630 msg_print("Ç®¤Ç²Ð½ý¤·¤¿¡ª");
1631 take_hit(DAMAGE_NOESCAPE, damage, format("%s¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1633 msg_print("The heat burns you!");
1634 take_hit(DAMAGE_NOESCAPE, damage, format("flying over %s", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1639 cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name;
1641 msg_format("%s¤Ç²Ð½ý¤·¤¿¡ª", name);
1643 msg_format("The %s burns you!", name);
1645 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1648 cave_no_regen = TRUE;
1652 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1653 !p_ptr->levitation && !p_ptr->can_swim)
1655 if (p_ptr->total_weight > weight_limit())
1659 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
1660 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
1662 msg_print("You are drowning!");
1663 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
1666 cave_no_regen = TRUE;
1673 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1675 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1676 if (prace_is_(RACE_ENT)) damage += damage / 3;
1677 if (p_ptr->resist_fire) damage = damage / 3;
1678 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1680 msg_print("Ç®¤¤¡ª");
1681 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
1683 msg_print("It's hot!");
1684 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
1687 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1689 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1690 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1691 if (p_ptr->resist_elec) damage = damage / 3;
1692 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1694 msg_print("Äˤ¤¡ª");
1695 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
1697 msg_print("It hurts!");
1698 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
1701 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1703 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1704 if (p_ptr->resist_cold) damage = damage / 3;
1705 if (IS_OPPOSE_COLD()) damage = damage / 3;
1707 msg_print("Î䤿¤¤¡ª");
1708 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
1710 msg_print("It's cold!");
1711 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
1716 /* Spectres -- take damage when moving through walls */
1718 * Added: ANYBODY takes damage if inside through walls
1719 * without wraith form -- NOTE: Spectres will never be
1720 * reduced below 0 hp by being inside a stone wall; others
1723 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1725 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
1726 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1730 cave_no_regen = TRUE;
1732 if (p_ptr->pass_wall)
1735 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
1738 msg_print("Your molecules feel disrupted!");
1739 dam_desc = "density";
1745 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
1746 dam_desc = "¹Å¤¤´ä";
1748 msg_print("You are being crushed!");
1749 dam_desc = "solid rock";
1753 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1758 /*** handle regeneration ***/
1761 if (p_ptr->food < PY_FOOD_WEAK)
1763 /* Lower regeneration */
1764 if (p_ptr->food < PY_FOOD_STARVE)
1768 else if (p_ptr->food < PY_FOOD_FAINT)
1770 regen_amount = PY_REGEN_FAINT;
1774 regen_amount = PY_REGEN_WEAK;
1778 /* Are we walking the pattern? */
1779 if (pattern_effect())
1781 cave_no_regen = TRUE;
1785 /* Regeneration ability */
1786 if (p_ptr->regenerate)
1788 regen_amount = regen_amount * 2;
1790 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1794 if (p_ptr->cursed & TRC_SLOW_REGEN)
1801 /* Searching or Resting */
1802 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1804 regen_amount = regen_amount * 2;
1807 upkeep_factor = calculate_upkeep();
1809 /* No regeneration while special action */
1810 if ((p_ptr->action == ACTION_LEARN) ||
1811 (p_ptr->action == ACTION_HAYAGAKE) ||
1812 (p_ptr->special_defense & KATA_KOUKIJIN))
1814 upkeep_factor += 100;
1817 /* Regenerate the mana */
1818 upkeep_regen = (100 - upkeep_factor) * regen_amount;
1819 regenmana(upkeep_regen);
1822 /* Recharge magic eater's power */
1823 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1825 regenmagic(regen_amount);
1828 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1830 while (upkeep_factor > 100)
1833 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
1835 msg_print("Too many pets to control at once!");
1838 do_cmd_pet_dismiss();
1840 upkeep_factor = calculate_upkeep();
1843 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
1845 msg_format("Upkeep: %d%% mana.", upkeep_factor);
1851 /* Poisoned or cut yields no healing */
1852 if (p_ptr->poisoned) regen_amount = 0;
1853 if (p_ptr->cut) regen_amount = 0;
1855 /* Special floor -- Pattern, in a wall -- yields no healing */
1856 if (cave_no_regen) regen_amount = 0;
1858 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
1860 /* Regenerate Hit Points if needed */
1861 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1863 regenhp(regen_amount);
1869 * Handle timeout every 10 game turns
1871 static void process_world_aux_timeout(void)
1873 const int dec_count = (easy_band ? 2 : 1);
1875 /*** Timeout Various Things ***/
1878 if (p_ptr->tim_mimic)
1880 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1883 /* Hack -- Hallucinating */
1886 (void)set_image(p_ptr->image - dec_count);
1892 (void)set_blind(p_ptr->blind - dec_count);
1895 /* Times see-invisible */
1896 if (p_ptr->tim_invis)
1898 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1909 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1912 /* Timed temporary elemental brands. -LM- */
1913 if (p_ptr->ele_attack)
1915 p_ptr->ele_attack--;
1917 /* Clear all temporary elemental brands. */
1918 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1921 /* Timed temporary elemental immune. -LM- */
1922 if (p_ptr->ele_immune)
1924 p_ptr->ele_immune--;
1926 /* Clear all temporary elemental brands. */
1927 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1930 /* Timed infra-vision */
1931 if (p_ptr->tim_infra)
1933 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1937 if (p_ptr->tim_stealth)
1939 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1942 /* Timed levitation */
1943 if (p_ptr->tim_levitation)
1945 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1948 /* Timed sh_touki */
1949 if (p_ptr->tim_sh_touki)
1951 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1955 if (p_ptr->tim_sh_fire)
1957 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1961 if (p_ptr->tim_sh_holy)
1963 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1967 if (p_ptr->tim_eyeeye)
1969 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1972 /* Timed resist-magic */
1973 if (p_ptr->resist_magic)
1975 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1978 /* Timed regeneration */
1979 if (p_ptr->tim_regen)
1981 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1984 /* Timed resist nether */
1985 if (p_ptr->tim_res_nether)
1987 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1990 /* Timed resist time */
1991 if (p_ptr->tim_res_time)
1993 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1997 if (p_ptr->tim_reflect)
1999 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2003 if (p_ptr->multishadow)
2005 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2008 /* Timed Robe of dust */
2009 if (p_ptr->dustrobe)
2011 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2014 /* Timed infra-vision */
2015 if (p_ptr->kabenuke)
2017 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2021 if (p_ptr->paralyzed)
2023 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2027 if (p_ptr->confused)
2029 (void)set_confused(p_ptr->confused - dec_count);
2035 (void)set_afraid(p_ptr->afraid - dec_count);
2041 (void)set_fast(p_ptr->fast - 1, TRUE);
2047 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2050 /* Protection from evil */
2051 if (p_ptr->protevil)
2053 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2056 /* Invulnerability */
2059 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2063 if (p_ptr->wraith_form)
2065 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2071 (void)set_hero(p_ptr->hero - 1, TRUE);
2077 (void)set_shero(p_ptr->shero - 1, TRUE);
2083 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2089 (void)set_shield(p_ptr->shield - 1, TRUE);
2093 if (p_ptr->tsubureru)
2095 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2099 if (p_ptr->magicdef)
2101 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2105 if (p_ptr->tsuyoshi)
2107 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2111 if (p_ptr->oppose_acid)
2113 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2116 /* Oppose Lightning */
2117 if (p_ptr->oppose_elec)
2119 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2123 if (p_ptr->oppose_fire)
2125 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2129 if (p_ptr->oppose_cold)
2131 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2135 if (p_ptr->oppose_pois)
2137 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2142 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2145 /*** Poison and Stun and Cut ***/
2148 if (p_ptr->poisoned)
2150 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2152 /* Apply some healing */
2153 (void)set_poisoned(p_ptr->poisoned - adjust);
2159 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2161 /* Apply some healing */
2162 (void)set_stun(p_ptr->stun - adjust);
2168 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2170 /* Hack -- Truly "mortal" wound */
2171 if (p_ptr->cut > 1000) adjust = 0;
2173 /* Apply some healing */
2174 (void)set_cut(p_ptr->cut - adjust);
2180 * Handle burning fuel every 10 game turns
2182 static void process_world_aux_light(void)
2184 /* Check for light being wielded */
2185 object_type *o_ptr = &inventory[INVEN_LITE];
2187 /* Burn some fuel in the current lite */
2188 if (o_ptr->tval == TV_LITE)
2190 /* Hack -- Use some fuel (except on artifacts) */
2191 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2193 /* Decrease life-span */
2194 if (o_ptr->name2 == EGO_LITE_LONG)
2196 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2198 else o_ptr->xtra4--;
2200 /* Notice interesting fuel steps */
2201 notice_lite_change(o_ptr);
2208 * Handle mutation effects once every 10 game turns
2210 static void process_world_aux_mutation(void)
2212 /* No mutation with effects */
2213 if (!p_ptr->muta2) return;
2215 /* No effect on monster arena */
2216 if (p_ptr->inside_battle) return;
2218 /* No effect on the global map */
2219 if (p_ptr->wild_mode) return;
2222 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2226 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
2227 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
2229 msg_print("RAAAAGHH!");
2230 msg_print("You feel a fit of rage coming over you!");
2233 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2236 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2238 if (!p_ptr->resist_fear)
2242 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
2244 msg_print("It's so dark... so scary!");
2247 set_afraid(p_ptr->afraid + 13 + randint1(26));
2251 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2253 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2258 /* Teleport player */
2260 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
2262 msg_print("Your position suddenly seems very uncertain...");
2266 teleport_player(40, TELEPORT_PASSIVE);
2270 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2272 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2275 p_ptr->redraw |= PR_EXTRA;
2277 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
2279 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2284 if (!p_ptr->resist_conf)
2286 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2289 if (!p_ptr->resist_chaos)
2294 if (one_in_(3)) lose_all_info();
2296 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2299 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
2300 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
2302 msg_print("You wake up somewhere with a sore head...");
2303 msg_print("You can't remember a thing, or how you got here!");
2312 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
2314 msg_print("Thishcischs GooDSChtuff!");
2317 (void)set_image(p_ptr->image + randint0(150) + 150);
2323 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2325 if (!p_ptr->resist_chaos)
2328 p_ptr->redraw |= PR_EXTRA;
2329 (void)set_image(p_ptr->image + randint0(50) + 20);
2333 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2338 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
2340 msg_print("BRRAAAP! Oops.");
2344 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2347 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2348 !p_ptr->anti_magic && one_in_(9000))
2353 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
2355 msg_print("Magical energy flows through you! You must release it!");
2360 (void)get_hack_dir(&dire);
2361 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2364 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2365 !p_ptr->anti_magic && (randint1(6666) == 666))
2367 bool pet = one_in_(6);
2368 u32b mode = PM_ALLOW_GROUP;
2370 if (pet) mode |= PM_FORCE_PET;
2371 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2373 if (summon_specific((pet ? -1 : 0), py, px,
2374 dun_level, SUMMON_DEMON, mode))
2377 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2379 msg_print("You have attracted a demon!");
2386 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2392 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2394 msg_print("You feel less energetic.");
2397 if (p_ptr->fast > 0)
2403 set_slow(randint1(30) + 10, FALSE);
2409 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2411 msg_print("You feel more energetic.");
2414 if (p_ptr->slow > 0)
2420 set_fast(randint1(30) + 10, FALSE);
2425 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2429 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
2431 msg_print("You suddenly feel almost lonely.");
2434 banish_monsters(100);
2435 if (!dun_level && p_ptr->town_num)
2439 /* Pick a random shop (except home) */
2442 n = randint0(MAX_STORES);
2444 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2447 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
2449 msg_print("You see one of the shopkeepers running for the hills!");
2457 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2462 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
2464 msg_print("A shadow passes over you.");
2469 /* Absorb light from the current possition */
2470 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2475 o_ptr = &inventory[INVEN_LITE];
2477 /* Absorb some fuel in the current lite */
2478 if (o_ptr->tval == TV_LITE)
2480 /* Use some fuel (except on artifacts) */
2481 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2483 /* Heal the player a bit */
2484 hp_player(o_ptr->xtra4 / 20);
2486 /* Decrease life-span of lite */
2490 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
2492 msg_print("You absorb energy from your light!");
2496 /* Notice interesting fuel steps */
2497 notice_lite_change(o_ptr);
2502 * Unlite the area (radius 10) around player and
2503 * do 50 points damage to every affected monster
2505 unlite_area(50, 10);
2508 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
2509 !p_ptr->anti_magic && one_in_(7000))
2511 bool pet = one_in_(3);
2512 u32b mode = PM_ALLOW_GROUP;
2514 if (pet) mode |= PM_FORCE_PET;
2515 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2517 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
2520 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
2522 msg_print("You have attracted an animal!");
2529 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
2530 !p_ptr->anti_magic && one_in_(8000))
2534 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
2536 msg_print("You feel the world warping around you!");
2540 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2542 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2544 if (!lose_mutation(0))
2546 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
2548 msg_print("You feel oddly normal.");
2552 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2556 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
2558 msg_print("You feel insubstantial!");
2562 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2564 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2568 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2570 int which_stat = randint0(6);
2571 int sustained = FALSE;
2576 if (p_ptr->sustain_str) sustained = TRUE;
2579 if (p_ptr->sustain_int) sustained = TRUE;
2582 if (p_ptr->sustain_wis) sustained = TRUE;
2585 if (p_ptr->sustain_dex) sustained = TRUE;
2588 if (p_ptr->sustain_con) sustained = TRUE;
2591 if (p_ptr->sustain_chr) sustained = TRUE;
2595 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
2597 msg_print("Invalid stat chosen!");
2607 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
2609 msg_print("You can feel yourself wasting away!");
2613 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2616 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
2617 !p_ptr->anti_magic && one_in_(3000))
2619 bool pet = one_in_(5);
2620 u32b mode = PM_ALLOW_GROUP;
2622 if (pet) mode |= PM_FORCE_PET;
2623 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2625 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
2628 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2630 msg_print("You have attracted a dragon!");
2636 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
2639 if (p_ptr->tim_esp > 0)
2642 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
2644 msg_print("Your mind feels cloudy!");
2647 set_tim_esp(0, TRUE);
2652 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
2654 msg_print("Your mind expands!");
2657 set_tim_esp(p_ptr->lev, FALSE);
2660 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
2665 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
2667 msg_print("Your stomach roils, and you lose your lunch!");
2671 set_food(PY_FOOD_WEAK);
2672 if (music_singing_any()) stop_singing();
2675 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
2676 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2681 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2683 int danger_amount = 0;
2686 for (monster = 0; monster < m_max; monster++)
2688 monster_type *m_ptr = &m_list[monster];
2689 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2691 /* Paranoia -- Skip dead monsters */
2692 if (!m_ptr->r_idx) continue;
2694 if (r_ptr->level >= p_ptr->lev)
2696 danger_amount += r_ptr->level - p_ptr->lev + 1;
2700 if (danger_amount > 100)
2702 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
2704 msg_print("You feel utterly terrified!");
2707 else if (danger_amount > 50)
2709 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
2711 msg_print("You feel terrified!");
2714 else if (danger_amount > 20)
2716 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
2718 msg_print("You feel very worried!");
2721 else if (danger_amount > 10)
2723 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
2725 msg_print("You feel paranoid!");
2728 else if (danger_amount > 5)
2730 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
2732 msg_print("You feel almost safe.");
2737 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
2739 msg_print("You feel lonely.");
2743 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
2748 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
2750 msg_print("You feel invincible!");
2754 (void)set_invuln(randint1(8) + 8, FALSE);
2756 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2758 int wounds = p_ptr->mhp - p_ptr->chp;
2762 int healing = p_ptr->csp;
2764 if (healing > wounds)
2770 p_ptr->csp -= healing;
2773 p_ptr->redraw |= (PR_MANA);
2776 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
2779 int wounds = p_ptr->msp - p_ptr->csp;
2783 int healing = p_ptr->chp;
2785 if (healing > wounds)
2790 p_ptr->csp += healing;
2793 p_ptr->redraw |= (PR_MANA);
2795 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
2797 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
2802 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2805 object_type *o_ptr = NULL;
2809 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
2810 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
2812 msg_print("You trip over your own feet!");
2813 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
2817 if (buki_motteruka(INVEN_RARM))
2820 o_ptr = &inventory[INVEN_RARM];
2822 if (buki_motteruka(INVEN_LARM) && one_in_(2))
2824 o_ptr = &inventory[INVEN_LARM];
2828 else if (buki_motteruka(INVEN_LARM))
2830 o_ptr = &inventory[INVEN_LARM];
2834 if (slot && !object_is_cursed(o_ptr))
2837 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
2839 msg_print("You drop your weapon!");
2841 inven_drop(slot, 1);
2848 * Handle curse effects once every 10 game turns
2850 static void process_world_aux_curse(void)
2852 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2855 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2856 * can actually be useful!
2858 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2860 char o_name[MAX_NLEN];
2864 /* Scan the equipment with random teleport ability */
2865 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2867 u32b flgs[TR_FLAG_SIZE];
2868 o_ptr = &inventory[i];
2870 /* Skip non-objects */
2871 if (!o_ptr->k_idx) continue;
2873 /* Extract the item flags */
2874 object_flags(o_ptr, flgs);
2876 if (have_flag(flgs, TR_TELEPORT)) break;
2879 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2882 msg_format("%s¤¬¥Æ¥ì¥Ý¡¼¥È¤ÎǽÎϤòȯư¤µ¤»¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", o_name);
2884 msg_format("Your %s is activating teleportation.", o_name);
2888 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
2890 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
2894 teleport_player(50, 0L);
2899 msg_format("%s¤Ë{.}(¥Ô¥ê¥ª¥É)¤ÈÌäò¹ï¤à¤Èȯư¤òÍÞÀ©¤Ç¤¤Þ¤¹¡£", o_name);
2901 msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
2906 /* Make a chainsword noise */
2907 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2911 if (!get_rnd_line("chainswd_j.txt", 0, noise))
2913 if (!get_rnd_line("chainswd.txt", 0, noise))
2916 disturb(FALSE, FALSE);
2919 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2922 (void)activate_ty_curse(FALSE, &count);
2924 /* Handle experience draining */
2925 if (p_ptr->prace != RACE_ANDROID &&
2926 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2928 p_ptr->exp -= (p_ptr->lev+1)/2;
2929 if (p_ptr->exp < 0) p_ptr->exp = 0;
2930 p_ptr->max_exp -= (p_ptr->lev+1)/2;
2931 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2934 /* Add light curse (Later) */
2935 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2940 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2942 new_curse = get_curse(0, o_ptr);
2943 if (!(o_ptr->curse_flags & new_curse))
2945 char o_name[MAX_NLEN];
2947 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2949 o_ptr->curse_flags |= new_curse;
2951 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
2953 msg_format("There is a malignant black aura surrounding your %s...", o_name);
2956 o_ptr->feeling = FEEL_NONE;
2958 p_ptr->update |= (PU_BONUS);
2961 /* Add heavy curse (Later) */
2962 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2967 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2969 new_curse = get_curse(1, o_ptr);
2970 if (!(o_ptr->curse_flags & new_curse))
2972 char o_name[MAX_NLEN];
2974 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2976 o_ptr->curse_flags |= new_curse;
2978 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
2980 msg_format("There is a malignant black aura surrounding your %s...", o_name);
2983 o_ptr->feeling = FEEL_NONE;
2985 p_ptr->update |= (PU_BONUS);
2989 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2991 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
2992 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2994 char o_name[MAX_NLEN];
2996 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2998 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3000 msg_format("Your %s have attracted an animal!", o_name);
3007 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3009 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3011 char o_name[MAX_NLEN];
3013 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3015 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3017 msg_format("Your %s have attracted a demon!", o_name);
3024 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3026 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3027 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3029 char o_name[MAX_NLEN];
3031 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3033 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3035 msg_format("Your %s have attracted an animal!", o_name);
3041 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3043 if (!p_ptr->resist_fear)
3047 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3049 msg_print("It's so dark... so scary!");
3052 set_afraid(p_ptr->afraid + 13 + randint1(26));
3055 /* Teleport player */
3056 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3060 /* Teleport player */
3061 teleport_player(40, TELEPORT_PASSIVE);
3063 /* Handle HP draining */
3064 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3066 char o_name[MAX_NLEN];
3068 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3070 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3072 msg_format("Your %s drains HP from you!", o_name);
3074 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3076 /* Handle mana draining */
3077 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3079 char o_name[MAX_NLEN];
3081 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3083 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3085 msg_format("Your %s drains mana from you!", o_name);
3087 p_ptr->csp -= MIN(p_ptr->lev, 50);
3091 p_ptr->csp_frac = 0;
3093 p_ptr->redraw |= PR_MANA;
3097 /* Rarely, take damage from the Jewel of Judgement */
3098 if (one_in_(999) && !p_ptr->anti_magic)
3100 object_type *o_ptr = &inventory[INVEN_LITE];
3102 if (o_ptr->name1 == ART_JUDGE)
3105 if (object_is_known(o_ptr))
3106 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3108 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3109 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3111 if (object_is_known(o_ptr))
3112 msg_print("The Jewel of Judgement drains life from you!");
3114 msg_print("Something drains life from you!");
3115 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3123 * Handle recharging objects once every 10 game turns
3125 static void process_world_aux_recharge(void)
3130 /* Process equipment */
3131 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3133 /* Get the object */
3134 object_type *o_ptr = &inventory[i];
3136 /* Skip non-objects */
3137 if (!o_ptr->k_idx) continue;
3139 /* Recharge activatable objects */
3140 if (o_ptr->timeout > 0)
3145 /* Notice changes */
3146 if (!o_ptr->timeout)
3148 recharged_notice(o_ptr);
3154 /* Notice changes */
3158 p_ptr->window |= (PW_EQUIP);
3163 * Recharge rods. Rods now use timeout to control charging status,
3164 * and each charging rod in a stack decreases the stack's timeout by
3165 * one per turn. -LM-
3167 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
3169 object_type *o_ptr = &inventory[i];
3170 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3172 /* Skip non-objects */
3173 if (!o_ptr->k_idx) continue;
3175 /* Examine all charging rods or stacks of charging rods. */
3176 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3178 /* Determine how many rods are charging. */
3179 int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3180 if (temp > o_ptr->number) temp = o_ptr->number;
3182 /* Decrease timeout by that number. */
3183 o_ptr->timeout -= temp;
3185 /* Boundary control. */
3186 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3188 /* Notice changes, provide message if object is inscribed. */
3189 if (!(o_ptr->timeout))
3191 recharged_notice(o_ptr);
3195 /* One of the stack of rod is charged */
3196 else if (o_ptr->timeout % k_ptr->pval)
3203 /* Notice changes */
3207 p_ptr->window |= (PW_INVEN);
3211 /* Process objects on floor */
3212 for (i = 1; i < o_max; i++)
3215 object_type *o_ptr = &o_list[i];
3217 /* Skip dead objects */
3218 if (!o_ptr->k_idx) continue;
3220 /* Recharge rods on the ground. No messages. */
3221 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3224 o_ptr->timeout -= o_ptr->number;
3226 /* Boundary control. */
3227 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3234 * Handle involuntary movement once every 10 game turns
3236 static void process_world_aux_movement(void)
3238 /* Delayed Word-of-Recall */
3239 if (p_ptr->word_recall)
3242 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3243 * The player is yanked up/down as soon as
3244 * he loads the autosaved game.
3246 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3247 do_cmd_save_game(TRUE);
3249 /* Count down towards recall */
3250 p_ptr->word_recall--;
3252 p_ptr->redraw |= (PR_STATUS);
3254 /* Activate the recall */
3255 if (!p_ptr->word_recall)
3260 /* Determine the level */
3261 if (dun_level || p_ptr->inside_quest)
3264 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3266 msg_print("You feel yourself yanked upwards!");
3269 p_ptr->recall_dungeon = dungeon_type;
3271 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3276 leave_quest_check();
3278 p_ptr->inside_quest = 0;
3280 p_ptr->leaving = TRUE;
3285 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3287 msg_print("You feel yourself yanked downwards!");
3290 dungeon_type = p_ptr->recall_dungeon;
3293 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3296 dun_level = max_dlv[dungeon_type];
3297 if (dun_level < 1) dun_level = 1;
3299 /* Nightmare mode makes recall more dangerous */
3300 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3306 else if (dun_level < 99)
3308 dun_level = (dun_level + 99) / 2;
3310 else if (dun_level > 100)
3312 dun_level = d_info[dungeon_type].maxdepth - 1;
3316 if (p_ptr->wild_mode)
3318 p_ptr->wilderness_y = py;
3319 p_ptr->wilderness_x = px;
3323 /* Save player position */
3327 p_ptr->wild_mode = FALSE;
3330 * Clear all saved floors
3331 * and create a first saved floor
3333 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3336 p_ptr->leaving = TRUE;
3338 if (dungeon_type == DUNGEON_ANGBAND)
3342 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3344 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
3345 (quest[i].status == QUEST_STATUS_TAKEN) &&
3346 (quest[i].level < dun_level))
3348 quest[i].status = QUEST_STATUS_FAILED;
3349 quest[i].complev = (byte)p_ptr->lev;
3350 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
3357 sound(SOUND_TPLEVEL);
3362 /* Delayed Alter reality */
3363 if (p_ptr->alter_reality)
3365 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3366 do_cmd_save_game(TRUE);
3368 /* Count down towards alter */
3369 p_ptr->alter_reality--;
3371 p_ptr->redraw |= (PR_STATUS);
3373 /* Activate the alter reality */
3374 if (!p_ptr->alter_reality)
3379 /* Determine the level */
3380 if (!quest_number(dun_level) && dun_level)
3383 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
3385 msg_print("The world changes!");
3389 * Clear all saved floors
3390 * and create a first saved floor
3392 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3395 p_ptr->leaving = TRUE;
3400 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
3402 msg_print("The world seems to change for a moment!");
3407 sound(SOUND_TPLEVEL);
3414 * Count number of adjacent monsters
3416 static int get_monster_crowd_number(int m_idx)
3418 monster_type *m_ptr = &m_list[m_idx];
3424 for (i = 0; i < 7; i++)
3426 int ay = my + ddy_ddd[i];
3427 int ax = mx + ddx_ddd[i];
3429 if (!in_bounds(ay, ax)) continue;
3431 /* Count number of monsters */
3432 if (cave[ay][ax].m_idx > 0) count++;
3441 * Dungeon rating is no longer linear
3443 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3446 * Examine all monsters and unidentified objects,
3447 * and get the feeling of current dungeon floor
3449 static byte get_dungeon_feeling(void)
3451 const int base = 10;
3455 /* Hack -- no feeling in the town */
3456 if (!dun_level) return 0;
3458 /* Examine each monster */
3459 for (i = 1; i < m_max; i++)
3461 monster_type *m_ptr = &m_list[i];
3462 monster_race *r_ptr;
3465 /* Skip dead monsters */
3466 if (!m_ptr->r_idx) continue;
3469 if (is_pet(m_ptr)) continue;
3471 r_ptr = &r_info[m_ptr->r_idx];
3473 /* Unique monsters */
3474 if (r_ptr->flags1 & (RF1_UNIQUE))
3476 /* Nearly out-of-depth unique monsters */
3477 if (r_ptr->level + 10 > dun_level)
3479 /* Boost rating by twice delta-depth */
3480 delta += (r_ptr->level + 10 - dun_level) * 2 * base;
3485 /* Out-of-depth monsters */
3486 if (r_ptr->level > dun_level)
3488 /* Boost rating by delta-depth */
3489 delta += (r_ptr->level - dun_level) * base;
3493 /* Unusually crowded monsters get a little bit of rating boost */
3494 if (r_ptr->flags1 & RF1_FRIENDS)
3496 if (5 <= get_monster_crowd_number(i)) delta += 1;
3500 if (2 <= get_monster_crowd_number(i)) delta += 1;
3504 rating += RATING_BOOST(delta);
3507 /* Examine each unidentified object */
3508 for (i = 1; i < o_max; i++)
3510 object_type *o_ptr = &o_list[i];
3511 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3514 /* Skip dead objects */
3515 if (!o_ptr->k_idx) continue;
3517 /* Skip known objects */
3518 if (object_is_known(o_ptr)) continue;
3520 /* Skip pseudo-known objects */
3521 if (o_ptr->ident & IDENT_SENSE) continue;
3524 if (object_is_ego(o_ptr))
3526 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3528 delta += e_ptr->rating * base;
3532 if (object_is_artifact(o_ptr))
3534 s32b cost = object_value_real(o_ptr);
3537 if (cost > 10000L) delta += 10 * base;
3538 if (cost > 50000L) delta += 10 * base;
3539 if (cost > 100000L) delta += 10 * base;
3541 /* Special feeling */
3542 if (!preserve_mode) return 1;
3545 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3546 if (o_ptr->tval == TV_SHIELD &&
3547 o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3548 if (o_ptr->tval == TV_GLOVES &&
3549 o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3550 if (o_ptr->tval == TV_BOOTS &&
3551 o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3552 if (o_ptr->tval == TV_HELM &&
3553 o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3554 if (o_ptr->tval == TV_RING &&
3555 o_ptr->sval == SV_RING_SPEED &&
3556 !object_is_cursed(o_ptr)) delta += 25 * base;
3557 if (o_ptr->tval == TV_RING &&
3558 o_ptr->sval == SV_RING_LORDLY &&
3559 !object_is_cursed(o_ptr)) delta += 15 * base;
3560 if (o_ptr->tval == TV_AMULET &&
3561 o_ptr->sval == SV_AMULET_THE_MAGI &&
3562 !object_is_cursed(o_ptr)) delta += 15 * base;
3564 /* Out-of-depth objects */
3565 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
3566 k_ptr->level > dun_level)
3568 /* Rating increase */
3569 delta += (k_ptr->level - dun_level) * base;
3572 rating += RATING_BOOST(delta);
3576 if (rating > RATING_BOOST(1000)) return 2;
3577 if (rating > RATING_BOOST(800)) return 3;
3578 if (rating > RATING_BOOST(600)) return 4;
3579 if (rating > RATING_BOOST(400)) return 5;
3580 if (rating > RATING_BOOST(300)) return 6;
3581 if (rating > RATING_BOOST(200)) return 7;
3582 if (rating > RATING_BOOST(100)) return 8;
3583 if (rating > RATING_BOOST(0)) return 9;
3590 * Update dungeon feeling, and announce it if changed
3592 static void update_dungeon_feeling(void)
3598 /* No feeling on the surface */
3599 if (!dun_level) return;
3601 /* No feeling in the arena */
3602 if (p_ptr->inside_battle) return;
3604 /* Extract delay time */
3605 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
3607 /* Not yet felt anything */
3608 if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3610 /* Extract quest number (if any) */
3611 quest_num = quest_number(dun_level);
3613 /* No feeling in a quest */
3615 (is_fixed_quest_idx(quest_num) &&
3616 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3617 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3620 /* Get new dungeon feeling */
3621 new_feeling = get_dungeon_feeling();
3623 /* Remember last time updated */
3624 p_ptr->feeling_turn = turn;
3627 if (p_ptr->feeling == new_feeling) return;
3629 /* Dungeon feeling is changed */
3630 p_ptr->feeling = new_feeling;
3632 /* Announce feeling */
3635 /* Update the level indicator */
3636 p_ptr->redraw |= (PR_DEPTH);
3639 if (disturb_minor) disturb(0, 0);
3644 * Handle certain things once every 10 game turns
3646 static void process_world(void)
3650 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3651 s32b prev_turn_in_today = ((turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3652 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3654 extract_day_hour_min(&day, &hour, &min);
3656 /* Update dungeon feeling, and announce it if changed */
3657 update_dungeon_feeling();
3659 /*** Check monster arena ***/
3660 if (p_ptr->inside_battle && !p_ptr->leaving)
3666 /* Count all hostile monsters */
3667 for (i2 = 0; i2 < cur_wid; ++i2)
3668 for (j2 = 0; j2 < cur_hgt; j2++)
3670 cave_type *c_ptr = &cave[j2][i2];
3672 if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
3675 win_m_idx = c_ptr->m_idx;
3679 if (number_mon == 0)
3682 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
3684 msg_print("They have kill each other at the same time.");
3687 p_ptr->energy_need = 0;
3690 else if ((number_mon-1) == 0)
3693 monster_type *wm_ptr;
3695 wm_ptr = &m_list[win_m_idx];
3697 monster_desc(m_name, wm_ptr, 0);
3699 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
3701 msg_format("%s is winner!", m_name);
3705 if (win_m_idx == (sel_monster+1))
3708 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
3710 msg_print("Congratulations.");
3713 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
3715 msg_format("You received %d gold.", battle_odds);
3717 p_ptr->au += battle_odds;
3722 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
3724 msg_print("You lost gold.");
3728 p_ptr->energy_need = 0;
3731 else if (turn - old_turn == 150*TURNS_PER_TICK)
3734 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
3736 msg_format("This battle have ended in a draw.");
3738 p_ptr->au += kakekin;
3740 p_ptr->energy_need = 0;
3745 /* Every 10 game turns */
3746 if (turn % TURNS_PER_TICK) return;
3748 /*** Check the Time and Load ***/
3750 if (!(turn % (50*TURNS_PER_TICK)))
3752 /* Check time and load */
3753 if ((0 != check_time()) || (0 != check_load()))
3756 if (closing_flag <= 2)
3761 /* Count warnings */
3766 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
3767 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
3769 msg_print("The gates to ANGBAND are closing...");
3770 msg_print("Please finish up and/or save your game.");
3780 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
3782 msg_print("The gates to ANGBAND are now closed.");
3787 p_ptr->playing = FALSE;
3790 p_ptr->leaving = TRUE;
3795 /*** Attempt timed autosave ***/
3796 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3798 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3799 do_cmd_save_game(TRUE);
3802 if (mon_fight && !ignore_unview)
3805 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
3807 msg_print("You hear noise.");
3811 /*** Handle the wilderness/town (sunshine) ***/
3813 /* While in town/wilderness */
3814 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3816 /* Hack -- Daybreak/Nighfall in town */
3817 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3821 /* Check for dawn */
3822 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
3831 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
3833 msg_print("The sun has risen.");
3836 if (!p_ptr->wild_mode)
3838 /* Hack -- Scan the town */
3839 for (y = 0; y < cur_hgt; y++)
3841 for (x = 0; x < cur_wid; x++)
3843 /* Get the cave grid */
3844 cave_type *c_ptr = &cave[y][x];
3847 c_ptr->info |= (CAVE_GLOW);
3849 /* Hack -- Memorize lit grids if allowed */
3850 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
3852 /* Hack -- Notice spot */
3866 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
3868 msg_print("The sun has fallen.");
3871 if (!p_ptr->wild_mode)
3873 /* Hack -- Scan the town */
3874 for (y = 0; y < cur_hgt; y++)
3876 for (x = 0; x < cur_wid; x++)
3878 /* Get the cave grid */
3879 cave_type *c_ptr = &cave[y][x];
3881 /* Feature code (applying "mimic" field) */
3882 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
3884 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
3885 !have_flag(f_ptr->flags, FF_ENTRANCE))
3888 c_ptr->info &= ~(CAVE_GLOW);
3890 if (!have_flag(f_ptr->flags, FF_REMEMBER))
3892 /* Forget the normal floor grid */
3893 c_ptr->info &= ~(CAVE_MARK);
3895 /* Hack -- Notice spot */
3901 /* Glow deep lava and building entrances */
3902 glow_deep_lava_and_bldg();
3907 /* Update the monsters */
3908 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3911 p_ptr->redraw |= (PR_MAP);
3914 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3916 if (p_ptr->special_defense & NINJA_S_STEALTH)
3918 if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
3923 /* While in the dungeon (vanilla_town or lite_town mode only) */
3924 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
3926 /*** Shuffle the Storekeepers ***/
3928 /* Chance is only once a day (while in dungeon) */
3929 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
3931 /* Sometimes, shuffle the shop-keepers */
3932 if (one_in_(STORE_SHUFFLE))
3936 /* Pick a random shop (except home and museum) */
3939 n = randint0(MAX_STORES);
3941 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3943 /* Check every feature */
3944 for (i = 1; i < max_f_idx; i++)
3946 /* Access the index */
3947 feature_type *f_ptr = &f_info[i];
3949 /* Skip empty index */
3950 if (!f_ptr->name) continue;
3952 /* Skip non-store features */
3953 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3955 /* Verify store type */
3956 if (f_ptr->power == n)
3960 if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_ptr->name);
3962 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_ptr->name);
3976 /*** Process the monsters ***/
3978 /* Check for creature generation. */
3979 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
3980 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3982 /* Make a new monster */
3983 (void)alloc_monster(MAX_SIGHT + 5, 0);
3986 /* Hack -- Check for creature regeneration */
3987 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
3988 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
3990 if (!p_ptr->leaving)
3994 /* Hack -- Process the counters of monsters if needed */
3995 for (i = 0; i < MAX_MTIMED; i++)
3997 if (mproc_max[i] > 0) process_monsters_mtimed(i);
4005 if (min != prev_min)
4007 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
4008 determine_today_mon(FALSE);
4013 * Nightmare mode activates the TY_CURSE at midnight
4015 * Require exact minute -- Don't activate multiple times in a minute
4017 if (ironman_nightmare && (min != prev_min))
4019 /* Every 15 minutes after 11:00 pm */
4020 if ((hour == 23) && !(min % 15))
4029 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
4031 msg_print("You hear a distant bell toll ominously.");
4037 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
4039 msg_print("A distant bell sounds twice.");
4045 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
4047 msg_print("A distant bell sounds three times.");
4053 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
4055 msg_print("A distant bell tolls four times.");
4061 /* TY_CURSE activates at midnight! */
4068 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
4070 msg_print("A distant bell tolls many times, fading into an deathly silence.");
4073 activate_ty_curse(FALSE, &count);
4078 /*** Check the Food, and Regenerate ***/
4080 if (!p_ptr->inside_battle)
4082 /* Digest quickly when gorged */
4083 if (p_ptr->food >= PY_FOOD_MAX)
4085 /* Digest a lot of food */
4086 (void)set_food(p_ptr->food - 100);
4089 /* Digest normally -- Every 50 game turns */
4090 else if (!(turn % (TURNS_PER_TICK*5)))
4092 /* Basic digestion rate based on speed */
4093 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
4095 /* Regeneration takes more food */
4096 if (p_ptr->regenerate)
4098 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
4100 if (p_ptr->cursed & TRC_FAST_DIGEST)
4103 /* Slow digestion takes less food */
4104 if (p_ptr->slow_digest)
4107 /* Minimal digestion */
4108 if (digestion < 1) digestion = 1;
4109 /* Maximal digestion */
4110 if (digestion > 100) digestion = 100;
4112 /* Digest some food */
4113 (void)set_food(p_ptr->food - digestion);
4118 if ((p_ptr->food < PY_FOOD_FAINT))
4120 /* Faint occasionally */
4121 if (!p_ptr->paralyzed && (randint0(100) < 10))
4125 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
4127 msg_print("You faint from the lack of food.");
4132 /* Hack -- faint (bypass free action) */
4133 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
4136 /* Starve to death (slowly) */
4137 if (p_ptr->food < PY_FOOD_STARVE)
4139 /* Calculate damage */
4140 int dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
4144 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "¶õÊ¢", -1);
4146 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "starvation", -1);
4154 /* Process timed damage and regeneration */
4155 process_world_aux_hp_and_sp();
4157 /* Process timeout */
4158 process_world_aux_timeout();
4161 process_world_aux_light();
4163 /* Process mutation effects */
4164 process_world_aux_mutation();
4166 /* Process curse effects */
4167 process_world_aux_curse();
4169 /* Process recharging */
4170 process_world_aux_recharge();
4172 /* Feel the inventory */
4176 /* Involuntary Movement */
4177 process_world_aux_movement();
4183 * Verify use of "wizard" mode
4185 static bool enter_wizard_mode(void)
4187 /* Ask first time */
4188 if (!p_ptr->noscore)
4190 /* Wizard mode is not permitted */
4191 if (!allow_debug_opts || arg_wizard)
4194 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4196 msg_print("Wizard mode is not permitted.");
4201 /* Mention effects */
4203 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4204 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4206 msg_print("Wizard mode is for debugging and experimenting.");
4207 msg_print("The game will not be scored if you enter wizard mode.");
4212 /* Verify request */
4214 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4216 if (!get_check("Are you sure you want to enter wizard mode? "))
4223 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4225 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4228 p_ptr->noscore |= 0x0002;
4239 * Verify use of "debug" commands
4241 static bool enter_debug_mode(void)
4243 /* Ask first time */
4244 if (!p_ptr->noscore)
4246 /* Debug mode is not permitted */
4247 if (!allow_debug_opts)
4250 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4252 msg_print("Use of debug command is not permitted.");
4257 /* Mention effects */
4259 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4260 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4262 msg_print("The debug commands are for debugging and experimenting.");
4263 msg_print("The game will not be scored if you use debug commands.");
4268 /* Verify request */
4270 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4272 if (!get_check("Are you sure you want to use debug commands? "))
4279 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4281 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4284 p_ptr->noscore |= 0x0008;
4292 * Hack -- Declare the Debug Routines
4294 extern void do_cmd_debug(void);
4296 #endif /* ALLOW_WIZARD */
4302 * Verify use of "borg" commands
4304 static bool enter_borg_mode(void)
4306 /* Ask first time */
4307 if (!(p_ptr->noscore & 0x0010))
4309 /* Mention effects */
4311 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4312 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4314 msg_print("The borg commands are for debugging and experimenting.");
4315 msg_print("The game will not be scored if you use borg commands.");
4320 /* Verify request */
4322 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4324 if (!get_check("Are you sure you want to use borg commands? "))
4331 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4333 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4336 p_ptr->noscore |= 0x0010;
4344 * Hack -- Declare the Ben Borg
4346 extern void do_cmd_borg(void);
4348 #endif /* ALLOW_BORG */
4353 * Parse and execute the current command
4354 * Give "Warning" on illegal commands.
4356 * XXX XXX XXX Make some "blocks"
4358 static void process_command(void)
4360 int old_now_message = now_message;
4362 #ifdef ALLOW_REPEAT /* TNB */
4364 /* Handle repeating the last command */
4367 #endif /* ALLOW_REPEAT -- TNB */
4371 /* Parse the command */
4372 switch (command_cmd)
4388 /*** Wizard Commands ***/
4390 /* Toggle Wizard Mode */
4395 p_ptr->wizard = FALSE;
4397 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4399 msg_print("Wizard mode off.");
4403 else if (enter_wizard_mode())
4405 p_ptr->wizard = TRUE;
4407 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4409 msg_print("Wizard mode on.");
4414 /* Update monsters */
4415 p_ptr->update |= (PU_MONSTERS);
4417 /* Redraw "title" */
4418 p_ptr->redraw |= (PR_TITLE);
4426 /* Special "debug" commands */
4429 /* Enter debug mode */
4430 if (enter_debug_mode())
4437 #endif /* ALLOW_WIZARD */
4442 /* Special "borg" commands */
4445 /* Enter borg mode */
4446 if (enter_borg_mode())
4448 if (!p_ptr->wild_mode) do_cmd_borg();
4454 #endif /* ALLOW_BORG */
4458 /*** Inventory Commands ***/
4460 /* Wear/wield equipment */
4463 if (!p_ptr->wild_mode) do_cmd_wield();
4467 /* Take off equipment */
4470 if (!p_ptr->wild_mode) do_cmd_takeoff();
4477 if (!p_ptr->wild_mode) do_cmd_drop();
4481 /* Destroy an item */
4488 /* Equipment list */
4495 /* Inventory list */
4503 /*** Various commands ***/
4505 /* Identify an object */
4512 /* Hack -- toggle windows */
4515 toggle_inven_equip();
4520 /*** Standard "Movement" Commands ***/
4525 if (!p_ptr->wild_mode) do_cmd_alter();
4532 if (!p_ptr->wild_mode) do_cmd_tunnel();
4536 /* Move (usually pick up things) */
4539 #ifdef ALLOW_EASY_DISARM /* TNB */
4543 #else /* ALLOW_EASY_DISARM -- TNB */
4545 do_cmd_walk(always_pickup);
4547 #endif /* ALLOW_EASY_DISARM -- TNB */
4552 /* Move (usually do not pick up) */
4555 #ifdef ALLOW_EASY_DISARM /* TNB */
4559 #else /* ALLOW_EASY_DISARM -- TNB */
4561 do_cmd_walk(!always_pickup);
4563 #endif /* ALLOW_EASY_DISARM -- TNB */
4569 /*** Running, Resting, Searching, Staying */
4571 /* Begin Running -- Arg is Max Distance */
4574 if (!p_ptr->wild_mode) do_cmd_run();
4578 /* Stay still (usually pick things up) */
4581 do_cmd_stay(always_pickup);
4585 /* Stay still (usually do not pick up) */
4588 do_cmd_stay(!always_pickup);
4592 /* Rest -- Arg is time */
4599 /* Search for traps/doors */
4606 /* Toggle search mode */
4609 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4610 else set_action(ACTION_SEARCH);
4615 /*** Stairs and Doors and Chests and Traps ***/
4618 case SPECIAL_KEY_STORE:
4620 if (!p_ptr->wild_mode) do_cmd_store();
4624 /* Enter building -KMW- */
4625 case SPECIAL_KEY_BUILDING:
4627 if (!p_ptr->wild_mode) do_cmd_bldg();
4631 /* Enter quest level -KMW- */
4632 case SPECIAL_KEY_QUEST:
4634 if (!p_ptr->wild_mode) do_cmd_quest();
4638 /* Go up staircase */
4641 if (!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4643 if (vanilla_town) break;
4648 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4650 msg_print("To flee the ambush you have to reach the edge of the map.");
4655 if (p_ptr->food < PY_FOOD_WEAK)
4658 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4660 msg_print("You must eat something here.");
4672 /* Go down staircase */
4675 if (p_ptr->wild_mode)
4683 /* Open a door or chest */
4686 if (!p_ptr->wild_mode) do_cmd_open();
4693 if (!p_ptr->wild_mode) do_cmd_close();
4697 /* Jam a door with spikes */
4700 if (!p_ptr->wild_mode) do_cmd_spike();
4707 if (!p_ptr->wild_mode) do_cmd_bash();
4711 /* Disarm a trap or chest */
4714 if (!p_ptr->wild_mode) do_cmd_disarm();
4719 /*** Magic and Prayers ***/
4721 /* Gain new spells/prayers */
4724 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4726 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4728 msg_print("You don't have to learn spells!");
4730 else if (p_ptr->pclass == CLASS_SAMURAI)
4731 do_cmd_gain_hissatsu();
4732 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4742 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4743 (p_ptr->pclass == CLASS_BERSERKER) ||
4744 (p_ptr->pclass == CLASS_NINJA) ||
4745 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4746 ) do_cmd_mind_browse();
4747 else if (p_ptr->pclass == CLASS_SMITH)
4749 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4750 do_cmd_magic_eater(TRUE);
4751 else do_cmd_browse();
4759 if (!p_ptr->wild_mode)
4761 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4764 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4766 msg_print("You cannot cast spells!");
4769 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4772 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4774 msg_print("The dungeon absorbs all attempted magic!");
4778 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4782 cptr which_power = "ËâË¡";
4784 cptr which_power = "magic";
4786 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4788 which_power = "ĶǽÎÏ";
4790 which_power = "psionic powers";
4792 else if (p_ptr->pclass == CLASS_IMITATOR)
4794 which_power = "¤â¤Î¤Þ¤Í";
4796 which_power = "imitation";
4798 else if (p_ptr->pclass == CLASS_SAMURAI)
4800 which_power = "ɬ»¦·õ";
4802 which_power = "hissatsu";
4804 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4806 which_power = "¶ÀËâË¡";
4808 which_power = "mirror magic";
4810 else if (p_ptr->pclass == CLASS_NINJA)
4812 which_power = "Ǧ½Ñ";
4814 which_power = "ninjutsu";
4816 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4818 which_power = "µ§¤ê";
4820 which_power = "prayer";
4824 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4826 msg_format("An anti-magic shell disrupts your %s!", which_power);
4830 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4833 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4835 msg_format("You cannot think directly!");
4841 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4842 (p_ptr->pclass == CLASS_BERSERKER) ||
4843 (p_ptr->pclass == CLASS_NINJA) ||
4844 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4847 else if (p_ptr->pclass == CLASS_IMITATOR)
4849 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4850 do_cmd_magic_eater(FALSE);
4851 else if (p_ptr->pclass == CLASS_SAMURAI)
4853 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4854 do_cmd_cast_learned();
4855 else if (p_ptr->pclass == CLASS_SMITH)
4864 /* Issue a pet command */
4867 if (!p_ptr->wild_mode) do_cmd_pet();
4871 /*** Use various objects ***/
4873 /* Inscribe an object */
4880 /* Uninscribe an object */
4883 do_cmd_uninscribe();
4887 /* Activate an artifact */
4890 if (!p_ptr->wild_mode)
4892 if (!p_ptr->inside_arena)
4897 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4899 msg_print("The arena absorbs all attempted magic!");
4915 /* Fuel your lantern/torch */
4925 if (!p_ptr->wild_mode) do_cmd_fire();
4932 if (!p_ptr->wild_mode)
4942 if (!p_ptr->wild_mode)
4944 if (!p_ptr->inside_arena)
4949 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4951 msg_print("The arena absorbs all attempted magic!");
4963 if (!p_ptr->wild_mode)
4965 if (p_ptr->inside_arena)
4968 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4970 msg_print("The arena absorbs all attempted magic!");
4975 else if (use_command && rogue_like_commands)
4987 /* Quaff a potion */
4990 if (!p_ptr->wild_mode)
4992 if (!p_ptr->inside_arena)
4993 do_cmd_quaff_potion();
4997 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4999 msg_print("The arena absorbs all attempted magic!");
5011 if (!p_ptr->wild_mode)
5013 if (!p_ptr->inside_arena)
5014 do_cmd_read_scroll();
5018 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5020 msg_print("The arena absorbs all attempted magic!");
5032 if (!p_ptr->wild_mode)
5034 if (p_ptr->inside_arena)
5037 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5039 msg_print("The arena absorbs all attempted magic!");
5044 else if (use_command && !rogue_like_commands)
5054 /* Use racial power */
5057 if (!p_ptr->wild_mode) do_cmd_racial_power();
5062 /*** Looking at Things (nearby or on map) ***/
5064 /* Full dungeon map */
5071 /* Locate player on map */
5085 /* Target monster or location */
5088 if (!p_ptr->wild_mode) do_cmd_target();
5094 /*** Help and Such ***/
5103 /* Identify symbol */
5106 do_cmd_query_symbol();
5110 /* Character description */
5113 do_cmd_change_name();
5118 /*** System Commands ***/
5120 /* Hack -- User interface */
5127 /* Single line from a pref file */
5136 do_cmd_reload_autopick();
5142 do_cmd_edit_autopick();
5146 /* Interact with macros */
5153 /* Interact with visuals */
5161 /* Interact with colors */
5169 /* Interact with options */
5177 /*** Misc Commands ***/
5193 /* Repeat level feeling */
5196 if (!p_ptr->wild_mode) do_cmd_feeling();
5200 /* Show previous message */
5203 do_cmd_message_one();
5207 /* Show previous messages */
5210 do_cmd_messages(old_now_message);
5214 /* Show quest status -KMW- */
5217 do_cmd_checkquest();
5221 /* Redraw the screen */
5224 now_message = old_now_message;
5229 #ifndef VERIFY_SAVEFILE
5231 /* Hack -- Save and don't quit */
5234 do_cmd_save_game(FALSE);
5238 #endif /* VERIFY_SAVEFILE */
5248 case SPECIAL_KEY_QUIT:
5250 do_cmd_save_and_exit();
5254 /* Quit (commit suicide) */
5267 /* Check artifacts, uniques, objects */
5274 /* Load "screen dump" */
5277 do_cmd_load_screen();
5281 /* Save "screen dump" */
5284 do_cmd_save_screen();
5288 /* Make random artifact list */
5291 spoil_random_artifact("randifact.txt");
5295 /* Hack -- Unknown command */
5298 if (flush_failure) flush();
5302 sound(SOUND_ILLEGAL);
5304 if (!get_rnd_line("error_j.txt", 0, error_m))
5306 if (!get_rnd_line("error.txt", 0, error_m))
5313 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5315 prt("Type '?' for help.", 0, 0);
5321 if (!energy_use && !now_message)
5322 now_message = old_now_message;
5328 static bool monster_tsuri(int r_idx)
5330 monster_race *r_ptr = &r_info[r_idx];
5332 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
5340 * Process the player
5342 * Notice the annoying code to handle "pack overflow", which
5343 * must come first just in case somebody manages to corrupt
5344 * the savefiles by clever use of menu commands or something.
5346 static void process_player(void)
5350 /*** Apply energy ***/
5355 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5357 msg_print("You feel different!");
5360 (void)gain_random_mutation(0);
5361 hack_mutation = FALSE;
5364 if (p_ptr->inside_battle)
5366 for(i = 1; i < m_max; i++)
5368 monster_type *m_ptr = &m_list[i];
5370 if (!m_ptr->r_idx) continue;
5372 /* Hack -- Detect monster */
5373 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5375 /* Update the monster */
5376 update_mon(i, FALSE);
5381 /* Give the player some energy */
5382 else if (!(load && p_ptr->energy_need <= 0))
5384 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5388 if (p_ptr->energy_need > 0) return;
5389 if (!command_rep) prt_time();
5391 /*** Check for interupts ***/
5393 /* Complete resting */
5400 if ((p_ptr->chp == p_ptr->mhp) &&
5401 (p_ptr->csp >= p_ptr->msp))
5403 set_action(ACTION_NONE);
5407 /* Complete resting */
5408 else if (resting == -2)
5411 if ((p_ptr->chp == p_ptr->mhp) &&
5412 (p_ptr->csp >= p_ptr->msp) &&
5413 !p_ptr->blind && !p_ptr->confused &&
5414 !p_ptr->poisoned && !p_ptr->afraid &&
5415 !p_ptr->stun && !p_ptr->cut &&
5416 !p_ptr->slow && !p_ptr->paralyzed &&
5417 !p_ptr->image && !p_ptr->word_recall &&
5418 !p_ptr->alter_reality)
5420 set_action(ACTION_NONE);
5425 if (p_ptr->action == ACTION_FISH)
5428 Term_xtra(TERM_XTRA_DELAY, 10);
5432 bool success = FALSE;
5433 get_mon_num_prep(monster_tsuri,NULL);
5434 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5436 if (r_idx && one_in_(2))
5439 y = py+ddy[tsuri_dir];
5440 x = px+ddx[tsuri_dir];
5441 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5444 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5446 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5448 msg_format("You have a good catch!", m_name);
5456 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5458 msg_print("Damn! The fish stole your bait!");
5465 /* Handle "abort" */
5468 /* Check for "player abort" (semi-efficiently for resting) */
5469 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5474 /* Check for a key */
5483 /* Hack -- Show a Message */
5485 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5487 msg_print("Canceled.");
5494 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5496 monster_type *m_ptr = &m_list[p_ptr->riding];
5497 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5499 if (MON_CSLEEP(m_ptr))
5504 (void)set_monster_csleep(p_ptr->riding, 0);
5506 /* Acquire the monster name */
5507 monster_desc(m_name, m_ptr, 0);
5509 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5511 msg_format("You have waked %s up.", m_name);
5515 if (MON_STUNNED(m_ptr))
5517 /* Hack -- Recover from stun */
5518 if (set_monster_stunned(p_ptr->riding,
5519 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
5523 /* Acquire the monster name */
5524 monster_desc(m_name, m_ptr, 0);
5526 /* Dump a message */
5528 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5530 msg_format("%^s is no longer stunned.", m_name);
5535 if (MON_CONFUSED(m_ptr))
5537 /* Hack -- Recover from confusion */
5538 if (set_monster_confused(p_ptr->riding,
5539 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
5543 /* Acquire the monster name */
5544 monster_desc(m_name, m_ptr, 0);
5546 /* Dump a message */
5548 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5550 msg_format("%^s is no longer confused.", m_name);
5555 if (MON_MONFEAR(m_ptr))
5557 /* Hack -- Recover from fear */
5558 if (set_monster_monfear(p_ptr->riding,
5559 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
5563 /* Acquire the monster name */
5564 monster_desc(m_name, m_ptr, 0);
5566 /* Dump a message */
5568 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5570 msg_format("%^s is no longer fear.", m_name);
5575 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5579 /* Handle the player song */
5580 if (!load) check_music();
5585 if (p_ptr->lightspeed)
5587 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5589 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5591 if (p_ptr->magic_num1[0] < 40)
5593 p_ptr->magic_num1[0] = 0;
5595 else p_ptr->magic_num1[0] -= 40;
5596 p_ptr->update |= (PU_BONUS);
5598 if (p_ptr->action == ACTION_LEARN)
5601 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
5603 /* Convert the unit (1/2^16) to (1/2^32) */
5604 s64b_LSHIFT(cost, cost_frac, 16);
5607 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
5611 p_ptr->csp_frac = 0;
5612 set_action(ACTION_NONE);
5617 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
5619 p_ptr->redraw |= PR_MANA;
5622 if (p_ptr->special_defense & KATA_MASK)
5624 if (p_ptr->special_defense & KATA_MUSOU)
5628 set_action(ACTION_NONE);
5633 p_ptr->redraw |= (PR_MANA);
5638 /*** Handle actual user input ***/
5640 /* Repeat until out of energy */
5641 while (p_ptr->energy_need <= 0)
5643 p_ptr->window |= PW_PLAYER;
5644 p_ptr->sutemi = FALSE;
5645 p_ptr->counter = FALSE;
5646 now_damaged = FALSE;
5648 /* Handle "p_ptr->notice" */
5651 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5654 /* Place the cursor on the player */
5655 move_cursor_relative(py, px);
5657 /* Refresh (optional) */
5658 if (fresh_before) Term_fresh();
5661 /* Hack -- Pack Overflow */
5662 if (inventory[INVEN_PACK].k_idx)
5664 int item = INVEN_PACK;
5666 char o_name[MAX_NLEN];
5670 /* Access the slot to be dropped */
5671 o_ptr = &inventory[item];
5678 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5680 msg_print("Your pack overflows!");
5685 object_desc(o_name, o_ptr, 0);
5689 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5691 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5695 /* Drop it (carefully) near the player */
5696 (void)drop_near(o_ptr, 0, py, px);
5698 /* Modify, Describe, Optimize */
5699 inven_item_increase(item, -255);
5700 inven_item_describe(item);
5701 inven_item_optimize(item);
5703 /* Handle "p_ptr->notice" */
5706 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5711 /* Hack -- cancel "lurking browse mode" */
5712 if (!command_new) command_see = FALSE;
5715 /* Assume free turn */
5719 if (p_ptr->inside_battle)
5721 /* Place the cursor on the player */
5722 move_cursor_relative(py, px);
5724 command_cmd = SPECIAL_KEY_BUILDING;
5726 /* Process the command */
5730 /* Paralyzed or Knocked Out */
5731 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5738 else if (p_ptr->action == ACTION_REST)
5743 /* Reduce rest count */
5746 if (!resting) set_action(ACTION_NONE);
5748 /* Redraw the state */
5749 p_ptr->redraw |= (PR_STATE);
5757 else if (p_ptr->action == ACTION_FISH)
5770 /* Repeated command */
5771 else if (command_rep)
5773 /* Count this execution */
5776 /* Redraw the state */
5777 p_ptr->redraw |= (PR_STATE);
5782 /* Hack -- Assume messages were seen */
5785 /* Clear the top line */
5788 /* Process the command */
5792 /* Normal command */
5795 /* Place the cursor on the player */
5796 move_cursor_relative(py, px);
5799 /* Get a command (normal) */
5800 request_command(FALSE);
5803 /* Process the command */
5813 /* Use some energy */
5814 if (world_player || energy_use > 400)
5816 /* The Randomness is irrelevant */
5817 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5821 /* There is some randomness of needed energy */
5822 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5825 /* Hack -- constant hallucination */
5826 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5829 /* Shimmer monsters if needed */
5830 if (shimmer_monsters)
5832 /* Clear the flag */
5833 shimmer_monsters = FALSE;
5835 /* Shimmer multi-hued monsters */
5836 for (i = 1; i < m_max; i++)
5838 monster_type *m_ptr;
5839 monster_race *r_ptr;
5841 /* Access monster */
5844 /* Skip dead monsters */
5845 if (!m_ptr->r_idx) continue;
5847 /* Skip unseen monsters */
5848 if (!m_ptr->ml) continue;
5850 /* Access the monster race */
5851 r_ptr = &r_info[m_ptr->ap_r_idx];
5853 /* Skip non-multi-hued monsters */
5854 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5857 /* Reset the flag */
5858 shimmer_monsters = TRUE;
5860 /* Redraw regardless */
5861 lite_spot(m_ptr->fy, m_ptr->fx);
5866 /* Handle monster detection */
5867 if (repair_monsters)
5869 /* Reset the flag */
5870 repair_monsters = FALSE;
5872 /* Rotate detection flags */
5873 for (i = 1; i < m_max; i++)
5875 monster_type *m_ptr;
5877 /* Access monster */
5880 /* Skip dead monsters */
5881 if (!m_ptr->r_idx) continue;
5883 /* Nice monsters get mean */
5884 if (m_ptr->mflag & MFLAG_NICE)
5886 /* Nice monsters get mean */
5887 m_ptr->mflag &= ~(MFLAG_NICE);
5890 /* Handle memorized monsters */
5891 if (m_ptr->mflag2 & MFLAG2_MARK)
5893 /* Maintain detection */
5894 if (m_ptr->mflag2 & MFLAG2_SHOW)
5897 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
5899 /* Still need repairs */
5900 repair_monsters = TRUE;
5903 /* Remove detection */
5907 m_ptr->mflag2 &= ~(MFLAG2_MARK);
5909 /* Assume invisible */
5912 /* Update the monster */
5913 update_mon(i, FALSE);
5915 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
5916 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
5918 /* Redraw regardless */
5919 lite_spot(m_ptr->fy, m_ptr->fx);
5924 if (p_ptr->pclass == CLASS_IMITATOR)
5926 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5929 for (i = 0; i < p_ptr->mane_num; i++)
5931 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
5932 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
5936 p_ptr->redraw |= (PR_MANE);
5938 if (p_ptr->action == ACTION_LEARN)
5941 p_ptr->redraw |= (PR_STATE);
5944 if (world_player && (p_ptr->energy_need > - 1000))
5947 p_ptr->redraw |= (PR_MAP);
5949 /* Update monsters */
5950 p_ptr->update |= (PU_MONSTERS);
5953 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5956 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
5958 msg_print("You feel time flowing around you once more.");
5961 world_player = FALSE;
5962 p_ptr->energy_need = ENERGY_NEED();
5964 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5969 /* Hack -- notice death */
5970 if (!p_ptr->playing || p_ptr->is_dead)
5972 world_player = FALSE;
5976 /* Handle "leaving" */
5977 if (p_ptr->leaving) break;
5980 /* Update scent trail */
5986 * Interact with the current dungeon level.
5988 * This function will not exit until the level is completed,
5989 * the user dies, or the game is terminated.
5991 static void dungeon(bool load_game)
5995 /* Set the base level */
5996 base_level = dun_level;
5998 /* Reset various flags */
6002 p_ptr->leaving = FALSE;
6004 /* Reset the "command" vars */
6007 #if 0 /* Don't reset here --- It's used for Arena */
6016 /* Cancel the target */
6020 ambush_flag = FALSE;
6022 /* Cancel the health bar */
6025 /* Check visual effects */
6026 shimmer_monsters = TRUE;
6027 shimmer_objects = TRUE;
6028 repair_monsters = TRUE;
6029 repair_objects = TRUE;
6035 /* Get index of current quest (if any) */
6036 quest_num = quest_number(dun_level);
6038 /* Inside a quest? */
6041 /* Mark the quest monster */
6042 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6045 /* Track maximum player level */
6046 if (p_ptr->max_plv < p_ptr->lev)
6048 p_ptr->max_plv = p_ptr->lev;
6052 /* Track maximum dungeon level (if not in quest -KMW-) */
6053 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6055 max_dlv[dungeon_type] = dun_level;
6056 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6059 /* Validate the panel */
6060 panel_bounds_center();
6062 /* Verify the panel */
6065 /* Flush messages */
6069 /* Enter "xtra" mode */
6070 character_xtra = TRUE;
6073 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6075 /* Redraw dungeon */
6076 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6079 p_ptr->redraw |= (PR_MAP);
6082 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6084 /* Update lite/view */
6085 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6087 /* Update monsters */
6088 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6090 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6093 /* Leave "xtra" mode */
6094 character_xtra = FALSE;
6097 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6099 /* Combine / Reorder the pack */
6100 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6102 /* Handle "p_ptr->notice" */
6105 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6111 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6112 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6113 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6115 if (p_ptr->inside_battle)
6119 p_ptr->energy_need = 0;
6125 msg_print("»î¹ç³«»Ï¡ª");
6127 msg_format("Ready..Fight!");
6133 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6134 p_ptr->magic_num1[0] = MUSIC_DETECT;
6136 /* Hack -- notice death or departure */
6137 if (!p_ptr->playing || p_ptr->is_dead) return;
6139 /* Print quest message if appropriate */
6140 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6142 quest_discovery(random_quest_number(dun_level));
6143 p_ptr->inside_quest = random_quest_number(dun_level);
6145 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6147 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6149 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6150 d_name+d_info[dungeon_type].name,
6151 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6153 msg_format("%^s lives in this level as the keeper of %s.",
6154 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6155 d_name+d_info[dungeon_type].name);
6159 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
6161 /*** Process this dungeon level ***/
6163 /* Reset the monster generation level */
6164 monster_level = base_level;
6166 /* Reset the object generation level */
6167 object_level = base_level;
6171 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6172 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6173 p_ptr->energy_need = 0;
6175 /* Not leaving dungeon */
6176 p_ptr->leaving_dungeon = FALSE;
6178 /* Initialize monster process */
6184 /* Hack -- Compact the monster list occasionally */
6185 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6187 /* Hack -- Compress the monster list occasionally */
6188 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6191 /* Hack -- Compact the object list occasionally */
6192 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6194 /* Hack -- Compress the object list occasionally */
6195 if (o_cnt + 32 < o_max) compact_objects(0);
6198 /* Process the player */
6201 /* Handle "p_ptr->notice" */
6204 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6207 /* Hack -- Hilite the player */
6208 move_cursor_relative(py, px);
6210 /* Optional fresh */
6211 if (fresh_after) Term_fresh();
6213 /* Hack -- Notice death or departure */
6214 if (!p_ptr->playing || p_ptr->is_dead) break;
6216 /* Process all of the monsters */
6219 /* Handle "p_ptr->notice" */
6222 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6225 /* Hack -- Hilite the player */
6226 move_cursor_relative(py, px);
6228 /* Optional fresh */
6229 if (fresh_after) Term_fresh();
6231 /* Hack -- Notice death or departure */
6232 if (!p_ptr->playing || p_ptr->is_dead) break;
6235 /* Process the world */
6238 /* Handle "p_ptr->notice" */
6241 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6244 /* Hack -- Hilite the player */
6245 move_cursor_relative(py, px);
6247 /* Optional fresh */
6248 if (fresh_after) Term_fresh();
6250 /* Hack -- Notice death or departure */
6251 if (!p_ptr->playing || p_ptr->is_dead) break;
6253 /* Handle "leaving" */
6254 if (p_ptr->leaving) break;
6256 /* Count game turns */
6258 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6259 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6260 if (wild_regen) wild_regen--;
6263 /* Inside a quest and non-unique questor? */
6264 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6266 /* Un-mark the quest monster */
6267 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6270 /* Not save-and-quit and not dead? */
6271 if (p_ptr->playing && !p_ptr->is_dead)
6274 * Maintain Unique monsters and artifact, save current
6275 * floor, then prepare next floor
6279 /* Forget the flag */
6280 reinit_wilderness = FALSE;
6283 /* Write about current level on the play record once per level */
6289 * Load some "user pref files"
6291 * Modified by Arcum Dagsson to support
6292 * separate macro files for different realms.
6294 static void load_all_pref_files(void)
6298 /* Access the "user" pref file */
6299 sprintf(buf, "user.prf");
6301 /* Process that file */
6302 process_pref_file(buf);
6304 /* Access the "user" system pref file */
6305 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6307 /* Process that file */
6308 process_pref_file(buf);
6310 /* Access the "race" pref file */
6311 sprintf(buf, "%s.prf", rp_ptr->title);
6313 /* Process that file */
6314 process_pref_file(buf);
6316 /* Access the "class" pref file */
6317 sprintf(buf, "%s.prf", cp_ptr->title);
6319 /* Process that file */
6320 process_pref_file(buf);
6322 /* Access the "character" pref file */
6323 sprintf(buf, "%s.prf", player_base);
6325 /* Process that file */
6326 process_pref_file(buf);
6328 /* Access the "realm 1" pref file */
6329 if (p_ptr->realm1 != REALM_NONE)
6331 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6333 /* Process that file */
6334 process_pref_file(buf);
6337 /* Access the "realm 2" pref file */
6338 if (p_ptr->realm2 != REALM_NONE)
6340 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6342 /* Process that file */
6343 process_pref_file(buf);
6347 /* Load an autopick preference file */
6348 autopick_load_pref(FALSE);
6353 * Extract option variables from bit sets
6355 void extract_option_vars(void)
6359 for (i = 0; option_info[i].o_desc; i++)
6361 int os = option_info[i].o_set;
6362 int ob = option_info[i].o_bit;
6364 /* Set the "default" options */
6365 if (option_info[i].o_var)
6368 if (option_flag[os] & (1L << ob))
6371 (*option_info[i].o_var) = TRUE;
6378 (*option_info[i].o_var) = FALSE;
6386 * Determine bounty uniques
6388 void determine_bounty_uniques(void)
6391 monster_race *r_ptr;
6393 get_mon_num_prep(NULL, NULL);
6394 for (i = 0; i < MAX_KUBI; i++)
6398 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6399 r_ptr = &r_info[kubi_r_idx[i]];
6401 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6403 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6405 if (r_ptr->rarity > 100) continue;
6407 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6409 for (j = 0; j < i; j++)
6410 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6417 for (i = 0; i < MAX_KUBI - 1; i++)
6419 for (j = i; j < MAX_KUBI; j++)
6421 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6423 tmp = kubi_r_idx[i];
6424 kubi_r_idx[i] = kubi_r_idx[j];
6425 kubi_r_idx[j] = tmp;
6433 * Determine today's bounty monster
6434 * Note: conv_old is used if loaded 0.0.3 or older save file
6436 void determine_today_mon(bool conv_old)
6439 bool old_inside_battle = p_ptr->inside_battle;
6440 monster_race *r_ptr;
6444 for (i = 0; i < max_d_idx; i++)
6446 if (max_dlv[i] < d_info[i].mindepth) continue;
6447 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6450 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6452 p_ptr->inside_battle = TRUE;
6453 get_mon_num_prep(NULL, NULL);
6457 today_mon = get_mon_num(max_dl);
6458 r_ptr = &r_info[today_mon];
6460 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6461 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6462 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6463 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6464 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6465 if (r_ptr->rarity > 10) continue;
6469 p_ptr->today_mon = 0;
6470 p_ptr->inside_battle = old_inside_battle;
6475 * Actually play a game
6477 * If the "new_game" parameter is true, then, after loading the
6478 * savefile, we will commit suicide, if necessary, to allow the
6479 * player to start a new game.
6481 void play_game(bool new_game)
6484 bool load_game = TRUE;
6494 else if (chuukei_server)
6496 prepare_chuukei_hooks();
6500 hack_mutation = FALSE;
6502 /* Hack -- Character is "icky" */
6503 character_icky = TRUE;
6505 /* Make sure main term is active */
6506 Term_activate(angband_term[0]);
6508 /* Initialise the resize hooks */
6509 angband_term[0]->resize_hook = resize_map;
6511 for (i = 1; i < 8; i++)
6513 /* Does the term exist? */
6514 if (angband_term[i])
6516 /* Add the redraw on resize hook */
6517 angband_term[i]->resize_hook = redraw_window;
6521 /* Hack -- turn off the cursor */
6522 (void)Term_set_cursor(0);
6525 /* Attempt to load */
6530 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6532 quit("broken savefile");
6537 /* Extract the options */
6538 extract_option_vars();
6540 /* Report waited score */
6541 if (p_ptr->wait_report_score)
6547 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6549 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6554 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6559 p_ptr->is_dead = TRUE;
6561 start_time = time(NULL);
6563 /* No suspending now */
6564 signals_ignore_tstp();
6566 /* Hack -- Character is now "icky" */
6567 character_icky = TRUE;
6569 /* Build the filename */
6570 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6572 /* Open the high score file, for reading/writing */
6573 highscore_fd = fd_open(buf, O_RDWR);
6575 /* Handle score, show Top scores */
6576 success = send_world_score(TRUE);
6579 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6581 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6585 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6587 prt("standing by for future registration...", 0, 0);
6593 p_ptr->wait_report_score = FALSE;
6596 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6598 if (!save_player()) msg_print("death save failed!");
6601 /* Shut the high score file */
6602 (void)fd_close(highscore_fd);
6604 /* Forget the high score fd */
6607 /* Allow suspending now */
6608 signals_handle_tstp();
6613 /* Nothing loaded */
6614 if (!character_loaded)
6616 /* Make new player */
6619 /* The dungeon is not ready */
6620 character_dungeon = FALSE;
6622 /* Prepare to init the RNG */
6625 /* Initialize the saved floors data */
6626 init_saved_floors(FALSE);
6629 /* Old game is loaded. But new game is requested. */
6632 /* Initialize the saved floors data */
6633 init_saved_floors(TRUE);
6636 /* Process old character */
6639 /* Process the player name */
6640 process_player_name(FALSE);
6649 seed = (time(NULL));
6653 /* Mutate the seed on Unix machines */
6654 seed = ((seed >> 3) * (getpid() << 1));
6658 /* Use the complex RNG */
6661 /* Seed the "complex" RNG */
6662 Rand_state_init(seed);
6665 /* Roll new character */
6668 /* The dungeon is not ready */
6669 character_dungeon = FALSE;
6673 p_ptr->inside_quest = 0;
6674 p_ptr->inside_arena = FALSE;
6675 p_ptr->inside_battle = FALSE;
6679 /* Hack -- seed for flavors */
6680 seed_flavor = randint0(0x10000000);
6682 /* Hack -- seed for town layout */
6683 seed_town = randint0(0x10000000);
6685 /* Roll up a new character */
6693 determine_bounty_uniques();
6694 determine_today_mon(FALSE);
6696 /* Initialize object array */
6701 write_level = FALSE;
6704 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6706 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6710 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6711 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6713 if (p_ptr->riding == -1)
6716 for (i = m_max; i > 0; i--)
6718 if (player_bold(m_list[i].fy, m_list[i].fx))
6727 p_ptr->teleport_town = FALSE;
6728 p_ptr->sutemi = FALSE;
6729 world_monster = FALSE;
6730 now_damaged = FALSE;
6732 start_time = time(NULL) - 1;
6733 record_o_name[0] = '\0';
6735 /* Reset map panel */
6736 panel_row_min = cur_hgt;
6737 panel_col_min = cur_wid;
6739 /* Sexy gal gets bonus to maximum weapon skill of whip */
6740 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6741 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
6743 /* Fill the arrays of floors and walls in the good proportions */
6744 set_floor_and_wall(dungeon_type);
6746 /* Flavor the objects */
6749 /* Flash a message */
6751 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6753 prt("Please wait...", 0, 0);
6757 /* Flush the message */
6761 /* Hack -- Enter wizard mode */
6764 if (enter_wizard_mode())
6766 p_ptr->wizard = TRUE;
6768 if (p_ptr->is_dead || !py || !px)
6770 /* Initialize the saved floors data */
6771 init_saved_floors(TRUE);
6774 p_ptr->inside_quest = 0;
6776 /* Avoid crash in update_view() */
6780 else if (p_ptr->is_dead)
6782 quit("Already dead.");
6786 /* Initialize the town-buildings if necessary */
6787 if (!dun_level && !p_ptr->inside_quest)
6789 /* Init the wilderness */
6791 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6794 init_flags = INIT_ONLY_BUILDINGS;
6796 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6801 /* Generate a dungeon level if needed */
6802 if (!character_dungeon)
6809 /* HACK -- Restore from panic-save */
6810 if (p_ptr->panic_save)
6812 /* No player? -- Try to regenerate floor */
6816 msg_print("¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¤¬¤ª¤«¤·¤¤¡£¥Õ¥í¥¢¤òºÆÀ¸À®¤·¤Þ¤¹¡£");
6818 msg_print("What a strange player location. Regenerate the dungeon floor.");
6823 /* Still no player? -- Try to locate random place */
6824 if (!py || !px) py = px = 10;
6826 /* No longer in panic */
6827 p_ptr->panic_save = 0;
6831 /* Character is now "complete" */
6832 character_generated = TRUE;
6835 /* Hack -- Character is no longer "icky" */
6836 character_icky = FALSE;
6844 sprintf(buf, "%s¤Ë¹ß¤êΩ¤Ã¤¿¡£", map_name());
6846 sprintf(buf, "You are standing in the %s.", map_name());
6848 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
6853 p_ptr->playing = TRUE;
6855 /* Reset the visual mappings */
6858 /* Load the "pref" files */
6859 load_all_pref_files();
6861 /* Give startup outfit (after loading pref files) */
6867 /* React to changes */
6868 Term_xtra(TERM_XTRA_REACT, 0);
6871 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6874 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6880 /* Set or clear "rogue_like_commands" if requested */
6881 if (arg_force_original) rogue_like_commands = FALSE;
6882 if (arg_force_roguelike) rogue_like_commands = TRUE;
6884 /* Hack -- Enforce "delayed death" */
6885 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6887 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6889 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6891 monster_type *m_ptr;
6892 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6893 monster_race *r_ptr = &r_info[pet_r_idx];
6894 place_monster_aux(0, py, px - 1, pet_r_idx,
6895 (PM_FORCE_PET | PM_NO_KAGE));
6896 m_ptr = &m_list[hack_m_idx_ii];
6897 m_ptr->mspeed = r_ptr->speed;
6898 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6899 m_ptr->max_maxhp = m_ptr->maxhp;
6900 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6901 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6907 /* Process the level */
6910 /* Handle "p_ptr->notice" */
6913 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6916 /* Cancel the target */
6919 /* Cancel the health bar */
6923 /* Forget the lite */
6926 /* Forget the view */
6929 /* Forget the view */
6932 /* Handle "quit and save" */
6933 if (!p_ptr->playing && !p_ptr->is_dead) break;
6935 /* Erase the old cave */
6937 if (!p_ptr->is_dead) wipe_m_list();
6945 /* Accidental Death */
6946 if (p_ptr->playing && p_ptr->is_dead)
6948 if (p_ptr->inside_arena)
6950 p_ptr->inside_arena = FALSE;
6951 if (p_ptr->arena_number > MAX_ARENA_MONS)
6952 p_ptr->arena_number++;
6954 p_ptr->arena_number = -1 - p_ptr->arena_number;
6955 p_ptr->is_dead = FALSE;
6957 p_ptr->chp_frac = 0;
6958 p_ptr->exit_bldg = TRUE;
6961 /* Leave through the exit */
6962 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
6964 /* prepare next floor */
6969 /* Mega-Hack -- Allow player to cheat death */
6971 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
6973 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
6976 /* Mark social class, reset age, if needed */
6977 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6983 p_ptr->noscore |= 0x0001;
6987 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
6989 msg_print("You invoke wizard mode and cheat death.");
6993 /* Restore hit points */
6994 p_ptr->chp = p_ptr->mhp;
6995 p_ptr->chp_frac = 0;
6997 if (p_ptr->pclass == CLASS_MAGIC_EATER)
6999 for (i = 0; i < EATER_EXT*2; i++)
7001 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7003 for (; i < EATER_EXT*3; i++)
7005 p_ptr->magic_num1[i] = 0;
7008 /* Restore spell points */
7009 p_ptr->csp = p_ptr->msp;
7010 p_ptr->csp_frac = 0;
7012 /* Hack -- cancel recall */
7013 if (p_ptr->word_recall)
7017 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7019 msg_print("A tension leaves the air around you...");
7024 /* Hack -- Prevent recall */
7025 p_ptr->word_recall = 0;
7026 p_ptr->redraw |= (PR_STATUS);
7029 /* Hack -- cancel alter */
7030 if (p_ptr->alter_reality)
7032 /* Hack -- Prevent alter */
7033 p_ptr->alter_reality = 0;
7034 p_ptr->redraw |= (PR_STATUS);
7037 /* Note cause of death XXX XXX XXX */
7039 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7041 (void)strcpy(p_ptr->died_from, "Cheating death");
7045 p_ptr->is_dead = FALSE;
7047 /* Hack -- Healing */
7049 (void)set_confused(0);
7050 (void)set_poisoned(0);
7051 (void)set_afraid(0);
7052 (void)set_paralyzed(0);
7057 /* Hack -- Prevent starvation */
7058 (void)set_food(PY_FOOD_MAX - 1);
7061 p_ptr->inside_arena = FALSE;
7062 p_ptr->inside_battle = FALSE;
7064 p_ptr->inside_quest = 0;
7065 p_ptr->recall_dungeon = dungeon_type;
7067 if (lite_town || vanilla_town)
7069 p_ptr->wilderness_y = 1;
7070 p_ptr->wilderness_x = 1;
7084 p_ptr->wilderness_y = 48;
7085 p_ptr->wilderness_x = 5;
7091 p_ptr->wild_mode = FALSE;
7092 p_ptr->leaving = TRUE;
7095 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7097 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7100 /* Prepare next floor */
7107 /* Handle "death" */
7108 if (p_ptr->is_dead) break;
7110 /* Make a new level */
7121 s32b turn_real(s32b hoge)
7123 switch (p_ptr->start_race)
7129 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);