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;
677 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
679 p_ptr->inside_quest = 0;
682 /* Clear all saved floors */
683 prepare_change_floor_mode(CFM_CLEAR_ALL);
686 p_ptr->leaving = TRUE;
690 static void wreck_the_pattern(void)
692 int to_ruin = 0, r_y, r_x;
694 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
701 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
702 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
704 msg_print("You bleed on the Pattern!");
705 msg_print("Something terrible happens!");
711 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
713 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
717 to_ruin = randint1(45) + 35;
721 scatter(&r_y, &r_x, py, px, 4, 0);
723 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
724 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
726 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
730 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
734 /* Returns TRUE if we are on the Pattern... */
735 static bool pattern_effect(void)
737 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
738 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
741 if ((prace_is_(RACE_AMBERITE)) &&
742 (p_ptr->cut > 0) && one_in_(10))
747 if (cave[py][px].feat == FEAT_PATTERN_END)
749 (void)set_poisoned(0);
755 (void)do_res_stat(A_STR);
756 (void)do_res_stat(A_INT);
757 (void)do_res_stat(A_WIS);
758 (void)do_res_stat(A_DEX);
759 (void)do_res_stat(A_CON);
760 (void)do_res_stat(A_CHR);
761 (void)restore_level();
762 (void)hp_player(1000);
763 cave_set_feat(py, px, FEAT_PATTERN_OLD);
765 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
767 msg_print("This section of the Pattern looks less powerful.");
774 * We could make the healing effect of the
775 * Pattern center one-time only to avoid various kinds
776 * of abuse, like luring the win monster into fighting you
777 * in the middle of the pattern...
780 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
784 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
788 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
792 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
794 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
800 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
802 else if (!IS_INVULN())
804 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
806 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
819 * Regenerate hit points -RAK-
821 static void regenhp(int percent)
823 s32b new_chp, new_chp_frac;
826 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
827 if (p_ptr->action == ACTION_HAYAGAKE) return;
828 /* Save the old hitpoints */
829 old_chp = p_ptr->chp;
831 /* Extract the new hitpoints */
832 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
833 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
835 /* check for overflow */
836 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
837 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
838 if (new_chp_frac >= 0x10000L)
840 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
845 p_ptr->chp_frac = (u16b)new_chp_frac;
849 if (p_ptr->chp >= p_ptr->mhp)
851 p_ptr->chp = p_ptr->mhp;
856 if (old_chp != p_ptr->chp)
859 p_ptr->redraw |= (PR_HP);
862 p_ptr->window |= (PW_PLAYER);
870 * Regenerate mana points -RAK-
872 static void regenmana(int percent)
874 s32b new_mana, new_mana_frac;
876 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
878 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
879 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
880 old_csp = p_ptr->csp;
881 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
882 if (old_csp_msp && (new_mana > 0))
886 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
887 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
891 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
892 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
894 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
896 if (new_mana_frac >= 0x10000L)
898 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
903 p_ptr->csp_frac = (u16b)(new_mana_frac);
906 /* check for overflow */
913 /* Must set frac to zero even if equal */
914 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
916 p_ptr->csp = p_ptr->msp;
921 if (old_csp != p_ptr->csp)
924 p_ptr->redraw |= (PR_MANA);
927 p_ptr->window |= (PW_PLAYER);
928 p_ptr->window |= (PW_SPELL);
939 static void regenmagic(int percent)
944 for (i = 0; i < EATER_EXT*2; i++)
946 if (!p_ptr->magic_num2[i]) continue;
947 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
948 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
949 p_ptr->magic_num1[i] += new_mana;
951 /* Must set frac to zero even if equal */
952 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
954 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
958 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
960 if (!p_ptr->magic_num1[i]) continue;
961 if (!p_ptr->magic_num2[i]) continue;
962 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
963 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
974 * Regenerate the monsters (once per 100 game turns)
976 * XXX XXX XXX Should probably be done during monster turns.
978 static void regen_monsters(void)
983 /* Regenerate everyone */
984 for (i = 1; i < m_max; i++)
986 /* Check the i'th monster */
987 monster_type *m_ptr = &m_list[i];
988 monster_race *r_ptr = &r_info[m_ptr->r_idx];
991 /* Skip dead monsters */
992 if (!m_ptr->r_idx) continue;
994 /* Allow regeneration (if needed) */
995 if (m_ptr->hp < m_ptr->maxhp)
997 /* Hack -- Base regeneration */
998 frac = m_ptr->maxhp / 100;
1000 /* Hack -- Minimal regeneration rate */
1001 if (!frac) if (one_in_(2)) frac = 1;
1003 /* Hack -- Some monsters regenerate quickly */
1004 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1006 /* Hack -- Regenerate */
1009 /* Do not over-regenerate */
1010 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1012 /* Redraw (later) if needed */
1013 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1014 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1021 * Regenerate the captured monsters (once per 30 game turns)
1023 * XXX XXX XXX Should probably be done during monster turns.
1025 static void regen_captured_monsters(void)
1030 /* Regenerate everyone */
1031 for (i = 0; i < INVEN_TOTAL; i++)
1033 monster_race *r_ptr;
1034 object_type *o_ptr = &inventory[i];
1036 if (!o_ptr->k_idx) continue;
1037 if (o_ptr->tval != TV_CAPTURE) continue;
1038 if (!o_ptr->pval) continue;
1042 r_ptr = &r_info[o_ptr->pval];
1044 /* Allow regeneration (if needed) */
1045 if (o_ptr->xtra4 < o_ptr->xtra5)
1047 /* Hack -- Base regeneration */
1048 frac = o_ptr->xtra5 / 100;
1050 /* Hack -- Minimal regeneration rate */
1051 if (!frac) if (one_in_(2)) frac = 1;
1053 /* Hack -- Some monsters regenerate quickly */
1054 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1056 /* Hack -- Regenerate */
1057 o_ptr->xtra4 += frac;
1059 /* Do not over-regenerate */
1060 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1067 p_ptr->notice |= (PN_COMBINE);
1070 p_ptr->window |= (PW_INVEN);
1071 p_ptr->window |= (PW_EQUIP);
1078 * Process the counters of monsters (once per 10 game turns)
1080 * This function is to process monsters' counters same as player's.
1082 static void process_monsters_counters(void)
1085 monster_type *m_ptr;
1086 monster_race *r_ptr;
1088 u32b noise; /* Hack -- local "player stealth" value */
1090 /* Handle "leaving" */
1091 if (p_ptr->leaving) return;
1093 /* Hack -- calculate the "player noise" */
1094 noise = (1L << (30 - p_ptr->skill_stl));
1096 /* Process the monsters (backwards) */
1097 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1099 /* Access the monster */
1100 m_ptr = &m_list[m_idx];
1101 r_ptr = &r_info[m_ptr->r_idx];
1103 /* Ignore "dead" monsters */
1104 if (!m_ptr->r_idx) continue;
1106 /* Handle Invulnerability */
1107 if (m_ptr->invulner)
1109 /* Reduce by one, note if expires */
1112 if (!m_ptr->invulner)
1118 /* Acquire the monster name */
1119 monster_desc(m_name, m_ptr, 0);
1121 /* Dump a message */
1123 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1125 msg_format("%^s is no longer invulnerable.", m_name);
1128 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1129 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1131 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1138 /* Reduce by one, note if expires */
1141 if (!m_ptr->fast && m_ptr->ml)
1145 /* Acquire the monster name */
1146 monster_desc(m_name, m_ptr, 0);
1148 /* Dump a message */
1150 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1152 msg_format("%^s is no longer fast.", m_name);
1155 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1156 if (p_ptr->riding == m_idx)
1158 p_ptr->redraw |= (PR_UHEALTH);
1159 p_ptr->update |= (PU_BONUS);
1167 /* Reduce by one, note if expires */
1170 if (!m_ptr->slow && m_ptr->ml)
1174 /* Acquire the monster name */
1175 monster_desc(m_name, m_ptr, 0);
1177 /* Dump a message */
1179 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1181 msg_format("%^s is no longer slow.", m_name);
1184 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1185 if (p_ptr->riding == m_idx)
1187 p_ptr->redraw |= (PR_UHEALTH);
1188 p_ptr->update |= (PU_BONUS);
1193 /* Handle "sleep" */
1196 /* Assume does not wake up */
1199 /* Hack -- Require proximity */
1200 if (m_ptr->cdis < AAF_LIMIT)
1202 /* Handle "sensing radius" */
1203 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1205 /* We may wake up */
1209 /* Handle "sight" and "aggravation" */
1210 else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
1212 /* We may wake up */
1219 u32b notice = randint0(1024);
1221 /* Nightmare monsters are more alert */
1222 if (ironman_nightmare) notice /= 2;
1224 /* Hack -- See if monster "notices" player */
1225 if ((notice * notice * notice) <= noise)
1227 /* Hack -- amount of "waking" */
1228 /* Wake up faster near the player */
1229 int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
1231 /* Hack -- amount of "waking" is affected by speed of player */
1232 d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
1236 if (m_ptr->csleep > d)
1238 /* Monster wakes up "a little bit" */
1241 /* Notice the "not waking up" */
1244 /* Hack -- Count the ignores */
1245 if (r_ptr->r_ignore < MAX_UCHAR)
1255 /* Reset sleep counter */
1258 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1260 /* Notice the "waking up" */
1265 /* Acquire the monster name */
1266 monster_desc(m_name, m_ptr, 0);
1268 /* Dump a message */
1270 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1272 msg_format("%^s wakes up.", m_name);
1275 /* Redraw the health bar */
1276 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1277 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1279 /* Hack -- Count the wakings */
1280 if (r_ptr->r_wake < MAX_UCHAR)
1295 /* Make a "saving throw" against stun */
1296 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1302 /* Hack -- Recover from stun */
1303 if (m_ptr->stunned > d)
1305 /* Recover somewhat */
1306 m_ptr->stunned -= d;
1315 /* Message if visible */
1320 /* Acquire the monster name */
1321 monster_desc(m_name, m_ptr, 0);
1323 /* Dump a message */
1325 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1327 msg_format("%^s is no longer stunned.", m_name);
1330 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1331 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1336 /* Handle confusion */
1337 if (m_ptr->confused)
1339 /* Amount of "boldness" */
1340 int d = randint1(r_ptr->level / 20 + 1);
1342 /* Still confused */
1343 if (m_ptr->confused > d)
1345 /* Reduce the confusion */
1346 m_ptr->confused -= d;
1352 /* No longer confused */
1353 m_ptr->confused = 0;
1355 /* Message if visible */
1360 /* Acquire the monster name */
1361 monster_desc(m_name, m_ptr, 0);
1363 /* Dump a message */
1365 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1367 msg_format("%^s is no longer confused.", m_name);
1370 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1371 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1379 /* Amount of "boldness" */
1380 int d = randint1(r_ptr->level / 20 + 1);
1383 if (m_ptr->monfear > d)
1385 /* Reduce the fear */
1386 m_ptr->monfear -= d;
1389 /* Recover from fear, take note if seen */
1392 /* No longer afraid */
1402 /* Acquire the monster possessive */
1403 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1406 /* Acquire the monster name */
1407 monster_desc(m_name, m_ptr, 0);
1409 /* Dump a message */
1411 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1413 msg_format("%^s recovers %s courage.", m_name, m_poss);
1416 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1417 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1425 static void notice_lite_change(object_type *o_ptr)
1427 /* Hack -- notice interesting fuel steps */
1428 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1431 p_ptr->window |= (PW_EQUIP);
1434 /* Hack -- Special treatment when blind */
1437 /* Hack -- save some light for later */
1438 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1441 /* The light is now out */
1442 else if (o_ptr->xtra4 == 0)
1446 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1448 msg_print("Your light has gone out!");
1450 p_ptr->update |= (PU_BONUS);
1453 /* The light is getting dim */
1454 else if (o_ptr->name2 == EGO_LITE_LONG)
1456 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1457 && (turn % (TURNS_PER_TICK*2)))
1459 if (disturb_minor) disturb(0, 0);
1461 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1463 msg_print("Your light is growing faint.");
1469 /* The light is getting dim */
1470 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1472 if (disturb_minor) disturb(0, 0);
1474 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1476 msg_print("Your light is growing faint.");
1483 void leave_quest_check(void)
1485 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1486 leaving_quest = p_ptr->inside_quest;
1488 /* Leaving an 'only once' quest marks it as failed */
1489 if (leaving_quest &&
1490 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1491 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1493 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1494 quest[leaving_quest].complev = (byte)p_ptr->lev;
1495 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1497 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1498 if (record_rand_quest)
1499 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1501 /* Floor of random quest will be blocked */
1502 prepare_change_floor_mode(CFM_NO_RETURN);
1504 else if (record_fix_quest)
1505 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1511 * Forcibly pseudo-identify an object in the inventory
1514 * note: currently this function allows pseudo-id of any object,
1515 * including silly ones like potions & scrolls, which always
1516 * get '{average}'. This should be changed, either to stop such
1517 * items from being pseudo-id'd, or to allow psychometry to
1518 * detect whether the unidentified potion/scroll/etc is
1519 * good (Cure Light Wounds, Restore Strength, etc) or
1520 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1522 bool psychometry(void)
1526 char o_name[MAX_NLEN];
1532 item_tester_no_ryoute = TRUE;
1535 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1536 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1538 q = "Meditate on which item? ";
1539 s = "You have nothing appropriate.";
1542 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1544 /* Get the item (in the pack) */
1547 o_ptr = &inventory[item];
1550 /* Get the item (on the floor) */
1553 o_ptr = &o_list[0 - item];
1556 /* It is fully known, no information needed */
1557 if (object_known_p(o_ptr))
1560 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1562 msg_print("You cannot find out anything more about that.");
1568 /* Check for a feeling */
1569 feel = value_check_aux1(o_ptr);
1571 /* Get an object description */
1572 object_desc(o_name, o_ptr, FALSE, 0);
1574 /* Skip non-feelings */
1578 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1580 msg_format("You do not perceive anything unusual about the %s.", o_name);
1587 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1588 o_name, game_inscriptions[feel]);
1590 msg_format("You feel that the %s %s %s...",
1591 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1592 game_inscriptions[feel]);
1596 /* We have "felt" it */
1597 o_ptr->ident |= (IDENT_SENSE);
1600 o_ptr->feeling = feel;
1602 /* Combine / Reorder the pack (later) */
1603 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1606 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1608 /* Valid "tval" codes */
1609 switch (o_ptr->tval)
1637 /* Auto-inscription/destroy */
1638 idx = is_autopick(o_ptr);
1639 auto_inscribe_item(item, idx);
1640 if (okay && destroy_feeling)
1641 auto_destroy_item(item, idx);
1643 /* Something happened */
1648 static void gere_music(s32b music)
1656 stun_monsters(damroll(p_ptr->lev/10,2));
1659 hp_player(damroll(2,6));
1662 project_hack(GF_TURN_ALL, p_ptr->lev);
1665 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1668 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1671 confuse_monsters(p_ptr->lev * 2);
1674 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1677 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1680 project(0, 0, py, px,
1681 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1684 dispel_monsters(randint1(p_ptr->lev * 3));
1685 dispel_evil(randint1(p_ptr->lev * 3));
1692 earthquake(py, px, 10);
1695 stasis_monsters(p_ptr->lev * 4);
1698 dispel_monsters(randint1(p_ptr->lev * 3));
1701 hp_player(damroll(15,10));
1705 case MUSIC_DETECT+19:
1707 case MUSIC_DETECT+11:
1708 case MUSIC_DETECT+12:
1709 case MUSIC_DETECT+13:
1710 case MUSIC_DETECT+14:
1711 case MUSIC_DETECT+15:
1712 case MUSIC_DETECT+16:
1713 case MUSIC_DETECT+17:
1714 case MUSIC_DETECT+18:
1715 map_area(DETECT_RAD_MAP);
1716 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1717 case MUSIC_DETECT+6:
1718 case MUSIC_DETECT+7:
1719 case MUSIC_DETECT+8:
1720 case MUSIC_DETECT+9:
1721 case MUSIC_DETECT+10:
1722 /* There are too many hidden treasure. So... */
1723 /* detect_treasure(DETECT_RAD_DEFAULT); */
1724 detect_objects_gold(DETECT_RAD_DEFAULT);
1725 detect_objects_normal(DETECT_RAD_DEFAULT);
1726 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1727 case MUSIC_DETECT+3:
1728 case MUSIC_DETECT+4:
1729 case MUSIC_DETECT+5:
1730 detect_monsters_invis(DETECT_RAD_DEFAULT);
1731 detect_monsters_normal(DETECT_RAD_DEFAULT);
1732 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1734 case MUSIC_DETECT+1:
1735 case MUSIC_DETECT+2:
1736 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1737 detect_doors(DETECT_RAD_DEFAULT);
1738 detect_stairs(DETECT_RAD_DEFAULT);
1739 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1745 * If player has inscribed the object with "!!", let him know when it's
1748 static void recharged_notice(object_type *o_ptr)
1750 char o_name[MAX_NLEN];
1754 /* No inscription */
1755 if (!o_ptr->inscription) return;
1759 s = strchr_j(quark_str(o_ptr->inscription), '!');
1761 s = strchr(quark_str(o_ptr->inscription), '!');
1764 /* Process notification request. */
1767 /* Find another '!' */
1770 /* Describe (briefly) */
1771 object_desc(o_name, o_ptr, FALSE, 0);
1773 /* Notify the player */
1775 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1777 if (o_ptr->number > 1)
1778 msg_format("Your %s are recharged.", o_name);
1780 msg_format("Your %s is recharged.", o_name);
1789 /* Keep looking for '!'s */
1791 s = strchr_j(s + 1, '!');
1793 s = strchr(s + 1, '!');
1799 static void check_music(void)
1805 /* Music singed by player */
1806 if (p_ptr->pclass != CLASS_BARD) return;
1807 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1809 spell = p_ptr->magic_num2[0];
1810 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1812 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1813 need_mana *= 0x8000;
1814 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1821 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1822 need_mana = (need_mana & 0xffff);
1823 if ((u32b)p_ptr->csp_frac < need_mana)
1826 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1830 p_ptr->csp_frac -= (u16b)need_mana;
1833 p_ptr->redraw |= PR_MANA;
1834 if (p_ptr->magic_num1[1])
1836 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1837 p_ptr->magic_num1[1] = 0;
1839 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1841 msg_print("You restart singing.");
1843 p_ptr->action = ACTION_SING;
1845 /* Recalculate bonuses */
1846 p_ptr->update |= (PU_BONUS | PU_HP);
1848 /* Redraw map and status bar */
1849 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1851 /* Update monsters */
1852 p_ptr->update |= (PU_MONSTERS);
1855 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1858 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1859 p_ptr->spell_exp[spell] += 5;
1860 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1861 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1862 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1863 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1864 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1865 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1867 gere_music(p_ptr->magic_num1[0]);
1870 /* Choose one of items that have cursed flag */
1871 static object_type *choose_cursed_obj_name(u32b flag)
1874 int choices[INVEN_TOTAL-INVEN_RARM];
1877 /* Paranoia -- Player has no warning-item */
1878 if (!(p_ptr->cursed & flag)) return NULL;
1880 /* Search Inventry */
1881 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1883 object_type *o_ptr = &inventory[i];
1885 if (o_ptr->curse_flags & flag)
1887 choices[number] = i;
1892 /* Choice one of them */
1893 return (&inventory[choices[randint0(number)]]);
1898 * Handle certain things once every 10 game turns
1900 static void process_world(void)
1904 bool cave_no_regen = FALSE;
1905 int upkeep_factor = 0;
1910 const int dec_count = (easy_band ? 2 : 1);
1912 int day, hour, min, prev_min;
1914 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1915 s32b tick = turn % len + len / 4;
1917 int quest_num = quest_number(dun_level);
1919 extract_day_hour_min(&day, &hour, &min);
1920 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1922 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1924 !(quest_num && (is_fixed_quest_idx(quest_num) &&
1925 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
1926 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
1927 !p_ptr->inside_battle)
1929 /* Announce feeling */
1932 /* Update the level indicator */
1933 p_ptr->redraw |= (PR_DEPTH);
1936 if (disturb_minor) disturb(0, 0);
1939 if (p_ptr->inside_battle && !p_ptr->leaving)
1946 /* Count all hostile monsters */
1947 for (i2 = 0; i2 < cur_wid; ++i2)
1948 for (j2 = 0; j2 < cur_hgt; j2++)
1949 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1952 win_m_idx = cave[j2][i2].m_idx;
1955 if (number_mon == 0)
1958 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1960 msg_print("They have kill each other at the same time.");
1963 p_ptr->energy_need = 0;
1966 else if ((number_mon-1) == 0)
1969 monster_type *wm_ptr;
1971 wm_ptr = &m_list[win_m_idx];
1973 monster_desc(m_name, wm_ptr, 0);
1975 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1977 msg_format("%s is winner!", m_name);
1981 if (win_m_idx == (sel_monster+1))
1984 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1986 msg_print("Congratulations.");
1989 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1991 msg_format("You received %d gold.", battle_odds);
1993 p_ptr->au += battle_odds;
1998 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
2000 msg_print("You lost gold.");
2004 p_ptr->energy_need = 0;
2007 else if(turn - old_turn == 150*TURNS_PER_TICK)
2010 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
2012 msg_format("This battle have ended in a draw.");
2014 p_ptr->au += kakekin;
2016 p_ptr->energy_need = 0;
2021 /* Every 10 game turns */
2022 if (turn % TURNS_PER_TICK) return;
2024 /*** Check the Time and Load ***/
2026 if (!(turn % (50*TURNS_PER_TICK)))
2028 /* Check time and load */
2029 if ((0 != check_time()) || (0 != check_load()))
2032 if (closing_flag <= 2)
2037 /* Count warnings */
2042 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2043 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2045 msg_print("The gates to ANGBAND are closing...");
2046 msg_print("Please finish up and/or save your game.");
2056 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2058 msg_print("The gates to ANGBAND are now closed.");
2063 p_ptr->playing = FALSE;
2066 p_ptr->leaving = TRUE;
2071 /*** Attempt timed autosave ***/
2072 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2074 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2075 do_cmd_save_game(TRUE);
2081 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2083 msg_print("You hear noise.");
2087 /*** Handle the wilderness/town (sunshine) ***/
2089 /* While in town/wilderness */
2090 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2092 /* Hack -- Daybreak/Nighfall in town */
2093 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2097 /* Check for dawn */
2098 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2105 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2107 msg_print("The sun has risen.");
2110 /* Hack -- Scan the town */
2111 for (y = 0; y < cur_hgt; y++)
2113 for (x = 0; x < cur_wid; x++)
2115 /* Get the cave grid */
2116 c_ptr = &cave[y][x];
2119 c_ptr->info |= (CAVE_GLOW);
2121 /* Hack -- Memorize lit grids if allowed */
2122 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2124 /* Hack -- Notice spot */
2137 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2139 msg_print("The sun has fallen.");
2142 /* Hack -- Scan the town */
2143 for (y = 0; y < cur_hgt; y++)
2145 for (x = 0; x < cur_wid; x++)
2147 /* Get the cave grid */
2148 c_ptr = &cave[y][x];
2150 /* Feature code (applying "mimic" field) */
2151 feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
2153 if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
2156 c_ptr->info &= ~(CAVE_GLOW);
2158 if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
2160 /* Forget the normal floor grid */
2161 c_ptr->info &= ~(CAVE_MARK);
2163 /* Hack -- Notice spot */
2169 /* Glow deep lava and building entrances */
2170 glow_deep_lava_and_bldg();
2174 /* Update the monsters */
2175 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2178 p_ptr->redraw |= (PR_MAP);
2181 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2185 /* While in the dungeon (vanilla_town or lite_town mode only) */
2186 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
2188 /*** Shuffle the Storekeepers ***/
2190 /* Chance is only once a day (while in dungeon) */
2191 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
2193 /* Sometimes, shuffle the shop-keepers */
2194 if (one_in_(STORE_SHUFFLE))
2198 /* Pick a random shop (except home) */
2201 n = randint0(MAX_STORES);
2203 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2207 if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_info[FEAT_SHOP_HEAD + n].name);
2209 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_info[FEAT_SHOP_HEAD + n].name);
2218 /* Set back the rewards once a day */
2219 /* Only used for reward in thief's guild for now */
2220 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2224 /* Reset the rewards */
2225 for (n = 0; n < MAX_BACT; n++)
2227 p_ptr->rewards[n] = FALSE;
2232 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2234 if (cheat_xtra) msg_print("Rewards reset.");
2240 /*** Process the monsters ***/
2242 /* Check for creature generation. */
2243 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2244 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2246 /* Make a new monster */
2247 (void)alloc_monster(MAX_SIGHT + 5, 0);
2250 /* Hack -- Check for creature regeneration */
2251 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2252 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2254 /* Hack -- Process the counters of all monsters */
2255 process_monsters_counters();
2258 /*** Damage over Time ***/
2260 /* Take damage from poison */
2261 if (p_ptr->poisoned && !IS_INVULN())
2265 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2267 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2273 /* (Vampires) Take damage from sunlight */
2274 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2276 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2278 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2282 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2283 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2285 msg_print("The sun's rays scorch your undead flesh!");
2286 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2289 cave_no_regen = TRUE;
2293 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2294 !p_ptr->resist_lite)
2296 object_type * o_ptr = &inventory[INVEN_LITE];
2297 char o_name [MAX_NLEN];
2298 char ouch [MAX_NLEN+40];
2300 /* Get an object description */
2301 object_desc(o_name, o_ptr, FALSE, 0);
2304 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2306 msg_format("The %s scorches your undead flesh!", o_name);
2310 cave_no_regen = TRUE;
2312 /* Get an object description */
2313 object_desc(o_name, o_ptr, TRUE, 0);
2316 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2318 sprintf(ouch, "wielding %s", o_name);
2321 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2325 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2326 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2328 int damage = 3000 + randint0(2000);
2330 if (prace_is_(RACE_ENT)) damage += damage/3;
2331 if (p_ptr->resist_fire) damage = damage / 3;
2332 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2333 damage = damage / 100 + (randint0(100) < (damage % 100));
2339 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2340 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2342 msg_print("The lava burns you!");
2343 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2346 cave_no_regen = TRUE;
2350 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2351 !IS_INVULN() && !p_ptr->immune_fire)
2353 int damage = 6000 + randint0(4000);
2358 if (p_ptr->resist_fire) damage = damage / 3;
2359 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2363 damage = damage / 5;
2366 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2367 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2369 message = "The heat burns you!";
2370 hit_from = "flying over deep lava";
2377 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2378 hit_from = "¿¼¤¤ÍÏ´äή";
2380 message = "The lava burns you!";
2381 hit_from = "deep lava";
2386 damage = damage / 100 + (randint0(100) < (damage % 100));
2391 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2393 cave_no_regen = TRUE;
2397 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2399 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2403 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2404 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2406 msg_print("You are drowning!");
2407 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2410 cave_no_regen = TRUE;
2417 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2419 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2420 if (prace_is_(RACE_ENT)) damage += damage / 3;
2421 if (p_ptr->resist_fire) damage = damage / 3;
2422 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2424 msg_print("Ç®¤¤¡ª");
2425 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2427 msg_print("It's hot!");
2428 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2431 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2433 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2434 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2435 if (p_ptr->resist_elec) damage = damage / 3;
2436 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2438 msg_print("Äˤ¤¡ª");
2439 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2441 msg_print("It hurts!");
2442 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2445 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2447 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2448 if (p_ptr->resist_cold) damage = damage / 3;
2449 if (IS_OPPOSE_COLD()) damage = damage / 3;
2451 msg_print("Î䤿¤¤¡ª");
2452 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2454 msg_print("It's cold!");
2455 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2460 /* Spectres -- take damage when moving through walls */
2462 * Added: ANYBODY takes damage if inside through walls
2463 * without wraith form -- NOTE: Spectres will never be
2464 * reduced below 0 hp by being inside a stone wall; others
2467 if (!cave_floor_bold(py, px))
2469 /* Player can walk through trees */
2470 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2474 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2475 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2479 cave_no_regen = TRUE;
2481 if (p_ptr->pass_wall)
2484 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2487 msg_print("Your molecules feel disrupted!");
2488 dam_desc = "density";
2495 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2496 dam_desc = "¹Å¤¤´ä";
2498 msg_print("You are being crushed!");
2499 dam_desc = "solid rock";
2504 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2510 if (min != prev_min)
2512 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2513 determine_today_mon(FALSE);
2517 /* Nightmare mode activates the TY_CURSE at midnight */
2518 if (ironman_nightmare)
2520 /* Require exact minute */
2521 if (min != prev_min)
2523 /* Every 15 minutes after 11:00 pm */
2524 if ((hour == 23) && !(min % 15))
2534 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2536 msg_print("You hear a distant bell toll ominously.");
2544 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2546 msg_print("A distant bell sounds twice.");
2554 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2556 msg_print("A distant bell sounds three times.");
2564 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2566 msg_print("A distant bell tolls four times.");
2574 /* TY_CURSE activates at mignight! */
2581 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2583 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2586 activate_ty_curse(FALSE, &count);
2591 /* Take damage from cuts */
2592 if (p_ptr->cut && !IS_INVULN())
2594 /* Mortal wound or Deep Gash */
2595 if (p_ptr->cut > 1000)
2600 else if (p_ptr->cut > 200)
2606 else if (p_ptr->cut > 100)
2611 else if (p_ptr->cut > 50)
2616 else if (p_ptr->cut > 25)
2621 else if (p_ptr->cut > 10)
2634 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2636 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2642 /*** Check the Food, and Regenerate ***/
2644 if (!p_ptr->inside_battle)
2646 /* Digest normally */
2647 if (p_ptr->food < PY_FOOD_MAX)
2649 /* Every 50 game turns */
2650 if (!(turn % (TURNS_PER_TICK*5)))
2652 /* Basic digestion rate based on speed */
2653 i = SPEED_TO_ENERGY(p_ptr->pspeed);
2655 /* Regeneration takes more food */
2656 if (p_ptr->regenerate) i += 20;
2657 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2658 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2660 /* Slow digestion takes less food */
2661 if (p_ptr->slow_digest) i -= 5;
2663 /* Minimal digestion */
2665 /* Maximal digestion */
2666 if (i > 100) i = 100;
2668 /* Digest some food */
2669 (void)set_food(p_ptr->food - i);
2673 /* Digest quickly when gorged */
2676 /* Digest a lot of food */
2677 (void)set_food(p_ptr->food - 100);
2681 /* Starve to death (slowly) */
2682 if (p_ptr->food < PY_FOOD_STARVE)
2684 /* Calculate damage */
2685 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2689 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2691 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2696 /* Default regeneration */
2697 regen_amount = PY_REGEN_NORMAL;
2700 if (p_ptr->food < PY_FOOD_WEAK)
2702 /* Lower regeneration */
2703 if (p_ptr->food < PY_FOOD_STARVE)
2707 else if (p_ptr->food < PY_FOOD_FAINT)
2709 regen_amount = PY_REGEN_FAINT;
2713 regen_amount = PY_REGEN_WEAK;
2717 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2719 /* Faint occasionally */
2720 if (!p_ptr->paralyzed && (randint0(100) < 10))
2724 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2726 msg_print("You faint from the lack of food.");
2731 /* Hack -- faint (bypass free action) */
2732 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2738 /* Are we walking the pattern? */
2739 if (pattern_effect())
2741 cave_no_regen = TRUE;
2745 /* Regeneration ability */
2746 if (p_ptr->regenerate)
2748 regen_amount = regen_amount * 2;
2750 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2754 if (p_ptr->cursed & TRC_SLOW_REGEN)
2761 /* Searching or Resting */
2762 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2764 regen_amount = regen_amount * 2;
2767 upkeep_factor = calculate_upkeep();
2769 /* Regenerate the mana */
2770 /* if (p_ptr->csp < p_ptr->msp) */
2774 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2775 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2776 regenmana(upkeep_regen/100);
2778 #ifdef TRACK_FRIENDS
2782 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2784 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2788 #endif /* TRACK_FRIENDS */
2791 else if (p_ptr->action != ACTION_LEARN)
2793 regenmana(regen_amount);
2796 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2798 regenmagic(regen_amount);
2801 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2803 while (upkeep_factor > 100)
2806 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2808 msg_print("Such much pets cannot be controled at once!");
2811 do_cmd_pet_dismiss();
2813 upkeep_factor = calculate_upkeep();
2816 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2818 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2824 /* Poisoned or cut yields no healing */
2825 if (p_ptr->poisoned) regen_amount = 0;
2826 if (p_ptr->cut) regen_amount = 0;
2828 /* Special floor -- Pattern, in a wall -- yields no healing */
2829 if (cave_no_regen) regen_amount = 0;
2831 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2833 /* Regenerate Hit Points if needed */
2834 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2836 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2837 (cave[py][px].feat >= FEAT_PATTERN_START))
2839 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2843 regenhp(regen_amount);
2848 /*** Timeout Various Things ***/
2851 if (p_ptr->tim_mimic)
2853 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2856 /* Hack -- Hallucinating */
2859 (void)set_image(p_ptr->image - dec_count);
2865 (void)set_blind(p_ptr->blind - dec_count);
2868 /* Times see-invisible */
2869 if (p_ptr->tim_invis)
2871 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2882 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2885 /* Timed temporary elemental brands. -LM- */
2886 if (p_ptr->ele_attack)
2888 p_ptr->ele_attack--;
2890 /* Clear all temporary elemental brands. */
2891 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2894 /* Timed temporary elemental immune. -LM- */
2895 if (p_ptr->ele_immune)
2897 p_ptr->ele_immune--;
2899 /* Clear all temporary elemental brands. */
2900 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2903 /* Timed infra-vision */
2904 if (p_ptr->tim_infra)
2906 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2910 if (p_ptr->tim_stealth)
2912 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2915 /* Timed levitation */
2916 if (p_ptr->tim_ffall)
2918 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2921 /* Timed sh_touki */
2922 if (p_ptr->tim_sh_touki)
2924 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2928 if (p_ptr->tim_sh_fire)
2930 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2934 if (p_ptr->tim_sh_holy)
2936 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2940 if (p_ptr->tim_eyeeye)
2942 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2945 /* Timed resist-magic */
2946 if (p_ptr->resist_magic)
2948 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2951 /* Timed regeneration */
2952 if (p_ptr->tim_regen)
2954 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2957 /* Timed resist nether */
2958 if (p_ptr->tim_res_nether)
2960 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2963 /* Timed resist time */
2964 if (p_ptr->tim_res_time)
2966 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2970 if (p_ptr->tim_reflect)
2972 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2976 if (p_ptr->multishadow)
2978 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2981 /* Timed Robe of dust */
2982 if (p_ptr->dustrobe)
2984 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2987 /* Timed infra-vision */
2988 if (p_ptr->kabenuke)
2990 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2994 if (p_ptr->paralyzed)
2996 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
3000 if (p_ptr->confused)
3002 (void)set_confused(p_ptr->confused - dec_count);
3008 (void)set_afraid(p_ptr->afraid - dec_count);
3014 (void)set_fast(p_ptr->fast - 1, TRUE);
3020 (void)set_slow(p_ptr->slow - dec_count, TRUE);
3023 /* Protection from evil */
3024 if (p_ptr->protevil)
3026 (void)set_protevil(p_ptr->protevil - 1, TRUE);
3029 /* Invulnerability */
3032 (void)set_invuln(p_ptr->invuln - 1, TRUE);
3036 if (p_ptr->wraith_form)
3038 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3044 (void)set_hero(p_ptr->hero - 1, TRUE);
3050 (void)set_shero(p_ptr->shero - 1, TRUE);
3056 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3062 (void)set_shield(p_ptr->shield - 1, TRUE);
3066 if (p_ptr->tsubureru)
3068 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3072 if (p_ptr->magicdef)
3074 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3078 if (p_ptr->tsuyoshi)
3080 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3084 if (p_ptr->oppose_acid)
3086 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3089 /* Oppose Lightning */
3090 if (p_ptr->oppose_elec)
3092 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3096 if (p_ptr->oppose_fire)
3098 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3102 if (p_ptr->oppose_cold)
3104 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3108 if (p_ptr->oppose_pois)
3110 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3115 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3118 /*** Poison and Stun and Cut ***/
3121 if (p_ptr->poisoned)
3123 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3125 /* Apply some healing */
3126 (void)set_poisoned(p_ptr->poisoned - adjust);
3132 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3134 /* Apply some healing */
3135 (void)set_stun(p_ptr->stun - adjust);
3141 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3143 /* Hack -- Truly "mortal" wound */
3144 if (p_ptr->cut > 1000) adjust = 0;
3146 /* Apply some healing */
3147 (void)set_cut(p_ptr->cut - adjust);
3152 /*** Process Light ***/
3154 /* Check for light being wielded */
3155 o_ptr = &inventory[INVEN_LITE];
3157 /* Burn some fuel in the current lite */
3158 if (o_ptr->tval == TV_LITE)
3160 /* Hack -- Use some fuel (except on artifacts) */
3161 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3163 /* Decrease life-span */
3164 if (o_ptr->name2 == EGO_LITE_LONG)
3166 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3168 else o_ptr->xtra4--;
3170 /* Notice interesting fuel steps */
3171 notice_lite_change(o_ptr);
3175 /* Calculate torch radius */
3176 p_ptr->update |= (PU_TORCH);
3179 /*** Process mutation effects ***/
3180 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3182 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3186 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3187 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3189 msg_print("RAAAAGHH!");
3190 msg_print("You feel a fit of rage coming over you!");
3193 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3196 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3198 if (!p_ptr->resist_fear)
3202 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3204 msg_print("It's so dark... so scary!");
3207 set_afraid(p_ptr->afraid + 13 + randint1(26));
3211 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3213 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3218 /* Teleport player */
3220 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3222 msg_print("Your position suddenly seems very uncertain...");
3226 teleport_player(40);
3230 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3232 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3235 p_ptr->redraw |= PR_EXTRA;
3237 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3239 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3244 if (!p_ptr->resist_conf)
3246 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3249 if (!p_ptr->resist_chaos)
3254 if (one_in_(3)) lose_all_info();
3256 teleport_player(100);
3259 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3260 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3262 msg_print("You wake up somewhere with a sore head...");
3263 msg_print("You can't remember a thing, or how you got here!");
3272 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3274 msg_print("Thishcischs GooDSChtuff!");
3277 (void)set_image(p_ptr->image + randint0(150) + 150);
3283 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3285 if (!p_ptr->resist_chaos)
3288 p_ptr->redraw |= PR_EXTRA;
3289 (void)set_image(p_ptr->image + randint0(50) + 20);
3293 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3298 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3300 msg_print("BRRAAAP! Oops.");
3304 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3307 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3308 !p_ptr->anti_magic && one_in_(9000))
3313 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3315 msg_print("Magical energy flows through you! You must release it!");
3320 (void)get_hack_dir(&dire);
3321 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3324 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3325 !p_ptr->anti_magic && (randint1(6666) == 666))
3327 bool pet = one_in_(6);
3328 u32b mode = PM_ALLOW_GROUP;
3330 if (pet) mode |= PM_FORCE_PET;
3331 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3333 if (summon_specific((pet ? -1 : 0), py, px,
3334 dun_level, SUMMON_DEMON, mode))
3337 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3339 msg_print("You have attracted a demon!");
3346 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3352 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3354 msg_print("You feel less energetic.");
3357 if (p_ptr->fast > 0)
3363 set_slow(randint1(30) + 10, FALSE);
3369 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3371 msg_print("You feel more energetic.");
3374 if (p_ptr->slow > 0)
3380 set_fast(randint1(30) + 10, FALSE);
3385 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3389 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3391 msg_print("You suddenly feel almost lonely.");
3394 banish_monsters(100);
3395 if (!dun_level && p_ptr->town_num)
3399 /* Pick a random shop (except home) */
3402 n = randint0(MAX_STORES);
3404 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3407 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3409 msg_print("You see one of the shopkeepers running for the hills!");
3417 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3422 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3424 msg_print("A shadow passes over you.");
3429 /* Absorb light from the current possition */
3430 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
3435 o_ptr = &inventory[INVEN_LITE];
3437 /* Absorb some fuel in the current lite */
3438 if (o_ptr->tval == TV_LITE)
3440 /* Use some fuel (except on artifacts) */
3441 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3443 /* Heal the player a bit */
3444 hp_player(o_ptr->xtra4 / 20);
3446 /* Decrease life-span of lite */
3450 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3452 msg_print("You absorb energy from your light!");
3456 /* Notice interesting fuel steps */
3457 notice_lite_change(o_ptr);
3462 * Unlite the area (radius 10) around player and
3463 * do 50 points damage to every affected monster
3465 unlite_area(50, 10);
3468 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3469 !p_ptr->anti_magic && one_in_(7000))
3471 bool pet = one_in_(3);
3472 u32b mode = PM_ALLOW_GROUP;
3474 if (pet) mode |= PM_FORCE_PET;
3475 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3477 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3480 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3482 msg_print("You have attracted an animal!");
3489 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3490 !p_ptr->anti_magic && one_in_(8000))
3494 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3496 msg_print("You feel the world warping around you!");
3500 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3502 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3504 if (!lose_mutation(0))
3506 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3508 msg_print("You feel oddly normal.");
3512 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3516 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3518 msg_print("You feel insubstantial!");
3522 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3524 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3528 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3530 int which_stat = randint0(6);
3531 int sustained = FALSE;
3536 if (p_ptr->sustain_str) sustained = TRUE;
3539 if (p_ptr->sustain_int) sustained = TRUE;
3542 if (p_ptr->sustain_wis) sustained = TRUE;
3545 if (p_ptr->sustain_dex) sustained = TRUE;
3548 if (p_ptr->sustain_con) sustained = TRUE;
3551 if (p_ptr->sustain_chr) sustained = TRUE;
3555 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3557 msg_print("Invalid stat chosen!");
3567 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3569 msg_print("You can feel yourself wasting away!");
3573 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3576 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3577 !p_ptr->anti_magic && one_in_(3000))
3579 bool pet = one_in_(5);
3580 u32b mode = PM_ALLOW_GROUP;
3582 if (pet) mode |= PM_FORCE_PET;
3583 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3585 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3588 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3590 msg_print("You have attracted a dragon!");
3596 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3599 if (p_ptr->tim_esp > 0)
3602 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3604 msg_print("Your mind feels cloudy!");
3607 set_tim_esp(0, TRUE);
3612 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3614 msg_print("Your mind expands!");
3617 set_tim_esp(p_ptr->lev, FALSE);
3620 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3625 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3627 msg_print("Your stomach roils, and you lose your lunch!");
3631 set_food(PY_FOOD_WEAK);
3634 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3635 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3640 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3642 int danger_amount = 0;
3645 for (monster = 0; monster < m_max; monster++)
3647 monster_type *m_ptr = &m_list[monster];
3648 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3650 /* Paranoia -- Skip dead monsters */
3651 if (!m_ptr->r_idx) continue;
3653 if (r_ptr->level >= p_ptr->lev)
3655 danger_amount += r_ptr->level - p_ptr->lev + 1;
3659 if (danger_amount > 100)
3661 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3663 msg_print("You feel utterly terrified!");
3666 else if (danger_amount > 50)
3668 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3670 msg_print("You feel terrified!");
3673 else if (danger_amount > 20)
3675 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3677 msg_print("You feel very worried!");
3680 else if (danger_amount > 10)
3682 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3684 msg_print("You feel paranoid!");
3687 else if (danger_amount > 5)
3689 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3691 msg_print("You feel almost safe.");
3696 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3698 msg_print("You feel lonely.");
3702 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3707 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3709 msg_print("You feel invincible!");
3713 (void)set_invuln(randint1(8) + 8, FALSE);
3715 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3717 int wounds = p_ptr->mhp - p_ptr->chp;
3721 int healing = p_ptr->csp;
3723 if (healing > wounds)
3729 p_ptr->csp -= healing;
3732 p_ptr->redraw |= (PR_MANA);
3735 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3738 int wounds = p_ptr->msp - p_ptr->csp;
3742 int healing = p_ptr->chp;
3744 if (healing > wounds)
3749 p_ptr->csp += healing;
3752 p_ptr->redraw |= (PR_MANA);
3754 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3756 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3761 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3767 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3768 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3770 msg_print("You trip over your own feet!");
3771 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3776 if (buki_motteruka(INVEN_RARM))
3778 int slot = INVEN_RARM;
3779 o_ptr = &inventory[INVEN_RARM];
3780 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3782 o_ptr = &inventory[INVEN_LARM];
3785 if (!cursed_p(o_ptr))
3788 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3790 msg_print("You drop your weapon!");
3793 inven_drop(slot, 1);
3800 /*** Process Inventory ***/
3802 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3805 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3806 * can actually be useful!
3808 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3811 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3813 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3817 teleport_player(50);
3820 /* Make a chainsword noise */
3821 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3825 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3827 if (!get_rnd_line("chainswd.txt", 0, noise))
3830 disturb(FALSE, FALSE);
3833 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3836 (void)activate_ty_curse(FALSE, &count);
3838 /* Handle experience draining */
3839 if (p_ptr->prace != RACE_ANDROID &&
3840 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3842 p_ptr->exp -= (p_ptr->lev+1)/2;
3843 if (p_ptr->exp < 0) p_ptr->exp = 0;
3844 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3845 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3848 /* Add light curse (Later) */
3849 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3854 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3856 new_curse = get_curse(0, o_ptr);
3857 if (!(o_ptr->curse_flags & new_curse))
3859 char o_name[MAX_NLEN];
3861 object_desc(o_name, o_ptr, FALSE, 0);
3863 o_ptr->curse_flags |= new_curse;
3865 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3867 msg_format("There is a malignant black aura surrounding %s...", o_name);
3870 o_ptr->feeling = FEEL_NONE;
3872 p_ptr->update |= (PU_BONUS);
3875 /* Add heavy curse (Later) */
3876 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3881 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3883 new_curse = get_curse(1, o_ptr);
3884 if (!(o_ptr->curse_flags & new_curse))
3886 char o_name[MAX_NLEN];
3888 object_desc(o_name, o_ptr, FALSE, 0);
3890 o_ptr->curse_flags |= new_curse;
3892 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3894 msg_format("There is a malignant black aura surrounding %s...", o_name);
3897 o_ptr->feeling = FEEL_NONE;
3899 p_ptr->update |= (PU_BONUS);
3903 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3905 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3906 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3908 char o_name[MAX_NLEN];
3910 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3912 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3914 msg_format("%s have attracted an animal!", o_name);
3921 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3923 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3925 char o_name[MAX_NLEN];
3927 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3929 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3931 msg_format("%s have attracted a demon!", o_name);
3938 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3940 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3941 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3943 char o_name[MAX_NLEN];
3945 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3947 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3949 msg_format("%s have attracted an animal!", o_name);
3955 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3957 if (!p_ptr->resist_fear)
3961 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3963 msg_print("It's so dark... so scary!");
3966 set_afraid(p_ptr->afraid + 13 + randint1(26));
3969 /* Teleport player */
3970 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3974 /* Teleport player */
3975 teleport_player(40);
3977 /* Handle HP draining */
3978 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3980 char o_name[MAX_NLEN];
3982 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3984 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3986 msg_format("%s drains HP from you!", o_name);
3988 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3990 /* Handle mana draining */
3991 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3993 char o_name[MAX_NLEN];
3995 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3997 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3999 msg_format("%s drains mana from you!", o_name);
4001 p_ptr->csp -= MIN(p_ptr->lev, 50);
4005 p_ptr->csp_frac = 0;
4007 p_ptr->redraw |= PR_MANA;
4011 /* Rarely, take damage from the Jewel of Judgement */
4012 if (one_in_(999) && !p_ptr->anti_magic)
4014 object_type *o_ptr = &inventory[INVEN_LITE];
4016 if (o_ptr->name1 == ART_JUDGE)
4019 if (object_known_p(o_ptr))
4020 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
4022 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
4023 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
4025 if (object_known_p(o_ptr))
4026 msg_print("The Jewel of Judgement drains life from you!");
4028 msg_print("Something drains life from you!");
4029 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
4035 /* Process equipment */
4036 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
4038 /* Get the object */
4039 o_ptr = &inventory[i];
4041 /* Skip non-objects */
4042 if (!o_ptr->k_idx) continue;
4044 /* Recharge activatable objects */
4045 if (o_ptr->timeout > 0)
4050 /* Notice changes */
4051 if (!o_ptr->timeout)
4053 recharged_notice(o_ptr);
4059 /* Notice changes */
4063 p_ptr->window |= (PW_EQUIP);
4068 * Recharge rods. Rods now use timeout to control charging status,
4069 * and each charging rod in a stack decreases the stack's timeout by
4070 * one per turn. -LM-
4072 for (j = 0, i = 0; i < INVEN_PACK; i++)
4074 o_ptr = &inventory[i];
4075 k_ptr = &k_info[o_ptr->k_idx];
4077 /* Skip non-objects */
4078 if (!o_ptr->k_idx) continue;
4080 /* Examine all charging rods or stacks of charging rods. */
4081 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4083 /* Determine how many rods are charging. */
4084 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4085 if (temp > o_ptr->number) temp = o_ptr->number;
4087 /* Decrease timeout by that number. */
4088 o_ptr->timeout -= temp;
4090 /* Boundary control. */
4091 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4093 /* Notice changes, provide message if object is inscribed. */
4094 if (!(o_ptr->timeout))
4096 recharged_notice(o_ptr);
4102 /* Notice changes */
4106 p_ptr->notice |= (PN_COMBINE);
4109 p_ptr->window |= (PW_INVEN);
4113 /* Feel the inventory */
4118 /*** Process Objects ***/
4120 /* Process objects */
4121 for (i = 1; i < o_max; i++)
4126 /* Skip dead objects */
4127 if (!o_ptr->k_idx) continue;
4129 /* Recharge rods on the ground. No messages. */
4130 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4133 o_ptr->timeout -= o_ptr->number;
4135 /* Boundary control. */
4136 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4141 /*** Involuntary Movement ***/
4143 /* Delayed Word-of-Recall */
4144 if (p_ptr->word_recall)
4147 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4148 * The player is yanked up/down as soon as
4149 * he loads the autosaved game.
4151 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4152 do_cmd_save_game(TRUE);
4154 /* Count down towards recall */
4155 p_ptr->word_recall--;
4157 p_ptr->redraw |= (PR_STATUS);
4159 /* Activate the recall */
4160 if (!p_ptr->word_recall)
4165 /* Determine the level */
4166 if (dun_level || p_ptr->inside_quest)
4169 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4171 msg_print("You feel yourself yanked upwards!");
4174 p_ptr->recall_dungeon = dungeon_type;
4176 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4181 leave_quest_check();
4183 p_ptr->inside_quest = 0;
4185 /* Clear all saved floors */
4186 prepare_change_floor_mode(CFM_CLEAR_ALL);
4188 p_ptr->leaving = TRUE;
4193 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4195 msg_print("You feel yourself yanked downwards!");
4198 dungeon_type = p_ptr->recall_dungeon;
4201 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4204 dun_level = max_dlv[dungeon_type];
4205 if (dun_level < 1) dun_level = 1;
4207 /* Nightmare mode makes recall more dangerous */
4208 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4214 else if (dun_level < 99)
4216 dun_level = (dun_level + 99) / 2;
4218 else if (dun_level > 100)
4220 dun_level = d_info[dungeon_type].maxdepth - 1;
4224 if (p_ptr->wild_mode)
4226 p_ptr->wilderness_y = py;
4227 p_ptr->wilderness_x = px;
4231 /* Save player position */
4235 p_ptr->wild_mode = FALSE;
4237 /* Clear all saved floors */
4238 prepare_change_floor_mode(CFM_CLEAR_ALL);
4241 p_ptr->leaving = TRUE;
4243 if (dungeon_type == DUNGEON_ANGBAND)
4245 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4247 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4248 (quest[i].status == QUEST_STATUS_TAKEN) &&
4249 (quest[i].level < dun_level))
4251 quest[i].status = QUEST_STATUS_FAILED;
4252 quest[i].complev = (byte)p_ptr->lev;
4253 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4260 sound(SOUND_TPLEVEL);
4265 /* Delayed Alter reality */
4266 if (p_ptr->alter_reality)
4268 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4269 do_cmd_save_game(TRUE);
4271 /* Count down towards alter */
4272 p_ptr->alter_reality--;
4274 p_ptr->redraw |= (PR_STATUS);
4276 /* Activate the alter reality */
4277 if (!p_ptr->alter_reality)
4282 /* Determine the level */
4283 if (!quest_number(dun_level) && dun_level)
4286 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4288 msg_print("The world changes!");
4291 /* Clear all saved floors */
4292 prepare_change_floor_mode(CFM_CLEAR_ALL);
4295 p_ptr->leaving = TRUE;
4300 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4302 msg_print("The world seems to change for a moment!");
4307 sound(SOUND_TPLEVEL);
4315 * Verify use of "wizard" mode
4317 static bool enter_wizard_mode(void)
4319 /* Ask first time */
4320 if (!p_ptr->noscore)
4322 /* Wizard mode is not permitted */
4323 if (!allow_debug_opts)
4326 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4328 msg_print("Wizard mode is not permitted.");
4333 /* Mention effects */
4335 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4336 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4338 msg_print("Wizard mode is for debugging and experimenting.");
4339 msg_print("The game will not be scored if you enter wizard mode.");
4344 /* Verify request */
4346 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4348 if (!get_check("Are you sure you want to enter wizard mode? "))
4355 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4357 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4360 p_ptr->noscore |= 0x0002;
4371 * Verify use of "debug" commands
4373 static bool enter_debug_mode(void)
4375 /* Ask first time */
4376 if (!p_ptr->noscore)
4378 /* Debug mode is not permitted */
4379 if (!allow_debug_opts)
4382 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4384 msg_print("Use of debug command is not permitted.");
4389 /* Mention effects */
4391 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4392 msg_print("¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4394 msg_print("The debug commands are for debugging and experimenting.");
4395 msg_print("The game will not be scored if you use debug commands.");
4400 /* Verify request */
4402 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥Ã¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4404 if (!get_check("Are you sure you want to use debug commands? "))
4411 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4413 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4416 p_ptr->noscore |= 0x0008;
4424 * Hack -- Declare the Debug Routines
4426 extern void do_cmd_debug(void);
4428 #endif /* ALLOW_WIZARD */
4434 * Verify use of "borg" commands
4436 static bool enter_borg_mode(void)
4438 /* Ask first time */
4439 if (!(p_ptr->noscore & 0x0010))
4441 /* Mention effects */
4443 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥Ã¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4444 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4446 msg_print("The borg commands are for debugging and experimenting.");
4447 msg_print("The game will not be scored if you use borg commands.");
4452 /* Verify request */
4454 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4456 if (!get_check("Are you sure you want to use borg commands? "))
4463 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4465 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4468 p_ptr->noscore |= 0x0010;
4476 * Hack -- Declare the Ben Borg
4478 extern void do_cmd_borg(void);
4480 #endif /* ALLOW_BORG */
4485 * Parse and execute the current command
4486 * Give "Warning" on illegal commands.
4488 * XXX XXX XXX Make some "blocks"
4490 static void process_command(void)
4492 int old_now_message = now_message;
4494 #ifdef ALLOW_REPEAT /* TNB */
4496 /* Handle repeating the last command */
4499 #endif /* ALLOW_REPEAT -- TNB */
4503 /* Parse the command */
4504 switch (command_cmd)
4520 /*** Wizard Commands ***/
4522 /* Toggle Wizard Mode */
4527 p_ptr->wizard = FALSE;
4529 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4531 msg_print("Wizard mode off.");
4535 else if (enter_wizard_mode())
4537 p_ptr->wizard = TRUE;
4539 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4541 msg_print("Wizard mode on.");
4546 /* Update monsters */
4547 p_ptr->update |= (PU_MONSTERS);
4549 /* Redraw "title" */
4550 p_ptr->redraw |= (PR_TITLE);
4558 /* Special "debug" commands */
4561 /* Enter debug mode */
4562 if (enter_debug_mode())
4569 #endif /* ALLOW_WIZARD */
4574 /* Special "borg" commands */
4577 /* Enter borg mode */
4578 if (enter_borg_mode())
4580 if (!p_ptr->wild_mode) do_cmd_borg();
4586 #endif /* ALLOW_BORG */
4590 /*** Inventory Commands ***/
4592 /* Wear/wield equipment */
4595 if (!p_ptr->wild_mode) do_cmd_wield();
4599 /* Take off equipment */
4602 if (!p_ptr->wild_mode) do_cmd_takeoff();
4609 if (!p_ptr->wild_mode) do_cmd_drop();
4613 /* Destroy an item */
4620 /* Equipment list */
4627 /* Inventory list */
4635 /*** Various commands ***/
4637 /* Identify an object */
4644 /* Hack -- toggle windows */
4647 toggle_inven_equip();
4652 /*** Standard "Movement" Commands ***/
4657 if (!p_ptr->wild_mode) do_cmd_alter();
4664 if (!p_ptr->wild_mode) do_cmd_tunnel();
4668 /* Move (usually pick up things) */
4671 #ifdef ALLOW_EASY_DISARM /* TNB */
4675 #else /* ALLOW_EASY_DISARM -- TNB */
4677 do_cmd_walk(always_pickup);
4679 #endif /* ALLOW_EASY_DISARM -- TNB */
4684 /* Move (usually do not pick up) */
4687 #ifdef ALLOW_EASY_DISARM /* TNB */
4691 #else /* ALLOW_EASY_DISARM -- TNB */
4693 do_cmd_walk(!always_pickup);
4695 #endif /* ALLOW_EASY_DISARM -- TNB */
4701 /*** Running, Resting, Searching, Staying */
4703 /* Begin Running -- Arg is Max Distance */
4706 if (!p_ptr->wild_mode) do_cmd_run();
4710 /* Stay still (usually pick things up) */
4713 do_cmd_stay(always_pickup);
4717 /* Stay still (usually do not pick up) */
4720 do_cmd_stay(!always_pickup);
4724 /* Rest -- Arg is time */
4731 /* Search for traps/doors */
4738 /* Toggle search mode */
4741 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4742 else set_action(ACTION_SEARCH);
4747 /*** Stairs and Doors and Chests and Traps ***/
4750 case SPECIAL_KEY_STORE:
4752 if (!p_ptr->wild_mode) do_cmd_store();
4756 /* Enter building -KMW- */
4757 case SPECIAL_KEY_BUILDING:
4759 if (!p_ptr->wild_mode) do_cmd_bldg();
4763 /* Enter quest level -KMW- */
4764 case SPECIAL_KEY_QUEST:
4766 if (!p_ptr->wild_mode) do_cmd_quest();
4770 /* Go up staircase */
4773 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4780 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4782 msg_print("To flee the ambush you have to reach the edge of the map.");
4785 else if (p_ptr->food < PY_FOOD_WEAK)
4788 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4790 msg_print("You must eat something here.");
4795 if (change_wild_mode())
4808 /* Go down staircase */
4811 if(!p_ptr->wild_mode) do_cmd_go_down();
4814 p_ptr->wilderness_x = px;
4815 p_ptr->wilderness_y = py;
4821 /* Open a door or chest */
4824 if (!p_ptr->wild_mode) do_cmd_open();
4831 if (!p_ptr->wild_mode) do_cmd_close();
4835 /* Jam a door with spikes */
4838 if (!p_ptr->wild_mode) do_cmd_spike();
4845 if (!p_ptr->wild_mode) do_cmd_bash();
4849 /* Disarm a trap or chest */
4852 if (!p_ptr->wild_mode) do_cmd_disarm();
4857 /*** Magic and Prayers ***/
4859 /* Gain new spells/prayers */
4862 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4864 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4866 msg_print("You don't have to learn spells!");
4868 else if (p_ptr->pclass == CLASS_SAMURAI)
4869 do_cmd_gain_hissatsu();
4870 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4880 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4881 (p_ptr->pclass == CLASS_BERSERKER) ||
4882 (p_ptr->pclass == CLASS_NINJA) ||
4883 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4884 ) do_cmd_mind_browse();
4885 else if (p_ptr->pclass == CLASS_SMITH)
4887 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4888 do_cmd_magic_eater(TRUE);
4889 else do_cmd_browse();
4897 if (!p_ptr->wild_mode)
4899 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4902 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4904 msg_print("You cannot cast spells!");
4907 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4910 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4912 msg_print("The dungeon absorbs all attempted magic!");
4916 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4920 cptr which_power = "ËâË¡";
4922 cptr which_power = "magic";
4924 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4926 which_power = "ĶǽÎÏ";
4928 which_power = "psionic powers";
4930 else if (p_ptr->pclass == CLASS_IMITATOR)
4932 which_power = "¤â¤Î¤Þ¤Í";
4934 which_power = "imitation";
4936 else if (p_ptr->pclass == CLASS_SAMURAI)
4938 which_power = "ɬ»¦·õ";
4940 which_power = "hissatsu";
4942 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4944 which_power = "¶ÀËâË¡";
4946 which_power = "mirror magic";
4948 else if (p_ptr->pclass == CLASS_NINJA)
4950 which_power = "Ǧ½Ñ";
4952 which_power = "ninjutsu";
4954 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4956 which_power = "µ§¤ê";
4958 which_power = "prayer";
4962 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4964 msg_format("An anti-magic shell disrupts your %s!", which_power);
4968 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4971 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4973 msg_format("You cannot think directly!");
4979 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4980 (p_ptr->pclass == CLASS_BERSERKER) ||
4981 (p_ptr->pclass == CLASS_NINJA) ||
4982 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4985 else if (p_ptr->pclass == CLASS_IMITATOR)
4987 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4988 do_cmd_magic_eater(FALSE);
4989 else if (p_ptr->pclass == CLASS_SAMURAI)
4991 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4992 do_cmd_cast_learned();
4993 else if (p_ptr->pclass == CLASS_SMITH)
5002 /* Issue a pet command */
5005 if (!p_ptr->wild_mode) do_cmd_pet();
5009 /*** Use various objects ***/
5011 /* Inscribe an object */
5018 /* Uninscribe an object */
5021 do_cmd_uninscribe();
5025 /* Activate an artifact */
5028 if (!p_ptr->wild_mode)
5030 if (!p_ptr->inside_arena)
5035 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5037 msg_print("The arena absorbs all attempted magic!");
5053 /* Fuel your lantern/torch */
5063 if (!p_ptr->wild_mode) do_cmd_fire();
5070 if (!p_ptr->wild_mode)
5080 if (!p_ptr->wild_mode)
5082 if (!p_ptr->inside_arena)
5087 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5089 msg_print("The arena absorbs all attempted magic!");
5101 if (!p_ptr->wild_mode)
5103 if (p_ptr->inside_arena)
5106 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5108 msg_print("The arena absorbs all attempted magic!");
5113 else if (use_command && rogue_like_commands)
5125 /* Quaff a potion */
5128 if (!p_ptr->wild_mode)
5130 if (!p_ptr->inside_arena)
5131 do_cmd_quaff_potion();
5135 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5137 msg_print("The arena absorbs all attempted magic!");
5149 if (!p_ptr->wild_mode)
5151 if (!p_ptr->inside_arena)
5152 do_cmd_read_scroll();
5156 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5158 msg_print("The arena absorbs all attempted magic!");
5170 if (!p_ptr->wild_mode)
5172 if (p_ptr->inside_arena)
5175 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5177 msg_print("The arena absorbs all attempted magic!");
5182 else if (use_command && !rogue_like_commands)
5192 /* Use racial power */
5195 if (!p_ptr->wild_mode) do_cmd_racial_power();
5200 /*** Looking at Things (nearby or on map) ***/
5202 /* Full dungeon map */
5209 /* Locate player on map */
5223 /* Target monster or location */
5226 if (!p_ptr->wild_mode) do_cmd_target();
5232 /*** Help and Such ***/
5241 /* Identify symbol */
5244 do_cmd_query_symbol();
5248 /* Character description */
5251 do_cmd_change_name();
5256 /*** System Commands ***/
5258 /* Hack -- User interface */
5265 /* Single line from a pref file */
5280 do_cmd_edit_autopick();
5284 /* Interact with macros */
5291 /* Interact with visuals */
5299 /* Interact with colors */
5307 /* Interact with options */
5315 /*** Misc Commands ***/
5331 /* Repeat level feeling */
5334 if (!p_ptr->wild_mode) do_cmd_feeling();
5338 /* Show previous message */
5341 do_cmd_message_one();
5345 /* Show previous messages */
5348 do_cmd_messages(old_now_message);
5352 /* Show quest status -KMW- */
5355 do_cmd_checkquest();
5359 /* Redraw the screen */
5362 now_message = old_now_message;
5367 #ifndef VERIFY_SAVEFILE
5369 /* Hack -- Save and don't quit */
5372 do_cmd_save_game(FALSE);
5376 #endif /* VERIFY_SAVEFILE */
5386 case SPECIAL_KEY_QUIT:
5388 do_cmd_save_and_exit();
5392 /* Quit (commit suicide) */
5405 /* Check artifacts, uniques, objects */
5412 /* Load "screen dump" */
5415 do_cmd_load_screen();
5419 /* Save "screen dump" */
5422 do_cmd_save_screen();
5426 /* Make random artifact list */
5429 spoil_random_artifact("randifact.txt");
5433 /* Hack -- Unknown command */
5436 if (flush_failure) flush();
5440 sound(SOUND_ILLEGAL);
5442 if (!get_rnd_line("error_j.txt", 0, error_m))
5444 if (!get_rnd_line("error.txt", 0, error_m))
5451 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5453 prt("Type '?' for help.", 0, 0);
5459 if (!energy_use && !now_message)
5460 now_message = old_now_message;
5466 static bool monster_tsuri(int r_idx)
5468 monster_race *r_ptr = &r_info[r_idx];
5470 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5478 * Process the player
5480 * Notice the annoying code to handle "pack overflow", which
5481 * must come first just in case somebody manages to corrupt
5482 * the savefiles by clever use of menu commands or something.
5484 static void process_player(void)
5488 /*** Apply energy ***/
5493 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5495 msg_print("You feel different!");
5498 (void)gain_random_mutation(0);
5499 hack_mutation = FALSE;
5502 if (p_ptr->inside_battle)
5504 for(i = 1; i < m_max; i++)
5506 monster_type *m_ptr = &m_list[i];
5508 if (!m_ptr->r_idx) continue;
5510 /* Hack -- Detect monster */
5511 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5513 /* Update the monster */
5514 update_mon(i, FALSE);
5519 /* Give the player some energy */
5520 else if (!(load && p_ptr->energy_need <= 0))
5522 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5526 if (p_ptr->energy_need > 0) return;
5527 if (!command_rep) prt_time();
5529 /*** Check for interupts ***/
5531 /* Complete resting */
5538 if ((p_ptr->chp == p_ptr->mhp) &&
5539 (p_ptr->csp >= p_ptr->msp))
5541 set_action(ACTION_NONE);
5545 /* Complete resting */
5546 else if (resting == -2)
5549 if ((p_ptr->chp == p_ptr->mhp) &&
5550 (p_ptr->csp >= p_ptr->msp) &&
5551 !p_ptr->blind && !p_ptr->confused &&
5552 !p_ptr->poisoned && !p_ptr->afraid &&
5553 !p_ptr->stun && !p_ptr->cut &&
5554 !p_ptr->slow && !p_ptr->paralyzed &&
5555 !p_ptr->image && !p_ptr->word_recall &&
5556 !p_ptr->alter_reality)
5558 set_action(ACTION_NONE);
5563 if (p_ptr->action == ACTION_FISH)
5566 Term_xtra(TERM_XTRA_DELAY, 10);
5570 bool success = FALSE;
5571 get_mon_num_prep(monster_tsuri,NULL);
5572 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5574 if (r_idx && one_in_(2))
5577 y = py+ddy[tsuri_dir];
5578 x = px+ddx[tsuri_dir];
5579 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5582 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5584 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5586 msg_format("You have a good catch!", m_name);
5594 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5596 msg_print("Damn! The fish stole your bait!");
5603 /* Handle "abort" */
5606 /* Check for "player abort" (semi-efficiently for resting) */
5607 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5612 /* Check for a key */
5621 /* Hack -- Show a Message */
5623 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5625 msg_print("Canceled.");
5632 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5634 monster_type *m_ptr = &m_list[p_ptr->riding];
5635 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5644 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
5646 /* Acquire the monster name */
5647 monster_desc(m_name, m_ptr, 0);
5649 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5651 msg_format("You have waked %s up.", m_name);
5653 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5654 p_ptr->redraw |= (PR_UHEALTH);
5661 /* Make a "saving throw" against stun */
5662 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5668 /* Hack -- Recover from stun */
5669 if (m_ptr->stunned > d)
5671 /* Recover somewhat */
5672 m_ptr->stunned -= d;
5683 /* Acquire the monster name */
5684 monster_desc(m_name, m_ptr, 0);
5686 /* Dump a message */
5688 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5690 msg_format("%^s is no longer stunned.", m_name);
5692 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5693 p_ptr->redraw |= (PR_UHEALTH);
5697 if (m_ptr->confused)
5701 /* Make a "saving throw" against stun */
5702 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5705 d = m_ptr->confused;
5708 /* Hack -- Recover from stun */
5709 if (m_ptr->confused > d)
5711 /* Recover somewhat */
5712 m_ptr->confused -= d;
5721 m_ptr->confused = 0;
5723 /* Acquire the monster name */
5724 monster_desc(m_name, m_ptr, 0);
5726 /* Dump a message */
5728 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5730 msg_format("%^s is no longer confused.", m_name);
5732 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5733 p_ptr->redraw |= (PR_UHEALTH);
5741 /* Make a "saving throw" against stun */
5742 if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
5748 /* Hack -- Recover from stun */
5749 if (m_ptr->monfear > d)
5751 /* Recover somewhat */
5752 m_ptr->monfear -= d;
5763 /* Acquire the monster name */
5764 monster_desc(m_name, m_ptr, 0);
5766 /* Dump a message */
5768 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5770 msg_format("%^s is no longer fear.", m_name);
5772 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5773 p_ptr->redraw |= (PR_UHEALTH);
5777 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5781 /* Handle the player song */
5782 if (!load) check_music();
5787 if (p_ptr->lightspeed)
5789 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5791 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5793 if (p_ptr->magic_num1[0] < 40)
5795 p_ptr->magic_num1[0] = 0;
5797 else p_ptr->magic_num1[0] -= 40;
5798 p_ptr->update |= (PU_BONUS);
5800 if (p_ptr->action == ACTION_LEARN)
5802 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5803 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5806 p_ptr->csp_frac = 0;
5807 set_action(ACTION_NONE);
5811 p_ptr->csp -= (s16b)(hoge >> 16);
5813 if (p_ptr->csp_frac < hoge)
5815 p_ptr->csp_frac += 0x10000L - hoge;
5819 p_ptr->csp_frac -= hoge;
5821 p_ptr->redraw |= PR_MANA;
5824 if (p_ptr->special_defense & KATA_MASK)
5826 if (p_ptr->special_defense & KATA_MUSOU)
5830 set_action(ACTION_NONE);
5835 p_ptr->redraw |= (PR_MANA);
5840 /*** Handle actual user input ***/
5842 /* Repeat until out of energy */
5843 while (p_ptr->energy_need <= 0)
5845 p_ptr->window |= PW_PLAYER;
5846 p_ptr->sutemi = FALSE;
5847 p_ptr->counter = FALSE;
5848 now_damaged = FALSE;
5850 /* Handle "p_ptr->notice" */
5853 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5856 /* Place the cursor on the player */
5857 move_cursor_relative(py, px);
5859 /* Refresh (optional) */
5860 if (fresh_before) Term_fresh();
5863 /* Hack -- Pack Overflow */
5864 if (inventory[INVEN_PACK].k_idx)
5866 int item = INVEN_PACK;
5868 char o_name[MAX_NLEN];
5872 /* Access the slot to be dropped */
5873 o_ptr = &inventory[item];
5880 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5882 msg_print("Your pack overflows!");
5887 object_desc(o_name, o_ptr, TRUE, 3);
5891 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5893 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5897 /* Drop it (carefully) near the player */
5898 (void)drop_near(o_ptr, 0, py, px);
5900 /* Modify, Describe, Optimize */
5901 inven_item_increase(item, -255);
5902 inven_item_describe(item);
5903 inven_item_optimize(item);
5905 /* Handle "p_ptr->notice" */
5908 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5913 /* Hack -- cancel "lurking browse mode" */
5914 if (!command_new) command_see = FALSE;
5917 /* Assume free turn */
5921 if (p_ptr->inside_battle)
5923 /* Place the cursor on the player */
5924 move_cursor_relative(py, px);
5926 command_cmd = SPECIAL_KEY_BUILDING;
5928 /* Process the command */
5932 /* Paralyzed or Knocked Out */
5933 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5940 else if (p_ptr->action == ACTION_REST)
5945 /* Reduce rest count */
5948 if (!resting) set_action(ACTION_NONE);
5950 /* Redraw the state */
5951 p_ptr->redraw |= (PR_STATE);
5959 else if (p_ptr->action == ACTION_FISH)
5972 /* Repeated command */
5973 else if (command_rep)
5975 /* Count this execution */
5978 /* Redraw the state */
5979 p_ptr->redraw |= (PR_STATE);
5984 /* Hack -- Assume messages were seen */
5987 /* Clear the top line */
5990 /* Process the command */
5994 /* Normal command */
5997 /* Place the cursor on the player */
5998 move_cursor_relative(py, px);
6001 /* Get a command (normal) */
6002 request_command(FALSE);
6005 /* Process the command */
6015 /* Use some energy */
6016 if (world_player || energy_use > 400)
6018 /* The Randomness is irrelevant */
6019 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
6023 /* There is some randomness of needed energy */
6024 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
6027 /* Hack -- constant hallucination */
6028 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
6031 /* Shimmer monsters if needed */
6032 if (shimmer_monsters)
6034 /* Clear the flag */
6035 shimmer_monsters = FALSE;
6037 /* Shimmer multi-hued monsters */
6038 for (i = 1; i < m_max; i++)
6040 monster_type *m_ptr;
6041 monster_race *r_ptr;
6043 /* Access monster */
6046 /* Skip dead monsters */
6047 if (!m_ptr->r_idx) continue;
6049 /* Skip unseen monsters */
6050 if (!m_ptr->ml) continue;
6052 /* Access the monster race */
6053 r_ptr = &r_info[m_ptr->ap_r_idx];
6055 /* Skip non-multi-hued monsters */
6056 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6059 /* Reset the flag */
6060 shimmer_monsters = TRUE;
6062 /* Redraw regardless */
6063 lite_spot(m_ptr->fy, m_ptr->fx);
6068 /* Handle monster detection */
6069 if (repair_monsters)
6071 /* Reset the flag */
6072 repair_monsters = FALSE;
6074 /* Rotate detection flags */
6075 for (i = 1; i < m_max; i++)
6077 monster_type *m_ptr;
6079 /* Access monster */
6082 /* Skip dead monsters */
6083 if (!m_ptr->r_idx) continue;
6085 /* Nice monsters get mean */
6086 if (m_ptr->mflag & MFLAG_NICE)
6088 /* Nice monsters get mean */
6089 m_ptr->mflag &= ~(MFLAG_NICE);
6092 /* Handle memorized monsters */
6093 if (m_ptr->mflag2 & MFLAG2_MARK)
6095 /* Maintain detection */
6096 if (m_ptr->mflag2 & MFLAG2_SHOW)
6099 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6101 /* Still need repairs */
6102 repair_monsters = TRUE;
6105 /* Remove detection */
6109 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6111 /* Assume invisible */
6114 /* Update the monster */
6115 update_mon(i, FALSE);
6117 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6118 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6120 /* Redraw regardless */
6121 lite_spot(m_ptr->fy, m_ptr->fx);
6126 if (p_ptr->pclass == CLASS_IMITATOR)
6128 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6131 for (i = 0; i < p_ptr->mane_num; i++)
6133 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6134 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6138 p_ptr->redraw |= (PR_MANE);
6140 if (p_ptr->action == ACTION_LEARN)
6143 p_ptr->redraw |= (PR_STATE);
6146 if (world_player && (p_ptr->energy_need > - 1000))
6149 p_ptr->redraw |= (PR_MAP);
6151 /* Update monsters */
6152 p_ptr->update |= (PU_MONSTERS);
6155 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6158 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6160 msg_print("You feel time flowing around you once more.");
6163 world_player = FALSE;
6164 p_ptr->energy_need = ENERGY_NEED();
6166 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6171 /* Hack -- notice death */
6172 if (!p_ptr->playing || p_ptr->is_dead)
6174 world_player = FALSE;
6178 /* Handle "leaving" */
6179 if (p_ptr->leaving) break;
6182 /* Update scent trail */
6188 * Interact with the current dungeon level.
6190 * This function will not exit until the level is completed,
6191 * the user dies, or the game is terminated.
6193 static void dungeon(bool load_game)
6197 /* Set the base level */
6198 base_level = dun_level;
6200 /* Reset various flags */
6204 p_ptr->leaving = FALSE;
6206 /* Reset the "command" vars */
6209 #if 0 /* Don't reset here --- It's used for Arena */
6218 /* Cancel the target */
6222 ambush_flag = FALSE;
6224 /* Cancel the health bar */
6227 /* Check visual effects */
6228 shimmer_monsters = TRUE;
6229 shimmer_objects = TRUE;
6230 repair_monsters = TRUE;
6231 repair_objects = TRUE;
6237 /* Get index of current quest (if any) */
6238 quest_num = quest_number(dun_level);
6240 /* Inside a quest? */
6243 /* Mark the quest monster */
6244 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6247 /* Track maximum player level */
6248 if (p_ptr->max_plv < p_ptr->lev)
6250 p_ptr->max_plv = p_ptr->lev;
6254 /* Track maximum dungeon level (if not in quest -KMW-) */
6255 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6257 max_dlv[dungeon_type] = dun_level;
6258 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6261 /* Validate the panel */
6262 panel_bounds_center();
6264 /* Verify the panel */
6267 /* Flush messages */
6271 /* Enter "xtra" mode */
6272 character_xtra = TRUE;
6275 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6277 /* Redraw dungeon */
6278 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6281 p_ptr->redraw |= (PR_MAP);
6284 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6286 /* Update lite/view */
6287 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6289 /* Update monsters */
6290 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6292 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6295 /* Leave "xtra" mode */
6296 character_xtra = FALSE;
6299 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6301 /* Combine / Reorder the pack */
6302 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6304 /* Handle "p_ptr->notice" */
6307 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6313 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6314 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6315 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6317 if (p_ptr->inside_battle)
6321 p_ptr->energy_need = 0;
6327 msg_print("»î¹ç³«»Ï¡ª");
6329 msg_format("Ready..Fight!");
6335 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6336 p_ptr->magic_num1[0] = MUSIC_DETECT;
6338 /* Hack -- notice death or departure */
6339 if (!p_ptr->playing || p_ptr->is_dead) return;
6341 /* Print quest message if appropriate */
6342 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6344 quest_discovery(random_quest_number(dun_level));
6345 p_ptr->inside_quest = random_quest_number(dun_level);
6347 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6349 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6351 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6352 d_name+d_info[dungeon_type].name,
6353 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6355 msg_format("%^s lives in this level as the keeper of %s.",
6356 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6357 d_name+d_info[dungeon_type].name);
6361 /*** Process this dungeon level ***/
6363 /* Reset the monster generation level */
6364 monster_level = base_level;
6366 /* Reset the object generation level */
6367 object_level = base_level;
6371 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6372 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6373 p_ptr->energy_need = 0;
6375 /* Not leaving dungeon */
6376 p_ptr->leaving_dungeon = FALSE;
6381 /* Hack -- Compact the monster list occasionally */
6382 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6384 /* Hack -- Compress the monster list occasionally */
6385 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6388 /* Hack -- Compact the object list occasionally */
6389 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6391 /* Hack -- Compress the object list occasionally */
6392 if (o_cnt + 32 < o_max) compact_objects(0);
6395 /* Process the player */
6398 /* Handle "p_ptr->notice" */
6401 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6404 /* Hack -- Hilite the player */
6405 move_cursor_relative(py, px);
6407 /* Optional fresh */
6408 if (fresh_after) Term_fresh();
6410 /* Hack -- Notice death or departure */
6411 if (!p_ptr->playing || p_ptr->is_dead) break;
6413 /* Process all of the monsters */
6416 /* Handle "p_ptr->notice" */
6419 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6422 /* Hack -- Hilite the player */
6423 move_cursor_relative(py, px);
6425 /* Optional fresh */
6426 if (fresh_after) Term_fresh();
6428 /* Hack -- Notice death or departure */
6429 if (!p_ptr->playing || p_ptr->is_dead) break;
6432 /* Process the world */
6435 /* Handle "p_ptr->notice" */
6438 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6441 /* Hack -- Hilite the player */
6442 move_cursor_relative(py, px);
6444 /* Optional fresh */
6445 if (fresh_after) Term_fresh();
6447 /* Hack -- Notice death or departure */
6448 if (!p_ptr->playing || p_ptr->is_dead) break;
6450 /* Handle "leaving" */
6451 if (p_ptr->leaving) break;
6453 /* Count game turns */
6455 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6456 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6457 if (wild_regen) wild_regen--;
6460 /* Inside a quest and non-unique questor? */
6461 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6463 /* Un-mark the quest monster */
6464 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6467 /* Not save-and-quit and not dead? */
6468 if (p_ptr->playing && !p_ptr->is_dead)
6471 * Maintain Unique monsters and artifact, save current
6472 * floor, then prepare next floor
6476 /* Forget the flag */
6477 reinit_wilderness = FALSE;
6480 /* Write about current level on the play record once per level */
6486 * Load some "user pref files"
6488 * Modified by Arcum Dagsson to support
6489 * separate macro files for different realms.
6491 static void load_all_pref_files(void)
6496 /* Access the "user" pref file */
6497 sprintf(buf, "user.prf");
6499 /* Process that file */
6500 process_pref_file(buf);
6502 /* Access the "user" system pref file */
6503 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6505 /* Process that file */
6506 process_pref_file(buf);
6508 /* Access the "race" pref file */
6509 sprintf(buf, "%s.prf", rp_ptr->title);
6511 /* Process that file */
6512 process_pref_file(buf);
6514 /* Access the "class" pref file */
6515 sprintf(buf, "%s.prf", cp_ptr->title);
6517 /* Process that file */
6518 process_pref_file(buf);
6520 /* Access the "character" pref file */
6521 sprintf(buf, "%s.prf", player_base);
6523 /* Process that file */
6524 process_pref_file(buf);
6526 /* Free old entries */
6530 sprintf(buf, "picktype-%s.prf", player_base);
6532 sprintf(buf, "pickpref-%s.prf", player_base);
6535 err = process_pickpref_file(buf);
6537 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6541 process_pickpref_file("picktype.prf");
6543 process_pickpref_file("pickpref.prf");
6547 /* Access the "realm 1" pref file */
6548 if (p_ptr->realm1 != REALM_NONE)
6550 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6552 /* Process that file */
6553 process_pref_file(buf);
6556 /* Access the "realm 2" pref file */
6557 if (p_ptr->realm2 != REALM_NONE)
6559 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6561 /* Process that file */
6562 process_pref_file(buf);
6568 * Extract option variables from bit sets
6570 void extract_option_vars(void)
6574 for (i = 0; option_info[i].o_desc; i++)
6576 int os = option_info[i].o_set;
6577 int ob = option_info[i].o_bit;
6579 /* Set the "default" options */
6580 if (option_info[i].o_var)
6583 if (option_flag[os] & (1L << ob))
6586 (*option_info[i].o_var) = TRUE;
6593 (*option_info[i].o_var) = FALSE;
6601 * Determine bounty uniques
6603 void determine_bounty_uniques(void)
6606 monster_race *r_ptr;
6608 get_mon_num_prep(NULL, NULL);
6609 for (i = 0; i < MAX_KUBI; i++)
6613 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6614 r_ptr = &r_info[kubi_r_idx[i]];
6616 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6618 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6620 if (r_ptr->rarity > 100) continue;
6622 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6624 for (j = 0; j < i; j++)
6625 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6632 for (i = 0; i < MAX_KUBI - 1; i++)
6634 for (j = i; j < MAX_KUBI; j++)
6636 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6638 tmp = kubi_r_idx[i];
6639 kubi_r_idx[i] = kubi_r_idx[j];
6640 kubi_r_idx[j] = tmp;
6648 * Determine today's bounty monster
6649 * Note: conv_old is used if loaded 0.0.3 or older save file
6651 void determine_today_mon(bool conv_old)
6654 bool old_inside_battle = p_ptr->inside_battle;
6655 monster_race *r_ptr;
6659 for (i = 0; i < max_d_idx; i++)
6661 if (max_dlv[i] < d_info[i].mindepth) continue;
6662 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6665 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6667 p_ptr->inside_battle = TRUE;
6668 get_mon_num_prep(NULL, NULL);
6672 today_mon = get_mon_num(max_dl);
6673 r_ptr = &r_info[today_mon];
6675 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6676 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6677 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6678 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6679 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6680 if (r_ptr->rarity > 10) continue;
6684 p_ptr->today_mon = 0;
6685 p_ptr->inside_battle = old_inside_battle;
6690 * Actually play a game
6692 * If the "new_game" parameter is true, then, after loading the
6693 * savefile, we will commit suicide, if necessary, to allow the
6694 * player to start a new game.
6696 void play_game(bool new_game)
6699 bool load_game = TRUE;
6709 hack_mutation = FALSE;
6711 /* Hack -- Character is "icky" */
6712 character_icky = TRUE;
6714 /* Make sure main term is active */
6715 Term_activate(angband_term[0]);
6717 /* Initialise the resize hooks */
6718 angband_term[0]->resize_hook = resize_map;
6720 for (i = 1; i < 8; i++)
6722 /* Does the term exist? */
6723 if (angband_term[i])
6725 /* Add the redraw on resize hook */
6726 angband_term[i]->resize_hook = redraw_window;
6730 /* Hack -- turn off the cursor */
6731 (void)Term_set_cursor(0);
6734 /* Attempt to load */
6739 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6741 quit("broken savefile");
6746 /* Extract the options */
6747 extract_option_vars();
6749 /* Report waited score */
6750 if (p_ptr->wait_report_score)
6756 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6758 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6763 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6768 p_ptr->is_dead = TRUE;
6770 start_time = time(NULL);
6772 /* No suspending now */
6773 signals_ignore_tstp();
6775 /* Hack -- Character is now "icky" */
6776 character_icky = TRUE;
6778 /* Build the filename */
6779 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6781 /* Open the high score file, for reading/writing */
6782 highscore_fd = fd_open(buf, O_RDWR);
6784 /* Handle score, show Top scores */
6785 success = send_world_score(TRUE);
6788 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6790 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6794 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6796 prt("standing by for future registration...", 0, 0);
6802 p_ptr->wait_report_score = FALSE;
6805 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6807 if (!save_player()) msg_print("death save failed!");
6810 /* Shut the high score file */
6811 (void)fd_close(highscore_fd);
6813 /* Forget the high score fd */
6816 /* Allow suspending now */
6817 signals_handle_tstp();
6822 /* Nothing loaded */
6823 if (!character_loaded)
6825 /* Make new player */
6828 /* The dungeon is not ready */
6829 character_dungeon = FALSE;
6831 /* Prepare to init the RNG */
6834 /* Initialize the saved floors data */
6835 init_saved_floors(FALSE);
6838 /* Old game is loaded. But new game is requested. */
6841 /* Initialize the saved floors data */
6842 init_saved_floors(TRUE);
6845 /* Process old character */
6848 /* Process the player name */
6849 process_player_name(FALSE);
6858 seed = (time(NULL));
6862 /* Mutate the seed on Unix machines */
6863 seed = ((seed >> 3) * (getpid() << 1));
6867 /* Use the complex RNG */
6870 /* Seed the "complex" RNG */
6871 Rand_state_init(seed);
6874 /* Roll new character */
6877 /* The dungeon is not ready */
6878 character_dungeon = FALSE;
6882 p_ptr->inside_quest = 0;
6883 p_ptr->inside_arena = FALSE;
6884 p_ptr->inside_battle = FALSE;
6888 /* Hack -- seed for flavors */
6889 seed_flavor = randint0(0x10000000);
6891 /* Hack -- seed for town layout */
6892 seed_town = randint0(0x10000000);
6894 /* Roll up a new character */
6902 determine_bounty_uniques();
6903 determine_today_mon(FALSE);
6907 write_level = FALSE;
6910 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6912 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6916 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6917 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6919 if (p_ptr->riding == -1)
6922 for (i = m_max; i > 0; i--)
6924 if (player_bold(m_list[i].fy, m_list[i].fx))
6933 p_ptr->teleport_town = FALSE;
6934 p_ptr->sutemi = FALSE;
6935 world_monster = FALSE;
6936 now_damaged = FALSE;
6938 start_time = time(NULL) - 1;
6939 record_o_name[0] = '\0';
6941 /* Reset map panel */
6942 panel_row_min = cur_hgt;
6943 panel_col_min = cur_wid;
6945 /* Sexy gal gets bonus to maximum weapon skill of whip */
6946 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6947 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6949 /* Fill the arrays of floors and walls in the good proportions */
6950 set_floor_and_wall(dungeon_type);
6952 /* Flavor the objects */
6960 /* Flash a message */
6962 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6964 prt("Please wait...", 0, 0);
6968 /* Flush the message */
6972 /* Hack -- Enter wizard mode */
6975 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6976 else if (p_ptr->is_dead) quit("Already dead.");
6979 /* Initialize the town-buildings if necessary */
6980 if (!dun_level && !p_ptr->inside_quest)
6982 /* Init the wilderness */
6984 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6987 init_flags = INIT_ONLY_BUILDINGS;
6989 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6994 /* Generate a dungeon level if needed */
6995 if (!character_dungeon)
6997 /* Clear all saved floors */
6998 prepare_change_floor_mode(CFM_CLEAR_ALL);
7004 /* Character is now "complete" */
7005 character_generated = TRUE;
7008 /* Hack -- Character is no longer "icky" */
7009 character_icky = FALSE;
7017 sprintf(buf, "%s¤Ë¹ß¤êΩ¤Ã¤¿¡£", map_name());
7019 sprintf(buf, "You are standing in the %s.", map_name());
7021 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
7026 p_ptr->playing = TRUE;
7028 /* Reset the visual mappings */
7031 /* Load the "pref" files */
7032 load_all_pref_files();
7034 /* React to changes */
7035 Term_xtra(TERM_XTRA_REACT, 0);
7038 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
7041 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
7047 /* Set or clear "rogue_like_commands" if requested */
7048 if (arg_force_original) rogue_like_commands = FALSE;
7049 if (arg_force_roguelike) rogue_like_commands = TRUE;
7051 /* Hack -- Enforce "delayed death" */
7052 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
7054 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
7056 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
7058 monster_type *m_ptr;
7059 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
7060 monster_race *r_ptr = &r_info[pet_r_idx];
7061 place_monster_aux(0, py, px - 1, pet_r_idx,
7062 (PM_FORCE_PET | PM_NO_KAGE));
7063 m_ptr = &m_list[hack_m_idx_ii];
7064 m_ptr->mspeed = r_ptr->speed;
7065 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
7066 m_ptr->max_maxhp = m_ptr->maxhp;
7067 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
7068 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7074 /* Process the level */
7077 /* Handle "p_ptr->notice" */
7080 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7083 /* Cancel the target */
7086 /* Cancel the health bar */
7090 /* Forget the lite */
7093 /* Forget the view */
7096 /* Forget the view */
7099 /* Handle "quit and save" */
7100 if (!p_ptr->playing && !p_ptr->is_dead) break;
7102 /* Erase the old cave */
7104 if (!p_ptr->is_dead) wipe_m_list();
7112 /* Accidental Death */
7113 if (p_ptr->playing && p_ptr->is_dead)
7115 if (p_ptr->inside_arena)
7117 p_ptr->inside_arena = FALSE;
7118 if (p_ptr->arena_number > MAX_ARENA_MONS)
7119 p_ptr->arena_number++;
7121 p_ptr->arena_number = -1 - p_ptr->arena_number;
7122 p_ptr->is_dead = FALSE;
7124 p_ptr->chp_frac = 0;
7125 p_ptr->exit_bldg = TRUE;
7130 /* Mega-Hack -- Allow player to cheat death */
7132 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7134 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7138 /* Mark social class, reset age, if needed */
7139 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7145 p_ptr->noscore |= 0x0001;
7149 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7151 msg_print("You invoke wizard mode and cheat death.");
7157 /* Restore hit points */
7158 p_ptr->chp = p_ptr->mhp;
7159 p_ptr->chp_frac = 0;
7161 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7163 for (i = 0; i < EATER_EXT*2; i++)
7165 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7167 for (; i < EATER_EXT*3; i++)
7169 p_ptr->magic_num1[i] = 0;
7172 /* Restore spell points */
7173 p_ptr->csp = p_ptr->msp;
7174 p_ptr->csp_frac = 0;
7176 /* Hack -- Healing */
7178 (void)set_confused(0);
7179 (void)set_poisoned(0);
7180 (void)set_afraid(0);
7181 (void)set_paralyzed(0);
7186 /* Hack -- Prevent starvation */
7187 (void)set_food(PY_FOOD_MAX - 1);
7189 /* Hack -- cancel recall */
7190 if (p_ptr->word_recall)
7194 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7196 msg_print("A tension leaves the air around you...");
7201 /* Hack -- Prevent recall */
7202 p_ptr->word_recall = 0;
7203 p_ptr->redraw |= (PR_STATUS);
7206 /* Hack -- cancel alter */
7207 if (p_ptr->alter_reality)
7209 /* Hack -- Prevent alter */
7210 p_ptr->alter_reality = 0;
7211 p_ptr->redraw |= (PR_STATUS);
7214 /* Note cause of death XXX XXX XXX */
7216 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7218 (void)strcpy(p_ptr->died_from, "Cheating death");
7223 p_ptr->is_dead = FALSE;
7226 p_ptr->inside_arena = FALSE;
7227 p_ptr->inside_battle = FALSE;
7229 p_ptr->inside_quest = 0;
7230 p_ptr->recall_dungeon = dungeon_type;
7232 if (lite_town || vanilla_town)
7234 p_ptr->wilderness_y = 1;
7235 p_ptr->wilderness_x = 1;
7249 p_ptr->wilderness_y = 48;
7250 p_ptr->wilderness_x = 5;
7256 p_ptr->wild_mode = FALSE;
7258 /* Clear all saved floors */
7259 prepare_change_floor_mode(CFM_CLEAR_ALL);
7261 p_ptr->leaving = TRUE;
7264 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7266 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7272 /* Handle "death" */
7273 if (p_ptr->is_dead) break;
7275 /* Make a new level */
7286 s32b turn_real(s32b hoge)
7288 switch (p_ptr->start_race)
7294 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);