4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Angband game engine */
15 #define TY_CURSE_CHANCE 200
16 #define CHAINSWORD_NOISE 100
18 static bool load = TRUE;
19 static int wild_regen = 20;
22 * Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
24 static byte value_check_aux1(object_type *o_ptr)
27 if (artifact_p(o_ptr) || o_ptr->art_name)
30 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_TERRIBLE;
37 if (ego_item_p(o_ptr))
40 if (cursed_p(o_ptr) || broken_p(o_ptr)) return FEEL_WORTHLESS;
43 return FEEL_EXCELLENT;
47 if (cursed_p(o_ptr)) return FEEL_CURSED;
50 if (broken_p(o_ptr)) return FEEL_BROKEN;
52 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
54 /* Good "armor" bonus */
55 if (o_ptr->to_a > 0) return FEEL_GOOD;
57 /* Good "weapon" bonus */
58 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
60 /* Default to "average" */
66 * Return a "feeling" (or NULL) about an item. Method 2 (Light).
68 static byte value_check_aux2(object_type *o_ptr)
70 /* Cursed items (all of them) */
71 if (cursed_p(o_ptr)) return FEEL_CURSED;
73 /* Broken items (all of them) */
74 if (broken_p(o_ptr)) return FEEL_BROKEN;
76 /* Artifacts -- except cursed/broken ones */
77 if (artifact_p(o_ptr) || o_ptr->art_name) return FEEL_UNCURSED;
79 /* Ego-Items -- except cursed/broken ones */
80 if (ego_item_p(o_ptr)) return FEEL_UNCURSED;
82 /* Good armor bonus */
83 if (o_ptr->to_a > 0) return FEEL_UNCURSED;
85 /* Good weapon bonuses */
86 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
94 static void sense_inventory_aux(int slot, bool heavy)
97 object_type *o_ptr = &inventory[slot];
98 char o_name[MAX_NLEN];
101 /* We know about it already, do not tell us again */
102 if (o_ptr->ident & (IDENT_SENSE))return;
104 /* It is fully known, no information needed */
105 if (object_known_p(o_ptr)) return;
107 /* Check for a feeling */
108 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
110 /* Skip non-feelings */
114 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
125 feel = FEEL_EXCELLENT;
131 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
133 feel = FEEL_UNCURSED;
138 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
144 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
151 feel = FEEL_WORTHLESS;
156 feel = FEEL_TERRIBLE;
162 /* Stop everything */
163 if (disturb_minor) disturb(0, 0);
165 /* Get an object description */
166 object_desc(o_name, o_ptr, FALSE, 0);
168 /* Message (equipment) */
169 if (slot >= INVEN_RARM)
172 msg_format("%s%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
173 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
175 msg_format("You feel the %s (%c) you are %s %s %s...",
176 o_name, index_to_label(slot), describe_use(slot),
177 ((o_ptr->number == 1) ? "is" : "are"),
178 game_inscriptions[feel]);
183 /* Message (inventory) */
187 msg_format("¥¶¥Ã¥¯¤ÎÃæ¤Î%s(%c)¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
188 o_name, index_to_label(slot),game_inscriptions[feel]);
190 msg_format("You feel the %s (%c) in your pack %s %s...",
191 o_name, index_to_label(slot),
192 ((o_ptr->number == 1) ? "is" : "are"),
193 game_inscriptions[feel]);
198 /* We have "felt" it */
199 o_ptr->ident |= (IDENT_SENSE);
201 /* Set the "inscription" */
202 o_ptr->feeling = feel;
204 /* Auto-inscription/destroy */
205 idx = is_autopick(o_ptr);
206 auto_inscribe_item(slot, idx);
208 auto_destroy_item(slot, idx);
210 /* Combine / Reorder the pack (later) */
211 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
214 p_ptr->window |= (PW_INVEN | PW_EQUIP);
220 * Sense the inventory
222 * Class 0 = Warrior --> fast and heavy
223 * Class 1 = Mage --> slow and light
224 * Class 2 = Priest --> fast but light
225 * Class 3 = Rogue --> okay and heavy
226 * Class 4 = Ranger --> slow but heavy (changed!)
227 * Class 5 = Paladin --> slow but heavy
229 static void sense_inventory1(void)
232 int plev = p_ptr->lev;
237 /*** Check for "sensing" ***/
239 /* No sensing when confused */
240 if (p_ptr->confused) return;
242 /* Analyze the class */
243 switch (p_ptr->pclass)
251 if (0 != randint0(9000L / (plev * plev + 40))) return;
263 if (0 != randint0(6000L / (plev * plev + 50))) return;
273 case CLASS_HIGH_MAGE:
275 case CLASS_MAGIC_EATER:
277 /* Very bad (light) sensing */
278 if (0 != randint0(240000L / (plev + 5))) return;
287 /* Good (light) sensing */
288 if (0 != randint0(10000L / (plev * plev + 40))) return;
298 if (0 != randint0(20000L / (plev * plev + 40))) return;
310 if (0 != randint0(95000L / (plev * plev + 40))) return;
322 if (0 != randint0(77777L / (plev * plev + 40))) return;
331 case CLASS_WARRIOR_MAGE:
335 if (0 != randint0(75000L / (plev * plev + 40))) return;
341 case CLASS_MINDCRAFTER:
343 case CLASS_BLUE_MAGE:
344 case CLASS_MIRROR_MASTER:
347 if (0 != randint0(55000L / (plev * plev + 40))) return;
353 case CLASS_CHAOS_WARRIOR:
356 if (0 != randint0(80000L / (plev * plev + 40))) return;
366 case CLASS_FORCETRAINER:
369 if (0 != randint0(20000L / (plev * plev + 40))) return;
378 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
387 case CLASS_BEASTMASTER:
390 if (0 != randint0(65000L / (plev * plev + 40))) return;
395 case CLASS_BERSERKER:
405 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
407 /*** Sense everything ***/
409 /* Check everything */
410 for (i = 0; i < INVEN_TOTAL; i++)
414 o_ptr = &inventory[i];
416 /* Skip empty slots */
417 if (!o_ptr->k_idx) continue;
419 /* Valid "tval" codes */
446 /* Skip non-sense machines */
449 /* Occasional failure on inventory items */
450 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
453 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
458 sense_inventory_aux(i, heavy);
463 static void sense_inventory2(void)
466 int plev = p_ptr->lev;
470 /*** Check for "sensing" ***/
472 /* No sensing when confused */
473 if (p_ptr->confused) return;
475 /* Analyze the class */
476 switch (p_ptr->pclass)
482 case CLASS_BERSERKER:
489 case CLASS_CHAOS_WARRIOR:
491 case CLASS_BEASTMASTER:
494 /* Very bad (light) sensing */
495 if (0 != randint0(240000L / (plev + 5))) return;
502 case CLASS_WARRIOR_MAGE:
507 if (0 != randint0(95000L / (plev * plev + 40))) return;
516 case CLASS_FORCETRAINER:
517 case CLASS_MINDCRAFTER:
520 if (0 != randint0(20000L / (plev * plev + 40))) return;
527 case CLASS_HIGH_MAGE:
529 case CLASS_MAGIC_EATER:
530 case CLASS_MIRROR_MASTER:
531 case CLASS_BLUE_MAGE:
534 if (0 != randint0(9000L / (plev * plev + 40))) return;
543 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
550 /*** Sense everything ***/
552 /* Check everything */
553 for (i = 0; i < INVEN_TOTAL; i++)
557 o_ptr = &inventory[i];
559 /* Skip empty slots */
560 if (!o_ptr->k_idx) continue;
562 /* Valid "tval" codes */
575 /* Skip non-sense machines */
578 /* Occasional failure on inventory items */
579 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
581 sense_inventory_aux(i, TRUE);
588 * Go to any level (ripped off from wiz_jump)
590 static void pattern_teleport(void)
597 if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
599 if (get_check("Teleport level? "))
606 /* Only downward in ironman mode */
607 if (ironman_downward)
608 min_level = dun_level;
611 if (dungeon_type == DUNGEON_ANGBAND)
614 max_level = MAX_DEPTH - 1;
615 else if (dun_level == 100)
620 max_level = d_info[dungeon_type].maxdepth;
621 min_level = d_info[dungeon_type].mindepth;
626 sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
628 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
633 sprintf(tmp_val, "%d", dun_level);
635 /* Ask for a level */
636 if (!get_string(ppp, tmp_val, 10)) return;
638 /* Extract request */
639 command_arg = atoi(tmp_val);
642 else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
644 else if (get_check("Normal teleport? "))
648 teleport_player(200);
657 if (command_arg < min_level) command_arg = min_level;
660 if (command_arg > max_level) command_arg = max_level;
664 msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
666 msg_format("You teleport to dungeon level %d.", command_arg);
670 if (autosave_l) do_cmd_save_game(TRUE);
673 dun_level = command_arg;
674 prepare_change_floor_mode(CFM_CLEAR_ALL);
678 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
680 p_ptr->inside_quest = 0;
681 p_ptr->leftbldg = FALSE;
685 p_ptr->leaving = TRUE;
689 static void wreck_the_pattern(void)
691 int to_ruin = 0, r_y, r_x;
693 if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
700 msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
701 msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
703 msg_print("You bleed on the Pattern!");
704 msg_print("Something terrible happens!");
710 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
712 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
716 to_ruin = randint1(45) + 35;
720 scatter(&r_y, &r_x, py, px, 4, 0);
722 if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
723 (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
725 cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
729 cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
733 /* Returns TRUE if we are on the Pattern... */
734 static bool pattern_effect(void)
736 if ((cave[py][px].feat < FEAT_PATTERN_START) ||
737 (cave[py][px].feat > FEAT_PATTERN_XTRA2))
740 if ((prace_is_(RACE_AMBERITE)) &&
741 (p_ptr->cut > 0) && one_in_(10))
746 if (cave[py][px].feat == FEAT_PATTERN_END)
748 (void)set_poisoned(0);
754 (void)do_res_stat(A_STR);
755 (void)do_res_stat(A_INT);
756 (void)do_res_stat(A_WIS);
757 (void)do_res_stat(A_DEX);
758 (void)do_res_stat(A_CON);
759 (void)do_res_stat(A_CHR);
760 (void)restore_level();
761 (void)hp_player(1000);
762 cave_set_feat(py, px, FEAT_PATTERN_OLD);
764 msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
766 msg_print("This section of the Pattern looks less powerful.");
773 * We could make the healing effect of the
774 * Pattern center one-time only to avoid various kinds
775 * of abuse, like luring the win monster into fighting you
776 * in the middle of the pattern...
779 else if (cave[py][px].feat == FEAT_PATTERN_OLD)
783 else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
787 else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
791 take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
793 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
799 if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
801 else if (!IS_INVULN())
803 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
805 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
818 * Regenerate hit points -RAK-
820 static void regenhp(int percent)
822 s32b new_chp, new_chp_frac;
825 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
826 if (p_ptr->action == ACTION_HAYAGAKE) return;
827 /* Save the old hitpoints */
828 old_chp = p_ptr->chp;
830 /* Extract the new hitpoints */
831 new_chp = ((long)p_ptr->mhp) * percent + PY_REGEN_HPBASE;
832 p_ptr->chp += (s16b)(new_chp >> 16); /* div 65536 */
834 /* check for overflow */
835 if ((p_ptr->chp < 0) && (old_chp > 0)) p_ptr->chp = MAX_SHORT;
836 new_chp_frac = (new_chp & 0xFFFF) + p_ptr->chp_frac; /* mod 65536 */
837 if (new_chp_frac >= 0x10000L)
839 p_ptr->chp_frac = (u16b)(new_chp_frac - 0x10000L);
844 p_ptr->chp_frac = (u16b)new_chp_frac;
848 if (p_ptr->chp >= p_ptr->mhp)
850 p_ptr->chp = p_ptr->mhp;
855 if (old_chp != p_ptr->chp)
858 p_ptr->redraw |= (PR_HP);
861 p_ptr->window |= (PW_PLAYER);
869 * Regenerate mana points -RAK-
871 static void regenmana(int percent)
873 s32b new_mana, new_mana_frac;
875 bool old_csp_msp = (p_ptr->csp > p_ptr->msp);
877 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
878 if ((p_ptr->pclass == CLASS_SAMURAI) && (p_ptr->regenerate)) percent /= 2;
879 old_csp = p_ptr->csp;
880 new_mana = ((long)p_ptr->msp) * percent + PY_REGEN_MNBASE;
881 if (old_csp_msp && (new_mana > 0))
885 p_ptr->csp -= (s16b)(new_mana >> 16); /* div 65536 */
886 new_mana_frac = p_ptr->csp_frac + 0x10000L - (new_mana & 0xFFFF);
890 if (old_csp_msp) new_mana += ((((long)p_ptr->msp) * percent + PY_REGEN_MNBASE) * 32);
891 p_ptr->csp += (s16b)(new_mana >> 16); /* div 65536 */
893 new_mana_frac = (new_mana & 0xFFFF) + p_ptr->csp_frac; /* mod 65536 */
895 if (new_mana_frac >= 0x10000L)
897 p_ptr->csp_frac = (u16b)(new_mana_frac - 0x10000L);
902 p_ptr->csp_frac = (u16b)(new_mana_frac);
905 /* check for overflow */
912 /* Must set frac to zero even if equal */
913 if ((old_csp_msp && p_ptr->csp < p_ptr->msp) || (!old_csp_msp && p_ptr->csp >= p_ptr->msp))
915 p_ptr->csp = p_ptr->msp;
920 if (old_csp != p_ptr->csp)
923 p_ptr->redraw |= (PR_MANA);
926 p_ptr->window |= (PW_PLAYER);
927 p_ptr->window |= (PW_SPELL);
938 static void regenmagic(int percent)
943 for (i = 0; i < EATER_EXT*2; i++)
945 if (!p_ptr->magic_num2[i]) continue;
946 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
947 new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
948 p_ptr->magic_num1[i] += new_mana;
950 /* Must set frac to zero even if equal */
951 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
953 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
957 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
959 if (!p_ptr->magic_num1[i]) continue;
960 if (!p_ptr->magic_num2[i]) continue;
961 p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
962 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
973 * Regenerate the monsters (once per 100 game turns)
975 * XXX XXX XXX Should probably be done during monster turns.
977 static void regen_monsters(void)
982 /* Regenerate everyone */
983 for (i = 1; i < m_max; i++)
985 /* Check the i'th monster */
986 monster_type *m_ptr = &m_list[i];
987 monster_race *r_ptr = &r_info[m_ptr->r_idx];
990 /* Skip dead monsters */
991 if (!m_ptr->r_idx) continue;
993 /* Allow regeneration (if needed) */
994 if (m_ptr->hp < m_ptr->maxhp)
996 /* Hack -- Base regeneration */
997 frac = m_ptr->maxhp / 100;
999 /* Hack -- Minimal regeneration rate */
1000 if (!frac) if (one_in_(2)) frac = 1;
1002 /* Hack -- Some monsters regenerate quickly */
1003 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1005 /* Hack -- Regenerate */
1008 /* Do not over-regenerate */
1009 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1011 /* Redraw (later) if needed */
1012 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1013 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1020 * Regenerate the captured monsters (once per 30 game turns)
1022 * XXX XXX XXX Should probably be done during monster turns.
1024 static void regen_captured_monsters(void)
1029 /* Regenerate everyone */
1030 for (i = 0; i < INVEN_TOTAL; i++)
1032 monster_race *r_ptr;
1033 object_type *o_ptr = &inventory[i];
1035 if (!o_ptr->k_idx) continue;
1036 if (o_ptr->tval != TV_CAPTURE) continue;
1037 if (!o_ptr->pval) continue;
1041 r_ptr = &r_info[o_ptr->pval];
1043 /* Allow regeneration (if needed) */
1044 if (o_ptr->xtra4 < o_ptr->xtra5)
1046 /* Hack -- Base regeneration */
1047 frac = o_ptr->xtra5 / 100;
1049 /* Hack -- Minimal regeneration rate */
1050 if (!frac) if (one_in_(2)) frac = 1;
1052 /* Hack -- Some monsters regenerate quickly */
1053 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1055 /* Hack -- Regenerate */
1056 o_ptr->xtra4 += frac;
1058 /* Do not over-regenerate */
1059 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1066 p_ptr->notice |= (PN_COMBINE);
1069 p_ptr->window |= (PW_INVEN);
1070 p_ptr->window |= (PW_EQUIP);
1077 * Process the counters of monsters (once per 10 game turns)
1079 * This function is to process monsters' counters same as player's.
1081 static void process_monsters_counters(void)
1084 monster_type *m_ptr;
1085 monster_race *r_ptr;
1087 u32b noise; /* Hack -- local "player stealth" value */
1089 /* Handle "leaving" */
1090 if (p_ptr->leaving) return;
1092 /* Hack -- calculate the "player noise" */
1093 noise = (1L << (30 - p_ptr->skill_stl));
1095 /* Process the monsters (backwards) */
1096 for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
1098 /* Access the monster */
1099 m_ptr = &m_list[m_idx];
1100 r_ptr = &r_info[m_ptr->r_idx];
1102 /* Ignore "dead" monsters */
1103 if (!m_ptr->r_idx) continue;
1105 /* Handle Invulnerability */
1106 if (m_ptr->invulner)
1108 /* Reduce by one, note if expires */
1111 if (!m_ptr->invulner)
1117 /* Acquire the monster name */
1118 monster_desc(m_name, m_ptr, 0);
1120 /* Dump a message */
1122 msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
1124 msg_format("%^s is no longer invulnerable.", m_name);
1127 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1128 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1130 if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
1137 /* Reduce by one, note if expires */
1140 if (!m_ptr->fast && m_ptr->ml)
1144 /* Acquire the monster name */
1145 monster_desc(m_name, m_ptr, 0);
1147 /* Dump a message */
1149 msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1151 msg_format("%^s is no longer fast.", m_name);
1154 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1155 if (p_ptr->riding == m_idx)
1157 p_ptr->redraw |= (PR_UHEALTH);
1158 p_ptr->update |= (PU_BONUS);
1166 /* Reduce by one, note if expires */
1169 if (!m_ptr->slow && m_ptr->ml)
1173 /* Acquire the monster name */
1174 monster_desc(m_name, m_ptr, 0);
1176 /* Dump a message */
1178 msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1180 msg_format("%^s is no longer slow.", m_name);
1183 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1184 if (p_ptr->riding == m_idx)
1186 p_ptr->redraw |= (PR_UHEALTH);
1187 p_ptr->update |= (PU_BONUS);
1192 /* Handle "sleep" */
1195 /* Assume does not wake up */
1198 /* Hack -- Require proximity */
1199 if (m_ptr->cdis < 100)
1201 /* Handle "sensing radius" */
1202 if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
1204 /* We may wake up */
1208 /* Handle "sight" and "aggravation" */
1209 else if ((m_ptr->cdis <= MAX_SIGHT) &&
1210 (player_has_los_bold(m_ptr->fy, m_ptr->fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
1212 /* We may wake up */
1221 /* Hack -- handle non-aggravation */
1222 if (!(p_ptr->cursed & TRC_AGGRAVATE)) notice = randint0(1024);
1224 /* Nightmare monsters are more alert */
1225 if (ironman_nightmare) notice /= 2;
1227 /* Hack -- See if monster "notices" player */
1228 if ((notice * notice * notice) <= noise)
1230 /* Hack -- amount of "waking" */
1233 /* Hack -- handle aggravation */
1234 if (p_ptr->cursed & TRC_AGGRAVATE)
1240 /* Wake up faster near the player */
1241 if (m_ptr->cdis < 50) d = (100 / m_ptr->cdis);
1243 /* Hack -- amount of "waking" is affected by speed of player */
1244 d *= ((p_ptr->pspeed > 199) ? 49 :
1245 ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]));
1251 if (m_ptr->csleep > d)
1253 /* Monster wakes up "a little bit" */
1256 /* Notice the "not waking up" */
1259 /* Hack -- Count the ignores */
1260 if (r_ptr->r_ignore < MAX_UCHAR)
1270 /* Reset sleep counter */
1273 /* Notice the "waking up" */
1278 /* Acquire the monster name */
1279 monster_desc(m_name, m_ptr, 0);
1281 /* Dump a message */
1283 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1285 msg_format("%^s wakes up.", m_name);
1288 /* Redraw the health bar */
1289 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1290 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1292 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
1293 p_ptr->update |= (PU_MON_LITE);
1295 /* Hack -- Count the wakings */
1296 if (r_ptr->r_wake < MAX_UCHAR)
1311 /* Make a "saving throw" against stun */
1312 if (randint0(10000) <= r_ptr->level * r_ptr->level)
1318 /* Hack -- Recover from stun */
1319 if (m_ptr->stunned > d)
1321 /* Recover somewhat */
1322 m_ptr->stunned -= d;
1331 /* Message if visible */
1336 /* Acquire the monster name */
1337 monster_desc(m_name, m_ptr, 0);
1339 /* Dump a message */
1341 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1343 msg_format("%^s is no longer stunned.", m_name);
1346 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1347 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1352 /* Handle confusion */
1353 if (m_ptr->confused)
1355 /* Amount of "boldness" */
1356 int d = randint1(r_ptr->level / 20 + 1);
1358 /* Still confused */
1359 if (m_ptr->confused > d)
1361 /* Reduce the confusion */
1362 m_ptr->confused -= d;
1368 /* No longer confused */
1369 m_ptr->confused = 0;
1371 /* Message if visible */
1376 /* Acquire the monster name */
1377 monster_desc(m_name, m_ptr, 0);
1379 /* Dump a message */
1381 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
1383 msg_format("%^s is no longer confused.", m_name);
1386 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1387 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1395 /* Amount of "boldness" */
1396 int d = randint1(r_ptr->level / 20 + 1);
1399 if (m_ptr->monfear > d)
1401 /* Reduce the fear */
1402 m_ptr->monfear -= d;
1405 /* Recover from fear, take note if seen */
1408 /* No longer afraid */
1417 /* Acquire the monster name/poss */
1418 monster_desc(m_name, m_ptr, 0);
1419 monster_desc(m_poss, m_ptr, 0x22);
1421 /* Dump a message */
1423 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
1425 msg_format("%^s recovers %s courage.", m_name, m_poss);
1428 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1429 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1437 static void notice_lite_change(object_type *o_ptr)
1439 /* Hack -- notice interesting fuel steps */
1440 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1443 p_ptr->window |= (PW_EQUIP);
1446 /* Hack -- Special treatment when blind */
1449 /* Hack -- save some light for later */
1450 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1453 /* The light is now out */
1454 else if (o_ptr->xtra4 == 0)
1458 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1460 msg_print("Your light has gone out!");
1462 p_ptr->update |= (PU_BONUS);
1465 /* The light is getting dim */
1466 else if (o_ptr->name2 == EGO_LITE_LONG)
1468 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1469 && (turn % (TURNS_PER_TICK*2)))
1471 if (disturb_minor) disturb(0, 0);
1473 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1475 msg_print("Your light is growing faint.");
1481 /* The light is getting dim */
1482 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1484 if (disturb_minor) disturb(0, 0);
1486 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
1488 msg_print("Your light is growing faint.");
1495 void leave_quest_check(void)
1497 /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
1498 leaving_quest = p_ptr->inside_quest;
1500 /* Leaving an 'only once' quest marks it as failed */
1501 if (leaving_quest &&
1502 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
1503 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1505 quest[leaving_quest].status = QUEST_STATUS_FAILED;
1506 quest[leaving_quest].complev = (byte)p_ptr->lev;
1507 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
1509 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
1510 if (record_rand_quest)
1511 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1513 /* Floor of random quest will be blocked */
1514 prepare_change_floor_mode(CFM_NO_RETURN);
1516 else if (record_fix_quest)
1517 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1523 * Forcibly pseudo-identify an object in the inventory
1526 * note: currently this function allows pseudo-id of any object,
1527 * including silly ones like potions & scrolls, which always
1528 * get '{average}'. This should be changed, either to stop such
1529 * items from being pseudo-id'd, or to allow psychometry to
1530 * detect whether the unidentified potion/scroll/etc is
1531 * good (Cure Light Wounds, Restore Strength, etc) or
1532 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1534 bool psychometry(void)
1538 char o_name[MAX_NLEN];
1544 item_tester_no_ryoute = TRUE;
1547 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«¡©";
1548 s = "Ä´¤Ù¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1550 q = "Meditate on which item? ";
1551 s = "You have nothing appropriate.";
1554 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1556 /* Get the item (in the pack) */
1559 o_ptr = &inventory[item];
1562 /* Get the item (on the floor) */
1565 o_ptr = &o_list[0 - item];
1568 /* It is fully known, no information needed */
1569 if (object_known_p(o_ptr))
1572 msg_print("²¿¤â¿·¤·¤¤¤³¤È¤ÏȽ¤é¤Ê¤«¤Ã¤¿¡£");
1574 msg_print("You cannot find out anything more about that.");
1580 /* Check for a feeling */
1581 feel = value_check_aux1(o_ptr);
1583 /* Get an object description */
1584 object_desc(o_name, o_ptr, FALSE, 0);
1586 /* Skip non-feelings */
1590 msg_format("%s¤«¤é¤ÏÆäËÊѤï¤Ã¤¿»ö¤Ï´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿¡£", o_name);
1592 msg_format("You do not perceive anything unusual about the %s.", o_name);
1599 msg_format("%s¤Ï%s¤È¤¤¤¦´¶¤¸¤¬¤¹¤ë...",
1600 o_name, game_inscriptions[feel]);
1602 msg_format("You feel that the %s %s %s...",
1603 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1604 game_inscriptions[feel]);
1608 /* We have "felt" it */
1609 o_ptr->ident |= (IDENT_SENSE);
1612 o_ptr->feeling = feel;
1614 /* Combine / Reorder the pack (later) */
1615 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1618 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1620 /* Valid "tval" codes */
1621 switch (o_ptr->tval)
1649 /* Auto-inscription/destroy */
1650 idx = is_autopick(o_ptr);
1651 auto_inscribe_item(item, idx);
1652 if (okay && destroy_feeling)
1653 auto_destroy_item(item, idx);
1655 /* Something happened */
1660 static void gere_music(s32b music)
1668 stun_monsters(damroll(p_ptr->lev/10,2));
1671 hp_player(damroll(2,6));
1674 project_hack(GF_TURN_ALL, p_ptr->lev);
1677 project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
1680 project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
1683 confuse_monsters(p_ptr->lev * 2);
1686 project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
1689 charm_monsters(damroll(10 + p_ptr->lev/15,6));
1692 project(0, 0, py, px,
1693 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
1696 dispel_monsters(randint1(p_ptr->lev * 3));
1697 dispel_evil(randint1(p_ptr->lev * 3));
1704 earthquake(py, px, 10);
1707 stasis_monsters(p_ptr->lev * 4);
1710 dispel_monsters(randint1(p_ptr->lev * 3));
1713 hp_player(damroll(15,10));
1717 case MUSIC_DETECT+19:
1719 case MUSIC_DETECT+11:
1720 case MUSIC_DETECT+12:
1721 case MUSIC_DETECT+13:
1722 case MUSIC_DETECT+14:
1723 case MUSIC_DETECT+15:
1724 case MUSIC_DETECT+16:
1725 case MUSIC_DETECT+17:
1726 case MUSIC_DETECT+18:
1727 map_area(DETECT_RAD_MAP);
1728 if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
1729 case MUSIC_DETECT+6:
1730 case MUSIC_DETECT+7:
1731 case MUSIC_DETECT+8:
1732 case MUSIC_DETECT+9:
1733 case MUSIC_DETECT+10:
1734 /* There are too many hidden treasure. So... */
1735 /* detect_treasure(DETECT_RAD_DEFAULT); */
1736 detect_objects_gold(DETECT_RAD_DEFAULT);
1737 detect_objects_normal(DETECT_RAD_DEFAULT);
1738 if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
1739 case MUSIC_DETECT+3:
1740 case MUSIC_DETECT+4:
1741 case MUSIC_DETECT+5:
1742 detect_monsters_invis(DETECT_RAD_DEFAULT);
1743 detect_monsters_normal(DETECT_RAD_DEFAULT);
1744 if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
1746 case MUSIC_DETECT+1:
1747 case MUSIC_DETECT+2:
1748 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1749 detect_doors(DETECT_RAD_DEFAULT);
1750 detect_stairs(DETECT_RAD_DEFAULT);
1751 if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
1757 * If player has inscribed the object with "!!", let him know when it's
1760 static void recharged_notice(object_type *o_ptr)
1762 char o_name[MAX_NLEN];
1766 /* No inscription */
1767 if (!o_ptr->inscription) return;
1770 s = strchr(quark_str(o_ptr->inscription), '!');
1772 /* Process notification request. */
1775 /* Find another '!' */
1778 /* Describe (briefly) */
1779 object_desc(o_name, o_ptr, FALSE, 0);
1781 /* Notify the player */
1783 msg_format("%s¤ÏºÆ½¼Å¶¤µ¤ì¤¿¡£", o_name);
1785 if (o_ptr->number > 1)
1786 msg_format("Your %s are recharged.", o_name);
1788 msg_format("Your %s is recharged.", o_name);
1797 /* Keep looking for '!'s */
1798 s = strchr(s + 1, '!');
1803 static void check_music(void)
1809 /* Music singed by player */
1810 if (p_ptr->pclass != CLASS_BARD) return;
1811 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1813 spell = p_ptr->magic_num2[0];
1814 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1816 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1817 need_mana *= 0x8000;
1818 if (((u32b)p_ptr->csp < (need_mana / 0x10000)) || (p_ptr->anti_magic))
1825 p_ptr->csp -= (u16b) (need_mana / 0x10000);
1826 need_mana = (need_mana & 0xffff);
1827 if ((u32b)p_ptr->csp_frac < need_mana)
1830 p_ptr->csp_frac += (u16b)(0x10000L - need_mana);
1834 p_ptr->csp_frac -= (u16b)need_mana;
1837 p_ptr->redraw |= PR_MANA;
1838 if (p_ptr->magic_num1[1])
1840 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1841 p_ptr->magic_num1[1] = 0;
1843 msg_print("²Î¤òºÆ³«¤·¤¿¡£");
1845 msg_print("You restart singing.");
1847 p_ptr->action = ACTION_SING;
1849 /* Recalculate bonuses */
1850 p_ptr->update |= (PU_BONUS | PU_HP);
1852 /* Redraw map and status bar */
1853 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1855 /* Update monsters */
1856 p_ptr->update |= (PU_MONSTERS);
1859 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1862 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1863 p_ptr->spell_exp[spell] += 5;
1864 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1865 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1866 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1867 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1868 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1869 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1871 gere_music(p_ptr->magic_num1[0]);
1874 /* Choose one of items that have cursed flag */
1875 static object_type *choose_cursed_obj_name(u32b flag)
1878 int choices[INVEN_TOTAL-INVEN_RARM];
1881 /* Paranoia -- Player has no warning-item */
1882 if (!(p_ptr->cursed & flag)) return NULL;
1884 /* Search Inventry */
1885 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1887 object_type *o_ptr = &inventory[i];
1889 if (o_ptr->curse_flags & flag)
1891 choices[number] = i;
1896 /* Choice one of them */
1897 return (&inventory[choices[randint0(number)]]);
1902 * Handle certain things once every 10 game turns
1904 static void process_world(void)
1908 bool cave_no_regen = FALSE;
1909 int upkeep_factor = 0;
1914 const int dec_count = (easy_band ? 2 : 1);
1916 int day, hour, min, prev_min;
1918 s32b len = TURNS_PER_TICK * TOWN_DAWN;
1919 s32b tick = turn % len + len / 4;
1921 extract_day_hour_min(&day, &hour, &min);
1922 prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
1924 if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
1926 !(quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) &&
1927 !(p_ptr->inside_battle))
1930 if (p_ptr->inside_battle && !p_ptr->leaving)
1937 /* Count all hostile monsters */
1938 for (i2 = 0; i2 < cur_wid; ++i2)
1939 for (j2 = 0; j2 < cur_hgt; j2++)
1940 if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
1943 win_m_idx = cave[j2][i2].m_idx;
1946 if (number_mon == 0)
1949 msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
1951 msg_print("They have kill each other at the same time.");
1954 p_ptr->energy_need = 0;
1957 else if ((number_mon-1) == 0)
1960 monster_type *wm_ptr;
1962 wm_ptr = &m_list[win_m_idx];
1964 monster_desc(m_name, wm_ptr, 0);
1966 msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
1968 msg_format("%s is winner!", m_name);
1972 if (win_m_idx == (sel_monster+1))
1975 msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
1977 msg_print("Congratulations.");
1980 msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
1982 msg_format("You received %d gold.", battle_odds);
1984 p_ptr->au += battle_odds;
1989 msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
1991 msg_print("You lost gold.");
1995 p_ptr->energy_need = 0;
1998 else if(turn - old_turn == 150*TURNS_PER_TICK)
2001 msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
2003 msg_format("This battle have ended in a draw.");
2005 p_ptr->au += kakekin;
2007 p_ptr->energy_need = 0;
2012 /* Every 10 game turns */
2013 if (turn % TURNS_PER_TICK) return;
2015 /*** Check the Time and Load ***/
2017 if (!(turn % (50*TURNS_PER_TICK)))
2019 /* Check time and load */
2020 if ((0 != check_time()) || (0 != check_load()))
2023 if (closing_flag <= 2)
2028 /* Count warnings */
2033 msg_print("¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¸¤«¤«¤Ã¤Æ¤¤¤Þ¤¹...");
2034 msg_print("¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤«¥»¡¼¥Ö¤¹¤ë¤«¤·¤Æ²¼¤µ¤¤¡£");
2036 msg_print("The gates to ANGBAND are closing...");
2037 msg_print("Please finish up and/or save your game.");
2047 msg_print("º£¡¢¥¢¥ó¥°¥Ð¥ó¥É¤Ø¤ÎÌ礬ÊĤ¶¤µ¤ì¤Þ¤·¤¿¡£");
2049 msg_print("The gates to ANGBAND are now closed.");
2054 p_ptr->playing = FALSE;
2057 p_ptr->leaving = TRUE;
2062 /*** Attempt timed autosave ***/
2063 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
2065 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2066 do_cmd_save_game(TRUE);
2072 msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
2074 msg_print("You hear noise.");
2078 /*** Handle the wilderness/town (sunshine) ***/
2080 /* While in town/wilderness */
2081 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
2083 /* Hack -- Daybreak/Nighfall in town */
2084 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2088 /* Check for dawn */
2089 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
2096 msg_print("Ì뤬ÌÀ¤±¤¿¡£");
2098 msg_print("The sun has risen.");
2102 /* Hack -- Scan the town */
2103 for (y = 0; y < cur_hgt; y++)
2105 for (x = 0; x < cur_wid; x++)
2107 /* Get the cave grid */
2108 c_ptr = &cave[y][x];
2111 c_ptr->info |= (CAVE_GLOW);
2113 /* Hack -- Memorize lit grids if allowed */
2114 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
2116 /* Hack -- Notice spot */
2127 msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
2129 msg_print("The sun has fallen.");
2133 /* Hack -- Scan the town */
2134 for (y = 0; y < cur_hgt; y++)
2136 for (x = 0; x < cur_wid; x++)
2138 /* Get the cave grid */
2139 c_ptr = &cave[y][x];
2141 /* Darken "boring" features */
2142 if ((c_ptr->feat <= FEAT_INVIS) ||
2143 ((c_ptr->feat >= FEAT_DEEP_WATER) &&
2144 (c_ptr->feat <= FEAT_MOUNTAIN) &&
2145 (c_ptr->feat != FEAT_MUSEUM)) ||
2146 (x == 0) || (x == cur_wid-1) ||
2147 (y == 0) || (y == cur_hgt-1))
2149 /* Forget the grid */
2150 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
2152 /* Hack -- Notice spot */
2157 /* Glow deep lava */
2162 /* Update the monsters */
2163 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
2166 p_ptr->redraw |= (PR_MAP);
2169 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2173 /* Set back the rewards once a day */
2174 /* Only used for reward in thief's guild for now */
2175 if (!(turn % (TURNS_PER_TICK * TOWN_DAWN)))
2179 /* Reset the rewards */
2180 for (n = 0; n < MAX_BACT; n++)
2182 p_ptr->rewards[n] = FALSE;
2187 if (cheat_xtra) msg_print("Êó½·¤ò¥ê¥»¥Ã¥È");
2189 if (cheat_xtra) msg_print("Rewards reset.");
2195 /*** Process the monsters ***/
2197 /* Check for creature generation. */
2198 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
2199 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
2201 /* Make a new monster */
2202 (void)alloc_monster(MAX_SIGHT + 5, 0);
2205 /* Hack -- Check for creature regeneration */
2206 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
2207 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
2209 /* Hack -- Process the counters of all monsters */
2210 process_monsters_counters();
2213 /*** Damage over Time ***/
2215 /* Take damage from poison */
2216 if (p_ptr->poisoned && !IS_INVULN())
2220 take_hit(DAMAGE_NOESCAPE, 1, "ÆÇ", -1);
2222 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
2228 /* (Vampires) Take damage from sunlight */
2229 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
2231 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
2233 if (cave[py][px].info & CAVE_GLOW)
2237 msg_print("Æü¸÷¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª");
2238 take_hit(DAMAGE_NOESCAPE, 1, "Æü¸÷", -1);
2240 msg_print("The sun's rays scorch your undead flesh!");
2241 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
2244 cave_no_regen = TRUE;
2248 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
2249 !p_ptr->resist_lite)
2251 object_type * o_ptr = &inventory[INVEN_LITE];
2252 char o_name [MAX_NLEN];
2253 char ouch [MAX_NLEN+40];
2255 /* Get an object description */
2256 object_desc(o_name, o_ptr, FALSE, 0);
2259 msg_format("%s¤¬¤¢¤Ê¤¿¤Î¥¢¥ó¥Ç¥Ã¥É¤ÎÆùÂΤò¾Æ¤¾Ç¤¬¤·¤¿¡ª", o_name);
2261 msg_format("The %s scorches your undead flesh!", o_name);
2265 cave_no_regen = TRUE;
2267 /* Get an object description */
2268 object_desc(o_name, o_ptr, TRUE, 0);
2271 sprintf(ouch, "%s¤òÁõÈ÷¤·¤¿¥À¥á¡¼¥¸", o_name);
2273 sprintf(ouch, "wielding %s", o_name);
2276 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
2280 if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
2281 !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
2283 int damage = 3000 + randint0(2000);
2285 if (prace_is_(RACE_ENT)) damage += damage/3;
2286 if (p_ptr->resist_fire) damage = damage / 3;
2287 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2288 damage = damage / 100 + (randint0(100) < (damage % 100));
2294 msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
2295 take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
2297 msg_print("The lava burns you!");
2298 take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
2301 cave_no_regen = TRUE;
2305 else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
2306 !IS_INVULN() && !p_ptr->immune_fire)
2308 int damage = 6000 + randint0(4000);
2313 if (p_ptr->resist_fire) damage = damage / 3;
2314 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2318 damage = damage / 5;
2321 message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
2322 hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
2324 message = "The heat burns you!";
2325 hit_from = "flying over deep lava";
2332 message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
2333 hit_from = "¿¼¤¤ÍÏ´äή";
2335 message = "The lava burns you!";
2336 hit_from = "deep lava";
2341 damage = damage / 100 + (randint0(100) < (damage % 100));
2346 take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
2348 cave_no_regen = TRUE;
2352 else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
2354 if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
2358 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
2359 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
2361 msg_print("You are drowning!");
2362 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
2365 cave_no_regen = TRUE;
2372 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
2374 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2375 if (prace_is_(RACE_ENT)) damage += damage / 3;
2376 if (p_ptr->resist_fire) damage = damage / 3;
2377 if (IS_OPPOSE_FIRE()) damage = damage / 3;
2379 msg_print("Ç®¤¤¡ª");
2380 take_hit(DAMAGE_NOESCAPE, damage, "±ê¤Î¥ª¡¼¥é", -1);
2382 msg_print("It's hot!");
2383 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
2386 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
2388 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2389 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
2390 if (p_ptr->resist_elec) damage = damage / 3;
2391 if (IS_OPPOSE_ELEC()) damage = damage / 3;
2393 msg_print("Äˤ¤¡ª");
2394 take_hit(DAMAGE_NOESCAPE, damage, "Åŵ¤¤Î¥ª¡¼¥é", -1);
2396 msg_print("It hurts!");
2397 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
2400 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
2402 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
2403 if (p_ptr->resist_cold) damage = damage / 3;
2404 if (IS_OPPOSE_COLD()) damage = damage / 3;
2406 msg_print("Î䤿¤¤¡ª");
2407 take_hit(DAMAGE_NOESCAPE, damage, "Î䵤¤Î¥ª¡¼¥é", -1);
2409 msg_print("It's cold!");
2410 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
2415 /* Spectres -- take damage when moving through walls */
2417 * Added: ANYBODY takes damage if inside through walls
2418 * without wraith form -- NOTE: Spectres will never be
2419 * reduced below 0 hp by being inside a stone wall; others
2422 if (!cave_floor_bold(py, px))
2424 /* Player can walk through trees */
2425 if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
2429 else if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
2430 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
2434 cave_no_regen = TRUE;
2436 if (p_ptr->pass_wall)
2439 msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
2442 msg_print("Your molecules feel disrupted!");
2443 dam_desc = "density";
2450 msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
2451 dam_desc = "¹Å¤¤´ä";
2453 msg_print("You are being crushed!");
2454 dam_desc = "solid rock";
2459 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
2465 monster_race *r_ptr;
2467 if (min != prev_min)
2470 bool old_inside_battle = p_ptr->inside_battle;
2472 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2474 p_ptr->inside_battle = TRUE;
2475 get_mon_num_prep(NULL,NULL);
2477 for (i = 0; i < max_d_idx; i++)
2479 if (max_dlv[i] < d_info[i].mindepth) continue;
2480 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
2484 today_mon = get_mon_num(max_dl);
2485 r_ptr = &r_info[today_mon];
2487 if (r_ptr->flags1 & RF1_UNIQUE) continue;
2488 if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
2489 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
2490 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
2491 if (r_ptr->level < MIN(max_dl/2, 40)) continue;
2492 if (r_ptr->rarity > 10) continue;
2493 if (r_ptr->level == 0) continue;
2496 p_ptr->today_mon = 0;
2497 p_ptr->inside_battle = old_inside_battle;
2501 /* Nightmare mode activates the TY_CURSE at midnight */
2502 if (ironman_nightmare)
2504 /* Require exact minute */
2505 if (min != prev_min)
2507 /* Every 15 minutes after 11:00 pm */
2508 if ((hour == 23) && !(min % 15))
2518 msg_print("±ó¤¯¤ÇÉÔµ¤Ì£¤Ê¾â¤Î²»¤¬ÌĤä¿¡£");
2520 msg_print("You hear a distant bell toll ominously.");
2528 msg_print("±ó¤¯¤Ç¾â¤¬Æó²óÌĤä¿¡£");
2530 msg_print("A distant bell sounds twice.");
2538 msg_print("±ó¤¯¤Ç¾â¤¬»°²óÌĤä¿¡£");
2540 msg_print("A distant bell sounds three times.");
2548 msg_print("±ó¤¯¤Ç¾â¤¬»Í²óÌĤä¿¡£");
2550 msg_print("A distant bell tolls four times.");
2558 /* TY_CURSE activates at mignight! */
2565 msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
2567 msg_print("A distant bell tolls many times, fading into an deathly silence.");
2570 activate_ty_curse(FALSE, &count);
2575 /* Take damage from cuts */
2576 if (p_ptr->cut && !IS_INVULN())
2578 /* Mortal wound or Deep Gash */
2579 if (p_ptr->cut > 1000)
2584 else if (p_ptr->cut > 200)
2590 else if (p_ptr->cut > 100)
2595 else if (p_ptr->cut > 50)
2600 else if (p_ptr->cut > 25)
2605 else if (p_ptr->cut > 10)
2618 take_hit(DAMAGE_NOESCAPE, i, "Ã×Ì¿½ý", -1);
2620 take_hit(DAMAGE_NOESCAPE, i, "a fatal wound", -1);
2626 /*** Check the Food, and Regenerate ***/
2628 if (!p_ptr->inside_battle)
2630 /* Digest normally */
2631 if (p_ptr->food < PY_FOOD_MAX)
2633 /* Every 50 game turns */
2634 if (!(turn % (TURNS_PER_TICK*5)))
2636 /* Basic digestion rate based on speed */
2637 i = /* extract_energy[p_ptr->pspeed] * 2;*/
2638 ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
2639 1 : extract_energy[p_ptr->pspeed]));
2641 /* Regeneration takes more food */
2642 if (p_ptr->regenerate) i += 20;
2643 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) i+= 20;
2644 if (p_ptr->cursed & TRC_FAST_DIGEST) i += 30;
2646 /* Slow digestion takes less food */
2647 if (p_ptr->slow_digest) i -= 5;
2649 /* Minimal digestion */
2651 /* Maximal digestion */
2652 if (i > 100) i = 100;
2654 /* Digest some food */
2655 (void)set_food(p_ptr->food - i);
2659 /* Digest quickly when gorged */
2662 /* Digest a lot of food */
2663 (void)set_food(p_ptr->food - 100);
2667 /* Starve to death (slowly) */
2668 if (p_ptr->food < PY_FOOD_STARVE)
2670 /* Calculate damage */
2671 i = (PY_FOOD_STARVE - p_ptr->food) / 10;
2675 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "¶õÊ¢", -1);
2677 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, i, "starvation", -1);
2682 /* Default regeneration */
2683 regen_amount = PY_REGEN_NORMAL;
2686 if (p_ptr->food < PY_FOOD_WEAK)
2688 /* Lower regeneration */
2689 if (p_ptr->food < PY_FOOD_STARVE)
2693 else if (p_ptr->food < PY_FOOD_FAINT)
2695 regen_amount = PY_REGEN_FAINT;
2699 regen_amount = PY_REGEN_WEAK;
2703 if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
2705 /* Faint occasionally */
2706 if (!p_ptr->paralyzed && (randint0(100) < 10))
2710 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤À䤷¤Æ¤·¤Þ¤Ã¤¿¡£");
2712 msg_print("You faint from the lack of food.");
2717 /* Hack -- faint (bypass free action) */
2718 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
2724 /* Are we walking the pattern? */
2725 if (pattern_effect())
2727 cave_no_regen = TRUE;
2731 /* Regeneration ability */
2732 if (p_ptr->regenerate)
2734 regen_amount = regen_amount * 2;
2736 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
2740 if (p_ptr->cursed & TRC_SLOW_REGEN)
2747 /* Searching or Resting */
2748 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
2750 regen_amount = regen_amount * 2;
2753 upkeep_factor = calculate_upkeep();
2755 /* Regenerate the mana */
2756 /* if (p_ptr->csp < p_ptr->msp) */
2760 s32b upkeep_regen = ((100 - upkeep_factor) * regen_amount);
2761 if ((p_ptr->action == ACTION_LEARN) || (p_ptr->action == ACTION_HAYAGAKE)) upkeep_regen -= regen_amount;
2762 regenmana(upkeep_regen/100);
2764 #ifdef TRACK_FRIENDS
2768 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
2770 msg_format("Regen: %d/%d", upkeep_regen, regen_amount);
2774 #endif /* TRACK_FRIENDS */
2777 else if (p_ptr->action != ACTION_LEARN)
2779 regenmana(regen_amount);
2782 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2784 regenmagic(regen_amount);
2787 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
2789 while (upkeep_factor > 100)
2792 msg_print("¤³¤ó¤Ê¤Ë¿¤¯¤Î¥Ú¥Ã¥È¤òÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
2794 msg_print("Such much pets cannot be controled at once!");
2797 do_cmd_pet_dismiss();
2799 upkeep_factor = calculate_upkeep();
2802 msg_format("°Ý»ý£Í£Ð¤Ï %d%%", upkeep_factor);
2804 msg_format("Upkeep: %d%% mana.", upkeep_factor);
2810 /* Poisoned or cut yields no healing */
2811 if (p_ptr->poisoned) regen_amount = 0;
2812 if (p_ptr->cut) regen_amount = 0;
2814 /* Special floor -- Pattern, in a wall -- yields no healing */
2815 if (cave_no_regen) regen_amount = 0;
2817 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
2819 /* Regenerate Hit Points if needed */
2820 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
2822 if ((cave[py][px].feat < FEAT_PATTERN_END) &&
2823 (cave[py][px].feat >= FEAT_PATTERN_START))
2825 regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
2829 regenhp(regen_amount);
2834 /*** Timeout Various Things ***/
2837 if (p_ptr->tim_mimic)
2839 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2842 /* Hack -- Hallucinating */
2845 (void)set_image(p_ptr->image - dec_count);
2851 (void)set_blind(p_ptr->blind - dec_count);
2854 /* Times see-invisible */
2855 if (p_ptr->tim_invis)
2857 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2868 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2871 /* Timed temporary elemental brands. -LM- */
2872 if (p_ptr->ele_attack)
2874 p_ptr->ele_attack--;
2876 /* Clear all temporary elemental brands. */
2877 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2880 /* Timed temporary elemental immune. -LM- */
2881 if (p_ptr->ele_immune)
2883 p_ptr->ele_immune--;
2885 /* Clear all temporary elemental brands. */
2886 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2889 /* Timed infra-vision */
2890 if (p_ptr->tim_infra)
2892 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2896 if (p_ptr->tim_stealth)
2898 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2901 /* Timed levitation */
2902 if (p_ptr->tim_ffall)
2904 (void)set_tim_ffall(p_ptr->tim_ffall - 1, TRUE);
2907 /* Timed sh_touki */
2908 if (p_ptr->tim_sh_touki)
2910 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2914 if (p_ptr->tim_sh_fire)
2916 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2920 if (p_ptr->tim_sh_holy)
2922 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2926 if (p_ptr->tim_eyeeye)
2928 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2931 /* Timed resist-magic */
2932 if (p_ptr->resist_magic)
2934 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2937 /* Timed regeneration */
2938 if (p_ptr->tim_regen)
2940 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2943 /* Timed resist nether */
2944 if (p_ptr->tim_res_nether)
2946 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2949 /* Timed resist time */
2950 if (p_ptr->tim_res_time)
2952 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2956 if (p_ptr->tim_reflect)
2958 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2962 if (p_ptr->multishadow)
2964 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2967 /* Timed Robe of dust */
2968 if (p_ptr->dustrobe)
2970 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2973 /* Timed infra-vision */
2974 if (p_ptr->kabenuke)
2976 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2980 if (p_ptr->paralyzed)
2982 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2986 if (p_ptr->confused)
2988 (void)set_confused(p_ptr->confused - dec_count);
2994 (void)set_afraid(p_ptr->afraid - dec_count);
3000 (void)set_fast(p_ptr->fast - 1, TRUE);
3006 (void)set_slow(p_ptr->slow - dec_count, TRUE);
3009 /* Protection from evil */
3010 if (p_ptr->protevil)
3012 (void)set_protevil(p_ptr->protevil - 1, TRUE);
3015 /* Invulnerability */
3018 (void)set_invuln(p_ptr->invuln - 1, TRUE);
3022 if (p_ptr->wraith_form)
3024 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
3030 (void)set_hero(p_ptr->hero - 1, TRUE);
3036 (void)set_shero(p_ptr->shero - 1, TRUE);
3042 (void)set_blessed(p_ptr->blessed - 1, TRUE);
3048 (void)set_shield(p_ptr->shield - 1, TRUE);
3052 if (p_ptr->tsubureru)
3054 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
3058 if (p_ptr->magicdef)
3060 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
3064 if (p_ptr->tsuyoshi)
3066 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
3070 if (p_ptr->oppose_acid)
3072 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
3075 /* Oppose Lightning */
3076 if (p_ptr->oppose_elec)
3078 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
3082 if (p_ptr->oppose_fire)
3084 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
3088 if (p_ptr->oppose_cold)
3090 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
3094 if (p_ptr->oppose_pois)
3096 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
3101 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
3104 /*** Poison and Stun and Cut ***/
3107 if (p_ptr->poisoned)
3109 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3111 /* Apply some healing */
3112 (void)set_poisoned(p_ptr->poisoned - adjust);
3118 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3120 /* Apply some healing */
3121 (void)set_stun(p_ptr->stun - adjust);
3127 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
3129 /* Hack -- Truly "mortal" wound */
3130 if (p_ptr->cut > 1000) adjust = 0;
3132 /* Apply some healing */
3133 (void)set_cut(p_ptr->cut - adjust);
3138 /*** Process Light ***/
3140 /* Check for light being wielded */
3141 o_ptr = &inventory[INVEN_LITE];
3143 /* Burn some fuel in the current lite */
3144 if (o_ptr->tval == TV_LITE)
3146 /* Hack -- Use some fuel (except on artifacts) */
3147 if (!(artifact_p(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
3149 /* Decrease life-span */
3150 if (o_ptr->name2 == EGO_LITE_LONG)
3152 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
3154 else o_ptr->xtra4--;
3156 /* Notice interesting fuel steps */
3157 notice_lite_change(o_ptr);
3161 /* Calculate torch radius */
3162 p_ptr->update |= (PU_TORCH);
3165 /*** Process mutation effects ***/
3166 if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
3168 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
3172 msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
3173 msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
3175 msg_print("RAAAAGHH!");
3176 msg_print("You feel a fit of rage coming over you!");
3179 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
3182 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
3184 if (!p_ptr->resist_fear)
3188 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3190 msg_print("It's so dark... so scary!");
3193 set_afraid(p_ptr->afraid + 13 + randint1(26));
3197 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
3199 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
3204 /* Teleport player */
3206 msg_print("¤¢¤Ê¤¿¤Î°ÌÃÖ¤ÏÆÍÁ³¤Ò¤¸¤ç¤¦¤ËÉÔ³ÎÄê¤Ë¤Ê¤Ã¤¿...");
3208 msg_print("Your position suddenly seems very uncertain...");
3212 teleport_player(40);
3216 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
3218 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
3221 p_ptr->redraw |= PR_EXTRA;
3223 msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
3225 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
3230 if (!p_ptr->resist_conf)
3232 (void)set_confused(p_ptr->confused + randint0(20) + 15);
3235 if (!p_ptr->resist_chaos)
3240 if (one_in_(3)) lose_all_info();
3242 teleport_player(100);
3245 msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
3246 msg_print("²¿¤â³Ð¤¨¤Æ¤¤¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ËÍ褿¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
3248 msg_print("You wake up somewhere with a sore head...");
3249 msg_print("You can't remember a thing, or how you got here!");
3258 msg_print("¤¡Á¤ì¤¤¤Ê¤Á¤ç¤ª¤Á¤ç¤é¤È¤ó¤ì¤¤¤ë¡Á");
3260 msg_print("Thishcischs GooDSChtuff!");
3263 (void)set_image(p_ptr->image + randint0(150) + 150);
3269 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
3271 if (!p_ptr->resist_chaos)
3274 p_ptr->redraw |= PR_EXTRA;
3275 (void)set_image(p_ptr->image + randint0(50) + 20);
3279 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
3284 msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
3286 msg_print("BRRAAAP! Oops.");
3290 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
3293 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
3294 !p_ptr->anti_magic && one_in_(9000))
3299 msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
3301 msg_print("Magical energy flows through you! You must release it!");
3306 (void)get_hack_dir(&dire);
3307 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
3310 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
3311 !p_ptr->anti_magic && (randint1(6666) == 666))
3313 bool pet = one_in_(6);
3314 u32b mode = PM_ALLOW_GROUP;
3316 if (pet) mode |= PM_FORCE_PET;
3317 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3319 if (summon_specific((pet ? -1 : 0), py, px,
3320 dun_level, SUMMON_DEMON, mode))
3323 msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3325 msg_print("You have attracted a demon!");
3332 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
3338 msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3340 msg_print("You feel less energetic.");
3343 if (p_ptr->fast > 0)
3349 set_slow(randint1(30) + 10, FALSE);
3355 msg_print("ÀºÎÏŪ¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
3357 msg_print("You feel more energetic.");
3360 if (p_ptr->slow > 0)
3366 set_fast(randint1(30) + 10, FALSE);
3371 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
3375 msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
3377 msg_print("You suddenly feel almost lonely.");
3380 banish_monsters(100);
3381 if (!dun_level && p_ptr->town_num)
3384 msg_print("Ź¤Î¼ç¿Í¤¬µÖ¤Ë¸þ¤«¤Ã¤ÆÁö¤Ã¤Æ¤¤¤ë¡ª");
3386 msg_print("You see one of the shopkeepers running for the hills!");
3389 store_shuffle(randint0(MAX_STORES));
3394 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
3399 msg_print("±Æ¤Ë¤Ä¤Ä¤Þ¤ì¤¿¡£");
3401 msg_print("A shadow passes over you.");
3406 /* Absorb light from the current possition */
3407 if (cave[py][px].info & CAVE_GLOW)
3412 o_ptr = &inventory[INVEN_LITE];
3414 /* Absorb some fuel in the current lite */
3415 if (o_ptr->tval == TV_LITE)
3417 /* Use some fuel (except on artifacts) */
3418 if (!artifact_p(o_ptr) && (o_ptr->xtra4 > 0))
3420 /* Heal the player a bit */
3421 hp_player(o_ptr->xtra4 / 20);
3423 /* Decrease life-span of lite */
3427 msg_print("¸÷¸»¤«¤é¥¨¥Í¥ë¥®¡¼¤òµÛ¼ý¤·¤¿¡ª");
3429 msg_print("You absorb energy from your light!");
3433 /* Notice interesting fuel steps */
3434 notice_lite_change(o_ptr);
3439 * Unlite the area (radius 10) around player and
3440 * do 50 points damage to every affected monster
3442 unlite_area(50, 10);
3445 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
3446 !p_ptr->anti_magic && one_in_(7000))
3448 bool pet = one_in_(3);
3449 u32b mode = PM_ALLOW_GROUP;
3451 if (pet) mode |= PM_FORCE_PET;
3452 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3454 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
3457 msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
3459 msg_print("You have attracted an animal!");
3466 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
3467 !p_ptr->anti_magic && one_in_(8000))
3471 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
3473 msg_print("You feel the world warping around you!");
3477 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
3479 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
3481 if (!lose_mutation(0))
3483 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
3485 msg_print("You feel oddly normal.");
3489 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
3493 msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
3495 msg_print("You feel insubstantial!");
3499 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
3501 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
3505 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
3507 int which_stat = randint0(6);
3508 int sustained = FALSE;
3513 if (p_ptr->sustain_str) sustained = TRUE;
3516 if (p_ptr->sustain_int) sustained = TRUE;
3519 if (p_ptr->sustain_wis) sustained = TRUE;
3522 if (p_ptr->sustain_dex) sustained = TRUE;
3525 if (p_ptr->sustain_con) sustained = TRUE;
3528 if (p_ptr->sustain_chr) sustained = TRUE;
3532 msg_print("ÉÔÀµ¤Ê¾õÂÖ¡ª");
3534 msg_print("Invalid stat chosen!");
3544 msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
3546 msg_print("You can feel yourself wasting away!");
3550 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
3553 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
3554 !p_ptr->anti_magic && one_in_(3000))
3556 bool pet = one_in_(5);
3557 u32b mode = PM_ALLOW_GROUP;
3559 if (pet) mode |= PM_FORCE_PET;
3560 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
3562 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
3565 msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
3567 msg_print("You have attracted a dragon!");
3573 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
3576 if (p_ptr->tim_esp > 0)
3579 msg_print("Àº¿À¤Ë¤â¤ä¤¬¤«¤«¤Ã¤¿¡ª");
3581 msg_print("Your mind feels cloudy!");
3584 set_tim_esp(0, TRUE);
3589 msg_print("Àº¿À¤¬¹¤¬¤Ã¤¿¡ª");
3591 msg_print("Your mind expands!");
3594 set_tim_esp(p_ptr->lev, FALSE);
3597 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
3602 msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
3604 msg_print("Your stomach roils, and you lose your lunch!");
3608 set_food(PY_FOOD_WEAK);
3611 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
3612 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
3617 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
3619 int danger_amount = 0;
3622 for (monster = 0; monster < m_max; monster++)
3624 monster_type *m_ptr = &m_list[monster];
3625 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3627 /* Paranoia -- Skip dead monsters */
3628 if (!m_ptr->r_idx) continue;
3630 if (r_ptr->level >= p_ptr->lev)
3632 danger_amount += r_ptr->level - p_ptr->lev + 1;
3636 if (danger_amount > 100)
3638 msg_print("Èó¾ï¤Ë¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3640 msg_print("You feel utterly terrified!");
3643 else if (danger_amount > 50)
3645 msg_print("¶²¤í¤·¤¤µ¤¤¬¤¹¤ë¡ª");
3647 msg_print("You feel terrified!");
3650 else if (danger_amount > 20)
3652 msg_print("Èó¾ï¤Ë¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3654 msg_print("You feel very worried!");
3657 else if (danger_amount > 10)
3659 msg_print("¿´Çۤʵ¤¤¬¤¹¤ë¡ª");
3661 msg_print("You feel paranoid!");
3664 else if (danger_amount > 5)
3666 msg_print("¤Û¤È¤ó¤É°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
3668 msg_print("You feel almost safe.");
3673 msg_print("¼ä¤·¤¤µ¤¤¬¤¹¤ë¡£");
3675 msg_print("You feel lonely.");
3679 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
3684 msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
3686 msg_print("You feel invincible!");
3690 (void)set_invuln(randint1(8) + 8, FALSE);
3692 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
3694 int wounds = p_ptr->mhp - p_ptr->chp;
3698 int healing = p_ptr->csp;
3700 if (healing > wounds)
3706 p_ptr->csp -= healing;
3709 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
3712 int wounds = p_ptr->msp - p_ptr->csp;
3716 int healing = p_ptr->chp;
3718 if (healing > wounds)
3723 p_ptr->csp += healing;
3725 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
3727 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
3732 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
3738 msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
3739 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
3741 msg_print("You trip over your own feet!");
3742 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
3747 if (buki_motteruka(INVEN_RARM))
3749 int slot = INVEN_RARM;
3750 o_ptr = &inventory[INVEN_RARM];
3751 if (buki_motteruka(INVEN_LARM) && one_in_(2))
3753 o_ptr = &inventory[INVEN_LARM];
3756 if (!cursed_p(o_ptr))
3759 msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
3761 msg_print("You drop your weapon!");
3764 inven_drop(slot, 1);
3771 /*** Process Inventory ***/
3773 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
3776 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
3777 * can actually be useful!
3779 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3782 if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3784 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3788 teleport_player(50);
3791 /* Make a chainsword noise */
3792 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3796 if (!get_rnd_line("chainswd_j.txt", 0, noise))
3798 if (!get_rnd_line("chainswd.txt", 0, noise))
3801 disturb(FALSE, FALSE);
3804 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3807 (void)activate_ty_curse(FALSE, &count);
3809 /* Handle experience draining */
3810 if (p_ptr->prace != RACE_ANDROID &&
3811 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3813 p_ptr->exp -= (p_ptr->lev+1)/2;
3814 if (p_ptr->exp < 0) p_ptr->exp = 0;
3815 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3816 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3819 /* Add light curse (Later) */
3820 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3825 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3827 new_curse = get_curse(0, o_ptr);
3828 if (!(o_ptr->curse_flags & new_curse))
3830 char o_name[MAX_NLEN];
3832 object_desc(o_name, o_ptr, FALSE, 0);
3834 o_ptr->curse_flags |= new_curse;
3836 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3838 msg_format("There is a malignant black aura surrounding %s...", o_name);
3841 o_ptr->feeling = FEEL_NONE;
3843 p_ptr->update |= (PU_BONUS);
3846 /* Add heavy curse (Later) */
3847 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3852 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3854 new_curse = get_curse(1, o_ptr);
3855 if (!(o_ptr->curse_flags & new_curse))
3857 char o_name[MAX_NLEN];
3859 object_desc(o_name, o_ptr, FALSE, 0);
3861 o_ptr->curse_flags |= new_curse;
3863 msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
3865 msg_format("There is a malignant black aura surrounding %s...", o_name);
3868 o_ptr->feeling = FEEL_NONE;
3870 p_ptr->update |= (PU_BONUS);
3874 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3876 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3877 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3879 char o_name[MAX_NLEN];
3881 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), FALSE, 0);
3883 msg_format("%s¤¬Æ°Êª¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3885 msg_format("%s have attracted an animal!", o_name);
3892 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3894 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3896 char o_name[MAX_NLEN];
3898 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), FALSE, 0);
3900 msg_format("%s¤¬°Ëâ¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3902 msg_format("%s have attracted a demon!", o_name);
3909 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3911 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3912 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3914 char o_name[MAX_NLEN];
3916 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), FALSE, 0);
3918 msg_format("%s¤¬¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª", o_name);
3920 msg_format("%s have attracted an animal!", o_name);
3926 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3928 if (!p_ptr->resist_fear)
3932 msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
3934 msg_print("It's so dark... so scary!");
3937 set_afraid(p_ptr->afraid + 13 + randint1(26));
3940 /* Teleport player */
3941 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3945 /* Teleport player */
3946 teleport_player(40);
3948 /* Handle HP draining */
3949 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3951 char o_name[MAX_NLEN];
3953 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), FALSE, 0);
3955 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3957 msg_format("%s drains HP from you!", o_name);
3959 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3961 /* Handle mana draining */
3962 if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
3964 char o_name[MAX_NLEN];
3966 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), FALSE, 0);
3968 msg_format("%s¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¼ý¤·¤¿¡ª", o_name);
3970 msg_format("%s drains mana from you!", o_name);
3972 p_ptr->csp -= MIN(p_ptr->lev, 50);
3976 p_ptr->csp_frac = 0;
3978 p_ptr->redraw |= PR_MANA;
3982 /* Rarely, take damage from the Jewel of Judgement */
3983 if (one_in_(999) && !p_ptr->anti_magic)
3985 object_type *o_ptr = &inventory[INVEN_LITE];
3987 if (o_ptr->name1 == ART_JUDGE)
3990 if (object_known_p(o_ptr))
3991 msg_print("¡Ø¿³È½¤ÎÊõÀС٤Ϥ¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3993 msg_print("¤Ê¤Ë¤«¤¬¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¼ý¤·¤¿¡ª");
3994 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "¿³È½¤ÎÊõÀÐ", -1);
3996 if (object_known_p(o_ptr))
3997 msg_print("The Jewel of Judgement drains life from you!");
3999 msg_print("Something drains life from you!");
4000 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
4006 /* Process equipment */
4007 for (j = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
4009 /* Get the object */
4010 o_ptr = &inventory[i];
4012 /* Skip non-objects */
4013 if (!o_ptr->k_idx) continue;
4015 /* Recharge activatable objects */
4016 if (o_ptr->timeout > 0)
4021 /* Notice changes */
4022 if (!o_ptr->timeout)
4024 recharged_notice(o_ptr);
4030 /* Notice changes */
4034 p_ptr->window |= (PW_EQUIP);
4039 * Recharge rods. Rods now use timeout to control charging status,
4040 * and each charging rod in a stack decreases the stack's timeout by
4041 * one per turn. -LM-
4043 for (j = 0, i = 0; i < INVEN_PACK; i++)
4045 o_ptr = &inventory[i];
4046 k_ptr = &k_info[o_ptr->k_idx];
4048 /* Skip non-objects */
4049 if (!o_ptr->k_idx) continue;
4051 /* Examine all charging rods or stacks of charging rods. */
4052 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4054 /* Determine how many rods are charging. */
4055 temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
4056 if (temp > o_ptr->number) temp = o_ptr->number;
4058 /* Decrease timeout by that number. */
4059 o_ptr->timeout -= temp;
4061 /* Boundary control. */
4062 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4064 /* Notice changes, provide message if object is inscribed. */
4065 if (!(o_ptr->timeout))
4067 recharged_notice(o_ptr);
4073 /* Notice changes */
4077 p_ptr->notice |= (PN_COMBINE);
4080 p_ptr->window |= (PW_INVEN);
4084 /* Feel the inventory */
4089 /*** Process Objects ***/
4091 /* Process objects */
4092 for (i = 1; i < o_max; i++)
4097 /* Skip dead objects */
4098 if (!o_ptr->k_idx) continue;
4100 /* Recharge rods on the ground. No messages. */
4101 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
4104 o_ptr->timeout -= o_ptr->number;
4106 /* Boundary control. */
4107 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
4112 /*** Involuntary Movement ***/
4114 /* Delayed Word-of-Recall */
4115 if (p_ptr->word_recall)
4118 * HACK: Autosave BEFORE resetting the recall counter (rr9)
4119 * The player is yanked up/down as soon as
4120 * he loads the autosaved game.
4122 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
4123 do_cmd_save_game(TRUE);
4125 /* Count down towards recall */
4126 p_ptr->word_recall--;
4128 p_ptr->redraw |= (PR_STATUS);
4130 /* Activate the recall */
4131 if (!p_ptr->word_recall)
4136 /* Determine the level */
4137 if (dun_level || p_ptr->inside_quest)
4140 msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4142 msg_print("You feel yourself yanked upwards!");
4145 p_ptr->recall_dungeon = dungeon_type;
4147 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4151 prepare_change_floor_mode(CFM_CLEAR_ALL);
4153 leave_quest_check();
4155 p_ptr->inside_quest = 0;
4156 p_ptr->leaving = TRUE;
4161 msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
4163 msg_print("You feel yourself yanked downwards!");
4166 dungeon_type = p_ptr->recall_dungeon;
4169 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
4172 dun_level = max_dlv[dungeon_type];
4173 if (dun_level < 1) dun_level = 1;
4175 /* Nightmare mode makes recall more dangerous */
4176 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
4182 else if (dun_level < 99)
4184 dun_level = (dun_level + 99) / 2;
4186 else if (dun_level > 100)
4188 dun_level = d_info[dungeon_type].maxdepth - 1;
4192 if (p_ptr->wild_mode)
4194 p_ptr->wilderness_y = py;
4195 p_ptr->wilderness_x = px;
4199 /* Save player position */
4203 p_ptr->wild_mode = FALSE;
4205 prepare_change_floor_mode(CFM_CLEAR_ALL);
4208 p_ptr->leaving = TRUE;
4210 if (dungeon_type == DUNGEON_ANGBAND)
4212 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4214 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4215 (quest[i].status == QUEST_STATUS_TAKEN) &&
4216 (quest[i].level < dun_level))
4218 quest[i].status = QUEST_STATUS_FAILED;
4219 quest[i].complev = (byte)p_ptr->lev;
4220 r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
4227 sound(SOUND_TPLEVEL);
4232 /* Delayed Alter reality */
4233 if (p_ptr->alter_reality)
4235 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
4236 do_cmd_save_game(TRUE);
4238 /* Count down towards alter */
4239 p_ptr->alter_reality--;
4241 p_ptr->redraw |= (PR_STATUS);
4243 /* Activate the alter reality */
4244 if (!p_ptr->alter_reality)
4249 /* Determine the level */
4250 if (!quest_number(dun_level) && dun_level)
4253 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
4255 msg_print("The world changes!");
4258 prepare_change_floor_mode(CFM_CLEAR_ALL);
4261 p_ptr->leaving = TRUE;
4266 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
4268 msg_print("The world seems to change for a moment!");
4273 sound(SOUND_TPLEVEL);
4281 * Verify use of "wizard" mode
4283 static bool enter_wizard_mode(void)
4285 /* Ask first time */
4286 if (!p_ptr->noscore)
4288 /* Wizard mode is not permitted */
4289 if (!allow_debug_opts)
4292 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4294 msg_print("Wizard mode is not permitted.");
4299 /* Mention effects */
4301 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
4302 msg_print("°ìÅÙ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ë¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4304 msg_print("Wizard mode is for debugging and experimenting.");
4305 msg_print("The game will not be scored if you enter wizard mode.");
4310 /* Verify request */
4312 if (!get_check("ËÜÅö¤Ë¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆþ¤ê¤¿¤¤¤Î¤Ç¤¹¤«? "))
4314 if (!get_check("Are you sure you want to enter wizard mode? "))
4321 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4323 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4326 p_ptr->noscore |= 0x0002;
4337 * Verify use of "debug" commands
4339 static bool enter_debug_mode(void)
4341 /* Ask first time */
4342 if (!p_ptr->noscore)
4344 /* Debug mode is not permitted */
4345 if (!allow_debug_opts)
4348 msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
4350 msg_print("Use of debug command is not permitted.");
4355 /* Mention effects */
4357 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4358 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4360 msg_print("The debug commands are for debugging and experimenting.");
4361 msg_print("The game will not be scored if you use debug commands.");
4366 /* Verify request */
4368 if (!get_check("ËÜÅö¤Ë¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4370 if (!get_check("Are you sure you want to use debug commands? "))
4377 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ËÆÍÆþ¤·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4379 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4382 p_ptr->noscore |= 0x0008;
4390 * Hack -- Declare the Debug Routines
4392 extern void do_cmd_debug(void);
4394 #endif /* ALLOW_WIZARD */
4400 * Verify use of "borg" commands
4402 static bool enter_borg_mode(void)
4404 /* Ask first time */
4405 if (!(p_ptr->noscore & 0x0010))
4407 /* Mention effects */
4409 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
4410 msg_print("¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¦¤È¥¹¥³¥¢¤ÏµÏ¿¤µ¤ì¤Þ¤»¤ó¡£");
4412 msg_print("The borg commands are for debugging and experimenting.");
4413 msg_print("The game will not be scored if you use borg commands.");
4418 /* Verify request */
4420 if (!get_check("ËÜÅö¤Ë¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¤«? "))
4422 if (!get_check("Are you sure you want to use borg commands? "))
4429 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥Ü¡¼¥°¡¦¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
4431 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4434 p_ptr->noscore |= 0x0010;
4442 * Hack -- Declare the Ben Borg
4444 extern void do_cmd_borg(void);
4446 #endif /* ALLOW_BORG */
4451 * Parse and execute the current command
4452 * Give "Warning" on illegal commands.
4454 * XXX XXX XXX Make some "blocks"
4456 static void process_command(void)
4458 int old_now_message = now_message;
4460 #ifdef ALLOW_REPEAT /* TNB */
4462 /* Handle repeating the last command */
4465 #endif /* ALLOW_REPEAT -- TNB */
4469 /* Parse the command */
4470 switch (command_cmd)
4486 /*** Wizard Commands ***/
4488 /* Toggle Wizard Mode */
4493 p_ptr->wizard = FALSE;
4495 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
4497 msg_print("Wizard mode off.");
4501 else if (enter_wizard_mode())
4503 p_ptr->wizard = TRUE;
4505 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
4507 msg_print("Wizard mode on.");
4512 /* Update monsters */
4513 p_ptr->update |= (PU_MONSTERS);
4515 /* Redraw "title" */
4516 p_ptr->redraw |= (PR_TITLE);
4524 /* Special "debug" commands */
4527 /* Enter debug mode */
4528 if (enter_debug_mode())
4535 #endif /* ALLOW_WIZARD */
4540 /* Special "borg" commands */
4543 /* Enter borg mode */
4544 if (enter_borg_mode())
4546 if (!p_ptr->wild_mode) do_cmd_borg();
4552 #endif /* ALLOW_BORG */
4556 /*** Inventory Commands ***/
4558 /* Wear/wield equipment */
4561 if (!p_ptr->wild_mode) do_cmd_wield();
4565 /* Take off equipment */
4568 if (!p_ptr->wild_mode) do_cmd_takeoff();
4575 if (!p_ptr->wild_mode) do_cmd_drop();
4579 /* Destroy an item */
4586 /* Equipment list */
4593 /* Inventory list */
4601 /*** Various commands ***/
4603 /* Identify an object */
4610 /* Hack -- toggle windows */
4613 toggle_inven_equip();
4618 /*** Standard "Movement" Commands ***/
4623 if (!p_ptr->wild_mode) do_cmd_alter();
4630 if (!p_ptr->wild_mode) do_cmd_tunnel();
4634 /* Move (usually pick up things) */
4637 #ifdef ALLOW_EASY_DISARM /* TNB */
4641 #else /* ALLOW_EASY_DISARM -- TNB */
4643 do_cmd_walk(always_pickup);
4645 #endif /* ALLOW_EASY_DISARM -- TNB */
4650 /* Move (usually do not pick up) */
4653 #ifdef ALLOW_EASY_DISARM /* TNB */
4657 #else /* ALLOW_EASY_DISARM -- TNB */
4659 do_cmd_walk(!always_pickup);
4661 #endif /* ALLOW_EASY_DISARM -- TNB */
4667 /*** Running, Resting, Searching, Staying */
4669 /* Begin Running -- Arg is Max Distance */
4672 if (!p_ptr->wild_mode) do_cmd_run();
4676 /* Stay still (usually pick things up) */
4679 do_cmd_stay(always_pickup);
4683 /* Stay still (usually do not pick up) */
4686 do_cmd_stay(!always_pickup);
4690 /* Rest -- Arg is time */
4697 /* Search for traps/doors */
4704 /* Toggle search mode */
4707 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4708 else set_action(ACTION_SEARCH);
4713 /*** Stairs and Doors and Chests and Traps ***/
4716 case SPECIAL_KEY_STORE:
4718 if (!p_ptr->wild_mode) do_cmd_store();
4722 /* Enter building -KMW- */
4723 case SPECIAL_KEY_BUILDING:
4725 if (!p_ptr->wild_mode) do_cmd_bldg();
4729 /* Enter quest level -KMW- */
4730 case SPECIAL_KEY_QUEST:
4732 if (!p_ptr->wild_mode) do_cmd_quest();
4736 /* Go up staircase */
4739 if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4746 msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
4748 msg_print("To flee the ambush you have to reach the edge of the map.");
4751 else if (p_ptr->food < PY_FOOD_WEAK)
4754 msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
4756 msg_print("You must eat something here.");
4761 if (change_wild_mode())
4774 /* Go down staircase */
4777 if(!p_ptr->wild_mode) do_cmd_go_down();
4780 p_ptr->wilderness_x = px;
4781 p_ptr->wilderness_y = py;
4787 /* Open a door or chest */
4790 if (!p_ptr->wild_mode) do_cmd_open();
4797 if (!p_ptr->wild_mode) do_cmd_close();
4801 /* Jam a door with spikes */
4804 if (!p_ptr->wild_mode) do_cmd_spike();
4811 if (!p_ptr->wild_mode) do_cmd_bash();
4815 /* Disarm a trap or chest */
4818 if (!p_ptr->wild_mode) do_cmd_disarm();
4823 /*** Magic and Prayers ***/
4825 /* Gain new spells/prayers */
4828 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4830 msg_print("¼öʸ¤ò³Ø½¬¤¹¤ëɬÍפϤʤ¤¡ª");
4832 msg_print("You don't have to learn spells!");
4834 else if (p_ptr->pclass == CLASS_SAMURAI)
4835 do_cmd_gain_hissatsu();
4836 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4846 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4847 (p_ptr->pclass == CLASS_BERSERKER) ||
4848 (p_ptr->pclass == CLASS_NINJA) ||
4849 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4850 ) do_cmd_mind_browse();
4851 else if (p_ptr->pclass == CLASS_SMITH)
4853 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4854 do_cmd_magic_eater(TRUE);
4855 else do_cmd_browse();
4863 if (!p_ptr->wild_mode)
4865 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4868 msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
4870 msg_print("You cannot cast spells!");
4873 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4876 msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
4878 msg_print("The dungeon absorbs all attempted magic!");
4882 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4886 cptr which_power = "ËâË¡";
4888 cptr which_power = "magic";
4890 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4892 which_power = "ĶǽÎÏ";
4894 which_power = "psionic powers";
4896 else if (p_ptr->pclass == CLASS_IMITATOR)
4898 which_power = "¤â¤Î¤Þ¤Í";
4900 which_power = "imitation";
4902 else if (p_ptr->pclass == CLASS_SAMURAI)
4904 which_power = "ɬ»¦·õ";
4906 which_power = "hissatsu";
4908 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4910 which_power = "¶ÀËâË¡";
4912 which_power = "mirror magic";
4914 else if (p_ptr->pclass == CLASS_NINJA)
4916 which_power = "Ǧ½Ñ";
4918 which_power = "ninjutsu";
4920 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4922 which_power = "µ§¤ê";
4924 which_power = "prayer";
4928 msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%s¤ò¼ÙË⤷¤¿¡ª", which_power);
4930 msg_format("An anti-magic shell disrupts your %s!", which_power);
4934 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4937 msg_format("¶¸Àï»Î²½¤·¤Æ¤¤¤ÆƬ¤¬²ó¤é¤Ê¤¤¡ª");
4939 msg_format("You cannot think directly!");
4945 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4946 (p_ptr->pclass == CLASS_BERSERKER) ||
4947 (p_ptr->pclass == CLASS_NINJA) ||
4948 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4951 else if (p_ptr->pclass == CLASS_IMITATOR)
4953 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4954 do_cmd_magic_eater(FALSE);
4955 else if (p_ptr->pclass == CLASS_SAMURAI)
4957 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4958 do_cmd_cast_learned();
4959 else if (p_ptr->pclass == CLASS_SMITH)
4968 /* Issue a pet command */
4971 if (!p_ptr->wild_mode) do_cmd_pet();
4975 /*** Use various objects ***/
4977 /* Inscribe an object */
4984 /* Uninscribe an object */
4987 do_cmd_uninscribe();
4991 /* Activate an artifact */
4994 if (!p_ptr->wild_mode)
4996 if (!p_ptr->inside_arena)
5001 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5003 msg_print("The arena absorbs all attempted magic!");
5019 /* Fuel your lantern/torch */
5029 if (!p_ptr->wild_mode) do_cmd_fire();
5036 if (!p_ptr->wild_mode)
5046 if (!p_ptr->wild_mode)
5048 if (!p_ptr->inside_arena)
5053 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5055 msg_print("The arena absorbs all attempted magic!");
5067 if (!p_ptr->wild_mode)
5069 if (p_ptr->inside_arena)
5072 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5074 msg_print("The arena absorbs all attempted magic!");
5079 else if (use_command && rogue_like_commands)
5091 /* Quaff a potion */
5094 if (!p_ptr->wild_mode)
5096 if (!p_ptr->inside_arena)
5097 do_cmd_quaff_potion();
5101 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5103 msg_print("The arena absorbs all attempted magic!");
5115 if (!p_ptr->wild_mode)
5117 if (!p_ptr->inside_arena)
5118 do_cmd_read_scroll();
5122 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5124 msg_print("The arena absorbs all attempted magic!");
5136 if (!p_ptr->wild_mode)
5138 if (p_ptr->inside_arena)
5141 msg_print("¥¢¥ê¡¼¥Ê¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
5143 msg_print("The arena absorbs all attempted magic!");
5148 else if (use_command && !rogue_like_commands)
5158 /* Use racial power */
5161 if (!p_ptr->wild_mode) do_cmd_racial_power();
5166 /*** Looking at Things (nearby or on map) ***/
5168 /* Full dungeon map */
5175 /* Locate player on map */
5189 /* Target monster or location */
5192 if (!p_ptr->wild_mode) do_cmd_target();
5198 /*** Help and Such ***/
5207 /* Identify symbol */
5210 do_cmd_query_symbol();
5214 /* Character description */
5217 do_cmd_change_name();
5222 /*** System Commands ***/
5224 /* Hack -- User interface */
5231 /* Single line from a pref file */
5246 do_cmd_edit_autopick();
5250 /* Interact with macros */
5257 /* Interact with visuals */
5265 /* Interact with colors */
5273 /* Interact with options */
5281 /*** Misc Commands ***/
5297 /* Repeat level feeling */
5300 if (!p_ptr->wild_mode) do_cmd_feeling();
5304 /* Show previous message */
5307 do_cmd_message_one();
5311 /* Show previous messages */
5314 do_cmd_messages(old_now_message);
5318 /* Show quest status -KMW- */
5321 do_cmd_checkquest();
5325 /* Redraw the screen */
5328 now_message = old_now_message;
5333 #ifndef VERIFY_SAVEFILE
5335 /* Hack -- Save and don't quit */
5338 do_cmd_save_game(FALSE);
5342 #endif /* VERIFY_SAVEFILE */
5352 case SPECIAL_KEY_QUIT:
5354 do_cmd_save_and_exit();
5358 /* Quit (commit suicide) */
5371 /* Check artifacts, uniques, objects */
5378 /* Load "screen dump" */
5381 do_cmd_load_screen();
5385 /* Save "screen dump" */
5388 do_cmd_save_screen();
5392 /* Make random artifact list */
5395 spoil_random_artifact("randifact.txt");
5399 /* Hack -- Unknown command */
5402 if (flush_failure) flush();
5406 sound(SOUND_ILLEGAL);
5408 if (!get_rnd_line("error_j.txt", 0, error_m))
5410 if (!get_rnd_line("error.txt", 0, error_m))
5417 prt(" '?' ¤Ç¥Ø¥ë¥×¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£", 0, 0);
5419 prt("Type '?' for help.", 0, 0);
5425 if (!energy_use && !now_message)
5426 now_message = old_now_message;
5432 static bool monster_tsuri(int r_idx)
5434 monster_race *r_ptr = &r_info[r_idx];
5436 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
5444 * Process the player
5446 * Notice the annoying code to handle "pack overflow", which
5447 * must come first just in case somebody manages to corrupt
5448 * the savefiles by clever use of menu commands or something.
5450 static void process_player(void)
5454 /*** Apply energy ***/
5459 msg_print("²¿¤«ÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
5461 msg_print("You feel different!");
5464 (void)gain_random_mutation(0);
5465 hack_mutation = FALSE;
5468 if (p_ptr->inside_battle)
5470 for(i = 1; i < m_max; i++)
5472 monster_type *m_ptr = &m_list[i];
5474 if (!m_ptr->r_idx) continue;
5476 /* Hack -- Detect monster */
5477 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5479 /* Update the monster */
5480 update_mon(i, FALSE);
5485 /* Give the player some energy */
5486 else if (!(load && p_ptr->energy_need <= 0))
5488 p_ptr->energy_need -= (p_ptr->pspeed > 199 ? 49 : (p_ptr->pspeed < 0 ? 1 : extract_energy[p_ptr->pspeed]));
5492 if (p_ptr->energy_need > 0) return;
5493 if (!command_rep) prt_time();
5495 /*** Check for interupts ***/
5497 /* Complete resting */
5504 if ((p_ptr->chp == p_ptr->mhp) &&
5505 (p_ptr->csp >= p_ptr->msp))
5507 set_action(ACTION_NONE);
5511 /* Complete resting */
5512 else if (resting == -2)
5515 if ((p_ptr->chp == p_ptr->mhp) &&
5516 (p_ptr->csp >= p_ptr->msp) &&
5517 !p_ptr->blind && !p_ptr->confused &&
5518 !p_ptr->poisoned && !p_ptr->afraid &&
5519 !p_ptr->stun && !p_ptr->cut &&
5520 !p_ptr->slow && !p_ptr->paralyzed &&
5521 !p_ptr->image && !p_ptr->word_recall &&
5522 !p_ptr->alter_reality)
5524 set_action(ACTION_NONE);
5529 if (p_ptr->action == ACTION_FISH)
5532 Term_xtra(TERM_XTRA_DELAY, 10);
5536 bool success = FALSE;
5537 get_mon_num_prep(monster_tsuri,NULL);
5538 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5540 if (r_idx && one_in_(2))
5543 y = py+ddy[tsuri_dir];
5544 x = px+ddx[tsuri_dir];
5545 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5548 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5550 msg_format("%s¤¬Äà¤ì¤¿¡ª", m_name);
5552 msg_format("You have a good catch!", m_name);
5560 msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
5562 msg_print("Damn! The fish stole your bait!");
5569 /* Handle "abort" */
5572 /* Check for "player abort" (semi-efficiently for resting) */
5573 if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5578 /* Check for a key */
5587 /* Hack -- Show a Message */
5589 msg_print("ÃæÃǤ·¤Þ¤·¤¿¡£");
5591 msg_print("Canceled.");
5598 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5600 monster_type *m_ptr = &m_list[p_ptr->riding];
5609 /* Acquire the monster name */
5610 monster_desc(m_name, m_ptr, 0);
5612 msg_format("%^s¤òµ¯¤³¤·¤¿¡£", m_name);
5614 msg_format("You have waked %s up.", m_name);
5616 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5617 p_ptr->redraw |= (PR_UHEALTH);
5624 /* Make a "saving throw" against stun */
5625 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5631 /* Hack -- Recover from stun */
5632 if (m_ptr->stunned > d)
5634 /* Recover somewhat */
5635 m_ptr->stunned -= d;
5646 /* Acquire the monster name */
5647 monster_desc(m_name, m_ptr, 0);
5649 /* Dump a message */
5651 msg_format("%^s¤òÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5653 msg_format("%^s is no longer stunned.", m_name);
5655 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5656 p_ptr->redraw |= (PR_UHEALTH);
5660 if (m_ptr->confused)
5664 /* Make a "saving throw" against stun */
5665 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5668 d = m_ptr->confused;
5671 /* Hack -- Recover from stun */
5672 if (m_ptr->confused > d)
5674 /* Recover somewhat */
5675 m_ptr->confused -= d;
5684 m_ptr->confused = 0;
5686 /* Acquire the monster name */
5687 monster_desc(m_name, m_ptr, 0);
5689 /* Dump a message */
5691 msg_format("%^s¤òº®Íð¾õÂÖ¤«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5693 msg_format("%^s is no longer confused.", m_name);
5695 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5696 p_ptr->redraw |= (PR_UHEALTH);
5704 /* Make a "saving throw" against stun */
5705 if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
5711 /* Hack -- Recover from stun */
5712 if (m_ptr->monfear > d)
5714 /* Recover somewhat */
5715 m_ptr->monfear -= d;
5726 /* Acquire the monster name */
5727 monster_desc(m_name, m_ptr, 0);
5729 /* Dump a message */
5731 msg_format("%^s¤ò¶²Éݤ«¤éΩ¤Áľ¤é¤»¤¿¡£", m_name);
5733 msg_format("%^s is no longer fear.", m_name);
5735 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= (PR_HEALTH);
5736 p_ptr->redraw |= (PR_UHEALTH);
5740 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5744 /* Handle the player song */
5745 if (!load) check_music();
5750 if (p_ptr->lightspeed)
5752 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5754 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5756 if (p_ptr->magic_num1[0] < 40)
5758 p_ptr->magic_num1[0] = 0;
5760 else p_ptr->magic_num1[0] -= 40;
5761 p_ptr->update |= (PU_BONUS);
5763 if (p_ptr->action == ACTION_LEARN)
5765 int hoge = ((p_ptr->msp * 0x10000L) / 256L)+7680L;
5766 if ((p_ptr->csp * 0x10000L + p_ptr->csp_frac) < hoge)
5769 p_ptr->csp_frac = 0;
5770 set_action(ACTION_NONE);
5774 p_ptr->csp -= (s16b)(hoge >> 16);
5776 if (p_ptr->csp_frac < hoge)
5778 p_ptr->csp_frac += 0x10000L - hoge;
5782 p_ptr->csp_frac -= hoge;
5784 p_ptr->redraw |= PR_MANA;
5787 if (p_ptr->special_defense & KATA_MASK)
5789 if (p_ptr->special_defense & KATA_MUSOU)
5793 set_action(ACTION_NONE);
5798 p_ptr->redraw |= (PR_MANA);
5803 /*** Handle actual user input ***/
5805 /* Repeat until out of energy */
5806 while (p_ptr->energy_need <= 0)
5808 p_ptr->window |= PW_PLAYER;
5809 p_ptr->sutemi = FALSE;
5810 p_ptr->counter = FALSE;
5811 now_damaged = FALSE;
5813 /* Handle "p_ptr->notice" */
5816 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5819 /* Place the cursor on the player */
5820 move_cursor_relative(py, px);
5822 /* Refresh (optional) */
5823 if (fresh_before) Term_fresh();
5826 /* Hack -- Pack Overflow */
5827 if (inventory[INVEN_PACK].k_idx)
5829 int item = INVEN_PACK;
5831 char o_name[MAX_NLEN];
5835 /* Access the slot to be dropped */
5836 o_ptr = &inventory[item];
5843 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
5845 msg_print("Your pack overflows!");
5850 object_desc(o_name, o_ptr, TRUE, 3);
5854 msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
5856 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5860 /* Drop it (carefully) near the player */
5861 (void)drop_near(o_ptr, 0, py, px);
5863 /* Modify, Describe, Optimize */
5864 inven_item_increase(item, -255);
5865 inven_item_describe(item);
5866 inven_item_optimize(item);
5868 /* Handle "p_ptr->notice" */
5871 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5876 /* Hack -- cancel "lurking browse mode" */
5877 if (!command_new) command_see = FALSE;
5880 /* Assume free turn */
5884 if (p_ptr->inside_battle)
5886 /* Place the cursor on the player */
5887 move_cursor_relative(py, px);
5889 command_cmd = SPECIAL_KEY_BUILDING;
5891 /* Process the command */
5895 /* Paralyzed or Knocked Out */
5896 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5903 else if (p_ptr->action == ACTION_REST)
5908 /* Reduce rest count */
5911 if (!resting) set_action(ACTION_NONE);
5913 /* Redraw the state */
5914 p_ptr->redraw |= (PR_STATE);
5922 else if (p_ptr->action == ACTION_FISH)
5935 /* Repeated command */
5936 else if (command_rep)
5938 /* Count this execution */
5941 /* Redraw the state */
5942 p_ptr->redraw |= (PR_STATE);
5947 /* Hack -- Assume messages were seen */
5950 /* Clear the top line */
5953 /* Process the command */
5957 /* Normal command */
5960 /* Place the cursor on the player */
5961 move_cursor_relative(py, px);
5964 /* Get a command (normal) */
5965 request_command(FALSE);
5968 /* Process the command */
5978 /* Use some energy */
5979 if (world_player || energy_use > 400)
5981 /* The Randomness is irrelevant */
5982 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
5986 /* There is some randomness of needed energy */
5987 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
5990 /* Hack -- constant hallucination */
5991 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5994 /* Shimmer monsters if needed */
5995 if (shimmer_monsters)
5997 /* Clear the flag */
5998 shimmer_monsters = FALSE;
6000 /* Shimmer multi-hued monsters */
6001 for (i = 1; i < m_max; i++)
6003 monster_type *m_ptr;
6004 monster_race *r_ptr;
6006 /* Access monster */
6009 /* Skip dead monsters */
6010 if (!m_ptr->r_idx) continue;
6012 /* Access the monster race */
6013 r_ptr = &r_info[m_ptr->r_idx];
6015 /* Skip non-multi-hued monsters */
6016 if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue;
6018 /* Reset the flag */
6019 shimmer_monsters = TRUE;
6021 /* Redraw regardless */
6022 lite_spot(m_ptr->fy, m_ptr->fx);
6027 /* Handle monster detection */
6028 if (repair_monsters)
6030 /* Reset the flag */
6031 repair_monsters = FALSE;
6033 /* Rotate detection flags */
6034 for (i = 1; i < m_max; i++)
6036 monster_type *m_ptr;
6038 /* Access monster */
6041 /* Skip dead monsters */
6042 if (!m_ptr->r_idx) continue;
6044 /* Nice monsters get mean */
6045 if (m_ptr->mflag & MFLAG_NICE)
6047 /* Nice monsters get mean */
6048 m_ptr->mflag &= ~(MFLAG_NICE);
6051 /* Handle memorized monsters */
6052 if (m_ptr->mflag2 & MFLAG2_MARK)
6054 /* Maintain detection */
6055 if (m_ptr->mflag2 & MFLAG2_SHOW)
6058 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6060 /* Still need repairs */
6061 repair_monsters = TRUE;
6064 /* Remove detection */
6068 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6070 /* Assume invisible */
6073 /* Update the monster */
6074 update_mon(i, FALSE);
6076 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6077 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6079 /* Redraw regardless */
6080 lite_spot(m_ptr->fy, m_ptr->fx);
6085 if (p_ptr->pclass == CLASS_IMITATOR)
6087 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6090 for (i = 0; i < p_ptr->mane_num; i++)
6092 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6093 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6097 p_ptr->redraw |= (PR_MANE);
6099 if (p_ptr->action == ACTION_LEARN)
6102 p_ptr->redraw |= (PR_STATE);
6105 if (world_player && (p_ptr->energy_need > - 1000))
6108 p_ptr->redraw |= (PR_MAP);
6110 /* Update monsters */
6111 p_ptr->update |= (PU_MONSTERS);
6114 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6117 msg_print("¡Ö»þ¤ÏÆ°¤¤À¤¹¡Ä¡×");
6119 msg_print("You feel time flowing around you once more.");
6122 world_player = FALSE;
6123 p_ptr->energy_need = ENERGY_NEED();
6125 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6130 /* Hack -- notice death */
6131 if (!p_ptr->playing || p_ptr->is_dead)
6133 world_player = FALSE;
6137 /* Handle "leaving" */
6138 if (p_ptr->leaving) break;
6141 /* Update scent trail */
6147 * Interact with the current dungeon level.
6149 * This function will not exit until the level is completed,
6150 * the user dies, or the game is terminated.
6152 static void dungeon(bool load_game)
6156 /* Set the base level */
6157 base_level = dun_level;
6159 /* Reset various flags */
6163 p_ptr->leaving = FALSE;
6165 /* Reset the "command" vars */
6173 /* Cancel the target */
6177 ambush_flag = FALSE;
6179 /* Cancel the health bar */
6182 /* Check visual effects */
6183 shimmer_monsters = TRUE;
6184 shimmer_objects = TRUE;
6185 repair_monsters = TRUE;
6186 repair_objects = TRUE;
6192 /* Get index of current quest (if any) */
6193 quest_num = quest_number(dun_level);
6195 /* Inside a quest? */
6198 /* Mark the quest monster */
6199 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6202 /* Track maximum player level */
6203 if (p_ptr->max_plv < p_ptr->lev)
6205 p_ptr->max_plv = p_ptr->lev;
6209 /* Track maximum dungeon level (if not in quest -KMW-) */
6210 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6212 max_dlv[dungeon_type] = dun_level;
6213 if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6216 /* Validate the panel */
6217 panel_bounds_center();
6219 /* Verify the panel */
6222 /* Flush messages */
6226 /* Enter "xtra" mode */
6227 character_xtra = TRUE;
6230 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6232 /* Redraw dungeon */
6233 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6236 p_ptr->redraw |= (PR_MAP);
6239 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6241 /* Update lite/view */
6242 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6244 /* Update monsters */
6245 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6247 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6250 /* Leave "xtra" mode */
6251 character_xtra = FALSE;
6254 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6256 /* Combine / Reorder the pack */
6257 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6259 /* Handle "p_ptr->notice" */
6262 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6268 if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6270 if (p_ptr->inside_battle)
6274 p_ptr->energy_need = 0;
6281 msg_print("»î¹ç³«»Ï¡ª");
6283 msg_format("Ready..Fight!");
6289 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6290 p_ptr->magic_num1[0] = MUSIC_DETECT;
6292 /* Hack -- notice death or departure */
6293 if (!p_ptr->playing || p_ptr->is_dead) return;
6295 /* Print quest message if appropriate */
6296 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6298 quest_discovery(random_quest_number(dun_level));
6299 p_ptr->inside_quest = random_quest_number(dun_level);
6301 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6303 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6305 msg_format("¤³¤Î³¬¤Ë¤Ï%s¤Î¼ç¤Ç¤¢¤ë%s¤¬À³¤ó¤Ç¤¤¤ë¡£",
6306 d_name+d_info[dungeon_type].name,
6307 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6309 msg_format("%^s lives in this level as the keeper of %s.",
6310 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6311 d_name+d_info[dungeon_type].name);
6315 /*** Process this dungeon level ***/
6317 /* Reset the monster generation level */
6318 monster_level = base_level;
6320 /* Reset the object generation level */
6321 object_level = base_level;
6325 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6326 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6327 p_ptr->energy_need = 0;
6329 /* Not leaving dungeon */
6330 p_ptr->leaving_dungeon = FALSE;
6335 /* Hack -- Compact the monster list occasionally */
6336 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6338 /* Hack -- Compress the monster list occasionally */
6339 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6342 /* Hack -- Compact the object list occasionally */
6343 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6345 /* Hack -- Compress the object list occasionally */
6346 if (o_cnt + 32 < o_max) compact_objects(0);
6349 /* Process the player */
6352 /* Handle "p_ptr->notice" */
6355 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6358 /* Hack -- Hilite the player */
6359 move_cursor_relative(py, px);
6361 /* Optional fresh */
6362 if (fresh_after) Term_fresh();
6364 /* Hack -- Notice death or departure */
6365 if (!p_ptr->playing || p_ptr->is_dead) break;
6367 /* Process all of the monsters */
6370 /* Handle "p_ptr->notice" */
6373 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6376 /* Hack -- Hilite the player */
6377 move_cursor_relative(py, px);
6379 /* Optional fresh */
6380 if (fresh_after) Term_fresh();
6382 /* Hack -- Notice death or departure */
6383 if (!p_ptr->playing || p_ptr->is_dead) break;
6386 /* Process the world */
6389 /* Handle "p_ptr->notice" */
6392 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6395 /* Hack -- Hilite the player */
6396 move_cursor_relative(py, px);
6398 /* Optional fresh */
6399 if (fresh_after) Term_fresh();
6401 /* Hack -- Notice death or departure */
6402 if (!p_ptr->playing || p_ptr->is_dead) break;
6404 /* Handle "leaving" */
6405 if (p_ptr->leaving) break;
6407 /* Count game turns */
6409 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6410 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6411 if (wild_regen) wild_regen--;
6414 /* Inside a quest and non-unique questor? */
6415 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6417 /* Un-mark the quest monster */
6418 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6421 /* Not save-and-quit and not dead? */
6422 if (p_ptr->playing && !p_ptr->is_dead)
6425 * Maintain Unique monsters and artifact, save current
6426 * floor, then prepare next floor
6430 /* Forget the flag */
6431 reinit_wilderness = FALSE;
6434 /* Write about current level on the play record once per level */
6440 * Load some "user pref files"
6442 * Modified by Arcum Dagsson to support
6443 * separate macro files for different realms.
6445 static void load_all_pref_files(void)
6450 /* Access the "user" pref file */
6451 sprintf(buf, "user.prf");
6453 /* Process that file */
6454 process_pref_file(buf);
6456 /* Access the "user" system pref file */
6457 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6459 /* Process that file */
6460 process_pref_file(buf);
6462 /* Access the "race" pref file */
6463 sprintf(buf, "%s.prf", rp_ptr->title);
6465 /* Process that file */
6466 process_pref_file(buf);
6468 /* Access the "class" pref file */
6469 sprintf(buf, "%s.prf", cp_ptr->title);
6471 /* Process that file */
6472 process_pref_file(buf);
6474 /* Access the "character" pref file */
6475 sprintf(buf, "%s.prf", player_base);
6477 /* Process that file */
6478 process_pref_file(buf);
6480 /* Free old entries */
6484 sprintf(buf, "picktype-%s.prf", player_base);
6486 sprintf(buf, "pickpref-%s.prf", player_base);
6489 err = process_pickpref_file(buf);
6491 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
6495 process_pickpref_file("picktype.prf");
6497 process_pickpref_file("pickpref.prf");
6501 /* Access the "realm 1" pref file */
6502 if (p_ptr->realm1 != REALM_NONE)
6504 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6506 /* Process that file */
6507 process_pref_file(buf);
6510 /* Access the "realm 2" pref file */
6511 if (p_ptr->realm2 != REALM_NONE)
6513 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6515 /* Process that file */
6516 process_pref_file(buf);
6522 * Actually play a game
6524 * If the "new_game" parameter is true, then, after loading the
6525 * savefile, we will commit suicide, if necessary, to allow the
6526 * player to start a new game.
6528 void play_game(bool new_game)
6531 bool load_game = TRUE;
6541 hack_mutation = FALSE;
6543 /* Hack -- Character is "icky" */
6544 character_icky = TRUE;
6546 /* Make sure main term is active */
6547 Term_activate(angband_term[0]);
6549 /* Initialise the resize hooks */
6550 angband_term[0]->resize_hook = resize_map;
6552 for (i = 1; i < 8; i++)
6554 /* Does the term exist? */
6555 if (angband_term[i])
6557 /* Add the redraw on resize hook */
6558 angband_term[i]->resize_hook = redraw_window;
6562 /* Hack -- turn off the cursor */
6563 (void)Term_set_cursor(0);
6566 /* Attempt to load */
6571 quit("¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤Þ¤¹");
6573 quit("broken savefile");
6578 /* Extract the options */
6579 for (i = 0; option_info[i].o_desc; i++)
6581 int os = option_info[i].o_set;
6582 int ob = option_info[i].o_bit;
6584 /* Set the "default" options */
6585 if (option_info[i].o_var)
6588 if (option_flag[os] & (1L << ob))
6591 (*option_info[i].o_var) = TRUE;
6598 (*option_info[i].o_var) = FALSE;
6603 /* Report waited score */
6604 if (p_ptr->wait_report_score)
6610 if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6612 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6617 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6622 p_ptr->is_dead = TRUE;
6624 start_time = time(NULL);
6626 /* No suspending now */
6627 signals_ignore_tstp();
6629 /* Hack -- Character is now "icky" */
6630 character_icky = TRUE;
6632 /* Build the filename */
6633 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6635 /* Open the high score file, for reading/writing */
6636 highscore_fd = fd_open(buf, O_RDWR);
6638 /* Handle score, show Top scores */
6639 success = send_world_score(TRUE);
6642 if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
6644 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6648 prt("°ú¤Â³¤ÂÔµ¡¤·¤Þ¤¹¡£", 0, 0);
6650 prt("standing by for future registration...", 0, 0);
6656 p_ptr->wait_report_score = FALSE;
6659 if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
6661 if (!save_player()) msg_print("death save failed!");
6664 /* Shut the high score file */
6665 (void)fd_close(highscore_fd);
6667 /* Forget the high score fd */
6670 /* Allow suspending now */
6671 signals_handle_tstp();
6676 /* Nothing loaded */
6677 if (!character_loaded)
6679 /* Make new player */
6682 /* The dungeon is not ready */
6683 character_dungeon = FALSE;
6685 /* Prepare to init the RNG */
6688 /* Initialize the saved floors data */
6689 init_saved_floors();
6692 /* Old game is loaded. But new game is requested. */
6695 /* Delete expanded temporal files */
6696 clear_saved_floor_files();
6699 /* Process old character */
6702 /* Process the player name */
6703 process_player_name(FALSE);
6712 seed = (time(NULL));
6716 /* Mutate the seed on Unix machines */
6717 seed = ((seed >> 3) * (getpid() << 1));
6721 /* Use the complex RNG */
6724 /* Seed the "complex" RNG */
6725 Rand_state_init(seed);
6728 /* Roll new character */
6731 monster_race *r_ptr;
6733 /* The dungeon is not ready */
6734 character_dungeon = FALSE;
6738 p_ptr->inside_quest = 0;
6739 p_ptr->inside_arena = FALSE;
6740 p_ptr->inside_battle = FALSE;
6744 /* Hack -- seed for flavors */
6745 seed_flavor = randint0(0x10000000);
6747 /* Hack -- seed for town layout */
6748 seed_town = randint0(0x10000000);
6750 /* Roll up a new character */
6757 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ÊÕ¶¤ÎÃϤ˹ߤêΩ¤Ã¤¿¡£");
6759 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "You are standing in the Outpost.");
6763 get_mon_num_prep(NULL, NULL);
6764 for (i = 0; i < MAX_KUBI; i++)
6770 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6771 r_ptr = &r_info[kubi_r_idx[i]];
6773 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6775 if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
6776 if (r_ptr->rarity > 100) continue;
6778 if(r_ptr->flags6 & RF6_SPECIAL) continue;
6780 for (j = 0; j < i; j++)
6781 if (kubi_r_idx[i] == kubi_r_idx[j])break;
6786 for (i = 0; i < MAX_KUBI -1; i++)
6789 for (j = i; j < MAX_KUBI; j++)
6791 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6793 tmp = kubi_r_idx[i];
6794 kubi_r_idx[i] = kubi_r_idx[j];
6795 kubi_r_idx[j] = tmp;
6800 p_ptr->inside_battle = TRUE;
6803 today_mon = get_mon_num(3);
6804 r_ptr = &r_info[today_mon];
6806 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6807 if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
6808 if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
6809 if (r_ptr->rarity > 10) continue;
6810 if (r_ptr->level == 0) continue;
6813 p_ptr->inside_battle = FALSE;
6817 write_level = FALSE;
6820 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----¥²¡¼¥àºÆ³«----");
6822 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6826 * 1.0.9 °ÊÁ°¤Ï¥»¡¼¥ÖÁ°¤Ë p_ptr->riding = -1 ¤È¤·¤Æ¤¤¤¿¤Î¤Ç¡¢ºÆÀßÄ꤬ɬÍפÀ¤Ã¤¿¡£
6827 * ¤â¤¦ÉÔÍפÀ¤¬¡¢°ÊÁ°¤Î¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤È¤Î¸ß´¹¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¯¡£
6829 if (p_ptr->riding == -1)
6832 for(i = m_max; i > 0; i--)
6834 if ((m_list[i].fy == py) && (m_list[i].fx == px))
6843 p_ptr->teleport_town = FALSE;
6844 p_ptr->sutemi = FALSE;
6845 world_monster = FALSE;
6846 now_damaged = FALSE;
6848 start_time = time(NULL) - 1;
6849 record_o_name[0] = '\0';
6851 /* Reset map panel */
6852 panel_row_min = cur_hgt;
6853 panel_col_min = cur_wid;
6855 /* Sexy gal gets bonus to maximum weapon skill of whip */
6856 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6857 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
6859 /* Fill the arrays of floors and walls in the good proportions */
6860 set_floor_and_wall(dungeon_type);
6862 /* Flavor the objects */
6870 /* Flash a message */
6872 prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
6874 prt("Please wait...", 0, 0);
6878 /* Flush the message */
6882 /* Hack -- Enter wizard mode */
6885 if (enter_wizard_mode()) p_ptr->wizard = TRUE;
6886 else if (p_ptr->is_dead) quit("Already dead.");
6889 /* Initialize the town-buildings if necessary */
6890 if (!dun_level && !p_ptr->inside_quest)
6892 /* Init the wilderness */
6894 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6897 init_flags = INIT_ONLY_BUILDINGS;
6899 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6904 /* Generate a dungeon level if needed */
6905 if (!character_dungeon) change_floor();
6908 /* Character is now "complete" */
6909 character_generated = TRUE;
6912 /* Hack -- Character is no longer "icky" */
6913 character_icky = FALSE;
6917 p_ptr->playing = TRUE;
6919 /* Reset the visual mappings */
6922 /* Load the "pref" files */
6923 load_all_pref_files();
6925 /* React to changes */
6926 Term_xtra(TERM_XTRA_REACT, 0);
6929 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6932 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6938 /* Set or clear "rogue_like_commands" if requested */
6939 if (arg_force_original) rogue_like_commands = FALSE;
6940 if (arg_force_roguelike) rogue_like_commands = TRUE;
6942 /* Hack -- Enforce "delayed death" */
6943 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6945 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6947 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6949 monster_type *m_ptr;
6950 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6951 monster_race *r_ptr = &r_info[pet_r_idx];
6952 place_monster_aux(0, py, px - 1, pet_r_idx,
6953 (PM_FORCE_PET | PM_NO_KAGE));
6954 m_ptr = &m_list[hack_m_idx_ii];
6955 m_ptr->mspeed = r_ptr->speed;
6956 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6957 m_ptr->max_maxhp = m_ptr->maxhp;
6958 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6959 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6965 /* Process the level */
6968 /* Handle "p_ptr->notice" */
6971 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6974 /* Cancel the target */
6977 /* Cancel the health bar */
6981 /* Forget the lite */
6984 /* Forget the view */
6987 /* Forget the view */
6990 /* Handle "quit and save" */
6991 if (!p_ptr->playing && !p_ptr->is_dead) break;
6993 /* Erase the old cave */
6995 if (!p_ptr->is_dead) wipe_m_list();
7003 /* Accidental Death */
7004 if (p_ptr->playing && p_ptr->is_dead)
7006 if (p_ptr->inside_arena)
7008 p_ptr->inside_arena = FALSE;
7009 if(p_ptr->arena_number > MAX_ARENA_MONS)
7010 p_ptr->arena_number++;
7012 p_ptr->arena_number = 99;
7013 p_ptr->is_dead = FALSE;
7015 p_ptr->chp_frac = 0;
7016 p_ptr->exit_bldg = TRUE;
7021 /* Mega-Hack -- Allow player to cheat death */
7023 if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
7025 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7029 /* Mark social class, reset age, if needed */
7030 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7036 p_ptr->noscore |= 0x0001;
7040 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
7042 msg_print("You invoke wizard mode and cheat death.");
7048 /* Restore hit points */
7049 p_ptr->chp = p_ptr->mhp;
7050 p_ptr->chp_frac = 0;
7052 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7054 for (i = 0; i < EATER_EXT*2; i++)
7056 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7058 for (; i < EATER_EXT*3; i++)
7060 p_ptr->magic_num1[i] = 0;
7063 /* Restore spell points */
7064 p_ptr->csp = p_ptr->msp;
7065 p_ptr->csp_frac = 0;
7067 /* Hack -- Healing */
7069 (void)set_confused(0);
7070 (void)set_poisoned(0);
7071 (void)set_afraid(0);
7072 (void)set_paralyzed(0);
7077 /* Hack -- Prevent starvation */
7078 (void)set_food(PY_FOOD_MAX - 1);
7080 /* Hack -- cancel recall */
7081 if (p_ptr->word_recall)
7085 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
7087 msg_print("A tension leaves the air around you...");
7092 /* Hack -- Prevent recall */
7093 p_ptr->word_recall = 0;
7094 p_ptr->redraw |= (PR_STATUS);
7097 /* Hack -- cancel alter */
7098 if (p_ptr->alter_reality)
7100 /* Hack -- Prevent alter */
7101 p_ptr->alter_reality = 0;
7102 p_ptr->redraw |= (PR_STATUS);
7105 /* Note cause of death XXX XXX XXX */
7107 (void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
7109 (void)strcpy(p_ptr->died_from, "Cheating death");
7114 p_ptr->is_dead = FALSE;
7117 p_ptr->inside_arena = FALSE;
7118 p_ptr->inside_battle = FALSE;
7120 p_ptr->inside_quest = 0;
7121 p_ptr->recall_dungeon = dungeon_type;
7123 if (lite_town || vanilla_town)
7125 p_ptr->wilderness_y = 1;
7126 p_ptr->wilderness_x = 1;
7140 p_ptr->wilderness_y = 48;
7141 p_ptr->wilderness_x = 5;
7147 p_ptr->wild_mode = FALSE;
7148 p_ptr->leaving = TRUE;
7151 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " ¤·¤«¤·¡¢À¸¤Ê֤ä¿¡£");
7153 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7159 /* Handle "death" */
7160 if (p_ptr->is_dead) break;
7162 /* Make a new level */
7173 s32b turn_real(s32b hoge)
7175 switch (p_ptr->start_race)
7181 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);