3 /* Purpose: Angband game engine */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
15 #define TY_CURSE_CHANCE 200
16 #define CHAINSWORD_NOISE 100
18 static bool load = TRUE;
19 static int wild_regen = 20;
22 * Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
24 static byte value_check_aux1(object_type *o_ptr)
27 if (artifact_p(o_ptr) || o_ptr->art_name)
30 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_TERRIBLE;
37 if (ego_item_p(o_ptr))
40 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_WORTHLESS;
43 return FEEL_EXCELLENT;
47 if (cursed_p(o_ptr)) return FEEL_CURSED;
50 if (broken_p(o_ptr)) return FEEL_BROKEN;
52 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
54 /* Good "armor" bonus */
55 if (o_ptr->to_a > 0) return FEEL_GOOD;
57 /* Good "weapon" bonus */
58 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
60 /* Default to "average" */
66 * Return a "feeling" (or NULL) about an item. Method 2 (Light).
68 static byte value_check_aux2(object_type *o_ptr)
70 /* Cursed items (all of them) */
71 if (cursed_p(o_ptr)) return FEEL_CURSED;
73 /* Broken items (all of them) */
74 if (broken_p(o_ptr)) return FEEL_BROKEN;
76 /* Artifacts -- except cursed/broken ones */
77 if (artifact_p(o_ptr) || o_ptr->art_name) return FEEL_UNCURSED;
79 /* Ego-Items -- except cursed/broken ones */
80 if (ego_item_p(o_ptr)) return FEEL_UNCURSED;
82 /* Good armor bonus */
83 if (o_ptr->to_a > 0) return FEEL_UNCURSED;
85 /* Good weapon bonuses */
86 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
94 static void sense_inventory_aux(int slot, bool heavy)
97 object_type *o_ptr = &inventory[slot];
98 char o_name[MAX_NLEN];
101 /* We know about it already, do not tell us again */
102 if (o_ptr->ident & (IDENT_SENSE))return;
104 /* It is fully known, no information needed */
105 if (object_known_p(o_ptr)) return;
107 /* Check for a feeling */
108 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
110 /* Skip non-feelings */
114 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
125 feel = FEEL_EXCELLENT;
131 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
133 feel = FEEL_UNCURSED;
138 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
144 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
151 feel = FEEL_WORTHLESS;
156 feel = FEEL_TERRIBLE;
162 /* Stop everything */
163 if (disturb_minor) disturb(0, 0);
165 /* Get an object description */
166 object_desc(o_name, o_ptr, FALSE, 0);
168 /* Message (equipment) */
169 if (slot >= INVEN_RARM)
172 msg_format("%s%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
173 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
175 msg_format("You feel the %s (%c) you are %s %s %s...",
176 o_name, index_to_label(slot), describe_use(slot),
177 ((o_ptr->number == 1) ? "is" : "are"),
178 game_inscriptions[feel]);
183 /* Message (inventory) */
187 msg_format("¥¶¥Ã¥¯¤ÎÃæ¤Î%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
188 o_name, index_to_label(slot),game_inscriptions[feel]);
190 msg_format("You feel the %s (%c) in your pack %s %s...",
191 o_name, index_to_label(slot),
192 ((o_ptr->number == 1) ? "is" : "are"),
193 game_inscriptions[feel]);
198 /* We have "felt" it */
199 o_ptr->ident |= (IDENT_SENSE);
201 /* Set the "inscription" */
202 o_ptr->feeling = feel;
204 /* Auto-inscription/destroy */
205 idx = is_autopick(o_ptr);
206 auto_inscribe_item(slot, idx);
208 auto_destroy_item(slot, idx);
210 /* Combine / Reorder the pack (later) */
211 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
214 p_ptr->window |= (PW_INVEN | PW_EQUIP);
220 * Sense the inventory
222 * Class 0 = Warrior --> fast and heavy
223 * Class 1 = Mage --> slow and light
224 * Class 2 = Priest --> fast but light
225 * Class 3 = Rogue --> okay and heavy
226 * Class 4 = Ranger --> slow but heavy (changed!)
227 * Class 5 = Paladin --> slow but heavy
229 static void sense_inventory1(void)
232 int plev = p_ptr->lev;
237 /*** Check for "sensing" ***/
239 /* No sensing when confused */
240 if (p_ptr->confused) return;
242 /* Analyze the class */
243 switch (p_ptr->pclass)
251 if (0 != randint0(9000L / (plev * plev + 40))) return;
263 if (0 != randint0(6000L / (plev * plev + 50))) return;
273 case CLASS_HIGH_MAGE:
275 case CLASS_MAGIC_EATER:
277 /* Very bad (light) sensing */
278 if (0 != randint0(240000L / (plev + 5))) return;
287 /* Good (light) sensing */
288 if (0 != randint0(10000L / (plev * plev + 40))) return;
298 if (0 != randint0(20000L / (plev * plev + 40))) return;
310 if (0 != randint0(95000L / (plev * plev + 40))) return;
322 if (0 != randint0(77777L / (plev * plev + 40))) return;
331 case CLASS_WARRIOR_MAGE:
335 if (0 != randint0(75000L / (plev * plev + 40))) return;
341 case CLASS_MINDCRAFTER:
342 case CLASS_MIRROR_MASTER:
345 if (0 != randint0(55000L / (plev * plev + 40))) return;
351 case CLASS_CHAOS_WARRIOR:
354 if (0 != randint0(80000L / (plev * plev + 40))) return;
364 case CLASS_FORCETRAINER:
367 if (0 != randint0(20000L / (plev * plev + 40))) return;
376 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
386 case CLASS_BLUE_MAGE:
389 if (0 != randint0(55000L / (plev * plev + 40))) return;
395 case CLASS_BEASTMASTER:
398 if (0 != randint0(65000L / (plev * plev + 40))) return;
403 case CLASS_BERSERKER:
413 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
415 /*** Sense everything ***/
417 /* Check everything */
418 for (i = 0; i < INVEN_TOTAL; i++)
422 o_ptr = &inventory[i];
424 /* Skip empty slots */
425 if (!o_ptr->k_idx) continue;
427 /* Valid "tval" codes */
454 /* Skip non-sense machines */
457 /* Occasional failure on inventory items */
458 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
461 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
466 sense_inventory_aux(i, heavy);
471 static void sense_inventory2(void)
474 int plev = p_ptr->lev;
478 /*** Check for "sensing" ***/
480 /* No sensing when confused */
481 if (p_ptr->confused) return;
483 /* Analyze the class */
484 switch (p_ptr->pclass)
490 case CLASS_BERSERKER:
497 case CLASS_CHAOS_WARRIOR:
499 case CLASS_BEASTMASTER:
502 /* Very bad (light) sensing */
503 if (0 != randint0(240000L / (plev + 5))) return;
510 case CLASS_WARRIOR_MAGE:
515 if (0 != randint0(95000L / (plev * plev + 40))) return;
524 case CLASS_FORCETRAINER:
525 case CLASS_MINDCRAFTER:
528 if (0 != randint0(20000L / (plev * plev + 40))) return;
535 case CLASS_HIGH_MAGE:
537 case CLASS_MAGIC_EATER:
538 case CLASS_MIRROR_MASTER:
539 case CLASS_BLUE_MAGE:
542 if (0 != randint0(9000L / (plev * plev + 40))) return;
551 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
558 /*** Sense everything ***/
560 /* Check everything */
561 for (i = 0; i < INVEN_TOTAL; i++)
565 o_ptr = &inventory[i];
567 /* Skip empty slots */
568 if (!o_ptr->k_idx) continue;
570 /* Valid "tval" codes */
583 /* Skip non-sense machines */
586 /* Occasional failure on inventory items */
587 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
589 sense_inventory_aux(i, TRUE);
596 * Go to any level (ripped off from wiz_jump)
598 static void pattern_teleport(void)
605 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
607 if (get_check("Teleport level? "))
614 /* Only downward in ironman mode */
615 if (ironman_downward)
616 min_level = dun_level;
619 if (dungeon_type == DUNGEON_ANGBAND)
622 max_level = MAX_DEPTH - 1;
623 else if (dun_level == 100)
628 max_level = d_info[dungeon_type].maxdepth;
629 min_level = d_info[dungeon_type].mindepth;
634 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
636 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
641 sprintf(tmp_val, "%d", dun_level);
643 /* Ask for a level */
644 if (!get_string(ppp, tmp_val, 10)) return;
646 /* Extract request */
647 command_arg = atoi(tmp_val);
650 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
652 else if (get_check("Normal teleport? "))
656 teleport_player(200);
665 if (command_arg < min_level) command_arg = min_level;
668 if (command_arg > max_level) command_arg = max_level;
672 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
674 msg_format("You teleport to dungeon level %d.", command_arg);
678 if (autosave_l) do_cmd_save_game(TRUE);
681 dun_level = command_arg;
682 prepare_change_floor_mode(CFM_CLEAR_ALL);
686 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
688 p_ptr->inside_quest = 0;
689 p_ptr->leftbldg = FALSE;
693 p_ptr->leaving = TRUE;
697 static void wreck_the_pattern(void)
699 int to_ruin = 0, r_y, r_x;
701 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
708 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
709 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
711 msg_print("You bleed on the Pattern!");
712 msg_print("Something terrible happens!");
718 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
720 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
724 to_ruin = randint1(45) + 35;
728 scatter(&r_y, &r_x, py, px, 4, 0);
730 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
731 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
733 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
737 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
741 /* Returns TRUE if we are on the Pattern... */
742 static bool pattern_effect(void)
744 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
745 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
748 if ((prace_is_(RACE_AMBERITE)) &&
749 (p_ptr->cut > 0) && one_in_(10))
754 if (cave[py][px].feat == FEAT_PATTERN_END)
756 (void)set_poisoned(0);
762 (void)do_res_stat(A_STR);
763 (void)do_res_stat(A_INT);
764 (void)do_res_stat(A_WIS);
765 (void)do_res_stat(A_DEX);
766 (void)do_res_stat(A_CON);
767 (void)do_res_stat(A_CHR);
768 (void)restore_level();
769 (void)hp_player(1000);
770 cave_set_feat(py, px, FEAT_PATTERN_OLD);
772 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
774 msg_print("This section of the Pattern looks less powerful.");
781 * We could make the healing effect of the
782 * Pattern center one-time only to avoid various kinds
783 * of abuse, like luring the win monster into fighting you
784 * in the middle of the pattern...
787 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
791 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
795 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
799 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
801 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
807 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
809 else if (!p_ptr->invuln)
811 take_hit(DAMAGE_NOESCAPE, damroll(1,3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
813 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
826 * Regenerate hit points -RAK-
828 static void regenhp(int percent)
830 s32b new_chp, new_chp_frac;
833 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
834 if (p_ptr->action == ACTION_HAYAGAKE) return;
835 /* Save the old hitpoints */
836 old_chp = p_ptr->chp;
838 /* Extract the new hitpoints */
839 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
840 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
842 /* check for overflow */
843 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
844 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
845 if (new_chp_frac >= 0x10000L)
847 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
852 p_ptr->chp_frac = (u16b)new_chp_frac;
856 if (p_ptr->chp >= p_ptr->mhp)
858 p_ptr->chp = p_ptr->mhp;
863 if (old_chp != p_ptr->chp)
866 p_ptr->redraw |= (PR_HP);
869 p_ptr->window |= (PW_PLAYER);
877 * Regenerate mana points -RAK-
879 static void regenmana(int percent)
881 s32b new_mana, new_mana_frac;
883 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
885 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
886 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
887 old_csp = p_ptr->csp;
888 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
889 if (old_csp_msp && (new_mana > 0))
893 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
894 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
898 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
899 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
901 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
903 if (new_mana_frac >= 0x10000L)
905 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
910 p_ptr->csp_frac = (u16b)(new_mana_frac);
913 /* check for overflow */
920 /* Must set frac to zero even if equal */
921 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
923 p_ptr->csp = p_ptr->msp;
928 if (old_csp != p_ptr->csp)
931 p_ptr->redraw |= (PR_MANA);
934 p_ptr->window |= (PW_PLAYER);
935 p_ptr->window |= (PW_SPELL);
946 static void regenmagic(int percent)
951 for (i = 0; i < EATER_EXT*2; i++)
953 if (!p_ptr->magic_num2[i]) continue;
954 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
955 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
956 p_ptr->magic_num1[i] += new_mana;
958 /* Must set frac to zero even if equal */
959 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
961 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
965 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
967 if (!p_ptr->magic_num1[i]) continue;
968 if (!p_ptr->magic_num2[i]) continue;
969 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
970 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
981 * Regenerate the monsters (once per 100 game turns)
983 * XXX XXX XXX Should probably be done during monster turns.
985 static void regen_monsters(void)
990 /* Regenerate everyone */
991 for (i = 1; i < m_max; i++)
993 /* Check the i'th monster */
994 monster_type *m_ptr = &m_list[i];
995 monster_race *r_ptr = &r_info[m_ptr->r_idx];
998 /* Skip dead monsters */
999 if (!m_ptr->r_idx) continue;
1001 /* Allow regeneration (if needed) */
1002 if (m_ptr->hp < m_ptr->maxhp)
1004 /* Hack -- Base regeneration */
1005 frac = m_ptr->maxhp / 100;
1007 /* Hack -- Minimal regeneration rate */
1008 if (!frac) if (one_in_(2)) frac = 1;
1010 /* Hack -- Some monsters regenerate quickly */
1011 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1013 /* Hack -- Regenerate */
1016 /* Do not over-regenerate */
1017 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1019 /* Redraw (later) if needed */
1020 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1021 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1028 * Regenerate the monsters (once per 100 game turns)
1030 * XXX XXX XXX Should probably be done during monster turns.
1032 static void regen_captured_monsters(void)
1037 /* Regenerate everyone */
1038 for (i = 0; i < INVEN_TOTAL; i++)
1040 monster_race *r_ptr;
1041 object_type *o_ptr = &inventory[i];
1043 if (!o_ptr->k_idx) continue;
1044 if (o_ptr->tval != TV_CAPTURE) continue;
1045 if (!o_ptr->pval) continue;
1049 r_ptr = &r_info[o_ptr->pval];
1051 /* Allow regeneration (if needed) */
1052 if (o_ptr->xtra4 < o_ptr->xtra5)
1054 /* Hack -- Base regeneration */
1055 frac = o_ptr->xtra5 / 100;
1057 /* Hack -- Minimal regeneration rate */
1058 if (!frac) if (one_in_(2)) frac = 1;
1060 /* Hack -- Some monsters regenerate quickly */
1061 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1063 /* Hack -- Regenerate */
1064 o_ptr->xtra4 += frac;
1066 /* Do not over-regenerate */
1067 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1074 p_ptr->notice |= (PN_COMBINE);
1077 p_ptr->window |= (PW_INVEN);
1078 p_ptr->window |= (PW_EQUIP);
1084 static void notice_lite_change(object_type *o_ptr)
1086 /* Hack -- notice interesting fuel steps */
1087 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1090 p_ptr->window |= (PW_EQUIP);
1093 /* Hack -- Special treatment when blind */
1096 /* Hack -- save some light for later */
1097 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1100 /* The light is now out */
1101 else if (o_ptr->xtra4 == 0)
1105 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1107 msg_print("Your light has gone out!");
1109 p_ptr->update |= (PU_BONUS);
1112 /* The light is getting dim */
1113 else if (o_ptr->name2 == EGO_LITE_LONG)
1115 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1116 && (turn % (TURNS_PER_TICK*2)))
1118 if (disturb_minor) disturb(0, 0);
1120 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1122 msg_print("Your light is growing faint.");
1128 /* The light is getting dim */
1129 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1131 if (disturb_minor) disturb(0, 0);
1133 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1135 msg_print("Your light is growing faint.");
1142 void leave_quest_check(void)
1144 /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
1145 leaving_quest = p_ptr->inside_quest;
1147 /* Leaving an 'only once' quest marks it as failed */
1148 if (leaving_quest &&
1149 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1150 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1152 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1153 quest[leaving_quest].complev = (byte)p_ptr->lev;
1154 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1156 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1157 if (record_rand_quest)
1158 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1160 /* Floor of random quest will be blocked */
1161 prepare_change_floor_mode(CFM_NO_RETURN);
1163 else if (record_fix_quest)
1164 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1170 * Forcibly pseudo-identify an object in the inventory
1173 * note: currently this function allows pseudo-id of any object,
1174 * including silly ones like potions & scrolls, which always
1175 * get '{average}'. This should be changed, either to stop such
1176 * items from being pseudo-id'd, or to allow psychometry to
1177 * detect whether the unidentified potion/scroll/etc is
1178 * good (Cure Light Wounds, Restore Strength, etc) or
1179 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1181 bool psychometry(void)
1185 char o_name[MAX_NLEN];
1191 item_tester_no_ryoute = TRUE;
1194 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1195 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1197 q = "Meditate on which item? ";
1198 s = "You have nothing appropriate.";
1201 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1203 /* Get the item (in the pack) */
1206 o_ptr = &inventory[item];
1209 /* Get the item (on the floor) */
1212 o_ptr = &o_list[0 - item];
1215 /* It is fully known, no information needed */
1216 if (object_known_p(o_ptr))
1219 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1221 msg_print("You cannot find out anything more about that.");
1227 /* Check for a feeling */
1228 feel = value_check_aux1(o_ptr);
1230 /* Get an object description */
1231 object_desc(o_name, o_ptr, FALSE, 0);
1233 /* Skip non-feelings */
1237 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1239 msg_format("You do not perceive anything unusual about the %s.", o_name);
1246 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1247 o_name, game_inscriptions[feel]);
1249 msg_format("You feel that the %s %s %s...",
1250 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1251 game_inscriptions[feel]);
1255 /* We have "felt" it */
1256 o_ptr->ident |= (IDENT_SENSE);
1259 o_ptr->feeling = feel;
1261 /* Combine / Reorder the pack (later) */
1262 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1265 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1267 /* Valid "tval" codes */
1268 switch (o_ptr->tval)
1296 /* Auto-inscription/destroy */
1297 idx = is_autopick(o_ptr);
1298 auto_inscribe_item(item, idx);
1299 if (okay && destroy_feeling)
1300 auto_destroy_item(item, idx);
1302 /* Something happened */
1307 static void gere_music(s32b music)
1315 stun_monsters(damroll(p_ptr->lev/10,2));
1318 hp_player(damroll(2,6));
1321 project_hack(GF_TURN_ALL, p_ptr->lev);
1324 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1327 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1330 confuse_monsters(p_ptr->lev * 2);
1333 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1336 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1339 project(0, 0, py, px,
1340 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1343 dispel_monsters(randint1(p_ptr->lev * 3));
1344 dispel_evil(randint1(p_ptr->lev * 3));
1351 earthquake(py, px, 10);
1354 stasis_monsters(p_ptr->lev * 4);
1357 dispel_monsters(randint1(p_ptr->lev * 3));
1360 hp_player(damroll(15,10));
1364 case MUSIC_DETECT+19:
1366 case MUSIC_DETECT+11:
1367 case MUSIC_DETECT+12:
1368 case MUSIC_DETECT+13:
1369 case MUSIC_DETECT+14:
1370 case MUSIC_DETECT+15:
1371 case MUSIC_DETECT+16:
1372 case MUSIC_DETECT+17:
1373 case MUSIC_DETECT+18:
1374 map_area(DETECT_RAD_MAP);
1375 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1376 case MUSIC_DETECT+6:
1377 case MUSIC_DETECT+7:
1378 case MUSIC_DETECT+8:
1379 case MUSIC_DETECT+9:
1380 case MUSIC_DETECT+10:
1381 /* There are too many hidden treasure. So... */
1382 /* detect_treasure(DETECT_RAD_DEFAULT); */
1383 detect_objects_gold(DETECT_RAD_DEFAULT);
1384 detect_objects_normal(DETECT_RAD_DEFAULT);
1385 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1386 case MUSIC_DETECT+3:
1387 case MUSIC_DETECT+4:
1388 case MUSIC_DETECT+5:
1389 detect_monsters_invis(DETECT_RAD_DEFAULT);
1390 detect_monsters_normal(DETECT_RAD_DEFAULT);
1391 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1393 case MUSIC_DETECT+1:
1394 case MUSIC_DETECT+2:
1395 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1396 detect_doors(DETECT_RAD_DEFAULT);
1397 detect_stairs(DETECT_RAD_DEFAULT);
1398 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1404 * If player has inscribed the object with "!!", let him know when it's
1407 static void recharged_notice(object_type *o_ptr)
1409 char o_name[MAX_NLEN];
1413 /* No inscription */
1414 if (!o_ptr->inscription) return;
1417 s = strchr(quark_str(o_ptr->inscription), '!');
1419 /* Process notification request. */
1422 /* Find another '!' */
1425 /* Describe (briefly) */
1426 object_desc(o_name, o_ptr, FALSE, 0);
1428 /* Notify the player */
1430 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1432 if (o_ptr->number > 1)
1433 msg_format("Your %s are recharged.", o_name);
1435 msg_format("Your %s is recharged.", o_name);
1444 /* Keep looking for '!'s */
1445 s = strchr(s + 1, '!');
1450 static void check_music(void)
1455 /* Music singed by player */
1456 if(p_ptr->pclass != CLASS_BARD) return;
1457 if(!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1459 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][p_ptr->magic_num2[0]];
1461 shouhimana = (s_ptr->smana*(3800-p_ptr->spell_exp[p_ptr->magic_num2[0]])+2399);
1464 else shouhimana *= 4;
1466 if(shouhimana < 1) shouhimana = 1;
1467 shouhimana *= 0x8000;
1468 if (((u16b)(p_ptr->csp) < (shouhimana / 0x10000)) || (p_ptr->anti_magic))
1475 p_ptr->csp -= (u16b) (shouhimana / 0x10000);
1476 shouhimana = (shouhimana & 0xffff);
1477 if (p_ptr->csp_frac < shouhimana)
1480 p_ptr->csp_frac += (u16b)(0x10000L - shouhimana);
1484 p_ptr->csp_frac -= (u16b)shouhimana;
1487 p_ptr->redraw |= PR_MANA;
1488 if (p_ptr->magic_num1[1])
1490 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1491 p_ptr->magic_num1[1] = 0;
1493 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1495 msg_print("You restart singing.");
1497 p_ptr->action = ACTION_SING;
1499 /* Recalculate bonuses */
1500 p_ptr->update |= (PU_BONUS | PU_HP);
1502 /* Redraw status bar */
1503 p_ptr->redraw |= (PR_STATUS);
1506 if (p_ptr->spell_exp[p_ptr->magic_num2[0]] < 900)
1507 p_ptr->spell_exp[p_ptr->magic_num2[0]]+=5;
1508 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1200)
1509 {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
1510 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1400)
1511 {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
1512 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1600)
1513 {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
1515 gere_music(p_ptr->magic_num1[0]);
1518 /* Choose one of items that have cursed flag */
1519 static object_type *choose_cursed_obj_name(u32b flag)
1522 int choices[INVEN_TOTAL-INVEN_RARM];
1525 /* Paranoia -- Player has no warning-item */
1526 if (!(p_ptr->cursed & flag)) return NULL;
1528 /* Search Inventry */
1529 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1531 object_type *o_ptr = &inventory[i];
1533 if (o_ptr->curse_flags & flag)
1535 choices[number] = i;
1540 /* Choice one of them */
1541 return (&inventory[choices[randint0(number)]]);
1546 * Handle certain things once every 10 game turns
1548 static void process_world(void)
1552 bool cave_no_regen = FALSE;
1553 int upkeep_factor = 0;
1558 const int dec_count = (easy_band ? 2 : 1);
1560 int day, hour, min, prev_min;
1562 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1563 s32b tick = turn % len + len / 4;
1565 extract_day_hour_min(&day, &hour, &min);
1566 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1568 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1570 !(quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) &&
1571 !(p_ptr->inside_battle))
1574 if (p_ptr->inside_battle && !p_ptr->leaving)
1581 /* Count all hostile monsters */
1582 for (i2 = 0; i2 < cur_wid; ++i2)
1583 for (j2 = 0; j2 < cur_hgt; j2++)
1584 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1587 win_m_idx = cave[j2][i2].m_idx;
1590 if (number_mon == 0)
1593 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1595 msg_print("They have kill each other at the same time.");
1598 p_ptr->energy_need = 0;
1601 else if ((number_mon-1) == 0)
1604 monster_type *wm_ptr;
1606 wm_ptr = &m_list[win_m_idx];
1608 monster_desc(m_name, wm_ptr, 0);
1610 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1612 msg_format("%s is winner!", m_name);
1616 if (win_m_idx == (sel_monster+1))
1619 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1621 msg_print("Congratulations.");
1624 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1626 msg_format("You received %d gold.", battle_odds);
1628 p_ptr->au += battle_odds;
1633 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1635 msg_print("You lost gold.");
1639 p_ptr->energy_need = 0;
1642 else if(turn - old_turn == 150*TURNS_PER_TICK)
1645 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
1647 msg_format("This battle have ended in a draw.");
1649 p_ptr->au += kakekin;
1651 p_ptr->energy_need = 0;
1656 /* Every 20 game turns */
1657 if (turn % TURNS_PER_TICK) return;
1659 /*** Check the Time and Load ***/
1661 if (!(turn % (50*TURNS_PER_TICK)))
1663 /* Check time and load */
1664 if ((0 != check_time()) || (0 != check_load()))
1667 if (closing_flag <= 2)
1672 /* Count warnings */
1677 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
1678 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
1680 msg_print("The gates to ANGBAND are closing...");
1681 msg_print("Please finish up and/or save your game.");
1691 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
1693 msg_print("The gates to ANGBAND are now closed.");
1698 p_ptr->playing = FALSE;
1701 p_ptr->leaving = TRUE;
1706 /*** Attempt timed autosave ***/
1707 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
1709 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
1710 do_cmd_save_game(TRUE);
1716 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
1718 msg_print("You hear noise.");
1722 /*** Handle the wilderness/town (sunshine) ***/
1724 /* While in town/wilderness */
1725 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
1727 /* Hack -- Daybreak/Nighfall in town */
1728 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
1732 /* Check for dawn */
1733 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
1740 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
1742 msg_print("The sun has risen.");
1746 /* Hack -- Scan the town */
1747 for (y = 0; y < cur_hgt; y++)
1749 for (x = 0; x < cur_wid; x++)
1751 /* Get the cave grid */
1752 c_ptr = &cave[y][x];
1755 c_ptr->info |= (CAVE_GLOW);
1757 /* Hack -- Memorize lit grids if allowed */
1758 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
1760 /* Hack -- Notice spot */
1771 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
1773 msg_print("The sun has fallen.");
1777 /* Hack -- Scan the town */
1778 for (y = 0; y < cur_hgt; y++)
1780 for (x = 0; x < cur_wid; x++)
1782 /* Get the cave grid */
1783 c_ptr = &cave[y][x];
1785 /* Darken "boring" features */
1786 if ((c_ptr->feat <= FEAT_INVIS) ||
1787 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
1788 (c_ptr->feat <= FEAT_MOUNTAIN) &&
1789 (c_ptr->feat != FEAT_MUSEUM)) ||
1790 (x == 0) || (x == cur_wid-1) ||
1791 (y == 0) || (y == cur_hgt-1))
1793 /* Forget the grid */
1794 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
1796 /* Hack -- Notice spot */
1803 /* Update the monsters */
1804 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
1807 p_ptr->redraw |= (PR_MAP);
1810 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1814 /* Set back the rewards once a day */
1815 if (!(turn % (TURNS_PER_TICK*10 * STORE_TURNS)))
1819 /* Reset the rewards */
1820 for (n = 0; n < MAX_BACT; n++)
1822 p_ptr->rewards[n] = FALSE;
1827 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
1829 if (cheat_xtra) msg_print("Rewards reset.");
1835 /*** Process the monsters ***/
1837 /* Check for creature generation. */
1838 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
1839 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
1841 /* Make a new monster */
1842 (void)alloc_monster(MAX_SIGHT + 5, 0);
1845 /* Hack -- Check for creature regeneration */
1846 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
1847 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
1850 /*** Damage over Time ***/
1852 /* Take damage from poison */
1853 if (p_ptr->poisoned && !p_ptr->invuln)
1857 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
1859 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1865 /* (Vampires) Take damage from sunlight */
1866 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1868 if (!dun_level && !p_ptr->resist_lite && !p_ptr->invuln && is_daytime())
1870 if (cave[py][px].info & CAVE_GLOW)
1874 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
1875 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
1877 msg_print("The sun's rays scorch your undead flesh!");
1878 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
1881 cave_no_regen = TRUE;
1885 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1886 !p_ptr->resist_lite)
1888 object_type * o_ptr = &inventory[INVEN_LITE];
1889 char o_name [MAX_NLEN];
1890 char ouch [MAX_NLEN+40];
1892 /* Get an object description */
1893 object_desc(o_name, o_ptr, FALSE, 0);
1896 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
1898 msg_format("The %s scorches your undead flesh!", o_name);
1902 cave_no_regen = TRUE;
1904 /* Get an object description */
1905 object_desc(o_name, o_ptr, TRUE, 0);
1908 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
1910 sprintf(ouch, "wielding %s", o_name);
1913 if (!p_ptr->invuln) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1917 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
1918 !p_ptr->invuln && !p_ptr->immune_fire && !p_ptr->ffall)
1920 int damage = 3000 + randint0(2000);
1922 if (prace_is_(RACE_ENT)) damage += damage/3;
1924 if (p_ptr->resist_fire) damage = damage / 3;
1925 if (p_ptr->oppose_fire) damage = damage / 3;
1926 damage = damage / 100 + (randint0(100) < (damage % 100));
1932 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
1933 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
1935 msg_print("The lava burns you!");
1936 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
1939 cave_no_regen = TRUE;
1943 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
1944 !p_ptr->invuln && !p_ptr->immune_fire)
1946 int damage = 6000 + randint0(4000);
1951 if (p_ptr->resist_fire) damage = damage / 3;
1952 if (p_ptr->oppose_fire) damage = damage / 3;
1956 damage = damage / 5;
1959 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
1960 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
1962 message = "The heat burns you!";
1963 hit_from = "flying over deep lava";
1970 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
1971 hit_from = "¿¼¤¤ÍÏ´äή";
1973 message = "The lava burns you!";
1974 hit_from = "deep lava";
1979 damage = damage / 100 + (randint0(100) < (damage % 100));
1984 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
1986 cave_no_regen = TRUE;
1990 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
1992 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
1996 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
1997 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
1999 msg_print("You are drowning!");
2000 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2003 cave_no_regen = TRUE;
2010 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2012 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2013 if (prace_is_(RACE_ENT)) damage += damage/3;
2014 if (p_ptr->resist_fire) damage = damage / 3;
2015 if (p_ptr->oppose_fire) damage = damage / 3;
2017 msg_print("Ç®¤¤¡ª");
2018 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2020 msg_print("It's hot!");
2021 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2024 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2026 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2027 if (p_ptr->resist_elec) damage = damage / 3;
2028 if (p_ptr->oppose_elec) damage = damage / 3;
2030 msg_print("Äˤ¤¡ª");
2031 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2033 msg_print("It hurts!");
2034 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2037 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2039 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2040 if (p_ptr->resist_cold) damage = damage / 3;
2041 if (p_ptr->oppose_cold) damage = damage / 3;
2043 msg_print("Î䤿¤¤¡ª");
2044 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2046 msg_print("It's cold!");
2047 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2052 /* Spectres -- take damage when moving through walls */
2054 * Added: ANYBODY takes damage if inside through walls
2055 * without wraith form -- NOTE: Spectres will never be
2056 * reduced below 0 hp by being inside a stone wall; others
2059 if (!cave_floor_bold(py, px))
2061 /* Player can walk through trees */
2062 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2066 else if (!p_ptr->invuln && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2067 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2071 cave_no_regen = TRUE;
2073 if (p_ptr->pass_wall)
2076 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2079 msg_print("Your molecules feel disrupted!");
2080 dam_desc = "density";
2087 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2088 dam_desc = "¹Å¤¤´ä";
2090 msg_print("You are being crushed!");
2091 dam_desc = "solid rock";
2096 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2102 monster_race *r_ptr;
2104 if (min != prev_min)
2107 bool old_inside_battle = p_ptr->inside_battle;
2109 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2111 p_ptr->inside_battle = TRUE;
2112 get_mon_num_prep(NULL,NULL);
2114 for (i = 0; i < max_d_idx; i++)
2116 if (max_dlv[i] < d_info[i].mindepth) continue;
2117 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2121 today_mon = get_mon_num(max_dl);
2122 r_ptr = &r_info[today_mon];
2124 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2125 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2126 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2127 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2128 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2129 if (r_ptr->rarity > 10) continue;
2130 if (r_ptr->level == 0) continue;
2133 p_ptr->today_mon = 0;
2134 p_ptr->inside_battle = old_inside_battle;
2138 /* Nightmare mode activates the TY_CURSE at midnight */
2139 if (ironman_nightmare)
2141 /* Require exact minute */
2142 if (min != prev_min)
2144 /* Every 15 minutes after 11:00 pm */
2145 if ((hour == 23) && !(min % 15))
2155 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2157 msg_print("You hear a distant bell toll ominously.");
2165 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2167 msg_print("A distant bell sounds twice.");
2175 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2177 msg_print("A distant bell sounds three times.");
2185 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2187 msg_print("A distant bell tolls four times.");
2195 /* TY_CURSE activates at mignight! */
2202 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2204 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2207 activate_ty_curse(FALSE, &count);
2212 /* Take damage from cuts */
2213 if (p_ptr->cut && !p_ptr->invuln)
2215 /* Mortal wound or Deep Gash */
2216 if (p_ptr->cut > 1000)
2221 else if (p_ptr->cut > 200)
2227 else if (p_ptr->cut > 100)
2232 else if (p_ptr->cut > 50)
2237 else if (p_ptr->cut > 25)
2242 else if (p_ptr->cut > 10)
2255 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2257 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2263 /*** Check the Food, and Regenerate ***/
2265 if (!p_ptr->inside_battle)
2267 /* Digest normally */
2268 if (p_ptr->food < PY_FOOD_MAX)
2270 /* Every 100 game turns */
2271 if (!(turn % (TURNS_PER_TICK*5)))
2273 /* Basic digestion rate based on speed */
2274 i = /* extract_energy[p_ptr->pspeed] * 2;*/
2275 ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
2276 1 : extract_energy[p_ptr->pspeed]));
2278 /* Regeneration takes more food */
2279 if (p_ptr->regenerate) i += 20;
2280 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2281 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2283 /* Slow digestion takes less food */
2284 if (p_ptr->slow_digest) i -= 5;
2286 /* Minimal digestion */
2288 /* Maximal digestion */
2289 if (i > 100) i = 100;
2291 /* Digest some food */
2292 (void)set_food(p_ptr->food - i);
2296 /* Digest quickly when gorged */
2299 /* Digest a lot of food */
2300 (void)set_food(p_ptr->food - 100);
2304 /* Starve to death (slowly) */
2305 if (p_ptr->food < PY_FOOD_STARVE)
2307 /* Calculate damage */
2308 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2312 if (!p_ptr->invuln) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2314 if (!p_ptr->invuln) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2319 /* Default regeneration */
2320 regen_amount = PY_REGEN_NORMAL;
2323 if (p_ptr->food < PY_FOOD_WEAK)
2325 /* Lower regeneration */
2326 if (p_ptr->food < PY_FOOD_STARVE)
2330 else if (p_ptr->food < PY_FOOD_FAINT)
2332 regen_amount = PY_REGEN_FAINT;
2336 regen_amount = PY_REGEN_WEAK;
2340 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2342 /* Faint occasionally */
2343 if (!p_ptr->paralyzed && (randint0(100) < 10))
2347 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2349 msg_print("You faint from the lack of food.");
2354 /* Hack -- faint (bypass free action) */
2355 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2361 /* Are we walking the pattern? */
2362 if (pattern_effect())
2364 cave_no_regen = TRUE;
2368 /* Regeneration ability */
2369 if (p_ptr->regenerate)
2371 regen_amount = regen_amount * 2;
2373 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2377 if (p_ptr->cursed & TRC_SLOW_REGEN)
2384 /* Searching or Resting */
2385 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2387 regen_amount = regen_amount * 2;
2390 upkeep_factor = calculate_upkeep();
2392 /* Regenerate the mana */
2393 /* if (p_ptr->csp < p_ptr->msp) */
2397 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2398 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2399 regenmana(upkeep_regen/100);
2401 #ifdef TRACK_FRIENDS
2405 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2407 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2411 #endif /* TRACK_FRIENDS */
2414 else if (p_ptr->action != ACTION_LEARN)
2416 regenmana(regen_amount);
2419 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2421 regenmagic(regen_amount);
2424 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2426 while (upkeep_factor > 100)
2429 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2431 msg_print("Such much pets cannot be controled at once!");
2434 do_cmd_pet_dismiss();
2436 upkeep_factor = calculate_upkeep();
2439 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2441 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2447 /* Poisoned or cut yields no healing */
2448 if (p_ptr->poisoned) regen_amount = 0;
2449 if (p_ptr->cut) regen_amount = 0;
2451 /* Special floor -- Pattern, in a wall -- yields no healing */
2452 if (cave_no_regen) regen_amount = 0;
2454 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2456 /* Regenerate Hit Points if needed */
2457 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2459 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2460 (cave[py][px].feat >= FEAT_PATTERN_START))
2462 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2466 regenhp(regen_amount);
2471 /*** Timeout Various Things ***/
2474 if (p_ptr->tim_mimic)
2476 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2479 /* Hack -- Hallucinating */
2482 (void)set_image(p_ptr->image - dec_count);
2488 (void)set_blind(p_ptr->blind - dec_count);
2491 /* Times see-invisible */
2492 if (p_ptr->tim_invis)
2494 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2505 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2508 /* Timed temporary elemental brands. -LM- */
2509 if (p_ptr->ele_attack)
2511 p_ptr->ele_attack--;
2513 /* Clear all temporary elemental brands. */
2514 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2517 /* Timed temporary elemental immune. -LM- */
2518 if (p_ptr->ele_immune)
2520 p_ptr->ele_immune--;
2522 /* Clear all temporary elemental brands. */
2523 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2526 /* Timed infra-vision */
2527 if (p_ptr->tim_infra)
2529 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2533 if (p_ptr->tim_stealth)
2535 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2538 /* Timed levitation */
2539 if (p_ptr->tim_ffall)
2541 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2544 /* Timed sh_touki */
2545 if (p_ptr->tim_sh_touki)
2547 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2551 if (p_ptr->tim_sh_fire)
2553 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2557 if (p_ptr->tim_sh_holy)
2559 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2563 if (p_ptr->tim_eyeeye)
2565 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2568 /* Timed resist-magic */
2569 if (p_ptr->resist_magic)
2571 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2574 /* Timed regeneration */
2575 if (p_ptr->tim_regen)
2577 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2580 /* Timed resist nether */
2581 if (p_ptr->tim_res_nether)
2583 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2586 /* Timed resist time */
2587 if (p_ptr->tim_res_time)
2589 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2593 if (p_ptr->tim_reflect)
2595 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2599 if (p_ptr->multishadow)
2601 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2604 /* Timed Robe of dust */
2605 if (p_ptr->dustrobe)
2607 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2610 /* Timed infra-vision */
2611 if (p_ptr->kabenuke)
2613 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2617 if (p_ptr->paralyzed)
2619 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2623 if (p_ptr->confused)
2625 (void)set_confused(p_ptr->confused - dec_count);
2631 (void)set_afraid(p_ptr->afraid - dec_count);
2637 (void)set_fast(p_ptr->fast - 1, TRUE);
2643 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2646 /* Protection from evil */
2647 if (p_ptr->protevil)
2649 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2652 /* Invulnerability */
2655 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2659 if (p_ptr->wraith_form)
2661 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2667 (void)set_hero(p_ptr->hero - 1, TRUE);
2673 (void)set_shero(p_ptr->shero - 1, TRUE);
2679 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2685 (void)set_shield(p_ptr->shield - 1, TRUE);
2689 if (p_ptr->tsubureru)
2691 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2695 if (p_ptr->magicdef)
2697 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2701 if (p_ptr->tsuyoshi)
2703 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2707 if (p_ptr->oppose_acid)
2709 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2712 /* Oppose Lightning */
2713 if (p_ptr->oppose_elec)
2715 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2719 if (p_ptr->oppose_fire)
2721 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2725 if (p_ptr->oppose_cold)
2727 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2731 if (p_ptr->oppose_pois)
2733 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2738 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2741 /*** Poison and Stun and Cut ***/
2744 if (p_ptr->poisoned)
2746 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2748 /* Apply some healing */
2749 (void)set_poisoned(p_ptr->poisoned - adjust);
2755 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2757 /* Apply some healing */
2758 (void)set_stun(p_ptr->stun - adjust);
2764 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2766 /* Hack -- Truly "mortal" wound */
2767 if (p_ptr->cut > 1000) adjust = 0;
2769 /* Apply some healing */
2770 (void)set_cut(p_ptr->cut - adjust);
2775 /*** Process Light ***/
2777 /* Check for light being wielded */
2778 o_ptr = &inventory[INVEN_LITE];
2780 /* Burn some fuel in the current lite */
2781 if (o_ptr->tval == TV_LITE)
2783 /* Hack -- Use some fuel (except on artifacts) */
2784 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2786 /* Decrease life-span */
2787 if (o_ptr->name2 == EGO_LITE_LONG)
2789 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2791 else o_ptr->xtra4--;
2793 /* Notice interesting fuel steps */
2794 notice_lite_change(o_ptr);
2798 /* Calculate torch radius */
2799 p_ptr->update |= (PU_TORCH);
2802 /*** Process mutation effects ***/
2803 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
2805 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2809 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
2810 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
2812 msg_print("RAAAAGHH!");
2813 msg_print("You feel a fit of rage coming over you!");
2816 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2819 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2821 if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
2825 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
2827 msg_print("It's so dark... so scary!");
2830 set_afraid(p_ptr->afraid + 13 + randint1(26));
2834 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2836 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2841 /* Teleport player */
2843 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
2845 msg_print("Your position suddenly seems very uncertain...");
2849 teleport_player(40);
2853 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2855 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2858 p_ptr->redraw |= PR_EXTRA;
2860 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
2862 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2867 if (!p_ptr->resist_conf)
2869 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2872 if (!p_ptr->resist_chaos)
2877 if (one_in_(3)) lose_all_info();
2879 teleport_player(100);
2882 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
2883 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
2885 msg_print("You wake up somewhere with a sore head...");
2886 msg_print("You can't remember a thing, or how you got here!");
2895 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
2897 msg_print("Thishcischs GooDSChtuff!");
2900 (void)set_image(p_ptr->image + randint0(150) + 150);
2906 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2908 if (!p_ptr->resist_chaos)
2911 p_ptr->redraw |= PR_EXTRA;
2912 (void)set_image(p_ptr->image + randint0(50) + 20);
2916 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2921 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
2923 msg_print("BRRAAAP! Oops.");
2927 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2930 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2931 !p_ptr->anti_magic && one_in_(9000))
2936 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
2938 msg_print("Magical energy flows through you! You must release it!");
2943 (void)get_hack_dir(&dire);
2944 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2947 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2948 !p_ptr->anti_magic && (randint1(6666) == 666))
2950 bool pet = one_in_(6);
2951 u32b mode = PM_ALLOW_GROUP;
2953 if (pet) mode |= PM_FORCE_PET;
2954 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2956 if (summon_specific((pet ? -1 : 0), py, px,
2957 dun_level, SUMMON_DEMON, mode))
2960 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2962 msg_print("You have attracted a demon!");
2969 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2975 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2977 msg_print("You feel less energetic.");
2980 if (p_ptr->fast > 0)
2986 set_slow(randint1(30) + 10, FALSE);
2992 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2994 msg_print("You feel more energetic.");
2997 if (p_ptr->slow > 0)
3003 set_fast(randint1(30) + 10, FALSE);
3008 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3012 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3014 msg_print("You suddenly feel almost lonely.");
3017 banish_monsters(100);
3018 if (!dun_level && p_ptr->town_num)
3021 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3023 msg_print("You see one of the shopkeepers running for the hills!");
3026 store_shuffle(randint0(MAX_STORES));
3031 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3036 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3038 msg_print("A shadow passes over you.");
3043 /* Absorb light from the current possition */
3044 if (cave[py][px].info & CAVE_GLOW)
3049 o_ptr = &inventory[INVEN_LITE];
3051 /* Absorb some fuel in the current lite */
3052 if (o_ptr->tval == TV_LITE)
3054 /* Use some fuel (except on artifacts) */
3055 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3057 /* Heal the player a bit */
3058 hp_player(o_ptr->xtra4 / 20);
3060 /* Decrease life-span of lite */
3064 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3066 msg_print("You absorb energy from your light!");
3070 /* Notice interesting fuel steps */
3071 notice_lite_change(o_ptr);
3076 * Unlite the area (radius 10) around player and
3077 * do 50 points damage to every affected monster
3079 unlite_area(50, 10);
3082 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3083 !p_ptr->anti_magic && one_in_(7000))
3085 bool pet = one_in_(3);
3086 u32b mode = PM_ALLOW_GROUP;
3088 if (pet) mode |= PM_FORCE_PET;
3089 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3091 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3094 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3096 msg_print("You have attracted an animal!");
3103 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3104 !p_ptr->anti_magic && one_in_(8000))
3108 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3110 msg_print("You feel the world warping around you!");
3114 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3116 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3118 if (!lose_mutation(0))
3120 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3122 msg_print("You feel oddly normal.");
3126 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3130 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3132 msg_print("You feel insubstantial!");
3136 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3138 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3142 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3144 int which_stat = randint0(6);
3145 int sustained = FALSE;
3150 if (p_ptr->sustain_str) sustained = TRUE;
3153 if (p_ptr->sustain_int) sustained = TRUE;
3156 if (p_ptr->sustain_wis) sustained = TRUE;
3159 if (p_ptr->sustain_dex) sustained = TRUE;
3162 if (p_ptr->sustain_con) sustained = TRUE;
3165 if (p_ptr->sustain_chr) sustained = TRUE;
3169 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3171 msg_print("Invalid stat chosen!");
3181 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3183 msg_print("You can feel yourself wasting away!");
3187 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3190 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3191 !p_ptr->anti_magic && one_in_(3000))
3193 bool pet = one_in_(5);
3194 u32b mode = PM_ALLOW_GROUP;
3196 if (pet) mode |= PM_FORCE_PET;
3197 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3199 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3202 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3204 msg_print("You have attracted a dragon!");
3210 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3213 if (p_ptr->tim_esp > 0)
3216 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3218 msg_print("Your mind feels cloudy!");
3221 set_tim_esp(0, TRUE);
3226 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3228 msg_print("Your mind expands!");
3231 set_tim_esp(p_ptr->lev, FALSE);
3234 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3239 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3241 msg_print("Your stomach roils, and you lose your lunch!");
3245 set_food(PY_FOOD_WEAK);
3248 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3249 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3254 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3256 int danger_amount = 0;
3259 for (monster = 0; monster < m_max; monster++)
3261 monster_type *m_ptr = &m_list[monster];
3262 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3264 /* Paranoia -- Skip dead monsters */
3265 if (!m_ptr->r_idx) continue;
3267 if (r_ptr->level >= p_ptr->lev)
3269 danger_amount += r_ptr->level - p_ptr->lev + 1;
3273 if (danger_amount > 100)
3275 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3277 msg_print("You feel utterly terrified!");
3280 else if (danger_amount > 50)
3282 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3284 msg_print("You feel terrified!");
3287 else if (danger_amount > 20)
3289 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3291 msg_print("You feel very worried!");
3294 else if (danger_amount > 10)
3296 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3298 msg_print("You feel paranoid!");
3301 else if (danger_amount > 5)
3303 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3305 msg_print("You feel almost safe.");
3310 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3312 msg_print("You feel lonely.");
3316 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3321 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3323 msg_print("You feel invincible!");
3327 (void)set_invuln(randint1(8) + 8, FALSE);
3329 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3331 int wounds = p_ptr->mhp - p_ptr->chp;
3335 int healing = p_ptr->csp;
3337 if (healing > wounds)
3343 p_ptr->csp -= healing;
3346 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3349 int wounds = p_ptr->msp - p_ptr->csp;
3353 int healing = p_ptr->chp;
3355 if (healing > wounds)
3360 p_ptr->csp += healing;
3362 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3364 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3369 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3375 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3376 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3378 msg_print("You trip over your own feet!");
3379 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3384 if (buki_motteruka(INVEN_RARM))
3386 int slot = INVEN_RARM;
3387 o_ptr = &inventory[INVEN_RARM];
3388 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3390 o_ptr = &inventory[INVEN_LARM];
3393 if (!cursed_p(o_ptr))
3396 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3398 msg_print("You drop your weapon!");
3401 inven_drop(slot, 1);
3408 /*** Process Inventory ***/
3410 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3413 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3414 * can actually be useful!
3416 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3419 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3421 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3425 teleport_player(50);
3428 /* Make a chainsword noise */
3429 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3433 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3435 if (!get_rnd_line("chainswd.txt", 0, noise))
3438 disturb(FALSE, FALSE);
3441 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3444 (void)activate_ty_curse(FALSE, &count);
3446 /* Handle experience draining */
3447 if (p_ptr->prace != RACE_ANDROID &&
3448 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3450 p_ptr->exp -= (p_ptr->lev+1)/2;
3451 if (p_ptr->exp < 0) p_ptr->exp = 0;
3452 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3453 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3456 /* Add light curse (Later) */
3457 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3462 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3464 new_curse = get_curse(0, o_ptr);
3465 if (!(o_ptr->curse_flags & new_curse))
3467 char o_name[MAX_NLEN];
3469 object_desc(o_name, o_ptr, FALSE, 0);
3471 o_ptr->curse_flags |= new_curse;
3473 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3475 msg_format("There is a malignant black aura surrounding %s...", o_name);
3478 o_ptr->feeling = FEEL_NONE;
3480 p_ptr->update |= (PU_BONUS);
3483 /* Add heavy curse (Later) */
3484 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3489 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3491 new_curse = get_curse(1, o_ptr);
3492 if (!(o_ptr->curse_flags & new_curse))
3494 char o_name[MAX_NLEN];
3496 object_desc(o_name, o_ptr, FALSE, 0);
3498 o_ptr->curse_flags |= new_curse;
3500 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3502 msg_format("There is a malignant black aura surrounding %s...", o_name);
3505 o_ptr->feeling = FEEL_NONE;
3507 p_ptr->update |= (PU_BONUS);
3511 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3513 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3514 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3516 char o_name[MAX_NLEN];
3518 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3520 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3522 msg_format("%s have attracted an animal!", o_name);
3529 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3531 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3533 char o_name[MAX_NLEN];
3535 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3537 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3539 msg_format("%s have attracted a demon!", o_name);
3546 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3548 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3549 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3551 char o_name[MAX_NLEN];
3553 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3555 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3557 msg_format("%s have attracted an animal!", o_name);
3563 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3565 if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
3569 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3571 msg_print("It's so dark... so scary!");
3574 set_afraid(p_ptr->afraid + 13 + randint1(26));
3577 /* Teleport player */
3578 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3582 /* Teleport player */
3583 teleport_player(40);
3585 /* Handle HP draining */
3586 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3588 char o_name[MAX_NLEN];
3590 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3592 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3594 msg_format("%s drains HP from you!", o_name);
3596 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3598 /* Handle mana draining */
3599 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3601 char o_name[MAX_NLEN];
3603 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3605 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3607 msg_format("%s drains mana from you!", o_name);
3609 p_ptr->csp -= MIN(p_ptr->lev, 50);
3613 p_ptr->csp_frac = 0;
3615 p_ptr->redraw |= PR_MANA;
3619 /* Rarely, take damage from the Jewel of Judgement */
3620 if (one_in_(999) && !p_ptr->anti_magic)
3622 if ((inventory[INVEN_LITE].tval) &&
3623 (inventory[INVEN_LITE].sval == SV_LITE_THRAIN))
3626 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3627 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3629 msg_print("The Jewel of Judgement drains life from you!");
3630 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3637 /* Process equipment */
3638 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3640 /* Get the object */
3641 o_ptr = &inventory[i];
3643 /* Skip non-objects */
3644 if (!o_ptr->k_idx) continue;
3646 /* Recharge activatable objects */
3647 if (o_ptr->timeout > 0)
3652 /* Notice changes */
3653 if (!o_ptr->timeout)
3655 recharged_notice(o_ptr);
3661 /* Notice changes */
3665 p_ptr->window |= (PW_EQUIP);
3670 * Recharge rods. Rods now use timeout to control charging status,
3671 * and each charging rod in a stack decreases the stack's timeout by
3672 * one per turn. -LM-
3674 for (j = 0, i = 0; i < INVEN_PACK; i++)
3676 o_ptr = &inventory[i];
3677 k_ptr = &k_info[o_ptr->k_idx];
3679 /* Skip non-objects */
3680 if (!o_ptr->k_idx) continue;
3682 /* Examine all charging rods or stacks of charging rods. */
3683 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3685 /* Determine how many rods are charging. */
3686 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3687 if (temp > o_ptr->number) temp = o_ptr->number;
3689 /* Decrease timeout by that number. */
3690 o_ptr->timeout -= temp;
3692 /* Boundary control. */
3693 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3695 /* Notice changes, provide message if object is inscribed. */
3696 if (!(o_ptr->timeout))
3698 recharged_notice(o_ptr);
3704 /* Notice changes */
3708 p_ptr->notice |= (PN_COMBINE);
3711 p_ptr->window |= (PW_INVEN);
3715 /* Feel the inventory */
3720 /*** Process Objects ***/
3722 /* Process objects */
3723 for (i = 1; i < o_max; i++)
3728 /* Skip dead objects */
3729 if (!o_ptr->k_idx) continue;
3731 /* Recharge rods on the ground. No messages. */
3732 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3735 o_ptr->timeout -= o_ptr->number;
3737 /* Boundary control. */
3738 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3743 /*** Involuntary Movement ***/
3745 /* Delayed Word-of-Recall */
3746 if (p_ptr->word_recall)
3749 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3750 * The player is yanked up/down as soon as
3751 * he loads the autosaved game.
3753 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3754 do_cmd_save_game(TRUE);
3756 /* Count down towards recall */
3757 p_ptr->word_recall--;
3759 p_ptr->redraw |= (PR_STATUS);
3761 /* Activate the recall */
3762 if (!p_ptr->word_recall)
3767 /* Determine the level */
3768 if (dun_level || p_ptr->inside_quest)
3771 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3773 msg_print("You feel yourself yanked upwards!");
3776 p_ptr->recall_dungeon = dungeon_type;
3778 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3782 prepare_change_floor_mode(CFM_CLEAR_ALL);
3784 leave_quest_check();
3786 p_ptr->inside_quest = 0;
3787 p_ptr->leaving = TRUE;
3792 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3794 msg_print("You feel yourself yanked downwards!");
3797 dungeon_type = p_ptr->recall_dungeon;
3800 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3803 dun_level = max_dlv[dungeon_type];
3804 if (dun_level < 1) dun_level = 1;
3806 /* Nightmare mode makes recall more dangerous */
3807 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3813 else if (dun_level < 99)
3815 dun_level = (dun_level + 99) / 2;
3817 else if (dun_level > 100)
3819 dun_level = d_info[dungeon_type].maxdepth - 1;
3823 if (p_ptr->wild_mode)
3825 p_ptr->wilderness_y = py;
3826 p_ptr->wilderness_x = px;
3830 /* Save player position */
3834 p_ptr->wild_mode = FALSE;
3836 prepare_change_floor_mode(CFM_CLEAR_ALL);
3839 p_ptr->leaving = TRUE;
3841 if (dungeon_type == DUNGEON_ANGBAND)
3843 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3845 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
3846 (quest[i].status == QUEST_STATUS_TAKEN) &&
3847 (quest[i].level < dun_level))
3849 quest[i].status = QUEST_STATUS_FAILED;
3850 quest[i].complev = (byte)p_ptr->lev;
3851 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
3858 sound(SOUND_TPLEVEL);
3863 /* Delayed Alter reality */
3864 if (p_ptr->alter_reality)
3866 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3867 do_cmd_save_game(TRUE);
3869 /* Count down towards alter */
3870 p_ptr->alter_reality--;
3872 p_ptr->redraw |= (PR_STATUS);
3874 /* Activate the alter reality */
3875 if (!p_ptr->alter_reality)
3880 /* Determine the level */
3881 if (!quest_number(dun_level) && dun_level)
3884 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
3886 msg_print("The world changes!");
3889 prepare_change_floor_mode(CFM_CLEAR_ALL);
3892 p_ptr->leaving = TRUE;
3897 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
3899 msg_print("The world seems to change for a moment!");
3904 sound(SOUND_TPLEVEL);
3912 * Verify use of "wizard" mode
3914 static bool enter_wizard_mode(void)
3916 /* Ask first time */
3917 if (!p_ptr->noscore)
3919 /* Wizard mode is not permitted */
3920 if (!allow_debug_opts)
3923 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
3925 msg_print("Wizard mode is not permitted.");
3930 /* Mention effects */
3932 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
3933 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
3935 msg_print("Wizard mode is for debugging and experimenting.");
3936 msg_print("The game will not be scored if you enter wizard mode.");
3941 /* Verify request */
3943 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
3945 if (!get_check("Are you sure you want to enter wizard mode? "))
3953 p_ptr->noscore |= 0x0002;
3964 * Verify use of "debug" commands
3966 static bool enter_debug_mode(void)
3968 /* Ask first time */
3969 if (!p_ptr->noscore)
3971 /* Debug mode is not permitted */
3972 if (!allow_debug_opts)
3975 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
3977 msg_print("Use of debug command is not permitted.");
3982 /* Mention effects */
3984 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
3985 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
3987 msg_print("The debug commands are for debugging and experimenting.");
3988 msg_print("The game will not be scored if you use debug commands.");
3993 /* Verify request */
3995 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
3997 if (!get_check("Are you sure you want to use debug commands? "))
4005 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4007 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4010 p_ptr->noscore |= 0x0008;
4018 * Hack -- Declare the Debug Routines
4020 extern void do_cmd_debug(void);
4022 #endif /* ALLOW_WIZARD */
4028 * Verify use of "borg" commands
4030 static bool enter_borg_mode(void)
4032 /* Ask first time */
4033 if (!(p_ptr->noscore & 0x0010))
4035 /* Mention effects */
4037 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4038 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4040 msg_print("The borg commands are for debugging and experimenting.");
4041 msg_print("The game will not be scored if you use borg commands.");
4046 /* Verify request */
4048 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4050 if (!get_check("Are you sure you want to use borg commands? "))
4058 p_ptr->noscore |= 0x0010;
4066 * Hack -- Declare the Ben Borg
4068 extern void do_cmd_borg(void);
4070 #endif /* ALLOW_BORG */
4075 * Parse and execute the current command
4076 * Give "Warning" on illegal commands.
4078 * XXX XXX XXX Make some "blocks"
4080 static void process_command(void)
4082 int old_now_message = now_message;
4084 #ifdef ALLOW_REPEAT /* TNB */
4086 /* Handle repeating the last command */
4089 #endif /* ALLOW_REPEAT -- TNB */
4093 /* Parse the command */
4094 switch (command_cmd)
4110 /*** Wizard Commands ***/
4112 /* Toggle Wizard Mode */
4117 p_ptr->wizard = FALSE;
4119 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4121 msg_print("Wizard mode off.");
4125 else if (enter_wizard_mode())
4127 p_ptr->wizard = TRUE;
4129 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4131 msg_print("Wizard mode on.");
4136 /* Update monsters */
4137 p_ptr->update |= (PU_MONSTERS);
4139 /* Redraw "title" */
4140 p_ptr->redraw |= (PR_TITLE);
4148 /* Special "debug" commands */
4151 /* Enter debug mode */
4152 if (enter_debug_mode())
4159 #endif /* ALLOW_WIZARD */
4164 /* Special "borg" commands */
4167 /* Enter borg mode */
4168 if (enter_borg_mode())
4170 if (!p_ptr->wild_mode) do_cmd_borg();
4176 #endif /* ALLOW_BORG */
4180 /*** Inventory Commands ***/
4182 /* Wear/wield equipment */
4185 if (!p_ptr->wild_mode) do_cmd_wield();
4189 /* Take off equipment */
4192 if (!p_ptr->wild_mode) do_cmd_takeoff();
4199 if (!p_ptr->wild_mode) do_cmd_drop();
4203 /* Destroy an item */
4210 /* Equipment list */
4217 /* Inventory list */
4225 /*** Various commands ***/
4227 /* Identify an object */
4234 /* Hack -- toggle windows */
4237 toggle_inven_equip();
4242 /*** Standard "Movement" Commands ***/
4247 if (!p_ptr->wild_mode) do_cmd_alter();
4254 if (!p_ptr->wild_mode) do_cmd_tunnel();
4258 /* Move (usually pick up things) */
4261 #ifdef ALLOW_EASY_DISARM /* TNB */
4265 #else /* ALLOW_EASY_DISARM -- TNB */
4267 do_cmd_walk(always_pickup);
4269 #endif /* ALLOW_EASY_DISARM -- TNB */
4274 /* Move (usually do not pick up) */
4277 #ifdef ALLOW_EASY_DISARM /* TNB */
4281 #else /* ALLOW_EASY_DISARM -- TNB */
4283 do_cmd_walk(!always_pickup);
4285 #endif /* ALLOW_EASY_DISARM -- TNB */
4291 /*** Running, Resting, Searching, Staying */
4293 /* Begin Running -- Arg is Max Distance */
4296 if (!p_ptr->wild_mode) do_cmd_run();
4300 /* Stay still (usually pick things up) */
4303 do_cmd_stay(always_pickup);
4307 /* Stay still (usually do not pick up) */
4310 do_cmd_stay(!always_pickup);
4314 /* Rest -- Arg is time */
4321 /* Search for traps/doors */
4328 /* Toggle search mode */
4331 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4332 else set_action(ACTION_SEARCH);
4337 /*** Stairs and Doors and Chests and Traps ***/
4340 case SPECIAL_KEY_STORE:
4342 if (!p_ptr->wild_mode) do_cmd_store();
4346 /* Enter building -KMW- */
4347 case SPECIAL_KEY_BUILDING:
4349 if (!p_ptr->wild_mode) do_cmd_bldg();
4353 /* Enter quest level -KMW- */
4354 case SPECIAL_KEY_QUEST:
4356 if (!p_ptr->wild_mode) do_cmd_quest();
4360 /* Go up staircase */
4363 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4370 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4372 msg_print("To flee the ambush you have to reach the edge of the map.");
4375 else if (p_ptr->food < PY_FOOD_WEAK)
4378 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4380 msg_print("You must eat something here.");
4385 if (change_wild_mode())
4398 /* Go down staircase */
4401 if(!p_ptr->wild_mode) do_cmd_go_down();
4404 p_ptr->wilderness_x = px;
4405 p_ptr->wilderness_y = py;
4411 /* Open a door or chest */
4414 if (!p_ptr->wild_mode) do_cmd_open();
4421 if (!p_ptr->wild_mode) do_cmd_close();
4425 /* Jam a door with spikes */
4428 if (!p_ptr->wild_mode) do_cmd_spike();
4435 if (!p_ptr->wild_mode) do_cmd_bash();
4439 /* Disarm a trap or chest */
4442 if (!p_ptr->wild_mode) do_cmd_disarm();
4447 /*** Magic and Prayers ***/
4449 /* Gain new spells/prayers */
4452 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4454 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4456 msg_print("You don't have to learn spells!");
4458 else if (p_ptr->pclass == CLASS_SAMURAI)
4459 do_cmd_gain_hissatsu();
4460 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4470 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4471 (p_ptr->pclass == CLASS_BERSERKER) ||
4472 (p_ptr->pclass == CLASS_NINJA) ||
4473 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4474 ) do_cmd_mind_browse();
4475 else if (p_ptr->pclass == CLASS_SMITH)
4477 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4478 do_cmd_magic_eater(TRUE);
4479 else do_cmd_browse();
4487 if (!p_ptr->wild_mode)
4489 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4492 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4494 msg_print("You cannot cast spells!");
4497 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4500 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4502 msg_print("The dungeon absorbs all attempted magic!");
4506 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4510 cptr which_power = "ËâË¡";
4512 cptr which_power = "magic";
4514 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4516 which_power = "ĶǽÎÏ";
4518 which_power = "psionic powers";
4520 else if (p_ptr->pclass == CLASS_IMITATOR)
4522 which_power = "¤â¤Î¤Þ¤Í";
4524 which_power = "imitation";
4526 else if (p_ptr->pclass == CLASS_SAMURAI)
4528 which_power = "ɬ»¦·õ";
4530 which_power = "hissatsu";
4532 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4534 which_power = "¶ÀËâË¡";
4536 which_power = "mirror magic";
4538 else if (p_ptr->pclass == CLASS_NINJA)
4540 which_power = "Ǧ½Ñ";
4542 which_power = "ninjutsu";
4544 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4546 which_power = "µ§¤ê";
4548 which_power = "prayer";
4552 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4554 msg_format("An anti-magic shell disrupts your %s!", which_power);
4558 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4561 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4563 msg_format("You cannot think directly!");
4569 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4570 (p_ptr->pclass == CLASS_BERSERKER) ||
4571 (p_ptr->pclass == CLASS_NINJA) ||
4572 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4575 else if (p_ptr->pclass == CLASS_IMITATOR)
4577 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4578 do_cmd_magic_eater(FALSE);
4579 else if (p_ptr->pclass == CLASS_SAMURAI)
4581 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4582 do_cmd_cast_learned();
4583 else if (p_ptr->pclass == CLASS_SMITH)
4592 /* Issue a pet command */
4595 if (!p_ptr->wild_mode) do_cmd_pet();
4599 /*** Use various objects ***/
4601 /* Inscribe an object */
4608 /* Uninscribe an object */
4611 do_cmd_uninscribe();
4615 /* Activate an artifact */
4618 if (!p_ptr->wild_mode)
4620 if (!p_ptr->inside_arena)
4625 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4627 msg_print("The arena absorbs all attempted magic!");
4643 /* Fuel your lantern/torch */
4653 if (!p_ptr->wild_mode) do_cmd_fire();
4660 if (!p_ptr->wild_mode)
4670 if (!p_ptr->wild_mode)
4672 if (!p_ptr->inside_arena)
4677 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4679 msg_print("The arena absorbs all attempted magic!");
4691 if (!p_ptr->wild_mode)
4693 if (p_ptr->inside_arena)
4696 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4698 msg_print("The arena absorbs all attempted magic!");
4703 else if (use_command && rogue_like_commands)
4715 /* Quaff a potion */
4718 if (!p_ptr->wild_mode)
4720 if (!p_ptr->inside_arena)
4721 do_cmd_quaff_potion();
4725 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4727 msg_print("The arena absorbs all attempted magic!");
4739 if (!p_ptr->wild_mode)
4741 if (!p_ptr->inside_arena)
4742 do_cmd_read_scroll();
4746 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4748 msg_print("The arena absorbs all attempted magic!");
4760 if (!p_ptr->wild_mode)
4762 if (p_ptr->inside_arena)
4765 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4767 msg_print("The arena absorbs all attempted magic!");
4772 else if (use_command && !rogue_like_commands)
4782 /* Use racial power */
4785 if (!p_ptr->wild_mode) do_cmd_racial_power();
4790 /*** Looking at Things (nearby or on map) ***/
4792 /* Full dungeon map */
4799 /* Locate player on map */
4813 /* Target monster or location */
4816 if (!p_ptr->wild_mode) do_cmd_target();
4822 /*** Help and Such ***/
4831 /* Identify symbol */
4834 do_cmd_query_symbol();
4838 /* Character description */
4841 do_cmd_change_name();
4846 /*** System Commands ***/
4848 /* Hack -- User interface */
4855 /* Single line from a pref file */
4870 do_cmd_edit_autopick();
4874 /* Interact with macros */
4881 /* Interact with visuals */
4889 /* Interact with colors */
4897 /* Interact with options */
4905 /*** Misc Commands ***/
4921 /* Repeat level feeling */
4924 if (!p_ptr->wild_mode) do_cmd_feeling();
4928 /* Show previous message */
4931 do_cmd_message_one();
4935 /* Show previous messages */
4938 do_cmd_messages(old_now_message);
4942 /* Show quest status -KMW- */
4945 do_cmd_checkquest();
4949 /* Redraw the screen */
4952 now_message = old_now_message;
4957 #ifndef VERIFY_SAVEFILE
4959 /* Hack -- Save and don't quit */
4962 do_cmd_save_game(FALSE);
4966 #endif /* VERIFY_SAVEFILE */
4976 case SPECIAL_KEY_QUIT:
4978 do_cmd_save_and_exit();
4982 /* Quit (commit suicide) */
4995 /* Check artifacts, uniques, objects */
5002 /* Load "screen dump" */
5005 do_cmd_load_screen();
5009 /* Save "screen dump" */
5012 do_cmd_save_screen();
5016 /* Make random artifact list */
5019 spoil_random_artifact("randifact.txt");
5023 /* Hack -- Unknown command */
5026 if (flush_failure) flush();
5030 sound(SOUND_ILLEGAL);
5032 if (!get_rnd_line("error_j.txt", 0, error_m))
5034 if (!get_rnd_line("error.txt", 0, error_m))
5041 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5043 prt("Type '?' for help.", 0, 0);
5049 if (!energy_use && !now_message)
5050 now_message = old_now_message;
5056 static bool monster_tsuri(int r_idx)
5058 monster_race *r_ptr = &r_info[r_idx];
5060 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5068 * Process the player
5070 * Notice the annoying code to handle "pack overflow", which
5071 * must come first just in case somebody manages to corrupt
5072 * the savefiles by clever use of menu commands or something.
5074 static void process_player(void)
5078 /*** Apply energy ***/
5083 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5085 msg_print("You feel different!");
5088 (void)gain_random_mutation(0);
5089 hack_mutation = FALSE;
5092 if (p_ptr->inside_battle)
5094 for(i = 1; i < m_max; i++)
5096 monster_type *m_ptr = &m_list[i];
5098 if (!m_ptr->r_idx) continue;
5100 /* Hack -- Detect monster */
5101 m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
5103 /* Update the monster */
5104 update_mon(i, FALSE);
5109 /* Give the player some energy */
5110 else if (!(load && p_ptr->energy_need <= 0))
5112 p_ptr->energy_need -= (p_ptr->pspeed > 199 ? 49 : (p_ptr->pspeed < 0 ? 1 : extract_energy[p_ptr->pspeed]));
5116 if (p_ptr->energy_need > 0) return;
5117 if (!command_rep) prt_time();
5119 /*** Check for interupts ***/
5121 /* Complete resting */
5128 if ((p_ptr->chp == p_ptr->mhp) &&
5129 (p_ptr->csp >= p_ptr->msp))
5131 set_action(ACTION_NONE);
5135 /* Complete resting */
5136 else if (resting == -2)
5139 if ((p_ptr->chp == p_ptr->mhp) &&
5140 (p_ptr->csp >= p_ptr->msp) &&
5141 !p_ptr->blind && !p_ptr->confused &&
5142 !p_ptr->poisoned && !p_ptr->afraid &&
5143 !p_ptr->stun && !p_ptr->cut &&
5144 !p_ptr->slow && !p_ptr->paralyzed &&
5145 !p_ptr->image && !p_ptr->word_recall &&
5146 !p_ptr->alter_reality)
5148 set_action(ACTION_NONE);
5153 if (p_ptr->action == ACTION_FISH)
5156 Term_xtra(TERM_XTRA_DELAY, 10);
5160 bool success = FALSE;
5161 get_mon_num_prep(monster_tsuri,NULL);
5162 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5164 if (r_idx && one_in_(2))
5167 y = py+ddy[tsuri_dir];
5168 x = px+ddx[tsuri_dir];
5169 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5172 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5174 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5176 msg_format("You have a good catch!", m_name);
5184 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5186 msg_print("Damn! The fish stole your bait!");
5193 /* Handle "abort" */
5196 /* Check for "player abort" (semi-efficiently for resting) */
5197 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5202 /* Check for a key */
5211 /* Hack -- Show a Message */
5213 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5215 msg_print("Canceled.");
5222 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5224 monster_type *m_ptr = &m_list[p_ptr->riding];
5233 /* Acquire the monster name */
5234 monster_desc(m_name, m_ptr, 0);
5236 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5238 msg_format("You have waked %s up.", m_name);
5240 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5241 p_ptr->redraw |= (PR_UHEALTH);
5248 /* Make a "saving throw" against stun */
5249 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5255 /* Hack -- Recover from stun */
5256 if (m_ptr->stunned > d)
5258 /* Recover somewhat */
5259 m_ptr->stunned -= d;
5270 /* Acquire the monster name */
5271 monster_desc(m_name, m_ptr, 0);
5273 /* Dump a message */
5275 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5277 msg_format("%^s is no longer stunned.", m_name);
5279 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5280 p_ptr->redraw |= (PR_UHEALTH);
5284 if (m_ptr->confused)
5288 /* Make a "saving throw" against stun */
5289 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5292 d = m_ptr->confused;
5295 /* Hack -- Recover from stun */
5296 if (m_ptr->confused > d)
5298 /* Recover somewhat */
5299 m_ptr->confused -= d;
5308 m_ptr->confused = 0;
5310 /* Acquire the monster name */
5311 monster_desc(m_name, m_ptr, 0);
5313 /* Dump a message */
5315 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5317 msg_format("%^s is no longer confused.", m_name);
5319 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5320 p_ptr->redraw |= (PR_UHEALTH);
5328 /* Make a "saving throw" against stun */
5329 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5335 /* Hack -- Recover from stun */
5336 if (m_ptr->monfear > d)
5338 /* Recover somewhat */
5339 m_ptr->monfear -= d;
5350 /* Acquire the monster name */
5351 monster_desc(m_name, m_ptr, 0);
5353 /* Dump a message */
5355 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5357 msg_format("%^s is no longer fear.", m_name);
5359 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5360 p_ptr->redraw |= (PR_UHEALTH);
5364 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5368 /* Handle the player song */
5369 if (!load) check_music();
5374 if (p_ptr->lightspeed)
5376 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5378 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5380 if (p_ptr->magic_num1[0] < 40)
5382 p_ptr->magic_num1[0] = 0;
5384 else p_ptr->magic_num1[0] -= 40;
5385 p_ptr->update |= (PU_BONUS);
5387 if (p_ptr->action == ACTION_LEARN)
5389 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5390 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5393 p_ptr->csp_frac = 0;
5394 set_action(ACTION_NONE);
5398 p_ptr->csp -= (s16b)(hoge >> 16);
5400 if (p_ptr->csp_frac < hoge)
5402 p_ptr->csp_frac += 0x10000L - hoge;
5406 p_ptr->csp_frac -= hoge;
5408 p_ptr->redraw |= PR_MANA;
5411 if (p_ptr->special_defense & KATA_MASK)
5413 if (p_ptr->special_defense & KATA_MUSOU)
5417 set_action(ACTION_NONE);
5422 p_ptr->redraw |= (PR_MANA);
5427 /*** Handle actual user input ***/
5429 /* Repeat until out of energy */
5430 while (p_ptr->energy_need <= 0)
5432 p_ptr->window |= PW_PLAYER;
5433 p_ptr->sutemi = FALSE;
5434 p_ptr->counter = FALSE;
5435 now_damaged = FALSE;
5437 /* Handle "p_ptr->notice" */
5440 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5443 /* Place the cursor on the player */
5444 move_cursor_relative(py, px);
5446 /* Refresh (optional) */
5447 if (fresh_before) Term_fresh();
5450 /* Hack -- Pack Overflow */
5451 if (inventory[INVEN_PACK].k_idx)
5453 int item = INVEN_PACK;
5455 char o_name[MAX_NLEN];
5459 /* Access the slot to be dropped */
5460 o_ptr = &inventory[item];
5467 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5469 msg_print("Your pack overflows!");
5474 object_desc(o_name, o_ptr, TRUE, 3);
5478 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5480 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5484 /* Drop it (carefully) near the player */
5485 (void)drop_near(o_ptr, 0, py, px);
5487 /* Modify, Describe, Optimize */
5488 inven_item_increase(item, -255);
5489 inven_item_describe(item);
5490 inven_item_optimize(item);
5492 /* Handle "p_ptr->notice" */
5495 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5500 /* Hack -- cancel "lurking browse mode" */
5501 if (!command_new) command_see = FALSE;
5504 /* Assume free turn */
5508 if (p_ptr->inside_battle)
5510 /* Place the cursor on the player */
5511 move_cursor_relative(py, px);
5513 command_cmd = SPECIAL_KEY_BUILDING;
5515 /* Process the command */
5519 /* Paralyzed or Knocked Out */
5520 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5527 else if (p_ptr->action == ACTION_REST)
5532 /* Reduce rest count */
5535 if (!resting) set_action(ACTION_NONE);
5537 /* Redraw the state */
5538 p_ptr->redraw |= (PR_STATE);
5546 else if (p_ptr->action == ACTION_FISH)
5559 /* Repeated command */
5560 else if (command_rep)
5562 /* Count this execution */
5565 /* Redraw the state */
5566 p_ptr->redraw |= (PR_STATE);
5571 /* Hack -- Assume messages were seen */
5574 /* Clear the top line */
5577 /* Process the command */
5581 /* Normal command */
5584 /* Place the cursor on the player */
5585 move_cursor_relative(py, px);
5588 /* Get a command (normal) */
5589 request_command(FALSE);
5592 /* Process the command */
5602 /* Use some energy */
5603 if (world_player || energy_use > 400)
5605 /* The Randomness is irrelevant */
5606 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5610 /* There is some randomness of needed energy */
5611 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5614 /* Hack -- constant hallucination */
5615 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5618 /* Shimmer monsters if needed */
5619 if (shimmer_monsters)
5621 /* Clear the flag */
5622 shimmer_monsters = FALSE;
5624 /* Shimmer multi-hued monsters */
5625 for (i = 1; i < m_max; i++)
5627 monster_type *m_ptr;
5628 monster_race *r_ptr;
5630 /* Access monster */
5633 /* Skip dead monsters */
5634 if (!m_ptr->r_idx) continue;
5636 /* Access the monster race */
5637 r_ptr = &r_info[m_ptr->r_idx];
5639 /* Skip non-multi-hued monsters */
5640 if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue;
5642 /* Reset the flag */
5643 shimmer_monsters = TRUE;
5645 /* Redraw regardless */
5646 lite_spot(m_ptr->fy, m_ptr->fx);
5651 /* Handle monster detection */
5652 if (repair_monsters)
5654 /* Reset the flag */
5655 repair_monsters = FALSE;
5657 /* Rotate detection flags */
5658 for (i = 1; i < m_max; i++)
5660 monster_type *m_ptr;
5662 /* Access monster */
5665 /* Skip dead monsters */
5666 if (!m_ptr->r_idx) continue;
5668 /* Nice monsters get mean */
5669 if (m_ptr->mflag & MFLAG_NICE)
5671 /* Nice monsters get mean */
5672 m_ptr->mflag &= ~(MFLAG_NICE);
5675 /* Handle memorized monsters */
5676 if (m_ptr->mflag & MFLAG_MARK)
5678 /* Maintain detection */
5679 if (m_ptr->mflag & MFLAG_SHOW)
5682 m_ptr->mflag &= ~(MFLAG_SHOW);
5684 /* Still need repairs */
5685 repair_monsters = TRUE;
5688 /* Remove detection */
5692 m_ptr->mflag &= ~(MFLAG_MARK);
5694 /* Assume invisible */
5697 /* Update the monster */
5698 update_mon(i, FALSE);
5700 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
5701 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
5703 /* Redraw regardless */
5704 lite_spot(m_ptr->fy, m_ptr->fx);
5709 if (p_ptr->pclass == CLASS_IMITATOR)
5711 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5714 for (i = 0; i < p_ptr->mane_num; i++)
5716 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
5717 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
5721 p_ptr->redraw |= (PR_MANE);
5723 if (p_ptr->action == ACTION_LEARN)
5726 p_ptr->redraw |= (PR_STATE);
5729 if (world_player && (p_ptr->energy_need > - 1000))
5732 p_ptr->redraw |= (PR_MAP);
5734 /* Update monsters */
5735 p_ptr->update |= (PU_MONSTERS);
5738 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5741 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
5743 msg_print("You feel time flowing around you once more.");
5746 world_player = FALSE;
5747 p_ptr->energy_need = ENERGY_NEED();
5749 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5754 /* Hack -- notice death */
5755 if (!p_ptr->playing || p_ptr->is_dead)
5757 world_player = FALSE;
5761 /* Handle "leaving" */
5762 if (p_ptr->leaving) break;
5765 /* Update scent trail */
5771 * Interact with the current dungeon level.
5773 * This function will not exit until the level is completed,
5774 * the user dies, or the game is terminated.
5776 static void dungeon(bool load_game)
5780 /* Set the base level */
5781 base_level = dun_level;
5783 /* Reset various flags */
5787 p_ptr->leaving = FALSE;
5789 /* Reset the "command" vars */
5797 /* Cancel the target */
5801 ambush_flag = FALSE;
5803 /* Cancel the health bar */
5806 /* Check visual effects */
5807 shimmer_monsters = TRUE;
5808 shimmer_objects = TRUE;
5809 repair_monsters = TRUE;
5810 repair_objects = TRUE;
5816 /* Get index of current quest (if any) */
5817 quest_num = quest_number(dun_level);
5819 /* Inside a quest? */
5822 /* Mark the quest monster */
5823 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
5826 /* Track maximum player level */
5827 if (p_ptr->max_plv < p_ptr->lev)
5829 p_ptr->max_plv = p_ptr->lev;
5833 /* Track maximum dungeon level (if not in quest -KMW-) */
5834 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
5836 max_dlv[dungeon_type] = dun_level;
5837 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
5840 /* Validate the panel */
5841 panel_bounds_center();
5843 /* Verify the panel */
5846 /* Flush messages */
5850 /* Enter "xtra" mode */
5851 character_xtra = TRUE;
5854 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5856 /* Redraw dungeon */
5857 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5860 p_ptr->redraw |= (PR_MAP);
5863 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5865 /* Update lite/view */
5866 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
5868 /* Update monsters */
5869 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
5871 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5874 /* Leave "xtra" mode */
5875 character_xtra = FALSE;
5878 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5880 /* Combine / Reorder the pack */
5881 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5883 /* Handle "p_ptr->notice" */
5886 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5892 if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5894 if (p_ptr->inside_battle)
5898 p_ptr->energy_need = 0;
5905 msg_print("»î¹ç³«»Ï¡ª");
5907 msg_format("Ready..Fight!");
5913 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
5914 p_ptr->magic_num1[0] = MUSIC_DETECT;
5916 /* Hack -- notice death or departure */
5917 if (!p_ptr->playing || p_ptr->is_dead) return;
5919 /* Print quest message if appropriate */
5920 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
5922 quest_discovery(random_quest_number(dun_level));
5923 p_ptr->inside_quest = random_quest_number(dun_level);
5925 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
5927 if (r_info[d_info[dungeon_type].final_guardian].max_num)
5929 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
5930 d_name+d_info[dungeon_type].name,
5931 r_name+r_info[d_info[dungeon_type].final_guardian].name);
5933 msg_format("%^s lives in this level as the keeper of %s.",
5934 r_name+r_info[d_info[dungeon_type].final_guardian].name,
5935 d_name+d_info[dungeon_type].name);
5939 /*** Process this dungeon level ***/
5941 /* Reset the monster generation level */
5942 monster_level = base_level;
5944 /* Reset the object generation level */
5945 object_level = base_level;
5949 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5950 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5951 p_ptr->energy_need = 0;
5953 /* Not leaving dungeon */
5954 p_ptr->leaving_dungeon = FALSE;
5959 /* Hack -- Compact the monster list occasionally */
5960 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5962 /* Hack -- Compress the monster list occasionally */
5963 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5966 /* Hack -- Compact the object list occasionally */
5967 if (o_cnt + 32 > max_o_idx) compact_objects(64);
5969 /* Hack -- Compress the object list occasionally */
5970 if (o_cnt + 32 < o_max) compact_objects(0);
5973 /* Process the player */
5976 /* Handle "p_ptr->notice" */
5979 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5982 /* Hack -- Hilite the player */
5983 move_cursor_relative(py, px);
5985 /* Optional fresh */
5986 if (fresh_after) Term_fresh();
5988 /* Hack -- Notice death or departure */
5989 if (!p_ptr->playing || p_ptr->is_dead) break;
5991 /* Process all of the monsters */
5994 /* Handle "p_ptr->notice" */
5997 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6000 /* Hack -- Hilite the player */
6001 move_cursor_relative(py, px);
6003 /* Optional fresh */
6004 if (fresh_after) Term_fresh();
6006 /* Hack -- Notice death or departure */
6007 if (!p_ptr->playing || p_ptr->is_dead) break;
6010 /* Process the world */
6013 /* Handle "p_ptr->notice" */
6016 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6019 /* Hack -- Hilite the player */
6020 move_cursor_relative(py, px);
6022 /* Optional fresh */
6023 if (fresh_after) Term_fresh();
6025 /* Hack -- Notice death or departure */
6026 if (!p_ptr->playing || p_ptr->is_dead) break;
6028 /* Handle "leaving" */
6029 if (p_ptr->leaving) break;
6031 /* Count game turns */
6033 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6034 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6035 if (wild_regen) wild_regen--;
6038 /* Inside a quest and non-unique questor? */
6039 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6041 /* Un-mark the quest monster */
6042 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6045 /* Not save-and-quit and not dead? */
6046 if (p_ptr->playing && !p_ptr->is_dead)
6049 * Maintain Unique monsters and artifact, save current
6050 * floor, then prepare next floor
6054 /* Forget the flag */
6055 reinit_wilderness = FALSE;
6058 /* Write about current level on the play record once per level */
6064 * Load some "user pref files"
6066 * Modified by Arcum Dagsson to support
6067 * separate macro files for different realms.
6069 static void load_all_pref_files(void)
6074 /* Access the "user" pref file */
6075 sprintf(buf, "user.prf");
6077 /* Process that file */
6078 process_pref_file(buf);
6080 /* Access the "user" system pref file */
6081 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6083 /* Process that file */
6084 process_pref_file(buf);
6086 /* Access the "race" pref file */
6087 sprintf(buf, "%s.prf", rp_ptr->title);
6089 /* Process that file */
6090 process_pref_file(buf);
6092 /* Access the "class" pref file */
6093 sprintf(buf, "%s.prf", cp_ptr->title);
6095 /* Process that file */
6096 process_pref_file(buf);
6098 /* Access the "character" pref file */
6099 sprintf(buf, "%s.prf", player_base);
6101 /* Process that file */
6102 process_pref_file(buf);
6104 /* Free old entries */
6108 sprintf(buf, "picktype-%s.prf", player_base);
6110 sprintf(buf, "pickpref-%s.prf", player_base);
6113 err = process_pickpref_file(buf);
6115 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6119 process_pickpref_file("picktype.prf");
6121 process_pickpref_file("pickpref.prf");
6125 /* Access the "realm 1" pref file */
6126 if (p_ptr->realm1 != REALM_NONE)
6128 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6130 /* Process that file */
6131 process_pref_file(buf);
6134 /* Access the "realm 2" pref file */
6135 if (p_ptr->realm2 != REALM_NONE)
6137 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6139 /* Process that file */
6140 process_pref_file(buf);
6146 * Actually play a game
6148 * If the "new_game" parameter is true, then, after loading the
6149 * savefile, we will commit suicide, if necessary, to allow the
6150 * player to start a new game.
6152 void play_game(bool new_game)
6155 bool load_game = TRUE;
6165 hack_mutation = FALSE;
6167 /* Hack -- Character is "icky" */
6168 character_icky = TRUE;
6170 /* Make sure main term is active */
6171 Term_activate(angband_term[0]);
6173 /* Initialise the resize hooks */
6174 angband_term[0]->resize_hook = resize_map;
6176 for (i = 1; i < 8; i++)
6178 /* Does the term exist? */
6179 if (angband_term[i])
6181 /* Add the redraw on resize hook */
6182 angband_term[i]->resize_hook = redraw_window;
6186 /* Hack -- turn off the cursor */
6187 (void)Term_set_cursor(0);
6190 /* Attempt to load */
6195 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6197 quit("broken savefile");
6202 /* Extract the options */
6203 for (i = 0; option_info[i].o_desc; i++)
6205 int os = option_info[i].o_set;
6206 int ob = option_info[i].o_bit;
6208 /* Set the "default" options */
6209 if (option_info[i].o_var)
6212 if (option_flag[os] & (1L << ob))
6215 (*option_info[i].o_var) = TRUE;
6222 (*option_info[i].o_var) = FALSE;
6227 /* Report waited score */
6228 if (p_ptr->wait_report_score)
6234 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6236 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6241 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6246 p_ptr->is_dead = TRUE;
6248 start_time = time(NULL);
6250 /* No suspending now */
6251 signals_ignore_tstp();
6253 /* Hack -- Character is now "icky" */
6254 character_icky = TRUE;
6256 /* Build the filename */
6257 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6259 /* Open the high score file, for reading/writing */
6260 highscore_fd = fd_open(buf, O_RDWR);
6262 /* Handle score, show Top scores */
6263 success = send_world_score(TRUE);
6266 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6268 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6272 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6274 prt("standing by for future registration...", 0, 0);
6280 p_ptr->wait_report_score = FALSE;
6283 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6285 if (!save_player()) msg_print("death save failed!");
6288 /* Shut the high score file */
6289 (void)fd_close(highscore_fd);
6291 /* Forget the high score fd */
6294 /* Allow suspending now */
6295 signals_handle_tstp();
6300 /* Nothing loaded */
6301 if (!character_loaded)
6303 /* Make new player */
6306 /* The dungeon is not ready */
6307 character_dungeon = FALSE;
6309 /* Prepare to init the RNG */
6312 /* Initialize the saved floors data */
6313 init_saved_floors();
6316 /* Old game is loaded. But new game is requested. */
6319 /* Delete expanded temporal files */
6320 clear_saved_floor_files();
6323 /* Process old character */
6326 /* Process the player name */
6327 process_player_name(FALSE);
6336 seed = (time(NULL));
6340 /* Mutate the seed on Unix machines */
6341 seed = ((seed >> 3) * (getpid() << 1));
6345 /* Use the complex RNG */
6348 /* Seed the "complex" RNG */
6349 Rand_state_init(seed);
6352 /* Roll new character */
6355 monster_race *r_ptr;
6357 /* The dungeon is not ready */
6358 character_dungeon = FALSE;
6362 p_ptr->inside_quest = 0;
6363 p_ptr->inside_arena = FALSE;
6364 p_ptr->inside_battle = FALSE;
6368 /* Hack -- seed for flavors */
6369 seed_flavor = randint0(0x10000000);
6371 /* Hack -- seed for town layout */
6372 seed_town = randint0(0x10000000);
6374 /* Roll up a new character */
6381 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6383 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6387 get_mon_num_prep(NULL, NULL);
6388 for (i = 0; i < MAX_KUBI; i++)
6394 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6395 r_ptr = &r_info[kubi_r_idx[i]];
6397 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6399 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6400 if (r_ptr->rarity > 100) continue;
6402 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6404 for (j = 0; j < i; j++)
6405 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6410 for (i = 0; i < MAX_KUBI -1; i++)
6413 for (j = i; j < MAX_KUBI; j++)
6415 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6417 tmp = kubi_r_idx[i];
6418 kubi_r_idx[i] = kubi_r_idx[j];
6419 kubi_r_idx[j] = tmp;
6424 p_ptr->inside_battle = TRUE;
6427 today_mon = get_mon_num(3);
6428 r_ptr = &r_info[today_mon];
6430 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6431 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6432 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6433 if (r_ptr->rarity > 10) continue;
6434 if (r_ptr->level == 0) continue;
6437 p_ptr->inside_battle = FALSE;
6441 write_level = FALSE;
6444 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6446 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6450 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6451 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6453 if (p_ptr->riding == -1)
6456 for(i = m_max; i > 0; i--)
6458 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6467 p_ptr->teleport_town = FALSE;
6468 p_ptr->sutemi = FALSE;
6469 world_monster = FALSE;
6470 now_damaged = FALSE;
6472 start_time = time(NULL) - 1;
6473 record_o_name[0] = '\0';
6475 /* Reset map panel */
6476 panel_row_min = cur_hgt;
6477 panel_col_min = cur_wid;
6479 /* Sexy gal gets bonus to maximum weapon skill of whip */
6480 if(p_ptr->pseikaku == SEIKAKU_SEXY)
6481 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = 8000;
6483 /* Fill the arrays of floors and walls in the good proportions */
6484 set_floor_and_wall(dungeon_type);
6486 /* Flavor the objects */
6494 /* Flash a message */
6496 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6498 prt("Please wait...", 0, 0);
6502 /* Flush the message */
6506 /* Hack -- Enter wizard mode */
6509 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6510 else if (p_ptr->is_dead) quit("Already dead.");
6513 /* Initialize the town-buildings if necessary */
6514 if (!dun_level && !p_ptr->inside_quest)
6516 /* Init the wilderness */
6518 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6521 init_flags = INIT_ONLY_BUILDINGS;
6523 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6528 /* Initialize vault info */
6530 if (init_v_info()) quit("·úÃÛʪ½é´ü²½ÉÔǽ");
6532 if (init_v_info()) quit("Cannot initialize vaults");
6535 /* Generate a dungeon level if needed */
6536 if (!character_dungeon) change_floor();
6539 /* Character is now "complete" */
6540 character_generated = TRUE;
6543 /* Hack -- Character is no longer "icky" */
6544 character_icky = FALSE;
6548 p_ptr->playing = TRUE;
6550 /* Reset the visual mappings */
6553 /* Load the "pref" files */
6554 load_all_pref_files();
6556 /* React to changes */
6557 Term_xtra(TERM_XTRA_REACT, 0);
6560 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6563 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6569 /* Set or clear "rogue_like_commands" if requested */
6570 if (arg_force_original) rogue_like_commands = FALSE;
6571 if (arg_force_roguelike) rogue_like_commands = TRUE;
6573 /* Hack -- Enforce "delayed death" */
6574 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6576 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6578 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6580 monster_type *m_ptr;
6581 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6582 monster_race *r_ptr = &r_info[pet_r_idx];
6583 place_monster_aux(0, py, px - 1, pet_r_idx,
6584 (PM_FORCE_PET | PM_NO_KAGE));
6585 m_ptr = &m_list[hack_m_idx_ii];
6586 m_ptr->mspeed = r_ptr->speed;
6587 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6588 m_ptr->max_maxhp = m_ptr->maxhp;
6589 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6590 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6596 /* Process the level */
6599 /* Handle "p_ptr->notice" */
6602 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6605 /* Cancel the target */
6608 /* Cancel the health bar */
6612 /* Forget the lite */
6615 /* Forget the view */
6618 /* Forget the view */
6621 /* Handle "quit and save" */
6622 if (!p_ptr->playing && !p_ptr->is_dead) break;
6624 /* Erase the old cave */
6626 if (!p_ptr->is_dead) wipe_m_list();
6634 /* Accidental Death */
6635 if (p_ptr->playing && p_ptr->is_dead)
6637 if (p_ptr->inside_arena)
6639 p_ptr->inside_arena = FALSE;
6640 if(p_ptr->arena_number > MAX_ARENA_MONS)
6641 p_ptr->arena_number++;
6643 p_ptr->arena_number = 99;
6644 p_ptr->is_dead = FALSE;
6646 p_ptr->chp_frac = 0;
6647 p_ptr->exit_bldg = TRUE;
6652 /* Mega-Hack -- Allow player to cheat death */
6654 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
6656 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
6660 /* Mark social class, reset age, if needed */
6661 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6667 p_ptr->noscore |= 0x0001;
6671 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
6673 msg_print("You invoke wizard mode and cheat death.");
6679 /* Restore hit points */
6680 p_ptr->chp = p_ptr->mhp;
6681 p_ptr->chp_frac = 0;
6683 if (p_ptr->pclass == CLASS_MAGIC_EATER)
6685 for (i = 0; i < EATER_EXT*2; i++)
6687 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
6689 for (; i < EATER_EXT*3; i++)
6691 p_ptr->magic_num1[i] = 0;
6694 /* Restore spell points */
6695 p_ptr->csp = p_ptr->msp;
6696 p_ptr->csp_frac = 0;
6698 /* Hack -- Healing */
6700 (void)set_confused(0);
6701 (void)set_poisoned(0);
6702 (void)set_afraid(0);
6703 (void)set_paralyzed(0);
6708 /* Hack -- Prevent starvation */
6709 (void)set_food(PY_FOOD_MAX - 1);
6711 /* Hack -- cancel recall */
6712 if (p_ptr->word_recall)
6716 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
6718 msg_print("A tension leaves the air around you...");
6723 /* Hack -- Prevent recall */
6724 p_ptr->word_recall = 0;
6725 p_ptr->redraw |= (PR_STATUS);
6728 /* Hack -- cancel alter */
6729 if (p_ptr->alter_reality)
6731 /* Hack -- Prevent alter */
6732 p_ptr->alter_reality = 0;
6733 p_ptr->redraw |= (PR_STATUS);
6736 /* Note cause of death XXX XXX XXX */
6738 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
6740 (void)strcpy(p_ptr->died_from, "Cheating death");
6745 p_ptr->is_dead = FALSE;
6748 p_ptr->inside_arena = FALSE;
6749 p_ptr->inside_battle = FALSE;
6751 p_ptr->inside_quest = 0;
6752 p_ptr->recall_dungeon = dungeon_type;
6754 if (lite_town || vanilla_town)
6756 p_ptr->wilderness_y = 1;
6757 p_ptr->wilderness_x = 1;
6771 p_ptr->wilderness_y = 48;
6772 p_ptr->wilderness_x = 5;
6778 p_ptr->wild_mode = FALSE;
6779 p_ptr->leaving = TRUE;
6782 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
6784 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
6790 /* Handle "death" */
6791 if (p_ptr->is_dead) break;
6793 /* Make a new level */
6804 s32b turn_real(s32b hoge)
6806 if ((p_ptr->prace == RACE_VAMPIRE) ||
6807 (p_ptr->prace == RACE_SKELETON) ||
6808 (p_ptr->prace == RACE_ZOMBIE) ||
6809 (p_ptr->prace == RACE_SPECTRE))
6810 return hoge-(TURNS_PER_TICK * TOWN_DAWN *3/ 4);