4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Angband game engine */
15 #define TY_CURSE_CHANCE 200
16 #define CHAINSWORD_NOISE 100
18 static bool load = TRUE;
19 static int wild_regen = 20;
22 * Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
24 static byte value_check_aux1(object_type *o_ptr)
27 if (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:
343 case CLASS_BLUE_MAGE:
344 case CLASS_MIRROR_MASTER:
347 if (0 != randint0(55000L / (plev * plev + 40))) return;
353 case CLASS_CHAOS_WARRIOR:
356 if (0 != randint0(80000L / (plev * plev + 40))) return;
366 case CLASS_FORCETRAINER:
369 if (0 != randint0(20000L / (plev * plev + 40))) return;
378 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
387 case CLASS_BEASTMASTER:
390 if (0 != randint0(65000L / (plev * plev + 40))) return;
395 case CLASS_BERSERKER:
405 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
407 /*** Sense everything ***/
409 /* Check everything */
410 for (i = 0; i < INVEN_TOTAL; i++)
414 o_ptr = &inventory[i];
416 /* Skip empty slots */
417 if (!o_ptr->k_idx) continue;
419 /* Valid "tval" codes */
446 /* Skip non-sense machines */
449 /* Occasional failure on inventory items */
450 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
453 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
458 sense_inventory_aux(i, heavy);
463 static void sense_inventory2(void)
466 int plev = p_ptr->lev;
470 /*** Check for "sensing" ***/
472 /* No sensing when confused */
473 if (p_ptr->confused) return;
475 /* Analyze the class */
476 switch (p_ptr->pclass)
482 case CLASS_BERSERKER:
489 case CLASS_CHAOS_WARRIOR:
491 case CLASS_BEASTMASTER:
494 /* Very bad (light) sensing */
495 if (0 != randint0(240000L / (plev + 5))) return;
502 case CLASS_WARRIOR_MAGE:
507 if (0 != randint0(95000L / (plev * plev + 40))) return;
516 case CLASS_FORCETRAINER:
517 case CLASS_MINDCRAFTER:
520 if (0 != randint0(20000L / (plev * plev + 40))) return;
527 case CLASS_HIGH_MAGE:
529 case CLASS_MAGIC_EATER:
530 case CLASS_MIRROR_MASTER:
531 case CLASS_BLUE_MAGE:
534 if (0 != randint0(9000L / (plev * plev + 40))) return;
543 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
550 /*** Sense everything ***/
552 /* Check everything */
553 for (i = 0; i < INVEN_TOTAL; i++)
557 o_ptr = &inventory[i];
559 /* Skip empty slots */
560 if (!o_ptr->k_idx) continue;
562 /* Valid "tval" codes */
575 /* Skip non-sense machines */
578 /* Occasional failure on inventory items */
579 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
581 sense_inventory_aux(i, TRUE);
588 * Go to any level (ripped off from wiz_jump)
590 static void pattern_teleport(void)
597 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
599 if (get_check("Teleport level? "))
606 /* Only downward in ironman mode */
607 if (ironman_downward)
608 min_level = dun_level;
611 if (dungeon_type == DUNGEON_ANGBAND)
614 max_level = MAX_DEPTH - 1;
615 else if (dun_level == 100)
620 max_level = d_info[dungeon_type].maxdepth;
621 min_level = d_info[dungeon_type].mindepth;
626 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
628 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
633 sprintf(tmp_val, "%d", dun_level);
635 /* Ask for a level */
636 if (!get_string(ppp, tmp_val, 10)) return;
638 /* Extract request */
639 command_arg = atoi(tmp_val);
642 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
644 else if (get_check("Normal teleport? "))
648 teleport_player(200);
657 if (command_arg < min_level) command_arg = min_level;
660 if (command_arg > max_level) command_arg = max_level;
664 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
666 msg_format("You teleport to dungeon level %d.", command_arg);
670 if (autosave_l) do_cmd_save_game(TRUE);
673 dun_level = command_arg;
674 prepare_change_floor_mode(CFM_CLEAR_ALL);
678 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
680 p_ptr->inside_quest = 0;
681 p_ptr->leftbldg = FALSE;
685 p_ptr->leaving = TRUE;
689 static void wreck_the_pattern(void)
691 int to_ruin = 0, r_y, r_x;
693 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
700 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
701 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
703 msg_print("You bleed on the Pattern!");
704 msg_print("Something terrible happens!");
710 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
712 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
716 to_ruin = randint1(45) + 35;
720 scatter(&r_y, &r_x, py, px, 4, 0);
722 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
723 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
725 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
729 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
733 /* Returns TRUE if we are on the Pattern... */
734 static bool pattern_effect(void)
736 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
737 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
740 if ((prace_is_(RACE_AMBERITE)) &&
741 (p_ptr->cut > 0) && one_in_(10))
746 if (cave[py][px].feat == FEAT_PATTERN_END)
748 (void)set_poisoned(0);
754 (void)do_res_stat(A_STR);
755 (void)do_res_stat(A_INT);
756 (void)do_res_stat(A_WIS);
757 (void)do_res_stat(A_DEX);
758 (void)do_res_stat(A_CON);
759 (void)do_res_stat(A_CHR);
760 (void)restore_level();
761 (void)hp_player(1000);
762 cave_set_feat(py, px, FEAT_PATTERN_OLD);
764 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
766 msg_print("This section of the Pattern looks less powerful.");
773 * We could make the healing effect of the
774 * Pattern center one-time only to avoid various kinds
775 * of abuse, like luring the win monster into fighting you
776 * in the middle of the pattern...
779 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
783 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
787 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
791 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
793 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
799 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
801 else if (!IS_INVULN())
803 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
805 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
818 * Regenerate hit points -RAK-
820 static void regenhp(int percent)
822 s32b new_chp, new_chp_frac;
825 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
826 if (p_ptr->action == ACTION_HAYAGAKE) return;
827 /* Save the old hitpoints */
828 old_chp = p_ptr->chp;
830 /* Extract the new hitpoints */
831 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
832 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
834 /* check for overflow */
835 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
836 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
837 if (new_chp_frac >= 0x10000L)
839 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
844 p_ptr->chp_frac = (u16b)new_chp_frac;
848 if (p_ptr->chp >= p_ptr->mhp)
850 p_ptr->chp = p_ptr->mhp;
855 if (old_chp != p_ptr->chp)
858 p_ptr->redraw |= (PR_HP);
861 p_ptr->window |= (PW_PLAYER);
869 * Regenerate mana points -RAK-
871 static void regenmana(int percent)
873 s32b new_mana, new_mana_frac;
875 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
877 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
878 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
879 old_csp = p_ptr->csp;
880 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
881 if (old_csp_msp && (new_mana > 0))
885 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
886 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
890 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
891 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
893 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
895 if (new_mana_frac >= 0x10000L)
897 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
902 p_ptr->csp_frac = (u16b)(new_mana_frac);
905 /* check for overflow */
912 /* Must set frac to zero even if equal */
913 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
915 p_ptr->csp = p_ptr->msp;
920 if (old_csp != p_ptr->csp)
923 p_ptr->redraw |= (PR_MANA);
926 p_ptr->window |= (PW_PLAYER);
927 p_ptr->window |= (PW_SPELL);
938 static void regenmagic(int percent)
943 for (i = 0; i < EATER_EXT*2; i++)
945 if (!p_ptr->magic_num2[i]) continue;
946 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
947 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
948 p_ptr->magic_num1[i] += new_mana;
950 /* Must set frac to zero even if equal */
951 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
953 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
957 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
959 if (!p_ptr->magic_num1[i]) continue;
960 if (!p_ptr->magic_num2[i]) continue;
961 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
962 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
973 * Regenerate the monsters (once per 100 game turns)
975 * XXX XXX XXX Should probably be done during monster turns.
977 static void regen_monsters(void)
982 /* Regenerate everyone */
983 for (i = 1; i < m_max; i++)
985 /* Check the i'th monster */
986 monster_type *m_ptr = &m_list[i];
987 monster_race *r_ptr = &r_info[m_ptr->r_idx];
990 /* Skip dead monsters */
991 if (!m_ptr->r_idx) continue;
993 /* Allow regeneration (if needed) */
994 if (m_ptr->hp < m_ptr->maxhp)
996 /* Hack -- Base regeneration */
997 frac = m_ptr->maxhp / 100;
999 /* Hack -- Minimal regeneration rate */
1000 if (!frac) if (one_in_(2)) frac = 1;
1002 /* Hack -- Some monsters regenerate quickly */
1003 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1005 /* Hack -- Regenerate */
1008 /* Do not over-regenerate */
1009 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1011 /* Redraw (later) if needed */
1012 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1013 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1020 * Regenerate the captured monsters (once per 30 game turns)
1022 * XXX XXX XXX Should probably be done during monster turns.
1024 static void regen_captured_monsters(void)
1029 /* Regenerate everyone */
1030 for (i = 0; i < INVEN_TOTAL; i++)
1032 monster_race *r_ptr;
1033 object_type *o_ptr = &inventory[i];
1035 if (!o_ptr->k_idx) continue;
1036 if (o_ptr->tval != TV_CAPTURE) continue;
1037 if (!o_ptr->pval) continue;
1041 r_ptr = &r_info[o_ptr->pval];
1043 /* Allow regeneration (if needed) */
1044 if (o_ptr->xtra4 < o_ptr->xtra5)
1046 /* Hack -- Base regeneration */
1047 frac = o_ptr->xtra5 / 100;
1049 /* Hack -- Minimal regeneration rate */
1050 if (!frac) if (one_in_(2)) frac = 1;
1052 /* Hack -- Some monsters regenerate quickly */
1053 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1055 /* Hack -- Regenerate */
1056 o_ptr->xtra4 += frac;
1058 /* Do not over-regenerate */
1059 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1066 p_ptr->notice |= (PN_COMBINE);
1069 p_ptr->window |= (PW_INVEN);
1070 p_ptr->window |= (PW_EQUIP);
1077 * Process the counters of monsters (once per 10 game turns)
1079 * This function is to process monsters' counters same as player's.
1081 static void process_monsters_counters(void)
1084 monster_type *m_ptr;
1085 monster_race *r_ptr;
1087 /* Handle "leaving" */
1088 if (p_ptr->leaving) return;
1090 /* Process the monsters (backwards) */
1091 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1093 /* Access the monster */
1094 m_ptr = &m_list[m_idx];
1095 r_ptr = &r_info[m_ptr->r_idx];
1097 /* Ignore "dead" monsters */
1098 if (!m_ptr->r_idx) continue;
1100 /* Handle Invulnerability */
1101 if (m_ptr->invulner)
1103 /* Reduce by one, note if expires */
1106 if (!m_ptr->invulner)
1112 /* Acquire the monster name */
1113 monster_desc(m_name, m_ptr, 0);
1115 /* Dump a message */
1117 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1119 msg_format("%^s is no longer invulnerable.", m_name);
1122 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1123 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1125 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1132 /* Reduce by one, note if expires */
1135 if (!m_ptr->fast && m_ptr->ml)
1139 /* Acquire the monster name */
1140 monster_desc(m_name, m_ptr, 0);
1142 /* Dump a message */
1144 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1146 msg_format("%^s is no longer fast.", m_name);
1149 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1150 if (p_ptr->riding == m_idx)
1152 p_ptr->redraw |= (PR_UHEALTH);
1153 p_ptr->update |= (PU_BONUS);
1161 /* Reduce by one, note if expires */
1164 if (!m_ptr->slow && m_ptr->ml)
1168 /* Acquire the monster name */
1169 monster_desc(m_name, m_ptr, 0);
1171 /* Dump a message */
1173 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1175 msg_format("%^s is no longer slow.", m_name);
1178 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1179 if (p_ptr->riding == m_idx)
1181 p_ptr->redraw |= (PR_UHEALTH);
1182 p_ptr->update |= (PU_BONUS);
1192 /* Make a "saving throw" against stun */
1193 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1199 /* Hack -- Recover from stun */
1200 if (m_ptr->stunned > d)
1202 /* Recover somewhat */
1203 m_ptr->stunned -= d;
1212 /* Message if visible */
1217 /* Acquire the monster name */
1218 monster_desc(m_name, m_ptr, 0);
1220 /* Dump a message */
1222 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1224 msg_format("%^s is no longer stunned.", m_name);
1227 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1228 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1233 /* Handle confusion */
1234 if (m_ptr->confused)
1236 /* Amount of "boldness" */
1237 int d = randint1(r_ptr->level / 20 + 1);
1239 /* Still confused */
1240 if (m_ptr->confused > d)
1242 /* Reduce the confusion */
1243 m_ptr->confused -= d;
1249 /* No longer confused */
1250 m_ptr->confused = 0;
1252 /* Message if visible */
1257 /* Acquire the monster name */
1258 monster_desc(m_name, m_ptr, 0);
1260 /* Dump a message */
1262 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1264 msg_format("%^s is no longer confused.", m_name);
1267 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1268 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1276 /* Amount of "boldness" */
1277 int d = randint1(r_ptr->level / 20 + 1);
1280 if (m_ptr->monfear > d)
1282 /* Reduce the fear */
1283 m_ptr->monfear -= d;
1286 /* Recover from fear, take note if seen */
1289 /* No longer afraid */
1298 /* Acquire the monster name/poss */
1299 monster_desc(m_name, m_ptr, 0);
1300 monster_desc(m_poss, m_ptr, 0x22);
1302 /* Dump a message */
1304 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1306 msg_format("%^s recovers %s courage.", m_name, m_poss);
1309 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1310 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1318 static void notice_lite_change(object_type *o_ptr)
1320 /* Hack -- notice interesting fuel steps */
1321 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1324 p_ptr->window |= (PW_EQUIP);
1327 /* Hack -- Special treatment when blind */
1330 /* Hack -- save some light for later */
1331 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1334 /* The light is now out */
1335 else if (o_ptr->xtra4 == 0)
1339 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1341 msg_print("Your light has gone out!");
1343 p_ptr->update |= (PU_BONUS);
1346 /* The light is getting dim */
1347 else if (o_ptr->name2 == EGO_LITE_LONG)
1349 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1350 && (turn % (TURNS_PER_TICK*2)))
1352 if (disturb_minor) disturb(0, 0);
1354 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1356 msg_print("Your light is growing faint.");
1362 /* The light is getting dim */
1363 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1365 if (disturb_minor) disturb(0, 0);
1367 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1369 msg_print("Your light is growing faint.");
1376 void leave_quest_check(void)
1378 /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
1379 leaving_quest = p_ptr->inside_quest;
1381 /* Leaving an 'only once' quest marks it as failed */
1382 if (leaving_quest &&
1383 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1384 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1386 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1387 quest[leaving_quest].complev = (byte)p_ptr->lev;
1388 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1390 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1391 if (record_rand_quest)
1392 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1394 /* Floor of random quest will be blocked */
1395 prepare_change_floor_mode(CFM_NO_RETURN);
1397 else if (record_fix_quest)
1398 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1404 * Forcibly pseudo-identify an object in the inventory
1407 * note: currently this function allows pseudo-id of any object,
1408 * including silly ones like potions & scrolls, which always
1409 * get '{average}'. This should be changed, either to stop such
1410 * items from being pseudo-id'd, or to allow psychometry to
1411 * detect whether the unidentified potion/scroll/etc is
1412 * good (Cure Light Wounds, Restore Strength, etc) or
1413 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1415 bool psychometry(void)
1419 char o_name[MAX_NLEN];
1425 item_tester_no_ryoute = TRUE;
1428 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1429 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1431 q = "Meditate on which item? ";
1432 s = "You have nothing appropriate.";
1435 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1437 /* Get the item (in the pack) */
1440 o_ptr = &inventory[item];
1443 /* Get the item (on the floor) */
1446 o_ptr = &o_list[0 - item];
1449 /* It is fully known, no information needed */
1450 if (object_known_p(o_ptr))
1453 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1455 msg_print("You cannot find out anything more about that.");
1461 /* Check for a feeling */
1462 feel = value_check_aux1(o_ptr);
1464 /* Get an object description */
1465 object_desc(o_name, o_ptr, FALSE, 0);
1467 /* Skip non-feelings */
1471 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1473 msg_format("You do not perceive anything unusual about the %s.", o_name);
1480 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1481 o_name, game_inscriptions[feel]);
1483 msg_format("You feel that the %s %s %s...",
1484 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1485 game_inscriptions[feel]);
1489 /* We have "felt" it */
1490 o_ptr->ident |= (IDENT_SENSE);
1493 o_ptr->feeling = feel;
1495 /* Combine / Reorder the pack (later) */
1496 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1499 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1501 /* Valid "tval" codes */
1502 switch (o_ptr->tval)
1530 /* Auto-inscription/destroy */
1531 idx = is_autopick(o_ptr);
1532 auto_inscribe_item(item, idx);
1533 if (okay && destroy_feeling)
1534 auto_destroy_item(item, idx);
1536 /* Something happened */
1541 static void gere_music(s32b music)
1549 stun_monsters(damroll(p_ptr->lev/10,2));
1552 hp_player(damroll(2,6));
1555 project_hack(GF_TURN_ALL, p_ptr->lev);
1558 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1561 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1564 confuse_monsters(p_ptr->lev * 2);
1567 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1570 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1573 project(0, 0, py, px,
1574 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1577 dispel_monsters(randint1(p_ptr->lev * 3));
1578 dispel_evil(randint1(p_ptr->lev * 3));
1585 earthquake(py, px, 10);
1588 stasis_monsters(p_ptr->lev * 4);
1591 dispel_monsters(randint1(p_ptr->lev * 3));
1594 hp_player(damroll(15,10));
1598 case MUSIC_DETECT+19:
1600 case MUSIC_DETECT+11:
1601 case MUSIC_DETECT+12:
1602 case MUSIC_DETECT+13:
1603 case MUSIC_DETECT+14:
1604 case MUSIC_DETECT+15:
1605 case MUSIC_DETECT+16:
1606 case MUSIC_DETECT+17:
1607 case MUSIC_DETECT+18:
1608 map_area(DETECT_RAD_MAP);
1609 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1610 case MUSIC_DETECT+6:
1611 case MUSIC_DETECT+7:
1612 case MUSIC_DETECT+8:
1613 case MUSIC_DETECT+9:
1614 case MUSIC_DETECT+10:
1615 /* There are too many hidden treasure. So... */
1616 /* detect_treasure(DETECT_RAD_DEFAULT); */
1617 detect_objects_gold(DETECT_RAD_DEFAULT);
1618 detect_objects_normal(DETECT_RAD_DEFAULT);
1619 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1620 case MUSIC_DETECT+3:
1621 case MUSIC_DETECT+4:
1622 case MUSIC_DETECT+5:
1623 detect_monsters_invis(DETECT_RAD_DEFAULT);
1624 detect_monsters_normal(DETECT_RAD_DEFAULT);
1625 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1627 case MUSIC_DETECT+1:
1628 case MUSIC_DETECT+2:
1629 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1630 detect_doors(DETECT_RAD_DEFAULT);
1631 detect_stairs(DETECT_RAD_DEFAULT);
1632 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1638 * If player has inscribed the object with "!!", let him know when it's
1641 static void recharged_notice(object_type *o_ptr)
1643 char o_name[MAX_NLEN];
1647 /* No inscription */
1648 if (!o_ptr->inscription) return;
1651 s = strchr(quark_str(o_ptr->inscription), '!');
1653 /* Process notification request. */
1656 /* Find another '!' */
1659 /* Describe (briefly) */
1660 object_desc(o_name, o_ptr, FALSE, 0);
1662 /* Notify the player */
1664 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1666 if (o_ptr->number > 1)
1667 msg_format("Your %s are recharged.", o_name);
1669 msg_format("Your %s is recharged.", o_name);
1678 /* Keep looking for '!'s */
1679 s = strchr(s + 1, '!');
1684 static void check_music(void)
1690 /* Music singed by player */
1691 if (p_ptr->pclass != CLASS_BARD) return;
1692 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1694 spell = p_ptr->magic_num2[0];
1695 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1697 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1698 need_mana *= 0x8000;
1699 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1706 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1707 need_mana = (need_mana & 0xffff);
1708 if ((u32b)p_ptr->csp_frac < need_mana)
1711 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1715 p_ptr->csp_frac -= (u16b)need_mana;
1718 p_ptr->redraw |= PR_MANA;
1719 if (p_ptr->magic_num1[1])
1721 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1722 p_ptr->magic_num1[1] = 0;
1724 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1726 msg_print("You restart singing.");
1728 p_ptr->action = ACTION_SING;
1730 /* Recalculate bonuses */
1731 p_ptr->update |= (PU_BONUS | PU_HP);
1733 /* Redraw map and status bar */
1734 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1736 /* Update monsters */
1737 p_ptr->update |= (PU_MONSTERS);
1740 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1743 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1744 p_ptr->spell_exp[spell] += 5;
1745 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1746 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1747 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1748 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1749 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1750 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1752 gere_music(p_ptr->magic_num1[0]);
1755 /* Choose one of items that have cursed flag */
1756 static object_type *choose_cursed_obj_name(u32b flag)
1759 int choices[INVEN_TOTAL-INVEN_RARM];
1762 /* Paranoia -- Player has no warning-item */
1763 if (!(p_ptr->cursed & flag)) return NULL;
1765 /* Search Inventry */
1766 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1768 object_type *o_ptr = &inventory[i];
1770 if (o_ptr->curse_flags & flag)
1772 choices[number] = i;
1777 /* Choice one of them */
1778 return (&inventory[choices[randint0(number)]]);
1783 * Handle certain things once every 10 game turns
1785 static void process_world(void)
1789 bool cave_no_regen = FALSE;
1790 int upkeep_factor = 0;
1795 const int dec_count = (easy_band ? 2 : 1);
1797 int day, hour, min, prev_min;
1799 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1800 s32b tick = turn % len + len / 4;
1802 extract_day_hour_min(&day, &hour, &min);
1803 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1805 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1807 !(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)))) &&
1808 !(p_ptr->inside_battle))
1811 if (p_ptr->inside_battle && !p_ptr->leaving)
1818 /* Count all hostile monsters */
1819 for (i2 = 0; i2 < cur_wid; ++i2)
1820 for (j2 = 0; j2 < cur_hgt; j2++)
1821 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1824 win_m_idx = cave[j2][i2].m_idx;
1827 if (number_mon == 0)
1830 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1832 msg_print("They have kill each other at the same time.");
1835 p_ptr->energy_need = 0;
1838 else if ((number_mon-1) == 0)
1841 monster_type *wm_ptr;
1843 wm_ptr = &m_list[win_m_idx];
1845 monster_desc(m_name, wm_ptr, 0);
1847 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1849 msg_format("%s is winner!", m_name);
1853 if (win_m_idx == (sel_monster+1))
1856 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1858 msg_print("Congratulations.");
1861 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1863 msg_format("You received %d gold.", battle_odds);
1865 p_ptr->au += battle_odds;
1870 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1872 msg_print("You lost gold.");
1876 p_ptr->energy_need = 0;
1879 else if(turn - old_turn == 150*TURNS_PER_TICK)
1882 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
1884 msg_format("This battle have ended in a draw.");
1886 p_ptr->au += kakekin;
1888 p_ptr->energy_need = 0;
1893 /* Every 10 game turns */
1894 if (turn % TURNS_PER_TICK) return;
1896 /*** Check the Time and Load ***/
1898 if (!(turn % (50*TURNS_PER_TICK)))
1900 /* Check time and load */
1901 if ((0 != check_time()) || (0 != check_load()))
1904 if (closing_flag <= 2)
1909 /* Count warnings */
1914 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
1915 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
1917 msg_print("The gates to ANGBAND are closing...");
1918 msg_print("Please finish up and/or save your game.");
1928 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
1930 msg_print("The gates to ANGBAND are now closed.");
1935 p_ptr->playing = FALSE;
1938 p_ptr->leaving = TRUE;
1943 /*** Attempt timed autosave ***/
1944 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
1946 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
1947 do_cmd_save_game(TRUE);
1953 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
1955 msg_print("You hear noise.");
1959 /*** Handle the wilderness/town (sunshine) ***/
1961 /* While in town/wilderness */
1962 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
1964 /* Hack -- Daybreak/Nighfall in town */
1965 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
1969 /* Check for dawn */
1970 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
1977 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
1979 msg_print("The sun has risen.");
1983 /* Hack -- Scan the town */
1984 for (y = 0; y < cur_hgt; y++)
1986 for (x = 0; x < cur_wid; x++)
1988 /* Get the cave grid */
1989 c_ptr = &cave[y][x];
1992 c_ptr->info |= (CAVE_GLOW);
1994 /* Hack -- Memorize lit grids if allowed */
1995 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
1997 /* Hack -- Notice spot */
2008 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2010 msg_print("The sun has fallen.");
2014 /* Hack -- Scan the town */
2015 for (y = 0; y < cur_hgt; y++)
2017 for (x = 0; x < cur_wid; x++)
2019 /* Get the cave grid */
2020 c_ptr = &cave[y][x];
2022 /* Darken "boring" features */
2023 if ((c_ptr->feat <= FEAT_INVIS) ||
2024 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
2025 (c_ptr->feat <= FEAT_MOUNTAIN) &&
2026 (c_ptr->feat != FEAT_MUSEUM)) ||
2027 (x == 0) || (x == cur_wid-1) ||
2028 (y == 0) || (y == cur_hgt-1))
2030 /* Forget the grid */
2031 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
2033 /* Hack -- Notice spot */
2038 /* Glow deep lava */
2043 /* Update the monsters */
2044 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2047 p_ptr->redraw |= (PR_MAP);
2050 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2054 /* Set back the rewards once a day */
2055 /* Only used for reward in thief's guild for now */
2056 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2060 /* Reset the rewards */
2061 for (n = 0; n < MAX_BACT; n++)
2063 p_ptr->rewards[n] = FALSE;
2068 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2070 if (cheat_xtra) msg_print("Rewards reset.");
2076 /*** Process the monsters ***/
2078 /* Check for creature generation. */
2079 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2080 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2082 /* Make a new monster */
2083 (void)alloc_monster(MAX_SIGHT + 5, 0);
2086 /* Hack -- Check for creature regeneration */
2087 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2088 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2090 /* Hack -- Process the counters of all monsters */
2091 process_monsters_counters();
2094 /*** Damage over Time ***/
2096 /* Take damage from poison */
2097 if (p_ptr->poisoned && !IS_INVULN())
2101 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2103 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2109 /* (Vampires) Take damage from sunlight */
2110 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2112 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2114 if (cave[py][px].info & CAVE_GLOW)
2118 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2119 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2121 msg_print("The sun's rays scorch your undead flesh!");
2122 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2125 cave_no_regen = TRUE;
2129 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2130 !p_ptr->resist_lite)
2132 object_type * o_ptr = &inventory[INVEN_LITE];
2133 char o_name [MAX_NLEN];
2134 char ouch [MAX_NLEN+40];
2136 /* Get an object description */
2137 object_desc(o_name, o_ptr, FALSE, 0);
2140 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2142 msg_format("The %s scorches your undead flesh!", o_name);
2146 cave_no_regen = TRUE;
2148 /* Get an object description */
2149 object_desc(o_name, o_ptr, TRUE, 0);
2152 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2154 sprintf(ouch, "wielding %s", o_name);
2157 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2161 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2162 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2164 int damage = 3000 + randint0(2000);
2166 if (prace_is_(RACE_ENT)) damage += damage/3;
2167 if (p_ptr->resist_fire) damage = damage / 3;
2168 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2169 damage = damage / 100 + (randint0(100) < (damage % 100));
2175 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2176 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2178 msg_print("The lava burns you!");
2179 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2182 cave_no_regen = TRUE;
2186 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2187 !IS_INVULN() && !p_ptr->immune_fire)
2189 int damage = 6000 + randint0(4000);
2194 if (p_ptr->resist_fire) damage = damage / 3;
2195 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2199 damage = damage / 5;
2202 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2203 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2205 message = "The heat burns you!";
2206 hit_from = "flying over deep lava";
2213 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2214 hit_from = "¿¼¤¤ÍÏ´äή";
2216 message = "The lava burns you!";
2217 hit_from = "deep lava";
2222 damage = damage / 100 + (randint0(100) < (damage % 100));
2227 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2229 cave_no_regen = TRUE;
2233 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2235 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2239 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2240 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2242 msg_print("You are drowning!");
2243 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2246 cave_no_regen = TRUE;
2253 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2255 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2256 if (prace_is_(RACE_ENT)) damage += damage / 3;
2257 if (p_ptr->resist_fire) damage = damage / 3;
2258 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2260 msg_print("Ç®¤¤¡ª");
2261 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2263 msg_print("It's hot!");
2264 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2267 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2269 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2270 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2271 if (p_ptr->resist_elec) damage = damage / 3;
2272 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2274 msg_print("Äˤ¤¡ª");
2275 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2277 msg_print("It hurts!");
2278 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2281 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2283 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2284 if (p_ptr->resist_cold) damage = damage / 3;
2285 if (IS_OPPOSE_COLD()) damage = damage / 3;
2287 msg_print("Î䤿¤¤¡ª");
2288 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2290 msg_print("It's cold!");
2291 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2296 /* Spectres -- take damage when moving through walls */
2298 * Added: ANYBODY takes damage if inside through walls
2299 * without wraith form -- NOTE: Spectres will never be
2300 * reduced below 0 hp by being inside a stone wall; others
2303 if (!cave_floor_bold(py, px))
2305 /* Player can walk through trees */
2306 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2310 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2311 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2315 cave_no_regen = TRUE;
2317 if (p_ptr->pass_wall)
2320 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2323 msg_print("Your molecules feel disrupted!");
2324 dam_desc = "density";
2331 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2332 dam_desc = "¹Å¤¤´ä";
2334 msg_print("You are being crushed!");
2335 dam_desc = "solid rock";
2340 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2346 monster_race *r_ptr;
2348 if (min != prev_min)
2351 bool old_inside_battle = p_ptr->inside_battle;
2353 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2355 p_ptr->inside_battle = TRUE;
2356 get_mon_num_prep(NULL,NULL);
2358 for (i = 0; i < max_d_idx; i++)
2360 if (max_dlv[i] < d_info[i].mindepth) continue;
2361 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2365 today_mon = get_mon_num(max_dl);
2366 r_ptr = &r_info[today_mon];
2368 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2369 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2370 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2371 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2372 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2373 if (r_ptr->rarity > 10) continue;
2374 if (r_ptr->level == 0) continue;
2377 p_ptr->today_mon = 0;
2378 p_ptr->inside_battle = old_inside_battle;
2382 /* Nightmare mode activates the TY_CURSE at midnight */
2383 if (ironman_nightmare)
2385 /* Require exact minute */
2386 if (min != prev_min)
2388 /* Every 15 minutes after 11:00 pm */
2389 if ((hour == 23) && !(min % 15))
2399 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2401 msg_print("You hear a distant bell toll ominously.");
2409 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2411 msg_print("A distant bell sounds twice.");
2419 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2421 msg_print("A distant bell sounds three times.");
2429 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2431 msg_print("A distant bell tolls four times.");
2439 /* TY_CURSE activates at mignight! */
2446 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2448 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2451 activate_ty_curse(FALSE, &count);
2456 /* Take damage from cuts */
2457 if (p_ptr->cut && !IS_INVULN())
2459 /* Mortal wound or Deep Gash */
2460 if (p_ptr->cut > 1000)
2465 else if (p_ptr->cut > 200)
2471 else if (p_ptr->cut > 100)
2476 else if (p_ptr->cut > 50)
2481 else if (p_ptr->cut > 25)
2486 else if (p_ptr->cut > 10)
2499 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2501 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2507 /*** Check the Food, and Regenerate ***/
2509 if (!p_ptr->inside_battle)
2511 /* Digest normally */
2512 if (p_ptr->food < PY_FOOD_MAX)
2514 /* Every 50 game turns */
2515 if (!(turn % (TURNS_PER_TICK*5)))
2517 /* Basic digestion rate based on speed */
2518 i = /* extract_energy[p_ptr->pspeed] * 2;*/
2519 ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
2520 1 : extract_energy[p_ptr->pspeed]));
2522 /* Regeneration takes more food */
2523 if (p_ptr->regenerate) i += 20;
2524 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2525 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2527 /* Slow digestion takes less food */
2528 if (p_ptr->slow_digest) i -= 5;
2530 /* Minimal digestion */
2532 /* Maximal digestion */
2533 if (i > 100) i = 100;
2535 /* Digest some food */
2536 (void)set_food(p_ptr->food - i);
2540 /* Digest quickly when gorged */
2543 /* Digest a lot of food */
2544 (void)set_food(p_ptr->food - 100);
2548 /* Starve to death (slowly) */
2549 if (p_ptr->food < PY_FOOD_STARVE)
2551 /* Calculate damage */
2552 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2556 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2558 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2563 /* Default regeneration */
2564 regen_amount = PY_REGEN_NORMAL;
2567 if (p_ptr->food < PY_FOOD_WEAK)
2569 /* Lower regeneration */
2570 if (p_ptr->food < PY_FOOD_STARVE)
2574 else if (p_ptr->food < PY_FOOD_FAINT)
2576 regen_amount = PY_REGEN_FAINT;
2580 regen_amount = PY_REGEN_WEAK;
2584 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2586 /* Faint occasionally */
2587 if (!p_ptr->paralyzed && (randint0(100) < 10))
2591 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2593 msg_print("You faint from the lack of food.");
2598 /* Hack -- faint (bypass free action) */
2599 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2605 /* Are we walking the pattern? */
2606 if (pattern_effect())
2608 cave_no_regen = TRUE;
2612 /* Regeneration ability */
2613 if (p_ptr->regenerate)
2615 regen_amount = regen_amount * 2;
2617 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2621 if (p_ptr->cursed & TRC_SLOW_REGEN)
2628 /* Searching or Resting */
2629 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2631 regen_amount = regen_amount * 2;
2634 upkeep_factor = calculate_upkeep();
2636 /* Regenerate the mana */
2637 /* if (p_ptr->csp < p_ptr->msp) */
2641 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2642 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2643 regenmana(upkeep_regen/100);
2645 #ifdef TRACK_FRIENDS
2649 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2651 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2655 #endif /* TRACK_FRIENDS */
2658 else if (p_ptr->action != ACTION_LEARN)
2660 regenmana(regen_amount);
2663 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2665 regenmagic(regen_amount);
2668 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2670 while (upkeep_factor > 100)
2673 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2675 msg_print("Such much pets cannot be controled at once!");
2678 do_cmd_pet_dismiss();
2680 upkeep_factor = calculate_upkeep();
2683 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2685 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2691 /* Poisoned or cut yields no healing */
2692 if (p_ptr->poisoned) regen_amount = 0;
2693 if (p_ptr->cut) regen_amount = 0;
2695 /* Special floor -- Pattern, in a wall -- yields no healing */
2696 if (cave_no_regen) regen_amount = 0;
2698 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2700 /* Regenerate Hit Points if needed */
2701 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2703 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2704 (cave[py][px].feat >= FEAT_PATTERN_START))
2706 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2710 regenhp(regen_amount);
2715 /*** Timeout Various Things ***/
2718 if (p_ptr->tim_mimic)
2720 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2723 /* Hack -- Hallucinating */
2726 (void)set_image(p_ptr->image - dec_count);
2732 (void)set_blind(p_ptr->blind - dec_count);
2735 /* Times see-invisible */
2736 if (p_ptr->tim_invis)
2738 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2749 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2752 /* Timed temporary elemental brands. -LM- */
2753 if (p_ptr->ele_attack)
2755 p_ptr->ele_attack--;
2757 /* Clear all temporary elemental brands. */
2758 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2761 /* Timed temporary elemental immune. -LM- */
2762 if (p_ptr->ele_immune)
2764 p_ptr->ele_immune--;
2766 /* Clear all temporary elemental brands. */
2767 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2770 /* Timed infra-vision */
2771 if (p_ptr->tim_infra)
2773 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2777 if (p_ptr->tim_stealth)
2779 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2782 /* Timed levitation */
2783 if (p_ptr->tim_ffall)
2785 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2788 /* Timed sh_touki */
2789 if (p_ptr->tim_sh_touki)
2791 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2795 if (p_ptr->tim_sh_fire)
2797 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2801 if (p_ptr->tim_sh_holy)
2803 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2807 if (p_ptr->tim_eyeeye)
2809 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2812 /* Timed resist-magic */
2813 if (p_ptr->resist_magic)
2815 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2818 /* Timed regeneration */
2819 if (p_ptr->tim_regen)
2821 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2824 /* Timed resist nether */
2825 if (p_ptr->tim_res_nether)
2827 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2830 /* Timed resist time */
2831 if (p_ptr->tim_res_time)
2833 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2837 if (p_ptr->tim_reflect)
2839 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2843 if (p_ptr->multishadow)
2845 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2848 /* Timed Robe of dust */
2849 if (p_ptr->dustrobe)
2851 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2854 /* Timed infra-vision */
2855 if (p_ptr->kabenuke)
2857 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2861 if (p_ptr->paralyzed)
2863 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2867 if (p_ptr->confused)
2869 (void)set_confused(p_ptr->confused - dec_count);
2875 (void)set_afraid(p_ptr->afraid - dec_count);
2881 (void)set_fast(p_ptr->fast - 1, TRUE);
2887 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2890 /* Protection from evil */
2891 if (p_ptr->protevil)
2893 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2896 /* Invulnerability */
2899 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2903 if (p_ptr->wraith_form)
2905 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2911 (void)set_hero(p_ptr->hero - 1, TRUE);
2917 (void)set_shero(p_ptr->shero - 1, TRUE);
2923 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2929 (void)set_shield(p_ptr->shield - 1, TRUE);
2933 if (p_ptr->tsubureru)
2935 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2939 if (p_ptr->magicdef)
2941 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2945 if (p_ptr->tsuyoshi)
2947 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2951 if (p_ptr->oppose_acid)
2953 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2956 /* Oppose Lightning */
2957 if (p_ptr->oppose_elec)
2959 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2963 if (p_ptr->oppose_fire)
2965 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2969 if (p_ptr->oppose_cold)
2971 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2975 if (p_ptr->oppose_pois)
2977 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2982 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2985 /*** Poison and Stun and Cut ***/
2988 if (p_ptr->poisoned)
2990 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2992 /* Apply some healing */
2993 (void)set_poisoned(p_ptr->poisoned - adjust);
2999 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3001 /* Apply some healing */
3002 (void)set_stun(p_ptr->stun - adjust);
3008 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3010 /* Hack -- Truly "mortal" wound */
3011 if (p_ptr->cut > 1000) adjust = 0;
3013 /* Apply some healing */
3014 (void)set_cut(p_ptr->cut - adjust);
3019 /*** Process Light ***/
3021 /* Check for light being wielded */
3022 o_ptr = &inventory[INVEN_LITE];
3024 /* Burn some fuel in the current lite */
3025 if (o_ptr->tval == TV_LITE)
3027 /* Hack -- Use some fuel (except on artifacts) */
3028 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3030 /* Decrease life-span */
3031 if (o_ptr->name2 == EGO_LITE_LONG)
3033 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3035 else o_ptr->xtra4--;
3037 /* Notice interesting fuel steps */
3038 notice_lite_change(o_ptr);
3042 /* Calculate torch radius */
3043 p_ptr->update |= (PU_TORCH);
3046 /*** Process mutation effects ***/
3047 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3049 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3053 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3054 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3056 msg_print("RAAAAGHH!");
3057 msg_print("You feel a fit of rage coming over you!");
3060 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3063 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3065 if (!p_ptr->resist_fear)
3069 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3071 msg_print("It's so dark... so scary!");
3074 set_afraid(p_ptr->afraid + 13 + randint1(26));
3078 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3080 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3085 /* Teleport player */
3087 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3089 msg_print("Your position suddenly seems very uncertain...");
3093 teleport_player(40);
3097 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3099 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3102 p_ptr->redraw |= PR_EXTRA;
3104 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3106 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3111 if (!p_ptr->resist_conf)
3113 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3116 if (!p_ptr->resist_chaos)
3121 if (one_in_(3)) lose_all_info();
3123 teleport_player(100);
3126 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3127 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3129 msg_print("You wake up somewhere with a sore head...");
3130 msg_print("You can't remember a thing, or how you got here!");
3139 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3141 msg_print("Thishcischs GooDSChtuff!");
3144 (void)set_image(p_ptr->image + randint0(150) + 150);
3150 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3152 if (!p_ptr->resist_chaos)
3155 p_ptr->redraw |= PR_EXTRA;
3156 (void)set_image(p_ptr->image + randint0(50) + 20);
3160 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3165 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3167 msg_print("BRRAAAP! Oops.");
3171 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3174 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3175 !p_ptr->anti_magic && one_in_(9000))
3180 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3182 msg_print("Magical energy flows through you! You must release it!");
3187 (void)get_hack_dir(&dire);
3188 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3191 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3192 !p_ptr->anti_magic && (randint1(6666) == 666))
3194 bool pet = one_in_(6);
3195 u32b mode = PM_ALLOW_GROUP;
3197 if (pet) mode |= PM_FORCE_PET;
3198 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3200 if (summon_specific((pet ? -1 : 0), py, px,
3201 dun_level, SUMMON_DEMON, mode))
3204 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3206 msg_print("You have attracted a demon!");
3213 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3219 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3221 msg_print("You feel less energetic.");
3224 if (p_ptr->fast > 0)
3230 set_slow(randint1(30) + 10, FALSE);
3236 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3238 msg_print("You feel more energetic.");
3241 if (p_ptr->slow > 0)
3247 set_fast(randint1(30) + 10, FALSE);
3252 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3256 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3258 msg_print("You suddenly feel almost lonely.");
3261 banish_monsters(100);
3262 if (!dun_level && p_ptr->town_num)
3265 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3267 msg_print("You see one of the shopkeepers running for the hills!");
3270 store_shuffle(randint0(MAX_STORES));
3275 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3280 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3282 msg_print("A shadow passes over you.");
3287 /* Absorb light from the current possition */
3288 if (cave[py][px].info & CAVE_GLOW)
3293 o_ptr = &inventory[INVEN_LITE];
3295 /* Absorb some fuel in the current lite */
3296 if (o_ptr->tval == TV_LITE)
3298 /* Use some fuel (except on artifacts) */
3299 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3301 /* Heal the player a bit */
3302 hp_player(o_ptr->xtra4 / 20);
3304 /* Decrease life-span of lite */
3308 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3310 msg_print("You absorb energy from your light!");
3314 /* Notice interesting fuel steps */
3315 notice_lite_change(o_ptr);
3320 * Unlite the area (radius 10) around player and
3321 * do 50 points damage to every affected monster
3323 unlite_area(50, 10);
3326 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3327 !p_ptr->anti_magic && one_in_(7000))
3329 bool pet = one_in_(3);
3330 u32b mode = PM_ALLOW_GROUP;
3332 if (pet) mode |= PM_FORCE_PET;
3333 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3335 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3338 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3340 msg_print("You have attracted an animal!");
3347 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3348 !p_ptr->anti_magic && one_in_(8000))
3352 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3354 msg_print("You feel the world warping around you!");
3358 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3360 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3362 if (!lose_mutation(0))
3364 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3366 msg_print("You feel oddly normal.");
3370 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3374 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3376 msg_print("You feel insubstantial!");
3380 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3382 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3386 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3388 int which_stat = randint0(6);
3389 int sustained = FALSE;
3394 if (p_ptr->sustain_str) sustained = TRUE;
3397 if (p_ptr->sustain_int) sustained = TRUE;
3400 if (p_ptr->sustain_wis) sustained = TRUE;
3403 if (p_ptr->sustain_dex) sustained = TRUE;
3406 if (p_ptr->sustain_con) sustained = TRUE;
3409 if (p_ptr->sustain_chr) sustained = TRUE;
3413 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3415 msg_print("Invalid stat chosen!");
3425 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3427 msg_print("You can feel yourself wasting away!");
3431 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3434 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3435 !p_ptr->anti_magic && one_in_(3000))
3437 bool pet = one_in_(5);
3438 u32b mode = PM_ALLOW_GROUP;
3440 if (pet) mode |= PM_FORCE_PET;
3441 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3443 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3446 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3448 msg_print("You have attracted a dragon!");
3454 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3457 if (p_ptr->tim_esp > 0)
3460 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3462 msg_print("Your mind feels cloudy!");
3465 set_tim_esp(0, TRUE);
3470 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3472 msg_print("Your mind expands!");
3475 set_tim_esp(p_ptr->lev, FALSE);
3478 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3483 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3485 msg_print("Your stomach roils, and you lose your lunch!");
3489 set_food(PY_FOOD_WEAK);
3492 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3493 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3498 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3500 int danger_amount = 0;
3503 for (monster = 0; monster < m_max; monster++)
3505 monster_type *m_ptr = &m_list[monster];
3506 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3508 /* Paranoia -- Skip dead monsters */
3509 if (!m_ptr->r_idx) continue;
3511 if (r_ptr->level >= p_ptr->lev)
3513 danger_amount += r_ptr->level - p_ptr->lev + 1;
3517 if (danger_amount > 100)
3519 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3521 msg_print("You feel utterly terrified!");
3524 else if (danger_amount > 50)
3526 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3528 msg_print("You feel terrified!");
3531 else if (danger_amount > 20)
3533 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3535 msg_print("You feel very worried!");
3538 else if (danger_amount > 10)
3540 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3542 msg_print("You feel paranoid!");
3545 else if (danger_amount > 5)
3547 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3549 msg_print("You feel almost safe.");
3554 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3556 msg_print("You feel lonely.");
3560 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3565 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3567 msg_print("You feel invincible!");
3571 (void)set_invuln(randint1(8) + 8, FALSE);
3573 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3575 int wounds = p_ptr->mhp - p_ptr->chp;
3579 int healing = p_ptr->csp;
3581 if (healing > wounds)
3587 p_ptr->csp -= healing;
3590 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3593 int wounds = p_ptr->msp - p_ptr->csp;
3597 int healing = p_ptr->chp;
3599 if (healing > wounds)
3604 p_ptr->csp += healing;
3606 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3608 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3613 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3619 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3620 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3622 msg_print("You trip over your own feet!");
3623 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3628 if (buki_motteruka(INVEN_RARM))
3630 int slot = INVEN_RARM;
3631 o_ptr = &inventory[INVEN_RARM];
3632 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3634 o_ptr = &inventory[INVEN_LARM];
3637 if (!cursed_p(o_ptr))
3640 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3642 msg_print("You drop your weapon!");
3645 inven_drop(slot, 1);
3652 /*** Process Inventory ***/
3654 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3657 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3658 * can actually be useful!
3660 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3663 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3665 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3669 teleport_player(50);
3672 /* Make a chainsword noise */
3673 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3677 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3679 if (!get_rnd_line("chainswd.txt", 0, noise))
3682 disturb(FALSE, FALSE);
3685 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3688 (void)activate_ty_curse(FALSE, &count);
3690 /* Handle experience draining */
3691 if (p_ptr->prace != RACE_ANDROID &&
3692 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3694 p_ptr->exp -= (p_ptr->lev+1)/2;
3695 if (p_ptr->exp < 0) p_ptr->exp = 0;
3696 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3697 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3700 /* Add light curse (Later) */
3701 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3706 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3708 new_curse = get_curse(0, o_ptr);
3709 if (!(o_ptr->curse_flags & new_curse))
3711 char o_name[MAX_NLEN];
3713 object_desc(o_name, o_ptr, FALSE, 0);
3715 o_ptr->curse_flags |= new_curse;
3717 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3719 msg_format("There is a malignant black aura surrounding %s...", o_name);
3722 o_ptr->feeling = FEEL_NONE;
3724 p_ptr->update |= (PU_BONUS);
3727 /* Add heavy curse (Later) */
3728 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3733 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3735 new_curse = get_curse(1, o_ptr);
3736 if (!(o_ptr->curse_flags & new_curse))
3738 char o_name[MAX_NLEN];
3740 object_desc(o_name, o_ptr, FALSE, 0);
3742 o_ptr->curse_flags |= new_curse;
3744 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3746 msg_format("There is a malignant black aura surrounding %s...", o_name);
3749 o_ptr->feeling = FEEL_NONE;
3751 p_ptr->update |= (PU_BONUS);
3755 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3757 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3758 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3760 char o_name[MAX_NLEN];
3762 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3764 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3766 msg_format("%s have attracted an animal!", o_name);
3773 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3775 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3777 char o_name[MAX_NLEN];
3779 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3781 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3783 msg_format("%s have attracted a demon!", o_name);
3790 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3792 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3793 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3795 char o_name[MAX_NLEN];
3797 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3799 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3801 msg_format("%s have attracted an animal!", o_name);
3807 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3809 if (!p_ptr->resist_fear)
3813 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3815 msg_print("It's so dark... so scary!");
3818 set_afraid(p_ptr->afraid + 13 + randint1(26));
3821 /* Teleport player */
3822 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3826 /* Teleport player */
3827 teleport_player(40);
3829 /* Handle HP draining */
3830 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3832 char o_name[MAX_NLEN];
3834 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3836 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3838 msg_format("%s drains HP from you!", o_name);
3840 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3842 /* Handle mana draining */
3843 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3845 char o_name[MAX_NLEN];
3847 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3849 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3851 msg_format("%s drains mana from you!", o_name);
3853 p_ptr->csp -= MIN(p_ptr->lev, 50);
3857 p_ptr->csp_frac = 0;
3859 p_ptr->redraw |= PR_MANA;
3863 /* Rarely, take damage from the Jewel of Judgement */
3864 if (one_in_(999) && !p_ptr->anti_magic)
3866 object_type *o_ptr = &inventory[INVEN_LITE];
3868 if (o_ptr->name1 == ART_JUDGE)
3871 if (object_known_p(o_ptr))
3872 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3874 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3875 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3877 if (object_known_p(o_ptr))
3878 msg_print("The Jewel of Judgement drains life from you!");
3880 msg_print("Something drains life from you!");
3881 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3887 /* Process equipment */
3888 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3890 /* Get the object */
3891 o_ptr = &inventory[i];
3893 /* Skip non-objects */
3894 if (!o_ptr->k_idx) continue;
3896 /* Recharge activatable objects */
3897 if (o_ptr->timeout > 0)
3902 /* Notice changes */
3903 if (!o_ptr->timeout)
3905 recharged_notice(o_ptr);
3911 /* Notice changes */
3915 p_ptr->window |= (PW_EQUIP);
3920 * Recharge rods. Rods now use timeout to control charging status,
3921 * and each charging rod in a stack decreases the stack's timeout by
3922 * one per turn. -LM-
3924 for (j = 0, i = 0; i < INVEN_PACK; i++)
3926 o_ptr = &inventory[i];
3927 k_ptr = &k_info[o_ptr->k_idx];
3929 /* Skip non-objects */
3930 if (!o_ptr->k_idx) continue;
3932 /* Examine all charging rods or stacks of charging rods. */
3933 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3935 /* Determine how many rods are charging. */
3936 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3937 if (temp > o_ptr->number) temp = o_ptr->number;
3939 /* Decrease timeout by that number. */
3940 o_ptr->timeout -= temp;
3942 /* Boundary control. */
3943 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3945 /* Notice changes, provide message if object is inscribed. */
3946 if (!(o_ptr->timeout))
3948 recharged_notice(o_ptr);
3954 /* Notice changes */
3958 p_ptr->notice |= (PN_COMBINE);
3961 p_ptr->window |= (PW_INVEN);
3965 /* Feel the inventory */
3970 /*** Process Objects ***/
3972 /* Process objects */
3973 for (i = 1; i < o_max; i++)
3978 /* Skip dead objects */
3979 if (!o_ptr->k_idx) continue;
3981 /* Recharge rods on the ground. No messages. */
3982 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3985 o_ptr->timeout -= o_ptr->number;
3987 /* Boundary control. */
3988 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3993 /*** Involuntary Movement ***/
3995 /* Delayed Word-of-Recall */
3996 if (p_ptr->word_recall)
3999 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4000 * The player is yanked up/down as soon as
4001 * he loads the autosaved game.
4003 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4004 do_cmd_save_game(TRUE);
4006 /* Count down towards recall */
4007 p_ptr->word_recall--;
4009 p_ptr->redraw |= (PR_STATUS);
4011 /* Activate the recall */
4012 if (!p_ptr->word_recall)
4017 /* Determine the level */
4018 if (dun_level || p_ptr->inside_quest)
4021 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4023 msg_print("You feel yourself yanked upwards!");
4026 p_ptr->recall_dungeon = dungeon_type;
4028 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4032 prepare_change_floor_mode(CFM_CLEAR_ALL);
4034 leave_quest_check();
4036 p_ptr->inside_quest = 0;
4037 p_ptr->leaving = TRUE;
4042 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4044 msg_print("You feel yourself yanked downwards!");
4047 dungeon_type = p_ptr->recall_dungeon;
4050 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4053 dun_level = max_dlv[dungeon_type];
4054 if (dun_level < 1) dun_level = 1;
4056 /* Nightmare mode makes recall more dangerous */
4057 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4063 else if (dun_level < 99)
4065 dun_level = (dun_level + 99) / 2;
4067 else if (dun_level > 100)
4069 dun_level = d_info[dungeon_type].maxdepth - 1;
4073 if (p_ptr->wild_mode)
4075 p_ptr->wilderness_y = py;
4076 p_ptr->wilderness_x = px;
4080 /* Save player position */
4084 p_ptr->wild_mode = FALSE;
4086 prepare_change_floor_mode(CFM_CLEAR_ALL);
4089 p_ptr->leaving = TRUE;
4091 if (dungeon_type == DUNGEON_ANGBAND)
4093 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4095 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4096 (quest[i].status == QUEST_STATUS_TAKEN) &&
4097 (quest[i].level < dun_level))
4099 quest[i].status = QUEST_STATUS_FAILED;
4100 quest[i].complev = (byte)p_ptr->lev;
4101 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4108 sound(SOUND_TPLEVEL);
4113 /* Delayed Alter reality */
4114 if (p_ptr->alter_reality)
4116 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4117 do_cmd_save_game(TRUE);
4119 /* Count down towards alter */
4120 p_ptr->alter_reality--;
4122 p_ptr->redraw |= (PR_STATUS);
4124 /* Activate the alter reality */
4125 if (!p_ptr->alter_reality)
4130 /* Determine the level */
4131 if (!quest_number(dun_level) && dun_level)
4134 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4136 msg_print("The world changes!");
4139 prepare_change_floor_mode(CFM_CLEAR_ALL);
4142 p_ptr->leaving = TRUE;
4147 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4149 msg_print("The world seems to change for a moment!");
4154 sound(SOUND_TPLEVEL);
4162 * Verify use of "wizard" mode
4164 static bool enter_wizard_mode(void)
4166 /* Ask first time */
4167 if (!p_ptr->noscore)
4169 /* Wizard mode is not permitted */
4170 if (!allow_debug_opts)
4173 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4175 msg_print("Wizard mode is not permitted.");
4180 /* Mention effects */
4182 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4183 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4185 msg_print("Wizard mode is for debugging and experimenting.");
4186 msg_print("The game will not be scored if you enter wizard mode.");
4191 /* Verify request */
4193 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4195 if (!get_check("Are you sure you want to enter wizard mode? "))
4202 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4204 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4207 p_ptr->noscore |= 0x0002;
4218 * Verify use of "debug" commands
4220 static bool enter_debug_mode(void)
4222 /* Ask first time */
4223 if (!p_ptr->noscore)
4225 /* Debug mode is not permitted */
4226 if (!allow_debug_opts)
4229 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4231 msg_print("Use of debug command is not permitted.");
4236 /* Mention effects */
4238 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4239 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4241 msg_print("The debug commands are for debugging and experimenting.");
4242 msg_print("The game will not be scored if you use debug commands.");
4247 /* Verify request */
4249 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4251 if (!get_check("Are you sure you want to use debug commands? "))
4258 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4260 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4263 p_ptr->noscore |= 0x0008;
4271 * Hack -- Declare the Debug Routines
4273 extern void do_cmd_debug(void);
4275 #endif /* ALLOW_WIZARD */
4281 * Verify use of "borg" commands
4283 static bool enter_borg_mode(void)
4285 /* Ask first time */
4286 if (!(p_ptr->noscore & 0x0010))
4288 /* Mention effects */
4290 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4291 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4293 msg_print("The borg commands are for debugging and experimenting.");
4294 msg_print("The game will not be scored if you use borg commands.");
4299 /* Verify request */
4301 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4303 if (!get_check("Are you sure you want to use borg commands? "))
4310 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4312 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4315 p_ptr->noscore |= 0x0010;
4323 * Hack -- Declare the Ben Borg
4325 extern void do_cmd_borg(void);
4327 #endif /* ALLOW_BORG */
4332 * Parse and execute the current command
4333 * Give "Warning" on illegal commands.
4335 * XXX XXX XXX Make some "blocks"
4337 static void process_command(void)
4339 int old_now_message = now_message;
4341 #ifdef ALLOW_REPEAT /* TNB */
4343 /* Handle repeating the last command */
4346 #endif /* ALLOW_REPEAT -- TNB */
4350 /* Parse the command */
4351 switch (command_cmd)
4367 /*** Wizard Commands ***/
4369 /* Toggle Wizard Mode */
4374 p_ptr->wizard = FALSE;
4376 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4378 msg_print("Wizard mode off.");
4382 else if (enter_wizard_mode())
4384 p_ptr->wizard = TRUE;
4386 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4388 msg_print("Wizard mode on.");
4393 /* Update monsters */
4394 p_ptr->update |= (PU_MONSTERS);
4396 /* Redraw "title" */
4397 p_ptr->redraw |= (PR_TITLE);
4405 /* Special "debug" commands */
4408 /* Enter debug mode */
4409 if (enter_debug_mode())
4416 #endif /* ALLOW_WIZARD */
4421 /* Special "borg" commands */
4424 /* Enter borg mode */
4425 if (enter_borg_mode())
4427 if (!p_ptr->wild_mode) do_cmd_borg();
4433 #endif /* ALLOW_BORG */
4437 /*** Inventory Commands ***/
4439 /* Wear/wield equipment */
4442 if (!p_ptr->wild_mode) do_cmd_wield();
4446 /* Take off equipment */
4449 if (!p_ptr->wild_mode) do_cmd_takeoff();
4456 if (!p_ptr->wild_mode) do_cmd_drop();
4460 /* Destroy an item */
4467 /* Equipment list */
4474 /* Inventory list */
4482 /*** Various commands ***/
4484 /* Identify an object */
4491 /* Hack -- toggle windows */
4494 toggle_inven_equip();
4499 /*** Standard "Movement" Commands ***/
4504 if (!p_ptr->wild_mode) do_cmd_alter();
4511 if (!p_ptr->wild_mode) do_cmd_tunnel();
4515 /* Move (usually pick up things) */
4518 #ifdef ALLOW_EASY_DISARM /* TNB */
4522 #else /* ALLOW_EASY_DISARM -- TNB */
4524 do_cmd_walk(always_pickup);
4526 #endif /* ALLOW_EASY_DISARM -- TNB */
4531 /* Move (usually do not pick up) */
4534 #ifdef ALLOW_EASY_DISARM /* TNB */
4538 #else /* ALLOW_EASY_DISARM -- TNB */
4540 do_cmd_walk(!always_pickup);
4542 #endif /* ALLOW_EASY_DISARM -- TNB */
4548 /*** Running, Resting, Searching, Staying */
4550 /* Begin Running -- Arg is Max Distance */
4553 if (!p_ptr->wild_mode) do_cmd_run();
4557 /* Stay still (usually pick things up) */
4560 do_cmd_stay(always_pickup);
4564 /* Stay still (usually do not pick up) */
4567 do_cmd_stay(!always_pickup);
4571 /* Rest -- Arg is time */
4578 /* Search for traps/doors */
4585 /* Toggle search mode */
4588 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4589 else set_action(ACTION_SEARCH);
4594 /*** Stairs and Doors and Chests and Traps ***/
4597 case SPECIAL_KEY_STORE:
4599 if (!p_ptr->wild_mode) do_cmd_store();
4603 /* Enter building -KMW- */
4604 case SPECIAL_KEY_BUILDING:
4606 if (!p_ptr->wild_mode) do_cmd_bldg();
4610 /* Enter quest level -KMW- */
4611 case SPECIAL_KEY_QUEST:
4613 if (!p_ptr->wild_mode) do_cmd_quest();
4617 /* Go up staircase */
4620 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4627 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4629 msg_print("To flee the ambush you have to reach the edge of the map.");
4632 else if (p_ptr->food < PY_FOOD_WEAK)
4635 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4637 msg_print("You must eat something here.");
4642 if (change_wild_mode())
4655 /* Go down staircase */
4658 if(!p_ptr->wild_mode) do_cmd_go_down();
4661 p_ptr->wilderness_x = px;
4662 p_ptr->wilderness_y = py;
4668 /* Open a door or chest */
4671 if (!p_ptr->wild_mode) do_cmd_open();
4678 if (!p_ptr->wild_mode) do_cmd_close();
4682 /* Jam a door with spikes */
4685 if (!p_ptr->wild_mode) do_cmd_spike();
4692 if (!p_ptr->wild_mode) do_cmd_bash();
4696 /* Disarm a trap or chest */
4699 if (!p_ptr->wild_mode) do_cmd_disarm();
4704 /*** Magic and Prayers ***/
4706 /* Gain new spells/prayers */
4709 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4711 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4713 msg_print("You don't have to learn spells!");
4715 else if (p_ptr->pclass == CLASS_SAMURAI)
4716 do_cmd_gain_hissatsu();
4717 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4727 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4728 (p_ptr->pclass == CLASS_BERSERKER) ||
4729 (p_ptr->pclass == CLASS_NINJA) ||
4730 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4731 ) do_cmd_mind_browse();
4732 else if (p_ptr->pclass == CLASS_SMITH)
4734 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4735 do_cmd_magic_eater(TRUE);
4736 else do_cmd_browse();
4744 if (!p_ptr->wild_mode)
4746 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4749 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4751 msg_print("You cannot cast spells!");
4754 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4757 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4759 msg_print("The dungeon absorbs all attempted magic!");
4763 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4767 cptr which_power = "ËâË¡";
4769 cptr which_power = "magic";
4771 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4773 which_power = "ĶǽÎÏ";
4775 which_power = "psionic powers";
4777 else if (p_ptr->pclass == CLASS_IMITATOR)
4779 which_power = "¤â¤Î¤Þ¤Í";
4781 which_power = "imitation";
4783 else if (p_ptr->pclass == CLASS_SAMURAI)
4785 which_power = "ɬ»¦·õ";
4787 which_power = "hissatsu";
4789 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4791 which_power = "¶ÀËâË¡";
4793 which_power = "mirror magic";
4795 else if (p_ptr->pclass == CLASS_NINJA)
4797 which_power = "Ǧ½Ñ";
4799 which_power = "ninjutsu";
4801 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4803 which_power = "µ§¤ê";
4805 which_power = "prayer";
4809 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4811 msg_format("An anti-magic shell disrupts your %s!", which_power);
4815 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4818 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4820 msg_format("You cannot think directly!");
4826 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4827 (p_ptr->pclass == CLASS_BERSERKER) ||
4828 (p_ptr->pclass == CLASS_NINJA) ||
4829 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4832 else if (p_ptr->pclass == CLASS_IMITATOR)
4834 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4835 do_cmd_magic_eater(FALSE);
4836 else if (p_ptr->pclass == CLASS_SAMURAI)
4838 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4839 do_cmd_cast_learned();
4840 else if (p_ptr->pclass == CLASS_SMITH)
4849 /* Issue a pet command */
4852 if (!p_ptr->wild_mode) do_cmd_pet();
4856 /*** Use various objects ***/
4858 /* Inscribe an object */
4865 /* Uninscribe an object */
4868 do_cmd_uninscribe();
4872 /* Activate an artifact */
4875 if (!p_ptr->wild_mode)
4877 if (!p_ptr->inside_arena)
4882 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4884 msg_print("The arena absorbs all attempted magic!");
4900 /* Fuel your lantern/torch */
4910 if (!p_ptr->wild_mode) do_cmd_fire();
4917 if (!p_ptr->wild_mode)
4927 if (!p_ptr->wild_mode)
4929 if (!p_ptr->inside_arena)
4934 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4936 msg_print("The arena absorbs all attempted magic!");
4948 if (!p_ptr->wild_mode)
4950 if (p_ptr->inside_arena)
4953 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4955 msg_print("The arena absorbs all attempted magic!");
4960 else if (use_command && rogue_like_commands)
4972 /* Quaff a potion */
4975 if (!p_ptr->wild_mode)
4977 if (!p_ptr->inside_arena)
4978 do_cmd_quaff_potion();
4982 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4984 msg_print("The arena absorbs all attempted magic!");
4996 if (!p_ptr->wild_mode)
4998 if (!p_ptr->inside_arena)
4999 do_cmd_read_scroll();
5003 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5005 msg_print("The arena absorbs all attempted magic!");
5017 if (!p_ptr->wild_mode)
5019 if (p_ptr->inside_arena)
5022 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5024 msg_print("The arena absorbs all attempted magic!");
5029 else if (use_command && !rogue_like_commands)
5039 /* Use racial power */
5042 if (!p_ptr->wild_mode) do_cmd_racial_power();
5047 /*** Looking at Things (nearby or on map) ***/
5049 /* Full dungeon map */
5056 /* Locate player on map */
5070 /* Target monster or location */
5073 if (!p_ptr->wild_mode) do_cmd_target();
5079 /*** Help and Such ***/
5088 /* Identify symbol */
5091 do_cmd_query_symbol();
5095 /* Character description */
5098 do_cmd_change_name();
5103 /*** System Commands ***/
5105 /* Hack -- User interface */
5112 /* Single line from a pref file */
5127 do_cmd_edit_autopick();
5131 /* Interact with macros */
5138 /* Interact with visuals */
5146 /* Interact with colors */
5154 /* Interact with options */
5162 /*** Misc Commands ***/
5178 /* Repeat level feeling */
5181 if (!p_ptr->wild_mode) do_cmd_feeling();
5185 /* Show previous message */
5188 do_cmd_message_one();
5192 /* Show previous messages */
5195 do_cmd_messages(old_now_message);
5199 /* Show quest status -KMW- */
5202 do_cmd_checkquest();
5206 /* Redraw the screen */
5209 now_message = old_now_message;
5214 #ifndef VERIFY_SAVEFILE
5216 /* Hack -- Save and don't quit */
5219 do_cmd_save_game(FALSE);
5223 #endif /* VERIFY_SAVEFILE */
5233 case SPECIAL_KEY_QUIT:
5235 do_cmd_save_and_exit();
5239 /* Quit (commit suicide) */
5252 /* Check artifacts, uniques, objects */
5259 /* Load "screen dump" */
5262 do_cmd_load_screen();
5266 /* Save "screen dump" */
5269 do_cmd_save_screen();
5273 /* Make random artifact list */
5276 spoil_random_artifact("randifact.txt");
5280 /* Hack -- Unknown command */
5283 if (flush_failure) flush();
5287 sound(SOUND_ILLEGAL);
5289 if (!get_rnd_line("error_j.txt", 0, error_m))
5291 if (!get_rnd_line("error.txt", 0, error_m))
5298 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5300 prt("Type '?' for help.", 0, 0);
5306 if (!energy_use && !now_message)
5307 now_message = old_now_message;
5313 static bool monster_tsuri(int r_idx)
5315 monster_race *r_ptr = &r_info[r_idx];
5317 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5325 * Process the player
5327 * Notice the annoying code to handle "pack overflow", which
5328 * must come first just in case somebody manages to corrupt
5329 * the savefiles by clever use of menu commands or something.
5331 static void process_player(void)
5335 /*** Apply energy ***/
5340 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5342 msg_print("You feel different!");
5345 (void)gain_random_mutation(0);
5346 hack_mutation = FALSE;
5349 if (p_ptr->inside_battle)
5351 for(i = 1; i < m_max; i++)
5353 monster_type *m_ptr = &m_list[i];
5355 if (!m_ptr->r_idx) continue;
5357 /* Hack -- Detect monster */
5358 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5360 /* Update the monster */
5361 update_mon(i, FALSE);
5366 /* Give the player some energy */
5367 else if (!(load && p_ptr->energy_need <= 0))
5369 p_ptr->energy_need -= (p_ptr->pspeed > 199 ? 49 : (p_ptr->pspeed < 0 ? 1 : extract_energy[p_ptr->pspeed]));
5373 if (p_ptr->energy_need > 0) return;
5374 if (!command_rep) prt_time();
5376 /*** Check for interupts ***/
5378 /* Complete resting */
5385 if ((p_ptr->chp == p_ptr->mhp) &&
5386 (p_ptr->csp >= p_ptr->msp))
5388 set_action(ACTION_NONE);
5392 /* Complete resting */
5393 else if (resting == -2)
5396 if ((p_ptr->chp == p_ptr->mhp) &&
5397 (p_ptr->csp >= p_ptr->msp) &&
5398 !p_ptr->blind && !p_ptr->confused &&
5399 !p_ptr->poisoned && !p_ptr->afraid &&
5400 !p_ptr->stun && !p_ptr->cut &&
5401 !p_ptr->slow && !p_ptr->paralyzed &&
5402 !p_ptr->image && !p_ptr->word_recall &&
5403 !p_ptr->alter_reality)
5405 set_action(ACTION_NONE);
5410 if (p_ptr->action == ACTION_FISH)
5413 Term_xtra(TERM_XTRA_DELAY, 10);
5417 bool success = FALSE;
5418 get_mon_num_prep(monster_tsuri,NULL);
5419 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5421 if (r_idx && one_in_(2))
5424 y = py+ddy[tsuri_dir];
5425 x = px+ddx[tsuri_dir];
5426 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5429 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5431 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5433 msg_format("You have a good catch!", m_name);
5441 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5443 msg_print("Damn! The fish stole your bait!");
5450 /* Handle "abort" */
5453 /* Check for "player abort" (semi-efficiently for resting) */
5454 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5459 /* Check for a key */
5468 /* Hack -- Show a Message */
5470 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5472 msg_print("Canceled.");
5479 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5481 monster_type *m_ptr = &m_list[p_ptr->riding];
5490 /* Acquire the monster name */
5491 monster_desc(m_name, m_ptr, 0);
5493 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5495 msg_format("You have waked %s up.", m_name);
5497 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5498 p_ptr->redraw |= (PR_UHEALTH);
5505 /* Make a "saving throw" against stun */
5506 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5512 /* Hack -- Recover from stun */
5513 if (m_ptr->stunned > d)
5515 /* Recover somewhat */
5516 m_ptr->stunned -= d;
5527 /* Acquire the monster name */
5528 monster_desc(m_name, m_ptr, 0);
5530 /* Dump a message */
5532 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5534 msg_format("%^s is no longer stunned.", m_name);
5536 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5537 p_ptr->redraw |= (PR_UHEALTH);
5541 if (m_ptr->confused)
5545 /* Make a "saving throw" against stun */
5546 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5549 d = m_ptr->confused;
5552 /* Hack -- Recover from stun */
5553 if (m_ptr->confused > d)
5555 /* Recover somewhat */
5556 m_ptr->confused -= d;
5565 m_ptr->confused = 0;
5567 /* Acquire the monster name */
5568 monster_desc(m_name, m_ptr, 0);
5570 /* Dump a message */
5572 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5574 msg_format("%^s is no longer confused.", m_name);
5576 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5577 p_ptr->redraw |= (PR_UHEALTH);
5585 /* Make a "saving throw" against stun */
5586 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5592 /* Hack -- Recover from stun */
5593 if (m_ptr->monfear > d)
5595 /* Recover somewhat */
5596 m_ptr->monfear -= d;
5607 /* Acquire the monster name */
5608 monster_desc(m_name, m_ptr, 0);
5610 /* Dump a message */
5612 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5614 msg_format("%^s is no longer fear.", m_name);
5616 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5617 p_ptr->redraw |= (PR_UHEALTH);
5621 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5625 /* Handle the player song */
5626 if (!load) check_music();
5631 if (p_ptr->lightspeed)
5633 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5635 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5637 if (p_ptr->magic_num1[0] < 40)
5639 p_ptr->magic_num1[0] = 0;
5641 else p_ptr->magic_num1[0] -= 40;
5642 p_ptr->update |= (PU_BONUS);
5644 if (p_ptr->action == ACTION_LEARN)
5646 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5647 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5650 p_ptr->csp_frac = 0;
5651 set_action(ACTION_NONE);
5655 p_ptr->csp -= (s16b)(hoge >> 16);
5657 if (p_ptr->csp_frac < hoge)
5659 p_ptr->csp_frac += 0x10000L - hoge;
5663 p_ptr->csp_frac -= hoge;
5665 p_ptr->redraw |= PR_MANA;
5668 if (p_ptr->special_defense & KATA_MASK)
5670 if (p_ptr->special_defense & KATA_MUSOU)
5674 set_action(ACTION_NONE);
5679 p_ptr->redraw |= (PR_MANA);
5684 /*** Handle actual user input ***/
5686 /* Repeat until out of energy */
5687 while (p_ptr->energy_need <= 0)
5689 p_ptr->window |= PW_PLAYER;
5690 p_ptr->sutemi = FALSE;
5691 p_ptr->counter = FALSE;
5692 now_damaged = FALSE;
5694 /* Handle "p_ptr->notice" */
5697 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5700 /* Place the cursor on the player */
5701 move_cursor_relative(py, px);
5703 /* Refresh (optional) */
5704 if (fresh_before) Term_fresh();
5707 /* Hack -- Pack Overflow */
5708 if (inventory[INVEN_PACK].k_idx)
5710 int item = INVEN_PACK;
5712 char o_name[MAX_NLEN];
5716 /* Access the slot to be dropped */
5717 o_ptr = &inventory[item];
5724 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5726 msg_print("Your pack overflows!");
5731 object_desc(o_name, o_ptr, TRUE, 3);
5735 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5737 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5741 /* Drop it (carefully) near the player */
5742 (void)drop_near(o_ptr, 0, py, px);
5744 /* Modify, Describe, Optimize */
5745 inven_item_increase(item, -255);
5746 inven_item_describe(item);
5747 inven_item_optimize(item);
5749 /* Handle "p_ptr->notice" */
5752 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5757 /* Hack -- cancel "lurking browse mode" */
5758 if (!command_new) command_see = FALSE;
5761 /* Assume free turn */
5765 if (p_ptr->inside_battle)
5767 /* Place the cursor on the player */
5768 move_cursor_relative(py, px);
5770 command_cmd = SPECIAL_KEY_BUILDING;
5772 /* Process the command */
5776 /* Paralyzed or Knocked Out */
5777 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5784 else if (p_ptr->action == ACTION_REST)
5789 /* Reduce rest count */
5792 if (!resting) set_action(ACTION_NONE);
5794 /* Redraw the state */
5795 p_ptr->redraw |= (PR_STATE);
5803 else if (p_ptr->action == ACTION_FISH)
5816 /* Repeated command */
5817 else if (command_rep)
5819 /* Count this execution */
5822 /* Redraw the state */
5823 p_ptr->redraw |= (PR_STATE);
5828 /* Hack -- Assume messages were seen */
5831 /* Clear the top line */
5834 /* Process the command */
5838 /* Normal command */
5841 /* Place the cursor on the player */
5842 move_cursor_relative(py, px);
5845 /* Get a command (normal) */
5846 request_command(FALSE);
5849 /* Process the command */
5859 /* Use some energy */
5860 if (world_player || energy_use > 400)
5862 /* The Randomness is irrelevant */
5863 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5867 /* There is some randomness of needed energy */
5868 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5871 /* Hack -- constant hallucination */
5872 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5875 /* Shimmer monsters if needed */
5876 if (shimmer_monsters)
5878 /* Clear the flag */
5879 shimmer_monsters = FALSE;
5881 /* Shimmer multi-hued monsters */
5882 for (i = 1; i < m_max; i++)
5884 monster_type *m_ptr;
5885 monster_race *r_ptr;
5887 /* Access monster */
5890 /* Skip dead monsters */
5891 if (!m_ptr->r_idx) continue;
5893 /* Access the monster race */
5894 r_ptr = &r_info[m_ptr->r_idx];
5896 /* Skip non-multi-hued monsters */
5897 if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue;
5899 /* Reset the flag */
5900 shimmer_monsters = TRUE;
5902 /* Redraw regardless */
5903 lite_spot(m_ptr->fy, m_ptr->fx);
5908 /* Handle monster detection */
5909 if (repair_monsters)
5911 /* Reset the flag */
5912 repair_monsters = FALSE;
5914 /* Rotate detection flags */
5915 for (i = 1; i < m_max; i++)
5917 monster_type *m_ptr;
5919 /* Access monster */
5922 /* Skip dead monsters */
5923 if (!m_ptr->r_idx) continue;
5925 /* Nice monsters get mean */
5926 if (m_ptr->mflag & MFLAG_NICE)
5928 /* Nice monsters get mean */
5929 m_ptr->mflag &= ~(MFLAG_NICE);
5932 /* Handle memorized monsters */
5933 if (m_ptr->mflag2 & MFLAG2_MARK)
5935 /* Maintain detection */
5936 if (m_ptr->mflag2 & MFLAG2_SHOW)
5939 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
5941 /* Still need repairs */
5942 repair_monsters = TRUE;
5945 /* Remove detection */
5949 m_ptr->mflag2 &= ~(MFLAG2_MARK);
5951 /* Assume invisible */
5954 /* Update the monster */
5955 update_mon(i, FALSE);
5957 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
5958 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
5960 /* Redraw regardless */
5961 lite_spot(m_ptr->fy, m_ptr->fx);
5966 if (p_ptr->pclass == CLASS_IMITATOR)
5968 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5971 for (i = 0; i < p_ptr->mane_num; i++)
5973 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
5974 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
5978 p_ptr->redraw |= (PR_MANE);
5980 if (p_ptr->action == ACTION_LEARN)
5983 p_ptr->redraw |= (PR_STATE);
5986 if (world_player && (p_ptr->energy_need > - 1000))
5989 p_ptr->redraw |= (PR_MAP);
5991 /* Update monsters */
5992 p_ptr->update |= (PU_MONSTERS);
5995 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5998 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6000 msg_print("You feel time flowing around you once more.");
6003 world_player = FALSE;
6004 p_ptr->energy_need = ENERGY_NEED();
6006 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6011 /* Hack -- notice death */
6012 if (!p_ptr->playing || p_ptr->is_dead)
6014 world_player = FALSE;
6018 /* Handle "leaving" */
6019 if (p_ptr->leaving) break;
6022 /* Update scent trail */
6028 * Interact with the current dungeon level.
6030 * This function will not exit until the level is completed,
6031 * the user dies, or the game is terminated.
6033 static void dungeon(bool load_game)
6037 /* Set the base level */
6038 base_level = dun_level;
6040 /* Reset various flags */
6044 p_ptr->leaving = FALSE;
6046 /* Reset the "command" vars */
6054 /* Cancel the target */
6058 ambush_flag = FALSE;
6060 /* Cancel the health bar */
6063 /* Check visual effects */
6064 shimmer_monsters = TRUE;
6065 shimmer_objects = TRUE;
6066 repair_monsters = TRUE;
6067 repair_objects = TRUE;
6073 /* Get index of current quest (if any) */
6074 quest_num = quest_number(dun_level);
6076 /* Inside a quest? */
6079 /* Mark the quest monster */
6080 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6083 /* Track maximum player level */
6084 if (p_ptr->max_plv < p_ptr->lev)
6086 p_ptr->max_plv = p_ptr->lev;
6090 /* Track maximum dungeon level (if not in quest -KMW-) */
6091 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6093 max_dlv[dungeon_type] = dun_level;
6094 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6097 /* Validate the panel */
6098 panel_bounds_center();
6100 /* Verify the panel */
6103 /* Flush messages */
6107 /* Enter "xtra" mode */
6108 character_xtra = TRUE;
6111 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6113 /* Redraw dungeon */
6114 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6117 p_ptr->redraw |= (PR_MAP);
6120 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6122 /* Update lite/view */
6123 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6125 /* Update monsters */
6126 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6128 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6131 /* Leave "xtra" mode */
6132 character_xtra = FALSE;
6135 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6137 /* Combine / Reorder the pack */
6138 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6140 /* Handle "p_ptr->notice" */
6143 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6149 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();
6151 if (p_ptr->inside_battle)
6155 p_ptr->energy_need = 0;
6162 msg_print("»î¹ç³«»Ï¡ª");
6164 msg_format("Ready..Fight!");
6170 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6171 p_ptr->magic_num1[0] = MUSIC_DETECT;
6173 /* Hack -- notice death or departure */
6174 if (!p_ptr->playing || p_ptr->is_dead) return;
6176 /* Print quest message if appropriate */
6177 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6179 quest_discovery(random_quest_number(dun_level));
6180 p_ptr->inside_quest = random_quest_number(dun_level);
6182 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6184 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6186 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6187 d_name+d_info[dungeon_type].name,
6188 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6190 msg_format("%^s lives in this level as the keeper of %s.",
6191 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6192 d_name+d_info[dungeon_type].name);
6196 /*** Process this dungeon level ***/
6198 /* Reset the monster generation level */
6199 monster_level = base_level;
6201 /* Reset the object generation level */
6202 object_level = base_level;
6206 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6207 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6208 p_ptr->energy_need = 0;
6210 /* Not leaving dungeon */
6211 p_ptr->leaving_dungeon = FALSE;
6216 /* Hack -- Compact the monster list occasionally */
6217 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6219 /* Hack -- Compress the monster list occasionally */
6220 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6223 /* Hack -- Compact the object list occasionally */
6224 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6226 /* Hack -- Compress the object list occasionally */
6227 if (o_cnt + 32 < o_max) compact_objects(0);
6230 /* Process the player */
6233 /* Handle "p_ptr->notice" */
6236 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6239 /* Hack -- Hilite the player */
6240 move_cursor_relative(py, px);
6242 /* Optional fresh */
6243 if (fresh_after) Term_fresh();
6245 /* Hack -- Notice death or departure */
6246 if (!p_ptr->playing || p_ptr->is_dead) break;
6248 /* Process all of the monsters */
6251 /* Handle "p_ptr->notice" */
6254 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6257 /* Hack -- Hilite the player */
6258 move_cursor_relative(py, px);
6260 /* Optional fresh */
6261 if (fresh_after) Term_fresh();
6263 /* Hack -- Notice death or departure */
6264 if (!p_ptr->playing || p_ptr->is_dead) break;
6267 /* Process the world */
6270 /* Handle "p_ptr->notice" */
6273 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6276 /* Hack -- Hilite the player */
6277 move_cursor_relative(py, px);
6279 /* Optional fresh */
6280 if (fresh_after) Term_fresh();
6282 /* Hack -- Notice death or departure */
6283 if (!p_ptr->playing || p_ptr->is_dead) break;
6285 /* Handle "leaving" */
6286 if (p_ptr->leaving) break;
6288 /* Count game turns */
6290 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6291 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6292 if (wild_regen) wild_regen--;
6295 /* Inside a quest and non-unique questor? */
6296 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6298 /* Un-mark the quest monster */
6299 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6302 /* Not save-and-quit and not dead? */
6303 if (p_ptr->playing && !p_ptr->is_dead)
6306 * Maintain Unique monsters and artifact, save current
6307 * floor, then prepare next floor
6311 /* Forget the flag */
6312 reinit_wilderness = FALSE;
6315 /* Write about current level on the play record once per level */
6321 * Load some "user pref files"
6323 * Modified by Arcum Dagsson to support
6324 * separate macro files for different realms.
6326 static void load_all_pref_files(void)
6331 /* Access the "user" pref file */
6332 sprintf(buf, "user.prf");
6334 /* Process that file */
6335 process_pref_file(buf);
6337 /* Access the "user" system pref file */
6338 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6340 /* Process that file */
6341 process_pref_file(buf);
6343 /* Access the "race" pref file */
6344 sprintf(buf, "%s.prf", rp_ptr->title);
6346 /* Process that file */
6347 process_pref_file(buf);
6349 /* Access the "class" pref file */
6350 sprintf(buf, "%s.prf", cp_ptr->title);
6352 /* Process that file */
6353 process_pref_file(buf);
6355 /* Access the "character" pref file */
6356 sprintf(buf, "%s.prf", player_base);
6358 /* Process that file */
6359 process_pref_file(buf);
6361 /* Free old entries */
6365 sprintf(buf, "picktype-%s.prf", player_base);
6367 sprintf(buf, "pickpref-%s.prf", player_base);
6370 err = process_pickpref_file(buf);
6372 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6376 process_pickpref_file("picktype.prf");
6378 process_pickpref_file("pickpref.prf");
6382 /* Access the "realm 1" pref file */
6383 if (p_ptr->realm1 != REALM_NONE)
6385 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6387 /* Process that file */
6388 process_pref_file(buf);
6391 /* Access the "realm 2" pref file */
6392 if (p_ptr->realm2 != REALM_NONE)
6394 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6396 /* Process that file */
6397 process_pref_file(buf);
6403 * Actually play a game
6405 * If the "new_game" parameter is true, then, after loading the
6406 * savefile, we will commit suicide, if necessary, to allow the
6407 * player to start a new game.
6409 void play_game(bool new_game)
6412 bool load_game = TRUE;
6422 hack_mutation = FALSE;
6424 /* Hack -- Character is "icky" */
6425 character_icky = TRUE;
6427 /* Make sure main term is active */
6428 Term_activate(angband_term[0]);
6430 /* Initialise the resize hooks */
6431 angband_term[0]->resize_hook = resize_map;
6433 for (i = 1; i < 8; i++)
6435 /* Does the term exist? */
6436 if (angband_term[i])
6438 /* Add the redraw on resize hook */
6439 angband_term[i]->resize_hook = redraw_window;
6443 /* Hack -- turn off the cursor */
6444 (void)Term_set_cursor(0);
6447 /* Attempt to load */
6452 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6454 quit("broken savefile");
6459 /* Extract the options */
6460 for (i = 0; option_info[i].o_desc; i++)
6462 int os = option_info[i].o_set;
6463 int ob = option_info[i].o_bit;
6465 /* Set the "default" options */
6466 if (option_info[i].o_var)
6469 if (option_flag[os] & (1L << ob))
6472 (*option_info[i].o_var) = TRUE;
6479 (*option_info[i].o_var) = FALSE;
6484 /* Report waited score */
6485 if (p_ptr->wait_report_score)
6491 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6493 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6498 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6503 p_ptr->is_dead = TRUE;
6505 start_time = time(NULL);
6507 /* No suspending now */
6508 signals_ignore_tstp();
6510 /* Hack -- Character is now "icky" */
6511 character_icky = TRUE;
6513 /* Build the filename */
6514 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6516 /* Open the high score file, for reading/writing */
6517 highscore_fd = fd_open(buf, O_RDWR);
6519 /* Handle score, show Top scores */
6520 success = send_world_score(TRUE);
6523 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6525 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6529 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6531 prt("standing by for future registration...", 0, 0);
6537 p_ptr->wait_report_score = FALSE;
6540 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6542 if (!save_player()) msg_print("death save failed!");
6545 /* Shut the high score file */
6546 (void)fd_close(highscore_fd);
6548 /* Forget the high score fd */
6551 /* Allow suspending now */
6552 signals_handle_tstp();
6557 /* Nothing loaded */
6558 if (!character_loaded)
6560 /* Make new player */
6563 /* The dungeon is not ready */
6564 character_dungeon = FALSE;
6566 /* Prepare to init the RNG */
6569 /* Initialize the saved floors data */
6570 init_saved_floors();
6573 /* Old game is loaded. But new game is requested. */
6576 /* Delete expanded temporal files */
6577 clear_saved_floor_files();
6580 /* Process old character */
6583 /* Process the player name */
6584 process_player_name(FALSE);
6593 seed = (time(NULL));
6597 /* Mutate the seed on Unix machines */
6598 seed = ((seed >> 3) * (getpid() << 1));
6602 /* Use the complex RNG */
6605 /* Seed the "complex" RNG */
6606 Rand_state_init(seed);
6609 /* Roll new character */
6612 monster_race *r_ptr;
6614 /* The dungeon is not ready */
6615 character_dungeon = FALSE;
6619 p_ptr->inside_quest = 0;
6620 p_ptr->inside_arena = FALSE;
6621 p_ptr->inside_battle = FALSE;
6625 /* Hack -- seed for flavors */
6626 seed_flavor = randint0(0x10000000);
6628 /* Hack -- seed for town layout */
6629 seed_town = randint0(0x10000000);
6631 /* Roll up a new character */
6638 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6640 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6644 get_mon_num_prep(NULL, NULL);
6645 for (i = 0; i < MAX_KUBI; i++)
6651 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6652 r_ptr = &r_info[kubi_r_idx[i]];
6654 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6656 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6657 if (r_ptr->rarity > 100) continue;
6659 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6661 for (j = 0; j < i; j++)
6662 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6667 for (i = 0; i < MAX_KUBI -1; i++)
6670 for (j = i; j < MAX_KUBI; j++)
6672 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6674 tmp = kubi_r_idx[i];
6675 kubi_r_idx[i] = kubi_r_idx[j];
6676 kubi_r_idx[j] = tmp;
6681 p_ptr->inside_battle = TRUE;
6684 today_mon = get_mon_num(3);
6685 r_ptr = &r_info[today_mon];
6687 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6688 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6689 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6690 if (r_ptr->rarity > 10) continue;
6691 if (r_ptr->level == 0) continue;
6694 p_ptr->inside_battle = FALSE;
6698 write_level = FALSE;
6701 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6703 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6707 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6708 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6710 if (p_ptr->riding == -1)
6713 for(i = m_max; i > 0; i--)
6715 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6724 p_ptr->teleport_town = FALSE;
6725 p_ptr->sutemi = FALSE;
6726 world_monster = FALSE;
6727 now_damaged = FALSE;
6729 start_time = time(NULL) - 1;
6730 record_o_name[0] = '\0';
6732 /* Reset map panel */
6733 panel_row_min = cur_hgt;
6734 panel_col_min = cur_wid;
6736 /* Sexy gal gets bonus to maximum weapon skill of whip */
6737 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6738 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6740 /* Fill the arrays of floors and walls in the good proportions */
6741 set_floor_and_wall(dungeon_type);
6743 /* Flavor the objects */
6751 /* Flash a message */
6753 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6755 prt("Please wait...", 0, 0);
6759 /* Flush the message */
6763 /* Hack -- Enter wizard mode */
6766 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6767 else if (p_ptr->is_dead) quit("Already dead.");
6770 /* Initialize the town-buildings if necessary */
6771 if (!dun_level && !p_ptr->inside_quest)
6773 /* Init the wilderness */
6775 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6778 init_flags = INIT_ONLY_BUILDINGS;
6780 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6785 /* Generate a dungeon level if needed */
6786 if (!character_dungeon) change_floor();
6789 /* Character is now "complete" */
6790 character_generated = TRUE;
6793 /* Hack -- Character is no longer "icky" */
6794 character_icky = FALSE;
6798 p_ptr->playing = TRUE;
6800 /* Reset the visual mappings */
6803 /* Load the "pref" files */
6804 load_all_pref_files();
6806 /* React to changes */
6807 Term_xtra(TERM_XTRA_REACT, 0);
6810 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6813 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6819 /* Set or clear "rogue_like_commands" if requested */
6820 if (arg_force_original) rogue_like_commands = FALSE;
6821 if (arg_force_roguelike) rogue_like_commands = TRUE;
6823 /* Hack -- Enforce "delayed death" */
6824 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6826 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6828 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6830 monster_type *m_ptr;
6831 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6832 monster_race *r_ptr = &r_info[pet_r_idx];
6833 place_monster_aux(0, py, px - 1, pet_r_idx,
6834 (PM_FORCE_PET | PM_NO_KAGE));
6835 m_ptr = &m_list[hack_m_idx_ii];
6836 m_ptr->mspeed = r_ptr->speed;
6837 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6838 m_ptr->max_maxhp = m_ptr->maxhp;
6839 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6840 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6846 /* Process the level */
6849 /* Handle "p_ptr->notice" */
6852 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6855 /* Cancel the target */
6858 /* Cancel the health bar */
6862 /* Forget the lite */
6865 /* Forget the view */
6868 /* Forget the view */
6871 /* Handle "quit and save" */
6872 if (!p_ptr->playing && !p_ptr->is_dead) break;
6874 /* Erase the old cave */
6876 if (!p_ptr->is_dead) wipe_m_list();
6884 /* Accidental Death */
6885 if (p_ptr->playing && p_ptr->is_dead)
6887 if (p_ptr->inside_arena)
6889 p_ptr->inside_arena = FALSE;
6890 if(p_ptr->arena_number > MAX_ARENA_MONS)
6891 p_ptr->arena_number++;
6893 p_ptr->arena_number = 99;
6894 p_ptr->is_dead = FALSE;
6896 p_ptr->chp_frac = 0;
6897 p_ptr->exit_bldg = TRUE;
6902 /* Mega-Hack -- Allow player to cheat death */
6904 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
6906 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
6910 /* Mark social class, reset age, if needed */
6911 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6917 p_ptr->noscore |= 0x0001;
6921 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
6923 msg_print("You invoke wizard mode and cheat death.");
6929 /* Restore hit points */
6930 p_ptr->chp = p_ptr->mhp;
6931 p_ptr->chp_frac = 0;
6933 if (p_ptr->pclass == CLASS_MAGIC_EATER)
6935 for (i = 0; i < EATER_EXT*2; i++)
6937 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
6939 for (; i < EATER_EXT*3; i++)
6941 p_ptr->magic_num1[i] = 0;
6944 /* Restore spell points */
6945 p_ptr->csp = p_ptr->msp;
6946 p_ptr->csp_frac = 0;
6948 /* Hack -- Healing */
6950 (void)set_confused(0);
6951 (void)set_poisoned(0);
6952 (void)set_afraid(0);
6953 (void)set_paralyzed(0);
6958 /* Hack -- Prevent starvation */
6959 (void)set_food(PY_FOOD_MAX - 1);
6961 /* Hack -- cancel recall */
6962 if (p_ptr->word_recall)
6966 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
6968 msg_print("A tension leaves the air around you...");
6973 /* Hack -- Prevent recall */
6974 p_ptr->word_recall = 0;
6975 p_ptr->redraw |= (PR_STATUS);
6978 /* Hack -- cancel alter */
6979 if (p_ptr->alter_reality)
6981 /* Hack -- Prevent alter */
6982 p_ptr->alter_reality = 0;
6983 p_ptr->redraw |= (PR_STATUS);
6986 /* Note cause of death XXX XXX XXX */
6988 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
6990 (void)strcpy(p_ptr->died_from, "Cheating death");
6995 p_ptr->is_dead = FALSE;
6998 p_ptr->inside_arena = FALSE;
6999 p_ptr->inside_battle = FALSE;
7001 p_ptr->inside_quest = 0;
7002 p_ptr->recall_dungeon = dungeon_type;
7004 if (lite_town || vanilla_town)
7006 p_ptr->wilderness_y = 1;
7007 p_ptr->wilderness_x = 1;
7021 p_ptr->wilderness_y = 48;
7022 p_ptr->wilderness_x = 5;
7028 p_ptr->wild_mode = FALSE;
7029 p_ptr->leaving = TRUE;
7032 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7034 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7040 /* Handle "death" */
7041 if (p_ptr->is_dead) break;
7043 /* Make a new level */
7054 s32b turn_real(s32b hoge)
7056 switch (p_ptr->start_race)
7062 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);