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 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3689 int wounds = p_ptr->msp - p_ptr->csp;
3693 int healing = p_ptr->chp;
3695 if (healing > wounds)
3700 p_ptr->csp += healing;
3702 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3704 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3709 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3715 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3716 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3718 msg_print("You trip over your own feet!");
3719 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3724 if (buki_motteruka(INVEN_RARM))
3726 int slot = INVEN_RARM;
3727 o_ptr = &inventory[INVEN_RARM];
3728 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3730 o_ptr = &inventory[INVEN_LARM];
3733 if (!cursed_p(o_ptr))
3736 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3738 msg_print("You drop your weapon!");
3741 inven_drop(slot, 1);
3748 /*** Process Inventory ***/
3750 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3753 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3754 * can actually be useful!
3756 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3759 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3761 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3765 teleport_player(50);
3768 /* Make a chainsword noise */
3769 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3773 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3775 if (!get_rnd_line("chainswd.txt", 0, noise))
3778 disturb(FALSE, FALSE);
3781 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3784 (void)activate_ty_curse(FALSE, &count);
3786 /* Handle experience draining */
3787 if (p_ptr->prace != RACE_ANDROID &&
3788 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3790 p_ptr->exp -= (p_ptr->lev+1)/2;
3791 if (p_ptr->exp < 0) p_ptr->exp = 0;
3792 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3793 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3796 /* Add light curse (Later) */
3797 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3802 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3804 new_curse = get_curse(0, o_ptr);
3805 if (!(o_ptr->curse_flags & new_curse))
3807 char o_name[MAX_NLEN];
3809 object_desc(o_name, o_ptr, FALSE, 0);
3811 o_ptr->curse_flags |= new_curse;
3813 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3815 msg_format("There is a malignant black aura surrounding %s...", o_name);
3818 o_ptr->feeling = FEEL_NONE;
3820 p_ptr->update |= (PU_BONUS);
3823 /* Add heavy curse (Later) */
3824 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3829 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3831 new_curse = get_curse(1, o_ptr);
3832 if (!(o_ptr->curse_flags & new_curse))
3834 char o_name[MAX_NLEN];
3836 object_desc(o_name, o_ptr, FALSE, 0);
3838 o_ptr->curse_flags |= new_curse;
3840 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3842 msg_format("There is a malignant black aura surrounding %s...", o_name);
3845 o_ptr->feeling = FEEL_NONE;
3847 p_ptr->update |= (PU_BONUS);
3851 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3853 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3854 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3856 char o_name[MAX_NLEN];
3858 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3860 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3862 msg_format("%s have attracted an animal!", o_name);
3869 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3871 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3873 char o_name[MAX_NLEN];
3875 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3877 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3879 msg_format("%s have attracted a demon!", o_name);
3886 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3888 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3889 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3891 char o_name[MAX_NLEN];
3893 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3895 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3897 msg_format("%s have attracted an animal!", o_name);
3903 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3905 if (!p_ptr->resist_fear)
3909 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3911 msg_print("It's so dark... so scary!");
3914 set_afraid(p_ptr->afraid + 13 + randint1(26));
3917 /* Teleport player */
3918 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3922 /* Teleport player */
3923 teleport_player(40);
3925 /* Handle HP draining */
3926 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3928 char o_name[MAX_NLEN];
3930 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3932 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3934 msg_format("%s drains HP from you!", o_name);
3936 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3938 /* Handle mana draining */
3939 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3941 char o_name[MAX_NLEN];
3943 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3945 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3947 msg_format("%s drains mana from you!", o_name);
3949 p_ptr->csp -= MIN(p_ptr->lev, 50);
3953 p_ptr->csp_frac = 0;
3955 p_ptr->redraw |= PR_MANA;
3959 /* Rarely, take damage from the Jewel of Judgement */
3960 if (one_in_(999) && !p_ptr->anti_magic)
3962 object_type *o_ptr = &inventory[INVEN_LITE];
3964 if (o_ptr->name1 == ART_JUDGE)
3967 if (object_known_p(o_ptr))
3968 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3970 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3971 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3973 if (object_known_p(o_ptr))
3974 msg_print("The Jewel of Judgement drains life from you!");
3976 msg_print("Something drains life from you!");
3977 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3983 /* Process equipment */
3984 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3986 /* Get the object */
3987 o_ptr = &inventory[i];
3989 /* Skip non-objects */
3990 if (!o_ptr->k_idx) continue;
3992 /* Recharge activatable objects */
3993 if (o_ptr->timeout > 0)
3998 /* Notice changes */
3999 if (!o_ptr->timeout)
4001 recharged_notice(o_ptr);
4007 /* Notice changes */
4011 p_ptr->window |= (PW_EQUIP);
4016 * Recharge rods. Rods now use timeout to control charging status,
4017 * and each charging rod in a stack decreases the stack's timeout by
4018 * one per turn. -LM-
4020 for (j = 0, i = 0; i < INVEN_PACK; i++)
4022 o_ptr = &inventory[i];
4023 k_ptr = &k_info[o_ptr->k_idx];
4025 /* Skip non-objects */
4026 if (!o_ptr->k_idx) continue;
4028 /* Examine all charging rods or stacks of charging rods. */
4029 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4031 /* Determine how many rods are charging. */
4032 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4033 if (temp > o_ptr->number) temp = o_ptr->number;
4035 /* Decrease timeout by that number. */
4036 o_ptr->timeout -= temp;
4038 /* Boundary control. */
4039 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4041 /* Notice changes, provide message if object is inscribed. */
4042 if (!(o_ptr->timeout))
4044 recharged_notice(o_ptr);
4050 /* Notice changes */
4054 p_ptr->notice |= (PN_COMBINE);
4057 p_ptr->window |= (PW_INVEN);
4061 /* Feel the inventory */
4066 /*** Process Objects ***/
4068 /* Process objects */
4069 for (i = 1; i < o_max; i++)
4074 /* Skip dead objects */
4075 if (!o_ptr->k_idx) continue;
4077 /* Recharge rods on the ground. No messages. */
4078 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4081 o_ptr->timeout -= o_ptr->number;
4083 /* Boundary control. */
4084 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4089 /*** Involuntary Movement ***/
4091 /* Delayed Word-of-Recall */
4092 if (p_ptr->word_recall)
4095 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4096 * The player is yanked up/down as soon as
4097 * he loads the autosaved game.
4099 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4100 do_cmd_save_game(TRUE);
4102 /* Count down towards recall */
4103 p_ptr->word_recall--;
4105 p_ptr->redraw |= (PR_STATUS);
4107 /* Activate the recall */
4108 if (!p_ptr->word_recall)
4113 /* Determine the level */
4114 if (dun_level || p_ptr->inside_quest)
4117 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4119 msg_print("You feel yourself yanked upwards!");
4122 p_ptr->recall_dungeon = dungeon_type;
4124 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4128 prepare_change_floor_mode(CFM_CLEAR_ALL);
4130 leave_quest_check();
4132 p_ptr->inside_quest = 0;
4133 p_ptr->leaving = TRUE;
4138 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4140 msg_print("You feel yourself yanked downwards!");
4143 dungeon_type = p_ptr->recall_dungeon;
4146 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4149 dun_level = max_dlv[dungeon_type];
4150 if (dun_level < 1) dun_level = 1;
4152 /* Nightmare mode makes recall more dangerous */
4153 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4159 else if (dun_level < 99)
4161 dun_level = (dun_level + 99) / 2;
4163 else if (dun_level > 100)
4165 dun_level = d_info[dungeon_type].maxdepth - 1;
4169 if (p_ptr->wild_mode)
4171 p_ptr->wilderness_y = py;
4172 p_ptr->wilderness_x = px;
4176 /* Save player position */
4180 p_ptr->wild_mode = FALSE;
4182 prepare_change_floor_mode(CFM_CLEAR_ALL);
4185 p_ptr->leaving = TRUE;
4187 if (dungeon_type == DUNGEON_ANGBAND)
4189 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4191 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4192 (quest[i].status == QUEST_STATUS_TAKEN) &&
4193 (quest[i].level < dun_level))
4195 quest[i].status = QUEST_STATUS_FAILED;
4196 quest[i].complev = (byte)p_ptr->lev;
4197 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4204 sound(SOUND_TPLEVEL);
4209 /* Delayed Alter reality */
4210 if (p_ptr->alter_reality)
4212 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4213 do_cmd_save_game(TRUE);
4215 /* Count down towards alter */
4216 p_ptr->alter_reality--;
4218 p_ptr->redraw |= (PR_STATUS);
4220 /* Activate the alter reality */
4221 if (!p_ptr->alter_reality)
4226 /* Determine the level */
4227 if (!quest_number(dun_level) && dun_level)
4230 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4232 msg_print("The world changes!");
4235 prepare_change_floor_mode(CFM_CLEAR_ALL);
4238 p_ptr->leaving = TRUE;
4243 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4245 msg_print("The world seems to change for a moment!");
4250 sound(SOUND_TPLEVEL);
4258 * Verify use of "wizard" mode
4260 static bool enter_wizard_mode(void)
4262 /* Ask first time */
4263 if (!p_ptr->noscore)
4265 /* Wizard mode is not permitted */
4266 if (!allow_debug_opts)
4269 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4271 msg_print("Wizard mode is not permitted.");
4276 /* Mention effects */
4278 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4279 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4281 msg_print("Wizard mode is for debugging and experimenting.");
4282 msg_print("The game will not be scored if you enter wizard mode.");
4287 /* Verify request */
4289 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4291 if (!get_check("Are you sure you want to enter wizard mode? "))
4298 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4300 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4303 p_ptr->noscore |= 0x0002;
4314 * Verify use of "debug" commands
4316 static bool enter_debug_mode(void)
4318 /* Ask first time */
4319 if (!p_ptr->noscore)
4321 /* Debug mode is not permitted */
4322 if (!allow_debug_opts)
4325 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4327 msg_print("Use of debug command is not permitted.");
4332 /* Mention effects */
4334 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4335 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4337 msg_print("The debug commands are for debugging and experimenting.");
4338 msg_print("The game will not be scored if you use debug commands.");
4343 /* Verify request */
4345 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4347 if (!get_check("Are you sure you want to use debug commands? "))
4354 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4356 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4359 p_ptr->noscore |= 0x0008;
4367 * Hack -- Declare the Debug Routines
4369 extern void do_cmd_debug(void);
4371 #endif /* ALLOW_WIZARD */
4377 * Verify use of "borg" commands
4379 static bool enter_borg_mode(void)
4381 /* Ask first time */
4382 if (!(p_ptr->noscore & 0x0010))
4384 /* Mention effects */
4386 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4387 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4389 msg_print("The borg commands are for debugging and experimenting.");
4390 msg_print("The game will not be scored if you use borg commands.");
4395 /* Verify request */
4397 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4399 if (!get_check("Are you sure you want to use borg commands? "))
4406 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4408 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4411 p_ptr->noscore |= 0x0010;
4419 * Hack -- Declare the Ben Borg
4421 extern void do_cmd_borg(void);
4423 #endif /* ALLOW_BORG */
4428 * Parse and execute the current command
4429 * Give "Warning" on illegal commands.
4431 * XXX XXX XXX Make some "blocks"
4433 static void process_command(void)
4435 int old_now_message = now_message;
4437 #ifdef ALLOW_REPEAT /* TNB */
4439 /* Handle repeating the last command */
4442 #endif /* ALLOW_REPEAT -- TNB */
4446 /* Parse the command */
4447 switch (command_cmd)
4463 /*** Wizard Commands ***/
4465 /* Toggle Wizard Mode */
4470 p_ptr->wizard = FALSE;
4472 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4474 msg_print("Wizard mode off.");
4478 else if (enter_wizard_mode())
4480 p_ptr->wizard = TRUE;
4482 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4484 msg_print("Wizard mode on.");
4489 /* Update monsters */
4490 p_ptr->update |= (PU_MONSTERS);
4492 /* Redraw "title" */
4493 p_ptr->redraw |= (PR_TITLE);
4501 /* Special "debug" commands */
4504 /* Enter debug mode */
4505 if (enter_debug_mode())
4512 #endif /* ALLOW_WIZARD */
4517 /* Special "borg" commands */
4520 /* Enter borg mode */
4521 if (enter_borg_mode())
4523 if (!p_ptr->wild_mode) do_cmd_borg();
4529 #endif /* ALLOW_BORG */
4533 /*** Inventory Commands ***/
4535 /* Wear/wield equipment */
4538 if (!p_ptr->wild_mode) do_cmd_wield();
4542 /* Take off equipment */
4545 if (!p_ptr->wild_mode) do_cmd_takeoff();
4552 if (!p_ptr->wild_mode) do_cmd_drop();
4556 /* Destroy an item */
4563 /* Equipment list */
4570 /* Inventory list */
4578 /*** Various commands ***/
4580 /* Identify an object */
4587 /* Hack -- toggle windows */
4590 toggle_inven_equip();
4595 /*** Standard "Movement" Commands ***/
4600 if (!p_ptr->wild_mode) do_cmd_alter();
4607 if (!p_ptr->wild_mode) do_cmd_tunnel();
4611 /* Move (usually pick up things) */
4614 #ifdef ALLOW_EASY_DISARM /* TNB */
4618 #else /* ALLOW_EASY_DISARM -- TNB */
4620 do_cmd_walk(always_pickup);
4622 #endif /* ALLOW_EASY_DISARM -- TNB */
4627 /* Move (usually do not pick up) */
4630 #ifdef ALLOW_EASY_DISARM /* TNB */
4634 #else /* ALLOW_EASY_DISARM -- TNB */
4636 do_cmd_walk(!always_pickup);
4638 #endif /* ALLOW_EASY_DISARM -- TNB */
4644 /*** Running, Resting, Searching, Staying */
4646 /* Begin Running -- Arg is Max Distance */
4649 if (!p_ptr->wild_mode) do_cmd_run();
4653 /* Stay still (usually pick things up) */
4656 do_cmd_stay(always_pickup);
4660 /* Stay still (usually do not pick up) */
4663 do_cmd_stay(!always_pickup);
4667 /* Rest -- Arg is time */
4674 /* Search for traps/doors */
4681 /* Toggle search mode */
4684 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4685 else set_action(ACTION_SEARCH);
4690 /*** Stairs and Doors and Chests and Traps ***/
4693 case SPECIAL_KEY_STORE:
4695 if (!p_ptr->wild_mode) do_cmd_store();
4699 /* Enter building -KMW- */
4700 case SPECIAL_KEY_BUILDING:
4702 if (!p_ptr->wild_mode) do_cmd_bldg();
4706 /* Enter quest level -KMW- */
4707 case SPECIAL_KEY_QUEST:
4709 if (!p_ptr->wild_mode) do_cmd_quest();
4713 /* Go up staircase */
4716 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4723 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4725 msg_print("To flee the ambush you have to reach the edge of the map.");
4728 else if (p_ptr->food < PY_FOOD_WEAK)
4731 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4733 msg_print("You must eat something here.");
4738 if (change_wild_mode())
4751 /* Go down staircase */
4754 if(!p_ptr->wild_mode) do_cmd_go_down();
4757 p_ptr->wilderness_x = px;
4758 p_ptr->wilderness_y = py;
4764 /* Open a door or chest */
4767 if (!p_ptr->wild_mode) do_cmd_open();
4774 if (!p_ptr->wild_mode) do_cmd_close();
4778 /* Jam a door with spikes */
4781 if (!p_ptr->wild_mode) do_cmd_spike();
4788 if (!p_ptr->wild_mode) do_cmd_bash();
4792 /* Disarm a trap or chest */
4795 if (!p_ptr->wild_mode) do_cmd_disarm();
4800 /*** Magic and Prayers ***/
4802 /* Gain new spells/prayers */
4805 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4807 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4809 msg_print("You don't have to learn spells!");
4811 else if (p_ptr->pclass == CLASS_SAMURAI)
4812 do_cmd_gain_hissatsu();
4813 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4823 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4824 (p_ptr->pclass == CLASS_BERSERKER) ||
4825 (p_ptr->pclass == CLASS_NINJA) ||
4826 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4827 ) do_cmd_mind_browse();
4828 else if (p_ptr->pclass == CLASS_SMITH)
4830 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4831 do_cmd_magic_eater(TRUE);
4832 else do_cmd_browse();
4840 if (!p_ptr->wild_mode)
4842 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4845 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4847 msg_print("You cannot cast spells!");
4850 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4853 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4855 msg_print("The dungeon absorbs all attempted magic!");
4859 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4863 cptr which_power = "ËâË¡";
4865 cptr which_power = "magic";
4867 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4869 which_power = "ĶǽÎÏ";
4871 which_power = "psionic powers";
4873 else if (p_ptr->pclass == CLASS_IMITATOR)
4875 which_power = "¤â¤Î¤Þ¤Í";
4877 which_power = "imitation";
4879 else if (p_ptr->pclass == CLASS_SAMURAI)
4881 which_power = "ɬ»¦·õ";
4883 which_power = "hissatsu";
4885 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4887 which_power = "¶ÀËâË¡";
4889 which_power = "mirror magic";
4891 else if (p_ptr->pclass == CLASS_NINJA)
4893 which_power = "Ǧ½Ñ";
4895 which_power = "ninjutsu";
4897 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4899 which_power = "µ§¤ê";
4901 which_power = "prayer";
4905 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4907 msg_format("An anti-magic shell disrupts your %s!", which_power);
4911 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4914 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4916 msg_format("You cannot think directly!");
4922 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4923 (p_ptr->pclass == CLASS_BERSERKER) ||
4924 (p_ptr->pclass == CLASS_NINJA) ||
4925 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4928 else if (p_ptr->pclass == CLASS_IMITATOR)
4930 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4931 do_cmd_magic_eater(FALSE);
4932 else if (p_ptr->pclass == CLASS_SAMURAI)
4934 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4935 do_cmd_cast_learned();
4936 else if (p_ptr->pclass == CLASS_SMITH)
4945 /* Issue a pet command */
4948 if (!p_ptr->wild_mode) do_cmd_pet();
4952 /*** Use various objects ***/
4954 /* Inscribe an object */
4961 /* Uninscribe an object */
4964 do_cmd_uninscribe();
4968 /* Activate an artifact */
4971 if (!p_ptr->wild_mode)
4973 if (!p_ptr->inside_arena)
4978 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4980 msg_print("The arena absorbs all attempted magic!");
4996 /* Fuel your lantern/torch */
5006 if (!p_ptr->wild_mode) do_cmd_fire();
5013 if (!p_ptr->wild_mode)
5023 if (!p_ptr->wild_mode)
5025 if (!p_ptr->inside_arena)
5030 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5032 msg_print("The arena absorbs all attempted magic!");
5044 if (!p_ptr->wild_mode)
5046 if (p_ptr->inside_arena)
5049 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5051 msg_print("The arena absorbs all attempted magic!");
5056 else if (use_command && rogue_like_commands)
5068 /* Quaff a potion */
5071 if (!p_ptr->wild_mode)
5073 if (!p_ptr->inside_arena)
5074 do_cmd_quaff_potion();
5078 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5080 msg_print("The arena absorbs all attempted magic!");
5092 if (!p_ptr->wild_mode)
5094 if (!p_ptr->inside_arena)
5095 do_cmd_read_scroll();
5099 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5101 msg_print("The arena absorbs all attempted magic!");
5113 if (!p_ptr->wild_mode)
5115 if (p_ptr->inside_arena)
5118 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5120 msg_print("The arena absorbs all attempted magic!");
5125 else if (use_command && !rogue_like_commands)
5135 /* Use racial power */
5138 if (!p_ptr->wild_mode) do_cmd_racial_power();
5143 /*** Looking at Things (nearby or on map) ***/
5145 /* Full dungeon map */
5152 /* Locate player on map */
5166 /* Target monster or location */
5169 if (!p_ptr->wild_mode) do_cmd_target();
5175 /*** Help and Such ***/
5184 /* Identify symbol */
5187 do_cmd_query_symbol();
5191 /* Character description */
5194 do_cmd_change_name();
5199 /*** System Commands ***/
5201 /* Hack -- User interface */
5208 /* Single line from a pref file */
5223 do_cmd_edit_autopick();
5227 /* Interact with macros */
5234 /* Interact with visuals */
5242 /* Interact with colors */
5250 /* Interact with options */
5258 /*** Misc Commands ***/
5274 /* Repeat level feeling */
5277 if (!p_ptr->wild_mode) do_cmd_feeling();
5281 /* Show previous message */
5284 do_cmd_message_one();
5288 /* Show previous messages */
5291 do_cmd_messages(old_now_message);
5295 /* Show quest status -KMW- */
5298 do_cmd_checkquest();
5302 /* Redraw the screen */
5305 now_message = old_now_message;
5310 #ifndef VERIFY_SAVEFILE
5312 /* Hack -- Save and don't quit */
5315 do_cmd_save_game(FALSE);
5319 #endif /* VERIFY_SAVEFILE */
5329 case SPECIAL_KEY_QUIT:
5331 do_cmd_save_and_exit();
5335 /* Quit (commit suicide) */
5348 /* Check artifacts, uniques, objects */
5355 /* Load "screen dump" */
5358 do_cmd_load_screen();
5362 /* Save "screen dump" */
5365 do_cmd_save_screen();
5369 /* Make random artifact list */
5372 spoil_random_artifact("randifact.txt");
5376 /* Hack -- Unknown command */
5379 if (flush_failure) flush();
5383 sound(SOUND_ILLEGAL);
5385 if (!get_rnd_line("error_j.txt", 0, error_m))
5387 if (!get_rnd_line("error.txt", 0, error_m))
5394 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5396 prt("Type '?' for help.", 0, 0);
5402 if (!energy_use && !now_message)
5403 now_message = old_now_message;
5409 static bool monster_tsuri(int r_idx)
5411 monster_race *r_ptr = &r_info[r_idx];
5413 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5421 * Process the player
5423 * Notice the annoying code to handle "pack overflow", which
5424 * must come first just in case somebody manages to corrupt
5425 * the savefiles by clever use of menu commands or something.
5427 static void process_player(void)
5431 /*** Apply energy ***/
5436 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5438 msg_print("You feel different!");
5441 (void)gain_random_mutation(0);
5442 hack_mutation = FALSE;
5445 if (p_ptr->inside_battle)
5447 for(i = 1; i < m_max; i++)
5449 monster_type *m_ptr = &m_list[i];
5451 if (!m_ptr->r_idx) continue;
5453 /* Hack -- Detect monster */
5454 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5456 /* Update the monster */
5457 update_mon(i, FALSE);
5462 /* Give the player some energy */
5463 else if (!(load && p_ptr->energy_need <= 0))
5465 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5469 if (p_ptr->energy_need > 0) return;
5470 if (!command_rep) prt_time();
5472 /*** Check for interupts ***/
5474 /* Complete resting */
5481 if ((p_ptr->chp == p_ptr->mhp) &&
5482 (p_ptr->csp >= p_ptr->msp))
5484 set_action(ACTION_NONE);
5488 /* Complete resting */
5489 else if (resting == -2)
5492 if ((p_ptr->chp == p_ptr->mhp) &&
5493 (p_ptr->csp >= p_ptr->msp) &&
5494 !p_ptr->blind && !p_ptr->confused &&
5495 !p_ptr->poisoned && !p_ptr->afraid &&
5496 !p_ptr->stun && !p_ptr->cut &&
5497 !p_ptr->slow && !p_ptr->paralyzed &&
5498 !p_ptr->image && !p_ptr->word_recall &&
5499 !p_ptr->alter_reality)
5501 set_action(ACTION_NONE);
5506 if (p_ptr->action == ACTION_FISH)
5509 Term_xtra(TERM_XTRA_DELAY, 10);
5513 bool success = FALSE;
5514 get_mon_num_prep(monster_tsuri,NULL);
5515 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5517 if (r_idx && one_in_(2))
5520 y = py+ddy[tsuri_dir];
5521 x = px+ddx[tsuri_dir];
5522 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5525 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5527 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5529 msg_format("You have a good catch!", m_name);
5537 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5539 msg_print("Damn! The fish stole your bait!");
5546 /* Handle "abort" */
5549 /* Check for "player abort" (semi-efficiently for resting) */
5550 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5555 /* Check for a key */
5564 /* Hack -- Show a Message */
5566 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5568 msg_print("Canceled.");
5575 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5577 monster_type *m_ptr = &m_list[p_ptr->riding];
5586 if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5588 /* Acquire the monster name */
5589 monster_desc(m_name, m_ptr, 0);
5591 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5593 msg_format("You have waked %s up.", m_name);
5595 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5596 p_ptr->redraw |= (PR_UHEALTH);
5603 /* Make a "saving throw" against stun */
5604 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5610 /* Hack -- Recover from stun */
5611 if (m_ptr->stunned > d)
5613 /* Recover somewhat */
5614 m_ptr->stunned -= d;
5625 /* Acquire the monster name */
5626 monster_desc(m_name, m_ptr, 0);
5628 /* Dump a message */
5630 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5632 msg_format("%^s is no longer stunned.", m_name);
5634 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5635 p_ptr->redraw |= (PR_UHEALTH);
5639 if (m_ptr->confused)
5643 /* Make a "saving throw" against stun */
5644 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5647 d = m_ptr->confused;
5650 /* Hack -- Recover from stun */
5651 if (m_ptr->confused > d)
5653 /* Recover somewhat */
5654 m_ptr->confused -= d;
5663 m_ptr->confused = 0;
5665 /* Acquire the monster name */
5666 monster_desc(m_name, m_ptr, 0);
5668 /* Dump a message */
5670 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5672 msg_format("%^s is no longer confused.", m_name);
5674 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5675 p_ptr->redraw |= (PR_UHEALTH);
5683 /* Make a "saving throw" against stun */
5684 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5690 /* Hack -- Recover from stun */
5691 if (m_ptr->monfear > d)
5693 /* Recover somewhat */
5694 m_ptr->monfear -= d;
5705 /* Acquire the monster name */
5706 monster_desc(m_name, m_ptr, 0);
5708 /* Dump a message */
5710 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5712 msg_format("%^s is no longer fear.", m_name);
5714 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5715 p_ptr->redraw |= (PR_UHEALTH);
5719 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5723 /* Handle the player song */
5724 if (!load) check_music();
5729 if (p_ptr->lightspeed)
5731 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5733 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5735 if (p_ptr->magic_num1[0] < 40)
5737 p_ptr->magic_num1[0] = 0;
5739 else p_ptr->magic_num1[0] -= 40;
5740 p_ptr->update |= (PU_BONUS);
5742 if (p_ptr->action == ACTION_LEARN)
5744 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5745 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5748 p_ptr->csp_frac = 0;
5749 set_action(ACTION_NONE);
5753 p_ptr->csp -= (s16b)(hoge >> 16);
5755 if (p_ptr->csp_frac < hoge)
5757 p_ptr->csp_frac += 0x10000L - hoge;
5761 p_ptr->csp_frac -= hoge;
5763 p_ptr->redraw |= PR_MANA;
5766 if (p_ptr->special_defense & KATA_MASK)
5768 if (p_ptr->special_defense & KATA_MUSOU)
5772 set_action(ACTION_NONE);
5777 p_ptr->redraw |= (PR_MANA);
5782 /*** Handle actual user input ***/
5784 /* Repeat until out of energy */
5785 while (p_ptr->energy_need <= 0)
5787 p_ptr->window |= PW_PLAYER;
5788 p_ptr->sutemi = FALSE;
5789 p_ptr->counter = FALSE;
5790 now_damaged = FALSE;
5792 /* Handle "p_ptr->notice" */
5795 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5798 /* Place the cursor on the player */
5799 move_cursor_relative(py, px);
5801 /* Refresh (optional) */
5802 if (fresh_before) Term_fresh();
5805 /* Hack -- Pack Overflow */
5806 if (inventory[INVEN_PACK].k_idx)
5808 int item = INVEN_PACK;
5810 char o_name[MAX_NLEN];
5814 /* Access the slot to be dropped */
5815 o_ptr = &inventory[item];
5822 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5824 msg_print("Your pack overflows!");
5829 object_desc(o_name, o_ptr, TRUE, 3);
5833 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5835 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5839 /* Drop it (carefully) near the player */
5840 (void)drop_near(o_ptr, 0, py, px);
5842 /* Modify, Describe, Optimize */
5843 inven_item_increase(item, -255);
5844 inven_item_describe(item);
5845 inven_item_optimize(item);
5847 /* Handle "p_ptr->notice" */
5850 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5855 /* Hack -- cancel "lurking browse mode" */
5856 if (!command_new) command_see = FALSE;
5859 /* Assume free turn */
5863 if (p_ptr->inside_battle)
5865 /* Place the cursor on the player */
5866 move_cursor_relative(py, px);
5868 command_cmd = SPECIAL_KEY_BUILDING;
5870 /* Process the command */
5874 /* Paralyzed or Knocked Out */
5875 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5882 else if (p_ptr->action == ACTION_REST)
5887 /* Reduce rest count */
5890 if (!resting) set_action(ACTION_NONE);
5892 /* Redraw the state */
5893 p_ptr->redraw |= (PR_STATE);
5901 else if (p_ptr->action == ACTION_FISH)
5914 /* Repeated command */
5915 else if (command_rep)
5917 /* Count this execution */
5920 /* Redraw the state */
5921 p_ptr->redraw |= (PR_STATE);
5926 /* Hack -- Assume messages were seen */
5929 /* Clear the top line */
5932 /* Process the command */
5936 /* Normal command */
5939 /* Place the cursor on the player */
5940 move_cursor_relative(py, px);
5943 /* Get a command (normal) */
5944 request_command(FALSE);
5947 /* Process the command */
5957 /* Use some energy */
5958 if (world_player || energy_use > 400)
5960 /* The Randomness is irrelevant */
5961 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5965 /* There is some randomness of needed energy */
5966 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5969 /* Hack -- constant hallucination */
5970 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5973 /* Shimmer monsters if needed */
5974 if (shimmer_monsters)
5976 /* Clear the flag */
5977 shimmer_monsters = FALSE;
5979 /* Shimmer multi-hued monsters */
5980 for (i = 1; i < m_max; i++)
5982 monster_type *m_ptr;
5983 monster_race *r_ptr;
5985 /* Access monster */
5988 /* Skip dead monsters */
5989 if (!m_ptr->r_idx) continue;
5991 /* Skip unseen monsters */
5992 if (!m_ptr->ml) continue;
5994 /* Access the monster race */
5995 r_ptr = &r_info[m_ptr->ap_r_idx];
5997 /* Skip non-multi-hued monsters */
5998 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6001 /* Reset the flag */
6002 shimmer_monsters = TRUE;
6004 /* Redraw regardless */
6005 lite_spot(m_ptr->fy, m_ptr->fx);
6010 /* Handle monster detection */
6011 if (repair_monsters)
6013 /* Reset the flag */
6014 repair_monsters = FALSE;
6016 /* Rotate detection flags */
6017 for (i = 1; i < m_max; i++)
6019 monster_type *m_ptr;
6021 /* Access monster */
6024 /* Skip dead monsters */
6025 if (!m_ptr->r_idx) continue;
6027 /* Nice monsters get mean */
6028 if (m_ptr->mflag & MFLAG_NICE)
6030 /* Nice monsters get mean */
6031 m_ptr->mflag &= ~(MFLAG_NICE);
6034 /* Handle memorized monsters */
6035 if (m_ptr->mflag2 & MFLAG2_MARK)
6037 /* Maintain detection */
6038 if (m_ptr->mflag2 & MFLAG2_SHOW)
6041 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6043 /* Still need repairs */
6044 repair_monsters = TRUE;
6047 /* Remove detection */
6051 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6053 /* Assume invisible */
6056 /* Update the monster */
6057 update_mon(i, FALSE);
6059 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6060 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6062 /* Redraw regardless */
6063 lite_spot(m_ptr->fy, m_ptr->fx);
6068 if (p_ptr->pclass == CLASS_IMITATOR)
6070 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6073 for (i = 0; i < p_ptr->mane_num; i++)
6075 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6076 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6080 p_ptr->redraw |= (PR_MANE);
6082 if (p_ptr->action == ACTION_LEARN)
6085 p_ptr->redraw |= (PR_STATE);
6088 if (world_player && (p_ptr->energy_need > - 1000))
6091 p_ptr->redraw |= (PR_MAP);
6093 /* Update monsters */
6094 p_ptr->update |= (PU_MONSTERS);
6097 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6100 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6102 msg_print("You feel time flowing around you once more.");
6105 world_player = FALSE;
6106 p_ptr->energy_need = ENERGY_NEED();
6108 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6113 /* Hack -- notice death */
6114 if (!p_ptr->playing || p_ptr->is_dead)
6116 world_player = FALSE;
6120 /* Handle "leaving" */
6121 if (p_ptr->leaving) break;
6124 /* Update scent trail */
6130 * Interact with the current dungeon level.
6132 * This function will not exit until the level is completed,
6133 * the user dies, or the game is terminated.
6135 static void dungeon(bool load_game)
6139 /* Set the base level */
6140 base_level = dun_level;
6142 /* Reset various flags */
6146 p_ptr->leaving = FALSE;
6148 /* Reset the "command" vars */
6156 /* Cancel the target */
6160 ambush_flag = FALSE;
6162 /* Cancel the health bar */
6165 /* Check visual effects */
6166 shimmer_monsters = TRUE;
6167 shimmer_objects = TRUE;
6168 repair_monsters = TRUE;
6169 repair_objects = TRUE;
6175 /* Get index of current quest (if any) */
6176 quest_num = quest_number(dun_level);
6178 /* Inside a quest? */
6181 /* Mark the quest monster */
6182 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6185 /* Track maximum player level */
6186 if (p_ptr->max_plv < p_ptr->lev)
6188 p_ptr->max_plv = p_ptr->lev;
6192 /* Track maximum dungeon level (if not in quest -KMW-) */
6193 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6195 max_dlv[dungeon_type] = dun_level;
6196 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6199 /* Validate the panel */
6200 panel_bounds_center();
6202 /* Verify the panel */
6205 /* Flush messages */
6209 /* Enter "xtra" mode */
6210 character_xtra = TRUE;
6213 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6215 /* Redraw dungeon */
6216 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6219 p_ptr->redraw |= (PR_MAP);
6222 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6224 /* Update lite/view */
6225 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6227 /* Update monsters */
6228 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6230 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6233 /* Leave "xtra" mode */
6234 character_xtra = FALSE;
6237 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6239 /* Combine / Reorder the pack */
6240 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6242 /* Handle "p_ptr->notice" */
6245 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6251 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6252 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6253 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6255 if (p_ptr->inside_battle)
6259 p_ptr->energy_need = 0;
6265 msg_print("»î¹ç³«»Ï¡ª");
6267 msg_format("Ready..Fight!");
6273 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6274 p_ptr->magic_num1[0] = MUSIC_DETECT;
6276 /* Hack -- notice death or departure */
6277 if (!p_ptr->playing || p_ptr->is_dead) return;
6279 /* Print quest message if appropriate */
6280 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6282 quest_discovery(random_quest_number(dun_level));
6283 p_ptr->inside_quest = random_quest_number(dun_level);
6285 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6287 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6289 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6290 d_name+d_info[dungeon_type].name,
6291 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6293 msg_format("%^s lives in this level as the keeper of %s.",
6294 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6295 d_name+d_info[dungeon_type].name);
6299 /*** Process this dungeon level ***/
6301 /* Reset the monster generation level */
6302 monster_level = base_level;
6304 /* Reset the object generation level */
6305 object_level = base_level;
6309 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6310 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6311 p_ptr->energy_need = 0;
6313 /* Not leaving dungeon */
6314 p_ptr->leaving_dungeon = FALSE;
6319 /* Hack -- Compact the monster list occasionally */
6320 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6322 /* Hack -- Compress the monster list occasionally */
6323 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6326 /* Hack -- Compact the object list occasionally */
6327 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6329 /* Hack -- Compress the object list occasionally */
6330 if (o_cnt + 32 < o_max) compact_objects(0);
6333 /* Process the player */
6336 /* Handle "p_ptr->notice" */
6339 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6342 /* Hack -- Hilite the player */
6343 move_cursor_relative(py, px);
6345 /* Optional fresh */
6346 if (fresh_after) Term_fresh();
6348 /* Hack -- Notice death or departure */
6349 if (!p_ptr->playing || p_ptr->is_dead) break;
6351 /* Process all of the monsters */
6354 /* Handle "p_ptr->notice" */
6357 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6360 /* Hack -- Hilite the player */
6361 move_cursor_relative(py, px);
6363 /* Optional fresh */
6364 if (fresh_after) Term_fresh();
6366 /* Hack -- Notice death or departure */
6367 if (!p_ptr->playing || p_ptr->is_dead) break;
6370 /* Process the world */
6373 /* Handle "p_ptr->notice" */
6376 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6379 /* Hack -- Hilite the player */
6380 move_cursor_relative(py, px);
6382 /* Optional fresh */
6383 if (fresh_after) Term_fresh();
6385 /* Hack -- Notice death or departure */
6386 if (!p_ptr->playing || p_ptr->is_dead) break;
6388 /* Handle "leaving" */
6389 if (p_ptr->leaving) break;
6391 /* Count game turns */
6393 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6394 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6395 if (wild_regen) wild_regen--;
6398 /* Inside a quest and non-unique questor? */
6399 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6401 /* Un-mark the quest monster */
6402 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6405 /* Not save-and-quit and not dead? */
6406 if (p_ptr->playing && !p_ptr->is_dead)
6409 * Maintain Unique monsters and artifact, save current
6410 * floor, then prepare next floor
6414 /* Forget the flag */
6415 reinit_wilderness = FALSE;
6418 /* Write about current level on the play record once per level */
6424 * Load some "user pref files"
6426 * Modified by Arcum Dagsson to support
6427 * separate macro files for different realms.
6429 static void load_all_pref_files(void)
6434 /* Access the "user" pref file */
6435 sprintf(buf, "user.prf");
6437 /* Process that file */
6438 process_pref_file(buf);
6440 /* Access the "user" system pref file */
6441 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6443 /* Process that file */
6444 process_pref_file(buf);
6446 /* Access the "race" pref file */
6447 sprintf(buf, "%s.prf", rp_ptr->title);
6449 /* Process that file */
6450 process_pref_file(buf);
6452 /* Access the "class" pref file */
6453 sprintf(buf, "%s.prf", cp_ptr->title);
6455 /* Process that file */
6456 process_pref_file(buf);
6458 /* Access the "character" pref file */
6459 sprintf(buf, "%s.prf", player_base);
6461 /* Process that file */
6462 process_pref_file(buf);
6464 /* Free old entries */
6468 sprintf(buf, "picktype-%s.prf", player_base);
6470 sprintf(buf, "pickpref-%s.prf", player_base);
6473 err = process_pickpref_file(buf);
6475 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6479 process_pickpref_file("picktype.prf");
6481 process_pickpref_file("pickpref.prf");
6485 /* Access the "realm 1" pref file */
6486 if (p_ptr->realm1 != REALM_NONE)
6488 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6490 /* Process that file */
6491 process_pref_file(buf);
6494 /* Access the "realm 2" pref file */
6495 if (p_ptr->realm2 != REALM_NONE)
6497 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6499 /* Process that file */
6500 process_pref_file(buf);
6506 * Extract option variables from bit sets
6508 void extract_option_vars(void)
6512 for (i = 0; option_info[i].o_desc; i++)
6514 int os = option_info[i].o_set;
6515 int ob = option_info[i].o_bit;
6517 /* Set the "default" options */
6518 if (option_info[i].o_var)
6521 if (option_flag[os] & (1L << ob))
6524 (*option_info[i].o_var) = TRUE;
6531 (*option_info[i].o_var) = FALSE;
6539 * Determine bounty uniques
6541 void determine_bounty_uniques(void)
6544 monster_race *r_ptr;
6546 get_mon_num_prep(NULL, NULL);
6547 for (i = 0; i < MAX_KUBI; i++)
6551 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6552 r_ptr = &r_info[kubi_r_idx[i]];
6554 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6556 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6558 if (r_ptr->rarity > 100) continue;
6560 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6562 for (j = 0; j < i; j++)
6563 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6570 for (i = 0; i < MAX_KUBI - 1; i++)
6572 for (j = i; j < MAX_KUBI; j++)
6574 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6576 tmp = kubi_r_idx[i];
6577 kubi_r_idx[i] = kubi_r_idx[j];
6578 kubi_r_idx[j] = tmp;
6586 * Determine today's bounty monster
6587 * Note: conv_old is used if loaded 0.0.3 or older save file
6589 void determine_today_mon(bool conv_old)
6592 bool old_inside_battle = p_ptr->inside_battle;
6593 monster_race *r_ptr;
6597 for (i = 0; i < max_d_idx; i++)
6599 if (max_dlv[i] < d_info[i].mindepth) continue;
6600 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6603 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6605 p_ptr->inside_battle = TRUE;
6606 get_mon_num_prep(NULL, NULL);
6610 today_mon = get_mon_num(max_dl);
6611 r_ptr = &r_info[today_mon];
6613 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6614 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
6615 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6616 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6617 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6618 if (r_ptr->rarity > 10) continue;
6622 p_ptr->today_mon = 0;
6623 p_ptr->inside_battle = old_inside_battle;
6628 * Actually play a game
6630 * If the "new_game" parameter is true, then, after loading the
6631 * savefile, we will commit suicide, if necessary, to allow the
6632 * player to start a new game.
6634 void play_game(bool new_game)
6637 bool load_game = TRUE;
6647 hack_mutation = FALSE;
6649 /* Hack -- Character is "icky" */
6650 character_icky = TRUE;
6652 /* Make sure main term is active */
6653 Term_activate(angband_term[0]);
6655 /* Initialise the resize hooks */
6656 angband_term[0]->resize_hook = resize_map;
6658 for (i = 1; i < 8; i++)
6660 /* Does the term exist? */
6661 if (angband_term[i])
6663 /* Add the redraw on resize hook */
6664 angband_term[i]->resize_hook = redraw_window;
6668 /* Hack -- turn off the cursor */
6669 (void)Term_set_cursor(0);
6672 /* Attempt to load */
6677 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6679 quit("broken savefile");
6684 /* Extract the options */
6685 extract_option_vars();
6687 /* Report waited score */
6688 if (p_ptr->wait_report_score)
6694 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6696 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6701 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6706 p_ptr->is_dead = TRUE;
6708 start_time = time(NULL);
6710 /* No suspending now */
6711 signals_ignore_tstp();
6713 /* Hack -- Character is now "icky" */
6714 character_icky = TRUE;
6716 /* Build the filename */
6717 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6719 /* Open the high score file, for reading/writing */
6720 highscore_fd = fd_open(buf, O_RDWR);
6722 /* Handle score, show Top scores */
6723 success = send_world_score(TRUE);
6726 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6728 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6732 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6734 prt("standing by for future registration...", 0, 0);
6740 p_ptr->wait_report_score = FALSE;
6743 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6745 if (!save_player()) msg_print("death save failed!");
6748 /* Shut the high score file */
6749 (void)fd_close(highscore_fd);
6751 /* Forget the high score fd */
6754 /* Allow suspending now */
6755 signals_handle_tstp();
6760 /* Nothing loaded */
6761 if (!character_loaded)
6763 /* Make new player */
6766 /* The dungeon is not ready */
6767 character_dungeon = FALSE;
6769 /* Prepare to init the RNG */
6772 /* Initialize the saved floors data */
6773 init_saved_floors();
6776 /* Old game is loaded. But new game is requested. */
6779 /* Delete expanded temporal files */
6780 clear_saved_floor_files();
6783 /* Process old character */
6786 /* Process the player name */
6787 process_player_name(FALSE);
6796 seed = (time(NULL));
6800 /* Mutate the seed on Unix machines */
6801 seed = ((seed >> 3) * (getpid() << 1));
6805 /* Use the complex RNG */
6808 /* Seed the "complex" RNG */
6809 Rand_state_init(seed);
6812 /* Roll new character */
6815 /* The dungeon is not ready */
6816 character_dungeon = FALSE;
6820 p_ptr->inside_quest = 0;
6821 p_ptr->inside_arena = FALSE;
6822 p_ptr->inside_battle = FALSE;
6826 /* Hack -- seed for flavors */
6827 seed_flavor = randint0(0x10000000);
6829 /* Hack -- seed for town layout */
6830 seed_town = randint0(0x10000000);
6832 /* Roll up a new character */
6839 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6841 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6846 determine_bounty_uniques();
6847 determine_today_mon(FALSE);
6851 write_level = FALSE;
6854 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6856 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6860 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6861 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6863 if (p_ptr->riding == -1)
6866 for (i = m_max; i > 0; i--)
6868 if (player_bold(m_list[i].fy, m_list[i].fx))
6877 p_ptr->teleport_town = FALSE;
6878 p_ptr->sutemi = FALSE;
6879 world_monster = FALSE;
6880 now_damaged = FALSE;
6882 start_time = time(NULL) - 1;
6883 record_o_name[0] = '\0';
6885 /* Reset map panel */
6886 panel_row_min = cur_hgt;
6887 panel_col_min = cur_wid;
6889 /* Sexy gal gets bonus to maximum weapon skill of whip */
6890 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6891 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6893 /* Fill the arrays of floors and walls in the good proportions */
6894 set_floor_and_wall(dungeon_type);
6896 /* Flavor the objects */
6904 /* Flash a message */
6906 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6908 prt("Please wait...", 0, 0);
6912 /* Flush the message */
6916 /* Hack -- Enter wizard mode */
6919 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6920 else if (p_ptr->is_dead) quit("Already dead.");
6923 /* Initialize the town-buildings if necessary */
6924 if (!dun_level && !p_ptr->inside_quest)
6926 /* Init the wilderness */
6928 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6931 init_flags = INIT_ONLY_BUILDINGS;
6933 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6938 /* Generate a dungeon level if needed */
6939 if (!character_dungeon) change_floor();
6942 /* Character is now "complete" */
6943 character_generated = TRUE;
6946 /* Hack -- Character is no longer "icky" */
6947 character_icky = FALSE;
6951 p_ptr->playing = TRUE;
6953 /* Reset the visual mappings */
6956 /* Load the "pref" files */
6957 load_all_pref_files();
6959 /* React to changes */
6960 Term_xtra(TERM_XTRA_REACT, 0);
6963 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6966 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6972 /* Set or clear "rogue_like_commands" if requested */
6973 if (arg_force_original) rogue_like_commands = FALSE;
6974 if (arg_force_roguelike) rogue_like_commands = TRUE;
6976 /* Hack -- Enforce "delayed death" */
6977 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6979 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6981 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6983 monster_type *m_ptr;
6984 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6985 monster_race *r_ptr = &r_info[pet_r_idx];
6986 place_monster_aux(0, py, px - 1, pet_r_idx,
6987 (PM_FORCE_PET | PM_NO_KAGE));
6988 m_ptr = &m_list[hack_m_idx_ii];
6989 m_ptr->mspeed = r_ptr->speed;
6990 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6991 m_ptr->max_maxhp = m_ptr->maxhp;
6992 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6993 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6999 /* Process the level */
7002 /* Handle "p_ptr->notice" */
7005 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7008 /* Cancel the target */
7011 /* Cancel the health bar */
7015 /* Forget the lite */
7018 /* Forget the view */
7021 /* Forget the view */
7024 /* Handle "quit and save" */
7025 if (!p_ptr->playing && !p_ptr->is_dead) break;
7027 /* Erase the old cave */
7029 if (!p_ptr->is_dead) wipe_m_list();
7037 /* Accidental Death */
7038 if (p_ptr->playing && p_ptr->is_dead)
7040 if (p_ptr->inside_arena)
7042 p_ptr->inside_arena = FALSE;
7043 if (p_ptr->arena_number > MAX_ARENA_MONS)
7044 p_ptr->arena_number++;
7046 p_ptr->arena_number = -1 - p_ptr->arena_number;
7047 p_ptr->is_dead = FALSE;
7049 p_ptr->chp_frac = 0;
7050 p_ptr->exit_bldg = TRUE;
7055 /* Mega-Hack -- Allow player to cheat death */
7057 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7059 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7063 /* Mark social class, reset age, if needed */
7064 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7070 p_ptr->noscore |= 0x0001;
7074 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7076 msg_print("You invoke wizard mode and cheat death.");
7082 /* Restore hit points */
7083 p_ptr->chp = p_ptr->mhp;
7084 p_ptr->chp_frac = 0;
7086 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7088 for (i = 0; i < EATER_EXT*2; i++)
7090 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7092 for (; i < EATER_EXT*3; i++)
7094 p_ptr->magic_num1[i] = 0;
7097 /* Restore spell points */
7098 p_ptr->csp = p_ptr->msp;
7099 p_ptr->csp_frac = 0;
7101 /* Hack -- Healing */
7103 (void)set_confused(0);
7104 (void)set_poisoned(0);
7105 (void)set_afraid(0);
7106 (void)set_paralyzed(0);
7111 /* Hack -- Prevent starvation */
7112 (void)set_food(PY_FOOD_MAX - 1);
7114 /* Hack -- cancel recall */
7115 if (p_ptr->word_recall)
7119 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7121 msg_print("A tension leaves the air around you...");
7126 /* Hack -- Prevent recall */
7127 p_ptr->word_recall = 0;
7128 p_ptr->redraw |= (PR_STATUS);
7131 /* Hack -- cancel alter */
7132 if (p_ptr->alter_reality)
7134 /* Hack -- Prevent alter */
7135 p_ptr->alter_reality = 0;
7136 p_ptr->redraw |= (PR_STATUS);
7139 /* Note cause of death XXX XXX XXX */
7141 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7143 (void)strcpy(p_ptr->died_from, "Cheating death");
7148 p_ptr->is_dead = FALSE;
7151 p_ptr->inside_arena = FALSE;
7152 p_ptr->inside_battle = FALSE;
7154 p_ptr->inside_quest = 0;
7155 p_ptr->recall_dungeon = dungeon_type;
7157 if (lite_town || vanilla_town)
7159 p_ptr->wilderness_y = 1;
7160 p_ptr->wilderness_x = 1;
7174 p_ptr->wilderness_y = 48;
7175 p_ptr->wilderness_x = 5;
7181 p_ptr->wild_mode = FALSE;
7182 p_ptr->leaving = TRUE;
7185 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7187 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7193 /* Handle "death" */
7194 if (p_ptr->is_dead) break;
7196 /* Make a new level */
7207 s32b turn_real(s32b hoge)
7209 switch (p_ptr->start_race)
7215 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);