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 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1273 /* Notice the "waking up" */
1278 /* Acquire the monster name */
1279 monster_desc(m_name, m_ptr, 0);
1281 /* Dump a message */
1283 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1285 msg_format("%^s wakes up.", m_name);
1288 /* Redraw the health bar */
1289 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1290 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1292 /* Hack -- Count the wakings */
1293 if (r_ptr->r_wake < MAX_UCHAR)
1308 /* Make a "saving throw" against stun */
1309 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1315 /* Hack -- Recover from stun */
1316 if (m_ptr->stunned > d)
1318 /* Recover somewhat */
1319 m_ptr->stunned -= d;
1328 /* Message if visible */
1333 /* Acquire the monster name */
1334 monster_desc(m_name, m_ptr, 0);
1336 /* Dump a message */
1338 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1340 msg_format("%^s is no longer stunned.", m_name);
1343 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1344 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1349 /* Handle confusion */
1350 if (m_ptr->confused)
1352 /* Amount of "boldness" */
1353 int d = randint1(r_ptr->level / 20 + 1);
1355 /* Still confused */
1356 if (m_ptr->confused > d)
1358 /* Reduce the confusion */
1359 m_ptr->confused -= d;
1365 /* No longer confused */
1366 m_ptr->confused = 0;
1368 /* Message if visible */
1373 /* Acquire the monster name */
1374 monster_desc(m_name, m_ptr, 0);
1376 /* Dump a message */
1378 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1380 msg_format("%^s is no longer confused.", m_name);
1383 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1384 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1392 /* Amount of "boldness" */
1393 int d = randint1(r_ptr->level / 20 + 1);
1396 if (m_ptr->monfear > d)
1398 /* Reduce the fear */
1399 m_ptr->monfear -= d;
1402 /* Recover from fear, take note if seen */
1405 /* No longer afraid */
1415 /* Acquire the monster possessive */
1416 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1419 /* Acquire the monster name */
1420 monster_desc(m_name, m_ptr, 0);
1422 /* Dump a message */
1424 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1426 msg_format("%^s recovers %s courage.", m_name, m_poss);
1429 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1430 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1438 static void notice_lite_change(object_type *o_ptr)
1440 /* Hack -- notice interesting fuel steps */
1441 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1444 p_ptr->window |= (PW_EQUIP);
1447 /* Hack -- Special treatment when blind */
1450 /* Hack -- save some light for later */
1451 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1454 /* The light is now out */
1455 else if (o_ptr->xtra4 == 0)
1459 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1461 msg_print("Your light has gone out!");
1463 p_ptr->update |= (PU_BONUS);
1466 /* The light is getting dim */
1467 else if (o_ptr->name2 == EGO_LITE_LONG)
1469 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1470 && (turn % (TURNS_PER_TICK*2)))
1472 if (disturb_minor) disturb(0, 0);
1474 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1476 msg_print("Your light is growing faint.");
1482 /* The light is getting dim */
1483 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1485 if (disturb_minor) disturb(0, 0);
1487 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1489 msg_print("Your light is growing faint.");
1496 void leave_quest_check(void)
1498 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1499 leaving_quest = p_ptr->inside_quest;
1501 /* Leaving an 'only once' quest marks it as failed */
1502 if (leaving_quest &&
1503 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1504 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1506 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1507 quest[leaving_quest].complev = (byte)p_ptr->lev;
1508 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1510 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1511 if (record_rand_quest)
1512 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1514 /* Floor of random quest will be blocked */
1515 prepare_change_floor_mode(CFM_NO_RETURN);
1517 else if (record_fix_quest)
1518 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1524 * Forcibly pseudo-identify an object in the inventory
1527 * note: currently this function allows pseudo-id of any object,
1528 * including silly ones like potions & scrolls, which always
1529 * get '{average}'. This should be changed, either to stop such
1530 * items from being pseudo-id'd, or to allow psychometry to
1531 * detect whether the unidentified potion/scroll/etc is
1532 * good (Cure Light Wounds, Restore Strength, etc) or
1533 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1535 bool psychometry(void)
1539 char o_name[MAX_NLEN];
1545 item_tester_no_ryoute = TRUE;
1548 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1549 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1551 q = "Meditate on which item? ";
1552 s = "You have nothing appropriate.";
1555 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1557 /* Get the item (in the pack) */
1560 o_ptr = &inventory[item];
1563 /* Get the item (on the floor) */
1566 o_ptr = &o_list[0 - item];
1569 /* It is fully known, no information needed */
1570 if (object_known_p(o_ptr))
1573 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1575 msg_print("You cannot find out anything more about that.");
1581 /* Check for a feeling */
1582 feel = value_check_aux1(o_ptr);
1584 /* Get an object description */
1585 object_desc(o_name, o_ptr, FALSE, 0);
1587 /* Skip non-feelings */
1591 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1593 msg_format("You do not perceive anything unusual about the %s.", o_name);
1600 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1601 o_name, game_inscriptions[feel]);
1603 msg_format("You feel that the %s %s %s...",
1604 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1605 game_inscriptions[feel]);
1609 /* We have "felt" it */
1610 o_ptr->ident |= (IDENT_SENSE);
1613 o_ptr->feeling = feel;
1615 /* Combine / Reorder the pack (later) */
1616 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1619 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1621 /* Valid "tval" codes */
1622 switch (o_ptr->tval)
1650 /* Auto-inscription/destroy */
1651 idx = is_autopick(o_ptr);
1652 auto_inscribe_item(item, idx);
1653 if (okay && destroy_feeling)
1654 auto_destroy_item(item, idx);
1656 /* Something happened */
1661 static void gere_music(s32b music)
1669 stun_monsters(damroll(p_ptr->lev/10,2));
1672 hp_player(damroll(2,6));
1675 project_hack(GF_TURN_ALL, p_ptr->lev);
1678 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1681 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1684 confuse_monsters(p_ptr->lev * 2);
1687 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1690 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1693 project(0, 0, py, px,
1694 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1697 dispel_monsters(randint1(p_ptr->lev * 3));
1698 dispel_evil(randint1(p_ptr->lev * 3));
1705 earthquake(py, px, 10);
1708 stasis_monsters(p_ptr->lev * 4);
1711 dispel_monsters(randint1(p_ptr->lev * 3));
1714 hp_player(damroll(15,10));
1718 case MUSIC_DETECT+19:
1720 case MUSIC_DETECT+11:
1721 case MUSIC_DETECT+12:
1722 case MUSIC_DETECT+13:
1723 case MUSIC_DETECT+14:
1724 case MUSIC_DETECT+15:
1725 case MUSIC_DETECT+16:
1726 case MUSIC_DETECT+17:
1727 case MUSIC_DETECT+18:
1728 map_area(DETECT_RAD_MAP);
1729 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1730 case MUSIC_DETECT+6:
1731 case MUSIC_DETECT+7:
1732 case MUSIC_DETECT+8:
1733 case MUSIC_DETECT+9:
1734 case MUSIC_DETECT+10:
1735 /* There are too many hidden treasure. So... */
1736 /* detect_treasure(DETECT_RAD_DEFAULT); */
1737 detect_objects_gold(DETECT_RAD_DEFAULT);
1738 detect_objects_normal(DETECT_RAD_DEFAULT);
1739 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1740 case MUSIC_DETECT+3:
1741 case MUSIC_DETECT+4:
1742 case MUSIC_DETECT+5:
1743 detect_monsters_invis(DETECT_RAD_DEFAULT);
1744 detect_monsters_normal(DETECT_RAD_DEFAULT);
1745 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1747 case MUSIC_DETECT+1:
1748 case MUSIC_DETECT+2:
1749 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1750 detect_doors(DETECT_RAD_DEFAULT);
1751 detect_stairs(DETECT_RAD_DEFAULT);
1752 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1758 * If player has inscribed the object with "!!", let him know when it's
1761 static void recharged_notice(object_type *o_ptr)
1763 char o_name[MAX_NLEN];
1767 /* No inscription */
1768 if (!o_ptr->inscription) return;
1771 s = strchr(quark_str(o_ptr->inscription), '!');
1773 /* Process notification request. */
1776 /* Find another '!' */
1779 /* Describe (briefly) */
1780 object_desc(o_name, o_ptr, FALSE, 0);
1782 /* Notify the player */
1784 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1786 if (o_ptr->number > 1)
1787 msg_format("Your %s are recharged.", o_name);
1789 msg_format("Your %s is recharged.", o_name);
1798 /* Keep looking for '!'s */
1799 s = strchr(s + 1, '!');
1804 static void check_music(void)
1810 /* Music singed by player */
1811 if (p_ptr->pclass != CLASS_BARD) return;
1812 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1814 spell = p_ptr->magic_num2[0];
1815 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1817 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1818 need_mana *= 0x8000;
1819 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1826 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1827 need_mana = (need_mana & 0xffff);
1828 if ((u32b)p_ptr->csp_frac < need_mana)
1831 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1835 p_ptr->csp_frac -= (u16b)need_mana;
1838 p_ptr->redraw |= PR_MANA;
1839 if (p_ptr->magic_num1[1])
1841 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1842 p_ptr->magic_num1[1] = 0;
1844 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1846 msg_print("You restart singing.");
1848 p_ptr->action = ACTION_SING;
1850 /* Recalculate bonuses */
1851 p_ptr->update |= (PU_BONUS | PU_HP);
1853 /* Redraw map and status bar */
1854 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1856 /* Update monsters */
1857 p_ptr->update |= (PU_MONSTERS);
1860 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1863 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1864 p_ptr->spell_exp[spell] += 5;
1865 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1866 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1867 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1868 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1869 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1870 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1872 gere_music(p_ptr->magic_num1[0]);
1875 /* Choose one of items that have cursed flag */
1876 static object_type *choose_cursed_obj_name(u32b flag)
1879 int choices[INVEN_TOTAL-INVEN_RARM];
1882 /* Paranoia -- Player has no warning-item */
1883 if (!(p_ptr->cursed & flag)) return NULL;
1885 /* Search Inventry */
1886 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1888 object_type *o_ptr = &inventory[i];
1890 if (o_ptr->curse_flags & flag)
1892 choices[number] = i;
1897 /* Choice one of them */
1898 return (&inventory[choices[randint0(number)]]);
1903 * Handle certain things once every 10 game turns
1905 static void process_world(void)
1909 bool cave_no_regen = FALSE;
1910 int upkeep_factor = 0;
1915 const int dec_count = (easy_band ? 2 : 1);
1917 int day, hour, min, prev_min;
1919 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1920 s32b tick = turn % len + len / 4;
1922 int quest_num = quest_number(dun_level);
1924 extract_day_hour_min(&day, &hour, &min);
1925 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1927 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1929 !(quest_num && (is_fixed_quest_idx(quest_num) &&
1930 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
1931 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
1932 !p_ptr->inside_battle)
1935 if (p_ptr->inside_battle && !p_ptr->leaving)
1942 /* Count all hostile monsters */
1943 for (i2 = 0; i2 < cur_wid; ++i2)
1944 for (j2 = 0; j2 < cur_hgt; j2++)
1945 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1948 win_m_idx = cave[j2][i2].m_idx;
1951 if (number_mon == 0)
1954 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1956 msg_print("They have kill each other at the same time.");
1959 p_ptr->energy_need = 0;
1962 else if ((number_mon-1) == 0)
1965 monster_type *wm_ptr;
1967 wm_ptr = &m_list[win_m_idx];
1969 monster_desc(m_name, wm_ptr, 0);
1971 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1973 msg_format("%s is winner!", m_name);
1977 if (win_m_idx == (sel_monster+1))
1980 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1982 msg_print("Congratulations.");
1985 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1987 msg_format("You received %d gold.", battle_odds);
1989 p_ptr->au += battle_odds;
1994 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1996 msg_print("You lost gold.");
2000 p_ptr->energy_need = 0;
2003 else if(turn - old_turn == 150*TURNS_PER_TICK)
2006 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
2008 msg_format("This battle have ended in a draw.");
2010 p_ptr->au += kakekin;
2012 p_ptr->energy_need = 0;
2017 /* Every 10 game turns */
2018 if (turn % TURNS_PER_TICK) return;
2020 /*** Check the Time and Load ***/
2022 if (!(turn % (50*TURNS_PER_TICK)))
2024 /* Check time and load */
2025 if ((0 != check_time()) || (0 != check_load()))
2028 if (closing_flag <= 2)
2033 /* Count warnings */
2038 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2039 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2041 msg_print("The gates to ANGBAND are closing...");
2042 msg_print("Please finish up and/or save your game.");
2052 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2054 msg_print("The gates to ANGBAND are now closed.");
2059 p_ptr->playing = FALSE;
2062 p_ptr->leaving = TRUE;
2067 /*** Attempt timed autosave ***/
2068 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2070 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2071 do_cmd_save_game(TRUE);
2077 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2079 msg_print("You hear noise.");
2083 /*** Handle the wilderness/town (sunshine) ***/
2085 /* While in town/wilderness */
2086 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2088 /* Hack -- Daybreak/Nighfall in town */
2089 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2093 /* Check for dawn */
2094 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2101 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2103 msg_print("The sun has risen.");
2106 /* Hack -- Scan the town */
2107 for (y = 0; y < cur_hgt; y++)
2109 for (x = 0; x < cur_wid; x++)
2111 /* Get the cave grid */
2112 c_ptr = &cave[y][x];
2115 c_ptr->info |= (CAVE_GLOW);
2117 /* Hack -- Memorize lit grids if allowed */
2118 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2120 /* Hack -- Notice spot */
2133 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2135 msg_print("The sun has fallen.");
2138 /* Hack -- Scan the town */
2139 for (y = 0; y < cur_hgt; y++)
2141 for (x = 0; x < cur_wid; x++)
2143 /* Get the cave grid */
2144 c_ptr = &cave[y][x];
2146 /* Feature code (applying "mimic" field) */
2147 feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
2149 if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
2152 c_ptr->info &= ~(CAVE_GLOW);
2154 if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
2156 /* Forget the normal floor grid */
2157 c_ptr->info &= ~(CAVE_MARK);
2159 /* Hack -- Notice spot */
2165 /* Glow deep lava and building entrances */
2166 glow_deep_lava_and_bldg();
2170 /* Update the monsters */
2171 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2174 p_ptr->redraw |= (PR_MAP);
2177 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2181 /* Set back the rewards once a day */
2182 /* Only used for reward in thief's guild for now */
2183 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2187 /* Reset the rewards */
2188 for (n = 0; n < MAX_BACT; n++)
2190 p_ptr->rewards[n] = FALSE;
2195 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2197 if (cheat_xtra) msg_print("Rewards reset.");
2203 /*** Process the monsters ***/
2205 /* Check for creature generation. */
2206 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2207 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2209 /* Make a new monster */
2210 (void)alloc_monster(MAX_SIGHT + 5, 0);
2213 /* Hack -- Check for creature regeneration */
2214 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2215 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2217 /* Hack -- Process the counters of all monsters */
2218 process_monsters_counters();
2221 /*** Damage over Time ***/
2223 /* Take damage from poison */
2224 if (p_ptr->poisoned && !IS_INVULN())
2228 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2230 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2236 /* (Vampires) Take damage from sunlight */
2237 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2239 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2241 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2245 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2246 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2248 msg_print("The sun's rays scorch your undead flesh!");
2249 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2252 cave_no_regen = TRUE;
2256 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2257 !p_ptr->resist_lite)
2259 object_type * o_ptr = &inventory[INVEN_LITE];
2260 char o_name [MAX_NLEN];
2261 char ouch [MAX_NLEN+40];
2263 /* Get an object description */
2264 object_desc(o_name, o_ptr, FALSE, 0);
2267 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2269 msg_format("The %s scorches your undead flesh!", o_name);
2273 cave_no_regen = TRUE;
2275 /* Get an object description */
2276 object_desc(o_name, o_ptr, TRUE, 0);
2279 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2281 sprintf(ouch, "wielding %s", o_name);
2284 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2288 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2289 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2291 int damage = 3000 + randint0(2000);
2293 if (prace_is_(RACE_ENT)) damage += damage/3;
2294 if (p_ptr->resist_fire) damage = damage / 3;
2295 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2296 damage = damage / 100 + (randint0(100) < (damage % 100));
2302 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2303 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2305 msg_print("The lava burns you!");
2306 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2309 cave_no_regen = TRUE;
2313 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2314 !IS_INVULN() && !p_ptr->immune_fire)
2316 int damage = 6000 + randint0(4000);
2321 if (p_ptr->resist_fire) damage = damage / 3;
2322 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2326 damage = damage / 5;
2329 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2330 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2332 message = "The heat burns you!";
2333 hit_from = "flying over deep lava";
2340 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2341 hit_from = "¿¼¤¤ÍÏ´äή";
2343 message = "The lava burns you!";
2344 hit_from = "deep lava";
2349 damage = damage / 100 + (randint0(100) < (damage % 100));
2354 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2356 cave_no_regen = TRUE;
2360 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2362 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2366 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2367 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2369 msg_print("You are drowning!");
2370 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2373 cave_no_regen = TRUE;
2380 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2382 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2383 if (prace_is_(RACE_ENT)) damage += damage / 3;
2384 if (p_ptr->resist_fire) damage = damage / 3;
2385 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2387 msg_print("Ç®¤¤¡ª");
2388 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2390 msg_print("It's hot!");
2391 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2394 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2396 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2397 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2398 if (p_ptr->resist_elec) damage = damage / 3;
2399 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2401 msg_print("Äˤ¤¡ª");
2402 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2404 msg_print("It hurts!");
2405 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2408 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2410 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2411 if (p_ptr->resist_cold) damage = damage / 3;
2412 if (IS_OPPOSE_COLD()) damage = damage / 3;
2414 msg_print("Î䤿¤¤¡ª");
2415 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2417 msg_print("It's cold!");
2418 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2423 /* Spectres -- take damage when moving through walls */
2425 * Added: ANYBODY takes damage if inside through walls
2426 * without wraith form -- NOTE: Spectres will never be
2427 * reduced below 0 hp by being inside a stone wall; others
2430 if (!cave_floor_bold(py, px))
2432 /* Player can walk through trees */
2433 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2437 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2438 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2442 cave_no_regen = TRUE;
2444 if (p_ptr->pass_wall)
2447 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2450 msg_print("Your molecules feel disrupted!");
2451 dam_desc = "density";
2458 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2459 dam_desc = "¹Å¤¤´ä";
2461 msg_print("You are being crushed!");
2462 dam_desc = "solid rock";
2467 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2473 if (min != prev_min)
2475 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2476 determine_today_mon(FALSE);
2480 /* Nightmare mode activates the TY_CURSE at midnight */
2481 if (ironman_nightmare)
2483 /* Require exact minute */
2484 if (min != prev_min)
2486 /* Every 15 minutes after 11:00 pm */
2487 if ((hour == 23) && !(min % 15))
2497 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2499 msg_print("You hear a distant bell toll ominously.");
2507 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2509 msg_print("A distant bell sounds twice.");
2517 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2519 msg_print("A distant bell sounds three times.");
2527 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2529 msg_print("A distant bell tolls four times.");
2537 /* TY_CURSE activates at mignight! */
2544 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2546 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2549 activate_ty_curse(FALSE, &count);
2554 /* Take damage from cuts */
2555 if (p_ptr->cut && !IS_INVULN())
2557 /* Mortal wound or Deep Gash */
2558 if (p_ptr->cut > 1000)
2563 else if (p_ptr->cut > 200)
2569 else if (p_ptr->cut > 100)
2574 else if (p_ptr->cut > 50)
2579 else if (p_ptr->cut > 25)
2584 else if (p_ptr->cut > 10)
2597 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2599 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2605 /*** Check the Food, and Regenerate ***/
2607 if (!p_ptr->inside_battle)
2609 /* Digest normally */
2610 if (p_ptr->food < PY_FOOD_MAX)
2612 /* Every 50 game turns */
2613 if (!(turn % (TURNS_PER_TICK*5)))
2615 /* Basic digestion rate based on speed */
2616 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2618 /* Regeneration takes more food */
2619 if (p_ptr->regenerate) i += 20;
2620 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2621 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2623 /* Slow digestion takes less food */
2624 if (p_ptr->slow_digest) i -= 5;
2626 /* Minimal digestion */
2628 /* Maximal digestion */
2629 if (i > 100) i = 100;
2631 /* Digest some food */
2632 (void)set_food(p_ptr->food - i);
2636 /* Digest quickly when gorged */
2639 /* Digest a lot of food */
2640 (void)set_food(p_ptr->food - 100);
2644 /* Starve to death (slowly) */
2645 if (p_ptr->food < PY_FOOD_STARVE)
2647 /* Calculate damage */
2648 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2652 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2654 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2659 /* Default regeneration */
2660 regen_amount = PY_REGEN_NORMAL;
2663 if (p_ptr->food < PY_FOOD_WEAK)
2665 /* Lower regeneration */
2666 if (p_ptr->food < PY_FOOD_STARVE)
2670 else if (p_ptr->food < PY_FOOD_FAINT)
2672 regen_amount = PY_REGEN_FAINT;
2676 regen_amount = PY_REGEN_WEAK;
2680 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2682 /* Faint occasionally */
2683 if (!p_ptr->paralyzed && (randint0(100) < 10))
2687 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2689 msg_print("You faint from the lack of food.");
2694 /* Hack -- faint (bypass free action) */
2695 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2701 /* Are we walking the pattern? */
2702 if (pattern_effect())
2704 cave_no_regen = TRUE;
2708 /* Regeneration ability */
2709 if (p_ptr->regenerate)
2711 regen_amount = regen_amount * 2;
2713 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2717 if (p_ptr->cursed & TRC_SLOW_REGEN)
2724 /* Searching or Resting */
2725 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2727 regen_amount = regen_amount * 2;
2730 upkeep_factor = calculate_upkeep();
2732 /* Regenerate the mana */
2733 /* if (p_ptr->csp < p_ptr->msp) */
2737 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2738 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2739 regenmana(upkeep_regen/100);
2741 #ifdef TRACK_FRIENDS
2745 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2747 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2751 #endif /* TRACK_FRIENDS */
2754 else if (p_ptr->action != ACTION_LEARN)
2756 regenmana(regen_amount);
2759 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2761 regenmagic(regen_amount);
2764 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2766 while (upkeep_factor > 100)
2769 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2771 msg_print("Such much pets cannot be controled at once!");
2774 do_cmd_pet_dismiss();
2776 upkeep_factor = calculate_upkeep();
2779 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2781 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2787 /* Poisoned or cut yields no healing */
2788 if (p_ptr->poisoned) regen_amount = 0;
2789 if (p_ptr->cut) regen_amount = 0;
2791 /* Special floor -- Pattern, in a wall -- yields no healing */
2792 if (cave_no_regen) regen_amount = 0;
2794 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2796 /* Regenerate Hit Points if needed */
2797 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2799 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2800 (cave[py][px].feat >= FEAT_PATTERN_START))
2802 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2806 regenhp(regen_amount);
2811 /*** Timeout Various Things ***/
2814 if (p_ptr->tim_mimic)
2816 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2819 /* Hack -- Hallucinating */
2822 (void)set_image(p_ptr->image - dec_count);
2828 (void)set_blind(p_ptr->blind - dec_count);
2831 /* Times see-invisible */
2832 if (p_ptr->tim_invis)
2834 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2845 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2848 /* Timed temporary elemental brands. -LM- */
2849 if (p_ptr->ele_attack)
2851 p_ptr->ele_attack--;
2853 /* Clear all temporary elemental brands. */
2854 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2857 /* Timed temporary elemental immune. -LM- */
2858 if (p_ptr->ele_immune)
2860 p_ptr->ele_immune--;
2862 /* Clear all temporary elemental brands. */
2863 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2866 /* Timed infra-vision */
2867 if (p_ptr->tim_infra)
2869 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2873 if (p_ptr->tim_stealth)
2875 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2878 /* Timed levitation */
2879 if (p_ptr->tim_ffall)
2881 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2884 /* Timed sh_touki */
2885 if (p_ptr->tim_sh_touki)
2887 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2891 if (p_ptr->tim_sh_fire)
2893 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2897 if (p_ptr->tim_sh_holy)
2899 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2903 if (p_ptr->tim_eyeeye)
2905 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2908 /* Timed resist-magic */
2909 if (p_ptr->resist_magic)
2911 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2914 /* Timed regeneration */
2915 if (p_ptr->tim_regen)
2917 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2920 /* Timed resist nether */
2921 if (p_ptr->tim_res_nether)
2923 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2926 /* Timed resist time */
2927 if (p_ptr->tim_res_time)
2929 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2933 if (p_ptr->tim_reflect)
2935 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2939 if (p_ptr->multishadow)
2941 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2944 /* Timed Robe of dust */
2945 if (p_ptr->dustrobe)
2947 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2950 /* Timed infra-vision */
2951 if (p_ptr->kabenuke)
2953 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2957 if (p_ptr->paralyzed)
2959 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2963 if (p_ptr->confused)
2965 (void)set_confused(p_ptr->confused - dec_count);
2971 (void)set_afraid(p_ptr->afraid - dec_count);
2977 (void)set_fast(p_ptr->fast - 1, TRUE);
2983 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2986 /* Protection from evil */
2987 if (p_ptr->protevil)
2989 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2992 /* Invulnerability */
2995 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2999 if (p_ptr->wraith_form)
3001 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3007 (void)set_hero(p_ptr->hero - 1, TRUE);
3013 (void)set_shero(p_ptr->shero - 1, TRUE);
3019 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3025 (void)set_shield(p_ptr->shield - 1, TRUE);
3029 if (p_ptr->tsubureru)
3031 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3035 if (p_ptr->magicdef)
3037 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3041 if (p_ptr->tsuyoshi)
3043 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3047 if (p_ptr->oppose_acid)
3049 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3052 /* Oppose Lightning */
3053 if (p_ptr->oppose_elec)
3055 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3059 if (p_ptr->oppose_fire)
3061 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3065 if (p_ptr->oppose_cold)
3067 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3071 if (p_ptr->oppose_pois)
3073 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3078 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3081 /*** Poison and Stun and Cut ***/
3084 if (p_ptr->poisoned)
3086 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3088 /* Apply some healing */
3089 (void)set_poisoned(p_ptr->poisoned - adjust);
3095 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3097 /* Apply some healing */
3098 (void)set_stun(p_ptr->stun - adjust);
3104 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3106 /* Hack -- Truly "mortal" wound */
3107 if (p_ptr->cut > 1000) adjust = 0;
3109 /* Apply some healing */
3110 (void)set_cut(p_ptr->cut - adjust);
3115 /*** Process Light ***/
3117 /* Check for light being wielded */
3118 o_ptr = &inventory[INVEN_LITE];
3120 /* Burn some fuel in the current lite */
3121 if (o_ptr->tval == TV_LITE)
3123 /* Hack -- Use some fuel (except on artifacts) */
3124 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3126 /* Decrease life-span */
3127 if (o_ptr->name2 == EGO_LITE_LONG)
3129 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3131 else o_ptr->xtra4--;
3133 /* Notice interesting fuel steps */
3134 notice_lite_change(o_ptr);
3138 /* Calculate torch radius */
3139 p_ptr->update |= (PU_TORCH);
3142 /*** Process mutation effects ***/
3143 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3145 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3149 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3150 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3152 msg_print("RAAAAGHH!");
3153 msg_print("You feel a fit of rage coming over you!");
3156 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3159 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3161 if (!p_ptr->resist_fear)
3165 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3167 msg_print("It's so dark... so scary!");
3170 set_afraid(p_ptr->afraid + 13 + randint1(26));
3174 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3176 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3181 /* Teleport player */
3183 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3185 msg_print("Your position suddenly seems very uncertain...");
3189 teleport_player(40);
3193 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3195 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3198 p_ptr->redraw |= PR_EXTRA;
3200 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3202 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3207 if (!p_ptr->resist_conf)
3209 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3212 if (!p_ptr->resist_chaos)
3217 if (one_in_(3)) lose_all_info();
3219 teleport_player(100);
3222 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3223 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3225 msg_print("You wake up somewhere with a sore head...");
3226 msg_print("You can't remember a thing, or how you got here!");
3235 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3237 msg_print("Thishcischs GooDSChtuff!");
3240 (void)set_image(p_ptr->image + randint0(150) + 150);
3246 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3248 if (!p_ptr->resist_chaos)
3251 p_ptr->redraw |= PR_EXTRA;
3252 (void)set_image(p_ptr->image + randint0(50) + 20);
3256 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3261 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3263 msg_print("BRRAAAP! Oops.");
3267 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3270 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3271 !p_ptr->anti_magic && one_in_(9000))
3276 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3278 msg_print("Magical energy flows through you! You must release it!");
3283 (void)get_hack_dir(&dire);
3284 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3287 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3288 !p_ptr->anti_magic && (randint1(6666) == 666))
3290 bool pet = one_in_(6);
3291 u32b mode = PM_ALLOW_GROUP;
3293 if (pet) mode |= PM_FORCE_PET;
3294 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3296 if (summon_specific((pet ? -1 : 0), py, px,
3297 dun_level, SUMMON_DEMON, mode))
3300 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3302 msg_print("You have attracted a demon!");
3309 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3315 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3317 msg_print("You feel less energetic.");
3320 if (p_ptr->fast > 0)
3326 set_slow(randint1(30) + 10, FALSE);
3332 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3334 msg_print("You feel more energetic.");
3337 if (p_ptr->slow > 0)
3343 set_fast(randint1(30) + 10, FALSE);
3348 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3352 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3354 msg_print("You suddenly feel almost lonely.");
3357 banish_monsters(100);
3358 if (!dun_level && p_ptr->town_num)
3361 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3363 msg_print("You see one of the shopkeepers running for the hills!");
3366 store_shuffle(randint0(MAX_STORES));
3371 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3376 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3378 msg_print("A shadow passes over you.");
3383 /* Absorb light from the current possition */
3384 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
3389 o_ptr = &inventory[INVEN_LITE];
3391 /* Absorb some fuel in the current lite */
3392 if (o_ptr->tval == TV_LITE)
3394 /* Use some fuel (except on artifacts) */
3395 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3397 /* Heal the player a bit */
3398 hp_player(o_ptr->xtra4 / 20);
3400 /* Decrease life-span of lite */
3404 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3406 msg_print("You absorb energy from your light!");
3410 /* Notice interesting fuel steps */
3411 notice_lite_change(o_ptr);
3416 * Unlite the area (radius 10) around player and
3417 * do 50 points damage to every affected monster
3419 unlite_area(50, 10);
3422 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3423 !p_ptr->anti_magic && one_in_(7000))
3425 bool pet = one_in_(3);
3426 u32b mode = PM_ALLOW_GROUP;
3428 if (pet) mode |= PM_FORCE_PET;
3429 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3431 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3434 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3436 msg_print("You have attracted an animal!");
3443 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3444 !p_ptr->anti_magic && one_in_(8000))
3448 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3450 msg_print("You feel the world warping around you!");
3454 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3456 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3458 if (!lose_mutation(0))
3460 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3462 msg_print("You feel oddly normal.");
3466 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3470 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3472 msg_print("You feel insubstantial!");
3476 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3478 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3482 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3484 int which_stat = randint0(6);
3485 int sustained = FALSE;
3490 if (p_ptr->sustain_str) sustained = TRUE;
3493 if (p_ptr->sustain_int) sustained = TRUE;
3496 if (p_ptr->sustain_wis) sustained = TRUE;
3499 if (p_ptr->sustain_dex) sustained = TRUE;
3502 if (p_ptr->sustain_con) sustained = TRUE;
3505 if (p_ptr->sustain_chr) sustained = TRUE;
3509 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3511 msg_print("Invalid stat chosen!");
3521 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3523 msg_print("You can feel yourself wasting away!");
3527 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3530 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3531 !p_ptr->anti_magic && one_in_(3000))
3533 bool pet = one_in_(5);
3534 u32b mode = PM_ALLOW_GROUP;
3536 if (pet) mode |= PM_FORCE_PET;
3537 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3539 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3542 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3544 msg_print("You have attracted a dragon!");
3550 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3553 if (p_ptr->tim_esp > 0)
3556 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3558 msg_print("Your mind feels cloudy!");
3561 set_tim_esp(0, TRUE);
3566 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3568 msg_print("Your mind expands!");
3571 set_tim_esp(p_ptr->lev, FALSE);
3574 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3579 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3581 msg_print("Your stomach roils, and you lose your lunch!");
3585 set_food(PY_FOOD_WEAK);
3588 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3589 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3594 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3596 int danger_amount = 0;
3599 for (monster = 0; monster < m_max; monster++)
3601 monster_type *m_ptr = &m_list[monster];
3602 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3604 /* Paranoia -- Skip dead monsters */
3605 if (!m_ptr->r_idx) continue;
3607 if (r_ptr->level >= p_ptr->lev)
3609 danger_amount += r_ptr->level - p_ptr->lev + 1;
3613 if (danger_amount > 100)
3615 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3617 msg_print("You feel utterly terrified!");
3620 else if (danger_amount > 50)
3622 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3624 msg_print("You feel terrified!");
3627 else if (danger_amount > 20)
3629 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3631 msg_print("You feel very worried!");
3634 else if (danger_amount > 10)
3636 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3638 msg_print("You feel paranoid!");
3641 else if (danger_amount > 5)
3643 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3645 msg_print("You feel almost safe.");
3650 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3652 msg_print("You feel lonely.");
3656 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3661 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3663 msg_print("You feel invincible!");
3667 (void)set_invuln(randint1(8) + 8, FALSE);
3669 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3671 int wounds = p_ptr->mhp - p_ptr->chp;
3675 int healing = p_ptr->csp;
3677 if (healing > wounds)
3683 p_ptr->csp -= healing;
3686 p_ptr->redraw |= (PR_MANA);
3689 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3692 int wounds = p_ptr->msp - p_ptr->csp;
3696 int healing = p_ptr->chp;
3698 if (healing > wounds)
3703 p_ptr->csp += healing;
3706 p_ptr->redraw |= (PR_MANA);
3708 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3710 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3715 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3721 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3722 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3724 msg_print("You trip over your own feet!");
3725 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3730 if (buki_motteruka(INVEN_RARM))
3732 int slot = INVEN_RARM;
3733 o_ptr = &inventory[INVEN_RARM];
3734 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3736 o_ptr = &inventory[INVEN_LARM];
3739 if (!cursed_p(o_ptr))
3742 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3744 msg_print("You drop your weapon!");
3747 inven_drop(slot, 1);
3754 /*** Process Inventory ***/
3756 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3759 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3760 * can actually be useful!
3762 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3765 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3767 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3771 teleport_player(50);
3774 /* Make a chainsword noise */
3775 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3779 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3781 if (!get_rnd_line("chainswd.txt", 0, noise))
3784 disturb(FALSE, FALSE);
3787 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3790 (void)activate_ty_curse(FALSE, &count);
3792 /* Handle experience draining */
3793 if (p_ptr->prace != RACE_ANDROID &&
3794 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3796 p_ptr->exp -= (p_ptr->lev+1)/2;
3797 if (p_ptr->exp < 0) p_ptr->exp = 0;
3798 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3799 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3802 /* Add light curse (Later) */
3803 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3808 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3810 new_curse = get_curse(0, o_ptr);
3811 if (!(o_ptr->curse_flags & new_curse))
3813 char o_name[MAX_NLEN];
3815 object_desc(o_name, o_ptr, FALSE, 0);
3817 o_ptr->curse_flags |= new_curse;
3819 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3821 msg_format("There is a malignant black aura surrounding %s...", o_name);
3824 o_ptr->feeling = FEEL_NONE;
3826 p_ptr->update |= (PU_BONUS);
3829 /* Add heavy curse (Later) */
3830 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3835 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3837 new_curse = get_curse(1, o_ptr);
3838 if (!(o_ptr->curse_flags & new_curse))
3840 char o_name[MAX_NLEN];
3842 object_desc(o_name, o_ptr, FALSE, 0);
3844 o_ptr->curse_flags |= new_curse;
3846 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3848 msg_format("There is a malignant black aura surrounding %s...", o_name);
3851 o_ptr->feeling = FEEL_NONE;
3853 p_ptr->update |= (PU_BONUS);
3857 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3859 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3860 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3862 char o_name[MAX_NLEN];
3864 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3866 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3868 msg_format("%s have attracted an animal!", o_name);
3875 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3877 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (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_DEMON), FALSE, 0);
3883 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3885 msg_format("%s have attracted a demon!", o_name);
3892 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3894 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3895 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3897 char o_name[MAX_NLEN];
3899 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3901 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3903 msg_format("%s have attracted an animal!", o_name);
3909 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3911 if (!p_ptr->resist_fear)
3915 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3917 msg_print("It's so dark... so scary!");
3920 set_afraid(p_ptr->afraid + 13 + randint1(26));
3923 /* Teleport player */
3924 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3928 /* Teleport player */
3929 teleport_player(40);
3931 /* Handle HP draining */
3932 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3934 char o_name[MAX_NLEN];
3936 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3938 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3940 msg_format("%s drains HP from you!", o_name);
3942 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3944 /* Handle mana draining */
3945 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3947 char o_name[MAX_NLEN];
3949 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3951 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3953 msg_format("%s drains mana from you!", o_name);
3955 p_ptr->csp -= MIN(p_ptr->lev, 50);
3959 p_ptr->csp_frac = 0;
3961 p_ptr->redraw |= PR_MANA;
3965 /* Rarely, take damage from the Jewel of Judgement */
3966 if (one_in_(999) && !p_ptr->anti_magic)
3968 object_type *o_ptr = &inventory[INVEN_LITE];
3970 if (o_ptr->name1 == ART_JUDGE)
3973 if (object_known_p(o_ptr))
3974 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3976 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3977 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3979 if (object_known_p(o_ptr))
3980 msg_print("The Jewel of Judgement drains life from you!");
3982 msg_print("Something drains life from you!");
3983 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3989 /* Process equipment */
3990 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3992 /* Get the object */
3993 o_ptr = &inventory[i];
3995 /* Skip non-objects */
3996 if (!o_ptr->k_idx) continue;
3998 /* Recharge activatable objects */
3999 if (o_ptr->timeout > 0)
4004 /* Notice changes */
4005 if (!o_ptr->timeout)
4007 recharged_notice(o_ptr);
4013 /* Notice changes */
4017 p_ptr->window |= (PW_EQUIP);
4022 * Recharge rods. Rods now use timeout to control charging status,
4023 * and each charging rod in a stack decreases the stack's timeout by
4024 * one per turn. -LM-
4026 for (j = 0, i = 0; i < INVEN_PACK; i++)
4028 o_ptr = &inventory[i];
4029 k_ptr = &k_info[o_ptr->k_idx];
4031 /* Skip non-objects */
4032 if (!o_ptr->k_idx) continue;
4034 /* Examine all charging rods or stacks of charging rods. */
4035 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4037 /* Determine how many rods are charging. */
4038 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4039 if (temp > o_ptr->number) temp = o_ptr->number;
4041 /* Decrease timeout by that number. */
4042 o_ptr->timeout -= temp;
4044 /* Boundary control. */
4045 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4047 /* Notice changes, provide message if object is inscribed. */
4048 if (!(o_ptr->timeout))
4050 recharged_notice(o_ptr);
4056 /* Notice changes */
4060 p_ptr->notice |= (PN_COMBINE);
4063 p_ptr->window |= (PW_INVEN);
4067 /* Feel the inventory */
4072 /*** Process Objects ***/
4074 /* Process objects */
4075 for (i = 1; i < o_max; i++)
4080 /* Skip dead objects */
4081 if (!o_ptr->k_idx) continue;
4083 /* Recharge rods on the ground. No messages. */
4084 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4087 o_ptr->timeout -= o_ptr->number;
4089 /* Boundary control. */
4090 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4095 /*** Involuntary Movement ***/
4097 /* Delayed Word-of-Recall */
4098 if (p_ptr->word_recall)
4101 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4102 * The player is yanked up/down as soon as
4103 * he loads the autosaved game.
4105 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4106 do_cmd_save_game(TRUE);
4108 /* Count down towards recall */
4109 p_ptr->word_recall--;
4111 p_ptr->redraw |= (PR_STATUS);
4113 /* Activate the recall */
4114 if (!p_ptr->word_recall)
4119 /* Determine the level */
4120 if (dun_level || p_ptr->inside_quest)
4123 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4125 msg_print("You feel yourself yanked upwards!");
4128 p_ptr->recall_dungeon = dungeon_type;
4130 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4134 prepare_change_floor_mode(CFM_CLEAR_ALL);
4136 leave_quest_check();
4138 p_ptr->inside_quest = 0;
4139 p_ptr->leaving = TRUE;
4144 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4146 msg_print("You feel yourself yanked downwards!");
4149 dungeon_type = p_ptr->recall_dungeon;
4152 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4155 dun_level = max_dlv[dungeon_type];
4156 if (dun_level < 1) dun_level = 1;
4158 /* Nightmare mode makes recall more dangerous */
4159 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4165 else if (dun_level < 99)
4167 dun_level = (dun_level + 99) / 2;
4169 else if (dun_level > 100)
4171 dun_level = d_info[dungeon_type].maxdepth - 1;
4175 if (p_ptr->wild_mode)
4177 p_ptr->wilderness_y = py;
4178 p_ptr->wilderness_x = px;
4182 /* Save player position */
4186 p_ptr->wild_mode = FALSE;
4188 prepare_change_floor_mode(CFM_CLEAR_ALL);
4191 p_ptr->leaving = TRUE;
4193 if (dungeon_type == DUNGEON_ANGBAND)
4195 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4197 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4198 (quest[i].status == QUEST_STATUS_TAKEN) &&
4199 (quest[i].level < dun_level))
4201 quest[i].status = QUEST_STATUS_FAILED;
4202 quest[i].complev = (byte)p_ptr->lev;
4203 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4210 sound(SOUND_TPLEVEL);
4215 /* Delayed Alter reality */
4216 if (p_ptr->alter_reality)
4218 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4219 do_cmd_save_game(TRUE);
4221 /* Count down towards alter */
4222 p_ptr->alter_reality--;
4224 p_ptr->redraw |= (PR_STATUS);
4226 /* Activate the alter reality */
4227 if (!p_ptr->alter_reality)
4232 /* Determine the level */
4233 if (!quest_number(dun_level) && dun_level)
4236 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4238 msg_print("The world changes!");
4241 prepare_change_floor_mode(CFM_CLEAR_ALL);
4244 p_ptr->leaving = TRUE;
4249 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4251 msg_print("The world seems to change for a moment!");
4256 sound(SOUND_TPLEVEL);
4264 * Verify use of "wizard" mode
4266 static bool enter_wizard_mode(void)
4268 /* Ask first time */
4269 if (!p_ptr->noscore)
4271 /* Wizard mode is not permitted */
4272 if (!allow_debug_opts)
4275 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4277 msg_print("Wizard mode is not permitted.");
4282 /* Mention effects */
4284 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4285 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4287 msg_print("Wizard mode is for debugging and experimenting.");
4288 msg_print("The game will not be scored if you enter wizard mode.");
4293 /* Verify request */
4295 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4297 if (!get_check("Are you sure you want to enter wizard mode? "))
4304 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4306 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4309 p_ptr->noscore |= 0x0002;
4320 * Verify use of "debug" commands
4322 static bool enter_debug_mode(void)
4324 /* Ask first time */
4325 if (!p_ptr->noscore)
4327 /* Debug mode is not permitted */
4328 if (!allow_debug_opts)
4331 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4333 msg_print("Use of debug command is not permitted.");
4338 /* Mention effects */
4340 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4341 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4343 msg_print("The debug commands are for debugging and experimenting.");
4344 msg_print("The game will not be scored if you use debug commands.");
4349 /* Verify request */
4351 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4353 if (!get_check("Are you sure you want to use debug commands? "))
4360 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4362 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4365 p_ptr->noscore |= 0x0008;
4373 * Hack -- Declare the Debug Routines
4375 extern void do_cmd_debug(void);
4377 #endif /* ALLOW_WIZARD */
4383 * Verify use of "borg" commands
4385 static bool enter_borg_mode(void)
4387 /* Ask first time */
4388 if (!(p_ptr->noscore & 0x0010))
4390 /* Mention effects */
4392 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4393 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4395 msg_print("The borg commands are for debugging and experimenting.");
4396 msg_print("The game will not be scored if you use borg commands.");
4401 /* Verify request */
4403 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4405 if (!get_check("Are you sure you want to use borg commands? "))
4412 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4414 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4417 p_ptr->noscore |= 0x0010;
4425 * Hack -- Declare the Ben Borg
4427 extern void do_cmd_borg(void);
4429 #endif /* ALLOW_BORG */
4434 * Parse and execute the current command
4435 * Give "Warning" on illegal commands.
4437 * XXX XXX XXX Make some "blocks"
4439 static void process_command(void)
4441 int old_now_message = now_message;
4443 #ifdef ALLOW_REPEAT /* TNB */
4445 /* Handle repeating the last command */
4448 #endif /* ALLOW_REPEAT -- TNB */
4452 /* Parse the command */
4453 switch (command_cmd)
4469 /*** Wizard Commands ***/
4471 /* Toggle Wizard Mode */
4476 p_ptr->wizard = FALSE;
4478 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4480 msg_print("Wizard mode off.");
4484 else if (enter_wizard_mode())
4486 p_ptr->wizard = TRUE;
4488 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4490 msg_print("Wizard mode on.");
4495 /* Update monsters */
4496 p_ptr->update |= (PU_MONSTERS);
4498 /* Redraw "title" */
4499 p_ptr->redraw |= (PR_TITLE);
4507 /* Special "debug" commands */
4510 /* Enter debug mode */
4511 if (enter_debug_mode())
4518 #endif /* ALLOW_WIZARD */
4523 /* Special "borg" commands */
4526 /* Enter borg mode */
4527 if (enter_borg_mode())
4529 if (!p_ptr->wild_mode) do_cmd_borg();
4535 #endif /* ALLOW_BORG */
4539 /*** Inventory Commands ***/
4541 /* Wear/wield equipment */
4544 if (!p_ptr->wild_mode) do_cmd_wield();
4548 /* Take off equipment */
4551 if (!p_ptr->wild_mode) do_cmd_takeoff();
4558 if (!p_ptr->wild_mode) do_cmd_drop();
4562 /* Destroy an item */
4569 /* Equipment list */
4576 /* Inventory list */
4584 /*** Various commands ***/
4586 /* Identify an object */
4593 /* Hack -- toggle windows */
4596 toggle_inven_equip();
4601 /*** Standard "Movement" Commands ***/
4606 if (!p_ptr->wild_mode) do_cmd_alter();
4613 if (!p_ptr->wild_mode) do_cmd_tunnel();
4617 /* Move (usually pick up things) */
4620 #ifdef ALLOW_EASY_DISARM /* TNB */
4624 #else /* ALLOW_EASY_DISARM -- TNB */
4626 do_cmd_walk(always_pickup);
4628 #endif /* ALLOW_EASY_DISARM -- TNB */
4633 /* Move (usually do not pick up) */
4636 #ifdef ALLOW_EASY_DISARM /* TNB */
4640 #else /* ALLOW_EASY_DISARM -- TNB */
4642 do_cmd_walk(!always_pickup);
4644 #endif /* ALLOW_EASY_DISARM -- TNB */
4650 /*** Running, Resting, Searching, Staying */
4652 /* Begin Running -- Arg is Max Distance */
4655 if (!p_ptr->wild_mode) do_cmd_run();
4659 /* Stay still (usually pick things up) */
4662 do_cmd_stay(always_pickup);
4666 /* Stay still (usually do not pick up) */
4669 do_cmd_stay(!always_pickup);
4673 /* Rest -- Arg is time */
4680 /* Search for traps/doors */
4687 /* Toggle search mode */
4690 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4691 else set_action(ACTION_SEARCH);
4696 /*** Stairs and Doors and Chests and Traps ***/
4699 case SPECIAL_KEY_STORE:
4701 if (!p_ptr->wild_mode) do_cmd_store();
4705 /* Enter building -KMW- */
4706 case SPECIAL_KEY_BUILDING:
4708 if (!p_ptr->wild_mode) do_cmd_bldg();
4712 /* Enter quest level -KMW- */
4713 case SPECIAL_KEY_QUEST:
4715 if (!p_ptr->wild_mode) do_cmd_quest();
4719 /* Go up staircase */
4722 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4729 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4731 msg_print("To flee the ambush you have to reach the edge of the map.");
4734 else if (p_ptr->food < PY_FOOD_WEAK)
4737 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4739 msg_print("You must eat something here.");
4744 if (change_wild_mode())
4757 /* Go down staircase */
4760 if(!p_ptr->wild_mode) do_cmd_go_down();
4763 p_ptr->wilderness_x = px;
4764 p_ptr->wilderness_y = py;
4770 /* Open a door or chest */
4773 if (!p_ptr->wild_mode) do_cmd_open();
4780 if (!p_ptr->wild_mode) do_cmd_close();
4784 /* Jam a door with spikes */
4787 if (!p_ptr->wild_mode) do_cmd_spike();
4794 if (!p_ptr->wild_mode) do_cmd_bash();
4798 /* Disarm a trap or chest */
4801 if (!p_ptr->wild_mode) do_cmd_disarm();
4806 /*** Magic and Prayers ***/
4808 /* Gain new spells/prayers */
4811 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4813 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4815 msg_print("You don't have to learn spells!");
4817 else if (p_ptr->pclass == CLASS_SAMURAI)
4818 do_cmd_gain_hissatsu();
4819 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4829 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4830 (p_ptr->pclass == CLASS_BERSERKER) ||
4831 (p_ptr->pclass == CLASS_NINJA) ||
4832 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4833 ) do_cmd_mind_browse();
4834 else if (p_ptr->pclass == CLASS_SMITH)
4836 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4837 do_cmd_magic_eater(TRUE);
4838 else do_cmd_browse();
4846 if (!p_ptr->wild_mode)
4848 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4851 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4853 msg_print("You cannot cast spells!");
4856 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4859 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4861 msg_print("The dungeon absorbs all attempted magic!");
4865 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4869 cptr which_power = "ËâË¡";
4871 cptr which_power = "magic";
4873 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4875 which_power = "ĶǽÎÏ";
4877 which_power = "psionic powers";
4879 else if (p_ptr->pclass == CLASS_IMITATOR)
4881 which_power = "¤â¤Î¤Þ¤Í";
4883 which_power = "imitation";
4885 else if (p_ptr->pclass == CLASS_SAMURAI)
4887 which_power = "ɬ»¦·õ";
4889 which_power = "hissatsu";
4891 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4893 which_power = "¶ÀËâË¡";
4895 which_power = "mirror magic";
4897 else if (p_ptr->pclass == CLASS_NINJA)
4899 which_power = "Ǧ½Ñ";
4901 which_power = "ninjutsu";
4903 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4905 which_power = "µ§¤ê";
4907 which_power = "prayer";
4911 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4913 msg_format("An anti-magic shell disrupts your %s!", which_power);
4917 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4920 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4922 msg_format("You cannot think directly!");
4928 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4929 (p_ptr->pclass == CLASS_BERSERKER) ||
4930 (p_ptr->pclass == CLASS_NINJA) ||
4931 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4934 else if (p_ptr->pclass == CLASS_IMITATOR)
4936 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4937 do_cmd_magic_eater(FALSE);
4938 else if (p_ptr->pclass == CLASS_SAMURAI)
4940 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4941 do_cmd_cast_learned();
4942 else if (p_ptr->pclass == CLASS_SMITH)
4951 /* Issue a pet command */
4954 if (!p_ptr->wild_mode) do_cmd_pet();
4958 /*** Use various objects ***/
4960 /* Inscribe an object */
4967 /* Uninscribe an object */
4970 do_cmd_uninscribe();
4974 /* Activate an artifact */
4977 if (!p_ptr->wild_mode)
4979 if (!p_ptr->inside_arena)
4984 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4986 msg_print("The arena absorbs all attempted magic!");
5002 /* Fuel your lantern/torch */
5012 if (!p_ptr->wild_mode) do_cmd_fire();
5019 if (!p_ptr->wild_mode)
5029 if (!p_ptr->wild_mode)
5031 if (!p_ptr->inside_arena)
5036 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5038 msg_print("The arena absorbs all attempted magic!");
5050 if (!p_ptr->wild_mode)
5052 if (p_ptr->inside_arena)
5055 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5057 msg_print("The arena absorbs all attempted magic!");
5062 else if (use_command && rogue_like_commands)
5074 /* Quaff a potion */
5077 if (!p_ptr->wild_mode)
5079 if (!p_ptr->inside_arena)
5080 do_cmd_quaff_potion();
5084 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5086 msg_print("The arena absorbs all attempted magic!");
5098 if (!p_ptr->wild_mode)
5100 if (!p_ptr->inside_arena)
5101 do_cmd_read_scroll();
5105 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5107 msg_print("The arena absorbs all attempted magic!");
5119 if (!p_ptr->wild_mode)
5121 if (p_ptr->inside_arena)
5124 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5126 msg_print("The arena absorbs all attempted magic!");
5131 else if (use_command && !rogue_like_commands)
5141 /* Use racial power */
5144 if (!p_ptr->wild_mode) do_cmd_racial_power();
5149 /*** Looking at Things (nearby or on map) ***/
5151 /* Full dungeon map */
5158 /* Locate player on map */
5172 /* Target monster or location */
5175 if (!p_ptr->wild_mode) do_cmd_target();
5181 /*** Help and Such ***/
5190 /* Identify symbol */
5193 do_cmd_query_symbol();
5197 /* Character description */
5200 do_cmd_change_name();
5205 /*** System Commands ***/
5207 /* Hack -- User interface */
5214 /* Single line from a pref file */
5229 do_cmd_edit_autopick();
5233 /* Interact with macros */
5240 /* Interact with visuals */
5248 /* Interact with colors */
5256 /* Interact with options */
5264 /*** Misc Commands ***/
5280 /* Repeat level feeling */
5283 if (!p_ptr->wild_mode) do_cmd_feeling();
5287 /* Show previous message */
5290 do_cmd_message_one();
5294 /* Show previous messages */
5297 do_cmd_messages(old_now_message);
5301 /* Show quest status -KMW- */
5304 do_cmd_checkquest();
5308 /* Redraw the screen */
5311 now_message = old_now_message;
5316 #ifndef VERIFY_SAVEFILE
5318 /* Hack -- Save and don't quit */
5321 do_cmd_save_game(FALSE);
5325 #endif /* VERIFY_SAVEFILE */
5335 case SPECIAL_KEY_QUIT:
5337 do_cmd_save_and_exit();
5341 /* Quit (commit suicide) */
5354 /* Check artifacts, uniques, objects */
5361 /* Load "screen dump" */
5364 do_cmd_load_screen();
5368 /* Save "screen dump" */
5371 do_cmd_save_screen();
5375 /* Make random artifact list */
5378 spoil_random_artifact("randifact.txt");
5382 /* Hack -- Unknown command */
5385 if (flush_failure) flush();
5389 sound(SOUND_ILLEGAL);
5391 if (!get_rnd_line("error_j.txt", 0, error_m))
5393 if (!get_rnd_line("error.txt", 0, error_m))
5400 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5402 prt("Type '?' for help.", 0, 0);
5408 if (!energy_use && !now_message)
5409 now_message = old_now_message;
5415 static bool monster_tsuri(int r_idx)
5417 monster_race *r_ptr = &r_info[r_idx];
5419 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5427 * Process the player
5429 * Notice the annoying code to handle "pack overflow", which
5430 * must come first just in case somebody manages to corrupt
5431 * the savefiles by clever use of menu commands or something.
5433 static void process_player(void)
5437 /*** Apply energy ***/
5442 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5444 msg_print("You feel different!");
5447 (void)gain_random_mutation(0);
5448 hack_mutation = FALSE;
5451 if (p_ptr->inside_battle)
5453 for(i = 1; i < m_max; i++)
5455 monster_type *m_ptr = &m_list[i];
5457 if (!m_ptr->r_idx) continue;
5459 /* Hack -- Detect monster */
5460 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5462 /* Update the monster */
5463 update_mon(i, FALSE);
5468 /* Give the player some energy */
5469 else if (!(load && p_ptr->energy_need <= 0))
5471 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5475 if (p_ptr->energy_need > 0) return;
5476 if (!command_rep) prt_time();
5478 /*** Check for interupts ***/
5480 /* Complete resting */
5487 if ((p_ptr->chp == p_ptr->mhp) &&
5488 (p_ptr->csp >= p_ptr->msp))
5490 set_action(ACTION_NONE);
5494 /* Complete resting */
5495 else if (resting == -2)
5498 if ((p_ptr->chp == p_ptr->mhp) &&
5499 (p_ptr->csp >= p_ptr->msp) &&
5500 !p_ptr->blind && !p_ptr->confused &&
5501 !p_ptr->poisoned && !p_ptr->afraid &&
5502 !p_ptr->stun && !p_ptr->cut &&
5503 !p_ptr->slow && !p_ptr->paralyzed &&
5504 !p_ptr->image && !p_ptr->word_recall &&
5505 !p_ptr->alter_reality)
5507 set_action(ACTION_NONE);
5512 if (p_ptr->action == ACTION_FISH)
5515 Term_xtra(TERM_XTRA_DELAY, 10);
5519 bool success = FALSE;
5520 get_mon_num_prep(monster_tsuri,NULL);
5521 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5523 if (r_idx && one_in_(2))
5526 y = py+ddy[tsuri_dir];
5527 x = px+ddx[tsuri_dir];
5528 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5531 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5533 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5535 msg_format("You have a good catch!", m_name);
5543 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5545 msg_print("Damn! The fish stole your bait!");
5552 /* Handle "abort" */
5555 /* Check for "player abort" (semi-efficiently for resting) */
5556 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5561 /* Check for a key */
5570 /* Hack -- Show a Message */
5572 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5574 msg_print("Canceled.");
5581 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5583 monster_type *m_ptr = &m_list[p_ptr->riding];
5592 if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5594 /* Acquire the monster name */
5595 monster_desc(m_name, m_ptr, 0);
5597 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5599 msg_format("You have waked %s up.", m_name);
5601 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5602 p_ptr->redraw |= (PR_UHEALTH);
5609 /* Make a "saving throw" against stun */
5610 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5616 /* Hack -- Recover from stun */
5617 if (m_ptr->stunned > d)
5619 /* Recover somewhat */
5620 m_ptr->stunned -= d;
5631 /* Acquire the monster name */
5632 monster_desc(m_name, m_ptr, 0);
5634 /* Dump a message */
5636 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5638 msg_format("%^s is no longer stunned.", m_name);
5640 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5641 p_ptr->redraw |= (PR_UHEALTH);
5645 if (m_ptr->confused)
5649 /* Make a "saving throw" against stun */
5650 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5653 d = m_ptr->confused;
5656 /* Hack -- Recover from stun */
5657 if (m_ptr->confused > d)
5659 /* Recover somewhat */
5660 m_ptr->confused -= d;
5669 m_ptr->confused = 0;
5671 /* Acquire the monster name */
5672 monster_desc(m_name, m_ptr, 0);
5674 /* Dump a message */
5676 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5678 msg_format("%^s is no longer confused.", m_name);
5680 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5681 p_ptr->redraw |= (PR_UHEALTH);
5689 /* Make a "saving throw" against stun */
5690 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5696 /* Hack -- Recover from stun */
5697 if (m_ptr->monfear > d)
5699 /* Recover somewhat */
5700 m_ptr->monfear -= d;
5711 /* Acquire the monster name */
5712 monster_desc(m_name, m_ptr, 0);
5714 /* Dump a message */
5716 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5718 msg_format("%^s is no longer fear.", m_name);
5720 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5721 p_ptr->redraw |= (PR_UHEALTH);
5725 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5729 /* Handle the player song */
5730 if (!load) check_music();
5735 if (p_ptr->lightspeed)
5737 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5739 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5741 if (p_ptr->magic_num1[0] < 40)
5743 p_ptr->magic_num1[0] = 0;
5745 else p_ptr->magic_num1[0] -= 40;
5746 p_ptr->update |= (PU_BONUS);
5748 if (p_ptr->action == ACTION_LEARN)
5750 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5751 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5754 p_ptr->csp_frac = 0;
5755 set_action(ACTION_NONE);
5759 p_ptr->csp -= (s16b)(hoge >> 16);
5761 if (p_ptr->csp_frac < hoge)
5763 p_ptr->csp_frac += 0x10000L - hoge;
5767 p_ptr->csp_frac -= hoge;
5769 p_ptr->redraw |= PR_MANA;
5772 if (p_ptr->special_defense & KATA_MASK)
5774 if (p_ptr->special_defense & KATA_MUSOU)
5778 set_action(ACTION_NONE);
5783 p_ptr->redraw |= (PR_MANA);
5788 /*** Handle actual user input ***/
5790 /* Repeat until out of energy */
5791 while (p_ptr->energy_need <= 0)
5793 p_ptr->window |= PW_PLAYER;
5794 p_ptr->sutemi = FALSE;
5795 p_ptr->counter = FALSE;
5796 now_damaged = FALSE;
5798 /* Handle "p_ptr->notice" */
5801 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5804 /* Place the cursor on the player */
5805 move_cursor_relative(py, px);
5807 /* Refresh (optional) */
5808 if (fresh_before) Term_fresh();
5811 /* Hack -- Pack Overflow */
5812 if (inventory[INVEN_PACK].k_idx)
5814 int item = INVEN_PACK;
5816 char o_name[MAX_NLEN];
5820 /* Access the slot to be dropped */
5821 o_ptr = &inventory[item];
5828 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5830 msg_print("Your pack overflows!");
5835 object_desc(o_name, o_ptr, TRUE, 3);
5839 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5841 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5845 /* Drop it (carefully) near the player */
5846 (void)drop_near(o_ptr, 0, py, px);
5848 /* Modify, Describe, Optimize */
5849 inven_item_increase(item, -255);
5850 inven_item_describe(item);
5851 inven_item_optimize(item);
5853 /* Handle "p_ptr->notice" */
5856 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5861 /* Hack -- cancel "lurking browse mode" */
5862 if (!command_new) command_see = FALSE;
5865 /* Assume free turn */
5869 if (p_ptr->inside_battle)
5871 /* Place the cursor on the player */
5872 move_cursor_relative(py, px);
5874 command_cmd = SPECIAL_KEY_BUILDING;
5876 /* Process the command */
5880 /* Paralyzed or Knocked Out */
5881 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5888 else if (p_ptr->action == ACTION_REST)
5893 /* Reduce rest count */
5896 if (!resting) set_action(ACTION_NONE);
5898 /* Redraw the state */
5899 p_ptr->redraw |= (PR_STATE);
5907 else if (p_ptr->action == ACTION_FISH)
5920 /* Repeated command */
5921 else if (command_rep)
5923 /* Count this execution */
5926 /* Redraw the state */
5927 p_ptr->redraw |= (PR_STATE);
5932 /* Hack -- Assume messages were seen */
5935 /* Clear the top line */
5938 /* Process the command */
5942 /* Normal command */
5945 /* Place the cursor on the player */
5946 move_cursor_relative(py, px);
5949 /* Get a command (normal) */
5950 request_command(FALSE);
5953 /* Process the command */
5963 /* Use some energy */
5964 if (world_player || energy_use > 400)
5966 /* The Randomness is irrelevant */
5967 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5971 /* There is some randomness of needed energy */
5972 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5975 /* Hack -- constant hallucination */
5976 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5979 /* Shimmer monsters if needed */
5980 if (shimmer_monsters)
5982 /* Clear the flag */
5983 shimmer_monsters = FALSE;
5985 /* Shimmer multi-hued monsters */
5986 for (i = 1; i < m_max; i++)
5988 monster_type *m_ptr;
5989 monster_race *r_ptr;
5991 /* Access monster */
5994 /* Skip dead monsters */
5995 if (!m_ptr->r_idx) continue;
5997 /* Skip unseen monsters */
5998 if (!m_ptr->ml) continue;
6000 /* Access the monster race */
6001 r_ptr = &r_info[m_ptr->ap_r_idx];
6003 /* Skip non-multi-hued monsters */
6004 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6007 /* Reset the flag */
6008 shimmer_monsters = TRUE;
6010 /* Redraw regardless */
6011 lite_spot(m_ptr->fy, m_ptr->fx);
6016 /* Handle monster detection */
6017 if (repair_monsters)
6019 /* Reset the flag */
6020 repair_monsters = FALSE;
6022 /* Rotate detection flags */
6023 for (i = 1; i < m_max; i++)
6025 monster_type *m_ptr;
6027 /* Access monster */
6030 /* Skip dead monsters */
6031 if (!m_ptr->r_idx) continue;
6033 /* Nice monsters get mean */
6034 if (m_ptr->mflag & MFLAG_NICE)
6036 /* Nice monsters get mean */
6037 m_ptr->mflag &= ~(MFLAG_NICE);
6040 /* Handle memorized monsters */
6041 if (m_ptr->mflag2 & MFLAG2_MARK)
6043 /* Maintain detection */
6044 if (m_ptr->mflag2 & MFLAG2_SHOW)
6047 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6049 /* Still need repairs */
6050 repair_monsters = TRUE;
6053 /* Remove detection */
6057 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6059 /* Assume invisible */
6062 /* Update the monster */
6063 update_mon(i, FALSE);
6065 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6066 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6068 /* Redraw regardless */
6069 lite_spot(m_ptr->fy, m_ptr->fx);
6074 if (p_ptr->pclass == CLASS_IMITATOR)
6076 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6079 for (i = 0; i < p_ptr->mane_num; i++)
6081 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6082 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6086 p_ptr->redraw |= (PR_MANE);
6088 if (p_ptr->action == ACTION_LEARN)
6091 p_ptr->redraw |= (PR_STATE);
6094 if (world_player && (p_ptr->energy_need > - 1000))
6097 p_ptr->redraw |= (PR_MAP);
6099 /* Update monsters */
6100 p_ptr->update |= (PU_MONSTERS);
6103 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6106 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6108 msg_print("You feel time flowing around you once more.");
6111 world_player = FALSE;
6112 p_ptr->energy_need = ENERGY_NEED();
6114 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6119 /* Hack -- notice death */
6120 if (!p_ptr->playing || p_ptr->is_dead)
6122 world_player = FALSE;
6126 /* Handle "leaving" */
6127 if (p_ptr->leaving) break;
6130 /* Update scent trail */
6136 * Interact with the current dungeon level.
6138 * This function will not exit until the level is completed,
6139 * the user dies, or the game is terminated.
6141 static void dungeon(bool load_game)
6145 /* Set the base level */
6146 base_level = dun_level;
6148 /* Reset various flags */
6152 p_ptr->leaving = FALSE;
6154 /* Reset the "command" vars */
6162 /* Cancel the target */
6166 ambush_flag = FALSE;
6168 /* Cancel the health bar */
6171 /* Check visual effects */
6172 shimmer_monsters = TRUE;
6173 shimmer_objects = TRUE;
6174 repair_monsters = TRUE;
6175 repair_objects = TRUE;
6181 /* Get index of current quest (if any) */
6182 quest_num = quest_number(dun_level);
6184 /* Inside a quest? */
6187 /* Mark the quest monster */
6188 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6191 /* Track maximum player level */
6192 if (p_ptr->max_plv < p_ptr->lev)
6194 p_ptr->max_plv = p_ptr->lev;
6198 /* Track maximum dungeon level (if not in quest -KMW-) */
6199 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6201 max_dlv[dungeon_type] = dun_level;
6202 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6205 /* Validate the panel */
6206 panel_bounds_center();
6208 /* Verify the panel */
6211 /* Flush messages */
6215 /* Enter "xtra" mode */
6216 character_xtra = TRUE;
6219 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6221 /* Redraw dungeon */
6222 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6225 p_ptr->redraw |= (PR_MAP);
6228 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6230 /* Update lite/view */
6231 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6233 /* Update monsters */
6234 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6236 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6239 /* Leave "xtra" mode */
6240 character_xtra = FALSE;
6243 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6245 /* Combine / Reorder the pack */
6246 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6248 /* Handle "p_ptr->notice" */
6251 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6257 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6258 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6259 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6261 if (p_ptr->inside_battle)
6265 p_ptr->energy_need = 0;
6271 msg_print("»î¹ç³«»Ï¡ª");
6273 msg_format("Ready..Fight!");
6279 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6280 p_ptr->magic_num1[0] = MUSIC_DETECT;
6282 /* Hack -- notice death or departure */
6283 if (!p_ptr->playing || p_ptr->is_dead) return;
6285 /* Print quest message if appropriate */
6286 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6288 quest_discovery(random_quest_number(dun_level));
6289 p_ptr->inside_quest = random_quest_number(dun_level);
6291 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6293 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6295 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6296 d_name+d_info[dungeon_type].name,
6297 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6299 msg_format("%^s lives in this level as the keeper of %s.",
6300 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6301 d_name+d_info[dungeon_type].name);
6305 /*** Process this dungeon level ***/
6307 /* Reset the monster generation level */
6308 monster_level = base_level;
6310 /* Reset the object generation level */
6311 object_level = base_level;
6315 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6316 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6317 p_ptr->energy_need = 0;
6319 /* Not leaving dungeon */
6320 p_ptr->leaving_dungeon = FALSE;
6325 /* Hack -- Compact the monster list occasionally */
6326 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6328 /* Hack -- Compress the monster list occasionally */
6329 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6332 /* Hack -- Compact the object list occasionally */
6333 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6335 /* Hack -- Compress the object list occasionally */
6336 if (o_cnt + 32 < o_max) compact_objects(0);
6339 /* Process the player */
6342 /* Handle "p_ptr->notice" */
6345 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6348 /* Hack -- Hilite the player */
6349 move_cursor_relative(py, px);
6351 /* Optional fresh */
6352 if (fresh_after) Term_fresh();
6354 /* Hack -- Notice death or departure */
6355 if (!p_ptr->playing || p_ptr->is_dead) break;
6357 /* Process all of the monsters */
6360 /* Handle "p_ptr->notice" */
6363 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6366 /* Hack -- Hilite the player */
6367 move_cursor_relative(py, px);
6369 /* Optional fresh */
6370 if (fresh_after) Term_fresh();
6372 /* Hack -- Notice death or departure */
6373 if (!p_ptr->playing || p_ptr->is_dead) break;
6376 /* Process the world */
6379 /* Handle "p_ptr->notice" */
6382 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6385 /* Hack -- Hilite the player */
6386 move_cursor_relative(py, px);
6388 /* Optional fresh */
6389 if (fresh_after) Term_fresh();
6391 /* Hack -- Notice death or departure */
6392 if (!p_ptr->playing || p_ptr->is_dead) break;
6394 /* Handle "leaving" */
6395 if (p_ptr->leaving) break;
6397 /* Count game turns */
6399 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6400 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6401 if (wild_regen) wild_regen--;
6404 /* Inside a quest and non-unique questor? */
6405 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6407 /* Un-mark the quest monster */
6408 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6411 /* Not save-and-quit and not dead? */
6412 if (p_ptr->playing && !p_ptr->is_dead)
6415 * Maintain Unique monsters and artifact, save current
6416 * floor, then prepare next floor
6420 /* Forget the flag */
6421 reinit_wilderness = FALSE;
6424 /* Write about current level on the play record once per level */
6430 * Load some "user pref files"
6432 * Modified by Arcum Dagsson to support
6433 * separate macro files for different realms.
6435 static void load_all_pref_files(void)
6440 /* Access the "user" pref file */
6441 sprintf(buf, "user.prf");
6443 /* Process that file */
6444 process_pref_file(buf);
6446 /* Access the "user" system pref file */
6447 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6449 /* Process that file */
6450 process_pref_file(buf);
6452 /* Access the "race" pref file */
6453 sprintf(buf, "%s.prf", rp_ptr->title);
6455 /* Process that file */
6456 process_pref_file(buf);
6458 /* Access the "class" pref file */
6459 sprintf(buf, "%s.prf", cp_ptr->title);
6461 /* Process that file */
6462 process_pref_file(buf);
6464 /* Access the "character" pref file */
6465 sprintf(buf, "%s.prf", player_base);
6467 /* Process that file */
6468 process_pref_file(buf);
6470 /* Free old entries */
6474 sprintf(buf, "picktype-%s.prf", player_base);
6476 sprintf(buf, "pickpref-%s.prf", player_base);
6479 err = process_pickpref_file(buf);
6481 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6485 process_pickpref_file("picktype.prf");
6487 process_pickpref_file("pickpref.prf");
6491 /* Access the "realm 1" pref file */
6492 if (p_ptr->realm1 != REALM_NONE)
6494 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6496 /* Process that file */
6497 process_pref_file(buf);
6500 /* Access the "realm 2" pref file */
6501 if (p_ptr->realm2 != REALM_NONE)
6503 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6505 /* Process that file */
6506 process_pref_file(buf);
6512 * Extract option variables from bit sets
6514 void extract_option_vars(void)
6518 for (i = 0; option_info[i].o_desc; i++)
6520 int os = option_info[i].o_set;
6521 int ob = option_info[i].o_bit;
6523 /* Set the "default" options */
6524 if (option_info[i].o_var)
6527 if (option_flag[os] & (1L << ob))
6530 (*option_info[i].o_var) = TRUE;
6537 (*option_info[i].o_var) = FALSE;
6545 * Determine bounty uniques
6547 void determine_bounty_uniques(void)
6550 monster_race *r_ptr;
6552 get_mon_num_prep(NULL, NULL);
6553 for (i = 0; i < MAX_KUBI; i++)
6557 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6558 r_ptr = &r_info[kubi_r_idx[i]];
6560 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6562 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6564 if (r_ptr->rarity > 100) continue;
6566 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6568 for (j = 0; j < i; j++)
6569 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6576 for (i = 0; i < MAX_KUBI - 1; i++)
6578 for (j = i; j < MAX_KUBI; j++)
6580 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6582 tmp = kubi_r_idx[i];
6583 kubi_r_idx[i] = kubi_r_idx[j];
6584 kubi_r_idx[j] = tmp;
6592 * Determine today's bounty monster
6593 * Note: conv_old is used if loaded 0.0.3 or older save file
6595 void determine_today_mon(bool conv_old)
6598 bool old_inside_battle = p_ptr->inside_battle;
6599 monster_race *r_ptr;
6603 for (i = 0; i < max_d_idx; i++)
6605 if (max_dlv[i] < d_info[i].mindepth) continue;
6606 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6609 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6611 p_ptr->inside_battle = TRUE;
6612 get_mon_num_prep(NULL, NULL);
6616 today_mon = get_mon_num(max_dl);
6617 r_ptr = &r_info[today_mon];
6619 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6620 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
6621 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6622 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6623 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6624 if (r_ptr->rarity > 10) continue;
6628 p_ptr->today_mon = 0;
6629 p_ptr->inside_battle = old_inside_battle;
6634 * Actually play a game
6636 * If the "new_game" parameter is true, then, after loading the
6637 * savefile, we will commit suicide, if necessary, to allow the
6638 * player to start a new game.
6640 void play_game(bool new_game)
6643 bool load_game = TRUE;
6653 hack_mutation = FALSE;
6655 /* Hack -- Character is "icky" */
6656 character_icky = TRUE;
6658 /* Make sure main term is active */
6659 Term_activate(angband_term[0]);
6661 /* Initialise the resize hooks */
6662 angband_term[0]->resize_hook = resize_map;
6664 for (i = 1; i < 8; i++)
6666 /* Does the term exist? */
6667 if (angband_term[i])
6669 /* Add the redraw on resize hook */
6670 angband_term[i]->resize_hook = redraw_window;
6674 /* Hack -- turn off the cursor */
6675 (void)Term_set_cursor(0);
6678 /* Attempt to load */
6683 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6685 quit("broken savefile");
6690 /* Extract the options */
6691 extract_option_vars();
6693 /* Report waited score */
6694 if (p_ptr->wait_report_score)
6700 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6702 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6707 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6712 p_ptr->is_dead = TRUE;
6714 start_time = time(NULL);
6716 /* No suspending now */
6717 signals_ignore_tstp();
6719 /* Hack -- Character is now "icky" */
6720 character_icky = TRUE;
6722 /* Build the filename */
6723 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6725 /* Open the high score file, for reading/writing */
6726 highscore_fd = fd_open(buf, O_RDWR);
6728 /* Handle score, show Top scores */
6729 success = send_world_score(TRUE);
6732 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6734 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6738 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6740 prt("standing by for future registration...", 0, 0);
6746 p_ptr->wait_report_score = FALSE;
6749 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6751 if (!save_player()) msg_print("death save failed!");
6754 /* Shut the high score file */
6755 (void)fd_close(highscore_fd);
6757 /* Forget the high score fd */
6760 /* Allow suspending now */
6761 signals_handle_tstp();
6766 /* Nothing loaded */
6767 if (!character_loaded)
6769 /* Make new player */
6772 /* The dungeon is not ready */
6773 character_dungeon = FALSE;
6775 /* Prepare to init the RNG */
6778 /* Initialize the saved floors data */
6779 init_saved_floors();
6782 /* Old game is loaded. But new game is requested. */
6785 /* Delete expanded temporal files */
6786 clear_saved_floor_files();
6789 /* Process old character */
6792 /* Process the player name */
6793 process_player_name(FALSE);
6802 seed = (time(NULL));
6806 /* Mutate the seed on Unix machines */
6807 seed = ((seed >> 3) * (getpid() << 1));
6811 /* Use the complex RNG */
6814 /* Seed the "complex" RNG */
6815 Rand_state_init(seed);
6818 /* Roll new character */
6821 /* The dungeon is not ready */
6822 character_dungeon = FALSE;
6826 p_ptr->inside_quest = 0;
6827 p_ptr->inside_arena = FALSE;
6828 p_ptr->inside_battle = FALSE;
6832 /* Hack -- seed for flavors */
6833 seed_flavor = randint0(0x10000000);
6835 /* Hack -- seed for town layout */
6836 seed_town = randint0(0x10000000);
6838 /* Roll up a new character */
6845 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6847 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6852 determine_bounty_uniques();
6853 determine_today_mon(FALSE);
6857 write_level = FALSE;
6860 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6862 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6866 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6867 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6869 if (p_ptr->riding == -1)
6872 for (i = m_max; i > 0; i--)
6874 if (player_bold(m_list[i].fy, m_list[i].fx))
6883 p_ptr->teleport_town = FALSE;
6884 p_ptr->sutemi = FALSE;
6885 world_monster = FALSE;
6886 now_damaged = FALSE;
6888 start_time = time(NULL) - 1;
6889 record_o_name[0] = '\0';
6891 /* Reset map panel */
6892 panel_row_min = cur_hgt;
6893 panel_col_min = cur_wid;
6895 /* Sexy gal gets bonus to maximum weapon skill of whip */
6896 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6897 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6899 /* Fill the arrays of floors and walls in the good proportions */
6900 set_floor_and_wall(dungeon_type);
6902 /* Flavor the objects */
6910 /* Flash a message */
6912 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6914 prt("Please wait...", 0, 0);
6918 /* Flush the message */
6922 /* Hack -- Enter wizard mode */
6925 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6926 else if (p_ptr->is_dead) quit("Already dead.");
6929 /* Initialize the town-buildings if necessary */
6930 if (!dun_level && !p_ptr->inside_quest)
6932 /* Init the wilderness */
6934 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6937 init_flags = INIT_ONLY_BUILDINGS;
6939 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6944 /* Generate a dungeon level if needed */
6945 if (!character_dungeon) change_floor();
6948 /* Character is now "complete" */
6949 character_generated = TRUE;
6952 /* Hack -- Character is no longer "icky" */
6953 character_icky = FALSE;
6957 p_ptr->playing = TRUE;
6959 /* Reset the visual mappings */
6962 /* Load the "pref" files */
6963 load_all_pref_files();
6965 /* React to changes */
6966 Term_xtra(TERM_XTRA_REACT, 0);
6969 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6972 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6978 /* Set or clear "rogue_like_commands" if requested */
6979 if (arg_force_original) rogue_like_commands = FALSE;
6980 if (arg_force_roguelike) rogue_like_commands = TRUE;
6982 /* Hack -- Enforce "delayed death" */
6983 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6985 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6987 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6989 monster_type *m_ptr;
6990 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6991 monster_race *r_ptr = &r_info[pet_r_idx];
6992 place_monster_aux(0, py, px - 1, pet_r_idx,
6993 (PM_FORCE_PET | PM_NO_KAGE));
6994 m_ptr = &m_list[hack_m_idx_ii];
6995 m_ptr->mspeed = r_ptr->speed;
6996 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6997 m_ptr->max_maxhp = m_ptr->maxhp;
6998 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6999 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7005 /* Process the level */
7008 /* Handle "p_ptr->notice" */
7011 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7014 /* Cancel the target */
7017 /* Cancel the health bar */
7021 /* Forget the lite */
7024 /* Forget the view */
7027 /* Forget the view */
7030 /* Handle "quit and save" */
7031 if (!p_ptr->playing && !p_ptr->is_dead) break;
7033 /* Erase the old cave */
7035 if (!p_ptr->is_dead) wipe_m_list();
7043 /* Accidental Death */
7044 if (p_ptr->playing && p_ptr->is_dead)
7046 if (p_ptr->inside_arena)
7048 p_ptr->inside_arena = FALSE;
7049 if (p_ptr->arena_number > MAX_ARENA_MONS)
7050 p_ptr->arena_number++;
7052 p_ptr->arena_number = -1 - p_ptr->arena_number;
7053 p_ptr->is_dead = FALSE;
7055 p_ptr->chp_frac = 0;
7056 p_ptr->exit_bldg = TRUE;
7061 /* Mega-Hack -- Allow player to cheat death */
7063 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7065 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7069 /* Mark social class, reset age, if needed */
7070 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7076 p_ptr->noscore |= 0x0001;
7080 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7082 msg_print("You invoke wizard mode and cheat death.");
7088 /* Restore hit points */
7089 p_ptr->chp = p_ptr->mhp;
7090 p_ptr->chp_frac = 0;
7092 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7094 for (i = 0; i < EATER_EXT*2; i++)
7096 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7098 for (; i < EATER_EXT*3; i++)
7100 p_ptr->magic_num1[i] = 0;
7103 /* Restore spell points */
7104 p_ptr->csp = p_ptr->msp;
7105 p_ptr->csp_frac = 0;
7107 /* Hack -- Healing */
7109 (void)set_confused(0);
7110 (void)set_poisoned(0);
7111 (void)set_afraid(0);
7112 (void)set_paralyzed(0);
7117 /* Hack -- Prevent starvation */
7118 (void)set_food(PY_FOOD_MAX - 1);
7120 /* Hack -- cancel recall */
7121 if (p_ptr->word_recall)
7125 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7127 msg_print("A tension leaves the air around you...");
7132 /* Hack -- Prevent recall */
7133 p_ptr->word_recall = 0;
7134 p_ptr->redraw |= (PR_STATUS);
7137 /* Hack -- cancel alter */
7138 if (p_ptr->alter_reality)
7140 /* Hack -- Prevent alter */
7141 p_ptr->alter_reality = 0;
7142 p_ptr->redraw |= (PR_STATUS);
7145 /* Note cause of death XXX XXX XXX */
7147 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7149 (void)strcpy(p_ptr->died_from, "Cheating death");
7154 p_ptr->is_dead = FALSE;
7157 p_ptr->inside_arena = FALSE;
7158 p_ptr->inside_battle = FALSE;
7160 p_ptr->inside_quest = 0;
7161 p_ptr->recall_dungeon = dungeon_type;
7163 if (lite_town || vanilla_town)
7165 p_ptr->wilderness_y = 1;
7166 p_ptr->wilderness_x = 1;
7180 p_ptr->wilderness_y = 48;
7181 p_ptr->wilderness_x = 5;
7187 p_ptr->wild_mode = FALSE;
7188 p_ptr->leaving = TRUE;
7191 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7193 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7199 /* Handle "death" */
7200 if (p_ptr->is_dead) break;
7202 /* Make a new level */
7213 s32b turn_real(s32b hoge)
7215 switch (p_ptr->start_race)
7221 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);