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) &&
1210 (player_has_los_bold(m_ptr->fy, m_ptr->fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
1212 /* We may wake up */
1221 /* Hack -- handle non-aggravation */
1222 if (!(p_ptr->cursed & TRC_AGGRAVATE)) notice = randint0(1024);
1224 /* Nightmare monsters are more alert */
1225 if (ironman_nightmare) notice /= 2;
1227 /* Hack -- See if monster "notices" player */
1228 if ((notice * notice * notice) <= noise)
1230 /* Hack -- amount of "waking" */
1233 /* Hack -- handle aggravation */
1234 if (p_ptr->cursed & TRC_AGGRAVATE)
1240 /* Wake up faster near the player */
1241 if (m_ptr->cdis < AAF_LIMIT / 2) d = (AAF_LIMIT / m_ptr->cdis);
1243 /* Hack -- amount of "waking" is affected by speed of player */
1244 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1249 if (m_ptr->csleep > d)
1251 /* Monster wakes up "a little bit" */
1254 /* Notice the "not waking up" */
1257 /* Hack -- Count the ignores */
1258 if (r_ptr->r_ignore < MAX_UCHAR)
1268 /* Reset sleep counter */
1271 /* Notice the "waking up" */
1276 /* Acquire the monster name */
1277 monster_desc(m_name, m_ptr, 0);
1279 /* Dump a message */
1281 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1283 msg_format("%^s wakes up.", m_name);
1286 /* Redraw the health bar */
1287 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1288 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1290 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
1291 p_ptr->update |= (PU_MON_LITE);
1293 /* Hack -- Count the wakings */
1294 if (r_ptr->r_wake < MAX_UCHAR)
1309 /* Make a "saving throw" against stun */
1310 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1316 /* Hack -- Recover from stun */
1317 if (m_ptr->stunned > d)
1319 /* Recover somewhat */
1320 m_ptr->stunned -= d;
1329 /* Message if visible */
1334 /* Acquire the monster name */
1335 monster_desc(m_name, m_ptr, 0);
1337 /* Dump a message */
1339 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1341 msg_format("%^s is no longer stunned.", m_name);
1344 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1345 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1350 /* Handle confusion */
1351 if (m_ptr->confused)
1353 /* Amount of "boldness" */
1354 int d = randint1(r_ptr->level / 20 + 1);
1356 /* Still confused */
1357 if (m_ptr->confused > d)
1359 /* Reduce the confusion */
1360 m_ptr->confused -= d;
1366 /* No longer confused */
1367 m_ptr->confused = 0;
1369 /* Message if visible */
1374 /* Acquire the monster name */
1375 monster_desc(m_name, m_ptr, 0);
1377 /* Dump a message */
1379 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1381 msg_format("%^s is no longer confused.", m_name);
1384 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1385 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1393 /* Amount of "boldness" */
1394 int d = randint1(r_ptr->level / 20 + 1);
1397 if (m_ptr->monfear > d)
1399 /* Reduce the fear */
1400 m_ptr->monfear -= d;
1403 /* Recover from fear, take note if seen */
1406 /* No longer afraid */
1415 /* Acquire the monster name/poss */
1416 monster_desc(m_name, m_ptr, 0);
1417 monster_desc(m_poss, m_ptr, 0x22);
1419 /* Dump a message */
1421 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1423 msg_format("%^s recovers %s courage.", m_name, m_poss);
1426 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1427 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1435 static void notice_lite_change(object_type *o_ptr)
1437 /* Hack -- notice interesting fuel steps */
1438 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1441 p_ptr->window |= (PW_EQUIP);
1444 /* Hack -- Special treatment when blind */
1447 /* Hack -- save some light for later */
1448 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1451 /* The light is now out */
1452 else if (o_ptr->xtra4 == 0)
1456 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1458 msg_print("Your light has gone out!");
1460 p_ptr->update |= (PU_BONUS);
1463 /* The light is getting dim */
1464 else if (o_ptr->name2 == EGO_LITE_LONG)
1466 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1467 && (turn % (TURNS_PER_TICK*2)))
1469 if (disturb_minor) disturb(0, 0);
1471 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1473 msg_print("Your light is growing faint.");
1479 /* The light is getting dim */
1480 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1482 if (disturb_minor) disturb(0, 0);
1484 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1486 msg_print("Your light is growing faint.");
1493 void leave_quest_check(void)
1495 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1496 leaving_quest = p_ptr->inside_quest;
1498 /* Leaving an 'only once' quest marks it as failed */
1499 if (leaving_quest &&
1500 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1501 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1503 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1504 quest[leaving_quest].complev = (byte)p_ptr->lev;
1505 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1507 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1508 if (record_rand_quest)
1509 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1511 /* Floor of random quest will be blocked */
1512 prepare_change_floor_mode(CFM_NO_RETURN);
1514 else if (record_fix_quest)
1515 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1521 * Forcibly pseudo-identify an object in the inventory
1524 * note: currently this function allows pseudo-id of any object,
1525 * including silly ones like potions & scrolls, which always
1526 * get '{average}'. This should be changed, either to stop such
1527 * items from being pseudo-id'd, or to allow psychometry to
1528 * detect whether the unidentified potion/scroll/etc is
1529 * good (Cure Light Wounds, Restore Strength, etc) or
1530 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1532 bool psychometry(void)
1536 char o_name[MAX_NLEN];
1542 item_tester_no_ryoute = TRUE;
1545 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1546 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1548 q = "Meditate on which item? ";
1549 s = "You have nothing appropriate.";
1552 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1554 /* Get the item (in the pack) */
1557 o_ptr = &inventory[item];
1560 /* Get the item (on the floor) */
1563 o_ptr = &o_list[0 - item];
1566 /* It is fully known, no information needed */
1567 if (object_known_p(o_ptr))
1570 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1572 msg_print("You cannot find out anything more about that.");
1578 /* Check for a feeling */
1579 feel = value_check_aux1(o_ptr);
1581 /* Get an object description */
1582 object_desc(o_name, o_ptr, FALSE, 0);
1584 /* Skip non-feelings */
1588 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1590 msg_format("You do not perceive anything unusual about the %s.", o_name);
1597 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1598 o_name, game_inscriptions[feel]);
1600 msg_format("You feel that the %s %s %s...",
1601 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1602 game_inscriptions[feel]);
1606 /* We have "felt" it */
1607 o_ptr->ident |= (IDENT_SENSE);
1610 o_ptr->feeling = feel;
1612 /* Combine / Reorder the pack (later) */
1613 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1616 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1618 /* Valid "tval" codes */
1619 switch (o_ptr->tval)
1647 /* Auto-inscription/destroy */
1648 idx = is_autopick(o_ptr);
1649 auto_inscribe_item(item, idx);
1650 if (okay && destroy_feeling)
1651 auto_destroy_item(item, idx);
1653 /* Something happened */
1658 static void gere_music(s32b music)
1666 stun_monsters(damroll(p_ptr->lev/10,2));
1669 hp_player(damroll(2,6));
1672 project_hack(GF_TURN_ALL, p_ptr->lev);
1675 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1678 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1681 confuse_monsters(p_ptr->lev * 2);
1684 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1687 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1690 project(0, 0, py, px,
1691 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1694 dispel_monsters(randint1(p_ptr->lev * 3));
1695 dispel_evil(randint1(p_ptr->lev * 3));
1702 earthquake(py, px, 10);
1705 stasis_monsters(p_ptr->lev * 4);
1708 dispel_monsters(randint1(p_ptr->lev * 3));
1711 hp_player(damroll(15,10));
1715 case MUSIC_DETECT+19:
1717 case MUSIC_DETECT+11:
1718 case MUSIC_DETECT+12:
1719 case MUSIC_DETECT+13:
1720 case MUSIC_DETECT+14:
1721 case MUSIC_DETECT+15:
1722 case MUSIC_DETECT+16:
1723 case MUSIC_DETECT+17:
1724 case MUSIC_DETECT+18:
1725 map_area(DETECT_RAD_MAP);
1726 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1727 case MUSIC_DETECT+6:
1728 case MUSIC_DETECT+7:
1729 case MUSIC_DETECT+8:
1730 case MUSIC_DETECT+9:
1731 case MUSIC_DETECT+10:
1732 /* There are too many hidden treasure. So... */
1733 /* detect_treasure(DETECT_RAD_DEFAULT); */
1734 detect_objects_gold(DETECT_RAD_DEFAULT);
1735 detect_objects_normal(DETECT_RAD_DEFAULT);
1736 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1737 case MUSIC_DETECT+3:
1738 case MUSIC_DETECT+4:
1739 case MUSIC_DETECT+5:
1740 detect_monsters_invis(DETECT_RAD_DEFAULT);
1741 detect_monsters_normal(DETECT_RAD_DEFAULT);
1742 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1744 case MUSIC_DETECT+1:
1745 case MUSIC_DETECT+2:
1746 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1747 detect_doors(DETECT_RAD_DEFAULT);
1748 detect_stairs(DETECT_RAD_DEFAULT);
1749 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1755 * If player has inscribed the object with "!!", let him know when it's
1758 static void recharged_notice(object_type *o_ptr)
1760 char o_name[MAX_NLEN];
1764 /* No inscription */
1765 if (!o_ptr->inscription) return;
1768 s = strchr(quark_str(o_ptr->inscription), '!');
1770 /* Process notification request. */
1773 /* Find another '!' */
1776 /* Describe (briefly) */
1777 object_desc(o_name, o_ptr, FALSE, 0);
1779 /* Notify the player */
1781 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1783 if (o_ptr->number > 1)
1784 msg_format("Your %s are recharged.", o_name);
1786 msg_format("Your %s is recharged.", o_name);
1795 /* Keep looking for '!'s */
1796 s = strchr(s + 1, '!');
1801 static void check_music(void)
1807 /* Music singed by player */
1808 if (p_ptr->pclass != CLASS_BARD) return;
1809 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1811 spell = p_ptr->magic_num2[0];
1812 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1814 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1815 need_mana *= 0x8000;
1816 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1823 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1824 need_mana = (need_mana & 0xffff);
1825 if ((u32b)p_ptr->csp_frac < need_mana)
1828 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1832 p_ptr->csp_frac -= (u16b)need_mana;
1835 p_ptr->redraw |= PR_MANA;
1836 if (p_ptr->magic_num1[1])
1838 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1839 p_ptr->magic_num1[1] = 0;
1841 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1843 msg_print("You restart singing.");
1845 p_ptr->action = ACTION_SING;
1847 /* Recalculate bonuses */
1848 p_ptr->update |= (PU_BONUS | PU_HP);
1850 /* Redraw map and status bar */
1851 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1853 /* Update monsters */
1854 p_ptr->update |= (PU_MONSTERS);
1857 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1860 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1861 p_ptr->spell_exp[spell] += 5;
1862 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1863 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1864 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1865 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1866 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1867 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1869 gere_music(p_ptr->magic_num1[0]);
1872 /* Choose one of items that have cursed flag */
1873 static object_type *choose_cursed_obj_name(u32b flag)
1876 int choices[INVEN_TOTAL-INVEN_RARM];
1879 /* Paranoia -- Player has no warning-item */
1880 if (!(p_ptr->cursed & flag)) return NULL;
1882 /* Search Inventry */
1883 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1885 object_type *o_ptr = &inventory[i];
1887 if (o_ptr->curse_flags & flag)
1889 choices[number] = i;
1894 /* Choice one of them */
1895 return (&inventory[choices[randint0(number)]]);
1900 * Handle certain things once every 10 game turns
1902 static void process_world(void)
1906 bool cave_no_regen = FALSE;
1907 int upkeep_factor = 0;
1912 const int dec_count = (easy_band ? 2 : 1);
1914 int day, hour, min, prev_min;
1916 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1917 s32b tick = turn % len + len / 4;
1919 int quest_num = quest_number(dun_level);
1921 extract_day_hour_min(&day, &hour, &min);
1922 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1924 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1926 !(quest_num && (is_fixed_quest_idx(quest_num) &&
1927 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
1928 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
1929 !p_ptr->inside_battle)
1932 if (p_ptr->inside_battle && !p_ptr->leaving)
1939 /* Count all hostile monsters */
1940 for (i2 = 0; i2 < cur_wid; ++i2)
1941 for (j2 = 0; j2 < cur_hgt; j2++)
1942 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1945 win_m_idx = cave[j2][i2].m_idx;
1948 if (number_mon == 0)
1951 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1953 msg_print("They have kill each other at the same time.");
1956 p_ptr->energy_need = 0;
1959 else if ((number_mon-1) == 0)
1962 monster_type *wm_ptr;
1964 wm_ptr = &m_list[win_m_idx];
1966 monster_desc(m_name, wm_ptr, 0);
1968 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1970 msg_format("%s is winner!", m_name);
1974 if (win_m_idx == (sel_monster+1))
1977 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1979 msg_print("Congratulations.");
1982 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1984 msg_format("You received %d gold.", battle_odds);
1986 p_ptr->au += battle_odds;
1991 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1993 msg_print("You lost gold.");
1997 p_ptr->energy_need = 0;
2000 else if(turn - old_turn == 150*TURNS_PER_TICK)
2003 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
2005 msg_format("This battle have ended in a draw.");
2007 p_ptr->au += kakekin;
2009 p_ptr->energy_need = 0;
2014 /* Every 10 game turns */
2015 if (turn % TURNS_PER_TICK) return;
2017 /*** Check the Time and Load ***/
2019 if (!(turn % (50*TURNS_PER_TICK)))
2021 /* Check time and load */
2022 if ((0 != check_time()) || (0 != check_load()))
2025 if (closing_flag <= 2)
2030 /* Count warnings */
2035 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2036 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2038 msg_print("The gates to ANGBAND are closing...");
2039 msg_print("Please finish up and/or save your game.");
2049 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2051 msg_print("The gates to ANGBAND are now closed.");
2056 p_ptr->playing = FALSE;
2059 p_ptr->leaving = TRUE;
2064 /*** Attempt timed autosave ***/
2065 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2067 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2068 do_cmd_save_game(TRUE);
2074 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2076 msg_print("You hear noise.");
2080 /*** Handle the wilderness/town (sunshine) ***/
2082 /* While in town/wilderness */
2083 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2085 /* Hack -- Daybreak/Nighfall in town */
2086 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2090 /* Check for dawn */
2091 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2098 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2100 msg_print("The sun has risen.");
2104 /* Hack -- Scan the town */
2105 for (y = 0; y < cur_hgt; y++)
2107 for (x = 0; x < cur_wid; x++)
2109 /* Get the cave grid */
2110 c_ptr = &cave[y][x];
2113 c_ptr->info |= (CAVE_GLOW);
2115 /* Hack -- Memorize lit grids if allowed */
2116 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2118 /* Hack -- Notice spot */
2129 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2131 msg_print("The sun has fallen.");
2135 /* Hack -- Scan the town */
2136 for (y = 0; y < cur_hgt; y++)
2138 for (x = 0; x < cur_wid; x++)
2140 /* Get the cave grid */
2141 c_ptr = &cave[y][x];
2143 /* Darken "boring" features */
2144 if ((c_ptr->feat <= FEAT_INVIS) ||
2145 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
2146 (c_ptr->feat <= FEAT_MOUNTAIN) &&
2147 (c_ptr->feat != FEAT_MUSEUM)) ||
2148 (x == 0) || (x == cur_wid-1) ||
2149 (y == 0) || (y == cur_hgt-1))
2151 /* Forget the grid */
2152 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
2154 /* Hack -- Notice spot */
2159 /* Glow deep lava */
2164 /* Update the monsters */
2165 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2168 p_ptr->redraw |= (PR_MAP);
2171 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2175 /* Set back the rewards once a day */
2176 /* Only used for reward in thief's guild for now */
2177 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2181 /* Reset the rewards */
2182 for (n = 0; n < MAX_BACT; n++)
2184 p_ptr->rewards[n] = FALSE;
2189 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2191 if (cheat_xtra) msg_print("Rewards reset.");
2197 /*** Process the monsters ***/
2199 /* Check for creature generation. */
2200 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2201 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2203 /* Make a new monster */
2204 (void)alloc_monster(MAX_SIGHT + 5, 0);
2207 /* Hack -- Check for creature regeneration */
2208 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2209 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2211 /* Hack -- Process the counters of all monsters */
2212 process_monsters_counters();
2215 /*** Damage over Time ***/
2217 /* Take damage from poison */
2218 if (p_ptr->poisoned && !IS_INVULN())
2222 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2224 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2230 /* (Vampires) Take damage from sunlight */
2231 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2233 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2235 if (cave[py][px].info & CAVE_GLOW)
2239 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2240 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2242 msg_print("The sun's rays scorch your undead flesh!");
2243 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2246 cave_no_regen = TRUE;
2250 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2251 !p_ptr->resist_lite)
2253 object_type * o_ptr = &inventory[INVEN_LITE];
2254 char o_name [MAX_NLEN];
2255 char ouch [MAX_NLEN+40];
2257 /* Get an object description */
2258 object_desc(o_name, o_ptr, FALSE, 0);
2261 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2263 msg_format("The %s scorches your undead flesh!", o_name);
2267 cave_no_regen = TRUE;
2269 /* Get an object description */
2270 object_desc(o_name, o_ptr, TRUE, 0);
2273 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2275 sprintf(ouch, "wielding %s", o_name);
2278 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2282 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2283 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2285 int damage = 3000 + randint0(2000);
2287 if (prace_is_(RACE_ENT)) damage += damage/3;
2288 if (p_ptr->resist_fire) damage = damage / 3;
2289 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2290 damage = damage / 100 + (randint0(100) < (damage % 100));
2296 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2297 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2299 msg_print("The lava burns you!");
2300 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2303 cave_no_regen = TRUE;
2307 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2308 !IS_INVULN() && !p_ptr->immune_fire)
2310 int damage = 6000 + randint0(4000);
2315 if (p_ptr->resist_fire) damage = damage / 3;
2316 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2320 damage = damage / 5;
2323 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2324 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2326 message = "The heat burns you!";
2327 hit_from = "flying over deep lava";
2334 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2335 hit_from = "¿¼¤¤ÍÏ´äή";
2337 message = "The lava burns you!";
2338 hit_from = "deep lava";
2343 damage = damage / 100 + (randint0(100) < (damage % 100));
2348 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2350 cave_no_regen = TRUE;
2354 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2356 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2360 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2361 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2363 msg_print("You are drowning!");
2364 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2367 cave_no_regen = TRUE;
2374 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2376 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2377 if (prace_is_(RACE_ENT)) damage += damage / 3;
2378 if (p_ptr->resist_fire) damage = damage / 3;
2379 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2381 msg_print("Ç®¤¤¡ª");
2382 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2384 msg_print("It's hot!");
2385 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2388 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2390 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2391 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2392 if (p_ptr->resist_elec) damage = damage / 3;
2393 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2395 msg_print("Äˤ¤¡ª");
2396 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2398 msg_print("It hurts!");
2399 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2402 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2404 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2405 if (p_ptr->resist_cold) damage = damage / 3;
2406 if (IS_OPPOSE_COLD()) damage = damage / 3;
2408 msg_print("Î䤿¤¤¡ª");
2409 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2411 msg_print("It's cold!");
2412 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2417 /* Spectres -- take damage when moving through walls */
2419 * Added: ANYBODY takes damage if inside through walls
2420 * without wraith form -- NOTE: Spectres will never be
2421 * reduced below 0 hp by being inside a stone wall; others
2424 if (!cave_floor_bold(py, px))
2426 /* Player can walk through trees */
2427 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2431 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2432 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2436 cave_no_regen = TRUE;
2438 if (p_ptr->pass_wall)
2441 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2444 msg_print("Your molecules feel disrupted!");
2445 dam_desc = "density";
2452 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2453 dam_desc = "¹Å¤¤´ä";
2455 msg_print("You are being crushed!");
2456 dam_desc = "solid rock";
2461 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2467 monster_race *r_ptr;
2469 if (min != prev_min)
2472 bool old_inside_battle = p_ptr->inside_battle;
2474 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2476 p_ptr->inside_battle = TRUE;
2477 get_mon_num_prep(NULL,NULL);
2479 for (i = 0; i < max_d_idx; i++)
2481 if (max_dlv[i] < d_info[i].mindepth) continue;
2482 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2486 today_mon = get_mon_num(max_dl);
2487 r_ptr = &r_info[today_mon];
2489 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2490 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2491 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2492 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2493 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2494 if (r_ptr->rarity > 10) continue;
2495 if (r_ptr->level == 0) continue;
2498 p_ptr->today_mon = 0;
2499 p_ptr->inside_battle = old_inside_battle;
2503 /* Nightmare mode activates the TY_CURSE at midnight */
2504 if (ironman_nightmare)
2506 /* Require exact minute */
2507 if (min != prev_min)
2509 /* Every 15 minutes after 11:00 pm */
2510 if ((hour == 23) && !(min % 15))
2520 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2522 msg_print("You hear a distant bell toll ominously.");
2530 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2532 msg_print("A distant bell sounds twice.");
2540 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2542 msg_print("A distant bell sounds three times.");
2550 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2552 msg_print("A distant bell tolls four times.");
2560 /* TY_CURSE activates at mignight! */
2567 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2569 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2572 activate_ty_curse(FALSE, &count);
2577 /* Take damage from cuts */
2578 if (p_ptr->cut && !IS_INVULN())
2580 /* Mortal wound or Deep Gash */
2581 if (p_ptr->cut > 1000)
2586 else if (p_ptr->cut > 200)
2592 else if (p_ptr->cut > 100)
2597 else if (p_ptr->cut > 50)
2602 else if (p_ptr->cut > 25)
2607 else if (p_ptr->cut > 10)
2620 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2622 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2628 /*** Check the Food, and Regenerate ***/
2630 if (!p_ptr->inside_battle)
2632 /* Digest normally */
2633 if (p_ptr->food < PY_FOOD_MAX)
2635 /* Every 50 game turns */
2636 if (!(turn % (TURNS_PER_TICK*5)))
2638 /* Basic digestion rate based on speed */
2639 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2641 /* Regeneration takes more food */
2642 if (p_ptr->regenerate) i += 20;
2643 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2644 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2646 /* Slow digestion takes less food */
2647 if (p_ptr->slow_digest) i -= 5;
2649 /* Minimal digestion */
2651 /* Maximal digestion */
2652 if (i > 100) i = 100;
2654 /* Digest some food */
2655 (void)set_food(p_ptr->food - i);
2659 /* Digest quickly when gorged */
2662 /* Digest a lot of food */
2663 (void)set_food(p_ptr->food - 100);
2667 /* Starve to death (slowly) */
2668 if (p_ptr->food < PY_FOOD_STARVE)
2670 /* Calculate damage */
2671 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2675 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2677 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2682 /* Default regeneration */
2683 regen_amount = PY_REGEN_NORMAL;
2686 if (p_ptr->food < PY_FOOD_WEAK)
2688 /* Lower regeneration */
2689 if (p_ptr->food < PY_FOOD_STARVE)
2693 else if (p_ptr->food < PY_FOOD_FAINT)
2695 regen_amount = PY_REGEN_FAINT;
2699 regen_amount = PY_REGEN_WEAK;
2703 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2705 /* Faint occasionally */
2706 if (!p_ptr->paralyzed && (randint0(100) < 10))
2710 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2712 msg_print("You faint from the lack of food.");
2717 /* Hack -- faint (bypass free action) */
2718 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2724 /* Are we walking the pattern? */
2725 if (pattern_effect())
2727 cave_no_regen = TRUE;
2731 /* Regeneration ability */
2732 if (p_ptr->regenerate)
2734 regen_amount = regen_amount * 2;
2736 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2740 if (p_ptr->cursed & TRC_SLOW_REGEN)
2747 /* Searching or Resting */
2748 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2750 regen_amount = regen_amount * 2;
2753 upkeep_factor = calculate_upkeep();
2755 /* Regenerate the mana */
2756 /* if (p_ptr->csp < p_ptr->msp) */
2760 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2761 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2762 regenmana(upkeep_regen/100);
2764 #ifdef TRACK_FRIENDS
2768 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2770 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2774 #endif /* TRACK_FRIENDS */
2777 else if (p_ptr->action != ACTION_LEARN)
2779 regenmana(regen_amount);
2782 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2784 regenmagic(regen_amount);
2787 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2789 while (upkeep_factor > 100)
2792 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2794 msg_print("Such much pets cannot be controled at once!");
2797 do_cmd_pet_dismiss();
2799 upkeep_factor = calculate_upkeep();
2802 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2804 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2810 /* Poisoned or cut yields no healing */
2811 if (p_ptr->poisoned) regen_amount = 0;
2812 if (p_ptr->cut) regen_amount = 0;
2814 /* Special floor -- Pattern, in a wall -- yields no healing */
2815 if (cave_no_regen) regen_amount = 0;
2817 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2819 /* Regenerate Hit Points if needed */
2820 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2822 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2823 (cave[py][px].feat >= FEAT_PATTERN_START))
2825 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2829 regenhp(regen_amount);
2834 /*** Timeout Various Things ***/
2837 if (p_ptr->tim_mimic)
2839 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2842 /* Hack -- Hallucinating */
2845 (void)set_image(p_ptr->image - dec_count);
2851 (void)set_blind(p_ptr->blind - dec_count);
2854 /* Times see-invisible */
2855 if (p_ptr->tim_invis)
2857 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2868 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2871 /* Timed temporary elemental brands. -LM- */
2872 if (p_ptr->ele_attack)
2874 p_ptr->ele_attack--;
2876 /* Clear all temporary elemental brands. */
2877 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2880 /* Timed temporary elemental immune. -LM- */
2881 if (p_ptr->ele_immune)
2883 p_ptr->ele_immune--;
2885 /* Clear all temporary elemental brands. */
2886 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2889 /* Timed infra-vision */
2890 if (p_ptr->tim_infra)
2892 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2896 if (p_ptr->tim_stealth)
2898 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2901 /* Timed levitation */
2902 if (p_ptr->tim_ffall)
2904 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2907 /* Timed sh_touki */
2908 if (p_ptr->tim_sh_touki)
2910 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2914 if (p_ptr->tim_sh_fire)
2916 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2920 if (p_ptr->tim_sh_holy)
2922 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2926 if (p_ptr->tim_eyeeye)
2928 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2931 /* Timed resist-magic */
2932 if (p_ptr->resist_magic)
2934 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2937 /* Timed regeneration */
2938 if (p_ptr->tim_regen)
2940 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2943 /* Timed resist nether */
2944 if (p_ptr->tim_res_nether)
2946 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2949 /* Timed resist time */
2950 if (p_ptr->tim_res_time)
2952 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2956 if (p_ptr->tim_reflect)
2958 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2962 if (p_ptr->multishadow)
2964 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2967 /* Timed Robe of dust */
2968 if (p_ptr->dustrobe)
2970 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2973 /* Timed infra-vision */
2974 if (p_ptr->kabenuke)
2976 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2980 if (p_ptr->paralyzed)
2982 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2986 if (p_ptr->confused)
2988 (void)set_confused(p_ptr->confused - dec_count);
2994 (void)set_afraid(p_ptr->afraid - dec_count);
3000 (void)set_fast(p_ptr->fast - 1, TRUE);
3006 (void)set_slow(p_ptr->slow - dec_count, TRUE);
3009 /* Protection from evil */
3010 if (p_ptr->protevil)
3012 (void)set_protevil(p_ptr->protevil - 1, TRUE);
3015 /* Invulnerability */
3018 (void)set_invuln(p_ptr->invuln - 1, TRUE);
3022 if (p_ptr->wraith_form)
3024 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3030 (void)set_hero(p_ptr->hero - 1, TRUE);
3036 (void)set_shero(p_ptr->shero - 1, TRUE);
3042 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3048 (void)set_shield(p_ptr->shield - 1, TRUE);
3052 if (p_ptr->tsubureru)
3054 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3058 if (p_ptr->magicdef)
3060 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3064 if (p_ptr->tsuyoshi)
3066 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3070 if (p_ptr->oppose_acid)
3072 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3075 /* Oppose Lightning */
3076 if (p_ptr->oppose_elec)
3078 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3082 if (p_ptr->oppose_fire)
3084 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3088 if (p_ptr->oppose_cold)
3090 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3094 if (p_ptr->oppose_pois)
3096 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3101 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3104 /*** Poison and Stun and Cut ***/
3107 if (p_ptr->poisoned)
3109 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3111 /* Apply some healing */
3112 (void)set_poisoned(p_ptr->poisoned - adjust);
3118 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3120 /* Apply some healing */
3121 (void)set_stun(p_ptr->stun - adjust);
3127 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3129 /* Hack -- Truly "mortal" wound */
3130 if (p_ptr->cut > 1000) adjust = 0;
3132 /* Apply some healing */
3133 (void)set_cut(p_ptr->cut - adjust);
3138 /*** Process Light ***/
3140 /* Check for light being wielded */
3141 o_ptr = &inventory[INVEN_LITE];
3143 /* Burn some fuel in the current lite */
3144 if (o_ptr->tval == TV_LITE)
3146 /* Hack -- Use some fuel (except on artifacts) */
3147 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3149 /* Decrease life-span */
3150 if (o_ptr->name2 == EGO_LITE_LONG)
3152 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3154 else o_ptr->xtra4--;
3156 /* Notice interesting fuel steps */
3157 notice_lite_change(o_ptr);
3161 /* Calculate torch radius */
3162 p_ptr->update |= (PU_TORCH);
3165 /*** Process mutation effects ***/
3166 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3168 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3172 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3173 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3175 msg_print("RAAAAGHH!");
3176 msg_print("You feel a fit of rage coming over you!");
3179 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3182 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3184 if (!p_ptr->resist_fear)
3188 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3190 msg_print("It's so dark... so scary!");
3193 set_afraid(p_ptr->afraid + 13 + randint1(26));
3197 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3199 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3204 /* Teleport player */
3206 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3208 msg_print("Your position suddenly seems very uncertain...");
3212 teleport_player(40);
3216 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3218 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3221 p_ptr->redraw |= PR_EXTRA;
3223 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3225 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3230 if (!p_ptr->resist_conf)
3232 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3235 if (!p_ptr->resist_chaos)
3240 if (one_in_(3)) lose_all_info();
3242 teleport_player(100);
3245 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3246 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3248 msg_print("You wake up somewhere with a sore head...");
3249 msg_print("You can't remember a thing, or how you got here!");
3258 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3260 msg_print("Thishcischs GooDSChtuff!");
3263 (void)set_image(p_ptr->image + randint0(150) + 150);
3269 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3271 if (!p_ptr->resist_chaos)
3274 p_ptr->redraw |= PR_EXTRA;
3275 (void)set_image(p_ptr->image + randint0(50) + 20);
3279 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3284 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3286 msg_print("BRRAAAP! Oops.");
3290 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3293 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3294 !p_ptr->anti_magic && one_in_(9000))
3299 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3301 msg_print("Magical energy flows through you! You must release it!");
3306 (void)get_hack_dir(&dire);
3307 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3310 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3311 !p_ptr->anti_magic && (randint1(6666) == 666))
3313 bool pet = one_in_(6);
3314 u32b mode = PM_ALLOW_GROUP;
3316 if (pet) mode |= PM_FORCE_PET;
3317 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3319 if (summon_specific((pet ? -1 : 0), py, px,
3320 dun_level, SUMMON_DEMON, mode))
3323 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3325 msg_print("You have attracted a demon!");
3332 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3338 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3340 msg_print("You feel less energetic.");
3343 if (p_ptr->fast > 0)
3349 set_slow(randint1(30) + 10, FALSE);
3355 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3357 msg_print("You feel more energetic.");
3360 if (p_ptr->slow > 0)
3366 set_fast(randint1(30) + 10, FALSE);
3371 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3375 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3377 msg_print("You suddenly feel almost lonely.");
3380 banish_monsters(100);
3381 if (!dun_level && p_ptr->town_num)
3384 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3386 msg_print("You see one of the shopkeepers running for the hills!");
3389 store_shuffle(randint0(MAX_STORES));
3394 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3399 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3401 msg_print("A shadow passes over you.");
3406 /* Absorb light from the current possition */
3407 if (cave[py][px].info & CAVE_GLOW)
3412 o_ptr = &inventory[INVEN_LITE];
3414 /* Absorb some fuel in the current lite */
3415 if (o_ptr->tval == TV_LITE)
3417 /* Use some fuel (except on artifacts) */
3418 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3420 /* Heal the player a bit */
3421 hp_player(o_ptr->xtra4 / 20);
3423 /* Decrease life-span of lite */
3427 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3429 msg_print("You absorb energy from your light!");
3433 /* Notice interesting fuel steps */
3434 notice_lite_change(o_ptr);
3439 * Unlite the area (radius 10) around player and
3440 * do 50 points damage to every affected monster
3442 unlite_area(50, 10);
3445 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3446 !p_ptr->anti_magic && one_in_(7000))
3448 bool pet = one_in_(3);
3449 u32b mode = PM_ALLOW_GROUP;
3451 if (pet) mode |= PM_FORCE_PET;
3452 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3454 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3457 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3459 msg_print("You have attracted an animal!");
3466 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3467 !p_ptr->anti_magic && one_in_(8000))
3471 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3473 msg_print("You feel the world warping around you!");
3477 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3479 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3481 if (!lose_mutation(0))
3483 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3485 msg_print("You feel oddly normal.");
3489 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3493 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3495 msg_print("You feel insubstantial!");
3499 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3501 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3505 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3507 int which_stat = randint0(6);
3508 int sustained = FALSE;
3513 if (p_ptr->sustain_str) sustained = TRUE;
3516 if (p_ptr->sustain_int) sustained = TRUE;
3519 if (p_ptr->sustain_wis) sustained = TRUE;
3522 if (p_ptr->sustain_dex) sustained = TRUE;
3525 if (p_ptr->sustain_con) sustained = TRUE;
3528 if (p_ptr->sustain_chr) sustained = TRUE;
3532 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3534 msg_print("Invalid stat chosen!");
3544 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3546 msg_print("You can feel yourself wasting away!");
3550 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3553 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3554 !p_ptr->anti_magic && one_in_(3000))
3556 bool pet = one_in_(5);
3557 u32b mode = PM_ALLOW_GROUP;
3559 if (pet) mode |= PM_FORCE_PET;
3560 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3562 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3565 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3567 msg_print("You have attracted a dragon!");
3573 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3576 if (p_ptr->tim_esp > 0)
3579 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3581 msg_print("Your mind feels cloudy!");
3584 set_tim_esp(0, TRUE);
3589 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3591 msg_print("Your mind expands!");
3594 set_tim_esp(p_ptr->lev, FALSE);
3597 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3602 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3604 msg_print("Your stomach roils, and you lose your lunch!");
3608 set_food(PY_FOOD_WEAK);
3611 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3612 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3617 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3619 int danger_amount = 0;
3622 for (monster = 0; monster < m_max; monster++)
3624 monster_type *m_ptr = &m_list[monster];
3625 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3627 /* Paranoia -- Skip dead monsters */
3628 if (!m_ptr->r_idx) continue;
3630 if (r_ptr->level >= p_ptr->lev)
3632 danger_amount += r_ptr->level - p_ptr->lev + 1;
3636 if (danger_amount > 100)
3638 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3640 msg_print("You feel utterly terrified!");
3643 else if (danger_amount > 50)
3645 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3647 msg_print("You feel terrified!");
3650 else if (danger_amount > 20)
3652 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3654 msg_print("You feel very worried!");
3657 else if (danger_amount > 10)
3659 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3661 msg_print("You feel paranoid!");
3664 else if (danger_amount > 5)
3666 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3668 msg_print("You feel almost safe.");
3673 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3675 msg_print("You feel lonely.");
3679 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3684 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3686 msg_print("You feel invincible!");
3690 (void)set_invuln(randint1(8) + 8, FALSE);
3692 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3694 int wounds = p_ptr->mhp - p_ptr->chp;
3698 int healing = p_ptr->csp;
3700 if (healing > wounds)
3706 p_ptr->csp -= healing;
3709 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3712 int wounds = p_ptr->msp - p_ptr->csp;
3716 int healing = p_ptr->chp;
3718 if (healing > wounds)
3723 p_ptr->csp += healing;
3725 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3727 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3732 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3738 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3739 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3741 msg_print("You trip over your own feet!");
3742 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3747 if (buki_motteruka(INVEN_RARM))
3749 int slot = INVEN_RARM;
3750 o_ptr = &inventory[INVEN_RARM];
3751 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3753 o_ptr = &inventory[INVEN_LARM];
3756 if (!cursed_p(o_ptr))
3759 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3761 msg_print("You drop your weapon!");
3764 inven_drop(slot, 1);
3771 /*** Process Inventory ***/
3773 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3776 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3777 * can actually be useful!
3779 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3782 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3784 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3788 teleport_player(50);
3791 /* Make a chainsword noise */
3792 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3796 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3798 if (!get_rnd_line("chainswd.txt", 0, noise))
3801 disturb(FALSE, FALSE);
3804 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3807 (void)activate_ty_curse(FALSE, &count);
3809 /* Handle experience draining */
3810 if (p_ptr->prace != RACE_ANDROID &&
3811 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3813 p_ptr->exp -= (p_ptr->lev+1)/2;
3814 if (p_ptr->exp < 0) p_ptr->exp = 0;
3815 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3816 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3819 /* Add light curse (Later) */
3820 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3825 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3827 new_curse = get_curse(0, o_ptr);
3828 if (!(o_ptr->curse_flags & new_curse))
3830 char o_name[MAX_NLEN];
3832 object_desc(o_name, o_ptr, FALSE, 0);
3834 o_ptr->curse_flags |= new_curse;
3836 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3838 msg_format("There is a malignant black aura surrounding %s...", o_name);
3841 o_ptr->feeling = FEEL_NONE;
3843 p_ptr->update |= (PU_BONUS);
3846 /* Add heavy curse (Later) */
3847 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3852 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3854 new_curse = get_curse(1, o_ptr);
3855 if (!(o_ptr->curse_flags & new_curse))
3857 char o_name[MAX_NLEN];
3859 object_desc(o_name, o_ptr, FALSE, 0);
3861 o_ptr->curse_flags |= new_curse;
3863 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3865 msg_format("There is a malignant black aura surrounding %s...", o_name);
3868 o_ptr->feeling = FEEL_NONE;
3870 p_ptr->update |= (PU_BONUS);
3874 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3876 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3877 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3879 char o_name[MAX_NLEN];
3881 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3883 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3885 msg_format("%s have attracted an animal!", o_name);
3892 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3894 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3896 char o_name[MAX_NLEN];
3898 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3900 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3902 msg_format("%s have attracted a demon!", o_name);
3909 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3911 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3912 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3914 char o_name[MAX_NLEN];
3916 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3918 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3920 msg_format("%s have attracted an animal!", o_name);
3926 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3928 if (!p_ptr->resist_fear)
3932 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3934 msg_print("It's so dark... so scary!");
3937 set_afraid(p_ptr->afraid + 13 + randint1(26));
3940 /* Teleport player */
3941 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3945 /* Teleport player */
3946 teleport_player(40);
3948 /* Handle HP draining */
3949 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3951 char o_name[MAX_NLEN];
3953 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3955 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3957 msg_format("%s drains HP from you!", o_name);
3959 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3961 /* Handle mana draining */
3962 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3964 char o_name[MAX_NLEN];
3966 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3968 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3970 msg_format("%s drains mana from you!", o_name);
3972 p_ptr->csp -= MIN(p_ptr->lev, 50);
3976 p_ptr->csp_frac = 0;
3978 p_ptr->redraw |= PR_MANA;
3982 /* Rarely, take damage from the Jewel of Judgement */
3983 if (one_in_(999) && !p_ptr->anti_magic)
3985 object_type *o_ptr = &inventory[INVEN_LITE];
3987 if (o_ptr->name1 == ART_JUDGE)
3990 if (object_known_p(o_ptr))
3991 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3993 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3994 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3996 if (object_known_p(o_ptr))
3997 msg_print("The Jewel of Judgement drains life from you!");
3999 msg_print("Something drains life from you!");
4000 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
4006 /* Process equipment */
4007 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
4009 /* Get the object */
4010 o_ptr = &inventory[i];
4012 /* Skip non-objects */
4013 if (!o_ptr->k_idx) continue;
4015 /* Recharge activatable objects */
4016 if (o_ptr->timeout > 0)
4021 /* Notice changes */
4022 if (!o_ptr->timeout)
4024 recharged_notice(o_ptr);
4030 /* Notice changes */
4034 p_ptr->window |= (PW_EQUIP);
4039 * Recharge rods. Rods now use timeout to control charging status,
4040 * and each charging rod in a stack decreases the stack's timeout by
4041 * one per turn. -LM-
4043 for (j = 0, i = 0; i < INVEN_PACK; i++)
4045 o_ptr = &inventory[i];
4046 k_ptr = &k_info[o_ptr->k_idx];
4048 /* Skip non-objects */
4049 if (!o_ptr->k_idx) continue;
4051 /* Examine all charging rods or stacks of charging rods. */
4052 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4054 /* Determine how many rods are charging. */
4055 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4056 if (temp > o_ptr->number) temp = o_ptr->number;
4058 /* Decrease timeout by that number. */
4059 o_ptr->timeout -= temp;
4061 /* Boundary control. */
4062 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4064 /* Notice changes, provide message if object is inscribed. */
4065 if (!(o_ptr->timeout))
4067 recharged_notice(o_ptr);
4073 /* Notice changes */
4077 p_ptr->notice |= (PN_COMBINE);
4080 p_ptr->window |= (PW_INVEN);
4084 /* Feel the inventory */
4089 /*** Process Objects ***/
4091 /* Process objects */
4092 for (i = 1; i < o_max; i++)
4097 /* Skip dead objects */
4098 if (!o_ptr->k_idx) continue;
4100 /* Recharge rods on the ground. No messages. */
4101 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4104 o_ptr->timeout -= o_ptr->number;
4106 /* Boundary control. */
4107 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4112 /*** Involuntary Movement ***/
4114 /* Delayed Word-of-Recall */
4115 if (p_ptr->word_recall)
4118 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4119 * The player is yanked up/down as soon as
4120 * he loads the autosaved game.
4122 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4123 do_cmd_save_game(TRUE);
4125 /* Count down towards recall */
4126 p_ptr->word_recall--;
4128 p_ptr->redraw |= (PR_STATUS);
4130 /* Activate the recall */
4131 if (!p_ptr->word_recall)
4136 /* Determine the level */
4137 if (dun_level || p_ptr->inside_quest)
4140 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4142 msg_print("You feel yourself yanked upwards!");
4145 p_ptr->recall_dungeon = dungeon_type;
4147 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4151 prepare_change_floor_mode(CFM_CLEAR_ALL);
4153 leave_quest_check();
4155 p_ptr->inside_quest = 0;
4156 p_ptr->leaving = TRUE;
4161 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4163 msg_print("You feel yourself yanked downwards!");
4166 dungeon_type = p_ptr->recall_dungeon;
4169 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4172 dun_level = max_dlv[dungeon_type];
4173 if (dun_level < 1) dun_level = 1;
4175 /* Nightmare mode makes recall more dangerous */
4176 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4182 else if (dun_level < 99)
4184 dun_level = (dun_level + 99) / 2;
4186 else if (dun_level > 100)
4188 dun_level = d_info[dungeon_type].maxdepth - 1;
4192 if (p_ptr->wild_mode)
4194 p_ptr->wilderness_y = py;
4195 p_ptr->wilderness_x = px;
4199 /* Save player position */
4203 p_ptr->wild_mode = FALSE;
4205 prepare_change_floor_mode(CFM_CLEAR_ALL);
4208 p_ptr->leaving = TRUE;
4210 if (dungeon_type == DUNGEON_ANGBAND)
4212 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4214 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4215 (quest[i].status == QUEST_STATUS_TAKEN) &&
4216 (quest[i].level < dun_level))
4218 quest[i].status = QUEST_STATUS_FAILED;
4219 quest[i].complev = (byte)p_ptr->lev;
4220 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4227 sound(SOUND_TPLEVEL);
4232 /* Delayed Alter reality */
4233 if (p_ptr->alter_reality)
4235 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4236 do_cmd_save_game(TRUE);
4238 /* Count down towards alter */
4239 p_ptr->alter_reality--;
4241 p_ptr->redraw |= (PR_STATUS);
4243 /* Activate the alter reality */
4244 if (!p_ptr->alter_reality)
4249 /* Determine the level */
4250 if (!quest_number(dun_level) && dun_level)
4253 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4255 msg_print("The world changes!");
4258 prepare_change_floor_mode(CFM_CLEAR_ALL);
4261 p_ptr->leaving = TRUE;
4266 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4268 msg_print("The world seems to change for a moment!");
4273 sound(SOUND_TPLEVEL);
4281 * Verify use of "wizard" mode
4283 static bool enter_wizard_mode(void)
4285 /* Ask first time */
4286 if (!p_ptr->noscore)
4288 /* Wizard mode is not permitted */
4289 if (!allow_debug_opts)
4292 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4294 msg_print("Wizard mode is not permitted.");
4299 /* Mention effects */
4301 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4302 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4304 msg_print("Wizard mode is for debugging and experimenting.");
4305 msg_print("The game will not be scored if you enter wizard mode.");
4310 /* Verify request */
4312 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4314 if (!get_check("Are you sure you want to enter wizard mode? "))
4321 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4323 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4326 p_ptr->noscore |= 0x0002;
4337 * Verify use of "debug" commands
4339 static bool enter_debug_mode(void)
4341 /* Ask first time */
4342 if (!p_ptr->noscore)
4344 /* Debug mode is not permitted */
4345 if (!allow_debug_opts)
4348 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4350 msg_print("Use of debug command is not permitted.");
4355 /* Mention effects */
4357 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4358 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4360 msg_print("The debug commands are for debugging and experimenting.");
4361 msg_print("The game will not be scored if you use debug commands.");
4366 /* Verify request */
4368 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4370 if (!get_check("Are you sure you want to use debug commands? "))
4377 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4379 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4382 p_ptr->noscore |= 0x0008;
4390 * Hack -- Declare the Debug Routines
4392 extern void do_cmd_debug(void);
4394 #endif /* ALLOW_WIZARD */
4400 * Verify use of "borg" commands
4402 static bool enter_borg_mode(void)
4404 /* Ask first time */
4405 if (!(p_ptr->noscore & 0x0010))
4407 /* Mention effects */
4409 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4410 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4412 msg_print("The borg commands are for debugging and experimenting.");
4413 msg_print("The game will not be scored if you use borg commands.");
4418 /* Verify request */
4420 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4422 if (!get_check("Are you sure you want to use borg commands? "))
4429 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4431 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4434 p_ptr->noscore |= 0x0010;
4442 * Hack -- Declare the Ben Borg
4444 extern void do_cmd_borg(void);
4446 #endif /* ALLOW_BORG */
4451 * Parse and execute the current command
4452 * Give "Warning" on illegal commands.
4454 * XXX XXX XXX Make some "blocks"
4456 static void process_command(void)
4458 int old_now_message = now_message;
4460 #ifdef ALLOW_REPEAT /* TNB */
4462 /* Handle repeating the last command */
4465 #endif /* ALLOW_REPEAT -- TNB */
4469 /* Parse the command */
4470 switch (command_cmd)
4486 /*** Wizard Commands ***/
4488 /* Toggle Wizard Mode */
4493 p_ptr->wizard = FALSE;
4495 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4497 msg_print("Wizard mode off.");
4501 else if (enter_wizard_mode())
4503 p_ptr->wizard = TRUE;
4505 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4507 msg_print("Wizard mode on.");
4512 /* Update monsters */
4513 p_ptr->update |= (PU_MONSTERS);
4515 /* Redraw "title" */
4516 p_ptr->redraw |= (PR_TITLE);
4524 /* Special "debug" commands */
4527 /* Enter debug mode */
4528 if (enter_debug_mode())
4535 #endif /* ALLOW_WIZARD */
4540 /* Special "borg" commands */
4543 /* Enter borg mode */
4544 if (enter_borg_mode())
4546 if (!p_ptr->wild_mode) do_cmd_borg();
4552 #endif /* ALLOW_BORG */
4556 /*** Inventory Commands ***/
4558 /* Wear/wield equipment */
4561 if (!p_ptr->wild_mode) do_cmd_wield();
4565 /* Take off equipment */
4568 if (!p_ptr->wild_mode) do_cmd_takeoff();
4575 if (!p_ptr->wild_mode) do_cmd_drop();
4579 /* Destroy an item */
4586 /* Equipment list */
4593 /* Inventory list */
4601 /*** Various commands ***/
4603 /* Identify an object */
4610 /* Hack -- toggle windows */
4613 toggle_inven_equip();
4618 /*** Standard "Movement" Commands ***/
4623 if (!p_ptr->wild_mode) do_cmd_alter();
4630 if (!p_ptr->wild_mode) do_cmd_tunnel();
4634 /* Move (usually pick up things) */
4637 #ifdef ALLOW_EASY_DISARM /* TNB */
4641 #else /* ALLOW_EASY_DISARM -- TNB */
4643 do_cmd_walk(always_pickup);
4645 #endif /* ALLOW_EASY_DISARM -- TNB */
4650 /* Move (usually do not pick up) */
4653 #ifdef ALLOW_EASY_DISARM /* TNB */
4657 #else /* ALLOW_EASY_DISARM -- TNB */
4659 do_cmd_walk(!always_pickup);
4661 #endif /* ALLOW_EASY_DISARM -- TNB */
4667 /*** Running, Resting, Searching, Staying */
4669 /* Begin Running -- Arg is Max Distance */
4672 if (!p_ptr->wild_mode) do_cmd_run();
4676 /* Stay still (usually pick things up) */
4679 do_cmd_stay(always_pickup);
4683 /* Stay still (usually do not pick up) */
4686 do_cmd_stay(!always_pickup);
4690 /* Rest -- Arg is time */
4697 /* Search for traps/doors */
4704 /* Toggle search mode */
4707 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4708 else set_action(ACTION_SEARCH);
4713 /*** Stairs and Doors and Chests and Traps ***/
4716 case SPECIAL_KEY_STORE:
4718 if (!p_ptr->wild_mode) do_cmd_store();
4722 /* Enter building -KMW- */
4723 case SPECIAL_KEY_BUILDING:
4725 if (!p_ptr->wild_mode) do_cmd_bldg();
4729 /* Enter quest level -KMW- */
4730 case SPECIAL_KEY_QUEST:
4732 if (!p_ptr->wild_mode) do_cmd_quest();
4736 /* Go up staircase */
4739 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4746 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4748 msg_print("To flee the ambush you have to reach the edge of the map.");
4751 else if (p_ptr->food < PY_FOOD_WEAK)
4754 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4756 msg_print("You must eat something here.");
4761 if (change_wild_mode())
4774 /* Go down staircase */
4777 if(!p_ptr->wild_mode) do_cmd_go_down();
4780 p_ptr->wilderness_x = px;
4781 p_ptr->wilderness_y = py;
4787 /* Open a door or chest */
4790 if (!p_ptr->wild_mode) do_cmd_open();
4797 if (!p_ptr->wild_mode) do_cmd_close();
4801 /* Jam a door with spikes */
4804 if (!p_ptr->wild_mode) do_cmd_spike();
4811 if (!p_ptr->wild_mode) do_cmd_bash();
4815 /* Disarm a trap or chest */
4818 if (!p_ptr->wild_mode) do_cmd_disarm();
4823 /*** Magic and Prayers ***/
4825 /* Gain new spells/prayers */
4828 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4830 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4832 msg_print("You don't have to learn spells!");
4834 else if (p_ptr->pclass == CLASS_SAMURAI)
4835 do_cmd_gain_hissatsu();
4836 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4846 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4847 (p_ptr->pclass == CLASS_BERSERKER) ||
4848 (p_ptr->pclass == CLASS_NINJA) ||
4849 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4850 ) do_cmd_mind_browse();
4851 else if (p_ptr->pclass == CLASS_SMITH)
4853 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4854 do_cmd_magic_eater(TRUE);
4855 else do_cmd_browse();
4863 if (!p_ptr->wild_mode)
4865 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4868 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4870 msg_print("You cannot cast spells!");
4873 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4876 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4878 msg_print("The dungeon absorbs all attempted magic!");
4882 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4886 cptr which_power = "ËâË¡";
4888 cptr which_power = "magic";
4890 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4892 which_power = "ĶǽÎÏ";
4894 which_power = "psionic powers";
4896 else if (p_ptr->pclass == CLASS_IMITATOR)
4898 which_power = "¤â¤Î¤Þ¤Í";
4900 which_power = "imitation";
4902 else if (p_ptr->pclass == CLASS_SAMURAI)
4904 which_power = "ɬ»¦·õ";
4906 which_power = "hissatsu";
4908 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4910 which_power = "¶ÀËâË¡";
4912 which_power = "mirror magic";
4914 else if (p_ptr->pclass == CLASS_NINJA)
4916 which_power = "Ǧ½Ñ";
4918 which_power = "ninjutsu";
4920 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4922 which_power = "µ§¤ê";
4924 which_power = "prayer";
4928 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4930 msg_format("An anti-magic shell disrupts your %s!", which_power);
4934 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4937 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4939 msg_format("You cannot think directly!");
4945 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4946 (p_ptr->pclass == CLASS_BERSERKER) ||
4947 (p_ptr->pclass == CLASS_NINJA) ||
4948 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4951 else if (p_ptr->pclass == CLASS_IMITATOR)
4953 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4954 do_cmd_magic_eater(FALSE);
4955 else if (p_ptr->pclass == CLASS_SAMURAI)
4957 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4958 do_cmd_cast_learned();
4959 else if (p_ptr->pclass == CLASS_SMITH)
4968 /* Issue a pet command */
4971 if (!p_ptr->wild_mode) do_cmd_pet();
4975 /*** Use various objects ***/
4977 /* Inscribe an object */
4984 /* Uninscribe an object */
4987 do_cmd_uninscribe();
4991 /* Activate an artifact */
4994 if (!p_ptr->wild_mode)
4996 if (!p_ptr->inside_arena)
5001 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5003 msg_print("The arena absorbs all attempted magic!");
5019 /* Fuel your lantern/torch */
5029 if (!p_ptr->wild_mode) do_cmd_fire();
5036 if (!p_ptr->wild_mode)
5046 if (!p_ptr->wild_mode)
5048 if (!p_ptr->inside_arena)
5053 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5055 msg_print("The arena absorbs all attempted magic!");
5067 if (!p_ptr->wild_mode)
5069 if (p_ptr->inside_arena)
5072 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5074 msg_print("The arena absorbs all attempted magic!");
5079 else if (use_command && rogue_like_commands)
5091 /* Quaff a potion */
5094 if (!p_ptr->wild_mode)
5096 if (!p_ptr->inside_arena)
5097 do_cmd_quaff_potion();
5101 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5103 msg_print("The arena absorbs all attempted magic!");
5115 if (!p_ptr->wild_mode)
5117 if (!p_ptr->inside_arena)
5118 do_cmd_read_scroll();
5122 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5124 msg_print("The arena absorbs all attempted magic!");
5136 if (!p_ptr->wild_mode)
5138 if (p_ptr->inside_arena)
5141 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5143 msg_print("The arena absorbs all attempted magic!");
5148 else if (use_command && !rogue_like_commands)
5158 /* Use racial power */
5161 if (!p_ptr->wild_mode) do_cmd_racial_power();
5166 /*** Looking at Things (nearby or on map) ***/
5168 /* Full dungeon map */
5175 /* Locate player on map */
5189 /* Target monster or location */
5192 if (!p_ptr->wild_mode) do_cmd_target();
5198 /*** Help and Such ***/
5207 /* Identify symbol */
5210 do_cmd_query_symbol();
5214 /* Character description */
5217 do_cmd_change_name();
5222 /*** System Commands ***/
5224 /* Hack -- User interface */
5231 /* Single line from a pref file */
5246 do_cmd_edit_autopick();
5250 /* Interact with macros */
5257 /* Interact with visuals */
5265 /* Interact with colors */
5273 /* Interact with options */
5281 /*** Misc Commands ***/
5297 /* Repeat level feeling */
5300 if (!p_ptr->wild_mode) do_cmd_feeling();
5304 /* Show previous message */
5307 do_cmd_message_one();
5311 /* Show previous messages */
5314 do_cmd_messages(old_now_message);
5318 /* Show quest status -KMW- */
5321 do_cmd_checkquest();
5325 /* Redraw the screen */
5328 now_message = old_now_message;
5333 #ifndef VERIFY_SAVEFILE
5335 /* Hack -- Save and don't quit */
5338 do_cmd_save_game(FALSE);
5342 #endif /* VERIFY_SAVEFILE */
5352 case SPECIAL_KEY_QUIT:
5354 do_cmd_save_and_exit();
5358 /* Quit (commit suicide) */
5371 /* Check artifacts, uniques, objects */
5378 /* Load "screen dump" */
5381 do_cmd_load_screen();
5385 /* Save "screen dump" */
5388 do_cmd_save_screen();
5392 /* Make random artifact list */
5395 spoil_random_artifact("randifact.txt");
5399 /* Hack -- Unknown command */
5402 if (flush_failure) flush();
5406 sound(SOUND_ILLEGAL);
5408 if (!get_rnd_line("error_j.txt", 0, error_m))
5410 if (!get_rnd_line("error.txt", 0, error_m))
5417 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5419 prt("Type '?' for help.", 0, 0);
5425 if (!energy_use && !now_message)
5426 now_message = old_now_message;
5432 static bool monster_tsuri(int r_idx)
5434 monster_race *r_ptr = &r_info[r_idx];
5436 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5444 * Process the player
5446 * Notice the annoying code to handle "pack overflow", which
5447 * must come first just in case somebody manages to corrupt
5448 * the savefiles by clever use of menu commands or something.
5450 static void process_player(void)
5454 /*** Apply energy ***/
5459 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5461 msg_print("You feel different!");
5464 (void)gain_random_mutation(0);
5465 hack_mutation = FALSE;
5468 if (p_ptr->inside_battle)
5470 for(i = 1; i < m_max; i++)
5472 monster_type *m_ptr = &m_list[i];
5474 if (!m_ptr->r_idx) continue;
5476 /* Hack -- Detect monster */
5477 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5479 /* Update the monster */
5480 update_mon(i, FALSE);
5485 /* Give the player some energy */
5486 else if (!(load && p_ptr->energy_need <= 0))
5488 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5492 if (p_ptr->energy_need > 0) return;
5493 if (!command_rep) prt_time();
5495 /*** Check for interupts ***/
5497 /* Complete resting */
5504 if ((p_ptr->chp == p_ptr->mhp) &&
5505 (p_ptr->csp >= p_ptr->msp))
5507 set_action(ACTION_NONE);
5511 /* Complete resting */
5512 else if (resting == -2)
5515 if ((p_ptr->chp == p_ptr->mhp) &&
5516 (p_ptr->csp >= p_ptr->msp) &&
5517 !p_ptr->blind && !p_ptr->confused &&
5518 !p_ptr->poisoned && !p_ptr->afraid &&
5519 !p_ptr->stun && !p_ptr->cut &&
5520 !p_ptr->slow && !p_ptr->paralyzed &&
5521 !p_ptr->image && !p_ptr->word_recall &&
5522 !p_ptr->alter_reality)
5524 set_action(ACTION_NONE);
5529 if (p_ptr->action == ACTION_FISH)
5532 Term_xtra(TERM_XTRA_DELAY, 10);
5536 bool success = FALSE;
5537 get_mon_num_prep(monster_tsuri,NULL);
5538 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5540 if (r_idx && one_in_(2))
5543 y = py+ddy[tsuri_dir];
5544 x = px+ddx[tsuri_dir];
5545 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5548 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5550 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5552 msg_format("You have a good catch!", m_name);
5560 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5562 msg_print("Damn! The fish stole your bait!");
5569 /* Handle "abort" */
5572 /* Check for "player abort" (semi-efficiently for resting) */
5573 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5578 /* Check for a key */
5587 /* Hack -- Show a Message */
5589 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5591 msg_print("Canceled.");
5598 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5600 monster_type *m_ptr = &m_list[p_ptr->riding];
5609 /* Acquire the monster name */
5610 monster_desc(m_name, m_ptr, 0);
5612 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5614 msg_format("You have waked %s up.", m_name);
5616 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5617 p_ptr->redraw |= (PR_UHEALTH);
5624 /* Make a "saving throw" against stun */
5625 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5631 /* Hack -- Recover from stun */
5632 if (m_ptr->stunned > d)
5634 /* Recover somewhat */
5635 m_ptr->stunned -= d;
5646 /* Acquire the monster name */
5647 monster_desc(m_name, m_ptr, 0);
5649 /* Dump a message */
5651 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5653 msg_format("%^s is no longer stunned.", m_name);
5655 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5656 p_ptr->redraw |= (PR_UHEALTH);
5660 if (m_ptr->confused)
5664 /* Make a "saving throw" against stun */
5665 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5668 d = m_ptr->confused;
5671 /* Hack -- Recover from stun */
5672 if (m_ptr->confused > d)
5674 /* Recover somewhat */
5675 m_ptr->confused -= d;
5684 m_ptr->confused = 0;
5686 /* Acquire the monster name */
5687 monster_desc(m_name, m_ptr, 0);
5689 /* Dump a message */
5691 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5693 msg_format("%^s is no longer confused.", m_name);
5695 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5696 p_ptr->redraw |= (PR_UHEALTH);
5704 /* Make a "saving throw" against stun */
5705 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5711 /* Hack -- Recover from stun */
5712 if (m_ptr->monfear > d)
5714 /* Recover somewhat */
5715 m_ptr->monfear -= d;
5726 /* Acquire the monster name */
5727 monster_desc(m_name, m_ptr, 0);
5729 /* Dump a message */
5731 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5733 msg_format("%^s is no longer fear.", m_name);
5735 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5736 p_ptr->redraw |= (PR_UHEALTH);
5740 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5744 /* Handle the player song */
5745 if (!load) check_music();
5750 if (p_ptr->lightspeed)
5752 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5754 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5756 if (p_ptr->magic_num1[0] < 40)
5758 p_ptr->magic_num1[0] = 0;
5760 else p_ptr->magic_num1[0] -= 40;
5761 p_ptr->update |= (PU_BONUS);
5763 if (p_ptr->action == ACTION_LEARN)
5765 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5766 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5769 p_ptr->csp_frac = 0;
5770 set_action(ACTION_NONE);
5774 p_ptr->csp -= (s16b)(hoge >> 16);
5776 if (p_ptr->csp_frac < hoge)
5778 p_ptr->csp_frac += 0x10000L - hoge;
5782 p_ptr->csp_frac -= hoge;
5784 p_ptr->redraw |= PR_MANA;
5787 if (p_ptr->special_defense & KATA_MASK)
5789 if (p_ptr->special_defense & KATA_MUSOU)
5793 set_action(ACTION_NONE);
5798 p_ptr->redraw |= (PR_MANA);
5803 /*** Handle actual user input ***/
5805 /* Repeat until out of energy */
5806 while (p_ptr->energy_need <= 0)
5808 p_ptr->window |= PW_PLAYER;
5809 p_ptr->sutemi = FALSE;
5810 p_ptr->counter = FALSE;
5811 now_damaged = FALSE;
5813 /* Handle "p_ptr->notice" */
5816 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5819 /* Place the cursor on the player */
5820 move_cursor_relative(py, px);
5822 /* Refresh (optional) */
5823 if (fresh_before) Term_fresh();
5826 /* Hack -- Pack Overflow */
5827 if (inventory[INVEN_PACK].k_idx)
5829 int item = INVEN_PACK;
5831 char o_name[MAX_NLEN];
5835 /* Access the slot to be dropped */
5836 o_ptr = &inventory[item];
5843 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5845 msg_print("Your pack overflows!");
5850 object_desc(o_name, o_ptr, TRUE, 3);
5854 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5856 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5860 /* Drop it (carefully) near the player */
5861 (void)drop_near(o_ptr, 0, py, px);
5863 /* Modify, Describe, Optimize */
5864 inven_item_increase(item, -255);
5865 inven_item_describe(item);
5866 inven_item_optimize(item);
5868 /* Handle "p_ptr->notice" */
5871 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5876 /* Hack -- cancel "lurking browse mode" */
5877 if (!command_new) command_see = FALSE;
5880 /* Assume free turn */
5884 if (p_ptr->inside_battle)
5886 /* Place the cursor on the player */
5887 move_cursor_relative(py, px);
5889 command_cmd = SPECIAL_KEY_BUILDING;
5891 /* Process the command */
5895 /* Paralyzed or Knocked Out */
5896 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5903 else if (p_ptr->action == ACTION_REST)
5908 /* Reduce rest count */
5911 if (!resting) set_action(ACTION_NONE);
5913 /* Redraw the state */
5914 p_ptr->redraw |= (PR_STATE);
5922 else if (p_ptr->action == ACTION_FISH)
5935 /* Repeated command */
5936 else if (command_rep)
5938 /* Count this execution */
5941 /* Redraw the state */
5942 p_ptr->redraw |= (PR_STATE);
5947 /* Hack -- Assume messages were seen */
5950 /* Clear the top line */
5953 /* Process the command */
5957 /* Normal command */
5960 /* Place the cursor on the player */
5961 move_cursor_relative(py, px);
5964 /* Get a command (normal) */
5965 request_command(FALSE);
5968 /* Process the command */
5978 /* Use some energy */
5979 if (world_player || energy_use > 400)
5981 /* The Randomness is irrelevant */
5982 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5986 /* There is some randomness of needed energy */
5987 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5990 /* Hack -- constant hallucination */
5991 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5994 /* Shimmer monsters if needed */
5995 if (shimmer_monsters)
5997 /* Clear the flag */
5998 shimmer_monsters = FALSE;
6000 /* Shimmer multi-hued monsters */
6001 for (i = 1; i < m_max; i++)
6003 monster_type *m_ptr;
6004 monster_race *r_ptr;
6006 /* Access monster */
6009 /* Skip dead monsters */
6010 if (!m_ptr->r_idx) continue;
6012 /* Skip unseen monsters */
6013 if (!m_ptr->ml) continue;
6015 /* Access the monster race */
6016 r_ptr = &r_info[m_ptr->ap_r_idx];
6018 /* Skip non-multi-hued monsters */
6019 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6022 /* Reset the flag */
6023 shimmer_monsters = TRUE;
6025 /* Redraw regardless */
6026 lite_spot(m_ptr->fy, m_ptr->fx);
6031 /* Handle monster detection */
6032 if (repair_monsters)
6034 /* Reset the flag */
6035 repair_monsters = FALSE;
6037 /* Rotate detection flags */
6038 for (i = 1; i < m_max; i++)
6040 monster_type *m_ptr;
6042 /* Access monster */
6045 /* Skip dead monsters */
6046 if (!m_ptr->r_idx) continue;
6048 /* Nice monsters get mean */
6049 if (m_ptr->mflag & MFLAG_NICE)
6051 /* Nice monsters get mean */
6052 m_ptr->mflag &= ~(MFLAG_NICE);
6055 /* Handle memorized monsters */
6056 if (m_ptr->mflag2 & MFLAG2_MARK)
6058 /* Maintain detection */
6059 if (m_ptr->mflag2 & MFLAG2_SHOW)
6062 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6064 /* Still need repairs */
6065 repair_monsters = TRUE;
6068 /* Remove detection */
6072 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6074 /* Assume invisible */
6077 /* Update the monster */
6078 update_mon(i, FALSE);
6080 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6081 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6083 /* Redraw regardless */
6084 lite_spot(m_ptr->fy, m_ptr->fx);
6089 if (p_ptr->pclass == CLASS_IMITATOR)
6091 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6094 for (i = 0; i < p_ptr->mane_num; i++)
6096 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6097 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6101 p_ptr->redraw |= (PR_MANE);
6103 if (p_ptr->action == ACTION_LEARN)
6106 p_ptr->redraw |= (PR_STATE);
6109 if (world_player && (p_ptr->energy_need > - 1000))
6112 p_ptr->redraw |= (PR_MAP);
6114 /* Update monsters */
6115 p_ptr->update |= (PU_MONSTERS);
6118 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6121 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6123 msg_print("You feel time flowing around you once more.");
6126 world_player = FALSE;
6127 p_ptr->energy_need = ENERGY_NEED();
6129 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6134 /* Hack -- notice death */
6135 if (!p_ptr->playing || p_ptr->is_dead)
6137 world_player = FALSE;
6141 /* Handle "leaving" */
6142 if (p_ptr->leaving) break;
6145 /* Update scent trail */
6151 * Interact with the current dungeon level.
6153 * This function will not exit until the level is completed,
6154 * the user dies, or the game is terminated.
6156 static void dungeon(bool load_game)
6160 /* Set the base level */
6161 base_level = dun_level;
6163 /* Reset various flags */
6167 p_ptr->leaving = FALSE;
6169 /* Reset the "command" vars */
6177 /* Cancel the target */
6181 ambush_flag = FALSE;
6183 /* Cancel the health bar */
6186 /* Check visual effects */
6187 shimmer_monsters = TRUE;
6188 shimmer_objects = TRUE;
6189 repair_monsters = TRUE;
6190 repair_objects = TRUE;
6196 /* Get index of current quest (if any) */
6197 quest_num = quest_number(dun_level);
6199 /* Inside a quest? */
6202 /* Mark the quest monster */
6203 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6206 /* Track maximum player level */
6207 if (p_ptr->max_plv < p_ptr->lev)
6209 p_ptr->max_plv = p_ptr->lev;
6213 /* Track maximum dungeon level (if not in quest -KMW-) */
6214 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6216 max_dlv[dungeon_type] = dun_level;
6217 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6220 /* Validate the panel */
6221 panel_bounds_center();
6223 /* Verify the panel */
6226 /* Flush messages */
6230 /* Enter "xtra" mode */
6231 character_xtra = TRUE;
6234 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6236 /* Redraw dungeon */
6237 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6240 p_ptr->redraw |= (PR_MAP);
6243 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6245 /* Update lite/view */
6246 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6248 /* Update monsters */
6249 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6251 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6254 /* Leave "xtra" mode */
6255 character_xtra = FALSE;
6258 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6260 /* Combine / Reorder the pack */
6261 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6263 /* Handle "p_ptr->notice" */
6266 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6272 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6273 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6274 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6276 if (p_ptr->inside_battle)
6280 p_ptr->energy_need = 0;
6286 msg_print("»î¹ç³«»Ï¡ª");
6288 msg_format("Ready..Fight!");
6294 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6295 p_ptr->magic_num1[0] = MUSIC_DETECT;
6297 /* Hack -- notice death or departure */
6298 if (!p_ptr->playing || p_ptr->is_dead) return;
6300 /* Print quest message if appropriate */
6301 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6303 quest_discovery(random_quest_number(dun_level));
6304 p_ptr->inside_quest = random_quest_number(dun_level);
6306 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6308 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6310 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6311 d_name+d_info[dungeon_type].name,
6312 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6314 msg_format("%^s lives in this level as the keeper of %s.",
6315 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6316 d_name+d_info[dungeon_type].name);
6320 /*** Process this dungeon level ***/
6322 /* Reset the monster generation level */
6323 monster_level = base_level;
6325 /* Reset the object generation level */
6326 object_level = base_level;
6330 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6331 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6332 p_ptr->energy_need = 0;
6334 /* Not leaving dungeon */
6335 p_ptr->leaving_dungeon = FALSE;
6340 /* Hack -- Compact the monster list occasionally */
6341 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6343 /* Hack -- Compress the monster list occasionally */
6344 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6347 /* Hack -- Compact the object list occasionally */
6348 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6350 /* Hack -- Compress the object list occasionally */
6351 if (o_cnt + 32 < o_max) compact_objects(0);
6354 /* Process the player */
6357 /* Handle "p_ptr->notice" */
6360 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6363 /* Hack -- Hilite the player */
6364 move_cursor_relative(py, px);
6366 /* Optional fresh */
6367 if (fresh_after) Term_fresh();
6369 /* Hack -- Notice death or departure */
6370 if (!p_ptr->playing || p_ptr->is_dead) break;
6372 /* Process all of the monsters */
6375 /* Handle "p_ptr->notice" */
6378 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6381 /* Hack -- Hilite the player */
6382 move_cursor_relative(py, px);
6384 /* Optional fresh */
6385 if (fresh_after) Term_fresh();
6387 /* Hack -- Notice death or departure */
6388 if (!p_ptr->playing || p_ptr->is_dead) break;
6391 /* Process the world */
6394 /* Handle "p_ptr->notice" */
6397 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6400 /* Hack -- Hilite the player */
6401 move_cursor_relative(py, px);
6403 /* Optional fresh */
6404 if (fresh_after) Term_fresh();
6406 /* Hack -- Notice death or departure */
6407 if (!p_ptr->playing || p_ptr->is_dead) break;
6409 /* Handle "leaving" */
6410 if (p_ptr->leaving) break;
6412 /* Count game turns */
6414 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6415 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6416 if (wild_regen) wild_regen--;
6419 /* Inside a quest and non-unique questor? */
6420 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6422 /* Un-mark the quest monster */
6423 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6426 /* Not save-and-quit and not dead? */
6427 if (p_ptr->playing && !p_ptr->is_dead)
6430 * Maintain Unique monsters and artifact, save current
6431 * floor, then prepare next floor
6435 /* Forget the flag */
6436 reinit_wilderness = FALSE;
6439 /* Write about current level on the play record once per level */
6445 * Load some "user pref files"
6447 * Modified by Arcum Dagsson to support
6448 * separate macro files for different realms.
6450 static void load_all_pref_files(void)
6455 /* Access the "user" pref file */
6456 sprintf(buf, "user.prf");
6458 /* Process that file */
6459 process_pref_file(buf);
6461 /* Access the "user" system pref file */
6462 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6464 /* Process that file */
6465 process_pref_file(buf);
6467 /* Access the "race" pref file */
6468 sprintf(buf, "%s.prf", rp_ptr->title);
6470 /* Process that file */
6471 process_pref_file(buf);
6473 /* Access the "class" pref file */
6474 sprintf(buf, "%s.prf", cp_ptr->title);
6476 /* Process that file */
6477 process_pref_file(buf);
6479 /* Access the "character" pref file */
6480 sprintf(buf, "%s.prf", player_base);
6482 /* Process that file */
6483 process_pref_file(buf);
6485 /* Free old entries */
6489 sprintf(buf, "picktype-%s.prf", player_base);
6491 sprintf(buf, "pickpref-%s.prf", player_base);
6494 err = process_pickpref_file(buf);
6496 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6500 process_pickpref_file("picktype.prf");
6502 process_pickpref_file("pickpref.prf");
6506 /* Access the "realm 1" pref file */
6507 if (p_ptr->realm1 != REALM_NONE)
6509 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6511 /* Process that file */
6512 process_pref_file(buf);
6515 /* Access the "realm 2" pref file */
6516 if (p_ptr->realm2 != REALM_NONE)
6518 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6520 /* Process that file */
6521 process_pref_file(buf);
6527 * Extract option variables from bit sets
6529 void extract_option_vars(void)
6533 for (i = 0; option_info[i].o_desc; i++)
6535 int os = option_info[i].o_set;
6536 int ob = option_info[i].o_bit;
6538 /* Set the "default" options */
6539 if (option_info[i].o_var)
6542 if (option_flag[os] & (1L << ob))
6545 (*option_info[i].o_var) = TRUE;
6552 (*option_info[i].o_var) = FALSE;
6560 * Actually play a game
6562 * If the "new_game" parameter is true, then, after loading the
6563 * savefile, we will commit suicide, if necessary, to allow the
6564 * player to start a new game.
6566 void play_game(bool new_game)
6569 bool load_game = TRUE;
6579 hack_mutation = FALSE;
6581 /* Hack -- Character is "icky" */
6582 character_icky = TRUE;
6584 /* Make sure main term is active */
6585 Term_activate(angband_term[0]);
6587 /* Initialise the resize hooks */
6588 angband_term[0]->resize_hook = resize_map;
6590 for (i = 1; i < 8; i++)
6592 /* Does the term exist? */
6593 if (angband_term[i])
6595 /* Add the redraw on resize hook */
6596 angband_term[i]->resize_hook = redraw_window;
6600 /* Hack -- turn off the cursor */
6601 (void)Term_set_cursor(0);
6604 /* Attempt to load */
6609 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6611 quit("broken savefile");
6616 /* Extract the options */
6617 extract_option_vars();
6619 /* Report waited score */
6620 if (p_ptr->wait_report_score)
6626 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6628 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6633 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6638 p_ptr->is_dead = TRUE;
6640 start_time = time(NULL);
6642 /* No suspending now */
6643 signals_ignore_tstp();
6645 /* Hack -- Character is now "icky" */
6646 character_icky = TRUE;
6648 /* Build the filename */
6649 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6651 /* Open the high score file, for reading/writing */
6652 highscore_fd = fd_open(buf, O_RDWR);
6654 /* Handle score, show Top scores */
6655 success = send_world_score(TRUE);
6658 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6660 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6664 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6666 prt("standing by for future registration...", 0, 0);
6672 p_ptr->wait_report_score = FALSE;
6675 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6677 if (!save_player()) msg_print("death save failed!");
6680 /* Shut the high score file */
6681 (void)fd_close(highscore_fd);
6683 /* Forget the high score fd */
6686 /* Allow suspending now */
6687 signals_handle_tstp();
6692 /* Nothing loaded */
6693 if (!character_loaded)
6695 /* Make new player */
6698 /* The dungeon is not ready */
6699 character_dungeon = FALSE;
6701 /* Prepare to init the RNG */
6704 /* Initialize the saved floors data */
6705 init_saved_floors();
6708 /* Old game is loaded. But new game is requested. */
6711 /* Delete expanded temporal files */
6712 clear_saved_floor_files();
6715 /* Process old character */
6718 /* Process the player name */
6719 process_player_name(FALSE);
6728 seed = (time(NULL));
6732 /* Mutate the seed on Unix machines */
6733 seed = ((seed >> 3) * (getpid() << 1));
6737 /* Use the complex RNG */
6740 /* Seed the "complex" RNG */
6741 Rand_state_init(seed);
6744 /* Roll new character */
6747 monster_race *r_ptr;
6749 /* The dungeon is not ready */
6750 character_dungeon = FALSE;
6754 p_ptr->inside_quest = 0;
6755 p_ptr->inside_arena = FALSE;
6756 p_ptr->inside_battle = FALSE;
6760 /* Hack -- seed for flavors */
6761 seed_flavor = randint0(0x10000000);
6763 /* Hack -- seed for town layout */
6764 seed_town = randint0(0x10000000);
6766 /* Roll up a new character */
6773 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6775 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6779 get_mon_num_prep(NULL, NULL);
6780 for (i = 0; i < MAX_KUBI; i++)
6786 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6787 r_ptr = &r_info[kubi_r_idx[i]];
6789 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6791 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6792 if (r_ptr->rarity > 100) continue;
6794 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6796 for (j = 0; j < i; j++)
6797 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6802 for (i = 0; i < MAX_KUBI -1; i++)
6805 for (j = i; j < MAX_KUBI; j++)
6807 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6809 tmp = kubi_r_idx[i];
6810 kubi_r_idx[i] = kubi_r_idx[j];
6811 kubi_r_idx[j] = tmp;
6816 p_ptr->inside_battle = TRUE;
6819 today_mon = get_mon_num(3);
6820 r_ptr = &r_info[today_mon];
6822 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6823 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6824 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6825 if (r_ptr->rarity > 10) continue;
6826 if (r_ptr->level == 0) continue;
6829 p_ptr->inside_battle = FALSE;
6833 write_level = FALSE;
6836 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6838 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6842 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6843 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6845 if (p_ptr->riding == -1)
6848 for(i = m_max; i > 0; i--)
6850 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6859 p_ptr->teleport_town = FALSE;
6860 p_ptr->sutemi = FALSE;
6861 world_monster = FALSE;
6862 now_damaged = FALSE;
6864 start_time = time(NULL) - 1;
6865 record_o_name[0] = '\0';
6867 /* Reset map panel */
6868 panel_row_min = cur_hgt;
6869 panel_col_min = cur_wid;
6871 /* Sexy gal gets bonus to maximum weapon skill of whip */
6872 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6873 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6875 /* Fill the arrays of floors and walls in the good proportions */
6876 set_floor_and_wall(dungeon_type);
6878 /* Flavor the objects */
6886 /* Flash a message */
6888 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6890 prt("Please wait...", 0, 0);
6894 /* Flush the message */
6898 /* Hack -- Enter wizard mode */
6901 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6902 else if (p_ptr->is_dead) quit("Already dead.");
6905 /* Initialize the town-buildings if necessary */
6906 if (!dun_level && !p_ptr->inside_quest)
6908 /* Init the wilderness */
6910 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6913 init_flags = INIT_ONLY_BUILDINGS;
6915 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6920 /* Generate a dungeon level if needed */
6921 if (!character_dungeon) change_floor();
6924 /* Character is now "complete" */
6925 character_generated = TRUE;
6928 /* Hack -- Character is no longer "icky" */
6929 character_icky = FALSE;
6933 p_ptr->playing = TRUE;
6935 /* Reset the visual mappings */
6938 /* Load the "pref" files */
6939 load_all_pref_files();
6941 /* React to changes */
6942 Term_xtra(TERM_XTRA_REACT, 0);
6945 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6948 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6954 /* Set or clear "rogue_like_commands" if requested */
6955 if (arg_force_original) rogue_like_commands = FALSE;
6956 if (arg_force_roguelike) rogue_like_commands = TRUE;
6958 /* Hack -- Enforce "delayed death" */
6959 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6961 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6963 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6965 monster_type *m_ptr;
6966 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6967 monster_race *r_ptr = &r_info[pet_r_idx];
6968 place_monster_aux(0, py, px - 1, pet_r_idx,
6969 (PM_FORCE_PET | PM_NO_KAGE));
6970 m_ptr = &m_list[hack_m_idx_ii];
6971 m_ptr->mspeed = r_ptr->speed;
6972 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6973 m_ptr->max_maxhp = m_ptr->maxhp;
6974 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6975 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6981 /* Process the level */
6984 /* Handle "p_ptr->notice" */
6987 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6990 /* Cancel the target */
6993 /* Cancel the health bar */
6997 /* Forget the lite */
7000 /* Forget the view */
7003 /* Forget the view */
7006 /* Handle "quit and save" */
7007 if (!p_ptr->playing && !p_ptr->is_dead) break;
7009 /* Erase the old cave */
7011 if (!p_ptr->is_dead) wipe_m_list();
7019 /* Accidental Death */
7020 if (p_ptr->playing && p_ptr->is_dead)
7022 if (p_ptr->inside_arena)
7024 p_ptr->inside_arena = FALSE;
7025 if (p_ptr->arena_number > MAX_ARENA_MONS)
7026 p_ptr->arena_number++;
7028 p_ptr->arena_number = -1 - p_ptr->arena_number;
7029 p_ptr->is_dead = FALSE;
7031 p_ptr->chp_frac = 0;
7032 p_ptr->exit_bldg = TRUE;
7037 /* Mega-Hack -- Allow player to cheat death */
7039 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7041 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7045 /* Mark social class, reset age, if needed */
7046 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7052 p_ptr->noscore |= 0x0001;
7056 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7058 msg_print("You invoke wizard mode and cheat death.");
7064 /* Restore hit points */
7065 p_ptr->chp = p_ptr->mhp;
7066 p_ptr->chp_frac = 0;
7068 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7070 for (i = 0; i < EATER_EXT*2; i++)
7072 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7074 for (; i < EATER_EXT*3; i++)
7076 p_ptr->magic_num1[i] = 0;
7079 /* Restore spell points */
7080 p_ptr->csp = p_ptr->msp;
7081 p_ptr->csp_frac = 0;
7083 /* Hack -- Healing */
7085 (void)set_confused(0);
7086 (void)set_poisoned(0);
7087 (void)set_afraid(0);
7088 (void)set_paralyzed(0);
7093 /* Hack -- Prevent starvation */
7094 (void)set_food(PY_FOOD_MAX - 1);
7096 /* Hack -- cancel recall */
7097 if (p_ptr->word_recall)
7101 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7103 msg_print("A tension leaves the air around you...");
7108 /* Hack -- Prevent recall */
7109 p_ptr->word_recall = 0;
7110 p_ptr->redraw |= (PR_STATUS);
7113 /* Hack -- cancel alter */
7114 if (p_ptr->alter_reality)
7116 /* Hack -- Prevent alter */
7117 p_ptr->alter_reality = 0;
7118 p_ptr->redraw |= (PR_STATUS);
7121 /* Note cause of death XXX XXX XXX */
7123 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7125 (void)strcpy(p_ptr->died_from, "Cheating death");
7130 p_ptr->is_dead = FALSE;
7133 p_ptr->inside_arena = FALSE;
7134 p_ptr->inside_battle = FALSE;
7136 p_ptr->inside_quest = 0;
7137 p_ptr->recall_dungeon = dungeon_type;
7139 if (lite_town || vanilla_town)
7141 p_ptr->wilderness_y = 1;
7142 p_ptr->wilderness_x = 1;
7156 p_ptr->wilderness_y = 48;
7157 p_ptr->wilderness_x = 5;
7163 p_ptr->wild_mode = FALSE;
7164 p_ptr->leaving = TRUE;
7167 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7169 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7175 /* Handle "death" */
7176 if (p_ptr->is_dead) break;
7178 /* Make a new level */
7189 s32b turn_real(s32b hoge)
7191 switch (p_ptr->start_race)
7197 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);