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:
1365 wiz_lite(FALSE, FALSE);
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 detect_treasure(DETECT_RAD_DEFAULT);
1382 detect_objects_gold(DETECT_RAD_DEFAULT);
1383 detect_objects_normal(DETECT_RAD_DEFAULT);
1384 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1385 case MUSIC_DETECT+3:
1386 case MUSIC_DETECT+4:
1387 case MUSIC_DETECT+5:
1388 detect_monsters_invis(DETECT_RAD_DEFAULT);
1389 detect_monsters_normal(DETECT_RAD_DEFAULT);
1390 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1392 case MUSIC_DETECT+1:
1393 case MUSIC_DETECT+2:
1394 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1395 detect_doors(DETECT_RAD_DEFAULT);
1396 detect_stairs(DETECT_RAD_DEFAULT);
1397 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1403 * If player has inscribed the object with "!!", let him know when it's
1406 static void recharged_notice(object_type *o_ptr)
1408 char o_name[MAX_NLEN];
1412 /* No inscription */
1413 if (!o_ptr->inscription) return;
1416 s = strchr(quark_str(o_ptr->inscription), '!');
1418 /* Process notification request. */
1421 /* Find another '!' */
1424 /* Describe (briefly) */
1425 object_desc(o_name, o_ptr, FALSE, 0);
1427 /* Notify the player */
1428 if (o_ptr->number > 1)
1430 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1431 else msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1433 msg_format("Your %s are recharged.", o_name);
1434 else msg_format("Your %s is recharged.", o_name);
1442 /* Keep looking for '!'s */
1443 s = strchr(s + 1, '!');
1448 static void check_music(void)
1453 /* Music singed by player */
1454 if(p_ptr->pclass != CLASS_BARD) return;
1455 if(!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1457 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][p_ptr->magic_num2[0]];
1459 shouhimana = (s_ptr->smana*(3800-p_ptr->spell_exp[p_ptr->magic_num2[0]])+2399);
1462 else shouhimana *= 4;
1464 if(shouhimana < 1) shouhimana = 1;
1465 shouhimana *= 0x8000;
1466 if (((u16b)(p_ptr->csp) < (shouhimana / 0x10000)) || (p_ptr->anti_magic))
1473 p_ptr->csp -= (u16b) (shouhimana / 0x10000);
1474 shouhimana = (shouhimana & 0xffff);
1475 if (p_ptr->csp_frac < shouhimana)
1478 p_ptr->csp_frac += (u16b)(0x10000L - shouhimana);
1482 p_ptr->csp_frac -= (u16b)shouhimana;
1485 p_ptr->redraw |= PR_MANA;
1486 if (p_ptr->magic_num1[1])
1488 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1489 p_ptr->magic_num1[1] = 0;
1491 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1493 msg_print("You restart singing.");
1495 p_ptr->action = ACTION_SING;
1497 /* Recalculate bonuses */
1498 p_ptr->update |= (PU_BONUS | PU_HP);
1500 /* Redraw status bar */
1501 p_ptr->redraw |= (PR_STATUS);
1504 if (p_ptr->spell_exp[p_ptr->magic_num2[0]] < 900)
1505 p_ptr->spell_exp[p_ptr->magic_num2[0]]+=5;
1506 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1200)
1507 {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
1508 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1400)
1509 {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;}
1510 else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1600)
1511 {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;}
1513 gere_music(p_ptr->magic_num1[0]);
1516 /* Choose one of items that have cursed flag */
1517 static object_type *choose_cursed_obj_name(u32b flag)
1520 int choices[INVEN_TOTAL-INVEN_RARM];
1523 /* Paranoia -- Player has no warning-item */
1524 if (!(p_ptr->cursed & flag)) return NULL;
1526 /* Search Inventry */
1527 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1529 object_type *o_ptr = &inventory[i];
1531 if (o_ptr->curse_flags & flag)
1533 choices[number] = i;
1538 /* Choice one of them */
1539 return (&inventory[choices[randint0(number)]]);
1544 * Handle certain things once every 10 game turns
1546 static void process_world(void)
1550 bool cave_no_regen = FALSE;
1551 int upkeep_factor = 0;
1556 const int dec_count = (easy_band ? 2 : 1);
1558 int day, hour, min, prev_min;
1560 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1561 s32b tick = turn % len + len / 4;
1563 extract_day_hour_min(&day, &hour, &min);
1564 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1566 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1568 !(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)))) &&
1569 !(p_ptr->inside_battle))
1572 if (p_ptr->inside_battle && !p_ptr->leaving)
1579 /* Count all hostile monsters */
1580 for (i2 = 0; i2 < cur_wid; ++i2)
1581 for (j2 = 0; j2 < cur_hgt; j2++)
1582 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1585 win_m_idx = cave[j2][i2].m_idx;
1588 if (number_mon == 0)
1591 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1593 msg_print("They have kill each other at the same time.");
1596 p_ptr->energy_need = 0;
1599 else if ((number_mon-1) == 0)
1602 monster_type *wm_ptr;
1604 wm_ptr = &m_list[win_m_idx];
1606 monster_desc(m_name, wm_ptr, 0);
1608 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1610 msg_format("%s is winner!", m_name);
1614 if (win_m_idx == (sel_monster+1))
1617 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1619 msg_print("Congratulations.");
1622 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1624 msg_format("You received %d gold.", battle_odds);
1626 p_ptr->au += battle_odds;
1631 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1633 msg_print("You lost gold.");
1637 p_ptr->energy_need = 0;
1640 else if(turn - old_turn == 150*TURNS_PER_TICK)
1643 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
1645 msg_format("This battle have ended in a draw.");
1647 p_ptr->au += kakekin;
1649 p_ptr->energy_need = 0;
1654 /* Every 20 game turns */
1655 if (turn % TURNS_PER_TICK) return;
1657 /*** Check the Time and Load ***/
1659 if (!(turn % (50*TURNS_PER_TICK)))
1661 /* Check time and load */
1662 if ((0 != check_time()) || (0 != check_load()))
1665 if (closing_flag <= 2)
1670 /* Count warnings */
1675 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
1676 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
1678 msg_print("The gates to ANGBAND are closing...");
1679 msg_print("Please finish up and/or save your game.");
1689 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
1691 msg_print("The gates to ANGBAND are now closed.");
1696 p_ptr->playing = FALSE;
1699 p_ptr->leaving = TRUE;
1704 /*** Attempt timed autosave ***/
1705 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
1707 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
1708 do_cmd_save_game(TRUE);
1714 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
1716 msg_print("You hear noise.");
1720 /*** Handle the wilderness/town (sunshine) ***/
1722 /* While in town/wilderness */
1723 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
1725 /* Hack -- Daybreak/Nighfall in town */
1726 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
1730 /* Check for dawn */
1731 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
1738 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
1740 msg_print("The sun has risen.");
1744 /* Hack -- Scan the town */
1745 for (y = 0; y < cur_hgt; y++)
1747 for (x = 0; x < cur_wid; x++)
1749 /* Get the cave grid */
1750 c_ptr = &cave[y][x];
1753 c_ptr->info |= (CAVE_GLOW);
1755 /* Hack -- Memorize lit grids if allowed */
1756 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
1758 /* Hack -- Notice spot */
1769 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
1771 msg_print("The sun has fallen.");
1775 /* Hack -- Scan the town */
1776 for (y = 0; y < cur_hgt; y++)
1778 for (x = 0; x < cur_wid; x++)
1780 /* Get the cave grid */
1781 c_ptr = &cave[y][x];
1783 /* Darken "boring" features */
1784 if ((c_ptr->feat <= FEAT_INVIS) ||
1785 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
1786 (c_ptr->feat <= FEAT_MOUNTAIN) &&
1787 (c_ptr->feat != FEAT_MUSEUM)) ||
1788 (x == 0) || (x == cur_wid-1) ||
1789 (y == 0) || (y == cur_hgt-1))
1791 /* Forget the grid */
1792 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
1794 /* Hack -- Notice spot */
1801 /* Update the monsters */
1802 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
1805 p_ptr->redraw |= (PR_MAP);
1808 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1812 /* Set back the rewards once a day */
1813 if (!(turn % (TURNS_PER_TICK*10 * STORE_TURNS)))
1817 /* Reset the rewards */
1818 for (n = 0; n < MAX_BACT; n++)
1820 p_ptr->rewards[n] = FALSE;
1825 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
1827 if (cheat_xtra) msg_print("Rewards reset.");
1833 /*** Process the monsters ***/
1835 /* Check for creature generation. */
1836 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
1837 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
1839 /* Make a new monster */
1840 (void)alloc_monster(MAX_SIGHT + 5, 0);
1843 /* Hack -- Check for creature regeneration */
1844 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
1845 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
1848 /*** Damage over Time ***/
1850 /* Take damage from poison */
1851 if (p_ptr->poisoned && !p_ptr->invuln)
1855 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
1857 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1863 /* (Vampires) Take damage from sunlight */
1864 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1866 if (!dun_level && !p_ptr->resist_lite && !p_ptr->invuln && is_daytime())
1868 if (cave[py][px].info & CAVE_GLOW)
1872 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
1873 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
1875 msg_print("The sun's rays scorch your undead flesh!");
1876 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
1879 cave_no_regen = TRUE;
1883 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1884 !p_ptr->resist_lite)
1886 object_type * o_ptr = &inventory[INVEN_LITE];
1887 char o_name [MAX_NLEN];
1888 char ouch [MAX_NLEN+40];
1890 /* Get an object description */
1891 object_desc(o_name, o_ptr, FALSE, 0);
1894 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
1896 msg_format("The %s scorches your undead flesh!", o_name);
1900 cave_no_regen = TRUE;
1902 /* Get an object description */
1903 object_desc(o_name, o_ptr, TRUE, 0);
1906 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
1908 sprintf(ouch, "wielding %s", o_name);
1911 if (!p_ptr->invuln) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1915 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
1916 !p_ptr->invuln && !p_ptr->immune_fire && !p_ptr->ffall)
1918 int damage = 3000 + randint0(2000);
1920 if (prace_is_(RACE_ENT)) damage += damage/3;
1922 if (p_ptr->resist_fire) damage = damage / 3;
1923 if (p_ptr->oppose_fire) damage = damage / 3;
1924 damage = damage / 100 + (randint0(100) < (damage % 100));
1930 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
1931 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
1933 msg_print("The lava burns you!");
1934 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
1937 cave_no_regen = TRUE;
1941 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
1942 !p_ptr->invuln && !p_ptr->immune_fire)
1944 int damage = 6000 + randint0(4000);
1949 if (p_ptr->resist_fire) damage = damage / 3;
1950 if (p_ptr->oppose_fire) damage = damage / 3;
1954 damage = damage / 5;
1957 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
1958 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
1960 message = "The heat burns you!";
1961 hit_from = "flying over deep lava";
1968 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
1969 hit_from = "¿¼¤¤ÍÏ´äή";
1971 message = "The lava burns you!";
1972 hit_from = "deep lava";
1977 damage = damage / 100 + (randint0(100) < (damage % 100));
1982 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
1984 cave_no_regen = TRUE;
1988 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
1990 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
1994 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
1995 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
1997 msg_print("You are drowning!");
1998 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2001 cave_no_regen = TRUE;
2008 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2010 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2011 if (prace_is_(RACE_ENT)) damage += damage/3;
2012 if (p_ptr->resist_fire) damage = damage / 3;
2013 if (p_ptr->oppose_fire) damage = damage / 3;
2015 msg_print("Ç®¤¤¡ª");
2016 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2018 msg_print("It's hot!");
2019 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2022 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2024 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2025 if (p_ptr->resist_elec) damage = damage / 3;
2026 if (p_ptr->oppose_elec) damage = damage / 3;
2028 msg_print("Äˤ¤¡ª");
2029 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2031 msg_print("It hurts!");
2032 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2035 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2037 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2038 if (p_ptr->resist_cold) damage = damage / 3;
2039 if (p_ptr->oppose_cold) damage = damage / 3;
2041 msg_print("Î䤿¤¤¡ª");
2042 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2044 msg_print("It's cold!");
2045 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2050 /* Spectres -- take damage when moving through walls */
2052 * Added: ANYBODY takes damage if inside through walls
2053 * without wraith form -- NOTE: Spectres will never be
2054 * reduced below 0 hp by being inside a stone wall; others
2057 if (!cave_floor_bold(py, px))
2059 /* Player can walk through trees */
2060 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2064 else if (!p_ptr->invuln && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2065 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2069 cave_no_regen = TRUE;
2071 if (p_ptr->pass_wall)
2074 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2077 msg_print("Your molecules feel disrupted!");
2078 dam_desc = "density";
2085 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2086 dam_desc = "¹Å¤¤´ä";
2088 msg_print("You are being crushed!");
2089 dam_desc = "solid rock";
2094 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2100 monster_race *r_ptr;
2102 if (min != prev_min)
2105 bool old_inside_battle = p_ptr->inside_battle;
2107 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2109 p_ptr->inside_battle = TRUE;
2110 get_mon_num_prep(NULL,NULL);
2112 for (i = 0; i < max_d_idx; i++)
2114 if (max_dlv[i] < d_info[i].mindepth) continue;
2115 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2119 today_mon = get_mon_num(max_dl);
2120 r_ptr = &r_info[today_mon];
2122 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2123 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2124 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2125 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2126 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2127 if (r_ptr->rarity > 10) continue;
2128 if (r_ptr->level == 0) continue;
2131 p_ptr->today_mon = 0;
2132 p_ptr->inside_battle = old_inside_battle;
2136 /* Nightmare mode activates the TY_CURSE at midnight */
2137 if (ironman_nightmare)
2139 /* Require exact minute */
2140 if (min != prev_min)
2142 /* Every 15 minutes after 11:00 pm */
2143 if ((hour == 23) && !(min % 15))
2153 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2155 msg_print("You hear a distant bell toll ominously.");
2163 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2165 msg_print("A distant bell sounds twice.");
2173 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2175 msg_print("A distant bell sounds three times.");
2183 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2185 msg_print("A distant bell tolls four times.");
2193 /* TY_CURSE activates at mignight! */
2200 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2202 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2205 activate_ty_curse(FALSE, &count);
2210 /* Take damage from cuts */
2211 if (p_ptr->cut && !p_ptr->invuln)
2213 /* Mortal wound or Deep Gash */
2214 if (p_ptr->cut > 1000)
2219 else if (p_ptr->cut > 200)
2225 else if (p_ptr->cut > 100)
2230 else if (p_ptr->cut > 50)
2235 else if (p_ptr->cut > 25)
2240 else if (p_ptr->cut > 10)
2253 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2255 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2261 /*** Check the Food, and Regenerate ***/
2263 if (!p_ptr->inside_battle)
2265 /* Digest normally */
2266 if (p_ptr->food < PY_FOOD_MAX)
2268 /* Every 100 game turns */
2269 if (!(turn % (TURNS_PER_TICK*5)))
2271 /* Basic digestion rate based on speed */
2272 i = /* extract_energy[p_ptr->pspeed] * 2;*/
2273 ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
2274 1 : extract_energy[p_ptr->pspeed]));
2276 /* Regeneration takes more food */
2277 if (p_ptr->regenerate) i += 20;
2278 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2279 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2281 /* Slow digestion takes less food */
2282 if (p_ptr->slow_digest) i -= 5;
2284 /* Minimal digestion */
2286 /* Maximal digestion */
2287 if (i > 100) i = 100;
2289 /* Digest some food */
2290 (void)set_food(p_ptr->food - i);
2294 /* Digest quickly when gorged */
2297 /* Digest a lot of food */
2298 (void)set_food(p_ptr->food - 100);
2302 /* Starve to death (slowly) */
2303 if (p_ptr->food < PY_FOOD_STARVE)
2305 /* Calculate damage */
2306 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2310 if (!p_ptr->invuln) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2312 if (!p_ptr->invuln) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2317 /* Default regeneration */
2318 regen_amount = PY_REGEN_NORMAL;
2321 if (p_ptr->food < PY_FOOD_WEAK)
2323 /* Lower regeneration */
2324 if (p_ptr->food < PY_FOOD_STARVE)
2328 else if (p_ptr->food < PY_FOOD_FAINT)
2330 regen_amount = PY_REGEN_FAINT;
2334 regen_amount = PY_REGEN_WEAK;
2338 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2340 /* Faint occasionally */
2341 if (!p_ptr->paralyzed && (randint0(100) < 10))
2345 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2347 msg_print("You faint from the lack of food.");
2352 /* Hack -- faint (bypass free action) */
2353 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2359 /* Are we walking the pattern? */
2360 if (pattern_effect())
2362 cave_no_regen = TRUE;
2366 /* Regeneration ability */
2367 if (p_ptr->regenerate)
2369 regen_amount = regen_amount * 2;
2371 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2375 if (p_ptr->cursed & TRC_SLOW_REGEN)
2382 /* Searching or Resting */
2383 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2385 regen_amount = regen_amount * 2;
2388 upkeep_factor = calculate_upkeep();
2390 /* Regenerate the mana */
2391 /* if (p_ptr->csp < p_ptr->msp) */
2395 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2396 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2397 regenmana(upkeep_regen/100);
2399 #ifdef TRACK_FRIENDS
2403 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2405 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2409 #endif /* TRACK_FRIENDS */
2412 else if (p_ptr->action != ACTION_LEARN)
2414 regenmana(regen_amount);
2417 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2419 regenmagic(regen_amount);
2422 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2424 while (upkeep_factor > 100)
2427 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2429 msg_print("Such much pets cannot be controled at once!");
2432 do_cmd_pet_dismiss();
2434 upkeep_factor = calculate_upkeep();
2437 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2439 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2445 /* Poisoned or cut yields no healing */
2446 if (p_ptr->poisoned) regen_amount = 0;
2447 if (p_ptr->cut) regen_amount = 0;
2449 /* Special floor -- Pattern, in a wall -- yields no healing */
2450 if (cave_no_regen) regen_amount = 0;
2452 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2454 /* Regenerate Hit Points if needed */
2455 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2457 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2458 (cave[py][px].feat >= FEAT_PATTERN_START))
2460 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2464 regenhp(regen_amount);
2469 /*** Timeout Various Things ***/
2472 if (p_ptr->tim_mimic)
2474 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2477 /* Hack -- Hallucinating */
2480 (void)set_image(p_ptr->image - dec_count);
2486 (void)set_blind(p_ptr->blind - dec_count);
2489 /* Times see-invisible */
2490 if (p_ptr->tim_invis)
2492 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2503 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2506 /* Timed temporary elemental brands. -LM- */
2507 if (p_ptr->ele_attack)
2509 p_ptr->ele_attack--;
2511 /* Clear all temporary elemental brands. */
2512 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2515 /* Timed temporary elemental immune. -LM- */
2516 if (p_ptr->ele_immune)
2518 p_ptr->ele_immune--;
2520 /* Clear all temporary elemental brands. */
2521 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2524 /* Timed infra-vision */
2525 if (p_ptr->tim_infra)
2527 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2531 if (p_ptr->tim_stealth)
2533 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2536 /* Timed levitation */
2537 if (p_ptr->tim_ffall)
2539 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2542 /* Timed sh_touki */
2543 if (p_ptr->tim_sh_touki)
2545 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2549 if (p_ptr->tim_sh_fire)
2551 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2555 if (p_ptr->tim_sh_holy)
2557 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2561 if (p_ptr->tim_eyeeye)
2563 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2566 /* Timed resist-magic */
2567 if (p_ptr->resist_magic)
2569 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2572 /* Timed regeneration */
2573 if (p_ptr->tim_regen)
2575 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2578 /* Timed resist nether */
2579 if (p_ptr->tim_res_nether)
2581 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2584 /* Timed resist time */
2585 if (p_ptr->tim_res_time)
2587 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2591 if (p_ptr->tim_reflect)
2593 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2597 if (p_ptr->multishadow)
2599 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2602 /* Timed Robe of dust */
2603 if (p_ptr->dustrobe)
2605 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2608 /* Timed infra-vision */
2609 if (p_ptr->kabenuke)
2611 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2615 if (p_ptr->paralyzed)
2617 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2621 if (p_ptr->confused)
2623 (void)set_confused(p_ptr->confused - dec_count);
2629 (void)set_afraid(p_ptr->afraid - dec_count);
2635 (void)set_fast(p_ptr->fast - 1, TRUE);
2641 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2644 /* Protection from evil */
2645 if (p_ptr->protevil)
2647 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2650 /* Invulnerability */
2653 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2657 if (p_ptr->wraith_form)
2659 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2665 (void)set_hero(p_ptr->hero - 1, TRUE);
2671 (void)set_shero(p_ptr->shero - 1, TRUE);
2677 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2683 (void)set_shield(p_ptr->shield - 1, TRUE);
2687 if (p_ptr->tsubureru)
2689 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2693 if (p_ptr->magicdef)
2695 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2699 if (p_ptr->tsuyoshi)
2701 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2705 if (p_ptr->oppose_acid)
2707 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2710 /* Oppose Lightning */
2711 if (p_ptr->oppose_elec)
2713 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2717 if (p_ptr->oppose_fire)
2719 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2723 if (p_ptr->oppose_cold)
2725 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2729 if (p_ptr->oppose_pois)
2731 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2736 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2739 /*** Poison and Stun and Cut ***/
2742 if (p_ptr->poisoned)
2744 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2746 /* Apply some healing */
2747 (void)set_poisoned(p_ptr->poisoned - adjust);
2753 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2755 /* Apply some healing */
2756 (void)set_stun(p_ptr->stun - adjust);
2762 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2764 /* Hack -- Truly "mortal" wound */
2765 if (p_ptr->cut > 1000) adjust = 0;
2767 /* Apply some healing */
2768 (void)set_cut(p_ptr->cut - adjust);
2773 /*** Process Light ***/
2775 /* Check for light being wielded */
2776 o_ptr = &inventory[INVEN_LITE];
2778 /* Burn some fuel in the current lite */
2779 if (o_ptr->tval == TV_LITE)
2781 /* Hack -- Use some fuel (except on artifacts) */
2782 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2784 /* Decrease life-span */
2785 if (o_ptr->name2 == EGO_LITE_LONG)
2787 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2789 else o_ptr->xtra4--;
2791 /* Notice interesting fuel steps */
2792 notice_lite_change(o_ptr);
2796 /* Calculate torch radius */
2797 p_ptr->update |= (PU_TORCH);
2800 /*** Process mutation effects ***/
2801 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
2803 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2807 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
2808 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
2810 msg_print("RAAAAGHH!");
2811 msg_print("You feel a fit of rage coming over you!");
2814 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2817 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2819 if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
2823 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
2825 msg_print("It's so dark... so scary!");
2828 set_afraid(p_ptr->afraid + 13 + randint1(26));
2832 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2834 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2839 /* Teleport player */
2841 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
2843 msg_print("Your position suddenly seems very uncertain...");
2847 teleport_player(40);
2851 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2853 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2856 p_ptr->redraw |= PR_EXTRA;
2858 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
2860 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2865 if (!p_ptr->resist_conf)
2867 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2870 if (!p_ptr->resist_chaos)
2875 if (one_in_(3)) lose_all_info();
2877 teleport_player(100);
2880 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
2881 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
2883 msg_print("You wake up somewhere with a sore head...");
2884 msg_print("You can't remember a thing, or how you got here!");
2893 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
2895 msg_print("Thishcischs GooDSChtuff!");
2898 (void)set_image(p_ptr->image + randint0(150) + 150);
2904 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2906 if (!p_ptr->resist_chaos)
2909 p_ptr->redraw |= PR_EXTRA;
2910 (void)set_image(p_ptr->image + randint0(50) + 20);
2914 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2919 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
2921 msg_print("BRRAAAP! Oops.");
2925 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2928 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2929 !p_ptr->anti_magic && one_in_(9000))
2934 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
2936 msg_print("Magical energy flows through you! You must release it!");
2941 (void)get_hack_dir(&dire);
2942 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2945 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2946 !p_ptr->anti_magic && (randint1(6666) == 666))
2948 bool pet = one_in_(6);
2949 u32b mode = PM_ALLOW_GROUP;
2951 if (pet) mode |= PM_FORCE_PET;
2952 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2954 if (summon_specific((pet ? -1 : 0), py, px,
2955 dun_level, SUMMON_DEMON, mode))
2958 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
2960 msg_print("You have attracted a demon!");
2967 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2973 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2975 msg_print("You feel less energetic.");
2978 if (p_ptr->fast > 0)
2984 set_slow(randint1(30) + 10, FALSE);
2990 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2992 msg_print("You feel more energetic.");
2995 if (p_ptr->slow > 0)
3001 set_fast(randint1(30) + 10, FALSE);
3006 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3010 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3012 msg_print("You suddenly feel almost lonely.");
3015 banish_monsters(100);
3016 if (!dun_level && p_ptr->town_num)
3019 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3021 msg_print("You see one of the shopkeepers running for the hills!");
3024 store_shuffle(randint0(MAX_STORES));
3029 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3034 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3036 msg_print("A shadow passes over you.");
3041 /* Absorb light from the current possition */
3042 if (cave[py][px].info & CAVE_GLOW)
3047 o_ptr = &inventory[INVEN_LITE];
3049 /* Absorb some fuel in the current lite */
3050 if (o_ptr->tval == TV_LITE)
3052 /* Use some fuel (except on artifacts) */
3053 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3055 /* Heal the player a bit */
3056 hp_player(o_ptr->xtra4 / 20);
3058 /* Decrease life-span of lite */
3062 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3064 msg_print("You absorb energy from your light!");
3068 /* Notice interesting fuel steps */
3069 notice_lite_change(o_ptr);
3074 * Unlite the area (radius 10) around player and
3075 * do 50 points damage to every affected monster
3077 unlite_area(50, 10);
3080 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3081 !p_ptr->anti_magic && one_in_(7000))
3083 bool pet = one_in_(3);
3084 u32b mode = PM_ALLOW_GROUP;
3086 if (pet) mode |= PM_FORCE_PET;
3087 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3089 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3092 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3094 msg_print("You have attracted an animal!");
3101 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3102 !p_ptr->anti_magic && one_in_(8000))
3106 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3108 msg_print("You feel the world warping around you!");
3112 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3114 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3116 if (!lose_mutation(0))
3118 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3120 msg_print("You feel oddly normal.");
3124 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3128 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3130 msg_print("You feel insubstantial!");
3134 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3136 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3140 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3142 int which_stat = randint0(6);
3143 int sustained = FALSE;
3148 if (p_ptr->sustain_str) sustained = TRUE;
3151 if (p_ptr->sustain_int) sustained = TRUE;
3154 if (p_ptr->sustain_wis) sustained = TRUE;
3157 if (p_ptr->sustain_dex) sustained = TRUE;
3160 if (p_ptr->sustain_con) sustained = TRUE;
3163 if (p_ptr->sustain_chr) sustained = TRUE;
3167 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3169 msg_print("Invalid stat chosen!");
3179 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3181 msg_print("You can feel yourself wasting away!");
3185 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3188 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3189 !p_ptr->anti_magic && one_in_(3000))
3191 bool pet = one_in_(5);
3192 u32b mode = PM_ALLOW_GROUP;
3194 if (pet) mode |= PM_FORCE_PET;
3195 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3197 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3200 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3202 msg_print("You have attracted a dragon!");
3208 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3211 if (p_ptr->tim_esp > 0)
3214 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3216 msg_print("Your mind feels cloudy!");
3219 set_tim_esp(0, TRUE);
3224 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3226 msg_print("Your mind expands!");
3229 set_tim_esp(p_ptr->lev, FALSE);
3232 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3237 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3239 msg_print("Your stomach roils, and you lose your lunch!");
3243 set_food(PY_FOOD_WEAK);
3246 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3247 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3252 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3254 int danger_amount = 0;
3257 for (monster = 0; monster < m_max; monster++)
3259 monster_type *m_ptr = &m_list[monster];
3260 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3262 /* Paranoia -- Skip dead monsters */
3263 if (!m_ptr->r_idx) continue;
3265 if (r_ptr->level >= p_ptr->lev)
3267 danger_amount += r_ptr->level - p_ptr->lev + 1;
3271 if (danger_amount > 100)
3273 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3275 msg_print("You feel utterly terrified!");
3278 else if (danger_amount > 50)
3280 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3282 msg_print("You feel terrified!");
3285 else if (danger_amount > 20)
3287 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3289 msg_print("You feel very worried!");
3292 else if (danger_amount > 10)
3294 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3296 msg_print("You feel paranoid!");
3299 else if (danger_amount > 5)
3301 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3303 msg_print("You feel almost safe.");
3308 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3310 msg_print("You feel lonely.");
3314 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3319 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3321 msg_print("You feel invincible!");
3325 (void)set_invuln(randint1(8) + 8, FALSE);
3327 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3329 int wounds = p_ptr->mhp - p_ptr->chp;
3333 int healing = p_ptr->csp;
3335 if (healing > wounds)
3341 p_ptr->csp -= healing;
3344 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3347 int wounds = p_ptr->msp - p_ptr->csp;
3351 int healing = p_ptr->chp;
3353 if (healing > wounds)
3358 p_ptr->csp += healing;
3360 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3362 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3367 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3373 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3374 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3376 msg_print("You trip over your own feet!");
3377 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3382 if (buki_motteruka(INVEN_RARM))
3384 int slot = INVEN_RARM;
3385 o_ptr = &inventory[INVEN_RARM];
3386 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3388 o_ptr = &inventory[INVEN_LARM];
3391 if (!cursed_p(o_ptr))
3394 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3396 msg_print("You drop your weapon!");
3399 inven_drop(slot, 1);
3406 /*** Process Inventory ***/
3408 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->wild_mode)
3411 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3412 * can actually be useful!
3414 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3417 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3419 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3423 teleport_player(50);
3426 /* Make a chainsword noise */
3427 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3431 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3433 if (!get_rnd_line("chainswd.txt", 0, noise))
3436 disturb(FALSE, FALSE);
3439 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3442 (void)activate_ty_curse(FALSE, &count);
3444 /* Handle experience draining */
3445 if (p_ptr->prace != RACE_ANDROID &&
3446 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3448 p_ptr->exp -= (p_ptr->lev+1)/2;
3449 if (p_ptr->exp < 0) p_ptr->exp = 0;
3450 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3451 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3454 /* Add light curse (Later) */
3455 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3460 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3462 new_curse = get_curse(0, o_ptr);
3463 if (!(o_ptr->curse_flags & new_curse))
3465 char o_name[MAX_NLEN];
3467 object_desc(o_name, o_ptr, FALSE, 0);
3469 o_ptr->curse_flags |= new_curse;
3471 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3473 msg_format("There is a malignant black aura surrounding %s...", o_name);
3476 o_ptr->feeling = FEEL_NONE;
3478 p_ptr->update |= (PU_BONUS);
3481 /* Add heavy curse (Later) */
3482 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3487 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3489 new_curse = get_curse(1, o_ptr);
3490 if (!(o_ptr->curse_flags & new_curse))
3492 char o_name[MAX_NLEN];
3494 object_desc(o_name, o_ptr, FALSE, 0);
3496 o_ptr->curse_flags |= new_curse;
3498 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3500 msg_format("There is a malignant black aura surrounding %s...", o_name);
3503 o_ptr->feeling = FEEL_NONE;
3505 p_ptr->update |= (PU_BONUS);
3509 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3511 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3512 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3514 char o_name[MAX_NLEN];
3516 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3518 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3520 msg_format("%s have attracted an animal!", o_name);
3527 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3529 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3531 char o_name[MAX_NLEN];
3533 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3535 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3537 msg_format("%s have attracted a demon!", o_name);
3544 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3546 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3547 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3549 char o_name[MAX_NLEN];
3551 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3553 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3555 msg_format("%s have attracted an animal!", o_name);
3561 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3563 if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
3567 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3569 msg_print("It's so dark... so scary!");
3572 set_afraid(p_ptr->afraid + 13 + randint1(26));
3575 /* Teleport player */
3576 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3580 /* Teleport player */
3581 teleport_player(40);
3583 /* Handle HP draining */
3584 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3586 char o_name[MAX_NLEN];
3588 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3590 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3592 msg_format("%s drains HP from you!", o_name);
3594 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3596 /* Handle mana draining */
3597 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3599 char o_name[MAX_NLEN];
3601 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3603 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3605 msg_format("%s drains mana from you!", o_name);
3607 p_ptr->csp -= MIN(p_ptr->lev, 50);
3611 p_ptr->csp_frac = 0;
3613 p_ptr->redraw |= PR_MANA;
3617 /* Rarely, take damage from the Jewel of Judgement */
3618 if (one_in_(999) && !p_ptr->anti_magic)
3620 if ((inventory[INVEN_LITE].tval) &&
3621 (inventory[INVEN_LITE].sval == SV_LITE_THRAIN))
3624 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3625 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3627 msg_print("The Jewel of Judgement drains life from you!");
3628 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3635 /* Process equipment */
3636 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3638 /* Get the object */
3639 o_ptr = &inventory[i];
3641 /* Skip non-objects */
3642 if (!o_ptr->k_idx) continue;
3644 /* Recharge activatable objects */
3645 if (o_ptr->timeout > 0)
3650 /* Notice changes */
3651 if (!o_ptr->timeout)
3653 recharged_notice(o_ptr);
3659 /* Notice changes */
3663 p_ptr->window |= (PW_EQUIP);
3668 * Recharge rods. Rods now use timeout to control charging status,
3669 * and each charging rod in a stack decreases the stack's timeout by
3670 * one per turn. -LM-
3672 for (j = 0, i = 0; i < INVEN_PACK; i++)
3674 o_ptr = &inventory[i];
3675 k_ptr = &k_info[o_ptr->k_idx];
3677 /* Skip non-objects */
3678 if (!o_ptr->k_idx) continue;
3680 /* Examine all charging rods or stacks of charging rods. */
3681 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3683 /* Determine how many rods are charging. */
3684 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3685 if (temp > o_ptr->number) temp = o_ptr->number;
3687 /* Decrease timeout by that number. */
3688 o_ptr->timeout -= temp;
3690 /* Boundary control. */
3691 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3693 /* Notice changes, provide message if object is inscribed. */
3694 if (!(o_ptr->timeout))
3696 recharged_notice(o_ptr);
3702 /* Notice changes */
3706 p_ptr->notice |= (PN_COMBINE);
3709 p_ptr->window |= (PW_INVEN);
3713 /* Feel the inventory */
3718 /*** Process Objects ***/
3720 /* Process objects */
3721 for (i = 1; i < o_max; i++)
3726 /* Skip dead objects */
3727 if (!o_ptr->k_idx) continue;
3729 /* Recharge rods on the ground. No messages. */
3730 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3733 o_ptr->timeout -= o_ptr->number;
3735 /* Boundary control. */
3736 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3741 /*** Involuntary Movement ***/
3743 /* Delayed Word-of-Recall */
3744 if (p_ptr->word_recall)
3747 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3748 * The player is yanked up/down as soon as
3749 * he loads the autosaved game.
3751 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3752 do_cmd_save_game(TRUE);
3754 /* Count down towards recall */
3755 p_ptr->word_recall--;
3757 p_ptr->redraw |= (PR_STATUS);
3759 /* Activate the recall */
3760 if (!p_ptr->word_recall)
3765 /* Determine the level */
3766 if (dun_level || p_ptr->inside_quest)
3769 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3771 msg_print("You feel yourself yanked upwards!");
3774 p_ptr->recall_dungeon = dungeon_type;
3776 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3780 prepare_change_floor_mode(CFM_CLEAR_ALL);
3782 leave_quest_check();
3784 p_ptr->inside_quest = 0;
3785 p_ptr->leaving = TRUE;
3790 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
3792 msg_print("You feel yourself yanked downwards!");
3795 dungeon_type = p_ptr->recall_dungeon;
3798 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3801 dun_level = max_dlv[dungeon_type];
3802 if (dun_level < 1) dun_level = 1;
3804 /* Nightmare mode makes recall more dangerous */
3805 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3811 else if (dun_level < 99)
3813 dun_level = (dun_level + 99) / 2;
3815 else if (dun_level > 100)
3817 dun_level = d_info[dungeon_type].maxdepth - 1;
3821 if (p_ptr->wild_mode)
3823 p_ptr->wilderness_y = py;
3824 p_ptr->wilderness_x = px;
3828 /* Save player position */
3832 p_ptr->wild_mode = FALSE;
3834 prepare_change_floor_mode(CFM_CLEAR_ALL);
3837 p_ptr->leaving = TRUE;
3839 if (dungeon_type == DUNGEON_ANGBAND)
3841 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3843 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
3844 (quest[i].status == QUEST_STATUS_TAKEN) &&
3845 (quest[i].level < dun_level))
3847 quest[i].status = QUEST_STATUS_FAILED;
3848 quest[i].complev = (byte)p_ptr->lev;
3849 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
3856 sound(SOUND_TPLEVEL);
3861 /* Delayed Alter reality */
3862 if (p_ptr->alter_reality)
3864 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3865 do_cmd_save_game(TRUE);
3867 /* Count down towards alter */
3868 p_ptr->alter_reality--;
3870 p_ptr->redraw |= (PR_STATUS);
3872 /* Activate the alter reality */
3873 if (!p_ptr->alter_reality)
3878 /* Determine the level */
3879 if (!quest_number(dun_level) && dun_level)
3882 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
3884 msg_print("The world changes!");
3887 prepare_change_floor_mode(CFM_CLEAR_ALL);
3890 p_ptr->leaving = TRUE;
3895 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
3897 msg_print("The world seems to change for a moment!");
3902 sound(SOUND_TPLEVEL);
3910 * Verify use of "wizard" mode
3912 static bool enter_wizard_mode(void)
3914 /* Ask first time */
3915 if (!p_ptr->noscore)
3917 /* Wizard mode is not permitted */
3918 if (!allow_debug_opts)
3921 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
3923 msg_print("Wizard mode is not permitted.");
3928 /* Mention effects */
3930 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
3931 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
3933 msg_print("Wizard mode is for debugging and experimenting.");
3934 msg_print("The game will not be scored if you enter wizard mode.");
3939 /* Verify request */
3941 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
3943 if (!get_check("Are you sure you want to enter wizard mode? "))
3951 p_ptr->noscore |= 0x0002;
3962 * Verify use of "debug" commands
3964 static bool enter_debug_mode(void)
3966 /* Ask first time */
3967 if (!p_ptr->noscore)
3969 /* Debug mode is not permitted */
3970 if (!allow_debug_opts)
3973 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
3975 msg_print("Use of debug command is not permitted.");
3980 /* Mention effects */
3982 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
3983 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
3985 msg_print("The debug commands are for debugging and experimenting.");
3986 msg_print("The game will not be scored if you use debug commands.");
3991 /* Verify request */
3993 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
3995 if (!get_check("Are you sure you want to use debug commands? "))
4003 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4005 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4008 p_ptr->noscore |= 0x0008;
4016 * Hack -- Declare the Debug Routines
4018 extern void do_cmd_debug(void);
4020 #endif /* ALLOW_WIZARD */
4026 * Verify use of "borg" commands
4028 static bool enter_borg_mode(void)
4030 /* Ask first time */
4031 if (!(p_ptr->noscore & 0x0010))
4033 /* Mention effects */
4035 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4036 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4038 msg_print("The borg commands are for debugging and experimenting.");
4039 msg_print("The game will not be scored if you use borg commands.");
4044 /* Verify request */
4046 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4048 if (!get_check("Are you sure you want to use borg commands? "))
4056 p_ptr->noscore |= 0x0010;
4064 * Hack -- Declare the Ben Borg
4066 extern void do_cmd_borg(void);
4068 #endif /* ALLOW_BORG */
4073 * Parse and execute the current command
4074 * Give "Warning" on illegal commands.
4076 * XXX XXX XXX Make some "blocks"
4078 static void process_command(void)
4080 int old_now_message = now_message;
4082 #ifdef ALLOW_REPEAT /* TNB */
4084 /* Handle repeating the last command */
4087 #endif /* ALLOW_REPEAT -- TNB */
4091 /* Parse the command */
4092 switch (command_cmd)
4108 /*** Wizard Commands ***/
4110 /* Toggle Wizard Mode */
4115 p_ptr->wizard = FALSE;
4117 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4119 msg_print("Wizard mode off.");
4123 else if (enter_wizard_mode())
4125 p_ptr->wizard = TRUE;
4127 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4129 msg_print("Wizard mode on.");
4134 /* Update monsters */
4135 p_ptr->update |= (PU_MONSTERS);
4137 /* Redraw "title" */
4138 p_ptr->redraw |= (PR_TITLE);
4146 /* Special "debug" commands */
4149 /* Enter debug mode */
4150 if (enter_debug_mode())
4157 #endif /* ALLOW_WIZARD */
4162 /* Special "borg" commands */
4165 /* Enter borg mode */
4166 if (enter_borg_mode())
4168 if (!p_ptr->wild_mode) do_cmd_borg();
4174 #endif /* ALLOW_BORG */
4178 /*** Inventory Commands ***/
4180 /* Wear/wield equipment */
4183 if (!p_ptr->wild_mode) do_cmd_wield();
4187 /* Take off equipment */
4190 if (!p_ptr->wild_mode) do_cmd_takeoff();
4197 if (!p_ptr->wild_mode) do_cmd_drop();
4201 /* Destroy an item */
4208 /* Equipment list */
4215 /* Inventory list */
4223 /*** Various commands ***/
4225 /* Identify an object */
4232 /* Hack -- toggle windows */
4235 toggle_inven_equip();
4240 /*** Standard "Movement" Commands ***/
4245 if (!p_ptr->wild_mode) do_cmd_alter();
4252 if (!p_ptr->wild_mode) do_cmd_tunnel();
4256 /* Move (usually pick up things) */
4259 #ifdef ALLOW_EASY_DISARM /* TNB */
4263 #else /* ALLOW_EASY_DISARM -- TNB */
4265 do_cmd_walk(always_pickup);
4267 #endif /* ALLOW_EASY_DISARM -- TNB */
4272 /* Move (usually do not pick up) */
4275 #ifdef ALLOW_EASY_DISARM /* TNB */
4279 #else /* ALLOW_EASY_DISARM -- TNB */
4281 do_cmd_walk(!always_pickup);
4283 #endif /* ALLOW_EASY_DISARM -- TNB */
4289 /*** Running, Resting, Searching, Staying */
4291 /* Begin Running -- Arg is Max Distance */
4294 if (!p_ptr->wild_mode) do_cmd_run();
4298 /* Stay still (usually pick things up) */
4301 do_cmd_stay(always_pickup);
4305 /* Stay still (usually do not pick up) */
4308 do_cmd_stay(!always_pickup);
4312 /* Rest -- Arg is time */
4319 /* Search for traps/doors */
4326 /* Toggle search mode */
4329 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4330 else set_action(ACTION_SEARCH);
4335 /*** Stairs and Doors and Chests and Traps ***/
4338 case SPECIAL_KEY_STORE:
4340 if (!p_ptr->wild_mode) do_cmd_store();
4344 /* Enter building -KMW- */
4345 case SPECIAL_KEY_BUILDING:
4347 if (!p_ptr->wild_mode) do_cmd_bldg();
4351 /* Enter quest level -KMW- */
4352 case SPECIAL_KEY_QUEST:
4354 if (!p_ptr->wild_mode) do_cmd_quest();
4358 /* Go up staircase */
4361 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4368 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4370 msg_print("To flee the ambush you have to reach the edge of the map.");
4373 else if (p_ptr->food < PY_FOOD_WEAK)
4376 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4378 msg_print("You must eat something here.");
4383 if (change_wild_mode())
4396 /* Go down staircase */
4399 if(!p_ptr->wild_mode) do_cmd_go_down();
4402 p_ptr->wilderness_x = px;
4403 p_ptr->wilderness_y = py;
4409 /* Open a door or chest */
4412 if (!p_ptr->wild_mode) do_cmd_open();
4419 if (!p_ptr->wild_mode) do_cmd_close();
4423 /* Jam a door with spikes */
4426 if (!p_ptr->wild_mode) do_cmd_spike();
4433 if (!p_ptr->wild_mode) do_cmd_bash();
4437 /* Disarm a trap or chest */
4440 if (!p_ptr->wild_mode) do_cmd_disarm();
4445 /*** Magic and Prayers ***/
4447 /* Gain new spells/prayers */
4450 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4452 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4454 msg_print("You don't have to learn spells!");
4456 else if (p_ptr->pclass == CLASS_SAMURAI)
4457 do_cmd_gain_hissatsu();
4458 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4468 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4469 (p_ptr->pclass == CLASS_BERSERKER) ||
4470 (p_ptr->pclass == CLASS_NINJA) ||
4471 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4472 ) do_cmd_mind_browse();
4473 else if (p_ptr->pclass == CLASS_SMITH)
4475 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4476 do_cmd_magic_eater(TRUE);
4477 else do_cmd_browse();
4485 if (!p_ptr->wild_mode)
4487 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4490 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4492 msg_print("You cannot cast spells!");
4495 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4498 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4500 msg_print("The dungeon absorbs all attempted magic!");
4504 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4508 cptr which_power = "ËâË¡";
4510 cptr which_power = "magic";
4512 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4514 which_power = "ĶǽÎÏ";
4516 which_power = "psionic powers";
4518 else if (p_ptr->pclass == CLASS_IMITATOR)
4520 which_power = "¤â¤Î¤Þ¤Í";
4522 which_power = "imitation";
4524 else if (p_ptr->pclass == CLASS_SAMURAI)
4526 which_power = "ɬ»¦·õ";
4528 which_power = "hissatsu";
4530 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4532 which_power = "¶ÀËâË¡";
4534 which_power = "mirror magic";
4536 else if (p_ptr->pclass == CLASS_NINJA)
4538 which_power = "Ǧ½Ñ";
4540 which_power = "ninjutsu";
4542 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4544 which_power = "µ§¤ê";
4546 which_power = "prayer";
4550 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4552 msg_format("An anti-magic shell disrupts your %s!", which_power);
4556 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4559 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4561 msg_format("You cannot think directly!");
4567 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4568 (p_ptr->pclass == CLASS_BERSERKER) ||
4569 (p_ptr->pclass == CLASS_NINJA) ||
4570 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4573 else if (p_ptr->pclass == CLASS_IMITATOR)
4575 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4576 do_cmd_magic_eater(FALSE);
4577 else if (p_ptr->pclass == CLASS_SAMURAI)
4579 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4580 do_cmd_cast_learned();
4581 else if (p_ptr->pclass == CLASS_SMITH)
4590 /* Issue a pet command */
4593 if (!p_ptr->wild_mode) do_cmd_pet();
4597 /*** Use various objects ***/
4599 /* Inscribe an object */
4606 /* Uninscribe an object */
4609 do_cmd_uninscribe();
4613 /* Activate an artifact */
4616 if (!p_ptr->wild_mode)
4618 if (!p_ptr->inside_arena)
4623 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4625 msg_print("The arena absorbs all attempted magic!");
4641 /* Fuel your lantern/torch */
4651 if (!p_ptr->wild_mode) do_cmd_fire();
4658 if (!p_ptr->wild_mode)
4668 if (!p_ptr->wild_mode)
4670 if (!p_ptr->inside_arena)
4675 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4677 msg_print("The arena absorbs all attempted magic!");
4689 if (!p_ptr->wild_mode)
4691 if (p_ptr->inside_arena)
4694 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4696 msg_print("The arena absorbs all attempted magic!");
4701 else if (use_command && rogue_like_commands)
4713 /* Quaff a potion */
4716 if (!p_ptr->wild_mode)
4718 if (!p_ptr->inside_arena)
4719 do_cmd_quaff_potion();
4723 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4725 msg_print("The arena absorbs all attempted magic!");
4737 if (!p_ptr->wild_mode)
4739 if (!p_ptr->inside_arena)
4740 do_cmd_read_scroll();
4744 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4746 msg_print("The arena absorbs all attempted magic!");
4758 if (!p_ptr->wild_mode)
4760 if (p_ptr->inside_arena)
4763 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4765 msg_print("The arena absorbs all attempted magic!");
4770 else if (use_command && !rogue_like_commands)
4780 /* Use racial power */
4783 if (!p_ptr->wild_mode) do_cmd_racial_power();
4788 /*** Looking at Things (nearby or on map) ***/
4790 /* Full dungeon map */
4797 /* Locate player on map */
4811 /* Target monster or location */
4814 if (!p_ptr->wild_mode) do_cmd_target();
4820 /*** Help and Such ***/
4829 /* Identify symbol */
4832 do_cmd_query_symbol();
4836 /* Character description */
4839 do_cmd_change_name();
4844 /*** System Commands ***/
4846 /* Hack -- User interface */
4853 /* Single line from a pref file */
4868 do_cmd_edit_autopick();
4872 /* Interact with macros */
4879 /* Interact with visuals */
4887 /* Interact with colors */
4895 /* Interact with options */
4903 /*** Misc Commands ***/
4919 /* Repeat level feeling */
4922 if (!p_ptr->wild_mode) do_cmd_feeling();
4926 /* Show previous message */
4929 do_cmd_message_one();
4933 /* Show previous messages */
4936 do_cmd_messages(old_now_message);
4940 /* Show quest status -KMW- */
4943 do_cmd_checkquest();
4947 /* Redraw the screen */
4950 now_message = old_now_message;
4955 #ifndef VERIFY_SAVEFILE
4957 /* Hack -- Save and don't quit */
4960 do_cmd_save_game(FALSE);
4964 #endif /* VERIFY_SAVEFILE */
4974 case SPECIAL_KEY_QUIT:
4976 do_cmd_save_and_exit();
4980 /* Quit (commit suicide) */
4993 /* Check artifacts, uniques, objects */
5000 /* Load "screen dump" */
5003 do_cmd_load_screen();
5007 /* Save "screen dump" */
5010 do_cmd_save_screen();
5014 /* Make random artifact list */
5017 spoil_random_artifact("randifact.txt");
5021 /* Hack -- Unknown command */
5024 if (flush_failure) flush();
5028 sound(SOUND_ILLEGAL);
5030 if (!get_rnd_line("error_j.txt", 0, error_m))
5032 if (!get_rnd_line("error.txt", 0, error_m))
5039 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5041 prt("Type '?' for help.", 0, 0);
5047 if (!energy_use && !now_message)
5048 now_message = old_now_message;
5054 static bool monster_tsuri(int r_idx)
5056 monster_race *r_ptr = &r_info[r_idx];
5058 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5066 * Process the player
5068 * Notice the annoying code to handle "pack overflow", which
5069 * must come first just in case somebody manages to corrupt
5070 * the savefiles by clever use of menu commands or something.
5072 static void process_player(void)
5076 /*** Apply energy ***/
5081 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5083 msg_print("You feel different!");
5086 (void)gain_random_mutation(0);
5087 hack_mutation = FALSE;
5090 if (p_ptr->inside_battle)
5092 for(i = 1; i < m_max; i++)
5094 monster_type *m_ptr = &m_list[i];
5096 if (!m_ptr->r_idx) continue;
5098 /* Hack -- Detect monster */
5099 m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
5101 /* Update the monster */
5102 update_mon(i, FALSE);
5107 /* Give the player some energy */
5108 else if (!(load && p_ptr->energy_need <= 0))
5110 p_ptr->energy_need -= (p_ptr->pspeed > 199 ? 49 : (p_ptr->pspeed < 0 ? 1 : extract_energy[p_ptr->pspeed]));
5114 if (p_ptr->energy_need > 0) return;
5115 if (!command_rep) prt_time();
5117 /*** Check for interupts ***/
5119 /* Complete resting */
5126 if ((p_ptr->chp == p_ptr->mhp) &&
5127 (p_ptr->csp >= p_ptr->msp))
5129 set_action(ACTION_NONE);
5133 /* Complete resting */
5134 else if (resting == -2)
5137 if ((p_ptr->chp == p_ptr->mhp) &&
5138 (p_ptr->csp >= p_ptr->msp) &&
5139 !p_ptr->blind && !p_ptr->confused &&
5140 !p_ptr->poisoned && !p_ptr->afraid &&
5141 !p_ptr->stun && !p_ptr->cut &&
5142 !p_ptr->slow && !p_ptr->paralyzed &&
5143 !p_ptr->image && !p_ptr->word_recall &&
5144 !p_ptr->alter_reality)
5146 set_action(ACTION_NONE);
5151 if (p_ptr->action == ACTION_FISH)
5154 Term_xtra(TERM_XTRA_DELAY, 10);
5158 bool success = FALSE;
5159 get_mon_num_prep(monster_tsuri,NULL);
5160 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5162 if (r_idx && one_in_(2))
5165 y = py+ddy[tsuri_dir];
5166 x = px+ddx[tsuri_dir];
5167 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5170 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5172 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5174 msg_format("You have a good catch!", m_name);
5182 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5184 msg_print("Damn! The fish stole your bait!");
5191 /* Handle "abort" */
5194 /* Check for "player abort" (semi-efficiently for resting) */
5195 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5200 /* Check for a key */
5209 /* Hack -- Show a Message */
5211 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5213 msg_print("Canceled.");
5220 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5222 monster_type *m_ptr = &m_list[p_ptr->riding];
5231 /* Acquire the monster name */
5232 monster_desc(m_name, m_ptr, 0);
5234 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5236 msg_format("You have waked %s up.", m_name);
5238 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5239 p_ptr->redraw |= (PR_UHEALTH);
5246 /* Make a "saving throw" against stun */
5247 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5253 /* Hack -- Recover from stun */
5254 if (m_ptr->stunned > d)
5256 /* Recover somewhat */
5257 m_ptr->stunned -= d;
5268 /* Acquire the monster name */
5269 monster_desc(m_name, m_ptr, 0);
5271 /* Dump a message */
5273 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5275 msg_format("%^s is no longer stunned.", m_name);
5277 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5278 p_ptr->redraw |= (PR_UHEALTH);
5282 if (m_ptr->confused)
5286 /* Make a "saving throw" against stun */
5287 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5290 d = m_ptr->confused;
5293 /* Hack -- Recover from stun */
5294 if (m_ptr->confused > d)
5296 /* Recover somewhat */
5297 m_ptr->confused -= d;
5306 m_ptr->confused = 0;
5308 /* Acquire the monster name */
5309 monster_desc(m_name, m_ptr, 0);
5311 /* Dump a message */
5313 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5315 msg_format("%^s is no longer confused.", m_name);
5317 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5318 p_ptr->redraw |= (PR_UHEALTH);
5326 /* Make a "saving throw" against stun */
5327 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5333 /* Hack -- Recover from stun */
5334 if (m_ptr->monfear > d)
5336 /* Recover somewhat */
5337 m_ptr->monfear -= d;
5348 /* Acquire the monster name */
5349 monster_desc(m_name, m_ptr, 0);
5351 /* Dump a message */
5353 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5355 msg_format("%^s is no longer fear.", m_name);
5357 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5358 p_ptr->redraw |= (PR_UHEALTH);
5365 /* Handle the player song */
5366 if (!load) check_music();
5371 if (p_ptr->lightspeed)
5373 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5375 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5377 if (p_ptr->magic_num1[0] < 40)
5379 p_ptr->magic_num1[0] = 0;
5381 else p_ptr->magic_num1[0] -= 40;
5382 p_ptr->update |= (PU_BONUS);
5384 if (p_ptr->action == ACTION_LEARN)
5386 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5387 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5390 p_ptr->csp_frac = 0;
5391 set_action(ACTION_NONE);
5395 p_ptr->csp -= (s16b)(hoge >> 16);
5397 if (p_ptr->csp_frac < hoge)
5399 p_ptr->csp_frac += 0x10000L - hoge;
5403 p_ptr->csp_frac -= hoge;
5405 p_ptr->redraw |= PR_MANA;
5408 if (p_ptr->special_defense & KATA_MASK)
5410 if (p_ptr->special_defense & KATA_MUSOU)
5414 set_action(ACTION_NONE);
5419 p_ptr->redraw |= (PR_MANA);
5424 /*** Handle actual user input ***/
5426 /* Repeat until out of energy */
5427 while (p_ptr->energy_need <= 0)
5429 p_ptr->window |= PW_PLAYER;
5430 p_ptr->sutemi = FALSE;
5431 p_ptr->counter = FALSE;
5432 now_damaged = FALSE;
5434 /* Notice stuff (if needed) */
5435 if (p_ptr->notice) notice_stuff();
5437 /* Update stuff (if needed) */
5438 if (p_ptr->update) update_stuff();
5440 /* Redraw stuff (if needed) */
5441 if (p_ptr->redraw) redraw_stuff();
5443 /* Redraw stuff (if needed) */
5444 if (p_ptr->window) window_stuff();
5447 /* Place the cursor on the player */
5448 move_cursor_relative(py, px);
5450 /* Refresh (optional) */
5451 if (fresh_before) Term_fresh();
5454 /* Hack -- Pack Overflow */
5455 if (inventory[INVEN_PACK].k_idx)
5457 int item = INVEN_PACK;
5459 char o_name[MAX_NLEN];
5463 /* Access the slot to be dropped */
5464 o_ptr = &inventory[item];
5471 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5473 msg_print("Your pack overflows!");
5478 object_desc(o_name, o_ptr, TRUE, 3);
5482 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5484 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5488 /* Drop it (carefully) near the player */
5489 (void)drop_near(o_ptr, 0, py, px);
5491 /* Modify, Describe, Optimize */
5492 inven_item_increase(item, -255);
5493 inven_item_describe(item);
5494 inven_item_optimize(item);
5496 /* Notice stuff (if needed) */
5497 if (p_ptr->notice) notice_stuff();
5499 /* Update stuff (if needed) */
5500 if (p_ptr->update) update_stuff();
5502 /* Redraw stuff (if needed) */
5503 if (p_ptr->redraw) redraw_stuff();
5505 /* Redraw stuff (if needed) */
5506 if (p_ptr->window) window_stuff();
5510 /* Hack -- cancel "lurking browse mode" */
5511 if (!command_new) command_see = FALSE;
5514 /* Assume free turn */
5518 if (p_ptr->inside_battle)
5520 /* Place the cursor on the player */
5521 move_cursor_relative(py, px);
5523 command_cmd = SPECIAL_KEY_BUILDING;
5525 /* Process the command */
5529 /* Paralyzed or Knocked Out */
5530 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5537 else if (p_ptr->action == ACTION_REST)
5542 /* Reduce rest count */
5545 if (!resting) set_action(ACTION_NONE);
5547 /* Redraw the state */
5548 p_ptr->redraw |= (PR_STATE);
5556 else if (p_ptr->action == ACTION_FISH)
5569 /* Repeated command */
5570 else if (command_rep)
5572 /* Count this execution */
5575 /* Redraw the state */
5576 p_ptr->redraw |= (PR_STATE);
5581 /* Hack -- Assume messages were seen */
5584 /* Clear the top line */
5587 /* Process the command */
5591 /* Normal command */
5594 /* Place the cursor on the player */
5595 move_cursor_relative(py, px);
5598 /* Get a command (normal) */
5599 request_command(FALSE);
5602 /* Process the command */
5612 /* Use some energy */
5614 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5616 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5618 /* Hack -- constant hallucination */
5619 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5622 /* Shimmer monsters if needed */
5623 if (shimmer_monsters)
5625 /* Clear the flag */
5626 shimmer_monsters = FALSE;
5628 /* Shimmer multi-hued monsters */
5629 for (i = 1; i < m_max; i++)
5631 monster_type *m_ptr;
5632 monster_race *r_ptr;
5634 /* Access monster */
5637 /* Skip dead monsters */
5638 if (!m_ptr->r_idx) continue;
5640 /* Access the monster race */
5641 r_ptr = &r_info[m_ptr->r_idx];
5643 /* Skip non-multi-hued monsters */
5644 if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue;
5646 /* Reset the flag */
5647 shimmer_monsters = TRUE;
5649 /* Redraw regardless */
5650 lite_spot(m_ptr->fy, m_ptr->fx);
5655 /* Handle monster detection */
5656 if (repair_monsters)
5658 /* Reset the flag */
5659 repair_monsters = FALSE;
5661 /* Rotate detection flags */
5662 for (i = 1; i < m_max; i++)
5664 monster_type *m_ptr;
5666 /* Access monster */
5669 /* Skip dead monsters */
5670 if (!m_ptr->r_idx) continue;
5672 /* Nice monsters get mean */
5673 if (m_ptr->mflag & MFLAG_NICE)
5675 /* Nice monsters get mean */
5676 m_ptr->mflag &= ~(MFLAG_NICE);
5679 /* Handle memorized monsters */
5680 if (m_ptr->mflag & MFLAG_MARK)
5682 /* Maintain detection */
5683 if (m_ptr->mflag & MFLAG_SHOW)
5686 m_ptr->mflag &= ~(MFLAG_SHOW);
5688 /* Still need repairs */
5689 repair_monsters = TRUE;
5692 /* Remove detection */
5696 m_ptr->mflag &= ~(MFLAG_MARK);
5698 /* Assume invisible */
5701 /* Update the monster */
5702 update_mon(i, FALSE);
5704 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
5705 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
5707 /* Redraw regardless */
5708 lite_spot(m_ptr->fy, m_ptr->fx);
5713 if (p_ptr->pclass == CLASS_IMITATOR)
5715 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5718 for (i = 0; i < p_ptr->mane_num; i++)
5720 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
5721 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
5725 p_ptr->redraw |= (PR_MANE);
5727 if (p_ptr->action == ACTION_LEARN)
5730 p_ptr->redraw |= (PR_STATE);
5733 if (world_player && (p_ptr->energy_need > - 1000))
5736 p_ptr->redraw |= (PR_MAP);
5738 /* Update monsters */
5739 p_ptr->update |= (PU_MONSTERS);
5742 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5745 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
5747 msg_print("You feel time flowing around you once more.");
5750 world_player = FALSE;
5751 p_ptr->energy_need = ENERGY_NEED();
5757 /* Hack -- notice death */
5758 if (!p_ptr->playing || p_ptr->is_dead)
5760 world_player = FALSE;
5764 /* Handle "leaving" */
5765 if (p_ptr->leaving) break;
5768 /* Update scent trail */
5774 * Interact with the current dungeon level.
5776 * This function will not exit until the level is completed,
5777 * the user dies, or the game is terminated.
5779 static void dungeon(bool load_game)
5781 int quest_num = 0, i;
5783 /* Set the base level */
5784 base_level = dun_level;
5786 /* Reset various flags */
5790 p_ptr->leaving = FALSE;
5792 /* Reset the "command" vars */
5800 /* Cancel the target */
5804 ambush_flag = FALSE;
5806 /* Cancel the health bar */
5809 /* Check visual effects */
5810 shimmer_monsters = TRUE;
5811 shimmer_objects = TRUE;
5812 repair_monsters = TRUE;
5813 repair_objects = TRUE;
5819 /* Get index of current quest (if any) */
5820 quest_num = quest_number(dun_level);
5822 /* Inside a quest? */
5825 /* Mark the quest monster */
5826 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
5829 /* Track maximum player level */
5830 if (p_ptr->max_plv < p_ptr->lev)
5832 p_ptr->max_plv = p_ptr->lev;
5836 /* Track maximum dungeon level (if not in quest -KMW-) */
5837 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
5839 max_dlv[dungeon_type] = dun_level;
5840 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
5843 /* Validate the panel */
5844 panel_bounds_center();
5846 /* Verify the panel */
5849 /* Flush messages */
5853 /* Enter "xtra" mode */
5854 character_xtra = TRUE;
5857 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5859 /* Redraw dungeon */
5860 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5863 p_ptr->redraw |= (PR_MAP);
5866 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5868 /* Update lite/view */
5869 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
5871 /* Update monsters */
5872 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
5883 /* Leave "xtra" mode */
5884 character_xtra = FALSE;
5887 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5889 /* Combine / Reorder the pack */
5890 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5907 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();
5909 if (p_ptr->inside_battle)
5913 p_ptr->energy_need = 0;
5920 msg_print("»î¹ç³«»Ï¡ª");
5922 msg_format("Ready..Fight!");
5928 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
5929 p_ptr->magic_num1[0] = MUSIC_DETECT;
5931 /* Hack -- notice death or departure */
5932 if (!p_ptr->playing || p_ptr->is_dead) return;
5934 /* Print quest message if appropriate */
5935 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
5937 quest_discovery(random_quest_number(dun_level));
5938 p_ptr->inside_quest = random_quest_number(dun_level);
5940 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
5942 if (r_info[d_info[dungeon_type].final_guardian].max_num)
5944 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
5945 d_name+d_info[dungeon_type].name,
5946 r_name+r_info[d_info[dungeon_type].final_guardian].name);
5948 msg_format("%^s lives in this level as the keeper of %s.",
5949 r_name+r_info[d_info[dungeon_type].final_guardian].name,
5950 d_name+d_info[dungeon_type].name);
5954 /*** Process this dungeon level ***/
5956 /* Reset the monster generation level */
5957 monster_level = base_level;
5959 /* Reset the object generation level */
5960 object_level = base_level;
5964 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5965 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5966 p_ptr->energy_need = 0;
5968 /* Not leaving dungeon */
5969 p_ptr->leaving_dungeon = FALSE;
5976 /* Hack -- Compact the monster list occasionally */
5977 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5979 /* Hack -- Compress the monster list occasionally */
5980 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5983 /* Hack -- Compact the object list occasionally */
5984 if (o_cnt + 32 > max_o_idx) compact_objects(64);
5986 /* Hack -- Compress the object list occasionally */
5987 if (o_cnt + 32 < o_max) compact_objects(0);
5990 /* Process the player */
5994 if (p_ptr->notice) notice_stuff();
5997 if (p_ptr->update) update_stuff();
6000 if (p_ptr->redraw) redraw_stuff();
6003 if (p_ptr->window) window_stuff();
6005 /* Hack -- Hilite the player */
6006 move_cursor_relative(py, px);
6008 /* Optional fresh */
6009 if (fresh_after) Term_fresh();
6011 /* Hack -- Notice death or departure */
6012 if (!p_ptr->playing || p_ptr->is_dead) break;
6014 /* Process all of the monsters */
6018 if (p_ptr->notice) notice_stuff();
6021 if (p_ptr->update) update_stuff();
6024 if (p_ptr->redraw) redraw_stuff();
6027 if (p_ptr->window) window_stuff();
6029 /* Hack -- Hilite the player */
6030 move_cursor_relative(py, px);
6032 /* Optional fresh */
6033 if (fresh_after) Term_fresh();
6035 /* Hack -- Notice death or departure */
6036 if (!p_ptr->playing || p_ptr->is_dead) break;
6039 /* Process the world */
6043 if (p_ptr->notice) notice_stuff();
6046 if (p_ptr->update) update_stuff();
6049 if (p_ptr->redraw) redraw_stuff();
6052 if (p_ptr->window) window_stuff();
6054 /* Hack -- Hilite the player */
6055 move_cursor_relative(py, px);
6057 /* Optional fresh */
6058 if (fresh_after) Term_fresh();
6060 /* Hack -- Notice death or departure */
6061 if (!p_ptr->playing || p_ptr->is_dead) break;
6063 /* Handle "leaving" */
6064 if (p_ptr->leaving) break;
6066 /* Count game turns */
6068 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6069 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6070 if (wild_regen) wild_regen--;
6073 /* Inside a quest and non-unique questor? */
6074 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6076 /* Un-mark the quest monster */
6077 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6080 /* Not save-and-quit and not dead? */
6081 if (p_ptr->playing && !p_ptr->is_dead)
6084 * Maintain Unique monsters and artifact, save current
6085 * floor, then prepare next floor
6089 /* Forget the flag */
6090 reinit_wilderness = FALSE;
6093 /* Write about current level on the play record once per level */
6099 * Load some "user pref files"
6101 * Modified by Arcum Dagsson to support
6102 * separate macro files for different realms.
6104 static void load_all_pref_files(void)
6109 /* Access the "user" pref file */
6110 sprintf(buf, "user.prf");
6112 /* Process that file */
6113 process_pref_file(buf);
6115 /* Access the "user" system pref file */
6116 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6118 /* Process that file */
6119 process_pref_file(buf);
6121 /* Access the "race" pref file */
6122 sprintf(buf, "%s.prf", rp_ptr->title);
6124 /* Process that file */
6125 process_pref_file(buf);
6127 /* Access the "class" pref file */
6128 sprintf(buf, "%s.prf", cp_ptr->title);
6130 /* Process that file */
6131 process_pref_file(buf);
6133 /* Access the "character" pref file */
6134 sprintf(buf, "%s.prf", player_base);
6136 /* Process that file */
6137 process_pref_file(buf);
6139 /* Free old entries */
6143 sprintf(buf, "picktype-%s.prf", player_base);
6145 sprintf(buf, "pickpref-%s.prf", player_base);
6148 err = process_pickpref_file(buf);
6150 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6154 process_pickpref_file("picktype.prf");
6156 process_pickpref_file("pickpref.prf");
6160 /* Access the "realm 1" pref file */
6161 if (p_ptr->realm1 != REALM_NONE)
6163 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6165 /* Process that file */
6166 process_pref_file(buf);
6169 /* Access the "realm 2" pref file */
6170 if (p_ptr->realm2 != REALM_NONE)
6172 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6174 /* Process that file */
6175 process_pref_file(buf);
6181 * Actually play a game
6183 * If the "new_game" parameter is true, then, after loading the
6184 * savefile, we will commit suicide, if necessary, to allow the
6185 * player to start a new game.
6187 void play_game(bool new_game)
6190 bool load_game = TRUE;
6200 hack_mutation = FALSE;
6202 /* Hack -- Character is "icky" */
6203 character_icky = TRUE;
6205 /* Make sure main term is active */
6206 Term_activate(angband_term[0]);
6208 /* Initialise the resize hooks */
6209 angband_term[0]->resize_hook = resize_map;
6211 for (i = 1; i < 8; i++)
6213 /* Does the term exist? */
6214 if (angband_term[i])
6216 /* Add the redraw on resize hook */
6217 angband_term[i]->resize_hook = redraw_window;
6221 /* Hack -- turn off the cursor */
6222 (void)Term_set_cursor(0);
6225 /* Attempt to load */
6230 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6232 quit("broken savefile");
6237 /* Extract the options */
6238 for (i = 0; option_info[i].o_desc; i++)
6240 int os = option_info[i].o_set;
6241 int ob = option_info[i].o_bit;
6243 /* Set the "default" options */
6244 if (option_info[i].o_var)
6247 if (option_flag[os] & (1L << ob))
6250 (*option_info[i].o_var) = TRUE;
6257 (*option_info[i].o_var) = FALSE;
6262 /* Report waited score */
6263 if (p_ptr->wait_report_score)
6269 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6271 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6276 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6281 p_ptr->is_dead = TRUE;
6283 start_time = time(NULL);
6285 /* No suspending now */
6286 signals_ignore_tstp();
6288 /* Hack -- Character is now "icky" */
6289 character_icky = TRUE;
6291 /* Build the filename */
6292 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6294 /* Open the high score file, for reading/writing */
6295 highscore_fd = fd_open(buf, O_RDWR);
6297 /* Handle score, show Top scores */
6298 success = send_world_score(TRUE);
6301 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6303 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6307 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6309 prt("standing by for future registration...", 0, 0);
6315 p_ptr->wait_report_score = FALSE;
6318 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6320 if (!save_player()) msg_print("death save failed!");
6323 /* Shut the high score file */
6324 (void)fd_close(highscore_fd);
6326 /* Forget the high score fd */
6329 /* Allow suspending now */
6330 signals_handle_tstp();
6335 /* Nothing loaded */
6336 if (!character_loaded)
6338 /* Make new player */
6341 /* The dungeon is not ready */
6342 character_dungeon = FALSE;
6344 /* Prepare to init the RNG */
6347 /* Initialize the saved floors data */
6348 init_saved_floors();
6351 /* Old game is loaded. But new game is requested. */
6354 /* Delete expanded temporal files */
6355 clear_saved_floor_files();
6358 /* Process old character */
6361 /* Process the player name */
6362 process_player_name(FALSE);
6371 seed = (time(NULL));
6375 /* Mutate the seed on Unix machines */
6376 seed = ((seed >> 3) * (getpid() << 1));
6380 /* Use the complex RNG */
6383 /* Seed the "complex" RNG */
6384 Rand_state_init(seed);
6387 /* Roll new character */
6390 monster_race *r_ptr;
6392 /* The dungeon is not ready */
6393 character_dungeon = FALSE;
6397 p_ptr->inside_quest = 0;
6398 p_ptr->inside_arena = FALSE;
6399 p_ptr->inside_battle = FALSE;
6403 /* Hack -- seed for flavors */
6404 seed_flavor = randint0(0x10000000);
6406 /* Hack -- seed for town layout */
6407 seed_town = randint0(0x10000000);
6409 /* Roll up a new character */
6416 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6418 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6422 get_mon_num_prep(NULL, NULL);
6423 for (i = 0; i < MAX_KUBI; i++)
6429 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6430 r_ptr = &r_info[kubi_r_idx[i]];
6432 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6434 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6435 if (r_ptr->rarity > 100) continue;
6437 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6439 for (j = 0; j < i; j++)
6440 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6445 for (i = 0; i < MAX_KUBI -1; i++)
6448 for (j = i; j < MAX_KUBI; j++)
6450 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6452 tmp = kubi_r_idx[i];
6453 kubi_r_idx[i] = kubi_r_idx[j];
6454 kubi_r_idx[j] = tmp;
6459 p_ptr->inside_battle = TRUE;
6462 today_mon = get_mon_num(3);
6463 r_ptr = &r_info[today_mon];
6465 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6466 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6467 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6468 if (r_ptr->rarity > 10) continue;
6469 if (r_ptr->level == 0) continue;
6472 p_ptr->inside_battle = FALSE;
6476 write_level = FALSE;
6479 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6481 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6485 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6486 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6488 if (p_ptr->riding == -1)
6491 for(i = m_max; i > 0; i--)
6493 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6502 p_ptr->teleport_town = FALSE;
6503 p_ptr->sutemi = FALSE;
6504 world_monster = FALSE;
6505 now_damaged = FALSE;
6507 start_time = time(NULL) - 1;
6508 record_o_name[0] = '\0';
6510 /* Reset map panel */
6511 panel_row_min = cur_hgt;
6512 panel_col_min = cur_wid;
6514 /* Sexy gal gets bonus to maximum weapon skill of whip */
6515 if(p_ptr->pseikaku == SEIKAKU_SEXY)
6516 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = 8000;
6518 /* Fill the arrays of floors and walls in the good proportions */
6519 for (i = 0; i < 100; i++)
6521 int lim1, lim2, lim3;
6523 lim1 = d_info[dungeon_type].floor_percent1;
6524 lim2 = lim1 + d_info[dungeon_type].floor_percent2;
6525 lim3 = lim2 + d_info[dungeon_type].floor_percent3;
6528 floor_type[i] = d_info[dungeon_type].floor1;
6530 floor_type[i] = d_info[dungeon_type].floor2;
6532 floor_type[i] = d_info[dungeon_type].floor3;
6534 lim1 = d_info[dungeon_type].fill_percent1;
6535 lim2 = lim1 + d_info[dungeon_type].fill_percent2;
6536 lim3 = lim2 + d_info[dungeon_type].fill_percent3;
6538 fill_type[i] = d_info[dungeon_type].fill_type1;
6540 fill_type[i] = d_info[dungeon_type].fill_type2;
6542 fill_type[i] = d_info[dungeon_type].fill_type3;
6545 /* Flavor the objects */
6553 /* Flash a message */
6555 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6557 prt("Please wait...", 0, 0);
6561 /* Flush the message */
6565 /* Hack -- Enter wizard mode */
6568 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6569 else if (p_ptr->is_dead) quit("Already dead.");
6572 /* Initialize the town-buildings if necessary */
6573 if (!dun_level && !p_ptr->inside_quest)
6575 /* Init the wilderness */
6577 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6580 init_flags = INIT_ONLY_BUILDINGS;
6582 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6587 /* Initialize vault info */
6589 if (init_v_info()) quit("·úÃÛʪ½é´ü²½ÉÔǽ");
6591 if (init_v_info()) quit("Cannot initialize vaults");
6594 /* Generate a dungeon level if needed */
6595 if (!character_dungeon) change_floor();
6598 /* Character is now "complete" */
6599 character_generated = TRUE;
6602 /* Hack -- Character is no longer "icky" */
6603 character_icky = FALSE;
6607 p_ptr->playing = TRUE;
6609 /* Reset the visual mappings */
6612 /* Load the "pref" files */
6613 load_all_pref_files();
6615 /* React to changes */
6616 Term_xtra(TERM_XTRA_REACT, 0);
6619 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6622 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6628 /* Set or clear "rogue_like_commands" if requested */
6629 if (arg_force_original) rogue_like_commands = FALSE;
6630 if (arg_force_roguelike) rogue_like_commands = TRUE;
6632 /* Hack -- Enforce "delayed death" */
6633 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6635 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6637 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6639 monster_type *m_ptr;
6640 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6641 monster_race *r_ptr = &r_info[pet_r_idx];
6642 place_monster_aux(0, py, px - 1, pet_r_idx,
6643 (PM_FORCE_PET | PM_NO_KAGE));
6644 m_ptr = &m_list[hack_m_idx_ii];
6645 m_ptr->mspeed = r_ptr->speed;
6646 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6647 m_ptr->max_maxhp = m_ptr->maxhp;
6648 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6649 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6655 /* Process the level */
6659 if (p_ptr->notice) notice_stuff();
6662 if (p_ptr->update) update_stuff();
6665 if (p_ptr->redraw) redraw_stuff();
6668 if (p_ptr->window) window_stuff();
6671 /* Cancel the target */
6674 /* Cancel the health bar */
6678 /* Forget the lite */
6681 /* Forget the view */
6684 /* Forget the view */
6687 /* Handle "quit and save" */
6688 if (!p_ptr->playing && !p_ptr->is_dead) break;
6690 /* Erase the old cave */
6692 if (!p_ptr->is_dead) wipe_m_list();
6700 /* Accidental Death */
6701 if (p_ptr->playing && p_ptr->is_dead)
6703 if (p_ptr->inside_arena)
6705 p_ptr->inside_arena = FALSE;
6706 if(p_ptr->arena_number > MAX_ARENA_MONS)
6707 p_ptr->arena_number++;
6709 p_ptr->arena_number = 99;
6710 p_ptr->is_dead = FALSE;
6712 p_ptr->chp_frac = 0;
6713 p_ptr->exit_bldg = TRUE;
6718 /* Mega-Hack -- Allow player to cheat death */
6720 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
6722 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
6726 /* Mark social class, reset age, if needed */
6727 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6733 p_ptr->noscore |= 0x0001;
6737 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
6739 msg_print("You invoke wizard mode and cheat death.");
6745 /* Restore hit points */
6746 p_ptr->chp = p_ptr->mhp;
6747 p_ptr->chp_frac = 0;
6749 if (p_ptr->pclass == CLASS_MAGIC_EATER)
6751 for (i = 0; i < EATER_EXT*2; i++)
6753 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
6755 for (; i < EATER_EXT*3; i++)
6757 p_ptr->magic_num1[i] = 0;
6760 /* Restore spell points */
6761 p_ptr->csp = p_ptr->msp;
6762 p_ptr->csp_frac = 0;
6764 /* Hack -- Healing */
6766 (void)set_confused(0);
6767 (void)set_poisoned(0);
6768 (void)set_afraid(0);
6769 (void)set_paralyzed(0);
6774 /* Hack -- Prevent starvation */
6775 (void)set_food(PY_FOOD_MAX - 1);
6777 /* Hack -- cancel recall */
6778 if (p_ptr->word_recall)
6782 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
6784 msg_print("A tension leaves the air around you...");
6789 /* Hack -- Prevent recall */
6790 p_ptr->word_recall = 0;
6791 p_ptr->redraw |= (PR_STATUS);
6794 /* Hack -- cancel alter */
6795 if (p_ptr->alter_reality)
6797 /* Hack -- Prevent alter */
6798 p_ptr->alter_reality = 0;
6799 p_ptr->redraw |= (PR_STATUS);
6802 /* Note cause of death XXX XXX XXX */
6804 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
6806 (void)strcpy(p_ptr->died_from, "Cheating death");
6811 p_ptr->is_dead = FALSE;
6814 p_ptr->inside_arena = FALSE;
6815 p_ptr->inside_battle = FALSE;
6817 p_ptr->inside_quest = 0;
6818 p_ptr->recall_dungeon = dungeon_type;
6820 if (lite_town || vanilla_town)
6822 p_ptr->wilderness_y = 1;
6823 p_ptr->wilderness_x = 1;
6837 p_ptr->wilderness_y = 48;
6838 p_ptr->wilderness_x = 5;
6844 p_ptr->wild_mode = FALSE;
6845 p_ptr->leaving = TRUE;
6848 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
6850 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
6856 /* Handle "death" */
6857 if (p_ptr->is_dead) break;
6859 /* Make a new level */
6870 s32b turn_real(s32b hoge)
6872 if ((p_ptr->prace == RACE_VAMPIRE) ||
6873 (p_ptr->prace == RACE_SKELETON) ||
6874 (p_ptr->prace == RACE_ZOMBIE) ||
6875 (p_ptr->prace == RACE_SPECTRE))
6876 return hoge-(TURNS_PER_TICK * TOWN_DAWN *3/ 4);