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 u32b noise; /* Hack -- local "player stealth" value */
1089 /* Handle "leaving" */
1090 if (p_ptr->leaving) return;
1092 /* Hack -- calculate the "player noise" */
1093 noise = (1L << (30 - p_ptr->skill_stl));
1095 /* Process the monsters (backwards) */
1096 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1098 /* Access the monster */
1099 m_ptr = &m_list[m_idx];
1100 r_ptr = &r_info[m_ptr->r_idx];
1102 /* Ignore "dead" monsters */
1103 if (!m_ptr->r_idx) continue;
1105 /* Handle Invulnerability */
1106 if (m_ptr->invulner)
1108 /* Reduce by one, note if expires */
1111 if (!m_ptr->invulner)
1117 /* Acquire the monster name */
1118 monster_desc(m_name, m_ptr, 0);
1120 /* Dump a message */
1122 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1124 msg_format("%^s is no longer invulnerable.", m_name);
1127 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1128 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1130 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1137 /* Reduce by one, note if expires */
1140 if (!m_ptr->fast && m_ptr->ml)
1144 /* Acquire the monster name */
1145 monster_desc(m_name, m_ptr, 0);
1147 /* Dump a message */
1149 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1151 msg_format("%^s is no longer fast.", m_name);
1154 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1155 if (p_ptr->riding == m_idx)
1157 p_ptr->redraw |= (PR_UHEALTH);
1158 p_ptr->update |= (PU_BONUS);
1166 /* Reduce by one, note if expires */
1169 if (!m_ptr->slow && m_ptr->ml)
1173 /* Acquire the monster name */
1174 monster_desc(m_name, m_ptr, 0);
1176 /* Dump a message */
1178 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1180 msg_format("%^s is no longer slow.", m_name);
1183 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1184 if (p_ptr->riding == m_idx)
1186 p_ptr->redraw |= (PR_UHEALTH);
1187 p_ptr->update |= (PU_BONUS);
1192 /* Handle "sleep" */
1195 /* Assume does not wake up */
1198 /* Hack -- Require proximity */
1199 if (m_ptr->cdis < AAF_LIMIT)
1201 /* Handle "sensing radius" */
1202 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1204 /* We may wake up */
1208 /* Handle "sight" and "aggravation" */
1209 else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
1211 /* We may wake up */
1218 u32b notice = randint0(1024);
1220 /* Nightmare monsters are more alert */
1221 if (ironman_nightmare) notice /= 2;
1223 /* Hack -- See if monster "notices" player */
1224 if ((notice * notice * notice) <= noise)
1226 /* Hack -- amount of "waking" */
1227 /* Wake up faster near the player */
1228 int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
1230 /* Hack -- amount of "waking" is affected by speed of player */
1231 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1235 if (m_ptr->csleep > d)
1237 /* Monster wakes up "a little bit" */
1240 /* Notice the "not waking up" */
1243 /* Hack -- Count the ignores */
1244 if (r_ptr->r_ignore < MAX_UCHAR)
1254 /* Reset sleep counter */
1257 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1259 /* Notice the "waking up" */
1264 /* Acquire the monster name */
1265 monster_desc(m_name, m_ptr, 0);
1267 /* Dump a message */
1269 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1271 msg_format("%^s wakes up.", m_name);
1274 /* Redraw the health bar */
1275 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1276 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1278 /* Hack -- Count the wakings */
1279 if (r_ptr->r_wake < MAX_UCHAR)
1294 /* Make a "saving throw" against stun */
1295 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1301 /* Hack -- Recover from stun */
1302 if (m_ptr->stunned > d)
1304 /* Recover somewhat */
1305 m_ptr->stunned -= d;
1314 /* Message if visible */
1319 /* Acquire the monster name */
1320 monster_desc(m_name, m_ptr, 0);
1322 /* Dump a message */
1324 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1326 msg_format("%^s is no longer stunned.", m_name);
1329 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1330 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1335 /* Handle confusion */
1336 if (m_ptr->confused)
1338 /* Amount of "boldness" */
1339 int d = randint1(r_ptr->level / 20 + 1);
1341 /* Still confused */
1342 if (m_ptr->confused > d)
1344 /* Reduce the confusion */
1345 m_ptr->confused -= d;
1351 /* No longer confused */
1352 m_ptr->confused = 0;
1354 /* Message if visible */
1359 /* Acquire the monster name */
1360 monster_desc(m_name, m_ptr, 0);
1362 /* Dump a message */
1364 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1366 msg_format("%^s is no longer confused.", m_name);
1369 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1370 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1378 /* Amount of "boldness" */
1379 int d = randint1(r_ptr->level / 20 + 1);
1382 if (m_ptr->monfear > d)
1384 /* Reduce the fear */
1385 m_ptr->monfear -= d;
1388 /* Recover from fear, take note if seen */
1391 /* No longer afraid */
1401 /* Acquire the monster possessive */
1402 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1405 /* Acquire the monster name */
1406 monster_desc(m_name, m_ptr, 0);
1408 /* Dump a message */
1410 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1412 msg_format("%^s recovers %s courage.", m_name, m_poss);
1415 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1416 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1424 static void notice_lite_change(object_type *o_ptr)
1426 /* Hack -- notice interesting fuel steps */
1427 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1430 p_ptr->window |= (PW_EQUIP);
1433 /* Hack -- Special treatment when blind */
1436 /* Hack -- save some light for later */
1437 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1440 /* The light is now out */
1441 else if (o_ptr->xtra4 == 0)
1445 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1447 msg_print("Your light has gone out!");
1449 p_ptr->update |= (PU_BONUS);
1452 /* The light is getting dim */
1453 else if (o_ptr->name2 == EGO_LITE_LONG)
1455 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1456 && (turn % (TURNS_PER_TICK*2)))
1458 if (disturb_minor) disturb(0, 0);
1460 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1462 msg_print("Your light is growing faint.");
1468 /* The light is getting dim */
1469 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1471 if (disturb_minor) disturb(0, 0);
1473 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1475 msg_print("Your light is growing faint.");
1482 void leave_quest_check(void)
1484 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1485 leaving_quest = p_ptr->inside_quest;
1487 /* Leaving an 'only once' quest marks it as failed */
1488 if (leaving_quest &&
1489 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1490 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1492 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1493 quest[leaving_quest].complev = (byte)p_ptr->lev;
1494 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1496 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1497 if (record_rand_quest)
1498 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1500 /* Floor of random quest will be blocked */
1501 prepare_change_floor_mode(CFM_NO_RETURN);
1503 else if (record_fix_quest)
1504 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1510 * Forcibly pseudo-identify an object in the inventory
1513 * note: currently this function allows pseudo-id of any object,
1514 * including silly ones like potions & scrolls, which always
1515 * get '{average}'. This should be changed, either to stop such
1516 * items from being pseudo-id'd, or to allow psychometry to
1517 * detect whether the unidentified potion/scroll/etc is
1518 * good (Cure Light Wounds, Restore Strength, etc) or
1519 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1521 bool psychometry(void)
1525 char o_name[MAX_NLEN];
1531 item_tester_no_ryoute = TRUE;
1534 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1535 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1537 q = "Meditate on which item? ";
1538 s = "You have nothing appropriate.";
1541 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1543 /* Get the item (in the pack) */
1546 o_ptr = &inventory[item];
1549 /* Get the item (on the floor) */
1552 o_ptr = &o_list[0 - item];
1555 /* It is fully known, no information needed */
1556 if (object_known_p(o_ptr))
1559 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1561 msg_print("You cannot find out anything more about that.");
1567 /* Check for a feeling */
1568 feel = value_check_aux1(o_ptr);
1570 /* Get an object description */
1571 object_desc(o_name, o_ptr, FALSE, 0);
1573 /* Skip non-feelings */
1577 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1579 msg_format("You do not perceive anything unusual about the %s.", o_name);
1586 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1587 o_name, game_inscriptions[feel]);
1589 msg_format("You feel that the %s %s %s...",
1590 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1591 game_inscriptions[feel]);
1595 /* We have "felt" it */
1596 o_ptr->ident |= (IDENT_SENSE);
1599 o_ptr->feeling = feel;
1601 /* Combine / Reorder the pack (later) */
1602 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1605 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1607 /* Valid "tval" codes */
1608 switch (o_ptr->tval)
1636 /* Auto-inscription/destroy */
1637 idx = is_autopick(o_ptr);
1638 auto_inscribe_item(item, idx);
1639 if (okay && destroy_feeling)
1640 auto_destroy_item(item, idx);
1642 /* Something happened */
1647 static void gere_music(s32b music)
1655 stun_monsters(damroll(p_ptr->lev/10,2));
1658 hp_player(damroll(2,6));
1661 project_hack(GF_TURN_ALL, p_ptr->lev);
1664 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1667 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1670 confuse_monsters(p_ptr->lev * 2);
1673 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1676 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1679 project(0, 0, py, px,
1680 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1683 dispel_monsters(randint1(p_ptr->lev * 3));
1684 dispel_evil(randint1(p_ptr->lev * 3));
1691 earthquake(py, px, 10);
1694 stasis_monsters(p_ptr->lev * 4);
1697 dispel_monsters(randint1(p_ptr->lev * 3));
1700 hp_player(damroll(15,10));
1704 case MUSIC_DETECT+19:
1706 case MUSIC_DETECT+11:
1707 case MUSIC_DETECT+12:
1708 case MUSIC_DETECT+13:
1709 case MUSIC_DETECT+14:
1710 case MUSIC_DETECT+15:
1711 case MUSIC_DETECT+16:
1712 case MUSIC_DETECT+17:
1713 case MUSIC_DETECT+18:
1714 map_area(DETECT_RAD_MAP);
1715 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1716 case MUSIC_DETECT+6:
1717 case MUSIC_DETECT+7:
1718 case MUSIC_DETECT+8:
1719 case MUSIC_DETECT+9:
1720 case MUSIC_DETECT+10:
1721 /* There are too many hidden treasure. So... */
1722 /* detect_treasure(DETECT_RAD_DEFAULT); */
1723 detect_objects_gold(DETECT_RAD_DEFAULT);
1724 detect_objects_normal(DETECT_RAD_DEFAULT);
1725 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1726 case MUSIC_DETECT+3:
1727 case MUSIC_DETECT+4:
1728 case MUSIC_DETECT+5:
1729 detect_monsters_invis(DETECT_RAD_DEFAULT);
1730 detect_monsters_normal(DETECT_RAD_DEFAULT);
1731 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1733 case MUSIC_DETECT+1:
1734 case MUSIC_DETECT+2:
1735 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1736 detect_doors(DETECT_RAD_DEFAULT);
1737 detect_stairs(DETECT_RAD_DEFAULT);
1738 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1744 * If player has inscribed the object with "!!", let him know when it's
1747 static void recharged_notice(object_type *o_ptr)
1749 char o_name[MAX_NLEN];
1753 /* No inscription */
1754 if (!o_ptr->inscription) return;
1757 s = strchr(quark_str(o_ptr->inscription), '!');
1759 /* Process notification request. */
1762 /* Find another '!' */
1765 /* Describe (briefly) */
1766 object_desc(o_name, o_ptr, FALSE, 0);
1768 /* Notify the player */
1770 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1772 if (o_ptr->number > 1)
1773 msg_format("Your %s are recharged.", o_name);
1775 msg_format("Your %s is recharged.", o_name);
1784 /* Keep looking for '!'s */
1785 s = strchr(s + 1, '!');
1790 static void check_music(void)
1796 /* Music singed by player */
1797 if (p_ptr->pclass != CLASS_BARD) return;
1798 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1800 spell = p_ptr->magic_num2[0];
1801 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1803 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1804 need_mana *= 0x8000;
1805 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1812 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1813 need_mana = (need_mana & 0xffff);
1814 if ((u32b)p_ptr->csp_frac < need_mana)
1817 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1821 p_ptr->csp_frac -= (u16b)need_mana;
1824 p_ptr->redraw |= PR_MANA;
1825 if (p_ptr->magic_num1[1])
1827 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1828 p_ptr->magic_num1[1] = 0;
1830 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1832 msg_print("You restart singing.");
1834 p_ptr->action = ACTION_SING;
1836 /* Recalculate bonuses */
1837 p_ptr->update |= (PU_BONUS | PU_HP);
1839 /* Redraw map and status bar */
1840 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1842 /* Update monsters */
1843 p_ptr->update |= (PU_MONSTERS);
1846 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1849 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1850 p_ptr->spell_exp[spell] += 5;
1851 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1852 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1853 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1854 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1855 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1856 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1858 gere_music(p_ptr->magic_num1[0]);
1861 /* Choose one of items that have cursed flag */
1862 static object_type *choose_cursed_obj_name(u32b flag)
1865 int choices[INVEN_TOTAL-INVEN_RARM];
1868 /* Paranoia -- Player has no warning-item */
1869 if (!(p_ptr->cursed & flag)) return NULL;
1871 /* Search Inventry */
1872 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1874 object_type *o_ptr = &inventory[i];
1876 if (o_ptr->curse_flags & flag)
1878 choices[number] = i;
1883 /* Choice one of them */
1884 return (&inventory[choices[randint0(number)]]);
1889 * Handle certain things once every 10 game turns
1891 static void process_world(void)
1895 bool cave_no_regen = FALSE;
1896 int upkeep_factor = 0;
1901 const int dec_count = (easy_band ? 2 : 1);
1903 int day, hour, min, prev_min;
1905 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1906 s32b tick = turn % len + len / 4;
1908 int quest_num = quest_number(dun_level);
1910 extract_day_hour_min(&day, &hour, &min);
1911 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1913 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1915 !(quest_num && (is_fixed_quest_idx(quest_num) &&
1916 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
1917 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
1918 !p_ptr->inside_battle)
1921 if (p_ptr->inside_battle && !p_ptr->leaving)
1928 /* Count all hostile monsters */
1929 for (i2 = 0; i2 < cur_wid; ++i2)
1930 for (j2 = 0; j2 < cur_hgt; j2++)
1931 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1934 win_m_idx = cave[j2][i2].m_idx;
1937 if (number_mon == 0)
1940 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1942 msg_print("They have kill each other at the same time.");
1945 p_ptr->energy_need = 0;
1948 else if ((number_mon-1) == 0)
1951 monster_type *wm_ptr;
1953 wm_ptr = &m_list[win_m_idx];
1955 monster_desc(m_name, wm_ptr, 0);
1957 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1959 msg_format("%s is winner!", m_name);
1963 if (win_m_idx == (sel_monster+1))
1966 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1968 msg_print("Congratulations.");
1971 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1973 msg_format("You received %d gold.", battle_odds);
1975 p_ptr->au += battle_odds;
1980 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1982 msg_print("You lost gold.");
1986 p_ptr->energy_need = 0;
1989 else if(turn - old_turn == 150*TURNS_PER_TICK)
1992 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
1994 msg_format("This battle have ended in a draw.");
1996 p_ptr->au += kakekin;
1998 p_ptr->energy_need = 0;
2003 /* Every 10 game turns */
2004 if (turn % TURNS_PER_TICK) return;
2006 /*** Check the Time and Load ***/
2008 if (!(turn % (50*TURNS_PER_TICK)))
2010 /* Check time and load */
2011 if ((0 != check_time()) || (0 != check_load()))
2014 if (closing_flag <= 2)
2019 /* Count warnings */
2024 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2025 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2027 msg_print("The gates to ANGBAND are closing...");
2028 msg_print("Please finish up and/or save your game.");
2038 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2040 msg_print("The gates to ANGBAND are now closed.");
2045 p_ptr->playing = FALSE;
2048 p_ptr->leaving = TRUE;
2053 /*** Attempt timed autosave ***/
2054 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2056 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2057 do_cmd_save_game(TRUE);
2063 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2065 msg_print("You hear noise.");
2069 /*** Handle the wilderness/town (sunshine) ***/
2071 /* While in town/wilderness */
2072 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2074 /* Hack -- Daybreak/Nighfall in town */
2075 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2079 /* Check for dawn */
2080 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2087 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2089 msg_print("The sun has risen.");
2092 /* Hack -- Scan the town */
2093 for (y = 0; y < cur_hgt; y++)
2095 for (x = 0; x < cur_wid; x++)
2097 /* Get the cave grid */
2098 c_ptr = &cave[y][x];
2101 c_ptr->info |= (CAVE_GLOW);
2103 /* Hack -- Memorize lit grids if allowed */
2104 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2106 /* Hack -- Notice spot */
2119 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2121 msg_print("The sun has fallen.");
2124 /* Hack -- Scan the town */
2125 for (y = 0; y < cur_hgt; y++)
2127 for (x = 0; x < cur_wid; x++)
2129 /* Get the cave grid */
2130 c_ptr = &cave[y][x];
2132 /* Feature code (applying "mimic" field) */
2133 feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
2135 if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
2138 c_ptr->info &= ~(CAVE_GLOW);
2140 if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
2142 /* Forget the normal floor grid */
2143 c_ptr->info &= ~(CAVE_MARK);
2145 /* Hack -- Notice spot */
2151 /* Glow deep lava and building entrances */
2152 glow_deep_lava_and_bldg();
2156 /* Update the monsters */
2157 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2160 p_ptr->redraw |= (PR_MAP);
2163 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2167 /* Set back the rewards once a day */
2168 /* Only used for reward in thief's guild for now */
2169 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2173 /* Reset the rewards */
2174 for (n = 0; n < MAX_BACT; n++)
2176 p_ptr->rewards[n] = FALSE;
2181 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2183 if (cheat_xtra) msg_print("Rewards reset.");
2189 /*** Process the monsters ***/
2191 /* Check for creature generation. */
2192 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2193 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2195 /* Make a new monster */
2196 (void)alloc_monster(MAX_SIGHT + 5, 0);
2199 /* Hack -- Check for creature regeneration */
2200 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2201 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2203 /* Hack -- Process the counters of all monsters */
2204 process_monsters_counters();
2207 /*** Damage over Time ***/
2209 /* Take damage from poison */
2210 if (p_ptr->poisoned && !IS_INVULN())
2214 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2216 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2222 /* (Vampires) Take damage from sunlight */
2223 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2225 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2227 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2231 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2232 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2234 msg_print("The sun's rays scorch your undead flesh!");
2235 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2238 cave_no_regen = TRUE;
2242 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2243 !p_ptr->resist_lite)
2245 object_type * o_ptr = &inventory[INVEN_LITE];
2246 char o_name [MAX_NLEN];
2247 char ouch [MAX_NLEN+40];
2249 /* Get an object description */
2250 object_desc(o_name, o_ptr, FALSE, 0);
2253 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2255 msg_format("The %s scorches your undead flesh!", o_name);
2259 cave_no_regen = TRUE;
2261 /* Get an object description */
2262 object_desc(o_name, o_ptr, TRUE, 0);
2265 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2267 sprintf(ouch, "wielding %s", o_name);
2270 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2274 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2275 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2277 int damage = 3000 + randint0(2000);
2279 if (prace_is_(RACE_ENT)) damage += damage/3;
2280 if (p_ptr->resist_fire) damage = damage / 3;
2281 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2282 damage = damage / 100 + (randint0(100) < (damage % 100));
2288 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2289 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2291 msg_print("The lava burns you!");
2292 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2295 cave_no_regen = TRUE;
2299 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2300 !IS_INVULN() && !p_ptr->immune_fire)
2302 int damage = 6000 + randint0(4000);
2307 if (p_ptr->resist_fire) damage = damage / 3;
2308 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2312 damage = damage / 5;
2315 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2316 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2318 message = "The heat burns you!";
2319 hit_from = "flying over deep lava";
2326 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2327 hit_from = "¿¼¤¤ÍÏ´äή";
2329 message = "The lava burns you!";
2330 hit_from = "deep lava";
2335 damage = damage / 100 + (randint0(100) < (damage % 100));
2340 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2342 cave_no_regen = TRUE;
2346 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2348 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2352 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2353 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2355 msg_print("You are drowning!");
2356 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2359 cave_no_regen = TRUE;
2366 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2368 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2369 if (prace_is_(RACE_ENT)) damage += damage / 3;
2370 if (p_ptr->resist_fire) damage = damage / 3;
2371 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2373 msg_print("Ç®¤¤¡ª");
2374 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2376 msg_print("It's hot!");
2377 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2380 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2382 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2383 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2384 if (p_ptr->resist_elec) damage = damage / 3;
2385 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2387 msg_print("Äˤ¤¡ª");
2388 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2390 msg_print("It hurts!");
2391 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2394 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2396 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2397 if (p_ptr->resist_cold) damage = damage / 3;
2398 if (IS_OPPOSE_COLD()) damage = damage / 3;
2400 msg_print("Î䤿¤¤¡ª");
2401 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2403 msg_print("It's cold!");
2404 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2409 /* Spectres -- take damage when moving through walls */
2411 * Added: ANYBODY takes damage if inside through walls
2412 * without wraith form -- NOTE: Spectres will never be
2413 * reduced below 0 hp by being inside a stone wall; others
2416 if (!cave_floor_bold(py, px))
2418 /* Player can walk through trees */
2419 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2423 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2424 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2428 cave_no_regen = TRUE;
2430 if (p_ptr->pass_wall)
2433 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2436 msg_print("Your molecules feel disrupted!");
2437 dam_desc = "density";
2444 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2445 dam_desc = "¹Å¤¤´ä";
2447 msg_print("You are being crushed!");
2448 dam_desc = "solid rock";
2453 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2459 if (min != prev_min)
2461 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2462 determine_today_mon(FALSE);
2466 /* Nightmare mode activates the TY_CURSE at midnight */
2467 if (ironman_nightmare)
2469 /* Require exact minute */
2470 if (min != prev_min)
2472 /* Every 15 minutes after 11:00 pm */
2473 if ((hour == 23) && !(min % 15))
2483 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2485 msg_print("You hear a distant bell toll ominously.");
2493 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2495 msg_print("A distant bell sounds twice.");
2503 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2505 msg_print("A distant bell sounds three times.");
2513 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2515 msg_print("A distant bell tolls four times.");
2523 /* TY_CURSE activates at mignight! */
2530 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2532 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2535 activate_ty_curse(FALSE, &count);
2540 /* Take damage from cuts */
2541 if (p_ptr->cut && !IS_INVULN())
2543 /* Mortal wound or Deep Gash */
2544 if (p_ptr->cut > 1000)
2549 else if (p_ptr->cut > 200)
2555 else if (p_ptr->cut > 100)
2560 else if (p_ptr->cut > 50)
2565 else if (p_ptr->cut > 25)
2570 else if (p_ptr->cut > 10)
2583 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2585 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2591 /*** Check the Food, and Regenerate ***/
2593 if (!p_ptr->inside_battle)
2595 /* Digest normally */
2596 if (p_ptr->food < PY_FOOD_MAX)
2598 /* Every 50 game turns */
2599 if (!(turn % (TURNS_PER_TICK*5)))
2601 /* Basic digestion rate based on speed */
2602 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2604 /* Regeneration takes more food */
2605 if (p_ptr->regenerate) i += 20;
2606 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2607 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2609 /* Slow digestion takes less food */
2610 if (p_ptr->slow_digest) i -= 5;
2612 /* Minimal digestion */
2614 /* Maximal digestion */
2615 if (i > 100) i = 100;
2617 /* Digest some food */
2618 (void)set_food(p_ptr->food - i);
2622 /* Digest quickly when gorged */
2625 /* Digest a lot of food */
2626 (void)set_food(p_ptr->food - 100);
2630 /* Starve to death (slowly) */
2631 if (p_ptr->food < PY_FOOD_STARVE)
2633 /* Calculate damage */
2634 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2638 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2640 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2645 /* Default regeneration */
2646 regen_amount = PY_REGEN_NORMAL;
2649 if (p_ptr->food < PY_FOOD_WEAK)
2651 /* Lower regeneration */
2652 if (p_ptr->food < PY_FOOD_STARVE)
2656 else if (p_ptr->food < PY_FOOD_FAINT)
2658 regen_amount = PY_REGEN_FAINT;
2662 regen_amount = PY_REGEN_WEAK;
2666 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2668 /* Faint occasionally */
2669 if (!p_ptr->paralyzed && (randint0(100) < 10))
2673 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2675 msg_print("You faint from the lack of food.");
2680 /* Hack -- faint (bypass free action) */
2681 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2687 /* Are we walking the pattern? */
2688 if (pattern_effect())
2690 cave_no_regen = TRUE;
2694 /* Regeneration ability */
2695 if (p_ptr->regenerate)
2697 regen_amount = regen_amount * 2;
2699 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2703 if (p_ptr->cursed & TRC_SLOW_REGEN)
2710 /* Searching or Resting */
2711 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2713 regen_amount = regen_amount * 2;
2716 upkeep_factor = calculate_upkeep();
2718 /* Regenerate the mana */
2719 /* if (p_ptr->csp < p_ptr->msp) */
2723 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2724 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2725 regenmana(upkeep_regen/100);
2727 #ifdef TRACK_FRIENDS
2731 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2733 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2737 #endif /* TRACK_FRIENDS */
2740 else if (p_ptr->action != ACTION_LEARN)
2742 regenmana(regen_amount);
2745 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2747 regenmagic(regen_amount);
2750 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2752 while (upkeep_factor > 100)
2755 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2757 msg_print("Such much pets cannot be controled at once!");
2760 do_cmd_pet_dismiss();
2762 upkeep_factor = calculate_upkeep();
2765 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2767 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2773 /* Poisoned or cut yields no healing */
2774 if (p_ptr->poisoned) regen_amount = 0;
2775 if (p_ptr->cut) regen_amount = 0;
2777 /* Special floor -- Pattern, in a wall -- yields no healing */
2778 if (cave_no_regen) regen_amount = 0;
2780 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2782 /* Regenerate Hit Points if needed */
2783 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2785 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2786 (cave[py][px].feat >= FEAT_PATTERN_START))
2788 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2792 regenhp(regen_amount);
2797 /*** Timeout Various Things ***/
2800 if (p_ptr->tim_mimic)
2802 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2805 /* Hack -- Hallucinating */
2808 (void)set_image(p_ptr->image - dec_count);
2814 (void)set_blind(p_ptr->blind - dec_count);
2817 /* Times see-invisible */
2818 if (p_ptr->tim_invis)
2820 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2831 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2834 /* Timed temporary elemental brands. -LM- */
2835 if (p_ptr->ele_attack)
2837 p_ptr->ele_attack--;
2839 /* Clear all temporary elemental brands. */
2840 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2843 /* Timed temporary elemental immune. -LM- */
2844 if (p_ptr->ele_immune)
2846 p_ptr->ele_immune--;
2848 /* Clear all temporary elemental brands. */
2849 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2852 /* Timed infra-vision */
2853 if (p_ptr->tim_infra)
2855 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2859 if (p_ptr->tim_stealth)
2861 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2864 /* Timed levitation */
2865 if (p_ptr->tim_ffall)
2867 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2870 /* Timed sh_touki */
2871 if (p_ptr->tim_sh_touki)
2873 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2877 if (p_ptr->tim_sh_fire)
2879 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2883 if (p_ptr->tim_sh_holy)
2885 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2889 if (p_ptr->tim_eyeeye)
2891 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2894 /* Timed resist-magic */
2895 if (p_ptr->resist_magic)
2897 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2900 /* Timed regeneration */
2901 if (p_ptr->tim_regen)
2903 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2906 /* Timed resist nether */
2907 if (p_ptr->tim_res_nether)
2909 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2912 /* Timed resist time */
2913 if (p_ptr->tim_res_time)
2915 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2919 if (p_ptr->tim_reflect)
2921 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2925 if (p_ptr->multishadow)
2927 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2930 /* Timed Robe of dust */
2931 if (p_ptr->dustrobe)
2933 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2936 /* Timed infra-vision */
2937 if (p_ptr->kabenuke)
2939 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2943 if (p_ptr->paralyzed)
2945 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2949 if (p_ptr->confused)
2951 (void)set_confused(p_ptr->confused - dec_count);
2957 (void)set_afraid(p_ptr->afraid - dec_count);
2963 (void)set_fast(p_ptr->fast - 1, TRUE);
2969 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2972 /* Protection from evil */
2973 if (p_ptr->protevil)
2975 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2978 /* Invulnerability */
2981 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2985 if (p_ptr->wraith_form)
2987 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2993 (void)set_hero(p_ptr->hero - 1, TRUE);
2999 (void)set_shero(p_ptr->shero - 1, TRUE);
3005 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3011 (void)set_shield(p_ptr->shield - 1, TRUE);
3015 if (p_ptr->tsubureru)
3017 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3021 if (p_ptr->magicdef)
3023 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3027 if (p_ptr->tsuyoshi)
3029 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3033 if (p_ptr->oppose_acid)
3035 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3038 /* Oppose Lightning */
3039 if (p_ptr->oppose_elec)
3041 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3045 if (p_ptr->oppose_fire)
3047 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3051 if (p_ptr->oppose_cold)
3053 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3057 if (p_ptr->oppose_pois)
3059 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3064 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3067 /*** Poison and Stun and Cut ***/
3070 if (p_ptr->poisoned)
3072 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3074 /* Apply some healing */
3075 (void)set_poisoned(p_ptr->poisoned - adjust);
3081 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3083 /* Apply some healing */
3084 (void)set_stun(p_ptr->stun - adjust);
3090 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3092 /* Hack -- Truly "mortal" wound */
3093 if (p_ptr->cut > 1000) adjust = 0;
3095 /* Apply some healing */
3096 (void)set_cut(p_ptr->cut - adjust);
3101 /*** Process Light ***/
3103 /* Check for light being wielded */
3104 o_ptr = &inventory[INVEN_LITE];
3106 /* Burn some fuel in the current lite */
3107 if (o_ptr->tval == TV_LITE)
3109 /* Hack -- Use some fuel (except on artifacts) */
3110 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3112 /* Decrease life-span */
3113 if (o_ptr->name2 == EGO_LITE_LONG)
3115 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3117 else o_ptr->xtra4--;
3119 /* Notice interesting fuel steps */
3120 notice_lite_change(o_ptr);
3124 /* Calculate torch radius */
3125 p_ptr->update |= (PU_TORCH);
3128 /*** Process mutation effects ***/
3129 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3131 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3135 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3136 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3138 msg_print("RAAAAGHH!");
3139 msg_print("You feel a fit of rage coming over you!");
3142 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3145 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3147 if (!p_ptr->resist_fear)
3151 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3153 msg_print("It's so dark... so scary!");
3156 set_afraid(p_ptr->afraid + 13 + randint1(26));
3160 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3162 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3167 /* Teleport player */
3169 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3171 msg_print("Your position suddenly seems very uncertain...");
3175 teleport_player(40);
3179 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3181 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3184 p_ptr->redraw |= PR_EXTRA;
3186 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3188 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3193 if (!p_ptr->resist_conf)
3195 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3198 if (!p_ptr->resist_chaos)
3203 if (one_in_(3)) lose_all_info();
3205 teleport_player(100);
3208 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3209 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3211 msg_print("You wake up somewhere with a sore head...");
3212 msg_print("You can't remember a thing, or how you got here!");
3221 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3223 msg_print("Thishcischs GooDSChtuff!");
3226 (void)set_image(p_ptr->image + randint0(150) + 150);
3232 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3234 if (!p_ptr->resist_chaos)
3237 p_ptr->redraw |= PR_EXTRA;
3238 (void)set_image(p_ptr->image + randint0(50) + 20);
3242 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3247 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3249 msg_print("BRRAAAP! Oops.");
3253 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3256 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3257 !p_ptr->anti_magic && one_in_(9000))
3262 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3264 msg_print("Magical energy flows through you! You must release it!");
3269 (void)get_hack_dir(&dire);
3270 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3273 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3274 !p_ptr->anti_magic && (randint1(6666) == 666))
3276 bool pet = one_in_(6);
3277 u32b mode = PM_ALLOW_GROUP;
3279 if (pet) mode |= PM_FORCE_PET;
3280 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3282 if (summon_specific((pet ? -1 : 0), py, px,
3283 dun_level, SUMMON_DEMON, mode))
3286 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3288 msg_print("You have attracted a demon!");
3295 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3301 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3303 msg_print("You feel less energetic.");
3306 if (p_ptr->fast > 0)
3312 set_slow(randint1(30) + 10, FALSE);
3318 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3320 msg_print("You feel more energetic.");
3323 if (p_ptr->slow > 0)
3329 set_fast(randint1(30) + 10, FALSE);
3334 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3338 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3340 msg_print("You suddenly feel almost lonely.");
3343 banish_monsters(100);
3344 if (!dun_level && p_ptr->town_num)
3347 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3349 msg_print("You see one of the shopkeepers running for the hills!");
3352 store_shuffle(randint0(MAX_STORES));
3357 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3362 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3364 msg_print("A shadow passes over you.");
3369 /* Absorb light from the current possition */
3370 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
3375 o_ptr = &inventory[INVEN_LITE];
3377 /* Absorb some fuel in the current lite */
3378 if (o_ptr->tval == TV_LITE)
3380 /* Use some fuel (except on artifacts) */
3381 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3383 /* Heal the player a bit */
3384 hp_player(o_ptr->xtra4 / 20);
3386 /* Decrease life-span of lite */
3390 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3392 msg_print("You absorb energy from your light!");
3396 /* Notice interesting fuel steps */
3397 notice_lite_change(o_ptr);
3402 * Unlite the area (radius 10) around player and
3403 * do 50 points damage to every affected monster
3405 unlite_area(50, 10);
3408 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3409 !p_ptr->anti_magic && one_in_(7000))
3411 bool pet = one_in_(3);
3412 u32b mode = PM_ALLOW_GROUP;
3414 if (pet) mode |= PM_FORCE_PET;
3415 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3417 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3420 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3422 msg_print("You have attracted an animal!");
3429 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3430 !p_ptr->anti_magic && one_in_(8000))
3434 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3436 msg_print("You feel the world warping around you!");
3440 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3442 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3444 if (!lose_mutation(0))
3446 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3448 msg_print("You feel oddly normal.");
3452 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3456 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3458 msg_print("You feel insubstantial!");
3462 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3464 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3468 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3470 int which_stat = randint0(6);
3471 int sustained = FALSE;
3476 if (p_ptr->sustain_str) sustained = TRUE;
3479 if (p_ptr->sustain_int) sustained = TRUE;
3482 if (p_ptr->sustain_wis) sustained = TRUE;
3485 if (p_ptr->sustain_dex) sustained = TRUE;
3488 if (p_ptr->sustain_con) sustained = TRUE;
3491 if (p_ptr->sustain_chr) sustained = TRUE;
3495 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3497 msg_print("Invalid stat chosen!");
3507 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3509 msg_print("You can feel yourself wasting away!");
3513 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3516 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3517 !p_ptr->anti_magic && one_in_(3000))
3519 bool pet = one_in_(5);
3520 u32b mode = PM_ALLOW_GROUP;
3522 if (pet) mode |= PM_FORCE_PET;
3523 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3525 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3528 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3530 msg_print("You have attracted a dragon!");
3536 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3539 if (p_ptr->tim_esp > 0)
3542 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3544 msg_print("Your mind feels cloudy!");
3547 set_tim_esp(0, TRUE);
3552 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3554 msg_print("Your mind expands!");
3557 set_tim_esp(p_ptr->lev, FALSE);
3560 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3565 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3567 msg_print("Your stomach roils, and you lose your lunch!");
3571 set_food(PY_FOOD_WEAK);
3574 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3575 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3580 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3582 int danger_amount = 0;
3585 for (monster = 0; monster < m_max; monster++)
3587 monster_type *m_ptr = &m_list[monster];
3588 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3590 /* Paranoia -- Skip dead monsters */
3591 if (!m_ptr->r_idx) continue;
3593 if (r_ptr->level >= p_ptr->lev)
3595 danger_amount += r_ptr->level - p_ptr->lev + 1;
3599 if (danger_amount > 100)
3601 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3603 msg_print("You feel utterly terrified!");
3606 else if (danger_amount > 50)
3608 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3610 msg_print("You feel terrified!");
3613 else if (danger_amount > 20)
3615 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3617 msg_print("You feel very worried!");
3620 else if (danger_amount > 10)
3622 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3624 msg_print("You feel paranoid!");
3627 else if (danger_amount > 5)
3629 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3631 msg_print("You feel almost safe.");
3636 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3638 msg_print("You feel lonely.");
3642 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3647 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3649 msg_print("You feel invincible!");
3653 (void)set_invuln(randint1(8) + 8, FALSE);
3655 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3657 int wounds = p_ptr->mhp - p_ptr->chp;
3661 int healing = p_ptr->csp;
3663 if (healing > wounds)
3669 p_ptr->csp -= healing;
3672 p_ptr->redraw |= (PR_MANA);
3675 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3678 int wounds = p_ptr->msp - p_ptr->csp;
3682 int healing = p_ptr->chp;
3684 if (healing > wounds)
3689 p_ptr->csp += healing;
3692 p_ptr->redraw |= (PR_MANA);
3694 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3696 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3701 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3707 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3708 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3710 msg_print("You trip over your own feet!");
3711 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3716 if (buki_motteruka(INVEN_RARM))
3718 int slot = INVEN_RARM;
3719 o_ptr = &inventory[INVEN_RARM];
3720 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3722 o_ptr = &inventory[INVEN_LARM];
3725 if (!cursed_p(o_ptr))
3728 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3730 msg_print("You drop your weapon!");
3733 inven_drop(slot, 1);
3740 /*** Process Inventory ***/
3742 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3745 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3746 * can actually be useful!
3748 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3751 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3753 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3757 teleport_player(50);
3760 /* Make a chainsword noise */
3761 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3765 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3767 if (!get_rnd_line("chainswd.txt", 0, noise))
3770 disturb(FALSE, FALSE);
3773 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3776 (void)activate_ty_curse(FALSE, &count);
3778 /* Handle experience draining */
3779 if (p_ptr->prace != RACE_ANDROID &&
3780 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3782 p_ptr->exp -= (p_ptr->lev+1)/2;
3783 if (p_ptr->exp < 0) p_ptr->exp = 0;
3784 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3785 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3788 /* Add light curse (Later) */
3789 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3794 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3796 new_curse = get_curse(0, o_ptr);
3797 if (!(o_ptr->curse_flags & new_curse))
3799 char o_name[MAX_NLEN];
3801 object_desc(o_name, o_ptr, FALSE, 0);
3803 o_ptr->curse_flags |= new_curse;
3805 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3807 msg_format("There is a malignant black aura surrounding %s...", o_name);
3810 o_ptr->feeling = FEEL_NONE;
3812 p_ptr->update |= (PU_BONUS);
3815 /* Add heavy curse (Later) */
3816 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3821 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3823 new_curse = get_curse(1, o_ptr);
3824 if (!(o_ptr->curse_flags & new_curse))
3826 char o_name[MAX_NLEN];
3828 object_desc(o_name, o_ptr, FALSE, 0);
3830 o_ptr->curse_flags |= new_curse;
3832 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3834 msg_format("There is a malignant black aura surrounding %s...", o_name);
3837 o_ptr->feeling = FEEL_NONE;
3839 p_ptr->update |= (PU_BONUS);
3843 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3845 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3846 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3848 char o_name[MAX_NLEN];
3850 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3852 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3854 msg_format("%s have attracted an animal!", o_name);
3861 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3863 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3865 char o_name[MAX_NLEN];
3867 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3869 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3871 msg_format("%s have attracted a demon!", o_name);
3878 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3880 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3881 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3883 char o_name[MAX_NLEN];
3885 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3887 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3889 msg_format("%s have attracted an animal!", o_name);
3895 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3897 if (!p_ptr->resist_fear)
3901 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3903 msg_print("It's so dark... so scary!");
3906 set_afraid(p_ptr->afraid + 13 + randint1(26));
3909 /* Teleport player */
3910 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3914 /* Teleport player */
3915 teleport_player(40);
3917 /* Handle HP draining */
3918 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3920 char o_name[MAX_NLEN];
3922 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3924 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3926 msg_format("%s drains HP from you!", o_name);
3928 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3930 /* Handle mana draining */
3931 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3933 char o_name[MAX_NLEN];
3935 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3937 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3939 msg_format("%s drains mana from you!", o_name);
3941 p_ptr->csp -= MIN(p_ptr->lev, 50);
3945 p_ptr->csp_frac = 0;
3947 p_ptr->redraw |= PR_MANA;
3951 /* Rarely, take damage from the Jewel of Judgement */
3952 if (one_in_(999) && !p_ptr->anti_magic)
3954 object_type *o_ptr = &inventory[INVEN_LITE];
3956 if (o_ptr->name1 == ART_JUDGE)
3959 if (object_known_p(o_ptr))
3960 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3962 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3963 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3965 if (object_known_p(o_ptr))
3966 msg_print("The Jewel of Judgement drains life from you!");
3968 msg_print("Something drains life from you!");
3969 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3975 /* Process equipment */
3976 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3978 /* Get the object */
3979 o_ptr = &inventory[i];
3981 /* Skip non-objects */
3982 if (!o_ptr->k_idx) continue;
3984 /* Recharge activatable objects */
3985 if (o_ptr->timeout > 0)
3990 /* Notice changes */
3991 if (!o_ptr->timeout)
3993 recharged_notice(o_ptr);
3999 /* Notice changes */
4003 p_ptr->window |= (PW_EQUIP);
4008 * Recharge rods. Rods now use timeout to control charging status,
4009 * and each charging rod in a stack decreases the stack's timeout by
4010 * one per turn. -LM-
4012 for (j = 0, i = 0; i < INVEN_PACK; i++)
4014 o_ptr = &inventory[i];
4015 k_ptr = &k_info[o_ptr->k_idx];
4017 /* Skip non-objects */
4018 if (!o_ptr->k_idx) continue;
4020 /* Examine all charging rods or stacks of charging rods. */
4021 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4023 /* Determine how many rods are charging. */
4024 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4025 if (temp > o_ptr->number) temp = o_ptr->number;
4027 /* Decrease timeout by that number. */
4028 o_ptr->timeout -= temp;
4030 /* Boundary control. */
4031 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4033 /* Notice changes, provide message if object is inscribed. */
4034 if (!(o_ptr->timeout))
4036 recharged_notice(o_ptr);
4042 /* Notice changes */
4046 p_ptr->notice |= (PN_COMBINE);
4049 p_ptr->window |= (PW_INVEN);
4053 /* Feel the inventory */
4058 /*** Process Objects ***/
4060 /* Process objects */
4061 for (i = 1; i < o_max; i++)
4066 /* Skip dead objects */
4067 if (!o_ptr->k_idx) continue;
4069 /* Recharge rods on the ground. No messages. */
4070 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4073 o_ptr->timeout -= o_ptr->number;
4075 /* Boundary control. */
4076 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4081 /*** Involuntary Movement ***/
4083 /* Delayed Word-of-Recall */
4084 if (p_ptr->word_recall)
4087 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4088 * The player is yanked up/down as soon as
4089 * he loads the autosaved game.
4091 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4092 do_cmd_save_game(TRUE);
4094 /* Count down towards recall */
4095 p_ptr->word_recall--;
4097 p_ptr->redraw |= (PR_STATUS);
4099 /* Activate the recall */
4100 if (!p_ptr->word_recall)
4105 /* Determine the level */
4106 if (dun_level || p_ptr->inside_quest)
4109 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4111 msg_print("You feel yourself yanked upwards!");
4114 p_ptr->recall_dungeon = dungeon_type;
4116 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4120 prepare_change_floor_mode(CFM_CLEAR_ALL);
4122 leave_quest_check();
4124 p_ptr->inside_quest = 0;
4125 p_ptr->leaving = TRUE;
4130 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4132 msg_print("You feel yourself yanked downwards!");
4135 dungeon_type = p_ptr->recall_dungeon;
4138 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4141 dun_level = max_dlv[dungeon_type];
4142 if (dun_level < 1) dun_level = 1;
4144 /* Nightmare mode makes recall more dangerous */
4145 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4151 else if (dun_level < 99)
4153 dun_level = (dun_level + 99) / 2;
4155 else if (dun_level > 100)
4157 dun_level = d_info[dungeon_type].maxdepth - 1;
4161 if (p_ptr->wild_mode)
4163 p_ptr->wilderness_y = py;
4164 p_ptr->wilderness_x = px;
4168 /* Save player position */
4172 p_ptr->wild_mode = FALSE;
4174 prepare_change_floor_mode(CFM_CLEAR_ALL);
4177 p_ptr->leaving = TRUE;
4179 if (dungeon_type == DUNGEON_ANGBAND)
4181 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4183 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4184 (quest[i].status == QUEST_STATUS_TAKEN) &&
4185 (quest[i].level < dun_level))
4187 quest[i].status = QUEST_STATUS_FAILED;
4188 quest[i].complev = (byte)p_ptr->lev;
4189 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4196 sound(SOUND_TPLEVEL);
4201 /* Delayed Alter reality */
4202 if (p_ptr->alter_reality)
4204 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4205 do_cmd_save_game(TRUE);
4207 /* Count down towards alter */
4208 p_ptr->alter_reality--;
4210 p_ptr->redraw |= (PR_STATUS);
4212 /* Activate the alter reality */
4213 if (!p_ptr->alter_reality)
4218 /* Determine the level */
4219 if (!quest_number(dun_level) && dun_level)
4222 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4224 msg_print("The world changes!");
4227 prepare_change_floor_mode(CFM_CLEAR_ALL);
4230 p_ptr->leaving = TRUE;
4235 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4237 msg_print("The world seems to change for a moment!");
4242 sound(SOUND_TPLEVEL);
4250 * Verify use of "wizard" mode
4252 static bool enter_wizard_mode(void)
4254 /* Ask first time */
4255 if (!p_ptr->noscore)
4257 /* Wizard mode is not permitted */
4258 if (!allow_debug_opts)
4261 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4263 msg_print("Wizard mode is not permitted.");
4268 /* Mention effects */
4270 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4271 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4273 msg_print("Wizard mode is for debugging and experimenting.");
4274 msg_print("The game will not be scored if you enter wizard mode.");
4279 /* Verify request */
4281 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4283 if (!get_check("Are you sure you want to enter wizard mode? "))
4290 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4292 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4295 p_ptr->noscore |= 0x0002;
4306 * Verify use of "debug" commands
4308 static bool enter_debug_mode(void)
4310 /* Ask first time */
4311 if (!p_ptr->noscore)
4313 /* Debug mode is not permitted */
4314 if (!allow_debug_opts)
4317 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4319 msg_print("Use of debug command is not permitted.");
4324 /* Mention effects */
4326 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4327 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4329 msg_print("The debug commands are for debugging and experimenting.");
4330 msg_print("The game will not be scored if you use debug commands.");
4335 /* Verify request */
4337 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4339 if (!get_check("Are you sure you want to use debug commands? "))
4346 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4348 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4351 p_ptr->noscore |= 0x0008;
4359 * Hack -- Declare the Debug Routines
4361 extern void do_cmd_debug(void);
4363 #endif /* ALLOW_WIZARD */
4369 * Verify use of "borg" commands
4371 static bool enter_borg_mode(void)
4373 /* Ask first time */
4374 if (!(p_ptr->noscore & 0x0010))
4376 /* Mention effects */
4378 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4379 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4381 msg_print("The borg commands are for debugging and experimenting.");
4382 msg_print("The game will not be scored if you use borg commands.");
4387 /* Verify request */
4389 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4391 if (!get_check("Are you sure you want to use borg commands? "))
4398 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4400 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4403 p_ptr->noscore |= 0x0010;
4411 * Hack -- Declare the Ben Borg
4413 extern void do_cmd_borg(void);
4415 #endif /* ALLOW_BORG */
4420 * Parse and execute the current command
4421 * Give "Warning" on illegal commands.
4423 * XXX XXX XXX Make some "blocks"
4425 static void process_command(void)
4427 int old_now_message = now_message;
4429 #ifdef ALLOW_REPEAT /* TNB */
4431 /* Handle repeating the last command */
4434 #endif /* ALLOW_REPEAT -- TNB */
4438 /* Parse the command */
4439 switch (command_cmd)
4455 /*** Wizard Commands ***/
4457 /* Toggle Wizard Mode */
4462 p_ptr->wizard = FALSE;
4464 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4466 msg_print("Wizard mode off.");
4470 else if (enter_wizard_mode())
4472 p_ptr->wizard = TRUE;
4474 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4476 msg_print("Wizard mode on.");
4481 /* Update monsters */
4482 p_ptr->update |= (PU_MONSTERS);
4484 /* Redraw "title" */
4485 p_ptr->redraw |= (PR_TITLE);
4493 /* Special "debug" commands */
4496 /* Enter debug mode */
4497 if (enter_debug_mode())
4504 #endif /* ALLOW_WIZARD */
4509 /* Special "borg" commands */
4512 /* Enter borg mode */
4513 if (enter_borg_mode())
4515 if (!p_ptr->wild_mode) do_cmd_borg();
4521 #endif /* ALLOW_BORG */
4525 /*** Inventory Commands ***/
4527 /* Wear/wield equipment */
4530 if (!p_ptr->wild_mode) do_cmd_wield();
4534 /* Take off equipment */
4537 if (!p_ptr->wild_mode) do_cmd_takeoff();
4544 if (!p_ptr->wild_mode) do_cmd_drop();
4548 /* Destroy an item */
4555 /* Equipment list */
4562 /* Inventory list */
4570 /*** Various commands ***/
4572 /* Identify an object */
4579 /* Hack -- toggle windows */
4582 toggle_inven_equip();
4587 /*** Standard "Movement" Commands ***/
4592 if (!p_ptr->wild_mode) do_cmd_alter();
4599 if (!p_ptr->wild_mode) do_cmd_tunnel();
4603 /* Move (usually pick up things) */
4606 #ifdef ALLOW_EASY_DISARM /* TNB */
4610 #else /* ALLOW_EASY_DISARM -- TNB */
4612 do_cmd_walk(always_pickup);
4614 #endif /* ALLOW_EASY_DISARM -- TNB */
4619 /* Move (usually do not pick up) */
4622 #ifdef ALLOW_EASY_DISARM /* TNB */
4626 #else /* ALLOW_EASY_DISARM -- TNB */
4628 do_cmd_walk(!always_pickup);
4630 #endif /* ALLOW_EASY_DISARM -- TNB */
4636 /*** Running, Resting, Searching, Staying */
4638 /* Begin Running -- Arg is Max Distance */
4641 if (!p_ptr->wild_mode) do_cmd_run();
4645 /* Stay still (usually pick things up) */
4648 do_cmd_stay(always_pickup);
4652 /* Stay still (usually do not pick up) */
4655 do_cmd_stay(!always_pickup);
4659 /* Rest -- Arg is time */
4666 /* Search for traps/doors */
4673 /* Toggle search mode */
4676 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4677 else set_action(ACTION_SEARCH);
4682 /*** Stairs and Doors and Chests and Traps ***/
4685 case SPECIAL_KEY_STORE:
4687 if (!p_ptr->wild_mode) do_cmd_store();
4691 /* Enter building -KMW- */
4692 case SPECIAL_KEY_BUILDING:
4694 if (!p_ptr->wild_mode) do_cmd_bldg();
4698 /* Enter quest level -KMW- */
4699 case SPECIAL_KEY_QUEST:
4701 if (!p_ptr->wild_mode) do_cmd_quest();
4705 /* Go up staircase */
4708 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4715 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4717 msg_print("To flee the ambush you have to reach the edge of the map.");
4720 else if (p_ptr->food < PY_FOOD_WEAK)
4723 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4725 msg_print("You must eat something here.");
4730 if (change_wild_mode())
4743 /* Go down staircase */
4746 if(!p_ptr->wild_mode) do_cmd_go_down();
4749 p_ptr->wilderness_x = px;
4750 p_ptr->wilderness_y = py;
4756 /* Open a door or chest */
4759 if (!p_ptr->wild_mode) do_cmd_open();
4766 if (!p_ptr->wild_mode) do_cmd_close();
4770 /* Jam a door with spikes */
4773 if (!p_ptr->wild_mode) do_cmd_spike();
4780 if (!p_ptr->wild_mode) do_cmd_bash();
4784 /* Disarm a trap or chest */
4787 if (!p_ptr->wild_mode) do_cmd_disarm();
4792 /*** Magic and Prayers ***/
4794 /* Gain new spells/prayers */
4797 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4799 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4801 msg_print("You don't have to learn spells!");
4803 else if (p_ptr->pclass == CLASS_SAMURAI)
4804 do_cmd_gain_hissatsu();
4805 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4815 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4816 (p_ptr->pclass == CLASS_BERSERKER) ||
4817 (p_ptr->pclass == CLASS_NINJA) ||
4818 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4819 ) do_cmd_mind_browse();
4820 else if (p_ptr->pclass == CLASS_SMITH)
4822 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4823 do_cmd_magic_eater(TRUE);
4824 else do_cmd_browse();
4832 if (!p_ptr->wild_mode)
4834 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4837 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4839 msg_print("You cannot cast spells!");
4842 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4845 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4847 msg_print("The dungeon absorbs all attempted magic!");
4851 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4855 cptr which_power = "ËâË¡";
4857 cptr which_power = "magic";
4859 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4861 which_power = "ĶǽÎÏ";
4863 which_power = "psionic powers";
4865 else if (p_ptr->pclass == CLASS_IMITATOR)
4867 which_power = "¤â¤Î¤Þ¤Í";
4869 which_power = "imitation";
4871 else if (p_ptr->pclass == CLASS_SAMURAI)
4873 which_power = "ɬ»¦·õ";
4875 which_power = "hissatsu";
4877 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4879 which_power = "¶ÀËâË¡";
4881 which_power = "mirror magic";
4883 else if (p_ptr->pclass == CLASS_NINJA)
4885 which_power = "Ǧ½Ñ";
4887 which_power = "ninjutsu";
4889 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4891 which_power = "µ§¤ê";
4893 which_power = "prayer";
4897 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4899 msg_format("An anti-magic shell disrupts your %s!", which_power);
4903 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4906 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4908 msg_format("You cannot think directly!");
4914 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4915 (p_ptr->pclass == CLASS_BERSERKER) ||
4916 (p_ptr->pclass == CLASS_NINJA) ||
4917 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4920 else if (p_ptr->pclass == CLASS_IMITATOR)
4922 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4923 do_cmd_magic_eater(FALSE);
4924 else if (p_ptr->pclass == CLASS_SAMURAI)
4926 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4927 do_cmd_cast_learned();
4928 else if (p_ptr->pclass == CLASS_SMITH)
4937 /* Issue a pet command */
4940 if (!p_ptr->wild_mode) do_cmd_pet();
4944 /*** Use various objects ***/
4946 /* Inscribe an object */
4953 /* Uninscribe an object */
4956 do_cmd_uninscribe();
4960 /* Activate an artifact */
4963 if (!p_ptr->wild_mode)
4965 if (!p_ptr->inside_arena)
4970 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4972 msg_print("The arena absorbs all attempted magic!");
4988 /* Fuel your lantern/torch */
4998 if (!p_ptr->wild_mode) do_cmd_fire();
5005 if (!p_ptr->wild_mode)
5015 if (!p_ptr->wild_mode)
5017 if (!p_ptr->inside_arena)
5022 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5024 msg_print("The arena absorbs all attempted magic!");
5036 if (!p_ptr->wild_mode)
5038 if (p_ptr->inside_arena)
5041 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5043 msg_print("The arena absorbs all attempted magic!");
5048 else if (use_command && rogue_like_commands)
5060 /* Quaff a potion */
5063 if (!p_ptr->wild_mode)
5065 if (!p_ptr->inside_arena)
5066 do_cmd_quaff_potion();
5070 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5072 msg_print("The arena absorbs all attempted magic!");
5084 if (!p_ptr->wild_mode)
5086 if (!p_ptr->inside_arena)
5087 do_cmd_read_scroll();
5091 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5093 msg_print("The arena absorbs all attempted magic!");
5105 if (!p_ptr->wild_mode)
5107 if (p_ptr->inside_arena)
5110 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5112 msg_print("The arena absorbs all attempted magic!");
5117 else if (use_command && !rogue_like_commands)
5127 /* Use racial power */
5130 if (!p_ptr->wild_mode) do_cmd_racial_power();
5135 /*** Looking at Things (nearby or on map) ***/
5137 /* Full dungeon map */
5144 /* Locate player on map */
5158 /* Target monster or location */
5161 if (!p_ptr->wild_mode) do_cmd_target();
5167 /*** Help and Such ***/
5176 /* Identify symbol */
5179 do_cmd_query_symbol();
5183 /* Character description */
5186 do_cmd_change_name();
5191 /*** System Commands ***/
5193 /* Hack -- User interface */
5200 /* Single line from a pref file */
5215 do_cmd_edit_autopick();
5219 /* Interact with macros */
5226 /* Interact with visuals */
5234 /* Interact with colors */
5242 /* Interact with options */
5250 /*** Misc Commands ***/
5266 /* Repeat level feeling */
5269 if (!p_ptr->wild_mode) do_cmd_feeling();
5273 /* Show previous message */
5276 do_cmd_message_one();
5280 /* Show previous messages */
5283 do_cmd_messages(old_now_message);
5287 /* Show quest status -KMW- */
5290 do_cmd_checkquest();
5294 /* Redraw the screen */
5297 now_message = old_now_message;
5302 #ifndef VERIFY_SAVEFILE
5304 /* Hack -- Save and don't quit */
5307 do_cmd_save_game(FALSE);
5311 #endif /* VERIFY_SAVEFILE */
5321 case SPECIAL_KEY_QUIT:
5323 do_cmd_save_and_exit();
5327 /* Quit (commit suicide) */
5340 /* Check artifacts, uniques, objects */
5347 /* Load "screen dump" */
5350 do_cmd_load_screen();
5354 /* Save "screen dump" */
5357 do_cmd_save_screen();
5361 /* Make random artifact list */
5364 spoil_random_artifact("randifact.txt");
5368 /* Hack -- Unknown command */
5371 if (flush_failure) flush();
5375 sound(SOUND_ILLEGAL);
5377 if (!get_rnd_line("error_j.txt", 0, error_m))
5379 if (!get_rnd_line("error.txt", 0, error_m))
5386 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5388 prt("Type '?' for help.", 0, 0);
5394 if (!energy_use && !now_message)
5395 now_message = old_now_message;
5401 static bool monster_tsuri(int r_idx)
5403 monster_race *r_ptr = &r_info[r_idx];
5405 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5413 * Process the player
5415 * Notice the annoying code to handle "pack overflow", which
5416 * must come first just in case somebody manages to corrupt
5417 * the savefiles by clever use of menu commands or something.
5419 static void process_player(void)
5423 /*** Apply energy ***/
5428 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5430 msg_print("You feel different!");
5433 (void)gain_random_mutation(0);
5434 hack_mutation = FALSE;
5437 if (p_ptr->inside_battle)
5439 for(i = 1; i < m_max; i++)
5441 monster_type *m_ptr = &m_list[i];
5443 if (!m_ptr->r_idx) continue;
5445 /* Hack -- Detect monster */
5446 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5448 /* Update the monster */
5449 update_mon(i, FALSE);
5454 /* Give the player some energy */
5455 else if (!(load && p_ptr->energy_need <= 0))
5457 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5461 if (p_ptr->energy_need > 0) return;
5462 if (!command_rep) prt_time();
5464 /*** Check for interupts ***/
5466 /* Complete resting */
5473 if ((p_ptr->chp == p_ptr->mhp) &&
5474 (p_ptr->csp >= p_ptr->msp))
5476 set_action(ACTION_NONE);
5480 /* Complete resting */
5481 else if (resting == -2)
5484 if ((p_ptr->chp == p_ptr->mhp) &&
5485 (p_ptr->csp >= p_ptr->msp) &&
5486 !p_ptr->blind && !p_ptr->confused &&
5487 !p_ptr->poisoned && !p_ptr->afraid &&
5488 !p_ptr->stun && !p_ptr->cut &&
5489 !p_ptr->slow && !p_ptr->paralyzed &&
5490 !p_ptr->image && !p_ptr->word_recall &&
5491 !p_ptr->alter_reality)
5493 set_action(ACTION_NONE);
5498 if (p_ptr->action == ACTION_FISH)
5501 Term_xtra(TERM_XTRA_DELAY, 10);
5505 bool success = FALSE;
5506 get_mon_num_prep(monster_tsuri,NULL);
5507 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5509 if (r_idx && one_in_(2))
5512 y = py+ddy[tsuri_dir];
5513 x = px+ddx[tsuri_dir];
5514 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5517 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5519 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5521 msg_format("You have a good catch!", m_name);
5529 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5531 msg_print("Damn! The fish stole your bait!");
5538 /* Handle "abort" */
5541 /* Check for "player abort" (semi-efficiently for resting) */
5542 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5547 /* Check for a key */
5556 /* Hack -- Show a Message */
5558 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5560 msg_print("Canceled.");
5567 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5569 monster_type *m_ptr = &m_list[p_ptr->riding];
5578 if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5580 /* Acquire the monster name */
5581 monster_desc(m_name, m_ptr, 0);
5583 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5585 msg_format("You have waked %s up.", m_name);
5587 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5588 p_ptr->redraw |= (PR_UHEALTH);
5595 /* Make a "saving throw" against stun */
5596 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5602 /* Hack -- Recover from stun */
5603 if (m_ptr->stunned > d)
5605 /* Recover somewhat */
5606 m_ptr->stunned -= d;
5617 /* Acquire the monster name */
5618 monster_desc(m_name, m_ptr, 0);
5620 /* Dump a message */
5622 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5624 msg_format("%^s is no longer stunned.", m_name);
5626 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5627 p_ptr->redraw |= (PR_UHEALTH);
5631 if (m_ptr->confused)
5635 /* Make a "saving throw" against stun */
5636 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5639 d = m_ptr->confused;
5642 /* Hack -- Recover from stun */
5643 if (m_ptr->confused > d)
5645 /* Recover somewhat */
5646 m_ptr->confused -= d;
5655 m_ptr->confused = 0;
5657 /* Acquire the monster name */
5658 monster_desc(m_name, m_ptr, 0);
5660 /* Dump a message */
5662 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5664 msg_format("%^s is no longer confused.", m_name);
5666 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5667 p_ptr->redraw |= (PR_UHEALTH);
5675 /* Make a "saving throw" against stun */
5676 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5682 /* Hack -- Recover from stun */
5683 if (m_ptr->monfear > d)
5685 /* Recover somewhat */
5686 m_ptr->monfear -= d;
5697 /* Acquire the monster name */
5698 monster_desc(m_name, m_ptr, 0);
5700 /* Dump a message */
5702 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5704 msg_format("%^s is no longer fear.", m_name);
5706 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5707 p_ptr->redraw |= (PR_UHEALTH);
5711 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5715 /* Handle the player song */
5716 if (!load) check_music();
5721 if (p_ptr->lightspeed)
5723 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5725 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5727 if (p_ptr->magic_num1[0] < 40)
5729 p_ptr->magic_num1[0] = 0;
5731 else p_ptr->magic_num1[0] -= 40;
5732 p_ptr->update |= (PU_BONUS);
5734 if (p_ptr->action == ACTION_LEARN)
5736 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5737 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5740 p_ptr->csp_frac = 0;
5741 set_action(ACTION_NONE);
5745 p_ptr->csp -= (s16b)(hoge >> 16);
5747 if (p_ptr->csp_frac < hoge)
5749 p_ptr->csp_frac += 0x10000L - hoge;
5753 p_ptr->csp_frac -= hoge;
5755 p_ptr->redraw |= PR_MANA;
5758 if (p_ptr->special_defense & KATA_MASK)
5760 if (p_ptr->special_defense & KATA_MUSOU)
5764 set_action(ACTION_NONE);
5769 p_ptr->redraw |= (PR_MANA);
5774 /*** Handle actual user input ***/
5776 /* Repeat until out of energy */
5777 while (p_ptr->energy_need <= 0)
5779 p_ptr->window |= PW_PLAYER;
5780 p_ptr->sutemi = FALSE;
5781 p_ptr->counter = FALSE;
5782 now_damaged = FALSE;
5784 /* Handle "p_ptr->notice" */
5787 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5790 /* Place the cursor on the player */
5791 move_cursor_relative(py, px);
5793 /* Refresh (optional) */
5794 if (fresh_before) Term_fresh();
5797 /* Hack -- Pack Overflow */
5798 if (inventory[INVEN_PACK].k_idx)
5800 int item = INVEN_PACK;
5802 char o_name[MAX_NLEN];
5806 /* Access the slot to be dropped */
5807 o_ptr = &inventory[item];
5814 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5816 msg_print("Your pack overflows!");
5821 object_desc(o_name, o_ptr, TRUE, 3);
5825 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5827 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5831 /* Drop it (carefully) near the player */
5832 (void)drop_near(o_ptr, 0, py, px);
5834 /* Modify, Describe, Optimize */
5835 inven_item_increase(item, -255);
5836 inven_item_describe(item);
5837 inven_item_optimize(item);
5839 /* Handle "p_ptr->notice" */
5842 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5847 /* Hack -- cancel "lurking browse mode" */
5848 if (!command_new) command_see = FALSE;
5851 /* Assume free turn */
5855 if (p_ptr->inside_battle)
5857 /* Place the cursor on the player */
5858 move_cursor_relative(py, px);
5860 command_cmd = SPECIAL_KEY_BUILDING;
5862 /* Process the command */
5866 /* Paralyzed or Knocked Out */
5867 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5874 else if (p_ptr->action == ACTION_REST)
5879 /* Reduce rest count */
5882 if (!resting) set_action(ACTION_NONE);
5884 /* Redraw the state */
5885 p_ptr->redraw |= (PR_STATE);
5893 else if (p_ptr->action == ACTION_FISH)
5906 /* Repeated command */
5907 else if (command_rep)
5909 /* Count this execution */
5912 /* Redraw the state */
5913 p_ptr->redraw |= (PR_STATE);
5918 /* Hack -- Assume messages were seen */
5921 /* Clear the top line */
5924 /* Process the command */
5928 /* Normal command */
5931 /* Place the cursor on the player */
5932 move_cursor_relative(py, px);
5935 /* Get a command (normal) */
5936 request_command(FALSE);
5939 /* Process the command */
5949 /* Use some energy */
5950 if (world_player || energy_use > 400)
5952 /* The Randomness is irrelevant */
5953 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5957 /* There is some randomness of needed energy */
5958 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5961 /* Hack -- constant hallucination */
5962 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5965 /* Shimmer monsters if needed */
5966 if (shimmer_monsters)
5968 /* Clear the flag */
5969 shimmer_monsters = FALSE;
5971 /* Shimmer multi-hued monsters */
5972 for (i = 1; i < m_max; i++)
5974 monster_type *m_ptr;
5975 monster_race *r_ptr;
5977 /* Access monster */
5980 /* Skip dead monsters */
5981 if (!m_ptr->r_idx) continue;
5983 /* Skip unseen monsters */
5984 if (!m_ptr->ml) continue;
5986 /* Access the monster race */
5987 r_ptr = &r_info[m_ptr->ap_r_idx];
5989 /* Skip non-multi-hued monsters */
5990 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5993 /* Reset the flag */
5994 shimmer_monsters = TRUE;
5996 /* Redraw regardless */
5997 lite_spot(m_ptr->fy, m_ptr->fx);
6002 /* Handle monster detection */
6003 if (repair_monsters)
6005 /* Reset the flag */
6006 repair_monsters = FALSE;
6008 /* Rotate detection flags */
6009 for (i = 1; i < m_max; i++)
6011 monster_type *m_ptr;
6013 /* Access monster */
6016 /* Skip dead monsters */
6017 if (!m_ptr->r_idx) continue;
6019 /* Nice monsters get mean */
6020 if (m_ptr->mflag & MFLAG_NICE)
6022 /* Nice monsters get mean */
6023 m_ptr->mflag &= ~(MFLAG_NICE);
6026 /* Handle memorized monsters */
6027 if (m_ptr->mflag2 & MFLAG2_MARK)
6029 /* Maintain detection */
6030 if (m_ptr->mflag2 & MFLAG2_SHOW)
6033 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6035 /* Still need repairs */
6036 repair_monsters = TRUE;
6039 /* Remove detection */
6043 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6045 /* Assume invisible */
6048 /* Update the monster */
6049 update_mon(i, FALSE);
6051 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6052 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6054 /* Redraw regardless */
6055 lite_spot(m_ptr->fy, m_ptr->fx);
6060 if (p_ptr->pclass == CLASS_IMITATOR)
6062 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6065 for (i = 0; i < p_ptr->mane_num; i++)
6067 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6068 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6072 p_ptr->redraw |= (PR_MANE);
6074 if (p_ptr->action == ACTION_LEARN)
6077 p_ptr->redraw |= (PR_STATE);
6080 if (world_player && (p_ptr->energy_need > - 1000))
6083 p_ptr->redraw |= (PR_MAP);
6085 /* Update monsters */
6086 p_ptr->update |= (PU_MONSTERS);
6089 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6092 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6094 msg_print("You feel time flowing around you once more.");
6097 world_player = FALSE;
6098 p_ptr->energy_need = ENERGY_NEED();
6100 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6105 /* Hack -- notice death */
6106 if (!p_ptr->playing || p_ptr->is_dead)
6108 world_player = FALSE;
6112 /* Handle "leaving" */
6113 if (p_ptr->leaving) break;
6116 /* Update scent trail */
6122 * Interact with the current dungeon level.
6124 * This function will not exit until the level is completed,
6125 * the user dies, or the game is terminated.
6127 static void dungeon(bool load_game)
6131 /* Set the base level */
6132 base_level = dun_level;
6134 /* Reset various flags */
6138 p_ptr->leaving = FALSE;
6140 /* Reset the "command" vars */
6148 /* Cancel the target */
6152 ambush_flag = FALSE;
6154 /* Cancel the health bar */
6157 /* Check visual effects */
6158 shimmer_monsters = TRUE;
6159 shimmer_objects = TRUE;
6160 repair_monsters = TRUE;
6161 repair_objects = TRUE;
6167 /* Get index of current quest (if any) */
6168 quest_num = quest_number(dun_level);
6170 /* Inside a quest? */
6173 /* Mark the quest monster */
6174 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6177 /* Track maximum player level */
6178 if (p_ptr->max_plv < p_ptr->lev)
6180 p_ptr->max_plv = p_ptr->lev;
6184 /* Track maximum dungeon level (if not in quest -KMW-) */
6185 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6187 max_dlv[dungeon_type] = dun_level;
6188 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6191 /* Validate the panel */
6192 panel_bounds_center();
6194 /* Verify the panel */
6197 /* Flush messages */
6201 /* Enter "xtra" mode */
6202 character_xtra = TRUE;
6205 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6207 /* Redraw dungeon */
6208 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6211 p_ptr->redraw |= (PR_MAP);
6214 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6216 /* Update lite/view */
6217 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6219 /* Update monsters */
6220 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6222 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6225 /* Leave "xtra" mode */
6226 character_xtra = FALSE;
6229 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6231 /* Combine / Reorder the pack */
6232 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6234 /* Handle "p_ptr->notice" */
6237 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6243 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6244 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6245 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6247 if (p_ptr->inside_battle)
6251 p_ptr->energy_need = 0;
6257 msg_print("»î¹ç³«»Ï¡ª");
6259 msg_format("Ready..Fight!");
6265 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6266 p_ptr->magic_num1[0] = MUSIC_DETECT;
6268 /* Hack -- notice death or departure */
6269 if (!p_ptr->playing || p_ptr->is_dead) return;
6271 /* Print quest message if appropriate */
6272 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6274 quest_discovery(random_quest_number(dun_level));
6275 p_ptr->inside_quest = random_quest_number(dun_level);
6277 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6279 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6281 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6282 d_name+d_info[dungeon_type].name,
6283 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6285 msg_format("%^s lives in this level as the keeper of %s.",
6286 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6287 d_name+d_info[dungeon_type].name);
6291 /*** Process this dungeon level ***/
6293 /* Reset the monster generation level */
6294 monster_level = base_level;
6296 /* Reset the object generation level */
6297 object_level = base_level;
6301 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6302 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6303 p_ptr->energy_need = 0;
6305 /* Not leaving dungeon */
6306 p_ptr->leaving_dungeon = FALSE;
6311 /* Hack -- Compact the monster list occasionally */
6312 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6314 /* Hack -- Compress the monster list occasionally */
6315 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6318 /* Hack -- Compact the object list occasionally */
6319 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6321 /* Hack -- Compress the object list occasionally */
6322 if (o_cnt + 32 < o_max) compact_objects(0);
6325 /* Process the player */
6328 /* Handle "p_ptr->notice" */
6331 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6334 /* Hack -- Hilite the player */
6335 move_cursor_relative(py, px);
6337 /* Optional fresh */
6338 if (fresh_after) Term_fresh();
6340 /* Hack -- Notice death or departure */
6341 if (!p_ptr->playing || p_ptr->is_dead) break;
6343 /* Process all of the monsters */
6346 /* Handle "p_ptr->notice" */
6349 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6352 /* Hack -- Hilite the player */
6353 move_cursor_relative(py, px);
6355 /* Optional fresh */
6356 if (fresh_after) Term_fresh();
6358 /* Hack -- Notice death or departure */
6359 if (!p_ptr->playing || p_ptr->is_dead) break;
6362 /* Process the world */
6365 /* Handle "p_ptr->notice" */
6368 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6371 /* Hack -- Hilite the player */
6372 move_cursor_relative(py, px);
6374 /* Optional fresh */
6375 if (fresh_after) Term_fresh();
6377 /* Hack -- Notice death or departure */
6378 if (!p_ptr->playing || p_ptr->is_dead) break;
6380 /* Handle "leaving" */
6381 if (p_ptr->leaving) break;
6383 /* Count game turns */
6385 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6386 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6387 if (wild_regen) wild_regen--;
6390 /* Inside a quest and non-unique questor? */
6391 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6393 /* Un-mark the quest monster */
6394 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6397 /* Not save-and-quit and not dead? */
6398 if (p_ptr->playing && !p_ptr->is_dead)
6401 * Maintain Unique monsters and artifact, save current
6402 * floor, then prepare next floor
6406 /* Forget the flag */
6407 reinit_wilderness = FALSE;
6410 /* Write about current level on the play record once per level */
6416 * Load some "user pref files"
6418 * Modified by Arcum Dagsson to support
6419 * separate macro files for different realms.
6421 static void load_all_pref_files(void)
6426 /* Access the "user" pref file */
6427 sprintf(buf, "user.prf");
6429 /* Process that file */
6430 process_pref_file(buf);
6432 /* Access the "user" system pref file */
6433 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6435 /* Process that file */
6436 process_pref_file(buf);
6438 /* Access the "race" pref file */
6439 sprintf(buf, "%s.prf", rp_ptr->title);
6441 /* Process that file */
6442 process_pref_file(buf);
6444 /* Access the "class" pref file */
6445 sprintf(buf, "%s.prf", cp_ptr->title);
6447 /* Process that file */
6448 process_pref_file(buf);
6450 /* Access the "character" pref file */
6451 sprintf(buf, "%s.prf", player_base);
6453 /* Process that file */
6454 process_pref_file(buf);
6456 /* Free old entries */
6460 sprintf(buf, "picktype-%s.prf", player_base);
6462 sprintf(buf, "pickpref-%s.prf", player_base);
6465 err = process_pickpref_file(buf);
6467 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6471 process_pickpref_file("picktype.prf");
6473 process_pickpref_file("pickpref.prf");
6477 /* Access the "realm 1" pref file */
6478 if (p_ptr->realm1 != REALM_NONE)
6480 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6482 /* Process that file */
6483 process_pref_file(buf);
6486 /* Access the "realm 2" pref file */
6487 if (p_ptr->realm2 != REALM_NONE)
6489 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6491 /* Process that file */
6492 process_pref_file(buf);
6498 * Extract option variables from bit sets
6500 void extract_option_vars(void)
6504 for (i = 0; option_info[i].o_desc; i++)
6506 int os = option_info[i].o_set;
6507 int ob = option_info[i].o_bit;
6509 /* Set the "default" options */
6510 if (option_info[i].o_var)
6513 if (option_flag[os] & (1L << ob))
6516 (*option_info[i].o_var) = TRUE;
6523 (*option_info[i].o_var) = FALSE;
6531 * Determine bounty uniques
6533 void determine_bounty_uniques(void)
6536 monster_race *r_ptr;
6538 get_mon_num_prep(NULL, NULL);
6539 for (i = 0; i < MAX_KUBI; i++)
6543 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6544 r_ptr = &r_info[kubi_r_idx[i]];
6546 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6548 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6550 if (r_ptr->rarity > 100) continue;
6552 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6554 for (j = 0; j < i; j++)
6555 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6562 for (i = 0; i < MAX_KUBI - 1; i++)
6564 for (j = i; j < MAX_KUBI; j++)
6566 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6568 tmp = kubi_r_idx[i];
6569 kubi_r_idx[i] = kubi_r_idx[j];
6570 kubi_r_idx[j] = tmp;
6578 * Determine today's bounty monster
6579 * Note: conv_old is used if loaded 0.0.3 or older save file
6581 void determine_today_mon(bool conv_old)
6584 bool old_inside_battle = p_ptr->inside_battle;
6585 monster_race *r_ptr;
6589 for (i = 0; i < max_d_idx; i++)
6591 if (max_dlv[i] < d_info[i].mindepth) continue;
6592 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6595 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6597 p_ptr->inside_battle = TRUE;
6598 get_mon_num_prep(NULL, NULL);
6602 today_mon = get_mon_num(max_dl);
6603 r_ptr = &r_info[today_mon];
6605 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6606 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
6607 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6608 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6609 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6610 if (r_ptr->rarity > 10) continue;
6614 p_ptr->today_mon = 0;
6615 p_ptr->inside_battle = old_inside_battle;
6620 * Actually play a game
6622 * If the "new_game" parameter is true, then, after loading the
6623 * savefile, we will commit suicide, if necessary, to allow the
6624 * player to start a new game.
6626 void play_game(bool new_game)
6629 bool load_game = TRUE;
6639 hack_mutation = FALSE;
6641 /* Hack -- Character is "icky" */
6642 character_icky = TRUE;
6644 /* Make sure main term is active */
6645 Term_activate(angband_term[0]);
6647 /* Initialise the resize hooks */
6648 angband_term[0]->resize_hook = resize_map;
6650 for (i = 1; i < 8; i++)
6652 /* Does the term exist? */
6653 if (angband_term[i])
6655 /* Add the redraw on resize hook */
6656 angband_term[i]->resize_hook = redraw_window;
6660 /* Hack -- turn off the cursor */
6661 (void)Term_set_cursor(0);
6664 /* Attempt to load */
6669 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6671 quit("broken savefile");
6676 /* Extract the options */
6677 extract_option_vars();
6679 /* Report waited score */
6680 if (p_ptr->wait_report_score)
6686 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6688 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6693 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6698 p_ptr->is_dead = TRUE;
6700 start_time = time(NULL);
6702 /* No suspending now */
6703 signals_ignore_tstp();
6705 /* Hack -- Character is now "icky" */
6706 character_icky = TRUE;
6708 /* Build the filename */
6709 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6711 /* Open the high score file, for reading/writing */
6712 highscore_fd = fd_open(buf, O_RDWR);
6714 /* Handle score, show Top scores */
6715 success = send_world_score(TRUE);
6718 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6720 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6724 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6726 prt("standing by for future registration...", 0, 0);
6732 p_ptr->wait_report_score = FALSE;
6735 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6737 if (!save_player()) msg_print("death save failed!");
6740 /* Shut the high score file */
6741 (void)fd_close(highscore_fd);
6743 /* Forget the high score fd */
6746 /* Allow suspending now */
6747 signals_handle_tstp();
6752 /* Nothing loaded */
6753 if (!character_loaded)
6755 /* Make new player */
6758 /* The dungeon is not ready */
6759 character_dungeon = FALSE;
6761 /* Prepare to init the RNG */
6764 /* Initialize the saved floors data */
6765 init_saved_floors();
6768 /* Old game is loaded. But new game is requested. */
6771 /* Delete expanded temporal files */
6772 clear_saved_floor_files();
6775 /* Process old character */
6778 /* Process the player name */
6779 process_player_name(FALSE);
6788 seed = (time(NULL));
6792 /* Mutate the seed on Unix machines */
6793 seed = ((seed >> 3) * (getpid() << 1));
6797 /* Use the complex RNG */
6800 /* Seed the "complex" RNG */
6801 Rand_state_init(seed);
6804 /* Roll new character */
6807 /* The dungeon is not ready */
6808 character_dungeon = FALSE;
6812 p_ptr->inside_quest = 0;
6813 p_ptr->inside_arena = FALSE;
6814 p_ptr->inside_battle = FALSE;
6818 /* Hack -- seed for flavors */
6819 seed_flavor = randint0(0x10000000);
6821 /* Hack -- seed for town layout */
6822 seed_town = randint0(0x10000000);
6824 /* Roll up a new character */
6831 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6833 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6838 determine_bounty_uniques();
6839 determine_today_mon(FALSE);
6843 write_level = FALSE;
6846 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6848 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6852 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6853 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6855 if (p_ptr->riding == -1)
6858 for (i = m_max; i > 0; i--)
6860 if (player_bold(m_list[i].fy, m_list[i].fx))
6869 p_ptr->teleport_town = FALSE;
6870 p_ptr->sutemi = FALSE;
6871 world_monster = FALSE;
6872 now_damaged = FALSE;
6874 start_time = time(NULL) - 1;
6875 record_o_name[0] = '\0';
6877 /* Reset map panel */
6878 panel_row_min = cur_hgt;
6879 panel_col_min = cur_wid;
6881 /* Sexy gal gets bonus to maximum weapon skill of whip */
6882 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6883 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6885 /* Fill the arrays of floors and walls in the good proportions */
6886 set_floor_and_wall(dungeon_type);
6888 /* Flavor the objects */
6896 /* Flash a message */
6898 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6900 prt("Please wait...", 0, 0);
6904 /* Flush the message */
6908 /* Hack -- Enter wizard mode */
6911 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6912 else if (p_ptr->is_dead) quit("Already dead.");
6915 /* Initialize the town-buildings if necessary */
6916 if (!dun_level && !p_ptr->inside_quest)
6918 /* Init the wilderness */
6920 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6923 init_flags = INIT_ONLY_BUILDINGS;
6925 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6930 /* Generate a dungeon level if needed */
6931 if (!character_dungeon) change_floor();
6934 /* Character is now "complete" */
6935 character_generated = TRUE;
6938 /* Hack -- Character is no longer "icky" */
6939 character_icky = FALSE;
6943 p_ptr->playing = TRUE;
6945 /* Reset the visual mappings */
6948 /* Load the "pref" files */
6949 load_all_pref_files();
6951 /* React to changes */
6952 Term_xtra(TERM_XTRA_REACT, 0);
6955 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6958 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6964 /* Set or clear "rogue_like_commands" if requested */
6965 if (arg_force_original) rogue_like_commands = FALSE;
6966 if (arg_force_roguelike) rogue_like_commands = TRUE;
6968 /* Hack -- Enforce "delayed death" */
6969 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6971 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6973 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6975 monster_type *m_ptr;
6976 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6977 monster_race *r_ptr = &r_info[pet_r_idx];
6978 place_monster_aux(0, py, px - 1, pet_r_idx,
6979 (PM_FORCE_PET | PM_NO_KAGE));
6980 m_ptr = &m_list[hack_m_idx_ii];
6981 m_ptr->mspeed = r_ptr->speed;
6982 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6983 m_ptr->max_maxhp = m_ptr->maxhp;
6984 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6985 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6991 /* Process the level */
6994 /* Handle "p_ptr->notice" */
6997 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7000 /* Cancel the target */
7003 /* Cancel the health bar */
7007 /* Forget the lite */
7010 /* Forget the view */
7013 /* Forget the view */
7016 /* Handle "quit and save" */
7017 if (!p_ptr->playing && !p_ptr->is_dead) break;
7019 /* Erase the old cave */
7021 if (!p_ptr->is_dead) wipe_m_list();
7029 /* Accidental Death */
7030 if (p_ptr->playing && p_ptr->is_dead)
7032 if (p_ptr->inside_arena)
7034 p_ptr->inside_arena = FALSE;
7035 if (p_ptr->arena_number > MAX_ARENA_MONS)
7036 p_ptr->arena_number++;
7038 p_ptr->arena_number = -1 - p_ptr->arena_number;
7039 p_ptr->is_dead = FALSE;
7041 p_ptr->chp_frac = 0;
7042 p_ptr->exit_bldg = TRUE;
7047 /* Mega-Hack -- Allow player to cheat death */
7049 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7051 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7055 /* Mark social class, reset age, if needed */
7056 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7062 p_ptr->noscore |= 0x0001;
7066 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7068 msg_print("You invoke wizard mode and cheat death.");
7074 /* Restore hit points */
7075 p_ptr->chp = p_ptr->mhp;
7076 p_ptr->chp_frac = 0;
7078 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7080 for (i = 0; i < EATER_EXT*2; i++)
7082 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7084 for (; i < EATER_EXT*3; i++)
7086 p_ptr->magic_num1[i] = 0;
7089 /* Restore spell points */
7090 p_ptr->csp = p_ptr->msp;
7091 p_ptr->csp_frac = 0;
7093 /* Hack -- Healing */
7095 (void)set_confused(0);
7096 (void)set_poisoned(0);
7097 (void)set_afraid(0);
7098 (void)set_paralyzed(0);
7103 /* Hack -- Prevent starvation */
7104 (void)set_food(PY_FOOD_MAX - 1);
7106 /* Hack -- cancel recall */
7107 if (p_ptr->word_recall)
7111 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7113 msg_print("A tension leaves the air around you...");
7118 /* Hack -- Prevent recall */
7119 p_ptr->word_recall = 0;
7120 p_ptr->redraw |= (PR_STATUS);
7123 /* Hack -- cancel alter */
7124 if (p_ptr->alter_reality)
7126 /* Hack -- Prevent alter */
7127 p_ptr->alter_reality = 0;
7128 p_ptr->redraw |= (PR_STATUS);
7131 /* Note cause of death XXX XXX XXX */
7133 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7135 (void)strcpy(p_ptr->died_from, "Cheating death");
7140 p_ptr->is_dead = FALSE;
7143 p_ptr->inside_arena = FALSE;
7144 p_ptr->inside_battle = FALSE;
7146 p_ptr->inside_quest = 0;
7147 p_ptr->recall_dungeon = dungeon_type;
7149 if (lite_town || vanilla_town)
7151 p_ptr->wilderness_y = 1;
7152 p_ptr->wilderness_x = 1;
7166 p_ptr->wilderness_y = 48;
7167 p_ptr->wilderness_x = 5;
7173 p_ptr->wild_mode = FALSE;
7174 p_ptr->leaving = TRUE;
7177 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7179 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7185 /* Handle "death" */
7186 if (p_ptr->is_dead) break;
7188 /* Make a new level */
7199 s32b turn_real(s32b hoge)
7201 switch (p_ptr->start_race)
7207 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);